From 6eac4e4d29c7e0bff482a68112df792653a69155 Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Sun, 30 Jun 2024 13:17:50 +0200 Subject: [PATCH] fix: Fix hopper not extracting from auto compressor #363 --- .../entity/AutoCompressorBlockEntity.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/shared/src/main/java/net/blay09/mods/excompressum/block/entity/AutoCompressorBlockEntity.java b/shared/src/main/java/net/blay09/mods/excompressum/block/entity/AutoCompressorBlockEntity.java index 5c7e7f70..e14ccdb0 100644 --- a/shared/src/main/java/net/blay09/mods/excompressum/block/entity/AutoCompressorBlockEntity.java +++ b/shared/src/main/java/net/blay09/mods/excompressum/block/entity/AutoCompressorBlockEntity.java @@ -14,6 +14,7 @@ import net.blay09.mods.excompressum.registry.ExRegistries; import net.blay09.mods.excompressum.registry.compressor.CompressedRecipe; import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; import net.minecraft.core.NonNullList; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; @@ -82,7 +83,7 @@ public int get(int id) { return (int) (100f * AutoCompressorBlockEntity.this.getProgress()); } else if (id == 1) { return AutoCompressorBlockEntity.this.getEnergyStorage().getEnergy(); - } else if (id == 2) { + } else if (id == 2) { return AutoCompressorBlockEntity.this.isDisabledByRedstone() ? 1 : 0; } return 0; @@ -90,10 +91,10 @@ public int get(int id) { public void set(int id, int value) { if (id == 0) { - AutoCompressorBlockEntity.this.setProgress( value / 100f); + AutoCompressorBlockEntity.this.setProgress(value / 100f); } else if (id == 1) { AutoCompressorBlockEntity.this.getEnergyStorage().setEnergy(value); - } else if (id == 2) { + } else if (id == 2) { AutoCompressorBlockEntity.this.setDisabledByRedstone(value == 1); } } @@ -190,7 +191,11 @@ public void serverTick() { if (compressedRecipe != null) { ItemStack resultStack = compressedRecipe.getResultStack().copy(); if (!addItemToOutput(resultStack)) { - ItemEntity entityItem = new ItemEntity(level, worldPosition.getX() + 0.5, worldPosition.getY() + 1.5, worldPosition.getZ() + 0.5, resultStack); + ItemEntity entityItem = new ItemEntity(level, + worldPosition.getX() + 0.5, + worldPosition.getY() + 1.5, + worldPosition.getZ() + 0.5, + resultStack); double motion = 0.05; entityItem.setDeltaMovement(level.random.nextGaussian() * motion, 0.2, level.random.nextGaussian() * motion); level.addFreshEntity(entityItem); @@ -301,6 +306,15 @@ public Container getContainer() { return container; } + @Override + public Container getContainer(Direction side) { + if (side == Direction.DOWN) { + return outputSlots; + } + + return BalmContainerProvider.super.getContainer(side); + } + @Override public EnergyStorage getEnergyStorage() { return energyStorage;