Skip to content

Commit f5b81e0

Browse files
committed
Remove client classes on the server oops
1 parent 199f585 commit f5b81e0

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ yarn_mappings=1.21.1+build.3
77
loader_version=0.16.10
88
fabric_version=0.115.1+1.21.1
99

10-
mod_version=1.0.0-alpha.25
10+
mod_version=1.0.0-alpha.26
1111
maven_group=falseresync.vivatech
1212
archives_base_name=vivatech
1313

src/main/java/falseresync/vivatech/common/item/focus/CometWarpFocusItem.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import falseresync.vivatech.compat.anshar.AnsharCompat;
88
import net.minecraft.block.Blocks;
99
import net.minecraft.block.pattern.CachedBlockPosition;
10-
import net.minecraft.client.network.ClientPlayerEntity;
1110
import net.minecraft.component.DataComponentTypes;
1211
import net.minecraft.entity.EquipmentSlot;
1312
import net.minecraft.entity.player.PlayerEntity;
@@ -64,19 +63,24 @@ public void focusOnUnequipped(ItemStack gadgetStack, ItemStack focusStack, Playe
6463

6564
@Override
6665
public ActionResult focusUseOnBlock(ItemStack gadgetStack, ItemStack focusStack, ItemUsageContext context) {
66+
var world = context.getWorld();
67+
var player = context.getPlayer();
68+
if (player == null) {
69+
return ActionResult.PASS;
70+
}
71+
6772
// Do not override lodestones
6873
var persistentAnchor = gadgetStack.get(VivatechComponents.WARP_FOCUS_PERSISTENT_ANCHOR);
6974
if (persistentAnchor != null && !focusStack.contains(VivatechComponents.WARP_FOCUS_BLOCK_ONLY_MODE)) {
70-
if (context.getPlayer() instanceof ClientPlayerEntity player && player.isSneaking()) {
75+
if (world.isClient && player.isSneaking()) {
7176
reportPermanentlyBound(player, persistentAnchor);
7277
}
7378
return ActionResult.PASS;
7479
}
7580

76-
var world = context.getWorld();
7781
var pos = context.getBlockPos();
7882
if (focusStack.canPlaceOn(new CachedBlockPosition(world, pos, false))) {
79-
if (context.getPlayer() instanceof ServerPlayerEntity player && player.isSneaking()) {
83+
if (!world.isClient && player.isSneaking()) {
8084
if (!Vivatech.getChargeManager().tryExpendGadgetCharge(gadgetStack, DEFAULT_PLACEMENT_COST * PERSISTENT_ANCHOR_COST_COEFFICIENT, player)) {
8185
Reports.insufficientCharge(player);
8286
return ActionResult.FAIL;
@@ -91,7 +95,7 @@ public ActionResult focusUseOnBlock(ItemStack gadgetStack, ItemStack focusStack,
9195

9296
return ActionResult.CONSUME;
9397
} else if (focusStack.contains(VivatechComponents.WARP_FOCUS_BLOCK_ONLY_MODE)) {
94-
if (context.getPlayer() instanceof ClientPlayerEntity player) {
98+
if (world.isClient) {
9599
player.sendMessage(Text.translatable("hud.vivatech.focus.comet_warp.cannot_anchor_here"), true);
96100
}
97101
return ActionResult.FAIL;

0 commit comments

Comments
 (0)