diff --git a/gradle.properties b/gradle.properties index 2c608f99..d4a8062e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -44,4 +44,4 @@ org.gradle.daemon=false org.gradle.caching=true # Common dependencies -cyclopscore_version=1.24.0-620 +cyclopscore_version=1.24.0-621 diff --git a/loader-common/src/main/java/org/cyclops/colossalchests/block/ChestWall.java b/loader-common/src/main/java/org/cyclops/colossalchests/block/ChestWall.java index d9ccb97f..36ab48cf 100644 --- a/loader-common/src/main/java/org/cyclops/colossalchests/block/ChestWall.java +++ b/loader-common/src/main/java/org/cyclops/colossalchests/block/ChestWall.java @@ -7,11 +7,13 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelWriter; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.StateDefinition; @@ -123,4 +125,19 @@ public boolean canSurvive(BlockState blockState, LevelReader world, BlockPos blo return super.canSurvive(blockState, world, blockPos) && ColossalChest.canPlace(world, blockPos); } + public void onBlockExplodedCommon(BlockState state, Level world, BlockPos pos, Explosion explosion) { + if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); + // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); + wasExploded(world, pos, explosion); + } + + @Override + public float getExplosionResistance() { + if (this.material.isExplosionResistant()) { + return 10000F; + } + return 0; + } + } diff --git a/loader-common/src/main/java/org/cyclops/colossalchests/block/ColossalChest.java b/loader-common/src/main/java/org/cyclops/colossalchests/block/ColossalChest.java index 63c3dea1..b4c1699c 100644 --- a/loader-common/src/main/java/org/cyclops/colossalchests/block/ColossalChest.java +++ b/loader-common/src/main/java/org/cyclops/colossalchests/block/ColossalChest.java @@ -21,12 +21,14 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelWriter; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityTicker; @@ -45,6 +47,7 @@ import org.cyclops.cyclopscore.block.multi.DetectionResult; import org.cyclops.cyclopscore.blockentity.CyclopsBlockEntityCommon; import org.cyclops.cyclopscore.datastructure.Wrapper; +import org.cyclops.cyclopscore.helper.IBlockEntityHelpers; import org.cyclops.cyclopscore.helper.IModHelpers; import org.cyclops.cyclopscore.inventory.SimpleInventoryCommon; import org.spongepowered.asm.mixin.Interface; @@ -253,7 +256,10 @@ public static void addPlayerChatError(Player player, Component error) { @Override public void writeExtraGuiData(FriendlyByteBuf packetBuffer, Level world, Player player, BlockPos blockPos, BlockHitResult rayTraceResult) { - IModHelpers.get().getBlockEntityHelpers().get(world, blockPos, BlockEntityColossalChest.class).ifPresent(tile -> packetBuffer.writeInt(tile.getInventory().getContainerSize())); + IBlockEntityHelpers blockEntityHelpers = IModHelpers.get().getBlockEntityHelpers(); + blockEntityHelpers.setUnsafeBlockEntityGetter(true); // Required for Fabric as this is called on the network thread + blockEntityHelpers.get(world, blockPos, BlockEntityColossalChest.class).ifPresent(tile -> packetBuffer.writeInt(tile.getInventory().getContainerSize())); + blockEntityHelpers.setUnsafeBlockEntityGetter(false); // Required for Fabric as this is called on the network thread } @Override @@ -289,6 +295,21 @@ public void onRemove(BlockState oldState, Level world, BlockPos blockPos, BlockS } } + public void onBlockExplodedCommon(BlockState state, Level world, BlockPos pos, Explosion explosion) { + if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); + // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); + wasExploded(world, pos, explosion); + } + + @Override + public float getExplosionResistance() { + if (this.material.isExplosionResistant()) { + return 10000F; + } + return 0; + } + private static class MaterialValidationAction implements CubeDetector.IValidationAction { private final Wrapper requiredMaterial; diff --git a/loader-common/src/main/java/org/cyclops/colossalchests/block/Interface.java b/loader-common/src/main/java/org/cyclops/colossalchests/block/Interface.java index a3f1ec1b..422818dd 100644 --- a/loader-common/src/main/java/org/cyclops/colossalchests/block/Interface.java +++ b/loader-common/src/main/java/org/cyclops/colossalchests/block/Interface.java @@ -8,12 +8,14 @@ import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.BlockGetter; +import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LevelReader; import net.minecraft.world.level.LevelWriter; import net.minecraft.world.level.block.BaseEntityBlock; import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.RenderShape; import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockState; @@ -127,6 +129,21 @@ public void onDetect(LevelReader world, BlockPos location, Vec3i size, boolean v } } + public void onBlockExplodedCommon(BlockState state, Level world, BlockPos pos, Explosion explosion) { + if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); + // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); + world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); + wasExploded(world, pos, explosion); + } + + @Override + public float getExplosionResistance() { + if (this.material.isExplosionResistant()) { + return 10000F; + } + return 0; + } + @Override public InteractionResult useWithoutItem(BlockState blockState, Level world, BlockPos blockPos, Player player, BlockHitResult rayTraceResult) { if(blockState.getValue(ENABLED)) { diff --git a/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityColossalChestConfig.java b/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityColossalChestConfig.java index d1102537..68610e16 100644 --- a/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityColossalChestConfig.java +++ b/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityColossalChestConfig.java @@ -36,8 +36,8 @@ protected BlockEntityRendererProvider getBlockEntityRe } @Override - public void onRegistered() { - super.onRegistered(); + public void onForgeRegistered() { + super.onForgeRegistered(); if (getMod().getModHelpers().getMinecraftHelpers().isClientSide()) { getMod().getProxy().registerRenderer(getInstance(), getBlockEntityRendererProvider()); } diff --git a/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityUncolossalChestConfig.java b/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityUncolossalChestConfig.java index d5671777..7ad634db 100644 --- a/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityUncolossalChestConfig.java +++ b/loader-common/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityUncolossalChestConfig.java @@ -24,8 +24,8 @@ public BlockEntityUncolossalChestConfig(M mod) { } @Override - public void onRegistered() { - super.onRegistered(); + public void onForgeRegistered() { + super.onForgeRegistered(); if (getMod().getModHelpers().getMinecraftHelpers().isClientSide()) { getMod().getProxy().registerRenderer(getInstance(), RenderTileEntityUncolossalChest::new); } diff --git a/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChest.java b/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChest.java index fa06539d..127c12f7 100644 --- a/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChest.java +++ b/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChest.java @@ -1,5 +1,6 @@ package org.cyclops.colossalchests.inventory.container; +import net.minecraft.network.FriendlyByteBuf; import net.minecraft.world.Container; import net.minecraft.world.SimpleContainer; import net.minecraft.world.entity.player.Inventory; @@ -11,7 +12,7 @@ */ public class ContainerUncolossalChest extends InventoryContainerCommon { - public ContainerUncolossalChest(int id, Inventory playerInventory) { + public ContainerUncolossalChest(int id, Inventory playerInventory, FriendlyByteBuf buf) { this(id, playerInventory, new SimpleContainer(5)); } diff --git a/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChestConfig.java b/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChestConfig.java index acd9e825..61dbdb44 100644 --- a/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChestConfig.java +++ b/loader-common/src/main/java/org/cyclops/colossalchests/inventory/container/ContainerUncolossalChestConfig.java @@ -1,10 +1,10 @@ package org.cyclops.colossalchests.inventory.container; import net.minecraft.world.flag.FeatureFlags; -import net.minecraft.world.inventory.MenuType; import org.cyclops.cyclopscore.config.extendedconfig.GuiConfigCommon; import org.cyclops.cyclopscore.config.extendedconfig.GuiConfigScreenFactoryProvider; import org.cyclops.cyclopscore.init.IModBase; +import org.cyclops.cyclopscore.inventory.container.ContainerTypeDataCommon; /** * Config for {@link ContainerUncolossalChest}. @@ -15,7 +15,7 @@ public class ContainerUncolossalChestConfig extends GuiConfi public ContainerUncolossalChestConfig(M mod) { super(mod, "uncolossal_chest", - eConfig -> new MenuType<>(ContainerUncolossalChest::new, FeatureFlags.VANILLA_SET)); + eConfig -> new ContainerTypeDataCommon<>(ContainerUncolossalChest::new, FeatureFlags.VANILLA_SET)); } @Override diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/ColossalChestsFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/ColossalChestsFabric.java new file mode 100644 index 00000000..b409062e --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/ColossalChestsFabric.java @@ -0,0 +1,92 @@ +package org.cyclops.colossalchests; + +import net.fabricmc.api.ModInitializer; +import net.minecraft.world.item.CreativeModeTab; +import net.minecraft.world.item.ItemStack; +import org.cyclops.colossalchests.advancement.criterion.ChestFormedTriggerConfig; +import org.cyclops.colossalchests.block.ChestMaterial; +import org.cyclops.colossalchests.block.ChestWallConfigFabric; +import org.cyclops.colossalchests.block.ColossalChestConfigFabric; +import org.cyclops.colossalchests.block.InterfaceConfigFabric; +import org.cyclops.colossalchests.block.UncolossalChestConfigFabric; +import org.cyclops.colossalchests.blockentity.BlockEntityColossalChestConfigFabric; +import org.cyclops.colossalchests.blockentity.BlockEntityInterfaceConfigFabric; +import org.cyclops.colossalchests.blockentity.BlockEntityUncolossalChestConfigFabric; +import org.cyclops.colossalchests.condition.ConditionMetalVariantsSettingConfig; +import org.cyclops.colossalchests.inventory.container.ContainerColossalChestConfig; +import org.cyclops.colossalchests.inventory.container.ContainerUncolossalChestConfig; +import org.cyclops.colossalchests.item.ItemUpgradeToolConfig; +import org.cyclops.colossalchests.proxy.ClientProxyFabric; +import org.cyclops.colossalchests.proxy.CommonProxyFabric; +import org.cyclops.cyclopscore.config.ConfigHandlerCommon; +import org.cyclops.cyclopscore.init.ModBaseFabric; +import org.cyclops.cyclopscore.proxy.IClientProxyCommon; +import org.cyclops.cyclopscore.proxy.ICommonProxyCommon; + +/** + * The main mod class of ColossalChests. + * @author rubensworks + */ +public class ColossalChestsFabric extends ModBaseFabric implements ModInitializer { + + /** + * The unique instance of this mod. + */ + public static ColossalChestsFabric _instance; + + public ColossalChestsFabric() { + super(Reference.MOD_ID, (instance) -> { + ColossalChestsInstance.MOD = instance; + _instance = instance; + }); + } + + @Override + protected IClientProxyCommon constructClientProxy() { + return new ClientProxyFabric(); + } + + @Override + protected ICommonProxyCommon constructCommonProxy() { + return new CommonProxyFabric(); + } + + @Override + protected boolean hasDefaultCreativeModeTab() { + return true; + } + + @Override + protected CreativeModeTab.Builder constructDefaultCreativeModeTab(CreativeModeTab.Builder builder) { + return super.constructDefaultCreativeModeTab(builder) + .icon(() -> new ItemStack(RegistryEntries.ITEM_CHEST)); + } + + @Override + protected void onConfigsRegister(ConfigHandlerCommon configHandler) { + super.onConfigsRegister(configHandler); + + configHandler.addConfigurable(new GeneralConfig<>(this)); + + for (ChestMaterial material : ChestMaterial.VALUES) { + configHandler.addConfigurable(new ChestWallConfigFabric<>(this, material)); + configHandler.addConfigurable(new ColossalChestConfigFabric<>(this, material)); + configHandler.addConfigurable(new InterfaceConfigFabric<>(this, material)); + } + configHandler.addConfigurable(new UncolossalChestConfigFabric<>(this)); + + configHandler.addConfigurable(new ItemUpgradeToolConfig<>(this, true)); + configHandler.addConfigurable(new ItemUpgradeToolConfig<>(this, false)); + + configHandler.addConfigurable(new BlockEntityColossalChestConfigFabric<>(this)); + configHandler.addConfigurable(new BlockEntityInterfaceConfigFabric<>(this)); + configHandler.addConfigurable(new BlockEntityUncolossalChestConfigFabric<>(this)); + + configHandler.addConfigurable(new ContainerColossalChestConfig<>(this)); + configHandler.addConfigurable(new ContainerUncolossalChestConfig<>(this)); + + configHandler.addConfigurable(new ConditionMetalVariantsSettingConfig()); + + configHandler.addConfigurable(new ChestFormedTriggerConfig<>(this)); + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallConfigFabric.java new file mode 100644 index 00000000..bcd78122 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallConfigFabric.java @@ -0,0 +1,23 @@ +package org.cyclops.colossalchests.block; + +import net.minecraft.world.item.Item; +import org.cyclops.colossalchests.item.ItemBlockMaterial; +import org.cyclops.cyclopscore.init.IModBase; + +/** + * Config for the {@link ChestWall}. + * @author rubensworks + * + */ +public class ChestWallConfigFabric extends ChestWallConfig { + + public ChestWallConfigFabric(M mod, ChestMaterial material) { + super( + mod, + "chest_wall_" + material.getName(), + eConfig -> new ChestWallFabric(((ChestWallConfig) eConfig).getProperties(), material), + (eConfig, block) -> new ItemBlockMaterial(block, new Item.Properties(), material) + ); + } + +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallFabric.java new file mode 100644 index 00000000..fa509a7a --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ChestWallFabric.java @@ -0,0 +1,19 @@ +package org.cyclops.colossalchests.block; + +import net.minecraft.world.level.Level; +import org.cyclops.cyclopscore.events.IBlockExplodedEvent; + +/** + * @author rubensworks + */ +public class ChestWallFabric extends ChestWall { + public ChestWallFabric(Properties properties, ChestMaterial material) { + super(properties, material); + IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> onBlockExplodedCommon(blockState, level, blockPos, explosion)); + } + + @Override + protected boolean isCaptureBlockSnapshots(Level level) { + return false; + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestConfigFabric.java new file mode 100644 index 00000000..78369fd3 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestConfigFabric.java @@ -0,0 +1,23 @@ +package org.cyclops.colossalchests.block; + +import net.minecraft.world.item.Item; +import org.cyclops.colossalchests.item.ItemBlockMaterial; +import org.cyclops.cyclopscore.init.IModBase; + +/** + * Config for the {@link ColossalChest}. + * @author rubensworks + * + */ +public class ColossalChestConfigFabric extends ColossalChestConfig { + + public ColossalChestConfigFabric(M mod, ChestMaterial material) { + super( + mod, + "colossal_chest_" + material.getName(), + eConfig -> new ColossalChestFabric(((ColossalChestConfig) eConfig).getProperties(), material), + (eConfig, block) -> new ItemBlockMaterial(block, new Item.Properties(), material) + ); + } + +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestFabric.java new file mode 100644 index 00000000..ea869884 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/ColossalChestFabric.java @@ -0,0 +1,20 @@ +package org.cyclops.colossalchests.block; + +import net.minecraft.world.level.Level; +import org.cyclops.colossalchests.blockentity.BlockEntityColossalChest; +import org.cyclops.cyclopscore.events.IBlockExplodedEvent; + +/** + * @author rubensworks + */ +public class ColossalChestFabric extends ColossalChest { + public ColossalChestFabric(Properties properties, ChestMaterial material) { + super(properties, material, BlockEntityColossalChest::new); + IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> onBlockExplodedCommon(blockState, level, blockPos, explosion)); + } + + @Override + protected boolean isCaptureBlockSnapshots(Level level) { + return false; + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceConfigFabric.java new file mode 100644 index 00000000..7bc292ba --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceConfigFabric.java @@ -0,0 +1,23 @@ +package org.cyclops.colossalchests.block; + +import net.minecraft.world.item.Item; +import org.cyclops.colossalchests.item.ItemBlockMaterial; +import org.cyclops.cyclopscore.init.IModBase; + +/** + * Config for the {@link Interface}. + * @author rubensworks + * + */ +public class InterfaceConfigFabric extends InterfaceConfig { + + public InterfaceConfigFabric(M mod, ChestMaterial material) { + super( + mod, + "interface_" + material.getName(), + eConfig -> new InterfaceFabric(((InterfaceConfig) eConfig).getProperties(), material), + (eConfig, block) -> new ItemBlockMaterial(block, new Item.Properties(), material) + ); + } + +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceFabric.java new file mode 100644 index 00000000..4b9573ee --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/InterfaceFabric.java @@ -0,0 +1,20 @@ +package org.cyclops.colossalchests.block; + +import net.minecraft.world.level.Level; +import org.cyclops.colossalchests.blockentity.BlockEntityInterface; +import org.cyclops.cyclopscore.events.IBlockExplodedEvent; + +/** + * @author rubensworks + */ +public class InterfaceFabric extends Interface { + public InterfaceFabric(Properties properties, ChestMaterial material) { + super(properties, material, BlockEntityInterface::new); + IBlockExplodedEvent.EVENT.register((blockState, level, blockPos, explosion, biConsumer) -> onBlockExplodedCommon(blockState, level, blockPos, explosion)); + } + + @Override + protected boolean isCaptureBlockSnapshots(Level level) { + return false; + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/block/UncolossalChestConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/UncolossalChestConfigFabric.java new file mode 100644 index 00000000..f832a727 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/block/UncolossalChestConfigFabric.java @@ -0,0 +1,40 @@ +package org.cyclops.colossalchests.block; + +import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; +import net.minecraft.world.item.BlockItem; +import net.minecraft.world.item.Item; +import org.cyclops.colossalchests.client.render.blockentity.ItemStackTileEntityUncolossalChestRenderFabric; +import org.cyclops.cyclopscore.datastructure.Wrapper; +import org.cyclops.cyclopscore.init.ModBaseFabric; + +/** + * Config for the {@link ColossalChest}. + * @author rubensworks + * + */ +public class UncolossalChestConfigFabric extends UncolossalChestConfig { + + public UncolossalChestConfigFabric(M mod) { + super( + mod, + "uncolossal_chest", + eConfig -> new UncolossalChest(((UncolossalChestConfig) eConfig).getProperties()), + (eConfig, block) -> new BlockItem(block, new Item.Properties()) + ); + } + + @Override + public void onForgeRegistered() { + super.onForgeRegistered(); + + if (getMod().getModHelpers().getMinecraftHelpers().isClientSide()) { + Wrapper renderer = new Wrapper<>(); + BuiltinItemRendererRegistry.INSTANCE.register(getItemInstance(), (stack, mode, matrices, vertexConsumers, light, overlay) -> { + if (renderer.get() == null) { + renderer.set(new ItemStackTileEntityUncolossalChestRenderFabric()); + } + renderer.get().renderByItem(stack, mode, matrices, vertexConsumers, light, overlay); + }); + } + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityColossalChestConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityColossalChestConfigFabric.java new file mode 100644 index 00000000..204277f3 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityColossalChestConfigFabric.java @@ -0,0 +1,22 @@ +package org.cyclops.colossalchests.blockentity; + +import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage; +import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage; +import org.cyclops.cyclopscore.init.ModBaseFabric; + +/** + * @author rubensworks + */ +public class BlockEntityColossalChestConfigFabric extends BlockEntityColossalChestConfig { + public BlockEntityColossalChestConfigFabric(M mod) { + super(mod); + } + + @Override + public void onForgeRegistered() { + super.onForgeRegistered(); + // If this would cause performance issues, we could implement a custom Storage instead of InventoryStorage that makes better use of Storage's capabilities. + // If so, also use this in BlockEntityInterfaceConfigFabric + ItemStorage.SIDED.registerForBlockEntity((blockEntity, context) -> InventoryStorage.of(blockEntity.getInventory(), context), getInstance()); + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityInterfaceConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityInterfaceConfigFabric.java new file mode 100644 index 00000000..b4a48bd7 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityInterfaceConfigFabric.java @@ -0,0 +1,26 @@ +package org.cyclops.colossalchests.blockentity; + +import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage; +import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage; +import org.cyclops.cyclopscore.init.ModBaseFabric; + +/** + * @author rubensworks + */ +public class BlockEntityInterfaceConfigFabric extends BlockEntityInterfaceConfig { + public BlockEntityInterfaceConfigFabric(M mod) { + super(mod, BlockEntityInterface::new); + } + + @Override + public void onForgeRegistered() { + super.onForgeRegistered(); + ItemStorage.SIDED.registerForBlockEntity((blockEntity, context) -> { + BlockEntityColossalChest core = blockEntity.getCore(); + if (core != null) { + return InventoryStorage.of(core.getInventory(), context); + } + return null; + }, getInstance()); + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityUncolossalChestConfigFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityUncolossalChestConfigFabric.java new file mode 100644 index 00000000..601df755 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/blockentity/BlockEntityUncolossalChestConfigFabric.java @@ -0,0 +1,20 @@ +package org.cyclops.colossalchests.blockentity; + +import net.fabricmc.fabric.api.transfer.v1.item.InventoryStorage; +import net.fabricmc.fabric.api.transfer.v1.item.ItemStorage; +import org.cyclops.cyclopscore.init.ModBaseFabric; + +/** + * @author rubensworks + */ +public class BlockEntityUncolossalChestConfigFabric extends BlockEntityUncolossalChestConfig { + public BlockEntityUncolossalChestConfigFabric(M mod) { + super(mod); + } + + @Override + public void onForgeRegistered() { + super.onForgeRegistered(); + ItemStorage.SIDED.registerForBlockEntity((blockEntity, context) -> InventoryStorage.of(blockEntity.getInventory(), context), getInstance()); + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/client/render/blockentity/ItemStackTileEntityUncolossalChestRenderFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/client/render/blockentity/ItemStackTileEntityUncolossalChestRenderFabric.java new file mode 100644 index 00000000..feb4c448 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/client/render/blockentity/ItemStackTileEntityUncolossalChestRenderFabric.java @@ -0,0 +1,17 @@ +package org.cyclops.colossalchests.client.render.blockentity; + +import net.minecraft.core.BlockPos; +import org.cyclops.colossalchests.RegistryEntries; +import org.cyclops.colossalchests.blockentity.BlockEntityUncolossalChest; +import org.cyclops.cyclopscore.client.render.blockentity.ItemStackBlockEntityRendererBase; + +/** + * @author rubensworks + */ +public class ItemStackTileEntityUncolossalChestRenderFabric extends ItemStackBlockEntityRendererBase { + + public ItemStackTileEntityUncolossalChestRenderFabric() { + super(() -> new BlockEntityUncolossalChest(BlockPos.ZERO, RegistryEntries.BLOCK_UNCOLOSSAL_CHEST.value().defaultBlockState())); + } + +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/condition/ConditionMetalVariantsSetting.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/condition/ConditionMetalVariantsSetting.java new file mode 100644 index 00000000..3c3fecbc --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/condition/ConditionMetalVariantsSetting.java @@ -0,0 +1,36 @@ +package org.cyclops.colossalchests.condition; + +import com.mojang.serialization.MapCodec; +import com.mojang.serialization.codecs.RecordCodecBuilder; +import net.fabricmc.fabric.api.resource.conditions.v1.ResourceCondition; +import net.fabricmc.fabric.api.resource.conditions.v1.ResourceConditionType; +import net.minecraft.core.HolderLookup; +import net.minecraft.resources.ResourceLocation; +import org.cyclops.colossalchests.GeneralConfig; +import org.cyclops.colossalchests.Reference; +import org.jetbrains.annotations.Nullable; + +/** + * A recipe condition for checking if the {@link GeneralConfig#metalVariants} setting is enabled. + * @author rubensworks + */ +public record ConditionMetalVariantsSetting() implements ResourceCondition { + + public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( + builder -> builder.point(new ConditionMetalVariantsSetting()) + ); + public static final ResourceConditionType TYPE = ResourceConditionType.create( + ResourceLocation.fromNamespaceAndPath(Reference.MOD_ID, "metal_variants_enabled"), + CODEC + ); + + @Override + public ResourceConditionType getType() { + return TYPE; + } + + @Override + public boolean test(@Nullable HolderLookup.Provider registryLookup) { + return GeneralConfig.metalVariants; + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/condition/ConditionMetalVariantsSettingConfig.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/condition/ConditionMetalVariantsSettingConfig.java new file mode 100644 index 00000000..2c0add1b --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/condition/ConditionMetalVariantsSettingConfig.java @@ -0,0 +1,20 @@ +package org.cyclops.colossalchests.condition; + +import org.cyclops.colossalchests.ColossalChestsFabric; +import org.cyclops.cyclopscore.config.extendedconfig.ConditionConfigFabric; + +/** + * Config for the metal variants setting recipe condition. + * @author rubensworks + */ +public class ConditionMetalVariantsSettingConfig extends ConditionConfigFabric { + + public ConditionMetalVariantsSettingConfig() { + super( + ColossalChestsFabric._instance, + "metal_variants_enabled", + ConditionMetalVariantsSetting.TYPE + ); + } + +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/proxy/ClientProxyFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/proxy/ClientProxyFabric.java new file mode 100644 index 00000000..b6bf944f --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/proxy/ClientProxyFabric.java @@ -0,0 +1,23 @@ +package org.cyclops.colossalchests.proxy; + +import org.cyclops.colossalchests.ColossalChestsFabric; +import org.cyclops.cyclopscore.init.ModBaseFabric; +import org.cyclops.cyclopscore.proxy.ClientProxyComponentFabric; + +/** + * Proxy for the client side. + * + * @author rubensworks + * + */ +public class ClientProxyFabric extends ClientProxyComponentFabric { + + public ClientProxyFabric() { + super(new CommonProxyFabric()); + } + + @Override + public ModBaseFabric getMod() { + return ColossalChestsFabric._instance; + } +} diff --git a/loader-fabric/src/main/java/org/cyclops/colossalchests/proxy/CommonProxyFabric.java b/loader-fabric/src/main/java/org/cyclops/colossalchests/proxy/CommonProxyFabric.java new file mode 100644 index 00000000..c9668e51 --- /dev/null +++ b/loader-fabric/src/main/java/org/cyclops/colossalchests/proxy/CommonProxyFabric.java @@ -0,0 +1,32 @@ +package org.cyclops.colossalchests.proxy; + +import org.cyclops.colossalchests.ColossalChestsFabric; +import org.cyclops.colossalchests.network.packet.ClientboundContainerSetContentPacketWindow; +import org.cyclops.colossalchests.network.packet.ClientboundContainerSetSlotPacketLarge; +import org.cyclops.colossalchests.network.packet.ServerboundContainerClickPacketOverride; +import org.cyclops.cyclopscore.init.ModBaseFabric; +import org.cyclops.cyclopscore.network.IPacketHandler; +import org.cyclops.cyclopscore.proxy.CommonProxyComponentFabric; + +/** + * Proxy for server and client side. + * @author rubensworks + * + */ +public class CommonProxyFabric extends CommonProxyComponentFabric { + + @Override + public ModBaseFabric getMod() { + return ColossalChestsFabric._instance; + } + + @Override + public void registerPackets(IPacketHandler packetHandler) { + super.registerPackets(packetHandler); + + // Register packets. + packetHandler.register(ClientboundContainerSetContentPacketWindow.class, ClientboundContainerSetContentPacketWindow.TYPE, ClientboundContainerSetContentPacketWindow.CODEC); + packetHandler.register(ServerboundContainerClickPacketOverride.class, ServerboundContainerClickPacketOverride.TYPE, ServerboundContainerClickPacketOverride.CODEC); + packetHandler.register(ClientboundContainerSetSlotPacketLarge.class, ClientboundContainerSetSlotPacketLarge.TYPE, ClientboundContainerSetSlotPacketLarge.CODEC); + } +} diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_copper.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_copper.json new file mode 100644 index 00000000..92ae6cd1 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_copper.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "III", + "ILI", + "III" + ], + "key": { + "I": { + "tag": "c:ingots/copper" + }, + "L": { + "tag": "minecraft:logs" + } + }, + "result": { + "id": "colossalchests:chest_wall_copper" + }, + "conditions": [ + { + "type": "neoforge:and", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:ingots/copper" + } + }, + { + "type": "colossalchests:metal_variants_enabled" + } + ] + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_diamond.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_diamond.json new file mode 100644 index 00000000..c3e19b4e --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_diamond.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "III", + "ILI", + "III" + ], + "key": { + "I": { + "item": "minecraft:diamond" + }, + "L": { + "tag": "minecraft:logs" + } + }, + "result": { + "id": "colossalchests:chest_wall_diamond" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_gold.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_gold.json new file mode 100644 index 00000000..0fa2efc8 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_gold.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "III", + "ILI", + "III" + ], + "key": { + "I": { + "tag": "c:ingots/gold" + }, + "L": { + "tag": "minecraft:logs" + } + }, + "result": { + "id": "colossalchests:chest_wall_gold" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_iron.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_iron.json new file mode 100644 index 00000000..8a88c670 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_iron.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "III", + "ILI", + "III" + ], + "key": { + "I": { + "tag": "c:ingots/iron" + }, + "L": { + "tag": "minecraft:logs" + } + }, + "result": { + "id": "colossalchests:chest_wall_iron" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_obsidian.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_obsidian.json new file mode 100644 index 00000000..8738d334 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_obsidian.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "PPP", + "PLP", + "PPP" + ], + "key": { + "P": { + "item": "minecraft:obsidian" + }, + "L": { + "tag": "minecraft:logs" + } + }, + "result": { + "id": "colossalchests:chest_wall_obsidian" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_silver.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_silver.json new file mode 100644 index 00000000..74fcab71 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_silver.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "III", + "ILI", + "III" + ], + "key": { + "I": { + "tag": "c:ingots/silver" + }, + "L": { + "tag": "minecraft:logs" + } + }, + "result": { + "id": "colossalchests:chest_wall_silver" + }, + "conditions": [ + { + "type": "neoforge:and", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:ingots/silver" + } + }, + { + "type": "colossalchests:metal_variants_enabled" + } + ] + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_wood.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_wood.json new file mode 100644 index 00000000..29d3384a --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/chest_wall_wood.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + "PPP", + "PLP", + "PPP" + ], + "key": { + "P": { + "tag": "minecraft:planks" + }, + "L": { + "tag": "minecraft:logs" + } + }, + "result": { + "id": "colossalchests:chest_wall_wood" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_copper.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_copper.json new file mode 100644 index 00000000..ca7ddf7c --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_copper.json @@ -0,0 +1,31 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_copper" + }, + { + "tag": "c:ingots/iron" + } + ], + "result": { + "id": "colossalchests:colossal_chest_copper" + }, + "conditions": [ + { + "type": "neoforge:and", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:ingots/copper" + } + }, + { + "type": "colossalchests:metal_variants_enabled" + } + ] + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_diamond.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_diamond.json new file mode 100644 index 00000000..04f22a03 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_diamond.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_diamond" + }, + { + "tag": "c:ingots/iron" + } + ], + "result": { + "id": "colossalchests:colossal_chest_diamond" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_gold.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_gold.json new file mode 100644 index 00000000..702d6238 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_gold.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_gold" + }, + { + "tag": "c:ingots/iron" + } + ], + "result": { + "id": "colossalchests:colossal_chest_gold" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_iron.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_iron.json new file mode 100644 index 00000000..9efe9168 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_iron.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_iron" + }, + { + "tag": "c:ingots/iron" + } + ], + "result": { + "id": "colossalchests:colossal_chest_iron" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_obsidian.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_obsidian.json new file mode 100644 index 00000000..215224b9 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_obsidian.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_obsidian" + }, + { + "tag": "c:ingots/iron" + } + ], + "result": { + "id": "colossalchests:colossal_chest_obsidian" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_silver.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_silver.json new file mode 100644 index 00000000..de6cc9ca --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_silver.json @@ -0,0 +1,31 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_silver" + }, + { + "tag": "c:ingots/iron" + } + ], + "result": { + "id": "colossalchests:colossal_chest_silver" + }, + "conditions": [ + { + "type": "neoforge:and", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:ingots/silver" + } + }, + { + "type": "colossalchests:metal_variants_enabled" + } + ] + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_wood.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_wood.json new file mode 100644 index 00000000..31bfb21a --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/colossal_chest_wood.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_wood" + }, + { + "tag": "c:ingots/iron" + } + ], + "result": { + "id": "colossalchests:colossal_chest_wood" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_copper.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_copper.json new file mode 100644 index 00000000..8b8d5d4e --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_copper.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " C ", + "CWC", + " C " + ], + "key": { + "C": { + "tag": "c:cobblestones" + }, + "W": { + "item": "colossalchests:chest_wall_copper" + } + }, + "result": { + "id": "colossalchests:interface_copper" + }, + "conditions": [ + { + "type": "neoforge:and", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:ingots/copper" + } + }, + { + "type": "colossalchests:metal_variants_enabled" + } + ] + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_diamond.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_diamond.json new file mode 100644 index 00000000..e7751d47 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_diamond.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " C ", + "CWC", + " C " + ], + "key": { + "C": { + "tag": "c:cobblestones" + }, + "W": { + "item": "colossalchests:chest_wall_diamond" + } + }, + "result": { + "id": "colossalchests:interface_diamond" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_gold.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_gold.json new file mode 100644 index 00000000..2605c64d --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_gold.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " C ", + "CWC", + " C " + ], + "key": { + "C": { + "tag": "c:cobblestones" + }, + "W": { + "item": "colossalchests:chest_wall_gold" + } + }, + "result": { + "id": "colossalchests:interface_gold" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_iron.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_iron.json new file mode 100644 index 00000000..09477b4c --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_iron.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " C ", + "CWC", + " C " + ], + "key": { + "C": { + "tag": "c:cobblestones" + }, + "W": { + "item": "colossalchests:chest_wall_iron" + } + }, + "result": { + "id": "colossalchests:interface_iron" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_obsidian.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_obsidian.json new file mode 100644 index 00000000..d6b7c58c --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_obsidian.json @@ -0,0 +1,24 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " C ", + "CWC", + " C " + ], + "key": { + "C": { + "tag": "c:cobblestones" + }, + "W": { + "item": "colossalchests:chest_wall_obsidian" + } + }, + "result": { + "id": "colossalchests:interface_obsidian" + }, + "conditions": [ + { + "type": "colossalchests:metal_variants_enabled" + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_silver.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_silver.json new file mode 100644 index 00000000..cd236040 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_silver.json @@ -0,0 +1,36 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " C ", + "CWC", + " C " + ], + "key": { + "C": { + "tag": "c:cobblestones" + }, + "W": { + "item": "colossalchests:chest_wall_silver" + } + }, + "result": { + "id": "colossalchests:interface_silver" + }, + "conditions": [ + { + "type": "neoforge:and", + "values": [ + { + "type": "neoforge:not", + "value": { + "type": "neoforge:tag_empty", + "tag": "c:ingots/silver" + } + }, + { + "type": "colossalchests:metal_variants_enabled" + } + ] + } + ] +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_wood.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_wood.json new file mode 100644 index 00000000..173d7b01 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/interface_wood.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " C ", + "CWC", + " C " + ], + "key": { + "C": { + "tag": "c:cobblestones" + }, + "W": { + "item": "colossalchests:chest_wall_wood" + } + }, + "result": { + "id": "colossalchests:interface_wood" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/uncolossal_chest.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/uncolossal_chest.json new file mode 100644 index 00000000..f8776f24 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/uncolossal_chest.json @@ -0,0 +1,14 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:chest_wall_wood" + }, + { + "tag": "minecraft:planks" + } + ], + "result": { + "id": "colossalchests:uncolossal_chest" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool.json new file mode 100644 index 00000000..3c928543 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool.json @@ -0,0 +1,17 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "minecraft:stick" + }, + { + "item": "colossalchests:chest_wall_wood" + }, + { + "item": "minecraft:stick" + } + ], + "result": { + "id": "colossalchests:upgrade_tool" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool_2.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool_2.json new file mode 100644 index 00000000..143dfc10 --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool_2.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:upgrade_tool_reverse" + } + ], + "result": { + "id": "colossalchests:upgrade_tool" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool_reverse.json b/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool_reverse.json new file mode 100644 index 00000000..d11f748c --- /dev/null +++ b/loader-fabric/src/main/resources/data/colossalchests/recipe/upgrade_tool_reverse.json @@ -0,0 +1,11 @@ +{ + "type": "minecraft:crafting_shapeless", + "ingredients": [ + { + "item": "colossalchests:upgrade_tool" + } + ], + "result": { + "id": "colossalchests:upgrade_tool_reverse" + } +} \ No newline at end of file diff --git a/loader-fabric/src/main/resources/fabric.mod.json b/loader-fabric/src/main/resources/fabric.mod.json new file mode 100644 index 00000000..149accbb --- /dev/null +++ b/loader-fabric/src/main/resources/fabric.mod.json @@ -0,0 +1,33 @@ +{ + "schemaVersion": 1, + "id": "${mod_id}", + "version": "${mod_version}", + + "name": "${mod_name}", + "description": "${description}", + "authors": [ + "${mod_author}" + ], + "contact": { + "homepage": "${display_url}", + "sources": "${issue_tracker_url}" + }, + + "license": "${license}", + "icon": "logo.png", + + "environment": "*", + "entrypoints": { + "main": [ + "org.cyclops.colossalchests.ColossalChestsFabric" + ] + }, + "accessWidener" : "colossalchests.accesswidener", + + "depends": { + "cyclopscore": ">=${cyclopscore_version_semver}", + "fabricloader": ">=${fabric_loader_version}", + "fabric-api": ">=${fabric_version}", + "java": ">=${java_version}" + } +} \ No newline at end of file diff --git a/loader-forge/src/main/java/org/cyclops/colossalchests/block/ChestWallForge.java b/loader-forge/src/main/java/org/cyclops/colossalchests/block/ChestWallForge.java index 7f67ed4a..14022020 100644 --- a/loader-forge/src/main/java/org/cyclops/colossalchests/block/ChestWallForge.java +++ b/loader-forge/src/main/java/org/cyclops/colossalchests/block/ChestWallForge.java @@ -5,7 +5,6 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; @@ -29,17 +28,11 @@ protected boolean isCaptureBlockSnapshots(Level level) { @Override public void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion) { - if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); - // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); - world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - wasExploded(world, pos, explosion); + super.onBlockExplodedCommon(state, world, pos, explosion); } @Override public float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion) { - if (this.material.isExplosionResistant()) { - return 10000F; - } - return 0; + return super.getExplosionResistance(); } } diff --git a/loader-forge/src/main/java/org/cyclops/colossalchests/block/ColossalChestForge.java b/loader-forge/src/main/java/org/cyclops/colossalchests/block/ColossalChestForge.java index 78adca35..47f2fa0f 100644 --- a/loader-forge/src/main/java/org/cyclops/colossalchests/block/ColossalChestForge.java +++ b/loader-forge/src/main/java/org/cyclops/colossalchests/block/ColossalChestForge.java @@ -5,7 +5,6 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import org.cyclops.colossalchests.blockentity.BlockEntityColossalChestForge; @@ -30,17 +29,11 @@ protected boolean isCaptureBlockSnapshots(Level level) { @Override public void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion) { - if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); - // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); - world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - wasExploded(world, pos, explosion); + super.onBlockExplodedCommon(state, world, pos, explosion); } @Override public float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion) { - if (this.material.isExplosionResistant()) { - return 10000F; - } - return 0; + return super.getExplosionResistance(); } } diff --git a/loader-forge/src/main/java/org/cyclops/colossalchests/block/InterfaceForge.java b/loader-forge/src/main/java/org/cyclops/colossalchests/block/InterfaceForge.java index 9f31b991..649de4fa 100644 --- a/loader-forge/src/main/java/org/cyclops/colossalchests/block/InterfaceForge.java +++ b/loader-forge/src/main/java/org/cyclops/colossalchests/block/InterfaceForge.java @@ -5,7 +5,6 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import org.cyclops.colossalchests.blockentity.BlockEntityInterfaceForge; @@ -30,17 +29,11 @@ protected boolean isCaptureBlockSnapshots(Level level) { @Override public void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion) { - if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); - // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); - world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - wasExploded(world, pos, explosion); + super.onBlockExplodedCommon(state, world, pos, explosion); } @Override public float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion) { - if (this.material.isExplosionResistant()) { - return 10000F; - } - return 0; + return super.getExplosionResistance(); } } diff --git a/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ChestWallNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ChestWallNeoForge.java index f0ace80d..0533ccf9 100644 --- a/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ChestWallNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ChestWallNeoForge.java @@ -5,7 +5,6 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; @@ -29,17 +28,11 @@ protected boolean isCaptureBlockSnapshots(Level level) { @Override public void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion) { - if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); - // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); - world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - wasExploded(world, pos, explosion); + super.onBlockExplodedCommon(state, world, pos, explosion); } @Override public float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion) { - if (this.material.isExplosionResistant()) { - return 10000F; - } - return 0; + return super.getExplosionResistance(); } } diff --git a/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ColossalChestNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ColossalChestNeoForge.java index 9733c11a..b2444dd3 100644 --- a/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ColossalChestNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/ColossalChestNeoForge.java @@ -5,7 +5,6 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import org.cyclops.colossalchests.blockentity.BlockEntityColossalChestNeoForge; @@ -30,17 +29,11 @@ protected boolean isCaptureBlockSnapshots(Level level) { @Override public void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion) { - if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); - // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); - world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - wasExploded(world, pos, explosion); + super.onBlockExplodedCommon(state, world, pos, explosion); } @Override public float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion) { - if (this.material.isExplosionResistant()) { - return 10000F; - } - return 0; + return super.getExplosionResistance(); } } diff --git a/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/InterfaceNeoForge.java b/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/InterfaceNeoForge.java index 273d5f05..0e1afa0d 100644 --- a/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/InterfaceNeoForge.java +++ b/loader-neoforge/src/main/java/org/cyclops/colossalchests/block/InterfaceNeoForge.java @@ -5,7 +5,6 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; import org.cyclops.colossalchests.blockentity.BlockEntityInterface; @@ -30,17 +29,11 @@ protected boolean isCaptureBlockSnapshots(Level level) { @Override public void onBlockExploded(BlockState state, Level world, BlockPos pos, Explosion explosion) { - if(world.getBlockState(pos).getValue(ENABLED)) ColossalChest.triggerDetector(material, world, pos, false, null); - // IForgeBlock.super.onBlockExploded(state, world, pos, explosion); - world.setBlock(pos, Blocks.AIR.defaultBlockState(), 3); - wasExploded(world, pos, explosion); + super.onBlockExplodedCommon(state, world, pos, explosion); } @Override public float getExplosionResistance(BlockState state, BlockGetter world, BlockPos pos, Explosion explosion) { - if (this.material.isExplosionResistant()) { - return 10000F; - } - return 0; + return super.getExplosionResistance(); } }