Jump to content

[1.12.x/1.11.x] [SOLVED] Block connections (Collision, JSON)


Recommended Posts

Posted (edited)

Hi,

 

I'm wondering which is the best way to let to cables connect to each other with changing the model and the collision

boxes for each possible connection and none connection. It should be noted here that the cable will have some

other states, too (not yet implemented) for stuff like different ratios of energy transfer (haven't planned yet how to implement it code-wise).

 

  • change collision box on new connection to match with look
  • change model on new connection, so two cables look connected ingame
  • blockstates for stuff like energy transfer rates might be implemented in the future

 

public class BlockCable extends Block implements ITileEntityProvider {
    
    private static final AxisAlignedBB BOX_CENTER = new AxisAlignedBB(.25d, .25d, .25d, .75d, .75d, .75d);
    private static final AxisAlignedBB BOX_DOWN = new AxisAlignedBB(.25d, 0d, .25d, .75d, .25d, .75d);
    private static final AxisAlignedBB BOX_UP = new AxisAlignedBB(.25d, .75d, .25d, .75d, 1d, .75d);
    private static final AxisAlignedBB BOX_NORTH = new AxisAlignedBB(.25d, .25d, 0d, .75d, .75d, .25d);
    private static final AxisAlignedBB BOX_SOUTH = new AxisAlignedBB(.25d, .25d, .75d, .75d, .75d, 1);
    private static final AxisAlignedBB BOX_WEST = new AxisAlignedBB(0d, .25d, .25d, .25d, .75d, .75d);
    private static final AxisAlignedBB BOX_EAST = new AxisAlignedBB(.75d, .25d, .25d, 1d, .75d, .75d);
    private static final AxisAlignedBB[] BOX_FACES = { BOX_DOWN, BOX_UP, BOX_NORTH, BOX_SOUTH, BOX_WEST, BOX_EAST };
    
	public BlockCable() {
		super(Material.IRON);
		this.setHardness(.25f);
		this.setResistance(3f);
		
		this.setCreativeTab(ModCreativeTabs.mcpowerTab);
	}
	
	@Override
	public boolean isFullCube(IBlockState state) {
	    return false;
	}
	
	@Override
	public boolean isFullBlock(IBlockState state) {
	    return false;
	}
	
	@Override
	public boolean isOpaqueCube(IBlockState state) {
	    return false;
	}
	
	@Override
	public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, 
	        List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) {
	    TileEntity tile = worldIn.getTileEntity(pos);
	    if(tile == null) {
	        Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB);
	        return;
	    }
	    
	}

 

{
	"forge_marker": 1,
	"defaults": {
		"model": "cube_all",
		"textures": {"all": "justanotherenergy:blocks/cable"}
	},
	"variants": {
		"normal": { "model": "cube_all" },
		"inventory": [{"transform": "forge:default-block"}]
	}
}

 

My problem with this is, I've never worked in 1.8.9+ with collision boxes and I don't know which would be the best way to implement the model in json files.

For the JSON files I thought about using sub-models, but I want to  know if there is a better way or if it is already the best way. I am also wondering

if I have to add the same code for the sub-models multiply times because of having other blockstates, too (which might change nothing on the look of the block or change

only the texture etc.).

 

Thx in advance.

Bektor

Edited by Bektor

Developer of Primeval Forest.

Posted

Forge block states are inherently single-property at a time and Forge automatically combines them. Using submodels is the best way to go about doing this.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
24 minutes ago, Draco18s said:

Forge block states are inherently single-property at a time and Forge automatically combines them. Using submodels is the best way to go about doing this.

Ok, thx. Which would then be the best way to let the json now in which direction the block is connected to? (multiply connections at the same time possible)

Also, how should I handle the stuff with the collision boxes?

Developer of Primeval Forest.

Posted

getActualState()

 

You have booleans for each direction, then in getActualState you return a state property that has the connected directions be true. Look at the fence or cobblestone wall.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
26 minutes ago, Draco18s said:

getActualState()

 

You have booleans for each direction, then in getActualState you return a state property that has the connected directions be true. Look at the fence or cobblestone wall.

Hm... Having a boolean for each direction sounds like creating more property values than really necessary.

I'm also wondering what this ExtendedBlockState is which for example BC 8.0 uses for their pipes.

Developer of Primeval Forest.

Posted (edited)

Extended State is just a fancy way of storing arbitrary data in a state property. Liquids use it to store the height of each vertex based on the amount of liquid in neighbor blocks.

 

You have six directions and each one can either be connected or not. That's six boolean properties. Use each one to dictate the presence or absence of a submodel.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
39 minutes ago, Draco18s said:

Extended State is just a fancy way of storing arbitrary data in a state property. Liquids use it to store the height of each vertex based on the amount of liquid in neighbor blocks.

 

You have six directions and each one can either be connected or not. That's six boolean properties. Use each one to dictate the presence or absence of a submodel.

Ok, I've got this done now, thought I'm getting a few errors:

Can't really tell what these errors are as the JSON support for my IDE is just crap, I mean, everything is nice (even xml support etc.) except for JSON. I've always got the feeling eclipse doesn't like json files.

 

{
	"forge_marker": 1,
	"defaults": {
		"model": "cable_center",
		"textures": {"all": "justanotherenergy:blocks/cable"}
	},
	"multipart": {
	   "apply": { "model": "cable_base" },
	   { // error
	       "when": { "north": "true" },
           "apply": {"model": "cable_side" }
	   },
	   {
           "when": { "east": "true" },
           "apply": {"model": "cable_side" }
       },
       {
           "when": { "south": "true" },
           "apply": {"model": "cable_side" }
       },
       {
           "when": { "west": "true" },
           "apply": {"model": "cable_side" }
       },   
	},
	"variants": {
		"inventory": [{"transform": "forge:default-block"}] // where to put this?
	}
}

 

I'm also wondering how to combine multiply collision boxes to one collision box. 

 

 

public class BlockCable extends Block implements ITileEntityProvider {
    
    /** Whether this fence connects in the northern direction */
    public static final PropertyBool NORTH = PropertyBool.create("north");
    /** Whether this fence connects in the eastern direction */
    public static final PropertyBool EAST = PropertyBool.create("east");
    /** Whether this fence connects in the southern direction */
    public static final PropertyBool SOUTH = PropertyBool.create("south");
    /** Whether this fence connects in the western direction */
    public static final PropertyBool WEST = PropertyBool.create("west");
    
    private static final AxisAlignedBB BOX_CENTER = new AxisAlignedBB(.25d, .25d, .25d, .75d, .75d, .75d);
    private static final AxisAlignedBB BOX_DOWN = new AxisAlignedBB(.25d, 0d, .25d, .75d, .25d, .75d);
    private static final AxisAlignedBB BOX_UP = new AxisAlignedBB(.25d, .75d, .25d, .75d, 1d, .75d);
    private static final AxisAlignedBB BOX_NORTH = new AxisAlignedBB(.25d, .25d, 0d, .75d, .75d, .25d);
    private static final AxisAlignedBB BOX_SOUTH = new AxisAlignedBB(.25d, .25d, .75d, .75d, .75d, 1);
    private static final AxisAlignedBB BOX_WEST = new AxisAlignedBB(0d, .25d, .25d, .25d, .75d, .75d);
    private static final AxisAlignedBB BOX_EAST = new AxisAlignedBB(.75d, .25d, .25d, 1d, .75d, .75d);
    private static final AxisAlignedBB[] BOX_FACES = { BOX_DOWN, BOX_UP, BOX_NORTH, BOX_SOUTH, BOX_WEST, BOX_EAST };
    
	public BlockCable() {
		super(Material.IRON);
		this.setHardness(.25f);
		this.setResistance(3f);
		
		this.setCreativeTab(ModCreativeTabs.mcpowerTab);
	}
	
	@Override
	public boolean isFullCube(IBlockState state) {
	    return false;
	}
	
	@Override
	public boolean isFullBlock(IBlockState state) {
	    return false;
	}
	
	@Override
	public boolean isOpaqueCube(IBlockState state) {
	    return false;
	}
	
	@Override
	public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, 
	        List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) {
	    TileEntity tile = worldIn.getTileEntity(pos);
	    if(tile == null) {
	        Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB);
	        return;
	    }
	    if(state.getValue(NORTH)) {
	        Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_CENTER + BOX_FACES[2]);
	        return;
	    }else if(state.getValue(EAST)) {
            Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB);
            return;
        }else if(state.getValue(WEST)) {
            Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB);
            return;
        }else if(state.getValue(SOUTH)) {
            Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB);
            return;
        }
	}
	
	@Override
	public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
	    return state.withProperty(NORTH, true) // TODO: value
	            .withProperty(EAST, false)
	            .withProperty(WEST, false)
	            .withProperty(SOUTH, false);
	}
	
	@Override
	protected BlockStateContainer createBlockState() {
	    return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
	}

 

Developer of Primeval Forest.

Posted
2 minutes ago, Bektor said:

I'm also wondering how to combine multiply collision boxes to one collision box. 

BlockFence has this already.

 

As for your JSON file, hit up https://jsonlint.com/, Your file has errors.

If you're using Eclipse, download the JSON Editor Plugin from the Eclipse marketplace (Help -> Eclipse Marketplace, it's the second result searching for "json")

If you're using IntelliJ I am not sure.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
1 minute ago, Draco18s said:

As for your JSON file, hit up https://jsonlint.com/, Your file has errors.

Error: Parse error on line 12:
..."cable_base"		},		{			"when": {				"
---------------------^
Expecting 'STRING', got '{'
 
1 minute ago, Draco18s said:

If you're using Eclipse, download the JSON Editor Plugin from the Eclipse marketplace (Help -> Eclipse Marketplace, it's the second result searching for "json")

If you're using IntelliJ I am not sure.

I'm using Eclipse with the Eclipse Web Developer Tools Plugin installed (which comes with a JSON editor besides HTML etc.).

 

2 minutes ago, Draco18s said:

BlockFence has this already.

Meaning I should do it like this?

	    Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_CENTER);
	    if(state.getValue(NORTH)) {
	        Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_NORTH);

 

Developer of Primeval Forest.

Posted (edited)
10 minutes ago, Bektor said:

Meaning I should do it like this?

Yes.

 

As to your error, glancing at your json file...

I am not sure where you even got that syntax. Here's the documentation, and aside from the example file using literal integers instead of strings (like it should), its correct.

http://mcforge.readthedocs.io/en/latest/blockstates/forgeBlockstates/#sub-models

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Ah, that's the multipart system, not the submodel system.

 

Now then:

From the minecraft wiki:

"multipart": [

From your file:

"multipart": {

 

HMM

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
5 minutes ago, Draco18s said:

Ah, that's the multipart system, not the submodel system.

 

Now then:

From the minecraft wiki:

"multipart": [

From your file:

"multipart": {

 

HMM

Ah, ok. Thought what's the difference between those two?

Developer of Primeval Forest.

Posted
43 minutes ago, Bektor said:

Ah, ok. Thought what's the difference between those two?

Seriously? 

One defines an object, one defines an array...

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
public class BlockCable extends Block implements ITileEntityProvider {
    
    /** Whether this fence connects in the northern direction */
    public static final PropertyBool NORTH = PropertyBool.create("north");
    /** Whether this fence connects in the eastern direction */
    public static final PropertyBool EAST = PropertyBool.create("east");
    /** Whether this fence connects in the southern direction */
    public static final PropertyBool SOUTH = PropertyBool.create("south");
    /** Whether this fence connects in the western direction */
    public static final PropertyBool WEST = PropertyBool.create("west");
    
    private static final AxisAlignedBB BOX_CENTER = new AxisAlignedBB(.25d, .25d, .25d, .75d, .75d, .75d);
    private static final AxisAlignedBB BOX_DOWN = new AxisAlignedBB(.25d, 0d, .25d, .75d, .25d, .75d);
    private static final AxisAlignedBB BOX_UP = new AxisAlignedBB(.25d, .75d, .25d, .75d, 1d, .75d);
    private static final AxisAlignedBB BOX_NORTH = new AxisAlignedBB(.25d, .25d, 0d, .75d, .75d, .25d);
    private static final AxisAlignedBB BOX_SOUTH = new AxisAlignedBB(.25d, .25d, .75d, .75d, .75d, 1);
    private static final AxisAlignedBB BOX_WEST = new AxisAlignedBB(0d, .25d, .25d, .25d, .75d, .75d);
    private static final AxisAlignedBB BOX_EAST = new AxisAlignedBB(.75d, .25d, .25d, 1d, .75d, .75d);
    
    // TODO: remove unused code
    private static final AxisAlignedBB[] BOX_FACES = { BOX_DOWN, BOX_UP, BOX_NORTH, BOX_SOUTH, BOX_WEST, BOX_EAST };
    
	public BlockCable() {
		super(Material.IRON);
		this.setHardness(.25f);
		this.setResistance(3f);
		
		this.setDefaultState(this.blockState.getBaseState().withProperty(NORTH, false).withProperty(EAST, false).withProperty(SOUTH, false).withProperty(WEST, false));
		this.setCreativeTab(ModCreativeTabs.mcpowerTab);
	}
	
	@Override
	public boolean isFullCube(IBlockState state) {
	    return false;
	}
	
	@Override
	public boolean isFullBlock(IBlockState state) {
	    return false;
	}
	
	@Override
	public boolean isOpaqueCube(IBlockState state) {
	    return false;
	}
	
	@Override
	public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, 
	        List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) {
	    
	    Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_CENTER);
	    if(state.getValue(NORTH)) {
	        Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_NORTH);
	        return;
	    }else if(state.getValue(EAST)) {
            Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_EAST);
            return;
        }else if(state.getValue(WEST)) {
            Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_WEST);
            return;
        }else if(state.getValue(SOUTH)) {
            Block.addCollisionBoxToList(pos, entityBox, collidingBoxes, BOX_SOUTH);
            return;
        }
	}
	
	@Override
	public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
	    return state.withProperty(NORTH, this.canCableConnectTo(worldIn, pos, EnumFacing.NORTH))
	            .withProperty(EAST, this.canCableConnectTo(worldIn, pos, EnumFacing.EAST))
	            .withProperty(WEST, this.canCableConnectTo(worldIn, pos, EnumFacing.WEST))
	            .withProperty(SOUTH, this.canCableConnectTo(worldIn, pos, EnumFacing.SOUTH));
	}
	
	private boolean canCableConnectTo(IBlockAccess worldIn, BlockPos pos, EnumFacing facing) {
	    return worldIn.getBlockState(pos.offset(facing)).getBlock() == ModBlocks.cable ||
	            worldIn.getBlockState(pos.offset(facing)).getBlock() == ModBlocks.transfer;
	}
	
	@Override
	protected BlockStateContainer createBlockState() {
	    return new BlockStateContainer(this, new IProperty[] {NORTH, EAST, WEST, SOUTH});
	}

 

Hm... this code seems not to work. :(

 

Spoiler

Caused by: java.lang.IllegalArgumentException: Don't know how to convert justanotherenergy:cable[east=true,north=true,south=true,west=true] back into data...
	at net.minecraft.block.Block.getMetaFromState(Block.java:245)
	at net.minecraftforge.fml.common.registry.GameData$BlockCallbacks.onAdd(GameData.java:272)
	at net.minecraftforge.fml.common.registry.GameData$BlockCallbacks.onAdd(GameData.java:255)
	at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:597)
	at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:504)
	at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:854)
	at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:225)
	at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:205)
	at minecraftplaye.justanotherenergy.common.lib.BlockRegistry.register(BlockRegistry.java:84)
	at minecraftplaye.justanotherenergy.common.lib.BlockRegistry.register(BlockRegistry.java:39)
	at minecraftplaye.justanotherenergy.common.lib.ModBlocks.init(ModBlocks.java:30)
	at minecraftplaye.justanotherenergy.JustAnotherEnergy.preInit(JustAnotherEnergy.java:82)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:649)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
	at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:253)
	at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:231)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
	at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:148)
	at net.minecraftforge.fml.common.Loader.preinitializeMods(Loader.java:647)
	at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:276)
	at net.minecraft.client.Minecraft.init(Minecraft.java:478)
	at net.minecraft.client.Minecraft.run(Minecraft.java:387)
	at net.minecraft.client.main.Main.main(Main.java:118)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:26)

 

 

Developer of Primeval Forest.

Posted

Do not implement ITileEntityProvider, it is not needed. hasTileEntity and createTileEntity are in the Block class, override those.

 

You also haven't supplied a getMetaFromState or getStateFromMeta methods.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
3 minutes ago, Draco18s said:

Do not implement ITileEntityProvider, it is not needed. hasTileEntity and createTileEntity are in the Block class, override those.

 

You also haven't supplied a getMetaFromState or getStateFromMeta methods.

Yeah, totally forgot those. Thought why the 'or' and not 'and'? For everything else I always used both.

Developer of Primeval Forest.

Posted

What I said is perfectly grammatically correct.

You haven't done [A or B]

You haven't done either of [A or B]

 

And if you'd done any research at all into what threw that error, you would have figured out what you needed to do on your own.

 

    public int getMetaFromState(IBlockState state)
    {
        if (state.getPropertyKeys().isEmpty())
        {
            return 0;
        }
        else
        {
            throw new IllegalArgumentException("Don't know how to convert " + state + " back into data...");
        }
    }

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
4 minutes ago, Draco18s said:

What I said is perfectly grammatically correct.

You haven't done [A or B]

You haven't done either of [A or B]

 

That's then beyond my knowledge of grammar.

That's my understanding:

And -> implement both

Or -> implement either A or B only

Edited by Bektor

Developer of Primeval Forest.

Posted
20 minutes ago, Bektor said:

That's then beyond my knowledge of grammar.

That's my understanding:

And -> implement both

Or -> implement either A or B only

https://english.stackexchange.com/questions/95624/use-of-or-inclusive-or-exclusive

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
1 hour ago, Draco18s said:

Hm.. interesting... Different from what I'm used to.

 

For some reason I'm getting errors with the JSON:

 

[00:25:07] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:cable#east=false,north=true,south=false,west=true for blockstate "justanotherenergy:cable[east=false,north=true,south=false,west=true]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:cable#east=false,north=true,south=false,west=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:264) ~[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:252) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:159) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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:1257) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more

 

cable.json

{
	"forge_marker": 1,
	"defaults": {
		"model": "cable_base",
		"textures": { "all": "justanotherenergy:blocks/cable" }
	},
	"variants": {
	   "normal": { "model": "cable_base" },
	   "north": { "submodel": "cable_side" },
	   "south": { "submodel": "cable_side" },
	   "east": { "submodel": "cable_side" },
	   "west": { "submodel": "cable_side" },
		"inventory": [{ "transform": "cable_side" }]
	}
}

 

cable_base.json (cable_side is currently just a 1:1 copy with different naming)

{
    "parent": "cable_base",
    "texture": {
        "particle": "justanotherenergy:blocks/cable",
        "texture": "justanotherenergy:blocks/cable",
        "overlay": "justanotherenergy:blocks/cable"
    },
    "elements": [
        {
            "from": [ 4, 4, 4 ],
            "to": [ 12, 12, 12 ],
            "faces": {
                "down": { "cullface": "down" },
                "up": { "cullface": "up" },
                "north": { "cullface": "north" },
                "south": { "cullface": "south" },
                "west": { "cullface": "west" },
                "east": { "cullface": "east" }
            }
        }
    ]
}

 

I know that the error tells me some variants are missing, but I've got the north, south, east and west and even the normal variant [just in case].

Edited by Bektor

Developer of Primeval Forest.

Posted

Post all of the errors. There's likely more than one.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
18 hours ago, Draco18s said:

Post all of the errors. There's likely more than one.

Spoiler

[19:49:17] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:cable#east=false,north=true,south=false,west=true for blockstate "justanotherenergy:cable[east=false,north=true,south=false,west=true]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:cable#east=false,north=true,south=false,west=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:264) ~[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:252) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:159) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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:1257) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[19:49:17] [Client thread/ERROR] [FML]: Exception loading blockstate for the variant justanotherenergy:cable#east=false,north=true,south=false,west=true: 
java.lang.Exception: Could not load model definition for variant justanotherenergy:cable
	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:297) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:121) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:252) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:159) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of 'justanotherenergy:cable' from: 'justanotherenergy:blockstates/cable.json' in resourcepack: 'FMLFileResourcePack:JustAnotherEnergy'
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:246) ~[ModelBakery.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:223) ~[ModelBakery.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:208) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:293) ~[ModelLoader.class:?]
	... 20 more
Caused by: com.google.gson.JsonParseException: transform: unknown default string: cable_side
	at net.minecraftforge.client.model.ForgeBlockStateV1$Variant$Deserializer.deserialize(ForgeBlockStateV1.java:562) ~[ForgeBlockStateV1$Variant$Deserializer.class:?]
	at net.minecraftforge.client.model.ForgeBlockStateV1$Variant$Deserializer.deserialize(ForgeBlockStateV1.java:440) ~[ForgeBlockStateV1$Variant$Deserializer.class:?]
	at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:868) ~[Gson.class:?]
	at com.google.gson.Gson$1.deserialize(Gson.java:126) ~[Gson$1.class:?]
	at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:96) ~[ForgeBlockStateV1$Deserializer.class:?]
	at net.minecraftforge.client.model.ForgeBlockStateV1$Deserializer.deserialize(ForgeBlockStateV1.java:67) ~[ForgeBlockStateV1$Deserializer.class:?]
	at com.google.gson.TreeTypeAdapter.read(TreeTypeAdapter.java:58) ~[TreeTypeAdapter.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:803) ~[Gson.class:?]
	at com.google.gson.Gson.fromJson(Gson.java:741) ~[Gson.class:?]
	at net.minecraftforge.client.model.BlockStateLoader.load(BlockStateLoader.java:81) ~[BlockStateLoader.class:?]
	at codechicken.lib.model.loader.blockstate.CCBlockStateLoader.handleLoad(CCBlockStateLoader.java:42) ~[CCBlockStateLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBlockDefinition.parseFromReader(ModelBlockDefinition.java) ~[ModelBlockDefinition.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModelBlockDefinition(ModelBakery.java:242) ~[ModelBakery.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadMultipartMBD(ModelBakery.java:223) ~[ModelBakery.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.getModelBlockDefinition(ModelBakery.java:208) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.getModelBlockDefinition(ModelLoader.java:293) ~[ModelLoader.class:?]
	... 20 more
[19:49:17] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:plate_tin#inventory for item "justanotherenergy:plate_tin", normal location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:item/plate_tin with loader VanillaLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:340) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.io.FileNotFoundException: justanotherenergy:models/item/plate_tin.json
	at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:127) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:941) ~[ModelLoader$VanillaLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 20 more
[19:49:17] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:plate_tin#inventory for item "justanotherenergy:plate_tin", blockstate location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:plate_tin#inventory with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:348) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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:1257) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 20 more
[19:49:17] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:cable#east=true,north=true,south=true,west=true for blockstate "justanotherenergy:cable[east=true,north=true,south=true,west=true]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:cable#east=true,north=true,south=true,west=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:264) ~[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:252) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:159) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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:1257) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[19:49:17] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:cable#inventory for item "justanotherenergy:cable", normal location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:item/cable with loader VanillaLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:340) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]
Caused by: java.io.FileNotFoundException: justanotherenergy:models/item/cable.json
	at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:69) ~[FallbackResourceManager.class:?]
	at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:334) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.access$1600(ModelLoader.java:127) ~[ModelLoader.class:?]
	at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:941) ~[ModelLoader$VanillaLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 20 more
[19:49:17] [Client thread/ERROR] [FML]: Exception loading model for variant justanotherenergy:cable#inventory for item "justanotherenergy:cable", blockstate location exception: 
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model justanotherenergy:cable#inventory with loader VariantLoader.INSTANCE, skipping
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]
	at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:348) ~[ModelLoader.class:?]
	at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:175) ~[ModelBakery.class:?]
	at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:160) ~[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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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_144]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_144]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_144]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_144]
	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:1257) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 20 more

 

There you go. It should be noted that the JSON file itself is registered correctly as before implementing all the variants it worked fine.

Developer of Primeval Forest.

Posted

This is probably your main problem:

Caused by: java.lang.RuntimeException: Encountered an exception when loading model definition of 'justanotherenergy:cable' from: 'justanotherenergy:blockstates/cable.json' in resourcepack: 'FMLFileResourcePack:JustAnotherEnergy'
...
Caused by: com.google.gson.JsonParseException: transform: unknown default string: cable_side

But you've also got this:

Caused by: java.io.FileNotFoundException: justanotherenergy:models/item/plate_tin.json

And this:

Caused by: java.io.FileNotFoundException: justanotherenergy:models/item/cable.json

 

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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