Skip to content

Commit

Permalink
fix for broken interactions when disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
gnembon committed Nov 23, 2020
1 parent 8c0dbaf commit 2c62ea9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'fabric-loom' version '0.5-SNAPSHOT'
id 'maven-publish'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,16 @@ public BlockEntity createBlockEntity(BlockView var1)
@Inject(method = "onUse", at = @At("HEAD"), cancellable = true)
private void onActivateActionResult(BlockState blockState_1, World world_1, BlockPos blockPos_1, PlayerEntity playerEntity_1, Hand hand_1, BlockHitResult blockHitResult_1, CallbackInfoReturnable<ActionResult> cir)
{
if (!hasBlockEntity()) return;
if (!AutoCraftingTableSettings.autoCraftingTable) return;
if (!world_1.isClient) {
BlockEntity blockEntity = world_1.getBlockEntity(blockPos_1);
if (blockEntity instanceof CraftingTableBlockEntity) {
playerEntity_1.openHandledScreen((NamedScreenHandlerFactory) blockEntity);
}
else
{
return;
}
}
playerEntity_1.incrementStat(Stats.INTERACT_WITH_CRAFTING_TABLE);
cir.setReturnValue(ActionResult.SUCCESS);
Expand All @@ -58,12 +62,12 @@ private void onActivateActionResult(BlockState blockState_1, World world_1, Bloc

@Override
public boolean hasComparatorOutput(BlockState blockState) {
return hasBlockEntity();
return AutoCraftingTableSettings.autoCraftingTable;
}

@Override
public int getComparatorOutput(BlockState blockState, World world, BlockPos pos) {
if (!hasBlockEntity()) return 0;
if (!AutoCraftingTableSettings.autoCraftingTable) return 0;
BlockEntity blockEntity = world.getBlockEntity(pos);
if (blockEntity instanceof CraftingTableBlockEntity) {
CraftingTableBlockEntity craftingTableBlockEntity = (CraftingTableBlockEntity) blockEntity;
Expand Down

0 comments on commit 2c62ea9

Please sign in to comment.