Make hoppers use the getter for HopperCounter in their mixin

And very minor cleanup in it
This commit is contained in:
altrisi authored and GitHub committed 2023-04-22 20:41:12 +02:00
1 parent 66d906b8ae
commit f1205a4251
1 file changed
+4 -4
@@ -40,17 +40,17 @@ public abstract class HopperBlockEntity_counterMixin extends RandomizableContain
private static void onInsert(Level world, BlockPos blockPos, BlockState blockState, Container inventory, CallbackInfoReturnable<Boolean> cir) private static void onInsert(Level world, BlockPos blockPos, BlockState blockState, Container inventory, CallbackInfoReturnable<Boolean> cir)
{ {
if (CarpetSettings.hopperCounters) { if (CarpetSettings.hopperCounters) {
DyeColor wool_color = WoolTool.getWoolColorAtPosition( DyeColor woolColor = WoolTool.getWoolColorAtPosition(
world, world,
blockPos.relative(blockState.getValue(HopperBlock.FACING))); // offset blockPos.relative(blockState.getValue(HopperBlock.FACING)));
if (wool_color != null) if (woolColor != null)
{ {
for (int i = 0; i < inventory.getContainerSize(); ++i) for (int i = 0; i < inventory.getContainerSize(); ++i)
{ {
if (!inventory.getItem(i).isEmpty()) if (!inventory.getItem(i).isEmpty())
{ {
ItemStack itemstack = inventory.getItem(i);//.copy(); ItemStack itemstack = inventory.getItem(i);//.copy();
HopperCounter.COUNTERS.get(wool_color).add(world.getServer(), itemstack); HopperCounter.getCounter(woolColor).add(world.getServer(), itemstack);
inventory.setItem(i, ItemStack.EMPTY); inventory.setItem(i, ItemStack.EMPTY);
} }
} }