Jump to content

Recommended Posts

Posted

 

---- Minecraft Crash Report ----

 

WARNING: coremods are present:

  CCLCorePlugin (CodeChickenLib-1.8-1.1.2.133-dev.jar)

  CCCDeobfPlugin (unknown)

  CodeChickenCorePlugin (CodeChickenCore-1.8-1.0.5.36-dev.jar)

  NEICorePlugin (NotEnoughItems-1.8-1.0.5.104-dev.jar)

  MorePlanetsPlugin (bin)

Contact their authors BEFORE contacting forge

 

// Oops.

 

Time: 12/7/2558, 22:46 น.

Description: Unexpected error

 

java.lang.IllegalArgumentException: Cannot get property PropertyEnum{name=variant, clazz=class stevekung.mods.moreplanets.planets.fronos.blocks.BlockFronosTallGrass$BlockType, values=[fronos_short_grass, fronos_medium_grass, fronos_tall_grass, pink_short_grass, pink_medium_grass, pink_tall_grass, purple_short_grass, purple_medium_grass, purple_tall_grass, plains_short_grass, plains_medium_grass, plains_tall_grass, golden_short_grass, golden_medium_grass, golden_tall_grass]} as it does not exist in BlockState{block=minecraft:air, properties=[]}

at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:167)

at stevekung.mods.moreplanets.planets.fronos.blocks.BlockFronosTallGrass.canBlockStay(BlockFronosTallGrass.java:125)

at stevekung.mods.moreplanets.common.blocks.BlockFlowerMP.canReplace(BlockFlowerMP.java:62)

at net.minecraft.world.World.canBlockBePlaced(World.java:3394)

at net.minecraft.item.ItemBlock.canPlaceBlockOnSide(ItemBlock.java:142)

at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:423)

at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1571)

at net.minecraft.client.Minecraft.runTick(Minecraft.java:2131)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087)

at net.minecraft.client.Minecraft.run(Minecraft.java:376)

at net.minecraft.client.main.Main.main(Main.java:117)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:167)

at stevekung.mods.moreplanets.planets.fronos.blocks.BlockFronosTallGrass.canBlockStay(BlockFronosTallGrass.java:125)

at stevekung.mods.moreplanets.common.blocks.BlockFlowerMP.canReplace(BlockFlowerMP.java:62)

at net.minecraft.world.World.canBlockBePlaced(World.java:3394)

at net.minecraft.item.ItemBlock.canPlaceBlockOnSide(ItemBlock.java:142)

at net.minecraft.client.multiplayer.PlayerControllerMP.func_178890_a(PlayerControllerMP.java:423)

at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1571)

 

-- Affected level --

Details:

Level name: MpServer

All players: 1 total; [EntityPlayerSP['Player209'/2, l='MpServer', x=-934.21, y=85.00, z=610.01]]

Chunk stats: MultiplayerChunkCache: 273, 273

Level seed: 0

Level generator: ID 01 - flat, ver 0. Features enabled: false

Level generator options:

Level spawn location: -395.00,4.00,766.00 - World: (-395,4,766), Chunk: (at 5,0,14 in -25,47; contains blocks -400,0,752 to -385,255,767), Region: (-1,1; contains chunks -32,32 to -1,63, blocks -512,0,512 to -1,255,1023)

Level time: 71808 game time, 6000 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: 31 total; [EntityTomato['Tomato'/65, l='MpServer', x=-985.50, y=72.00, z=530.50], EntityMelon['Melon'/3, l='MpServer', x=-938.25, y=84.00, z=624.94], EntityMelon['Melon'/4, l='MpServer', x=-927.81, y=86.00, z=642.66], EntityItem['item.item.fronos_food.berry'/5, l='MpServer', x=-934.34, y=85.00, z=631.88], EntityMelon['Melon'/6, l='MpServer', x=-914.24, y=86.00, z=628.97], EntityItem['item.tile.white_fronos_poppy'/7, l='MpServer', x=-952.91, y=63.00, z=653.22], EntityMarshmallow['Marshmallow'/8, l='MpServer', x=-960.22, y=64.00, z=653.19], EntityMarshmallow['Marshmallow'/9, l='MpServer', x=-963.28, y=73.00, z=641.88], EntityMarshmallow['Marshmallow'/10, l='MpServer', x=-945.88, y=63.00, z=652.25], EntityGrappy['Grappy'/11, l='MpServer', x=-954.50, y=63.00, z=591.50], EntityGrappy['Grappy'/12, l='MpServer', x=-954.44, y=65.00, z=589.44], EntityGrappy['Grappy'/13, l='MpServer', x=-958.91, y=63.00, z=589.16], EntityGrappy['Grappy'/14, l='MpServer', x=-955.50, y=68.00, z=587.72], EntityBerry['Berry'/15, l='MpServer', x=-962.50, y=69.00, z=648.50], EntityBerry['Berry'/16, l='MpServer', x=-962.50, y=68.00, z=649.50], EntityMarshmallow['Marshmallow'/17, l='MpServer', x=-963.66, y=69.00, z=649.91], EntityBerry['Berry'/18, l='MpServer', x=-964.50, y=67.00, z=651.50], EntityBerry['Berry'/19, l='MpServer', x=-966.94, y=64.00, z=658.31], EntityStrawberryChicken['Strawberry Chicken'/20, l='MpServer', x=-992.50, y=63.00, z=608.50], EntityStrawberryChicken['Strawberry Chicken'/21, l='MpServer', x=-995.66, y=62.50, z=613.38], EntityTomato['Tomato'/22, l='MpServer', x=-873.56, y=69.00, z=638.72], EntityTomato['Tomato'/23, l='MpServer', x=-886.19, y=73.00, z=647.56], EntityItem['item.item.seeds'/24, l='MpServer', x=-984.69, y=61.00, z=662.09], EntityTomato['Tomato'/25, l='MpServer', x=-876.41, y=71.00, z=643.13], EntityTomato['Tomato'/26, l='MpServer', x=-885.09, y=74.00, z=635.22], EntityMelon['Melon'/27, l='MpServer', x=-980.50, y=64.00, z=686.50], EntityTomato['Tomato'/35, l='MpServer', x=-990.34, y=73.00, z=531.34], EntityMelon['Melon'/52, l='MpServer', x=-978.50, y=63.00, z=688.50], EntityMelon['Melon'/54, l='MpServer', x=-981.56, y=64.00, z=688.28], EntityItem['item.item.fronos_food.berry'/378, l='MpServer', x=-965.78, y=63.00, z=657.81], EntityPlayerSP['Player209'/2, l='MpServer', x=-934.21, y=85.00, z=610.01]]

Retry entities: 0 total; []

Server brand: fml,forge

Server type: Integrated singleplayer server

Stacktrace:

at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:392)

at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2614)

at net.minecraft.client.Minecraft.run(Minecraft.java:405)

at net.minecraft.client.main.Main.main(Main.java:117)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)

at net.minecraft.launchwrapper.Launch.main(Launch.java:28)

at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)

at GradleStart.main(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.8.0_45, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 627554880 bytes (598 MB) / 1060372480 bytes (1011 MB) up to 1060372480 bytes (1011 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 2, tallocated: 28

FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1487 10 mods loaded, 10 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1487.jar)

UCHIJAAAA Forge{11.14.3.1487} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1487.jar)

UCHIJAAAA CodeChickenCore{1.0.5.36} [CodeChicken Core] (minecraft.jar)

UCHIJAAAA NotEnoughItems{1.0.5.104} [Not Enough Items] (NotEnoughItems-1.8-1.0.5.104-dev.jar)

UCHIJAAAA GalacticraftCore{3.0.12} [Galacticraft Core] (bin)

UCHIJAAAA NBTEdit{1.7.10-1.0} [in-game NBTEdit] (bin)

UCHIJAAAA DragonMounts{@VERSION@} [Dragon Mounts] (bin)

UCHIJAAAA GalacticraftMars{3.0.12} [Galacticraft Planets] (bin)

UCHIJAAAA MorePlanets{2.0.0} [More Planets] (bin)

Loaded coremods (and transformers):

CCLCorePlugin (CodeChickenLib-1.8-1.1.2.133-dev.jar)

  codechicken.lib.asm.ClassHeirachyManager

  codechicken.lib.asm.RenderHookTransformer

CCCDeobfPlugin (unknown)

 

CodeChickenCorePlugin (CodeChickenCore-1.8-1.0.5.36-dev.jar)

  codechicken.core.asm.InterfaceDependancyTransformer

  codechicken.core.asm.TweakTransformer

  codechicken.core.asm.DelegatedTransformer

  codechicken.core.asm.DefaultImplementationTransformer

NEICorePlugin (NotEnoughItems-1.8-1.0.5.104-dev.jar)

  codechicken.nei.asm.NEITransformer

MorePlanetsPlugin (bin)

  stevekung.mods.moreplanets.plugin.asm.MorePlanetsTransformer

GL info: ' Vendor: 'NVIDIA Corporation' Version: '3.3.0' Renderer: 'GeForce 9500 GT/PCIe/SSE2'

Launched Version: 1.8

LWJGL: 2.9.1

OpenGL: GeForce 9500 GT/PCIe/SSE2 GL version 3.3.0, NVIDIA Corporation

GL Caps: Using GL 1.3 multitexturing.

Using GL 1.3 texture combiners.

Using framebuffer objects because OpenGL 3.0 is supported and separate blending is supported.

Shaders are available because OpenGL 2.1 is supported.

VBOs are available because OpenGL 1.5 is supported.

 

Using VBOs: Yes

Is Modded: Definitely; Client brand changed to 'fml,forge'

Type: Client (map_client.txt)

Resource Packs: []

Current Language: English (US)

Profiler Position: N/A (disabled)

 

 

 

I have no idea why it happened? I copied from original minecraft world gen code, and adapted a little bit.

 

See my code.

https://github.com/SteveKunG/More-Planets/tree/1.8/src/main/java/stevekung/mods/moreplanets

 

Posted

The issue is that you are treating an air block like it was your block:

java.lang.IllegalArgumentException: Cannot get property PropertyEnum{...} as it does not exist in BlockState{block=minecraft:air, properties=[]}

at stevekung.mods.moreplanets.planets.fronos.blocks.BlockFronosTallGrass.canBlockStay(BlockFronosTallGrass.java:125)

at stevekung.mods.moreplanets.common.blocks.BlockFlowerMP.canReplace(BlockFlowerMP.java:62)

Here in your code:

@Override
public boolean canBlockStay(World world, BlockPos pos, IBlockState state)
{
	Block block = world.getBlockState(pos.down()).getBlock();
	BlockType type = (BlockType)state.getValue(VARIANT);

The block you get at the given BlockPos can be ANYTHING, not just your block. You need to check first.

Posted

Put this?

 

if (pos == null)

{

    return false;

}

 

It still crashes.  :-\

 

 

 

---- Minecraft Crash Report ----

 

WARNING: coremods are present:

  NEICorePlugin (NotEnoughItems-1.8-1.0.5.104-dev.jar)

  CCCDeobfPlugin (unknown)

  MorePlanetsPlugin (bin)

  CCLCorePlugin (CodeChickenLib-1.8-1.1.2.133-dev.jar)

  CodeChickenCorePlugin (CodeChickenCore-1.8-1.0.5.36-dev.jar)

Contact their authors BEFORE contacting forge

 

// I bet Cylons wouldn't have this problem.

 

Time: 14/7/2558, 12:58 น.

Description: Ticking memory connection

 

java.lang.IllegalArgumentException: Cannot get property PropertyEnum{name=variant, clazz=class stevekung.mods.moreplanets.planets.fronos.blocks.BlockFronosTallGrass$BlockType, values=[fronos_short_grass, fronos_medium_grass, fronos_tall_grass, pink_short_grass, pink_medium_grass, pink_tall_grass, purple_short_grass, purple_medium_grass, purple_tall_grass, plains_short_grass, plains_medium_grass, plains_tall_grass, golden_short_grass, golden_medium_grass, golden_tall_grass]} as it does not exist in BlockState{block=minecraft:air, properties=[]}

at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:167)

at stevekung.mods.moreplanets.planets.fronos.blocks.BlockFronosTallGrass.canBlockStay(BlockFronosTallGrass.java:126)

at stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosFlowers.generate(WorldGenFronosFlowers.java:38)

at stevekung.mods.moreplanets.planets.fronos.world.gen.BiomeDecoratorFronos.genDecorations(BiomeDecoratorFronos.java:402)

at stevekung.mods.moreplanets.planets.fronos.world.gen.BiomeDecoratorFronos.decorate(BiomeDecoratorFronos.java:110)

at net.minecraft.world.biome.BiomeGenBase.decorate(BiomeGenBase.java:419)

at stevekung.mods.moreplanets.planets.fronos.world.gen.ChunkProviderFronos.populate(ChunkProviderFronos.java:382)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:292)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1162)

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:196)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:138)

at net.minecraft.server.management.PlayerManager$PlayerInstance.<init>(PlayerManager.java:416)

at net.minecraft.server.management.PlayerManager.getPlayerInstance(PlayerManager.java:118)

at net.minecraft.server.management.PlayerManager.addPlayer(PlayerManager.java:162)

at net.minecraft.server.management.ServerConfigurationManager.func_72375_a(ServerConfigurationManager.java:281)

at net.minecraft.server.management.ServerConfigurationManager.playerLoggedIn(ServerConfigurationManager.java:353)

at net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer(ServerConfigurationManager.java:173)

at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:237)

at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.access$100(NetworkDispatcher.java:50)

at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:189)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:270)

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:208)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)

at java.lang.Thread.run(Unknown Source)

 

 

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

---------------------------------------------------------------------------------------

 

-- Head --

Stacktrace:

at net.minecraft.block.state.BlockState$StateImplementation.getValue(BlockState.java:167)

at stevekung.mods.moreplanets.planets.fronos.blocks.BlockFronosTallGrass.canBlockStay(BlockFronosTallGrass.java:126)

at stevekung.mods.moreplanets.planets.fronos.world.gen.feature.WorldGenFronosFlowers.generate(WorldGenFronosFlowers.java:38)

at stevekung.mods.moreplanets.planets.fronos.world.gen.BiomeDecoratorFronos.genDecorations(BiomeDecoratorFronos.java:402)

at stevekung.mods.moreplanets.planets.fronos.world.gen.BiomeDecoratorFronos.decorate(BiomeDecoratorFronos.java:110)

at net.minecraft.world.biome.BiomeGenBase.decorate(BiomeGenBase.java:419)

at stevekung.mods.moreplanets.planets.fronos.world.gen.ChunkProviderFronos.populate(ChunkProviderFronos.java:382)

at net.minecraft.world.gen.ChunkProviderServer.populate(ChunkProviderServer.java:292)

at net.minecraft.world.chunk.Chunk.populateChunk(Chunk.java:1162)

at net.minecraft.world.gen.ChunkProviderServer.originalLoadChunk(ChunkProviderServer.java:196)

at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:138)

at net.minecraft.server.management.PlayerManager$PlayerInstance.<init>(PlayerManager.java:416)

at net.minecraft.server.management.PlayerManager.getPlayerInstance(PlayerManager.java:118)

at net.minecraft.server.management.PlayerManager.addPlayer(PlayerManager.java:162)

at net.minecraft.server.management.ServerConfigurationManager.func_72375_a(ServerConfigurationManager.java:281)

at net.minecraft.server.management.ServerConfigurationManager.playerLoggedIn(ServerConfigurationManager.java:353)

at net.minecraft.server.management.ServerConfigurationManager.initializeConnectionToPlayer(ServerConfigurationManager.java:173)

at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.completeServerSideConnection(NetworkDispatcher.java:237)

at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.access$100(NetworkDispatcher.java:50)

at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:189)

at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:270)

 

-- Ticking connection --

Details:

Connection: net.minecraft.network.NetworkManager@4daccc

Stacktrace:

at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:208)

at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:798)

at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669)

at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171)

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540)

at java.lang.Thread.run(Unknown Source)

 

-- System Details --

Details:

Minecraft Version: 1.8

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.7.0_79, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 565420664 bytes (539 MB) / 1046937600 bytes (998 MB) up to 1046937600 bytes (998 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 1, tcache: 29, allocated: 2, tallocated: 28

FML: MCP v9.10 FML v8.0.99.99 Minecraft Forge 11.14.3.1487 10 mods loaded, 10 mods active

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAAA mcp{9.05} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8-11.14.3.1487.jar)

UCHIJAAAA Forge{11.14.3.1487} [Minecraft Forge] (forgeSrc-1.8-11.14.3.1487.jar)

UCHIJAAAA CodeChickenCore{1.0.5.36} [CodeChicken Core] (minecraft.jar)

UCHIJAAAA NotEnoughItems{1.0.5.104} [Not Enough Items] (NotEnoughItems-1.8-1.0.5.104-dev.jar)

UCHIJAAAA GalacticraftCore{3.0.12} [Galacticraft Core] (bin)

UCHIJAAAA NBTEdit{1.7.10-1.0} [in-game NBTEdit] (bin)

UCHIJAAAA DragonMounts{@VERSION@} [Dragon Mounts] (bin)

UCHIJAAAA GalacticraftMars{3.0.12} [Galacticraft Planets] (bin)

UCHIJAAAA MorePlanets{2.0.0} [More Planets] (bin)

Loaded coremods (and transformers):

NEICorePlugin (NotEnoughItems-1.8-1.0.5.104-dev.jar)

  codechicken.nei.asm.NEITransformer

CCCDeobfPlugin (unknown)

 

MorePlanetsPlugin (bin)

  stevekung.mods.moreplanets.plugin.asm.MorePlanetsTransformer

CCLCorePlugin (CodeChickenLib-1.8-1.1.2.133-dev.jar)

  codechicken.lib.asm.ClassHeirachyManager

  codechicken.lib.asm.RenderHookTransformer

CodeChickenCorePlugin (CodeChickenCore-1.8-1.0.5.36-dev.jar)

  codechicken.core.asm.InterfaceDependancyTransformer

  codechicken.core.asm.TweakTransformer

  codechicken.core.asm.DelegatedTransformer

  codechicken.core.asm.DefaultImplementationTransformer

GL info: ~~ERROR~~ RuntimeException: No OpenGL context found in the current thread.

Profiler Position: N/A (disabled)

Player Count: 1 / 8; [EntityPlayerMP['Player902'/2, l='Test World', x=-896.46, y=96.11, z=855.50]]

Type: Integrated Server (map_client.txt)

Is Modded: Definitely; Client brand changed to 'fml,forge'

 

 

Posted

Put this?

 

if (pos == null)

{

    return false;

}

I said the BLOCK at that position can be anything, though it will not be null, and the BlockPos certainly will not be null.

 

The problem is you are getting the block at the position BELOW your block, and then assuming that it is also your block, which clearly it usually won't be.

 

You need to check what the actual blockstate is at each position you check before trying to access any specific properties.

Posted

Thanks! It can placed properly. But World Generator still crash. -.-

 

My code like this.

 

@Override

public boolean canBlockStay(World world, BlockPos pos, IBlockState state)

{

IBlockState blockState = world.getBlockState(pos.down());

Block block = blockState.getBlock();

 

boolean onFronosGrass = block == FronosBlocks.fronos_grass || block == FronosBlocks.fronos_dirt;

boolean onPinkGrass = block == FronosBlocks.pink_grass || block == FronosBlocks.fronos_dirt;

boolean onPurpleGrass = block == FronosBlocks.purple_grass || block == FronosBlocks.fronos_dirt;

boolean onPlainsGrass = block == FronosBlocks.plains_grass || block == FronosBlocks.fronos_dirt;

boolean onGoldenGrass = block == FronosBlocks.golden_grass || block == FronosBlocks.fronos_dirt;

 

if (block instanceof BlockFronosGrass)

{

onFronosGrass = true;

}

else if (block instanceof BlockPinkGrass)

{

onPinkGrass = true;

}

else if (block instanceof BlockPurpleGrass)

{

onPurpleGrass = true;

}

else if (block instanceof BlockPlainsGrass)

{

onPlainsGrass = true;

}

else

{

onGoldenGrass = true;

}

 

BlockType type = (BlockType)state.getValue(VARIANT);

 

if (type == BlockType.fronos_short_grass || type == BlockType.fronos_medium_grass || type == BlockType.fronos_tall_grass)

{

return onFronosGrass;

}

if (type == BlockType.pink_short_grass || type == BlockType.pink_medium_grass || type == BlockType.pink_tall_grass)

{

return onPinkGrass;

}

if (type == BlockType.purple_short_grass || type == BlockType.purple_medium_grass || type == BlockType.purple_tall_grass)

{

return onPurpleGrass;

}

if (type == BlockType.plains_short_grass || type == BlockType.plains_medium_grass || type == BlockType.plains_tall_grass)

{

return onPlainsGrass;

}

if (type == BlockType.golden_short_grass || type == BlockType.golden_medium_grass || type == BlockType.golden_tall_grass)

{

return onGoldenGrass;

}

return block instanceof IFronosGrass || block == FronosBlocks.fronos_dirt;

}

 

 

Something its wrong?

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

    • You probably used jd-gui to open it, didn't you? Nothing wrong with that, I also made that mistake, except that Notch was a smart guy and he obfuscated the code. That's why you only see files called "a", "b", "c" and then a file that combines them all. As I said, use RetroMCP to deobfuscate the code so that you will 100% understand it and be able to navigate it.
    • Decompiling minecraft indev, infdev, alpha, beta or whichever legacy version is really easy. I'm not a plug, I just also got interested in modding legacy versions (Infdev to be specific). Use https://github.com/MCPHackers/RetroMCP-Java Once you install their client and the Zulu Architecture that they say they recommend (or use your own Java). I encountered some problems, so I run it with: "java -jar RetroMCP-Java-CLI.jar". You should run it in a seperate folder (not in downloads), otherwise the files and folders will go all over the place. How to use RetroMCP: Type setup (every time you want change version), copy-paste the version number from their list (they support indev), write "decompile" and done! The code will now be deobfuscated and filenames will be normal, instead of "a", "b" and "c"! Hope I helped you, but I don't expect you to reply, as this discussion is 9 years old! What a piece of history!  
    • I know that this may be a basic question, but I am very new to modding. I am trying to have it so that I can create modified Vanilla loot tables that use a custom enchantment as a condition (i.e. enchantment present = item). However, I am having trouble trying to implement this; the LootItemRandomChanceWithEnchantedBonusCondition constructor needs a Holder<Enchantment> and I am unable to use the getOrThrow() method on the custom enchantment declared in my mod's enchantments class. Here is what I have so far in the GLM:   protected void start(HolderLookup.Provider registries) { HolderLookup.RegistryLookup<Enchantment> registrylookup = registries.lookupOrThrow(Registries.ENCHANTMENT); LootItemRandomChanceWithEnchantedBonusCondition lootItemRandomChanceWithEnchantedBonusCondition = new LootItemRandomChanceWithEnchantedBonusCondition(0.0f, LevelBasedValue.perLevel(0.07f), registrylookup.getOrThrow(*enchantment here*)); this.add("nebu_from_deepslate", new AddItemModifier(new LootItemCondition[]{ LootItemBlockStatePropertyCondition.hasBlockStateProperties(Blocks.DEEPSLATE).build(), LootItemRandomChanceCondition.randomChance(0.25f).build(), lootItemRandomChanceWithEnchantedBonusCondition }, OrichalcumItems.NEBU.get())); }   Inserting Enchantments.[vanilla enchantment here] actually works but trying to declare an enchantment from my custom enchantments class as [mod enchantment class].[custom enchantment] does not work even though they are both a ResourceKey and are registered in Registries.ENCHANTMENT. Basically, how would I go about making it so that a custom enchantment declared as a ResourceKey<Enchantment> of value ResourceKey.create(Registries.ENCHANTMENT, ResourceLocation.fromNamespaceAndPath([modid], [name])), declared in a seperate enchantments class, can be used in the LootItemRandomChanceWithEnchantedBonusCondition constructor as a Holder? I can't use getOrThrow() because there is no level or block entity/entity in the start() method and it is running as datagen. It's driving me nuts.
    • Hi here is an update. I was able to fix the code so my mod does not crash Minecraft. Please understand that I am new to modding but I honestly am having a hard time understanding how anyone can get this to work without having extensive programming and debugging experience as well as searching across the Internet, multiple gen AI bots (claude, grok, openai), and examining source code hidden in the gradle directory and in various github repositories. I guess I am wrong because clearly there are thousands of mods so maybe I am just a newbie. Ok, rant over, here is a step by step summary so others can save the 3 days it took me to figure this out.   1. First, I am using forge 54.1.0 and Minecraft 1.21.4 2. I am creating a mod to add a shotgun to Minecraft 3. After creating the mod and compiling it, I installed the .jar file to the proper directory in Minecraft and used 1.21.4-forge-54.1.0 4. The mod immediately crashed with the error: Caused by: java.lang.NullPointerException: Item id not set 5. Using the stack trace, I determined that the Exception was being thrown from the net.minecraft.world.item.Item.Properties class 6. It seems that there are no javadocs for this class, so I used IntelliJ which was able to provide a decompiled version of the class, which I then examined to see the source of the error. Side question: Are there javadocs? 7. This method, specifically, was the culprit: protected String effectiveDescriptionId() {      return this.descriptionId.get(Objects.requireNonNull(this.id, "Item id not set"));  } 8. Now my quest was to determine how to set this.id. Looking at the same source file, I determined there was another method:  public Item.Properties setId(ResourceKey<Item> pId) {             this.id = pId;             return this;   } 9. So now, I need to figure out how to call setId(). This required working backwards a bit. Starting from the constructor, I stubbed out the variable p which is of type Item.Properties public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); Rather than putting this all on one line, I split it up for readability like this: private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); Here is was the missing function, setId(), which takes a type of ResourceKey<Item>. My next problem is that due to the apparent lack of documentation (I tried searching the docs on this site) I could not determine the full import path to ResourceKey. I did some random searching on the Internet and stumbled across a Github repository which gave two clues: import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; Then I created the rk variable like this: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); And now putting it all together in order: private static ResourceKey<Item> rk = ResourceKey.create(Registries.ITEM, ResourceLocation.parse("modid:shotgunmod")); private static final Item.Properties p = new Item.Properties().useItemDescriptionPrefix().setId(rk); public static final RegistryObject<Item> SHOTGUN = ITEMS.register("shotgun", () -> new ShotgunItem(p)); This compiled and the mod no longer crashes. I still have more to do on it, but hopefully this will save someone hours. I welcome any feedback and if I missed some obvious modding resource or tutorial that has this information. If not, I might suggest we add it somewhere for people trying to write a mod that doesn't crash. Thank you !!!  
  • Topics

×
×
  • Create New...

Important Information

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