Y-Axis Rotation Broken

Published by hawkster97 on Sun, 02/03/2019 - 19:19
Status
Fixed
Type
Product/platform
Not applicable
Priority
Normal
Issue description

When running MCreator mod on Server/Client setup, all blocks with Y-Axis rotation cause server crash/reboot with the below message on the server side. I've had to switch everything to include up/down rotation too, otherwise the server crashes as soon as anyone even adds the block to their inventory.

 

---- Minecraft Crash Report ----
// I blame Brandon Holt (rinrincodes) and Alex Hawk (hawka97), author of The MCLA Mod.

Time: 2019-02-03 14:12:11 EST
Description: Ticking player

java.lang.IllegalArgumentException: Cannot set property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} to down on block themclamod:flashbhr, it is not an allowed value
    at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:227)
    at mod.mcreator.mcreator_flashbhr$BlockCustom.getStateFromMeta(mcreator_flashbhr.java:72)
    at mods.railcraft.common.util.inventory.InvTools.getBlockStateFromStack(InvTools.java:488)
    at mods.railcraft.common.blocks.tracks.TrackTools.isRailBlock(TrackTools.java:73)
    at mods.railcraft.common.advancements.criterion.TrackItemPredicate.test(TrackItemPredicate.java:85)
    at net.minecraft.advancements.critereon.InventoryChangeTrigger$Instance.test(SourceFile:104)
    at net.minecraft.advancements.critereon.InventoryChangeTrigger$Listeners.trigger(SourceFile:149)
    at net.minecraft.advancements.critereon.InventoryChangeTrigger.trigger(SourceFile:69)
    at net.minecraft.entity.player.EntityPlayerMP.sendSlotContents(EntityPlayerMP.java:972)
    at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:91)
    at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:324)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1993)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:832)
    at net.minecraft.world.World.updateEntity(World.java:1955)
    at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:642)
    at net.minecraft.world.World.updateEntities(World.java:1734)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:613)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:767)
    at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:397)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
    at java.lang.Thread.run(Thread.java:748)


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

-- Player being ticked --
  Entity Type: null (net.minecraft.entity.player.EntityPlayerMP)
  Entity ID: 145
  Entity Name: HawkA97
  Entity's Exact location: -1223.31, 55.71, -30.78
  Entity's Block location: World: (-1224,55,-31), Chunk: (at 8,3,1 in -77,-2; contains blocks -1232,0,-32 to -1217,255,-17), Region: (-3,-1; contains chunks -96,-32 to -65,-1, blocks -1536,0,-512 to -1025,255,-1)
  Entity's Momentum: 0.00, 0.00, 0.00
  Entity's Passengers: []
  Entity's Vehicle: ~~ERROR~~ NullPointerException: null
  Entity NBT: {HurtByTimestamp:0,Spawns:[],SleepTimer:0s,Attributes:[{Base:20.0d,Name:"generic.maxHealth"},{Base:0.0d,Name:"generic.knockbackResistance"},{Base:0.20000000298023224d,Name:"generic.movementSpeed"},{Base:0.0d,Name:"generic.armor"},{Base:0.0d,Name:"generic.armorToughness"},{Base:1.0d,Name:"forge.swimSpeed"},{Base:1.0d,Name:"generic.attackDamage"},{Base:4.0d,Name:"generic.attackSpeed"},{Base:0.0d,Name:"generic.luck"},{Base:5.0d,Name:"generic.reachDistance"}],Invulnerable:0b,FallFlying:0b,PortalCooldown:0,AbsorptionAmount:0.0f,abilities:{invulnerable:1b,mayfly:1b,instabuild:1b,walkSpeed:0.2f,mayBuild:1b,flying:1b,flySpeed:0.1f},FallDistance:0.0f,recipeBook:{recipes:["minecraft:stonebrick","minecraft:stone_slab","minecraft:stone_pressure_plate","minecraft:stone_button"],isFilteringCraftable:0b,toBeDisplayed:["minecraft:stonebrick","minecraft:stone_slab","minecraft:stone_pressure_plate","minecraft:stone_button"],isGuiOpen:0b},DeathTime:0s,XpSeed:-1389287370,ForgeCaps:{"signpost:playerstore":{knownCountPos:0,knownCount:0,leftWaystones:-1,leftSignposts:-1},"vehicle:held_vehicle":{}},XpTotal:0,playerGameType:1,seenCredits:0b,Motion:[0.0d,0.0d,0.0d],UUIDLeast:-8258617452936190876L,Health:20.0f,foodSaturationLevel:5.0f,HasSpawnDimensionSet:0b,Air:300s,OnGround:0b,Dimension:0,ForgeDataVersion:{minecraft:1343,charset:5,immersiveengineering:1,architecturecraft:1,securitycraft:1,props:1},Rotation:[-215.4007f,6.000011f],XpLevel:0,UpdateBlocked:0b,Score:0,UUIDMost:7839087033135219080L,Sleeping:0b,Pos:[-1223.3086491590582d,55.70648493906289d,-30.77996598912639d],Fire:-20s,XpP:0.0f,EnderItems:[],DataVersion:1343,foodLevel:20,foodExhaustionLevel:0.0f,HurtTime:0s,SelectedItemSlot:2,Inventory:[{Slot:0b,id:"themclamod:wapn",Count:64b,Damage:0s},{Slot:1b,id:"themclamod:flashbhr",Count:64b,Damage:0s},{Slot:2b,id:"themclamod:g",Count:64b,Damage:0s},{Slot:3b,id:"themclamod:t",Count:64b,Damage:0s},{Slot:4b,id:"themclamod:r",Count:64b,Damage:0s},{Slot:5b,id:"themclamod:a",Count:64b,Damage:0s},{Slot:6b,id:"themclamod:l",Count:63b,Damage:0s}],foodTickTimer:0}

-- Affected level --
  Level name: City
  All players: 1 total; [EntityPlayerMP['HawkA97'/145, l='City', x=-1223.31, y=55.71, z=-30.78]]
  Chunk stats: ServerChunkCache: 330 Drop: 0
  Level seed: 2516689496499686762
  Level generator: ID 01 - flat, ver 0. Features enabled: false
  Level generator options: 3;2*minecraft:bedrock,20*minecraft:stone,20*minecraft:dirt,minecraft:grass;1;village
  Level spawn location: World: (-1028,44,-34), Chunk: (at 12,2,14 in -65,-3; contains blocks -1040,0,-48 to -1025,255,-33), Region: (-3,-1; contains chunks -96,-32 to -65,-1, blocks -1536,0,-512 to -1025,255,-1)
  Level time: 1558987427 game time, -678087 day time
  Level dimension: 0
  Level storage version: 0x04ABD - Anvil
  Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false)
  Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: true

-- System Details --
  Minecraft Version: 1.12.2
  Operating System: Linux (amd64) version 4.4.0-128-generic
  Java Version: 1.8.0_192, Oracle Corporation
  Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
  Memory: 757769016 bytes (722 MB) / 2794455040 bytes (2665 MB) up to 5726797824 bytes (5461 MB)
  JVM Flags: 2 total; -Xms128M -Xmx6144M
  IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

 

Issue comments

It looks like this is the code for rotation that is generated for Y-Axis rotation:

 

@Override
		protected net.minecraft.block.state.BlockStateContainer createBlockState() {
			return new net.minecraft.block.state.BlockStateContainer(this, new IProperty[]{FACING});
		}

		@Override
		public IBlockState getStateFromMeta(int meta) {
			return this.getDefaultState().withProperty(FACING, EnumFacing.getFront(meta));
		}

		@Override
		public int getMetaFromState(IBlockState state) {
			return ((EnumFacing) state.getValue(FACING)).getIndex();
		}

		@Override
		public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
				EntityLivingBase placer) {
			return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
		}

and some methods are not properly handling the horizontal only part. It should be something like:

@Override
		protected net.minecraft.block.state.BlockStateContainer createBlockState() {
			return new net.minecraft.block.state.BlockStateContainer(this, FACING);
		}

		@Override
		public IBlockState getStateFromMeta(int meta) {
			return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
		}

		@Override
		public int getMetaFromState(IBlockState state) {
			return ((EnumFacing) state.getValue(FACING)).getHorizontalIndex();
		}

		@Override
		public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta,
				EntityLivingBase placer) {
			return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing().getOpposite());
		}

 

Hi Klemen,

 

I downloaded the new MCreator and I still have the same issue (below). I am using MCreator 1.8.2 Build 2019.01.28.195958

 

 

Time: 2019-02-05 17:14:59 EST
Description: Ticking player

java.lang.IllegalArgumentException: Cannot set property PropertyDirection{name=facing, clazz=class net.minecraft.util.EnumFacing, values=[north, south, west, east]} to down on block themclamod:crosswalk1, it is not an allowed value
    at net.minecraft.block.state.BlockStateContainer$StateImplementation.withProperty(BlockStateContainer.java:227)
    at mod.mcreator.mcreator_crosswalk1$BlockCustom.getStateFromMeta(mcreator_crosswalk1.java:84)
    at mods.railcraft.common.util.inventory.InvTools.getBlockStateFromStack(InvTools.java:488)
    at mods.railcraft.common.blocks.tracks.TrackTools.isRailBlock(TrackTools.java:73)
    at mods.railcraft.common.advancements.criterion.TrackItemPredicate.test(TrackItemPredicate.java:85)
    at net.minecraft.advancements.critereon.InventoryChangeTrigger$Instance.test(SourceFile:104)
    at net.minecraft.advancements.critereon.InventoryChangeTrigger$Listeners.trigger(SourceFile:149)
    at net.minecraft.advancements.critereon.InventoryChangeTrigger.trigger(SourceFile:69)
    at net.minecraft.entity.player.EntityPlayerMP.sendSlotContents(EntityPlayerMP.java:972)
    at net.minecraft.inventory.Container.detectAndSendChanges(Container.java:91)
    at net.minecraft.entity.player.EntityPlayerMP.onUpdate(EntityPlayerMP.java:324)
    at net.minecraft.world.World.updateEntityWithOptionalForce(World.java:1993)
    at net.minecraft.world.WorldServer.updateEntityWithOptionalForce(WorldServer.java:832)
    at net.minecraft.world.World.updateEntity(World.java:1955)
    at net.minecraft.world.WorldServer.tickPlayers(WorldServer.java:642)
    at net.minecraft.world.World.updateEntities(World.java:1734)
    at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:613)
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:767)
    at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:397)
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:668)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:526)
    at java.lang.Thread.run(Thread.java:748)

 

Hi,

 

I found the issue. I am using a more recent version of Forge (1810). I disabled all of the version checking on my server due to previous issues with other mods, so the MCreator 1768 requirement didn't get noticed. 

I'll lock the code and fix myself, since 1810 is not supported by MCreator.

 

Sorry for the waste of time and confusion.

Thanks for being so helpful.

 

On a side note, apparently Forge has changed the way they handle rotation, so the code will need to be more strict towards which direction. It doesn't matter now for MCreator, but at least for the next Recommended build of Forge it will. :)



Donate to MCreator

By donating to developers you can speed up development, as with more resources, we can dedicate more time to MCreator. It is a free project made by developers working on it in their free time.