Jump to content

Custom Fence Gates [SOLVED]


CJMinecraft

Recommended Posts

When trying to create a custom fence gate for my mod I came upon this error where the fence gate renders fine in the inventory but when you place it, it renders incorrectly. To see if I was making an error in my blockstate json file I used the acacia fence gate blockstate to test if it would work. Again it failed to work correctly and I have no clue how to fix this. I believe this may have something to do with the Block Class I used which was a replica of that of the Block Fence gate other than changing the material and map colour to that of the iron material. I am using Forge 1.11.2-13.20.0.2223

Link to comment
Share on other sites

Here:

BlockTinFenceGate.class

package cjminecraft.bitofeverything.blocks;

import javax.annotation.Nullable;

import cjminecraft.bitofeverything.Reference;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.BlockHorizontal;
import net.minecraft.block.BlockWall;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Mirror;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Rotation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockTinFenceGate extends BlockHorizontal {

public static final PropertyBool OPEN = PropertyBool.create("open");
    public static final PropertyBool POWERED = PropertyBool.create("powered");
    public static final PropertyBool IN_WALL = PropertyBool.create("in_wall");
    protected static final AxisAlignedBB AABB_COLLIDE_ZAXIS = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.0D, 0.625D);
    protected static final AxisAlignedBB AABB_COLLIDE_XAXIS = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.0D, 1.0D);
    protected static final AxisAlignedBB AABB_COLLIDE_ZAXIS_INWALL = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 0.8125D, 0.625D);
    protected static final AxisAlignedBB AABB_COLLIDE_XAXIS_INWALL = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 0.8125D, 1.0D);
    protected static final AxisAlignedBB AABB_CLOSED_SELECTED_ZAXIS = new AxisAlignedBB(0.0D, 0.0D, 0.375D, 1.0D, 1.5D, 0.625D);
    protected static final AxisAlignedBB AABB_CLOSED_SELECTED_XAXIS = new AxisAlignedBB(0.375D, 0.0D, 0.0D, 0.625D, 1.5D, 1.0D);

    public BlockTinFenceGate(String unlocalizedName)
    {
        super(Material.IRON, Material.IRON.getMaterialMapColor());
        this.setDefaultState(this.blockState.getBaseState().withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)).withProperty(IN_WALL, Boolean.valueOf(false)));
        this.setUnlocalizedName(unlocalizedName);
        this.setRegistryName(new ResourceLocation(Reference.MODID, unlocalizedName));
        this.setHardness(3);
        this.setResistance(20);
        this.useNeighborBrightness = true;
    }

    public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
    {
        state = this.getActualState(state, source, pos);
        return ((Boolean)state.getValue(IN_WALL)).booleanValue() ? (((EnumFacing)state.getValue(FACING)).getAxis() == EnumFacing.Axis.X ? AABB_COLLIDE_XAXIS_INWALL : AABB_COLLIDE_ZAXIS_INWALL) : (((EnumFacing)state.getValue(FACING)).getAxis() == EnumFacing.Axis.X ? AABB_COLLIDE_XAXIS : AABB_COLLIDE_ZAXIS);
    }

    /**
     * Get the actual Block state of this Block at the given position. This applies properties not visible in the
     * metadata, such as fence connections.
     */
    public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();

        if (enumfacing$axis == EnumFacing.Axis.Z && (canFenceGateConnectTo(worldIn, pos, EnumFacing.WEST) || canFenceGateConnectTo(worldIn, pos, EnumFacing.EAST)) || enumfacing$axis == EnumFacing.Axis.X && (canFenceGateConnectTo(worldIn, pos, EnumFacing.NORTH) || canFenceGateConnectTo(worldIn, pos, EnumFacing.SOUTH)))
        {
            state = state.withProperty(IN_WALL, Boolean.valueOf(true));
        }

        return state;
    }

    /**
     * Returns the blockstate with the given rotation from the passed blockstate. If inapplicable, returns the passed
     * blockstate.
     */
    public IBlockState withRotation(IBlockState state, Rotation rot)
    {
        return state.withProperty(FACING, rot.rotate((EnumFacing)state.getValue(FACING)));
    }

    /**
     * Returns the blockstate with the given mirror of the passed blockstate. If inapplicable, returns the passed
     * blockstate.
     */
    public IBlockState withMirror(IBlockState state, Mirror mirrorIn)
    {
        return state.withRotation(mirrorIn.toRotation((EnumFacing)state.getValue(FACING)));
    }

    public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
    {
        return worldIn.getBlockState(pos.down()).getMaterial().isSolid() ? super.canPlaceBlockAt(worldIn, pos) : false;
    }

    @Nullable
    public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos)
    {
        return ((Boolean)blockState.getValue(OPEN)).booleanValue() ? NULL_AABB : (((EnumFacing)blockState.getValue(FACING)).getAxis() == EnumFacing.Axis.Z ? AABB_CLOSED_SELECTED_ZAXIS : AABB_CLOSED_SELECTED_XAXIS);
    }

    /**
     * Used to determine ambient occlusion and culling when rebuilding chunks for render
     */
    public boolean isOpaqueCube(IBlockState state)
    {
        return false;
    }

    public boolean isFullCube(IBlockState state)
    {
        return false;
    }

    public boolean isPassable(IBlockAccess worldIn, BlockPos pos)
    {
        return ((Boolean)worldIn.getBlockState(pos).getValue(OPEN)).booleanValue();
    }

    /**
     * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
     * IBlockstate
     */
    public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
    {
        boolean flag = worldIn.isBlockPowered(pos);
        return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()).withProperty(OPEN, Boolean.valueOf(flag)).withProperty(POWERED, Boolean.valueOf(flag)).withProperty(IN_WALL, Boolean.valueOf(false));
    }

    /**
     * Called when the block is right clicked by a player.
     */
    public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
    {
        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            state = state.withProperty(OPEN, Boolean.valueOf(false));
            worldIn.setBlockState(pos, state, 10);
        }
        else
        {
            EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw);

            if (state.getValue(FACING) == enumfacing.getOpposite())
            {
                state = state.withProperty(FACING, enumfacing);
            }

            state = state.withProperty(OPEN, Boolean.valueOf(true));
            worldIn.setBlockState(pos, state, 10);
        }

        worldIn.playEvent(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1008 : 1014, pos, 0);
        return true;
    }

    /**
     * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
     * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
     * block, etc.
     */
    public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
    {
        if (!worldIn.isRemote)
        {
            boolean flag = worldIn.isBlockPowered(pos);

            if (((Boolean)state.getValue(POWERED)).booleanValue() != flag)
            {
                worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag)).withProperty(OPEN, Boolean.valueOf(flag)), 2);

                if (((Boolean)state.getValue(OPEN)).booleanValue() != flag)
                {
                    worldIn.playEvent((EntityPlayer)null, flag ? 1008 : 1014, pos, 0);
                }
            }
        }
    }

    @SideOnly(Side.CLIENT)
    public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
    {
        return true;
    }

    /**
     * Convert the given metadata into a BlockState for this Block
     */
    public IBlockState getStateFromMeta(int meta)
    {
        return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta)).withProperty(OPEN, Boolean.valueOf((meta & 4) != 0)).withProperty(POWERED, Boolean.valueOf((meta &  != 0));
    }

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        int i = 0;
        i = i | ((EnumFacing)state.getValue(FACING)).getHorizontalIndex();

        if (((Boolean)state.getValue(POWERED)).booleanValue())
        {
            i |= 8;
        }

        if (((Boolean)state.getValue(OPEN)).booleanValue())
        {
            i |= 4;
        }

        return i;
    }

    protected BlockStateContainer createBlockState()
    {
        return new BlockStateContainer(this, new IProperty[] {FACING, OPEN, POWERED, IN_WALL});
    }

    /* ======================================== FORGE START ======================================== */

    @Override
    public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
    {
        Block connector = world.getBlockState(pos.offset(facing)).getBlock();
        return connector instanceof BlockFence || connector instanceof BlockWall;
    }

    private boolean canFenceGateConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing)
    {
        Block block = world.getBlockState(pos.offset(facing)).getBlock();
        return block.canBeConnectedTo(world, pos.offset(facing), facing.getOpposite());
    }

    /* ======================================== FORGE END ======================================== */

}

 

Blockstate - tin_fence_gate.json:

{
    "variants": {
        "facing=south,in_wall=false,open=false": { "model": "acacia_fence_gate_closed", "uvlock": true },
        "facing=west,in_wall=false,open=false":  { "model": "acacia_fence_gate_closed", "uvlock": true, "y": 90 },
        "facing=north,in_wall=false,open=false": { "model": "acacia_fence_gate_closed", "uvlock": true, "y": 180 },
        "facing=east,in_wall=false,open=false":  { "model": "acacia_fence_gate_closed", "uvlock": true, "y": 270 },
        "facing=south,in_wall=false,open=true": { "model": "acacia_fence_gate_open", "uvlock": true },
        "facing=west,in_wall=false,open=true":  { "model": "acacia_fence_gate_open", "uvlock": true, "y": 90 },
        "facing=north,in_wall=false,open=true": { "model": "acacia_fence_gate_open", "uvlock": true, "y": 180 },
        "facing=east,in_wall=false,open=true":  { "model": "acacia_fence_gate_open", "uvlock": true, "y": 270 },
        "facing=south,in_wall=true,open=false": { "model": "acacia_wall_gate_closed", "uvlock": true },
        "facing=west,in_wall=true,open=false":  { "model": "acacia_wall_gate_closed", "uvlock": true, "y": 90 },
        "facing=north,in_wall=true,open=false": { "model": "acacia_wall_gate_closed", "uvlock": true, "y": 180 },
        "facing=east,in_wall=true,open=false":  { "model": "acacia_wall_gate_closed", "uvlock": true, "y": 270 },
        "facing=south,in_wall=true,open=true": { "model": "acacia_wall_gate_open", "uvlock": true },
        "facing=west,in_wall=true,open=true":  { "model": "acacia_wall_gate_open", "uvlock": true, "y": 90 },
        "facing=north,in_wall=true,open=true": { "model": "acacia_wall_gate_open", "uvlock": true, "y": 180 },
        "facing=east,in_wall=true,open=true":  { "model": "acacia_wall_gate_open", "uvlock": true, "y": 270 }
    }
}

 

NOTE I AM USING THE ACACIA FENCE GATE FOR TESTING

Link to comment
Share on other sites

Mod Blocks Class:

package cjminecraft.bitofeverything.init;

import cjminecraft.bitofeverything.BitOfEverything;
import cjminecraft.bitofeverything.Reference;
import cjminecraft.bitofeverything.blocks.BlockBreaker;
import cjminecraft.bitofeverything.blocks.BlockGamemodeDetector;
import cjminecraft.bitofeverything.blocks.BlockMachineFrame;
import cjminecraft.bitofeverything.blocks.BlockTinBlock;
import cjminecraft.bitofeverything.blocks.BlockTinFence;
import cjminecraft.bitofeverything.blocks.BlockTinFenceGate;
import cjminecraft.bitofeverything.blocks.BlockTinOre;
import cjminecraft.bitofeverything.blocks.BlockTinSlabDouble;
import cjminecraft.bitofeverything.blocks.BlockTinSlabHalf;
import cjminecraft.bitofeverything.blocks.BlockTinStairs;
import cjminecraft.bitofeverything.blocks.item.ItemBlockBreaker;
import cjminecraft.bitofeverything.blocks.item.ItemBlockMeta;
import cjminecraft.bitofeverything.handlers.EnumHandler;
import cjminecraft.bitofeverything.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemSlab;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;

/**
* This class handles the registration of our blocks and also the rendering of them
* @author CJMinecraft
*
*/
public class ModBlocks {

/**
 * State our blocks
 */
public static Block tinOre;
public static Block tinBlock;
public static Block breaker;
public static Block gamemodeDetector;
public static Block machineFrame;
public static BlockTinSlabHalf tinSlabHalf;
public static BlockTinSlabDouble tinSlabDouble;
public static BlockTinStairs tinStairs;

public static BlockTinFence tinFence;
public static BlockTinFenceGate tinFenceGate;

/**
 * Initialize the blocks
 */
public static void init() {
	tinOre = new BlockTinOre("tin_ore", "tin_ore");
	breaker = new BlockBreaker("block_breaker");
	gamemodeDetector = new BlockGamemodeDetector("gamemode_detector");
	machineFrame = new BlockMachineFrame("machine_frame");
	tinBlock = new BlockTinBlock("tin_block");
	tinSlabHalf = new BlockTinSlabHalf("tin_slab_half");
	tinSlabDouble = new BlockTinSlabDouble("tin_slab_double");
	tinStairs = new BlockTinStairs("tin_stairs", tinBlock.getDefaultState());

	tinFence = new BlockTinFence("tin_fence");
	tinFenceGate = new BlockTinFenceGate("tin_fence_gate");
}

/**
 * Register the blocks
 */
public static void register() {
	registerBlock(tinOre, new ItemBlockMeta(tinOre)); //Says that the block uses the ItemBlockMeta as the item block
	registerBlock(breaker, new ItemBlockBreaker(breaker));
	registerBlock(gamemodeDetector);
	registerBlock(machineFrame, new ItemBlockMeta(machineFrame));
	registerBlock(tinBlock);
	registerBlock(tinSlabHalf, new ItemSlab(tinSlabHalf, tinSlabHalf, tinSlabDouble));
	GameRegistry.register(tinSlabDouble); //Doesn't need an item
	registerBlock(tinStairs);

	registerBlock(tinFence);
	registerBlock(tinFenceGate);
}

/**
 * Register the renders for the block
 */
public static void registerRenders() {
	for(int i = 0; i < EnumHandler.OreType.values().length; i++) {
		registerRender(tinOre, i, "tin_ore_" + EnumHandler.OreType.values()[i].getName());
	}
	for(int i = 0; i < EnumHandler.ChipTypes.values().length; i++) {
		registerRender(breaker, i, "block_breaker_" + EnumHandler.ChipTypes.values()[i].getName());
		registerRender(machineFrame, i, "machine_frame_" + EnumHandler.ChipTypes.values()[i].getName());
	}
	registerRender(gamemodeDetector);
	registerRender(tinBlock);
	registerRender(tinSlabHalf);
	registerRender(tinStairs);

	registerRender(tinFence);
	registerRender(tinFenceGate);
}

/**
 * Registers the block
 * @param block The block to register
 */
public static void registerBlock(Block block) {
	block.setCreativeTab(BitOfEverything.blocks);
	GameRegistry.register(block);
	GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
	Utils.getLogger().info("Registered Block: " + block.getUnlocalizedName().substring(5));
}

/**
 * Registers the block with a custom {@link ItemBlock}
 * @param block The block
 * @param itemBlock The {@link ItemBlock}
 */
public static void registerBlock(Block block, ItemBlock itemBlock) {
	block.setCreativeTab(BitOfEverything.blocks);
	GameRegistry.register(block);
	GameRegistry.register(itemBlock.setRegistryName(block.getRegistryName()));
	Utils.getLogger().info("Registered Block: " + block.getUnlocalizedName().substring(5));
}

/**
 * Registers the blocks renders
 * @param block The block
 */
public static void registerRender(Block block) {
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(new ResourceLocation(Reference.MODID, block.getUnlocalizedName().substring(5)), "inventory"));
	Utils.getLogger().info("Register render for " + block.getUnlocalizedName().substring(5));
}

/**
 * Registers the blocks renders even if it has meta data
 * @param block The block
 * @param meta The blocks meta data
 * @param fileName The file name
 */
public static void registerRender(Block block, int meta, String fileName) {
	ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), meta, new ModelResourceLocation(new ResourceLocation(Reference.MODID, fileName), "inventory"));
	Utils.getLogger().info("Register render for " + block.getUnlocalizedName().substring(5));
}

}

Link to comment
Share on other sites

[15:05:08] [Client thread/ERROR] [FML]: Exception loading model for variant boe:tin_fence_gate#facing=west,in_wall=true,open=false,powered=true for blockstate "boe:tin_fence_gate[facing=west,in_wall=true,open=false,powered=true]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model boe:tin_fence_gate#facing=west,in_wall=true,open=false,powered=true with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:260) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:248) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:155) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1253) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 21 more

[15:05:08] [Client thread/ERROR] [FML]: Exception loading model for variant boe:tin_fence_gate#facing=east,in_wall=false,open=true,powered=true for blockstate "boe:tin_fence_gate[facing=east,in_wall=false,open=true,powered=true]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model boe:tin_fence_gate#facing=east,in_wall=false,open=true,powered=true with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:260) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:248) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:155) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1253) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 21 more

[15:05:08] [Client thread/ERROR] [FML]: Exception loading model for variant boe:tin_fence_gate#facing=north,in_wall=true,open=false,powered=false for blockstate "boe:tin_fence_gate[facing=north,in_wall=true,open=false,powered=false]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model boe:tin_fence_gate#facing=north,in_wall=true,open=false,powered=false with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:260) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:248) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:155) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1253) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 21 more

[15:05:08] [Client thread/ERROR] [FML]: Exception loading model for variant boe:tin_fence_gate#facing=north,in_wall=true,open=false,powered=true for blockstate "boe:tin_fence_gate[facing=north,in_wall=true,open=false,powered=true]"

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model boe:tin_fence_gate#facing=north,in_wall=true,open=false,powered=true with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:260) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:248) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:155) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.init(Minecraft.java:541) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:387) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_111]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_111]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_111]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1253) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 21 more

Link to comment
Share on other sites

Right -- Those vanilla states are very literal; they need to be EXACT (even to the point of putting all of the properties in alpha order).

 

If you want parts, then use the Forge advanced json format.

 

On the other hand, if a property such as "powered" is superfluous, then use a custom state mapper (or 1.11.2's equivalent) to ignore it.

 

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Link to comment
Share on other sites

Adding the powered tag to the blockstate fixed everything. Here is what it looks like:

{
    "variants": {
        "facing=south,in_wall=false,open=false,powered=false": { "model": "boe:tin_fence_gate_closed", "uvlock": true },
        "facing=west,in_wall=false,open=false,powered=false":  { "model": "boe:tin_fence_gate_closed", "uvlock": true, "y": 90 },
        "facing=north,in_wall=false,open=false,powered=false": { "model": "boe:tin_fence_gate_closed", "uvlock": true, "y": 180 },
        "facing=east,in_wall=false,open=false,powered=false":  { "model": "boe:tin_fence_gate_closed", "uvlock": true, "y": 270 },
        "facing=south,in_wall=false,open=true,powered=false": { "model": "boe:tin_fence_gate_open", "uvlock": true },
        "facing=west,in_wall=false,open=true,powered=false":  { "model": "boe:tin_fence_gate_open", "uvlock": true, "y": 90 },
        "facing=north,in_wall=false,open=true,powered=false": { "model": "boe:tin_fence_gate_open", "uvlock": true, "y": 180 },
        "facing=east,in_wall=false,open=true,powered=false":  { "model": "boe:tin_fence_gate_open", "uvlock": true, "y": 270 },
        "facing=south,in_wall=true,open=false,powered=false": { "model": "boe:tin_wall_gate_closed", "uvlock": true },
        "facing=west,in_wall=true,open=false,powered=false":  { "model": "boe:tin_wall_gate_closed", "uvlock": true, "y": 90 },
        "facing=north,in_wall=true,open=false,powered=false": { "model": "boe:tin_wall_gate_closed", "uvlock": true, "y": 180 },
        "facing=east,in_wall=true,open=false,powered=false":  { "model": "boe:tin_wall_gate_closed", "uvlock": true, "y": 270 },
        "facing=south,in_wall=true,open=true,powered=false": { "model": "boe:tin_wall_gate_open", "uvlock": true },
        "facing=west,in_wall=true,open=true,powered=false":  { "model": "boe:tin_wall_gate_open", "uvlock": true, "y": 90 },
        "facing=north,in_wall=true,open=true,powered=false": { "model": "boe:tin_wall_gate_open", "uvlock": true, "y": 180 },
        "facing=east,in_wall=true,open=true,powered=false":  { "model": "boe:tin_wall_gate_open", "uvlock": true, "y": 270 },
	"facing=south,in_wall=false,open=false,powered=true": { "model": "boe:tin_fence_gate_closed", "uvlock": true },
        "facing=west,in_wall=false,open=false,powered=true":  { "model": "boe:tin_fence_gate_closed", "uvlock": true, "y": 90 },
        "facing=north,in_wall=false,open=false,powered=true": { "model": "boe:tin_fence_gate_closed", "uvlock": true, "y": 180 },
        "facing=east,in_wall=false,open=false,powered=true":  { "model": "boe:tin_fence_gate_closed", "uvlock": true, "y": 270 },
        "facing=south,in_wall=false,open=true,powered=true": { "model": "boe:tin_fence_gate_open", "uvlock": true },
        "facing=west,in_wall=false,open=true,powered=true":  { "model": "boe:tin_fence_gate_open", "uvlock": true, "y": 90 },
        "facing=north,in_wall=false,open=true,powered=true": { "model": "boe:tin_fence_gate_open", "uvlock": true, "y": 180 },
        "facing=east,in_wall=false,open=true,powered=true":  { "model": "boe:tin_fence_gate_open", "uvlock": true, "y": 270 },
        "facing=south,in_wall=true,open=false,powered=true": { "model": "boe:tin_wall_gate_closed", "uvlock": true },
        "facing=west,in_wall=true,open=false,powered=true":  { "model": "boe:tin_wall_gate_closed", "uvlock": true, "y": 90 },
        "facing=north,in_wall=true,open=false,powered=true": { "model": "boe:tin_wall_gate_closed", "uvlock": true, "y": 180 },
        "facing=east,in_wall=true,open=false,powered=true":  { "model": "boe:tin_wall_gate_closed", "uvlock": true, "y": 270 },
        "facing=south,in_wall=true,open=true,powered=true": { "model": "boe:tin_wall_gate_open", "uvlock": true },
        "facing=west,in_wall=true,open=true,powered=true":  { "model": "boe:tin_wall_gate_open", "uvlock": true, "y": 90 },
        "facing=north,in_wall=true,open=true,powered=true": { "model": "boe:tin_wall_gate_open", "uvlock": true, "y": 180 },
        "facing=east,in_wall=true,open=true,powered=true":  { "model": "boe:tin_wall_gate_open", "uvlock": true, "y": 270 }
    }
}

Thanks for all of the help!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.