Skip to content

Commit

Permalink
Fix #104
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Sep 4, 2024
1 parent 5572cbb commit b01c455
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,20 +90,4 @@ public static void onPlayerJoin(ServerPlayer player) {
}
}
}

@MultiLoaderEvent
public static InteractionResult onUseBlock(Player player, Level level, InteractionHand hand, BlockHitResult hitResult) {
BlockPos pos = hitResult.getBlockPos();
BlockState state = level.getBlockState(pos);

boolean offhandFix = !level.isClientSide()
&& !player.getOffhandItem().isEmpty()
&& !(player.getOffhandItem().getItem() instanceof BlockItem) &&
hand.equals(InteractionHand.MAIN_HAND);
if ((offhandFix || player.isShiftKeyDown()) && state.getBlock() instanceof VendorBlock vb) {
return vb.use(state, level, pos, player, hand, hitResult);
}

return InteractionResult.PASS;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@
public class NumismaticsBlockEntities {
private static final CreateRegistrate REGISTRATE = Numismatics.registrate();

/* public static final BlockEntityEntry<SemaphoreBlockEntity> SEMAPHORE = REGISTRATE.blockEntity("semaphore", SemaphoreBlockEntity::new)
.validBlocks(CRBlocks.SEMAPHORE)
.renderer(() -> SemaphoreRenderer::new)
.register();*/

public static final BlockEntityEntry<AndesiteDepositorBlockEntity> ANDESITE_DEPOSITOR = REGISTRATE.blockEntity("andesite_depositor", AndesiteDepositorBlockEntity::new)
.validBlocks(NumismaticsBlocks.ANDESITE_DEPOSITOR)
.register();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,5 @@ public static void init() {
ServerWorldEvents.LOAD.register((server, level) -> CommonEvents.onLoadWorld(level));
PlayerBlockBreakEvents.BEFORE.register((level, player, pos, state, entity) -> CommonEvents.onBlockBreak(level, pos, state, player));
ServerPlayConnectionEvents.JOIN.register((connection, packetSender, server) -> CommonEvents.onPlayerJoin(connection.player));
UseBlockCallback.EVENT.register((player, world, hand, hitResult) -> CommonEvents.onUseBlock(player, world, hand, hitResult));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,4 @@ public static void onPlayerJoin(PlayerEvent.PlayerLoggedInEvent event) {
if (event.getEntity() instanceof ServerPlayer serverPlayer)
CommonEvents.onPlayerJoin(serverPlayer);
}

@SubscribeEvent
public static void onRightClickBlock(PlayerInteractEvent.RightClickBlock event) {
CommonEvents.onUseBlock(event.getEntity(), event.getLevel(), event.getHand(), event.getHitVec());
}
}

0 comments on commit b01c455

Please sign in to comment.