Jump to content

Recommended Posts

Posted

Hi,

I'm trying to make an underwater seaweed block.

However, when placed underwater, it looks bad as the water flows around it.

I assume therefore I need to change the block's material to be that of water? (as described in another topic) Unless there is an easier way to do it.

However, when I do this, the game crashes whenever I place the block now.

Crash log:
 

Spoiler

[21:16:34] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:630]: ---- Minecraft Crash Report ----
// Oh - I know what I did wrong!

Time: 7/24/17 9:16 PM
Description: Ticking entity

java.lang.IllegalArgumentException: Cannot get property PropertyInteger{name=level, clazz=class java.lang.Integer, values=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]} as it does not exist in BlockStateContainer{block=biochemicalengineering:brownseaweed, properties=[]}
	at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:204)
	at net.minecraft.world.World.handleMaterialAcceleration(World.java:2392)
	at net.minecraft.entity.Entity.handleWaterMovement(Entity.java:1345)
	at net.minecraft.entity.EntityLivingBase.updateFallState(EntityLivingBase.java:237)
	at net.minecraft.entity.Entity.move(Entity.java:1001)
	at net.minecraft.client.entity.EntityPlayerSP.move(EntityPlayerSP.java:1179)
	at net.minecraft.entity.EntityLivingBase.travel(EntityLivingBase.java:2146)
	at net.minecraft.entity.player.EntityPlayer.travel(EntityPlayer.java:1950)
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2596)
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:563)
	at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:1126)
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2378)
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:258)
	at net.minecraft.client.entity.EntityPlayerSP.onUpdate(EntityPlayerSP.java:229)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2141)
	at net.minecraft.world.World.updateEntity(World.java:2101)
	at net.minecraft.world.World.updateEntities(World.java:1912)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1955)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1171)
	at net.minecraft.client.Minecraft.run(Minecraft.java:436)
	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)


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Client thread
Stacktrace:
	at net.minecraft.block.state.BlockStateContainer$StateImplementation.getValue(BlockStateContainer.java:204)
	at net.minecraft.world.World.handleMaterialAcceleration(World.java:2392)
	at net.minecraft.entity.Entity.handleWaterMovement(Entity.java:1345)
	at net.minecraft.entity.EntityLivingBase.updateFallState(EntityLivingBase.java:237)
	at net.minecraft.entity.Entity.move(Entity.java:1001)
	at net.minecraft.client.entity.EntityPlayerSP.move(EntityPlayerSP.java:1179)
	at net.minecraft.entity.EntityLivingBase.travel(EntityLivingBase.java:2146)
	at net.minecraft.entity.player.EntityPlayer.travel(EntityPlayer.java:1950)
	at net.minecraft.entity.EntityLivingBase.onLivingUpdate(EntityLivingBase.java:2596)
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:563)
	at net.minecraft.client.entity.EntityPlayerSP.onLivingUpdate(EntityPlayerSP.java:1126)
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2378)
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:258)
	at net.minecraft.client.entity.EntityPlayerSP.onUpdate(EntityPlayerSP.java:229)
	at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:2141)
	at net.minecraft.world.World.updateEntity(World.java:2101)

-- Entity being ticked --
Details:
	Entity Type: null (net.minecraft.client.entity.EntityPlayerSP)
	Entity ID: 216
	Entity Name: Sommanker
	Entity's Exact location: 40.19, 66.35, 48.65
	Entity's Block location: World: (40,66,48), Chunk: (at 8,4,0 in 2,3; contains blocks 32,0,48 to 47,255,63), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Entity's Momentum: -0.09, -0.29, 0.03
	Entity's Passengers: []
	Entity's Vehicle: ~~ERROR~~ NullPointerException: null
Stacktrace:
	at net.minecraft.world.World.updateEntities(World.java:1912)

-- Affected level --
Details:
	Level name: MpServer
	All players: 1 total; [EntityPlayerSP['Sommanker'/216, l='MpServer', x=40.19, y=66.35, z=48.65]]
	Chunk stats: MultiplayerChunkCache: 622, 622
	Level seed: 0
	Level generator: ID 00 - default, ver 1. Features enabled: false
	Level generator options: 
	Level spawn location: World: (20,64,98), Chunk: (at 4,4,2 in 1,6; contains blocks 16,0,96 to 31,255,111), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511)
	Level time: 9813 game time, 9813 day time
	Level dimension: 0
	Level storage version: 0x00000 - Unknown?
	Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
	Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
	Forced entities: 99 total; [EntityBat['Bat'/76, l='MpServer', x=-37.67, y=38.87, z=48.35], EntityWitch['Witch'/80, l='MpServer', x=-26.50, y=31.00, z=23.50], EntityItem['item.tile.biochemicalengineering.brownseaweed'/336, l='MpServer', x=39.13, y=65.00, z=49.13], EntityWitch['Witch'/81, l='MpServer', x=-29.50, y=31.00, z=24.50], EntityZombie['Zombie'/82, l='MpServer', x=-29.50, y=65.00, z=58.50], EntityZombie['Zombie'/88, l='MpServer', x=-12.50, y=55.00, z=6.50], EntityZombie['Zombie'/89, l='MpServer', x=-14.50, y=55.00, z=3.50], EntityZombie['Zombie'/90, l='MpServer', x=-13.50, y=55.00, z=3.50], EntitySheep['Sheep'/91, l='MpServer', x=-7.78, y=77.00, z=63.45], EntitySheep['Sheep'/92, l='MpServer', x=-4.42, y=72.00, z=67.93], EntitySheep['Sheep'/93, l='MpServer', x=-12.50, y=80.00, z=58.45], EntitySheep['Sheep'/94, l='MpServer', x=-12.50, y=80.00, z=59.43], EntitySheep['Sheep'/95, l='MpServer', x=-8.53, y=74.00, z=71.76], EntitySheep['Sheep'/96, l='MpServer', x=-6.21, y=74.00, z=67.61], EntitySkeleton['Skeleton'/100, l='MpServer', x=8.73, y=40.00, z=26.55], EntityBat['Bat'/101, l='MpServer', x=0.75, y=57.10, z=20.75], EntitySheep['Sheep'/102, l='MpServer', x=1.51, y=71.00, z=20.01], EntityBat['Bat'/103, l='MpServer', x=11.88, y=20.97, z=30.85], EntityBat['Bat'/104, l='MpServer', x=19.89, y=19.45, z=40.14], EntitySkeleton['Skeleton'/105, l='MpServer', x=7.13, y=45.00, z=39.37], EntityZombie['Zombie'/106, l='MpServer', x=6.50, y=37.00, z=33.50], EntityCreeper['Creeper'/107, l='MpServer', x=15.85, y=47.00, z=42.52], EntityBat['Bat'/108, l='MpServer', x=24.74, y=45.04, z=40.16], EntityCreeper['Creeper'/109, l='MpServer', x=7.39, y=19.00, z=59.07], EntityCreeper['Creeper'/110, l='MpServer', x=3.50, y=19.00, z=59.50], EntitySheep['Sheep'/111, l='MpServer', x=7.56, y=70.00, z=67.45], EntitySheep['Sheep'/112, l='MpServer', x=5.17, y=74.00, z=74.48], EntitySheep['Sheep'/113, l='MpServer', x=9.45, y=70.00, z=65.55], EntitySheep['Sheep'/114, l='MpServer', x=6.23, y=69.00, z=58.52], EntitySheep['Sheep'/115, l='MpServer', x=9.51, y=69.00, z=57.78], EntityItem['item.tile.cloth.white'/116, l='MpServer', x=8.20, y=71.00, z=83.04], EntityItem['item.item.muttonRaw'/117, l='MpServer', x=8.48, y=70.00, z=83.34], EntitySheep['Sheep'/123, l='MpServer', x=30.49, y=75.00, z=-4.27], EntitySheep['Sheep'/124, l='MpServer', x=23.83, y=73.00, z=-13.66], EntitySheep['Sheep'/125, l='MpServer', x=27.79, y=73.00, z=-2.51], EntitySkeleton['Skeleton'/126, l='MpServer', x=29.50, y=31.00, z=20.50], EntitySkeleton['Skeleton'/127, l='MpServer', x=27.67, y=48.00, z=22.49], EntityCreeper['Creeper'/128, l='MpServer', x=28.83, y=48.00, z=22.48], EntitySkeleton['Skeleton'/129, l='MpServer', x=31.52, y=51.00, z=25.21], EntityZombieVillager['Zombie Villager'/130, l='MpServer', x=26.51, y=15.00, z=41.70], EntityCreeper['Creeper'/131, l='MpServer', x=21.50, y=18.00, z=39.50], EntityZombieVillager['Zombie Villager'/132, l='MpServer', x=19.50, y=20.00, z=45.24], EntityBat['Bat'/133, l='MpServer', x=19.58, y=22.81, z=37.77], EntityBat['Bat'/134, l='MpServer', x=30.25, y=47.10, z=36.25], EntityBat['Bat'/135, l='MpServer', x=22.01, y=41.14, z=42.54], EntityBat['Bat'/136, l='MpServer', x=9.79, y=37.39, z=35.16], EntityZombie['Zombie'/137, l='MpServer', x=20.21, y=54.00, z=35.51], EntityZombie['Zombie'/138, l='MpServer', x=22.50, y=20.00, z=60.50], EntityBat['Bat'/140, l='MpServer', x=45.75, y=22.10, z=-4.49], EntityBat['Bat'/141, l='MpServer', x=41.47, y=16.79, z=-8.99], EntitySkeleton['Skeleton'/142, l='MpServer', x=45.50, y=20.00, z=1.50], EntityZombie['Zombie'/143, l='MpServer', x=38.50, y=22.00, z=11.50], EntityZombie['Zombie'/144, l='MpServer', x=36.50, y=21.00, z=9.20], EntityCreeper['Creeper'/145, l='MpServer', x=33.52, y=42.00, z=13.79], EntityBat['Bat'/146, l='MpServer', x=46.53, y=58.45, z=4.75], EntityBat['Bat'/147, l='MpServer', x=38.25, y=27.10, z=25.75], EntityWitch['Witch'/148, l='MpServer', x=40.78, y=27.00, z=31.49], EntitySkeleton['Skeleton'/149, l='MpServer', x=34.51, y=18.00, z=19.71], EntityZombie['Zombie'/150, l='MpServer', x=33.55, y=51.00, z=18.75], EntityCreeper['Creeper'/151, l='MpServer', x=33.50, y=55.00, z=37.82], EntitySquid['Squid'/152, l='MpServer', x=43.22, y=61.52, z=60.57], EntitySquid['Squid'/153, l='MpServer', x=48.53, y=62.46, z=60.44], EntitySquid['Squid'/154, l='MpServer', x=39.46, y=61.99, z=59.01], EntityWolf['Wolf'/156, l='MpServer', x=49.55, y=68.00, z=-28.51], EntityWolf['Wolf'/157, l='MpServer', x=51.71, y=71.00, z=-20.50], EntityWolf['Wolf'/158, l='MpServer', x=58.49, y=66.00, z=-20.38], EntityBat['Bat'/159, l='MpServer', x=42.56, y=20.08, z=5.52], EntityZombie['Zombie'/160, l='MpServer', x=51.70, y=28.00, z=31.43], EntityZombie['Zombie'/161, l='MpServer', x=42.56, y=47.00, z=29.22], EntitySkeleton['Skeleton'/162, l='MpServer', x=57.81, y=24.00, z=42.25], EntityZombie['Zombie'/163, l='MpServer', x=55.56, y=46.00, z=37.73], EntitySpider['Spider'/164, l='MpServer', x=54.36, y=50.00, z=57.30], EntityWolf['Wolf'/166, l='MpServer', x=69.46, y=63.00, z=-23.51], EntitySkeleton['Skeleton'/167, l='MpServer', x=71.50, y=17.00, z=-0.50], EntityCreeper['Creeper'/168, l='MpServer', x=73.30, y=43.00, z=-4.70], EntityWitch['Witch'/169, l='MpServer', x=73.50, y=17.00, z=0.50], EntityZombie['Zombie'/170, l='MpServer', x=76.50, y=27.00, z=53.82], EntityZombie['Zombie'/171, l='MpServer', x=82.80, y=47.00, z=-28.48], EntityCreeper['Creeper'/172, l='MpServer', x=82.16, y=46.00, z=-0.50], EntityCreeper['Creeper'/173, l='MpServer', x=91.50, y=14.00, z=50.50], EntitySquid['Squid'/174, l='MpServer', x=89.10, y=56.26, z=77.36], EntitySquid['Squid'/175, l='MpServer', x=95.05, y=55.03, z=85.46], EntitySquid['Squid'/176, l='MpServer', x=78.74, y=62.20, z=98.61], EntityZombie['Zombie'/178, l='MpServer', x=108.46, y=45.00, z=-24.91], EntityCreeper['Creeper'/179, l='MpServer', x=109.22, y=45.00, z=-24.29], EntityCreeper['Creeper'/180, l='MpServer', x=106.50, y=45.00, z=-25.50], EntitySkeleton['Skeleton'/181, l='MpServer', x=107.50, y=45.00, z=-21.50], EntitySpider['Spider'/182, l='MpServer', x=102.99, y=44.00, z=-21.00], EntityZombie['Zombie'/184, l='MpServer', x=105.50, y=24.00, z=85.50], EntityZombie['Zombie'/185, l='MpServer', x=101.55, y=26.00, z=79.79], EntityCreeper['Creeper'/186, l='MpServer', x=104.53, y=26.00, z=80.85], EntitySquid['Squid'/187, l='MpServer', x=106.64, y=58.31, z=91.94], EntitySquid['Squid'/188, l='MpServer', x=95.88, y=53.89, z=88.94], EntityZombie['Zombie'/192, l='MpServer', x=118.70, y=20.00, z=31.50], EntityZombie['Zombie'/193, l='MpServer', x=118.09, y=20.00, z=31.49], EntityBat['Bat'/197, l='MpServer', x=118.06, y=21.84, z=55.51], EntityCreeper['Creeper'/198, l='MpServer', x=115.50, y=20.00, z=75.50], EntityCreeper['Creeper'/199, l='MpServer', x=116.50, y=20.00, z=71.50], EntityPlayerSP['Sommanker'/216, l='MpServer', x=40.19, y=66.35, z=48.65]]
	Retry entities: 0 total; []
	Server brand: fml,forge
	Server type: Integrated singleplayer server
Stacktrace:
	at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:456)
	at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2868)
	at net.minecraft.client.Minecraft.run(Minecraft.java:457)
	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)

How do I go about fixing this?

Thanks

 

 

Posted

You need to add the LEVEL property to your block's BlockStateContainer, by overriding createBlockState.

 

Setting your block's material to water won't make any difference to the way it renders though. If you want it to look like water you'll need to model it yourself.

  • Like 1
Posted

Using Material.WATER does allow the model to be rendered with water surrounding it, as I explain here:

On 22/10/2016 at 11:24 PM, Choonster said:

Your block's model will be rendered with water surrounding it if its Material is Material.WATER.

 

A lot of vanilla code expects blocks that use Material.WATER to have the BlockLiquid.LEVEL property, so your block needs to include this. It doesn't need to be saved to the metadata, just set the default value to 0 and override Block#getMetaFromState to ignore it.

 

You can see an example of this here.

 

A screenshot of the effect (with Night Vision and Water Breathing active):

f7glVO5.png

  • Like 2

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Wow, I had no idea. Does that also render the top surface if the block doesn't have water on top of it? What about if the block is on its own and not surrounded by any water?

Posted (edited)

I doubt it renders the top surface if the block has no water on top, but I'm not sure since at the moment, I can't get it to work.

I believe that I have added the level property, as the block now places without the game crashing.

However, when placed, it looks and behaves like a water source block (only it doesn't flow). (The model still looks correct when held in hand)

BrownSeaweed class:

Spoiler

public class BrownSeaweed extends BlockLiquid {
protected static final PropertyInteger LEVEL = PropertyInteger.create("level", 0, 15);
public static BlockStateContainer blockState;
public BrownSeaweed()
{
super(Material.WATER);
blockState = this.createBlockState();

setDefaultState(blockState.getBaseState().withProperty(LEVEL, Integer.valueOf(0)));
setUnlocalizedName(BiochemicalEngineering.MOD_ID + ".brownseaweed" );
setRegistryName("brownseaweed");
setHardness(0.0F);
setResistance(0.0F);
setCreativeTab(CreativeTabs.MATERIALS);
setHarvestLevel(null, 0);

}

@SideOnly(Side.CLIENT)
public void initModel() {
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}

@Override
protected BlockStateContainer createBlockState()
{
    return new BlockStateContainer(this, new IProperty[] {LEVEL});
}

@Override
public int getMetaFromState(IBlockState state)
{
    return 0;
}

}

 

blockstates/brownseaweed.json:

Spoiler

{
  "forge_marker": 1,
  "defaults": {
    "model": "biochemicalengineering:brownseaweed"
  },
  "variants": {
    "normal": [{}],
    "inventory": [{}]

  }
}

 

models/block/brownseaweed.json:

Spoiler

{
  "parent": "block/cross",
  "textures": {
"cross":
"biochemicalengineering:blocks/brownseaweed"

  }
}

 

Errors in console:

Spoiler

[10:58:20] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=9 for blockstate "biochemicalengineering:brownseaweed[level=9]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=9 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[10:58:20] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=8 for blockstate "biochemicalengineering:brownseaweed[level=8]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=8 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[10:58:20] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=7 for blockstate "biochemicalengineering:brownseaweed[level=7]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=7 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[10:58:20] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=6 for blockstate "biochemicalengineering:brownseaweed[level=6]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=6 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more

 

 

Looking at the errors, it seems as though I need to provide model variants for each level of water even though they are unused?

I don't know if that's correct though, and I don't know how to do so.

 

 

 

Edited by Sommanker
Posted

Don't extend BlockLiquid or create your own property; just use Material.WATER and include the BlockLiquid.LEVEL property.

 

Since your Block has a property, you either need to include the property's values in your blockstates file or ignore the property by registering an IStateMapper for the Block by calling ModelLoader.setCustomStateMapper in ModelRegistryEvent. You can create the IStateMapper using StateMap.Builder.

 

 

29 minutes ago, Jay Avery said:

Wow, I had no idea. Does that also render the top surface if the block doesn't have water on top of it? What about if the block is on its own and not surrounded by any water?

 

It won't render water on any side of the block not touching water:

IDDs7Zf.png

  • Like 2

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)

 

I think I've done what you said above, and now the model does not appear as water, but it does appear as a solid block with no texture. Again, the texture is normal in the hand, including the block/cross ness, which seems to be absent when placed as a block.

 

What did I do wrong?

 

BrownSeaweed class:

Spoiler

public class BrownSeaweed extends Block {

public static BlockStateContainer blockState;
public BrownSeaweed()
{
super(Material.WATER);
blockState = this.createBlockState();
setDefaultState(blockState.getBaseState().withProperty(BlockLiquid.LEVEL, Integer.valueOf(0)));
setUnlocalizedName(BiochemicalEngineering.MOD_ID + ".brownseaweed" );
setRegistryName("brownseaweed");
setHardness(0.0F);
setResistance(0.0F);
setCreativeTab(CreativeTabs.MATERIALS);
setHarvestLevel(null, 0);

}

@SideOnly(Side.CLIENT)
public void initModel() {
    ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
}

@Override
protected BlockStateContainer createBlockState()
{
    return new BlockStateContainer(this, new IProperty[] {BlockLiquid.LEVEL});
}

@Override
public int getMetaFromState(IBlockState state)
{
    return 0;
}

}


 

 

ClientProxy class:

Spoiler

@Mod.EventBusSubscriber(Side.CLIENT)
public class ClientProxy extends CommonProxy {
    @Override
    public void preInit(FMLPreInitializationEvent e) {
        super.preInit(e);
       
    }

    @SubscribeEvent
    public static void registerModels(ModelRegistryEvent event) {
    	ModItems.initModels();
    	ModBlocks.initModels();
    	final StateMap.Builder AS = new StateMap.Builder();
    	ModelLoader.setCustomStateMapper(ModBlocks.brownseaweed, AS.ignore(BrownSeaweed.blockState.getProperty("LEVEL")).build());
    }
}


 

 

ModBlocks class:

Spoiler

@ObjectHolder(BiochemicalEngineering.MOD_ID)
public class ModBlocks {
		@ObjectHolder("brownseaweed")
	    public static BrownSeaweed brownseaweed;
		
		@SideOnly(Side.CLIENT)
		public static void initModels()
		{
			brownseaweed.initModel();
		}
		
}

 

And the errors in console:


 

Spoiler

[12:05:38] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=9 for blockstate "biochemicalengineering:brownseaweed[level=9]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=9 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[12:05:38] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=8 for blockstate "biochemicalengineering:brownseaweed[level=8]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=8 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[12:05:38] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=7 for blockstate "biochemicalengineering:brownseaweed[level=7]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=7 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[12:05:38] [main/ERROR] [FML]: Exception loading model for variant biochemicalengineering:brownseaweed#level=6 for blockstate "biochemicalengineering:brownseaweed[level=6]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model biochemicalengineering:brownseaweed#level=6 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:233) ~[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:221) ~[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:121) [SimpleReloadableResourceManager.class:?]
	at net.minecraft.client.Minecraft.init(Minecraft.java:554) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:416) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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_141]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_141]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_141]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_141]
	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:83) ~[ModelBlockDefinition.class:?]
	at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1208) ~[ModelLoader$VariantLoader.class:?]
	at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
	... 21 more
[12:05:38] [main/FATAL] [FML]: Suppressed additional 11 model loading errors for domain biochemicalengineering

 

Edited by Sommanker
Posted

There is no property with the name "LEVEL" in your Block's BlockStateContainer, so BlockStateContainer#getProperty returns null and you call StateMap.Builder#ignore with this null value. The name of the BlockLiquid.LEVEL property is "level".

 

Don't call Block#createState yourself, don't store the BlockStateContainer in a static field and don't use BlockStateContainer#getProperty to get the property. Just reference BlockLiquid.LEVEL directly.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

It works! Thanks <3

Excluding a few things :c

The texture is now there, however the transparent sections of the texture (only when placed as a block) appear as solid black rather than transparent.

Also, when the block is placed, any adjacent blocks have no texture on that face anymore (invisible) (http://imgur.com/a/wAse1)

There are no errors in the console now, though :D

 

Changed code:

Spoiler

public class BrownSeaweed extends Block {

public BlockStateContainer blockState;
public BrownSeaweed()
{
super(Material.WATER);


setUnlocalizedName(BiochemicalEngineering.MOD_ID + ".brownseaweed" );
setRegistryName("brownseaweed");
setHardness(0.0F);
setResistance(0.0F);
setCreativeTab(CreativeTabs.MATERIALS);
setHarvestLevel(null, 0);

}

 


@SubscribeEvent
    public static void registerModels(ModelRegistryEvent event) {
    	ModItems.initModels();
    	ModBlocks.initModels();
    	final StateMap.Builder AS = new StateMap.Builder();
    	ModelLoader.setCustomStateMapper(ModBlocks.brownseaweed, AS.ignore(BlockLiquid.LEVEL).build());
    }

 

 

 

 

Posted
1 minute ago, Sommanker said:

The texture is now there, however the transparent sections of the texture (only when placed as a block) appear as solid black rather than transparent.

 

Override Block#getBlockLayer to return BlockRenderLayer.CUTOUT or BlockRenderLayer.CUTOUT_MIPPED. The Grey Ghost explains render layers in more detail here.

 

3 minutes ago, Sommanker said:

Also, when the block is placed, any adjacent blocks have no texture on that face anymore (invisible)

 

Override Block#isOpaqueCube to return false.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)
2 minutes ago, Sommanker said:

isOpaqueCube is deprecated, but it works.

 

Many Block methods (like Block#isOpaqueCube) have been deprecated by Mojang to signal that they should be overridden but not called; the corresponding IBlockProperties methods (inherited by IBlockState) should be called instead.

 

Other methods have been deprecated by Forge to signal that they shouldn't be used at all, these usually include a comment explaining which method to use instead.

Edited by Choonster
  • Like 2

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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

×
×
  • Create New...

Important Information

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