Skip to content

Commit

Permalink
Revert "change: block.hopper: simplify inventory accessor mixin"
Browse files Browse the repository at this point in the history
This reverts commit 9f3e85b
  • Loading branch information
2No2Name committed Dec 4, 2022
1 parent 069d920 commit 9574403
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,53 +1,86 @@
package me.jellysquid.mods.lithium.mixin.block.hopper;

import me.jellysquid.mods.lithium.api.inventory.LithiumInventory;
import net.minecraft.block.entity.AbstractFurnaceBlockEntity;
import net.minecraft.block.entity.BrewingStandBlockEntity;
import net.minecraft.block.entity.LootableContainerBlockEntity;
import net.minecraft.block.entity.*;
import net.minecraft.entity.vehicle.StorageMinecartEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.gen.Accessor;

public class InventoryAccessors {
@Mixin(LootableContainerBlockEntity.class)
public abstract static class InventoryAccessorLootableContainerBlockEntity implements LithiumInventory {
@Shadow
protected abstract DefaultedList<ItemStack> getInvStackList();
@Mixin(AbstractFurnaceBlockEntity.class)
public abstract static class InventoryAccessorAbstractFurnaceBlockEntity implements LithiumInventory {
@Accessor("inventory")
public abstract DefaultedList<ItemStack> getInventoryLithium();

@Shadow
protected abstract void setInvStackList(DefaultedList<ItemStack> list);
@Accessor("inventory")
public abstract void setInventoryLithium(DefaultedList<ItemStack> inventory);
}

@Mixin(BarrelBlockEntity.class)
public abstract static class InventoryAccessorBarrelBlockEntity implements LithiumInventory {
@Override
public DefaultedList<ItemStack> getInventoryLithium() {
return this.getInvStackList();
}
@Accessor("inventory")
public abstract DefaultedList<ItemStack> getInventoryLithium();

@Override
public void setInventoryLithium(DefaultedList<ItemStack> inventory) {
this.setInvStackList(inventory);
}
@Accessor("inventory")
public abstract void setInventoryLithium(DefaultedList<ItemStack> inventory);
}

@Mixin(AbstractFurnaceBlockEntity.class)
public abstract static class InventoryAccessorAbstractFurnaceBlockEntity implements LithiumInventory {
@Accessor("inventory" )
@Mixin(BrewingStandBlockEntity.class)
public abstract static class InventoryAccessorBrewingStandBlockEntity implements LithiumInventory {
@Override
@Accessor("inventory")
public abstract DefaultedList<ItemStack> getInventoryLithium();

@Accessor("inventory" )
@Override
@Accessor("inventory")
public abstract void setInventoryLithium(DefaultedList<ItemStack> inventory);
}

@Mixin(BrewingStandBlockEntity.class)
public abstract static class InventoryAccessorBrewingStandBlockEntity implements LithiumInventory {
@Mixin(ChestBlockEntity.class)
public abstract static class InventoryAccessorChestBlockEntity implements LithiumInventory {
@Override
@Accessor("inventory")
public abstract DefaultedList<ItemStack> getInventoryLithium();

@Override
@Accessor("inventory" )
@Accessor("inventory")
public abstract void setInventoryLithium(DefaultedList<ItemStack> inventory);
}

@Mixin(DispenserBlockEntity.class)
public abstract static class InventoryAccessorDispenserBlockEntity implements LithiumInventory {
@Override
@Accessor("inventory")
public abstract DefaultedList<ItemStack> getInventoryLithium();

@Override
@Accessor("inventory" )
@Accessor("inventory")
public abstract void setInventoryLithium(DefaultedList<ItemStack> inventory);
}

@Mixin(HopperBlockEntity.class)
public abstract static class InventoryAccessorHopperBlockEntity implements LithiumInventory {
@Override
@Accessor("inventory")
public abstract DefaultedList<ItemStack> getInventoryLithium();

@Override
@Accessor("inventory")
public abstract void setInventoryLithium(DefaultedList<ItemStack> inventory);
}

@Mixin(ShulkerBoxBlockEntity.class)
public abstract static class InventoryAccessorShulkerBoxBlockEntity implements LithiumInventory {
@Override
@Accessor("inventory")
public abstract DefaultedList<ItemStack> getInventoryLithium();

@Override
@Accessor("inventory")
public abstract void setInventoryLithium(DefaultedList<ItemStack> inventory);
}

Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/lithium.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,12 @@
"block.hopper.HopperBlockEntityMixin",
"block.hopper.HopperBlockMixin",
"block.hopper.InventoryAccessors$InventoryAccessorAbstractFurnaceBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorBarrelBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorBrewingStandBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorLootableContainerBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorChestBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorDispenserBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorHopperBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorShulkerBoxBlockEntity",
"block.hopper.InventoryAccessors$InventoryAccessorStorageMinecartEntity",
"block.hopper.ItemStackMixin",
"block.hopper.ScreenHandlerMixin",
Expand Down

0 comments on commit 9574403

Please sign in to comment.