Skip to content
This repository has been archived by the owner on Sep 30, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/build.yml
#	gradle.properties
#	src/main/java/wraith/waystones/block/WaystoneBlockEntity.java
#	src/main/java/wraith/waystones/client/WaystonesClient.java
#	src/main/java/wraith/waystones/item/LocalVoidItem.java
#	src/main/java/wraith/waystones/registry/WaystonesModelProviderRegistry.java
#	src/main/java/wraith/waystones/util/WaystonePacketHandler.java
  • Loading branch information
Patbox committed May 16, 2022
2 parents 1baf8f3 + 2a3dcee commit dca80bc
Show file tree
Hide file tree
Showing 33 changed files with 629 additions and 636 deletions.
131 changes: 131 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
name: Bug report
description: Create a report to help us improve
title: '[Bug]: '
labels: bug
assignees: 'LordDeatHunter'
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report!
- type: checkboxes
attributes:
label: Is there an existing issue for this?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
validations:
required: true
- type: textarea
id: description
attributes:
label: Description
description: Describe the bug.
placeholder: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
id: stepsToReproduce
attributes:
label: To Reproduce
description: Steps to reproduce the behavior. Please also include a list of other mods/modpacks installed.
placeholder: |
1. In this environment...
2. With this config...
3. Run '...'
4. See error...
validations:
required: true
- type: textarea
id: expectedBehaviour
attributes:
label: Expected behavior
description: Expected behavior
placeholder: A clear and concise description of what you expected to happen.
validations:
required: true
- type: dropdown
id: modVersion
attributes:
label: Mod Version
description: "Please select the used version of 'Fabric Waystones'."
options:
- "v2.5.0"
- "v2.4.1"
- "v2.4.0"
- "v2.3.5"
- "v2.3.4"
- "v2.3.3"
- "v2.3.2"
- "v2.3.1"
- "v2.3.0-beta"
- "v2.2.3"
- "v2.2.2"
- "v2.2.1"
- "v2.2.0"
- "v2.1.3"
- "v2.1.2"
- "v2.1.1"
- "v2.1.0"
- "v2.0.4"
- "v2.0.4-beta"
- "v2.0.3"
- "v2.0.2"
- "v2.0.1"
- "v2.0.0"
validations:
required: true
- type: dropdown
id: minecraftVersion
attributes:
label: Minecraft Version
description: "Please select the used version of 'Minecraft'."
options:
- "1.19"
- "1.18.2"
- "1.18.1"
- "1.18"
- "1.18-snapshot"
- "1.17.1"
- "1.16.5"
- "Other"
validations:
required: true
- type: dropdown
id: javaVersion
attributes:
label: Java Version
description: "Please select the used version of 'Java'."
options:
- "Java 18"
- "Java 17"
- "Java 16"
- "Other"
validations:
required: true
- type: textarea
id: fabricVersion
attributes:
label: Fabric Version
description: "Please enter the used version of 'Fabric' and 'Fabric API'."
value: |
- **Fabric:** ex. 0.12.5-1-17-1
- **Fabric API:** ex. 0.42.1+1.17
validations:
required: false
- type: textarea
id: logs
attributes:
label: Relevant log output
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
render: shell
- type: textarea
id: anythingElse
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
42 changes: 42 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Feature request
description: Suggest an idea for this project
title: '[Feature]: '
labels: enhancement
assignees: 'LordDeatHunter'
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
- type: textarea
id: description
attributes:
label: Description
description: Is your feature request related to a problem? Please describe.
placeholder: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
validations:
required: true
- type: textarea
id: solution
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
id: alternatives
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: true
- type: textarea
id: anythingElse
attributes:
label: Anything else?
description: |
Links? References? Anything that will give us more context about the feature you are requesting!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.1
yarn_mappings=1.18.2+build.3
loader_version=0.13.3
# Mod Properties
mod_version=2.5.0
mod_version=2.5.1

maven_group=eu.pb4.polymer-ports
archives_base_name=wraith-waystones
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.47.8+1.18.2

sub_version=1
fabric_version=0.51.1+1.18.2

sub_version=0
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package wraith.waystones.access;

public interface StructurePoolBasedGenerator_StructurePoolGeneratorAccess {

void setMaxWaystoneCount(int maxWaystoneCount);

}
21 changes: 9 additions & 12 deletions src/main/java/wraith/waystones/block/WaystoneBlockEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,17 @@ public BlockPos way_getPos() {

@Override
public String getWorldName() {
return Utils.getDimensionName(world);
return world == null ? "" : Utils.getDimensionName(world);
}

public boolean canAccess(PlayerEntity player) {
return player.squaredDistanceTo((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D;
}

public boolean teleportPlayer(PlayerEntity player, boolean takeCost) {
return teleportPlayer(player, takeCost, null);
}
public boolean teleportPlayer(PlayerEntity player, boolean takeCost, TeleportSources source) {
if (!(player instanceof ServerPlayerEntity playerEntity)) {
return false;
}
Expand Down Expand Up @@ -356,16 +359,9 @@ public boolean teleportPlayer(PlayerEntity player, boolean takeCost) {
fYaw,
0
);
TeleportSources source = null;
if (playerEntity.currentScreenHandler instanceof VirtualScreenHandlerInterface vs && vs.getGui() instanceof UniversalWaystoneGui gui) {
source = gui.getSource();
} else {
for (var hand : Hand.values()) {
if (playerEntity.getStackInHand(hand).getItem() instanceof LocalVoidItem) {
source = TeleportSources.LOCAL_VOID;
break;
}
}

if (source == null) {
source = Utils.getTeleportSource(playerEntity);
}
if (source == null) {
return false;
Expand All @@ -389,7 +385,7 @@ public boolean teleportPlayer(PlayerEntity player, boolean takeCost) {
private boolean doTeleport(ServerPlayerEntity player, ServerWorld world, TeleportTarget target, TeleportSources source, boolean takeCost) {
var playerAccess = (PlayerEntityMixinAccess) player;
var cooldown = playerAccess.getTeleportCooldown();
if (cooldown > 0) {
if (source != TeleportSources.VOID_TOTEM && cooldown > 0) {
var cooldownSeconds = Utils.df.format(cooldown / 20F);
player.sendMessage(new TranslatableText(
"waystones.no_teleport_message.cooldown",
Expand All @@ -406,6 +402,7 @@ private boolean doTeleport(ServerPlayerEntity player, ServerWorld world, Telepor
case WAYSTONE -> Config.getInstance().getCooldownFromWaystone();
case ABYSS_WATCHER -> Config.getInstance().getCooldownFromAbyssWatcher();
case LOCAL_VOID -> Config.getInstance().getCooldownFromLocalVoid();
case VOID_TOTEM -> Config.getInstance().getCooldownFromVoidTotem();
case POCKET_WORMHOLE -> Config.getInstance().getCooldownFromPocketWormhole();
});
var oldPos = player.getBlockPos();
Expand Down
43 changes: 26 additions & 17 deletions src/main/java/wraith/waystones/item/LocalVoidItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,25 @@ public LocalVoidItem(Settings settings) {
super(settings);
}

protected boolean canTeleport = true;
protected String translationName = "local_void";

@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand hand) {
ItemStack stack = user.getStackInHand(hand);
NbtCompound tag = stack.getNbt();
if (tag == null || !tag.contains("waystone")) {
return TypedActionResult.fail(stack);
return canTeleport ? TypedActionResult.pass(stack) : TypedActionResult.fail(stack);
}
if (user.isSneaking()) {
stack.removeSubNbt("waystone");
} else {
} else if (canTeleport) {
String hash = tag.getString("waystone");
if (Waystones.WAYSTONE_STORAGE != null) {
WaystoneBlockEntity waystone = Waystones.WAYSTONE_STORAGE.getWaystoneEntity(hash);
if (waystone != null && waystone.teleportPlayer(user, Config.getInstance().doLocalVoidsUseCost()) && !user.isCreative() && Config.getInstance().consumeLocalVoid()) {
if (waystone == null) {
stack.removeSubNbt("waystone");
} else if (waystone.teleportPlayer(user, Config.getInstance().doLocalVoidsUseCost()) && !user.isCreative() && Config.getInstance().consumeLocalVoid()) {
stack.decrement(1);
}
}
Expand Down Expand Up @@ -73,28 +78,32 @@ public ActionResult useOnBlock(ItemUsageContext context) {
public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> tooltip, TooltipContext context) {
super.appendTooltip(stack, world, tooltip, context);
String name = null;
NbtCompound tag = stack.getNbt();
boolean invalid = false;
if (tag == null || !tag.contains("waystone")) {
invalid = true;
} else {
name = Waystones.WAYSTONE_STORAGE.getName(tag.getString("waystone"));
if (name == null) {
invalid = true;
}
}
if (invalid) {
tooltip.add(new TranslatableText("waystones.local_void.empty_tooltip"));

var hash = getBoundWaystone(stack);
if (hash != null) name = Waystones.WAYSTONE_STORAGE.getName(hash);
if (name == null) {
tooltip.add(new TranslatableText("waystones." + translationName + ".empty_tooltip"));
return;
}
tooltip.add(new TranslatableText(
"waystones.local_void.tooltip",
"waystones." + translationName + ".tooltip",
new LiteralText(name).styled(style ->
style.withColor(TextColor.parse(new TranslatableText("waystones.local_void.tooltip.arg_color").getString()))
style.withColor(TextColor.parse(new TranslatableText("waystones." + translationName + ".tooltip.arg_color").getString()))
)
));
}

public static String getBoundWaystone(ItemStack stack) {
if (!(stack.getItem() instanceof LocalVoidItem)) {
return null;
}
NbtCompound tag = stack.getNbt();
if (tag == null || !tag.contains("waystone")) {
return null;
}
return tag.getString("waystone");
}


@Override
public Item getPolymerItem(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/wraith/waystones/item/VoidTotem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package wraith.waystones.item;

public class VoidTotem extends LocalVoidItem {

public VoidTotem(Settings settings) {
super(settings);
this.canTeleport = false;
this.translationName = "void_totem";
}

}
Loading

0 comments on commit dca80bc

Please sign in to comment.