diff --git a/gradle.properties b/gradle.properties index 9b65caf2..499986ea 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false # Mod Version Information -mod_version=14.0 +mod_version=14.1 # Minecraft Version Information minecraft_base_version=1.19 @@ -12,10 +12,10 @@ minecraft_version=1.19 minecraft_range=[1.19,) # Forge Version Information -forge_version=41.0.17 +forge_version=41.1.0 loader_range=[41.0,) -forge_range=[41.0.17,) -parchment_version=2022.03.13 +forge_range=[41.1.0,) +parchment_version=2022.07.17 # Build dependencies jei_version=9.5.3.153 diff --git a/src/main/java/com/progwml6/ironchest/IronChests.java b/src/main/java/com/progwml6/ironchest/IronChests.java index 2afd07b6..8c2eba2c 100644 --- a/src/main/java/com/progwml6/ironchest/IronChests.java +++ b/src/main/java/com/progwml6/ironchest/IronChests.java @@ -16,13 +16,13 @@ import net.minecraft.world.item.ItemStack; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.data.event.GatherDataEvent; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; -import net.minecraftforge.forge.event.lifecycle.GatherDataEvent; @Mod(IronChests.MOD_ID) public class IronChests { diff --git a/src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java b/src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java index 71a40acd..6cf7c514 100644 --- a/src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java +++ b/src/main/java/com/progwml6/ironchest/common/ai/CatsSitOnChestsHandler.java @@ -14,8 +14,8 @@ public class CatsSitOnChestsHandler { @SubscribeEvent - static void changeSittingTaskForOcelots(final LivingEvent.LivingUpdateEvent evt) { - if (evt.getEntityLiving().tickCount < 5 && evt.getEntityLiving() instanceof Cat cat) { + static void changeSittingTaskForOcelots(final LivingEvent.LivingTickEvent evt) { + if (evt.getEntity().tickCount < 5 && evt.getEntity() instanceof Cat cat) { HashSet goals = new HashSet<>(); for (WrappedGoal goal : cat.goalSelector.availableGoals) { diff --git a/src/main/java/com/progwml6/ironchest/common/block/entity/IronChestsBlockEntityTypes.java b/src/main/java/com/progwml6/ironchest/common/block/entity/IronChestsBlockEntityTypes.java index d1895350..7b0916a4 100644 --- a/src/main/java/com/progwml6/ironchest/common/block/entity/IronChestsBlockEntityTypes.java +++ b/src/main/java/com/progwml6/ironchest/common/block/entity/IronChestsBlockEntityTypes.java @@ -17,55 +17,64 @@ import com.progwml6.ironchest.common.block.trapped.entity.TrappedIronChestBlockEntity; import com.progwml6.ironchest.common.block.trapped.entity.TrappedObsidianChestBlockEntity; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.RegistryObject; public class IronChestsBlockEntityTypes { - public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, IronChests.MOD_ID); + public static final DeferredRegister> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, IronChests.MOD_ID); public static final RegistryObject> IRON_CHEST = BLOCK_ENTITIES.register( - "iron_chest", () -> BlockEntityType.Builder.of(IronChestBlockEntity::new, IronChestsBlocks.IRON_CHEST.get()).build(null)); + "iron_chest", () -> typeOf(IronChestBlockEntity::new, IronChestsBlocks.IRON_CHEST.get())); public static final RegistryObject> GOLD_CHEST = BLOCK_ENTITIES.register( - "gold_chest", () -> BlockEntityType.Builder.of(GoldChestBlockEntity::new, IronChestsBlocks.GOLD_CHEST.get()).build(null)); + "gold_chest", () -> typeOf(GoldChestBlockEntity::new, IronChestsBlocks.GOLD_CHEST.get())); public static final RegistryObject> DIAMOND_CHEST = BLOCK_ENTITIES.register( - "diamond_chest", () -> BlockEntityType.Builder.of(DiamondChestBlockEntity::new, IronChestsBlocks.DIAMOND_CHEST.get()).build(null)); + "diamond_chest", () -> typeOf(DiamondChestBlockEntity::new, IronChestsBlocks.DIAMOND_CHEST.get())); public static final RegistryObject> COPPER_CHEST = BLOCK_ENTITIES.register( - "copper_chest", () -> BlockEntityType.Builder.of(CopperChestBlockEntity::new, IronChestsBlocks.COPPER_CHEST.get()).build(null)); + "copper_chest", () -> typeOf(CopperChestBlockEntity::new, IronChestsBlocks.COPPER_CHEST.get())); public static final RegistryObject> CRYSTAL_CHEST = BLOCK_ENTITIES.register( - "crystal_chest", () -> BlockEntityType.Builder.of(CrystalChestBlockEntity::new, IronChestsBlocks.CRYSTAL_CHEST.get()).build(null)); + "crystal_chest", () -> typeOf(CrystalChestBlockEntity::new, IronChestsBlocks.CRYSTAL_CHEST.get())); public static final RegistryObject> OBSIDIAN_CHEST = BLOCK_ENTITIES.register( - "obsidian_chest", () -> BlockEntityType.Builder.of(ObsidianChestBlockEntity::new, IronChestsBlocks.OBSIDIAN_CHEST.get()).build(null)); + "obsidian_chest", () -> typeOf(ObsidianChestBlockEntity::new, IronChestsBlocks.OBSIDIAN_CHEST.get())); public static final RegistryObject> DIRT_CHEST = BLOCK_ENTITIES.register( - "dirt_chest", () -> BlockEntityType.Builder.of(DirtChestBlockEntity::new, IronChestsBlocks.DIRT_CHEST.get()).build(null)); + "dirt_chest", () -> typeOf(DirtChestBlockEntity::new, IronChestsBlocks.DIRT_CHEST.get())); // Trapped Chests public static final RegistryObject> TRAPPED_IRON_CHEST = BLOCK_ENTITIES.register( - "trapped_iron_chest", () -> BlockEntityType.Builder.of(TrappedIronChestBlockEntity::new, IronChestsBlocks.TRAPPED_IRON_CHEST.get()).build(null)); + "trapped_iron_chest", () -> typeOf(TrappedIronChestBlockEntity::new, IronChestsBlocks.TRAPPED_IRON_CHEST.get())); public static final RegistryObject> TRAPPED_GOLD_CHEST = BLOCK_ENTITIES.register( - "trapped_gold_chest", () -> BlockEntityType.Builder.of(TrappedGoldChestBlockEntity::new, IronChestsBlocks.TRAPPED_GOLD_CHEST.get()).build(null)); + "trapped_gold_chest", () -> typeOf(TrappedGoldChestBlockEntity::new, IronChestsBlocks.TRAPPED_GOLD_CHEST.get())); public static final RegistryObject> TRAPPED_DIAMOND_CHEST = BLOCK_ENTITIES.register( - "trapped_diamond_chest", () -> BlockEntityType.Builder.of(TrappedDiamondChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get()).build(null)); + "trapped_diamond_chest", () -> typeOf(TrappedDiamondChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIAMOND_CHEST.get())); public static final RegistryObject> TRAPPED_COPPER_CHEST = BLOCK_ENTITIES.register( - "trapped_copper_chest", () -> BlockEntityType.Builder.of(TrappedCopperChestBlockEntity::new, IronChestsBlocks.TRAPPED_COPPER_CHEST.get()).build(null)); + "trapped_copper_chest", () -> typeOf(TrappedCopperChestBlockEntity::new, IronChestsBlocks.TRAPPED_COPPER_CHEST.get())); public static final RegistryObject> TRAPPED_CRYSTAL_CHEST = BLOCK_ENTITIES.register( - "trapped_crystal_chest", () -> BlockEntityType.Builder.of(TrappedCrystalChestBlockEntity::new, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get()).build(null)); + "trapped_crystal_chest", () -> typeOf(TrappedCrystalChestBlockEntity::new, IronChestsBlocks.TRAPPED_CRYSTAL_CHEST.get())); public static final RegistryObject> TRAPPED_OBSIDIAN_CHEST = BLOCK_ENTITIES.register( - "trapped_obsidian_chest", () -> BlockEntityType.Builder.of(TrappedObsidianChestBlockEntity::new, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get()).build(null)); + "trapped_obsidian_chest", () -> typeOf(TrappedObsidianChestBlockEntity::new, IronChestsBlocks.TRAPPED_OBSIDIAN_CHEST.get())); public static final RegistryObject> TRAPPED_DIRT_CHEST = BLOCK_ENTITIES.register( - "trapped_dirt_chest", () -> BlockEntityType.Builder.of(TrappedDirtChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIRT_CHEST.get()).build(null)); + "trapped_dirt_chest", () -> typeOf(TrappedDirtChestBlockEntity::new, IronChestsBlocks.TRAPPED_DIRT_CHEST.get())); + + /** + * Helper method to avoid having a NonNull error on each line + */ + private static BlockEntityType typeOf(BlockEntityType.BlockEntitySupplier entity, Block... blocks) { + return BlockEntityType.Builder.of(entity, blocks).build(null); + } } diff --git a/src/main/java/com/progwml6/ironchest/common/inventory/IronChestsContainerTypes.java b/src/main/java/com/progwml6/ironchest/common/inventory/IronChestsContainerTypes.java index 02185c1d..dcc22ae3 100644 --- a/src/main/java/com/progwml6/ironchest/common/inventory/IronChestsContainerTypes.java +++ b/src/main/java/com/progwml6/ironchest/common/inventory/IronChestsContainerTypes.java @@ -8,7 +8,7 @@ public class IronChestsContainerTypes { - public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, IronChests.MOD_ID); + public static final DeferredRegister> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, IronChests.MOD_ID); public static final RegistryObject> IRON_CHEST = CONTAINERS.register("iron_chest", () -> new MenuType<>(IronChestMenu::createIronContainer)); diff --git a/src/main/java/com/progwml6/ironchest/common/item/IronChestBlockItem.java b/src/main/java/com/progwml6/ironchest/common/item/IronChestBlockItem.java index cf795e50..7c93a159 100644 --- a/src/main/java/com/progwml6/ironchest/common/item/IronChestBlockItem.java +++ b/src/main/java/com/progwml6/ironchest/common/item/IronChestBlockItem.java @@ -24,7 +24,7 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.client.IItemRenderProperties; +import net.minecraftforge.client.extensions.common.IClientItemExtensions; import net.minecraftforge.fml.DistExecutor; import java.util.concurrent.Callable; @@ -48,12 +48,12 @@ public IronChestBlockItem(Block block, Properties properties, Supplier consumer) { + public void initializeClient(Consumer consumer) { super.initializeClient(consumer); - consumer.accept(new IItemRenderProperties() { + consumer.accept(new IClientItemExtensions() { @Override - public BlockEntityWithoutLevelRenderer getItemStackRenderer() { + public BlockEntityWithoutLevelRenderer getCustomRenderer() { Supplier modelToUse; if (trapped.get()) {