diff options
Diffstat (limited to 'src')
6 files changed, 44 insertions, 26 deletions
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyRegistry.java b/src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyRegistry.java index e0f6e31..ea17bbb 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyRegistry.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/ErisAlchemyRegistry.java | |||
| @@ -8,8 +8,6 @@ import lv.enes.mc.eris_alchemy.menu.AlchemicalChestMenu; | |||
| 8 | import lv.enes.mc.eris_alchemy.menu.EnergyCondenserMenu; | 8 | import lv.enes.mc.eris_alchemy.menu.EnergyCondenserMenu; |
| 9 | import lv.enes.mc.eris_alchemy.recipe.CovalenceRepair; | 9 | import lv.enes.mc.eris_alchemy.recipe.CovalenceRepair; |
| 10 | import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType; | 10 | import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerType; |
| 11 | import net.minecraft.client.renderer.Sheets; | ||
| 12 | import net.minecraft.client.resources.model.Material; | ||
| 13 | import net.minecraft.core.registries.BuiltInRegistries; | 11 | import net.minecraft.core.registries.BuiltInRegistries; |
| 14 | import net.minecraft.resources.ResourceLocation; | 12 | import net.minecraft.resources.ResourceLocation; |
| 15 | import net.minecraft.world.flag.FeatureFlags; | 13 | import net.minecraft.world.flag.FeatureFlags; |
| @@ -125,20 +123,6 @@ public final class ErisAlchemyRegistry { | |||
| 125 | } | 123 | } |
| 126 | } | 124 | } |
| 127 | 125 | ||
| 128 | public static final class Materials { | ||
| 129 | private Materials() {} | ||
| 130 | |||
| 131 | public static final Material ALCHEMICAL_CHEST = new Material( | ||
| 132 | Sheets.CHEST_SHEET, | ||
| 133 | new ResourceLocation(ErisAlchemy.ID, "entity/chest/alchemical_chest") | ||
| 134 | ); | ||
| 135 | |||
| 136 | public static final Material ENERGY_CONDENSER = new Material( | ||
| 137 | Sheets.CHEST_SHEET, | ||
| 138 | new ResourceLocation(ErisAlchemy.ID, "entity/chest/energy_condenser") | ||
| 139 | ); | ||
| 140 | } | ||
| 141 | |||
| 142 | public static final class Menus { | 126 | public static final class Menus { |
| 143 | private Menus() {} | 127 | private Menus() {} |
| 144 | 128 | ||
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/block/entity/AlchemicalChestEntity.java b/src/main/java/lv/enes/mc/eris_alchemy/block/entity/AlchemicalChestEntity.java index 659e4b1..4fff3fa 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/block/entity/AlchemicalChestEntity.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/block/entity/AlchemicalChestEntity.java | |||
| @@ -3,15 +3,17 @@ package lv.enes.mc.eris_alchemy.block.entity; | |||
| 3 | import jakarta.annotation.Nonnull; | 3 | import jakarta.annotation.Nonnull; |
| 4 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.BlockEntities; | 4 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.BlockEntities; |
| 5 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.Blocks; | 5 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.Blocks; |
| 6 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.Materials; | 6 | import lv.enes.mc.eris_alchemy.client.ErisAlchemyClientRegistry.Materials; |
| 7 | import lv.enes.mc.eris_alchemy.menu.AlchemicalChestMenu; | 7 | import lv.enes.mc.eris_alchemy.menu.AlchemicalChestMenu; |
| 8 | import lv.enes.mc.eris_alchemy.menu.ChestLikeMenu; | 8 | import lv.enes.mc.eris_alchemy.menu.ChestLikeMenu; |
| 9 | import net.minecraft.client.resources.model.Material; | ||
| 9 | import net.minecraft.core.BlockPos; | 10 | import net.minecraft.core.BlockPos; |
| 10 | import net.minecraft.core.NonNullList; | 11 | import net.minecraft.core.NonNullList; |
| 11 | import net.minecraft.world.entity.player.Inventory; | 12 | import net.minecraft.world.entity.player.Inventory; |
| 12 | import net.minecraft.world.item.ItemStack; | 13 | import net.minecraft.world.item.ItemStack; |
| 13 | import net.minecraft.world.level.block.Block; | 14 | import net.minecraft.world.level.block.Block; |
| 14 | import net.minecraft.world.level.block.state.BlockState; | 15 | import net.minecraft.world.level.block.state.BlockState; |
| 16 | import org.quiltmc.loader.api.minecraft.ClientOnly; | ||
| 15 | 17 | ||
| 16 | public class AlchemicalChestEntity extends ChestLikeEntity { | 18 | public class AlchemicalChestEntity extends ChestLikeEntity { |
| 17 | private final static int WIDTH = 13; | 19 | private final static int WIDTH = 13; |
| @@ -20,7 +22,7 @@ public class AlchemicalChestEntity extends ChestLikeEntity { | |||
| 20 | private final NonNullList<ItemStack> items = NonNullList.withSize(WIDTH * HEIGHT, ItemStack.EMPTY); | 22 | private final NonNullList<ItemStack> items = NonNullList.withSize(WIDTH * HEIGHT, ItemStack.EMPTY); |
| 21 | 23 | ||
| 22 | public AlchemicalChestEntity(BlockPos pos, BlockState state) { | 24 | public AlchemicalChestEntity(BlockPos pos, BlockState state) { |
| 23 | super(BlockEntities.ALCHEMICAL_CHEST, pos, state, Materials.ALCHEMICAL_CHEST); | 25 | super(BlockEntities.ALCHEMICAL_CHEST, pos, state); |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | @Nonnull | 28 | @Nonnull |
| @@ -35,6 +37,12 @@ public class AlchemicalChestEntity extends ChestLikeEntity { | |||
| 35 | return items; | 37 | return items; |
| 36 | } | 38 | } |
| 37 | 39 | ||
| 40 | @ClientOnly | ||
| 41 | @Nonnull | ||
| 42 | public Material getMaterial() { | ||
| 43 | return Materials.ALCHEMICAL_CHEST; | ||
| 44 | } | ||
| 45 | |||
| 38 | @Nonnull | 46 | @Nonnull |
| 39 | @Override | 47 | @Override |
| 40 | protected Block getParent() { | 48 | protected Block getParent() { |
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/block/entity/ChestLikeEntity.java b/src/main/java/lv/enes/mc/eris_alchemy/block/entity/ChestLikeEntity.java index 8f40d26..09aecc7 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/block/entity/ChestLikeEntity.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/block/entity/ChestLikeEntity.java | |||
| @@ -18,12 +18,11 @@ import net.minecraft.world.level.Level; | |||
| 18 | import net.minecraft.world.level.block.Block; | 18 | import net.minecraft.world.level.block.Block; |
| 19 | import net.minecraft.world.level.block.entity.*; | 19 | import net.minecraft.world.level.block.entity.*; |
| 20 | import net.minecraft.world.level.block.state.BlockState; | 20 | import net.minecraft.world.level.block.state.BlockState; |
| 21 | import org.quiltmc.loader.api.minecraft.ClientOnly; | ||
| 21 | 22 | ||
| 22 | public abstract class ChestLikeEntity extends BaseContainerBlockEntity implements LidBlockEntity { | 23 | public abstract class ChestLikeEntity extends BaseContainerBlockEntity implements LidBlockEntity { |
| 23 | protected static final int EVENT_INTERACTED = 1; | 24 | protected static final int EVENT_INTERACTED = 1; |
| 24 | 25 | ||
| 25 | public final Material material; | ||
| 26 | |||
| 27 | protected final ChestLidController lidController = new ChestLidController(); | 26 | protected final ChestLidController lidController = new ChestLidController(); |
| 28 | protected final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() { | 27 | protected final ContainerOpenersCounter openersCounter = new ContainerOpenersCounter() { |
| 29 | @Override | 28 | @Override |
| @@ -53,16 +52,17 @@ public abstract class ChestLikeEntity extends BaseContainerBlockEntity implement | |||
| 53 | public ChestLikeEntity( | 52 | public ChestLikeEntity( |
| 54 | BlockEntityType<? extends ChestLikeEntity> type, | 53 | BlockEntityType<? extends ChestLikeEntity> type, |
| 55 | BlockPos pos, | 54 | BlockPos pos, |
| 56 | BlockState state, | 55 | BlockState state |
| 57 | Material material | ||
| 58 | ) { | 56 | ) { |
| 59 | super(type, pos, state); | 57 | super(type, pos, state); |
| 60 | this.material = material; | ||
| 61 | } | 58 | } |
| 62 | 59 | ||
| 63 | 60 | ||
| 64 | @Nonnull | 61 | @Nonnull |
| 65 | protected abstract NonNullList<ItemStack> getItems(); | 62 | protected abstract NonNullList<ItemStack> getItems(); |
| 63 | @ClientOnly | ||
| 64 | @Nonnull | ||
| 65 | public abstract Material getMaterial(); | ||
| 66 | @Nonnull | 66 | @Nonnull |
| 67 | protected abstract Block getParent(); | 67 | protected abstract Block getParent(); |
| 68 | 68 | ||
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/block/entity/EnergyCondenserEntity.java b/src/main/java/lv/enes/mc/eris_alchemy/block/entity/EnergyCondenserEntity.java index 432ba6f..33a6250 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/block/entity/EnergyCondenserEntity.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/block/entity/EnergyCondenserEntity.java | |||
| @@ -4,12 +4,13 @@ import jakarta.annotation.Nonnull; | |||
| 4 | import lv.enes.mc.eris_alchemy.Emc; | 4 | import lv.enes.mc.eris_alchemy.Emc; |
| 5 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.BlockEntities; | 5 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.BlockEntities; |
| 6 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.Blocks; | 6 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.Blocks; |
| 7 | import lv.enes.mc.eris_alchemy.ErisAlchemyRegistry.Materials; | 7 | import lv.enes.mc.eris_alchemy.client.ErisAlchemyClientRegistry; |
| 8 | import lv.enes.mc.eris_alchemy.menu.ChestLikeMenu; | 8 | import lv.enes.mc.eris_alchemy.menu.ChestLikeMenu; |
| 9 | import lv.enes.mc.eris_alchemy.menu.EnergyCondenserMenu; | 9 | import lv.enes.mc.eris_alchemy.menu.EnergyCondenserMenu; |
| 10 | import lv.enes.mc.eris_alchemy.utils.ContainerOpenersCounterUtil; | 10 | import lv.enes.mc.eris_alchemy.utils.ContainerOpenersCounterUtil; |
| 11 | import lv.enes.mc.eris_alchemy.utils.SyncedValue.SyncedDouble; | 11 | import lv.enes.mc.eris_alchemy.utils.SyncedValue.SyncedDouble; |
| 12 | import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; | 12 | import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; |
| 13 | import net.minecraft.client.resources.model.Material; | ||
| 13 | import net.minecraft.core.BlockPos; | 14 | import net.minecraft.core.BlockPos; |
| 14 | import net.minecraft.core.NonNullList; | 15 | import net.minecraft.core.NonNullList; |
| 15 | import net.minecraft.nbt.CompoundTag; | 16 | import net.minecraft.nbt.CompoundTag; |
| @@ -20,6 +21,7 @@ import net.minecraft.world.item.ItemStack; | |||
| 20 | import net.minecraft.world.level.Level; | 21 | import net.minecraft.world.level.Level; |
| 21 | import net.minecraft.world.level.block.Block; | 22 | import net.minecraft.world.level.block.Block; |
| 22 | import net.minecraft.world.level.block.state.BlockState; | 23 | import net.minecraft.world.level.block.state.BlockState; |
| 24 | import org.quiltmc.loader.api.minecraft.ClientOnly; | ||
| 23 | 25 | ||
| 24 | import java.util.stream.IntStream; | 26 | import java.util.stream.IntStream; |
| 25 | 27 | ||
| @@ -32,7 +34,7 @@ public class EnergyCondenserEntity extends ChestLikeEntity implements ExtendedSc | |||
| 32 | public final SyncedDouble storedEmc = new SyncedDouble(0); | 34 | public final SyncedDouble storedEmc = new SyncedDouble(0); |
| 33 | 35 | ||
| 34 | public EnergyCondenserEntity(BlockPos pos, BlockState state) { | 36 | public EnergyCondenserEntity(BlockPos pos, BlockState state) { |
| 35 | super(BlockEntities.ENERGY_CONDENSER, pos, state, Materials.ENERGY_CONDENSER); | 37 | super(BlockEntities.ENERGY_CONDENSER, pos, state); |
| 36 | } | 38 | } |
| 37 | 39 | ||
| 38 | @Nonnull | 40 | @Nonnull |
| @@ -47,6 +49,12 @@ public class EnergyCondenserEntity extends ChestLikeEntity implements ExtendedSc | |||
| 47 | return items; | 49 | return items; |
| 48 | } | 50 | } |
| 49 | 51 | ||
| 52 | @ClientOnly | ||
| 53 | @Nonnull | ||
| 54 | public Material getMaterial() { | ||
| 55 | return ErisAlchemyClientRegistry.Materials.ENERGY_CONDENSER; | ||
| 56 | } | ||
| 57 | |||
| 50 | @Nonnull | 58 | @Nonnull |
| 51 | @Override | 59 | @Override |
| 52 | protected Block getParent() { | 60 | protected Block getParent() { |
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/client/ErisAlchemyClientRegistry.java b/src/main/java/lv/enes/mc/eris_alchemy/client/ErisAlchemyClientRegistry.java index 30c6690..c20134a 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/client/ErisAlchemyClientRegistry.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/client/ErisAlchemyClientRegistry.java | |||
| @@ -1,13 +1,17 @@ | |||
| 1 | package lv.enes.mc.eris_alchemy.client; | 1 | package lv.enes.mc.eris_alchemy.client; |
| 2 | 2 | ||
| 3 | import lv.enes.mc.eris_alchemy.ErisAlchemy; | ||
| 3 | import lv.enes.mc.eris_alchemy.block.entity.AlchemicalChestEntity; | 4 | import lv.enes.mc.eris_alchemy.block.entity.AlchemicalChestEntity; |
| 4 | import lv.enes.mc.eris_alchemy.block.entity.EnergyCondenserEntity; | 5 | import lv.enes.mc.eris_alchemy.block.entity.EnergyCondenserEntity; |
| 5 | import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer; | 6 | import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer; |
| 6 | import net.minecraft.client.gui.screens.MenuScreens.ScreenConstructor; | 7 | import net.minecraft.client.gui.screens.MenuScreens.ScreenConstructor; |
| 7 | import net.minecraft.client.gui.screens.Screen; | 8 | import net.minecraft.client.gui.screens.Screen; |
| 8 | import net.minecraft.client.gui.screens.inventory.MenuAccess; | 9 | import net.minecraft.client.gui.screens.inventory.MenuAccess; |
| 10 | import net.minecraft.client.renderer.Sheets; | ||
| 9 | import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; | 11 | import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider; |
| 10 | import net.minecraft.client.renderer.blockentity.ChestRenderer; | 12 | import net.minecraft.client.renderer.blockentity.ChestRenderer; |
| 13 | import net.minecraft.client.resources.model.Material; | ||
| 14 | import net.minecraft.resources.ResourceLocation; | ||
| 11 | import net.minecraft.world.inventory.AbstractContainerMenu; | 15 | import net.minecraft.world.inventory.AbstractContainerMenu; |
| 12 | import net.minecraft.world.inventory.MenuType; | 16 | import net.minecraft.world.inventory.MenuType; |
| 13 | import net.minecraft.world.level.ItemLike; | 17 | import net.minecraft.world.level.ItemLike; |
| @@ -84,6 +88,20 @@ public final class ErisAlchemyClientRegistry { | |||
| 84 | } | 88 | } |
| 85 | } | 89 | } |
| 86 | 90 | ||
| 91 | public static final class Materials { | ||
| 92 | private Materials() {} | ||
| 93 | |||
| 94 | public static final Material ALCHEMICAL_CHEST = new Material( | ||
| 95 | Sheets.CHEST_SHEET, | ||
| 96 | new ResourceLocation(ErisAlchemy.ID, "entity/chest/alchemical_chest") | ||
| 97 | ); | ||
| 98 | |||
| 99 | public static final Material ENERGY_CONDENSER = new Material( | ||
| 100 | Sheets.CHEST_SHEET, | ||
| 101 | new ResourceLocation(ErisAlchemy.ID, "entity/chest/energy_condenser") | ||
| 102 | ); | ||
| 103 | } | ||
| 104 | |||
| 87 | public static final class MenuScreens { | 105 | public static final class MenuScreens { |
| 88 | private MenuScreens() {} | 106 | private MenuScreens() {} |
| 89 | 107 | ||
diff --git a/src/main/java/lv/enes/mc/eris_alchemy/mixin/client/SheetsMixin.java b/src/main/java/lv/enes/mc/eris_alchemy/mixin/client/SheetsMixin.java index bc9e7b8..1f32d53 100644 --- a/src/main/java/lv/enes/mc/eris_alchemy/mixin/client/SheetsMixin.java +++ b/src/main/java/lv/enes/mc/eris_alchemy/mixin/client/SheetsMixin.java | |||
| @@ -24,7 +24,7 @@ public abstract class SheetsMixin { | |||
| 24 | CallbackInfoReturnable<Material> cir | 24 | CallbackInfoReturnable<Material> cir |
| 25 | ) { | 25 | ) { |
| 26 | if (entity instanceof ChestLikeEntity chestlike) { | 26 | if (entity instanceof ChestLikeEntity chestlike) { |
| 27 | cir.setReturnValue(chestlike.material); | 27 | cir.setReturnValue(chestlike.getMaterial()); |
| 28 | } | 28 | } |
| 29 | } | 29 | } |
| 30 | } | 30 | } |