Skip to content

Commit

Permalink
Updated to latest forge version to fix crashing, fix: #286
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelHillcox committed Jul 31, 2022
1 parent 62cd960 commit 84c247c
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 27 deletions.
8 changes: 4 additions & 4 deletions gradle.properties
Expand Up @@ -4,18 +4,18 @@ 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
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
2 changes: 1 addition & 1 deletion src/main/java/com/progwml6/ironchest/IronChests.java
Expand Up @@ -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 {
Expand Down
Expand Up @@ -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<WrappedGoal> goals = new HashSet<>();

for (WrappedGoal goal : cat.goalSelector.availableGoals) {
Expand Down
Expand Up @@ -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<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, IronChests.MOD_ID);
public static final DeferredRegister<BlockEntityType<?>> BLOCK_ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, IronChests.MOD_ID);

public static final RegistryObject<BlockEntityType<IronChestBlockEntity>> 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<BlockEntityType<GoldChestBlockEntity>> 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<BlockEntityType<DiamondChestBlockEntity>> 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<BlockEntityType<CopperChestBlockEntity>> 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<BlockEntityType<CrystalChestBlockEntity>> 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<BlockEntityType<ObsidianChestBlockEntity>> 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<BlockEntityType<DirtChestBlockEntity>> 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<BlockEntityType<TrappedIronChestBlockEntity>> 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<BlockEntityType<TrappedGoldChestBlockEntity>> 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<BlockEntityType<TrappedDiamondChestBlockEntity>> 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<BlockEntityType<TrappedCopperChestBlockEntity>> 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<BlockEntityType<TrappedCrystalChestBlockEntity>> 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<BlockEntityType<TrappedObsidianChestBlockEntity>> 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<BlockEntityType<TrappedDirtChestBlockEntity>> 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 <T extends BlockEntity> BlockEntityType<T> typeOf(BlockEntityType.BlockEntitySupplier<T> entity, Block... blocks) {
return BlockEntityType.Builder.of(entity, blocks).build(null);
}
}
Expand Up @@ -8,7 +8,7 @@

public class IronChestsContainerTypes {

public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, IronChests.MOD_ID);
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, IronChests.MOD_ID);

public static final RegistryObject<MenuType<IronChestMenu>> IRON_CHEST = CONTAINERS.register("iron_chest", () -> new MenuType<>(IronChestMenu::createIronContainer));

Expand Down
Expand Up @@ -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;
Expand All @@ -48,12 +48,12 @@ public IronChestBlockItem(Block block, Properties properties, Supplier<Callable<
}

@Override
public void initializeClient(Consumer<IItemRenderProperties> consumer) {
public void initializeClient(Consumer<IClientItemExtensions> consumer) {
super.initializeClient(consumer);

consumer.accept(new IItemRenderProperties() {
consumer.accept(new IClientItemExtensions() {
@Override
public BlockEntityWithoutLevelRenderer getItemStackRenderer() {
public BlockEntityWithoutLevelRenderer getCustomRenderer() {
Supplier<BlockEntity> modelToUse;

if (trapped.get()) {
Expand Down

0 comments on commit 84c247c

Please sign in to comment.