Jump to content

Game crashes after planting custom seeds


Korlimann

Recommended Posts

Hey there and good evening fellow devs. :)

 

I created a simple "corn" crop, also seeds.

When I went into the game and tried to plant the seed, the game immediately crashed.

Here's the log from the error:

Spoiler

[22:23:35] [Server thread/INFO]: Player241[local:E:6acfcc17] logged in with entity id 358 at (-122.29480888977956, 113.0, 157.01547799835743)
[22:23:35] [Server thread/INFO]: Player241 joined the game
[22:23:36] [main/INFO]: Loaded 3 advancements
[22:23:36] [Server thread/INFO]: Saving and pausing game...
[22:23:36] [Server thread/INFO]: Saving chunks for level 'Test2'/overworld
[22:23:36] [Server thread/INFO]: Saving chunks for level 'Test2'/the_nether
[22:23:36] [Server thread/INFO]: Saving chunks for level 'Test2'/the_end
[22:23:36] [pool-2-thread-1/WARN]: Couldn't look up profile properties for com.mojang.authlib.GameProfile@257aaf41[id=70e91197-310e-329c-b14b-d42515dd7aa5,name=Player241,properties={},legacy=false]
com.mojang.authlib.exceptions.AuthenticationException: The client has sent too many requests within a certain amount of time
    at com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService.makeRequest(YggdrasilAuthenticationService.java:79) ~[YggdrasilAuthenticationService.class:?]
    at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillGameProfile(YggdrasilMinecraftSessionService.java:180) [YggdrasilMinecraftSessionService.class:?]
    at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:60) [YggdrasilMinecraftSessionService$1.class:?]
    at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService$1.load(YggdrasilMinecraftSessionService.java:57) [YggdrasilMinecraftSessionService$1.class:?]
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3716) [guava-21.0.jar:?]
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2424) [guava-21.0.jar:?]
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2298) [guava-21.0.jar:?]
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2211) [guava-21.0.jar:?]
    at com.google.common.cache.LocalCache.get(LocalCache.java:4154) [guava-21.0.jar:?]
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4158) [guava-21.0.jar:?]
    at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:5147) [guava-21.0.jar:?]
    at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:5153) [guava-21.0.jar:?]
    at com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService.fillProfileProperties(YggdrasilMinecraftSessionService.java:170) [YggdrasilMinecraftSessionService.class:?]
    at net.minecraft.client.Minecraft.getProfileProperties(Minecraft.java:3188) [Minecraft.class:?]
    at net.minecraft.client.resources.SkinManager$3.run(SkinManager.java:138) [SkinManager$3.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_162]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_162]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_162]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_162]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_162]
[22:24:04] [main/INFO]: Loaded 5 advancements
[22:24:58] [main/INFO]: Loaded 11 advancements
[22:25:00] [Server thread/FATAL]: Error executing task
java.util.concurrent.ExecutionException: java.lang.NullPointerException
    at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_162]
    at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_162]
    at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?]
    at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:796) [MinecraftServer.class:?]
    at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:741) [MinecraftServer.class:?]
    at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:192) [IntegratedServer.class:?]
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:590) [MinecraftServer.class:?]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_162]
Caused by: java.lang.NullPointerException
    at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:61) ~[ItemSeeds.class:?]
    at net.minecraft.block.Block.canSustainPlant(Block.java:1931) ~[Block.class:?]
    at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34) ~[ItemSeeds.class:?]
    at net.minecraftforge.common.ForgeHooks.onPlaceItemIntoWorld(ForgeHooks.java:860) ~[ForgeHooks.class:?]
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:200) ~[ItemStack.class:?]
    at net.minecraft.server.management.PlayerInteractionManager.processRightClickBlock(PlayerInteractionManager.java:504) ~[PlayerInteractionManager.class:?]
    at net.minecraft.network.NetHandlerPlayServer.processTryUseItemOnBlock(NetHandlerPlayServer.java:767) ~[NetHandlerPlayServer.class:?]
    at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:68) ~[CPacketPlayerTryUseItemOnBlock.class:?]
    at net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock.processPacket(CPacketPlayerTryUseItemOnBlock.java:13) ~[CPacketPlayerTryUseItemOnBlock.class:?]
    at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:21) ~[PacketThreadUtil$1.class:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.8.0_162]
    at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_162]
    at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?]
    ... 5 more
[22:25:00] [Server thread/INFO]: Stopping server
[22:25:00] [Server thread/INFO]: Saving players
[22:25:00] [Server thread/INFO]: Saving worlds
[22:25:00] [Server thread/INFO]: Saving chunks for level 'Test2'/overworld
[22:25:00] [Server thread/INFO]: Saving chunks for level 'Test2'/the_nether
[22:25:00] [Server thread/INFO]: Saving chunks for level 'Test2'/the_end
[22:25:00] [Server thread/INFO] [FML]: Unloading dimension 0
[22:25:00] [Server thread/INFO] [FML]: Unloading dimension -1
[22:25:00] [Server thread/INFO] [FML]: Unloading dimension 1
[22:25:00] [Server thread/INFO] [FML]: Applying holder lookups
[22:25:00] [Server thread/INFO] [FML]: Holder lookups applied
[22:25:01] [main/FATAL]: Unreported exception thrown!
java.lang.NullPointerException: null
    at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:61) ~[ItemSeeds.class:?]
    at net.minecraft.block.Block.canSustainPlant(Block.java:1931) ~[Block.class:?]
    at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34) ~[ItemSeeds.class:?]
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:201) ~[ItemStack.class:?]
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:499) ~[PlayerControllerMP.class:?]
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1933) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186) ~[Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_162]
    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_162]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_162]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_162]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:26) [start/:?]
[22:25:01] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: ---- Minecraft Crash Report ----
// Daisy, daisy...

Time: 2/14/18 10:25 PM
Description: Unexpected error

java.lang.NullPointerException: Unexpected error
    at net.minecraft.item.ItemSeeds.getPlant(ItemSeeds.java:61)
    at net.minecraft.block.Block.canSustainPlant(Block.java:1931)
    at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:201)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:499)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1933)
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1186)
    at net.minecraft.client.Minecraft.run(Minecraft.java:441)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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 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.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.item.ItemSeeds.getPlant(ItemSeeds.java:61)
    at net.minecraft.block.Block.canSustainPlant(Block.java:1931)
    at net.minecraft.item.ItemSeeds.onItemUse(ItemSeeds.java:34)
    at net.minecraft.item.ItemStack.onItemUse(ItemStack.java:201)
    at net.minecraft.client.multiplayer.PlayerControllerMP.processRightClickBlock(PlayerControllerMP.java:499)
    at net.minecraft.client.Minecraft.rightClickMouse(Minecraft.java:1692)
    at net.minecraft.client.Minecraft.processKeyBinds(Minecraft.java:2379)
    at net.minecraft.client.Minecraft.runTickKeyboard(Minecraft.java:2145)

-- Affected level --
Details:
    Level name: MpServer
    All players: 1 total; [EntityPlayerSP['Player241'/358, l='MpServer', x=-123.40, y=113.00, z=159.75]]
    Chunk stats: MultiplayerChunkCache: 576, 576
    Level seed: 0
    Level generator: ID 00 - default, ver 1. Features enabled: false
    Level generator options: 
    Level spawn location: World: (-140,64,156), Chunk: (at 4,4,12 in -9,9; contains blocks -144,0,144 to -129,255,159), Region: (-1,0; contains chunks -32,0 to -1,31, blocks -512,0,0 to -1,255,511)
    Level time: 124869 game time, 124869 day time
    Level dimension: 0
    Level storage version: 0x00000 - Unknown?
    Level weather: Rain time: 0 (now: true), thunder time: 0 (now: false)
    Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false
    Forced entities: 119 total; [EntityItem['item.item.egg'/521, l='MpServer', x=-79.37, y=74.00, z=131.22], EntityZombie['Zombie'/1546, l='MpServer', x=-85.51, y=23.00, z=233.78], EntitySkeleton['Skeleton'/523, l='MpServer', x=-105.50, y=36.00, z=140.50], EntityZombie['Zombie'/1547, l='MpServer', x=-89.50, y=21.00, z=237.50], EntitySpider['Spider'/1550, l='MpServer', x=-89.50, y=21.00, z=236.50], EntityCreeper['Creeper'/548, l='MpServer', x=-189.50, y=44.00, z=135.50], EntitySkeleton['Skeleton'/805, l='MpServer', x=-118.33, y=45.00, z=130.64], EntityZombie['Zombie'/814, l='MpServer', x=-64.50, y=64.00, z=94.50], EntityCreeper['Creeper'/1327, l='MpServer', x=-48.50, y=25.00, z=181.50], EntityCow['Cow'/48, l='MpServer', x=-187.86, y=64.00, z=92.86], EntityZombie['Zombie'/1328, l='MpServer', x=-50.50, y=25.00, z=181.50], EntityCow['Cow'/50, l='MpServer', x=-193.78, y=64.00, z=82.83], EntityCow['Cow'/51, l='MpServer', x=-202.57, y=64.00, z=92.79], EntityPig['Pig'/52, l='MpServer', x=-199.19, y=63.00, z=102.60], EntityCreeper['Creeper'/564, l='MpServer', x=-148.47, y=25.00, z=108.80], EntityPig['Pig'/53, l='MpServer', x=-192.79, y=64.00, z=105.35], EntityCreeper['Creeper'/567, l='MpServer', x=-135.92, y=28.00, z=128.50], EntityCow['Cow'/60, l='MpServer', x=-187.83, y=64.00, z=94.68], EntitySheep['Sheep'/61, l='MpServer', x=-184.75, y=64.00, z=100.82], EntitySheep['Sheep'/62, l='MpServer', x=-185.20, y=64.00, z=102.48], EntityBat['Bat'/830, l='MpServer', x=-81.50, y=23.10, z=106.25], EntityItem['item.tile.mushroom'/63, l='MpServer', x=-185.12, y=64.00, z=104.38], EntityCow['Cow'/64, l='MpServer', x=-181.20, y=64.00, z=97.48], EntityCow['Cow'/65, l='MpServer', x=-180.15, y=63.00, z=115.47], EntityCow['Cow'/67, l='MpServer', x=-181.50, y=63.00, z=121.77], EntityCow['Cow'/69, l='MpServer', x=-181.15, y=63.00, z=145.53], EntitySkeleton['Skeleton'/1605, l='MpServer', x=-147.50, y=33.00, z=241.50], EntityCow['Cow'/71, l='MpServer', x=-187.38, y=66.00, z=178.19], EntitySkeleton['Skeleton'/72, l='MpServer', x=-187.25, y=63.00, z=198.53], EntitySheep['Sheep'/76, l='MpServer', x=-168.80, y=63.00, z=121.27], EntitySquid['Squid'/844, l='MpServer', x=-118.99, y=56.04, z=120.52], EntitySkeleton['Skeleton'/77, l='MpServer', x=-172.55, y=63.00, z=113.75], EntitySquid['Squid'/845, l='MpServer', x=-119.41, y=57.15, z=115.95], EntityCow['Cow'/78, l='MpServer', x=-162.83, y=64.00, z=128.81], EntitySquid['Squid'/846, l='MpServer', x=-120.25, y=59.27, z=120.32], EntitySquid['Squid'/847, l='MpServer', x=-114.99, y=56.36, z=116.40], EntityCow['Cow'/80, l='MpServer', x=-176.14, y=64.00, z=129.83], EntityCow['Cow'/82, l='MpServer', x=-169.51, y=63.00, z=178.79], EntityCow['Cow'/83, l='MpServer', x=-165.22, y=64.00, z=189.22], EntityCow['Cow'/84, l='MpServer', x=-171.20, y=64.00, z=184.67], EntityCow['Cow'/85, l='MpServer', x=-169.52, y=64.00, z=188.18], EntityCow['Cow'/86, l='MpServer', x=-168.47, y=64.00, z=188.81], EntityBat['Bat'/1366, l='MpServer', x=-64.74, y=33.01, z=79.41], EntityCreeper['Creeper'/1623, l='MpServer', x=-59.50, y=17.00, z=122.50], EntityCreeper['Creeper'/1624, l='MpServer', x=-57.50, y=17.00, z=120.50], EntityCreeper['Creeper'/1625, l='MpServer', x=-58.50, y=17.00, z=119.50], EntityBat['Bat'/1381, l='MpServer', x=-169.41, y=28.18, z=91.63], EntityBat['Bat'/1383, l='MpServer', x=-167.94, y=27.02, z=91.05], EntitySheep['Sheep'/104, l='MpServer', x=-157.80, y=64.00, z=102.22], EntitySheep['Sheep'/105, l='MpServer', x=-148.51, y=65.00, z=116.24], EntitySheep['Sheep'/106, l='MpServer', x=-153.57, y=64.00, z=129.77], EntityPlayerSP['Player241'/358, l='MpServer', x=-123.40, y=113.00, z=159.75], EntitySheep['Sheep'/107, l='MpServer', x=-150.49, y=64.00, z=137.20], EntityChicken['Chicken'/108, l='MpServer', x=-146.10, y=65.00, z=140.15], EntitySkeleton['Skeleton'/1132, l='MpServer', x=-49.50, y=67.00, z=173.50], EntitySkeleton['Skeleton'/1388, l='MpServer', x=-133.50, y=23.00, z=130.50], EntitySheep['Sheep'/109, l='MpServer', x=-151.75, y=63.00, z=156.69], EntityZombie['Zombie'/1389, l='MpServer', x=-130.51, y=29.00, z=130.81], EntityCow['Cow'/110, l='MpServer', x=-155.21, y=64.00, z=228.44], EntityCow['Cow'/111, l='MpServer', x=-157.55, y=65.00, z=239.19], EntityCow['Cow'/112, l='MpServer', x=-161.52, y=65.00, z=239.83], EntityCreeper['Creeper'/1139, l='MpServer', x=-131.38, y=25.00, z=131.70], EntityCreeper['Creeper'/1400, l='MpServer', x=-57.50, y=44.00, z=178.50], EntitySkeleton['Skeleton'/1401, l='MpServer', x=-59.50, y=44.00, z=177.50], EntityPig['Pig'/122, l='MpServer', x=-130.76, y=64.00, z=120.48], EntitySkeleton['Skeleton'/1402, l='MpServer', x=-60.53, y=43.00, z=186.29], EntityBat['Bat'/635, l='MpServer', x=-57.44, y=48.07, z=206.50], EntitySkeleton['Skeleton'/1403, l='MpServer', x=-56.50, y=44.00, z=176.50], EntitySkeleton['Skeleton'/127, l='MpServer', x=-131.50, y=28.00, z=136.50], EntityItem['item.item.egg'/128, l='MpServer', x=-140.00, y=65.00, z=133.91], EntityChicken['Chicken'/129, l='MpServer', x=-140.60, y=65.00, z=129.15], EntityItem['item.item.egg'/130, l='MpServer', x=-140.02, y=65.00, z=129.17], EntityZombie['Zombie'/133, l='MpServer', x=-135.50, y=50.00, z=229.50], EntityZombie['Zombie'/134, l='MpServer', x=-137.36, y=50.00, z=229.44], EntityCreeper['Creeper'/1415, l='MpServer', x=-166.50, y=43.00, z=81.50], EntityPig['Pig'/144, l='MpServer', x=-126.45, y=38.00, z=97.21], EntityPig['Pig'/145, l='MpServer', x=-127.51, y=38.00, z=97.30], EntityPig['Pig'/146, l='MpServer', x=-126.45, y=38.00, z=98.34], EntitySkeleton['Skeleton'/1428, l='MpServer', x=-144.50, y=52.00, z=227.50], EntityCow['Cow'/152, l='MpServer', x=-121.68, y=66.00, z=139.64], EntitySkeleton['Skeleton'/1432, l='MpServer', x=-73.50, y=67.00, z=167.50], EntityChicken['Chicken'/153, l='MpServer', x=-116.78, y=68.00, z=134.51], EntityCow['Cow'/154, l='MpServer', x=-131.21, y=65.00, z=134.50], EntityCow['Cow'/158, l='MpServer', x=-125.62, y=63.00, z=202.17], EntitySpider['Spider'/161, l='MpServer', x=-117.28, y=45.00, z=230.01], EntitySkeleton['Skeleton'/1196, l='MpServer', x=-67.50, y=28.00, z=90.50], EntityZombie['Zombie'/174, l='MpServer', x=-96.50, y=13.00, z=172.50], EntityBat['Bat'/1711, l='MpServer', x=-147.50, y=27.00, z=112.50], EntityZombie['Zombie'/1727, l='MpServer', x=-76.50, y=17.00, z=239.50], EntityZombie['Zombie'/1728, l='MpServer', x=-75.50, y=17.00, z=235.50], EntityChicken['Chicken'/193, l='MpServer', x=-80.47, y=69.00, z=102.17], EntitySpider['Spider'/1729, l='MpServer', x=-77.50, y=17.00, z=237.50], EntityItem['item.item.egg'/196, l='MpServer', x=-85.22, y=73.00, z=120.88], EntityItem['item.item.egg'/197, l='MpServer', x=-88.48, y=73.00, z=117.47], EntityChicken['Chicken'/200, l='MpServer', x=-95.51, y=68.00, z=170.17], EntityCreeper['Creeper'/201, l='MpServer', x=-92.50, y=35.00, z=186.80], EntitySkeleton['Skeleton'/216, l='MpServer', x=-71.18, y=70.00, z=110.70], EntityChicken['Chicken'/218, l='MpServer', x=-79.59, y=75.00, z=127.14], EntityChicken['Chicken'/219, l='MpServer', x=-74.79, y=72.00, z=115.51], EntityZombie['Zombie'/1499, l='MpServer', x=-143.50, y=27.00, z=128.50], EntityBat['Bat'/221, l='MpServer', x=-69.75, y=60.10, z=132.98], EntityChicken['Chicken'/224, l='MpServer', x=-67.16, y=72.00, z=132.50], EntityChicken['Chicken'/225, l='MpServer', x=-79.85, y=75.00, z=128.46], EntityChicken['Chicken'/226, l='MpServer', x=-78.50, y=74.00, z=131.84], EntityBat['Bat'/1506, l='MpServer', x=-71.45, y=22.04, z=92.20], EntityItem['item.item.egg'/485, l='MpServer', x=-80.24, y=69.00, z=101.60], EntityZombie['Zombie'/1253, l='MpServer', x=-112.50, y=37.00, z=166.50], EntityBat['Bat'/998, l='MpServer', x=-110.36, y=47.89, z=223.54], EntityBat['Bat'/999, l='MpServer', x=-116.18, y=47.51, z=228.66], EntitySpider['Spider'/744, l='MpServer', x=-140.50, y=51.00, z=228.50], EntityCreeper['Creeper'/1512, l='MpServer', x=-61.50, y=27.00, z=175.50], EntityBat['Bat'/491, l='MpServer', x=-167.49, y=28.00, z=86.14], EntityZombie['Zombie'/238, l='MpServer', x=-58.50, y=45.00, z=80.50], EntityBat['Bat'/1008, l='MpServer', x=-131.25, y=23.10, z=222.75], EntityChicken['Chicken'/241, l='MpServer', x=-51.83, y=67.00, z=120.50], EntityChicken['Chicken'/242, l='MpServer', x=-48.16, y=66.00, z=127.89], EntityPig['Pig'/243, l='MpServer', x=-61.50, y=69.00, z=138.67], EntityZombie['Zombie'/1267, l='MpServer', x=-94.50, y=40.00, z=117.50], EntityZombie['Zombie'/244, l='MpServer', x=-57.50, y=54.00, z=170.50]]
    Retry entities: 0 total; []
    Server brand: fml,forge
    Server type: Integrated singleplayer server
Stacktrace:
    at net.minecraft.client.multiplayer.WorldClient.addWorldInfoToCrashReport(WorldClient.java:461)
    at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:2896)
    at net.minecraft.client.Minecraft.run(Minecraft.java:470)
    at net.minecraft.client.main.Main.main(Main.java:118)
    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 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.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
    at GradleStart.main(GradleStart.java:26)

-- System Details --
Details:
    Minecraft Version: 1.12.2
    Operating System: Windows 10 (amd64) version 10.0
    Java Version: 1.8.0_162, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 607223528 bytes (579 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    IntCache: cache: 0, tcache: 0, allocated: 12, tallocated: 94
    FML: MCP 9.42 Powered by Forge 14.23.2.2611 5 mods loaded, 5 mods active
    States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

    | State     | ID        | Version      | Source                           | Signature |
    |:--------- |:--------- |:------------ |:-------------------------------- |:--------- |
    | UCHIJAAAA | minecraft | 1.12.2       | minecraft.jar                    | None      |
    | UCHIJAAAA | mcp       | 9.42         | minecraft.jar                    | None      |
    | UCHIJAAAA | FML       | 8.0.99.99    | forgeSrc-1.12.2-14.23.2.2611.jar | None      |
    | UCHIJAAAA | forge     | 14.23.2.2611 | forgeSrc-1.12.2-14.23.2.2611.jar | None      |
    | UCHIJAAAA | sm        | v1.0         | bin                              | None      |

    Loaded coremods (and transformers): 
    GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 390.65' Renderer: 'GeForce GTX 1060 6GB/PCIe/SSE2'
    Launched Version: 1.12.2
    LWJGL: 2.9.4
    OpenGL: GeForce GTX 1060 6GB/PCIe/SSE2 GL version 4.6.0 NVIDIA 390.65, 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)
    CPU: 4x Intel(R) Core(TM) i5-7600K CPU @ 3.80GHz
[22:25:01] [main/INFO] [STDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:629]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\stefa\Desktop\Mods\SushiMod\run\.\crash-reports\crash-2018-02-14_22.25.01-client.txt
AL lib: (EE) alc_cleanup: 1 device not closed
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

Also, here are the classes I used and made for the crops to work:

ItemCornSeed

Spoiler

package com.korlimann.sushimod.items;

import com.korlimann.sushimod.Main;
import com.korlimann.sushimod.init.ModBlocks;
import com.korlimann.sushimod.init.ModItems;
import com.korlimann.sushimod.util.IHasModel;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemSeeds;

public class ItemCornSeed extends ItemSeeds implements IHasModel {

    public ItemCornSeed(Block crops, Block soil, String name) {
        super(crops, soil);
        setUnlocalizedName(name);
        setRegistryName(name);
        setCreativeTab(Main.korlissushicraft);
        
        ModItems.ITEMS.add(this);
    }

    @Override
    public void registerModels() {
        Main.proxy.registerItemRenderer(this, 0, "inventory");
    }
    
    

}

BlockCropCorn

Spoiler

package com.korlimann.sushimod.blocks;

import com.korlimann.sushimod.init.ModItems;

import net.minecraft.block.BlockCrops;
import net.minecraft.item.Item;

public class BlockCropCorn extends BlockCrops {

    public BlockCropCorn() {
        setUnlocalizedName("crop_corn");
        setRegistryName("crop_corn");
    }
    
    @Override
    protected Item getSeed() {
        return ModItems.CORN_SEED;
    }
    
    @Override
    protected Item getCrop() {
        return ModItems.CORN_SEED;
    }
}

ModBlocks & ModItems to initialize everything:

Spoiler

 

package com.korlimann.sushimod.init;


import java.util.ArrayList;
import java.util.List;

import com.korlimann.sushimod.blocks.BlockBaseCraftingTable;
import com.korlimann.sushimod.blocks.BlockBaseWorkbench;
import com.korlimann.sushimod.blocks.BlockCropCorn;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.registries.IForgeRegistry;

public class ModBlocks {
    
    public static final List<Block> BLOCKS = new ArrayList<Block>();
    
    public static final BlockCropCorn CROPCORN = new BlockCropCorn();
}

 

 

package com.korlimann.sushimod.init;

import java.util.ArrayList;
import java.util.List;

import com.korlimann.sushimod.items.ItemBase;
import com.korlimann.sushimod.items.ItemBaseFood;
import com.korlimann.sushimod.items.ItemCornSeed;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;

public class ModItems {

    public static final List<Item> ITEMS = new ArrayList<Item>();
    public static final Item CORN = new ItemBaseFood("corn", 2, 0.3f, false);
    
}
 

 

I think that would be all important classes, if you miss anything, please just tell me. :) Not only I, but also a friend of mine is having the exact same problem. I followed this tutorial on how to create crops:

https://shadowfacts.net/tutorials/forge-modding-112/crops/

 

Thanks for all the help!

Cheers and have a nice evening

Korlimann

Link to comment
Share on other sites

25 minutes ago, Korlimann said:

    @Override
    protected Item getCrop() {
        return ModItems.CORN_SEED;
    }

This looks fine, let me go see where this item is created...

25 minutes ago, Korlimann said:

public class ModItems {

    public static final List<Item> ITEMS = new ArrayList<Item>();
    public static final Item CORN = new ItemBaseFood("corn", 2, 0.3f, false);
    
}

Uh...

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

 

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

 

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

Link to comment
Share on other sites

Just now, Draco18s said:

This looks fine, let me go see where this item is created...

Uh...

Whoops, I actually had like 30 more items in there but I deleted them so you'll only see the right ones, and I actually deleted the Corn_seed item. xD

 

Here it is:

package com.korlimann.sushimod.init;

import java.util.ArrayList;
import java.util.List;

import com.korlimann.sushimod.items.ItemBase;
import com.korlimann.sushimod.items.ItemBaseFood;
import com.korlimann.sushimod.items.ItemCornSeed;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;

public class ModItems {

	public static final List<Item> ITEMS = new ArrayList<Item>();

	public static final Item CORN_SEED = new ItemCornSeed(ModBlocks.CROPCORN, Blocks.FARMLAND, "corn_seed");
	public static final Item CORN = new ItemBaseFood("corn", 2, 0.3f, false);
}

 

Link to comment
Share on other sites

3 minutes ago, Korlimann said:

new ItemCornSeed(ModBlocks.CROPCORN, Blocks.FARMLAND, "corn_seed");

Because your blocks and items are created in static initializer blocks, your item is being created before your block, so ModBlocks.CROPCORN is null at this point.

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

 

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

 

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

Link to comment
Share on other sites

Not use a static initializer?

Seriously, control the order your code gets executed in. You HAVE to insure that your blocks get created before your items. The only way to do this is to explicitly invoke the initializers yourself.

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

 

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

 

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

Link to comment
Share on other sites

@EventBusSubscriber
public class ObjectRegistry {
	public static Block BLOCK_PATH;
	public static Block BLOCK_PATH_SLAB;
	public static Block BLOCK_GHOST;
	
	public static Item ITEM_PATHMAKER;
	public static Item ITEM_COPYTOOL;
	
	public static Set<Item> items = new HashSet<Item>();
	public static Set<Block> blocks = new HashSet<Block>();
	
	public static void prepareBlocks(){
		blocks.add(BLOCK_PATH = new BlockPath());
		blocks.add(BLOCK_PATH_SLAB = new BlockPathSlab());
		blocks.add(BLOCK_GHOST = new BlockGhost());
	}
	
	public static void prepareItems() {
		items.add(ITEM_PATHMAKER = new ItemPathMaker());
		items.add(ITEM_COPYTOOL = new ItemCopyTool());
	}
	
	//This method will be called without us calling it. This is because 
	//Forge calls it -for- us, when the RegistryEvent happens. This is why
	//we had to use the @Mod.EventBusSubscriber at the top of the class.
	@SubscribeEvent
	public static void registerBlocks(Register<Block> event){
		
		//We make sure that the list gets filled with our blocks.
		prepareBlocks();
		
		for(Block block : blocks){
			event.getRegistry().register(block);
		}
	}
	
	//We do not need to call prepareBlocks() in this method, because Blocks are registered before items.
	//Thus, our registerBlocks method has already happened.
	@SubscribeEvent
	public static void registerItems(Register<Item> event){
		
		for(Block block : blocks){
			ItemBlock iblock = new ItemBlock(block);
			iblock.setRegistryName(block.getRegistryName());
			event.getRegistry().register(iblock);
		}		
		
		prepareItems();
		
		for(Item item : items) {
			event.getRegistry().register(item);
		}
	}
}

 

A really nice registry class from a tutorial that I can sadly not find anymore, otherwise I would link it.

It's really compact and nice to use. Maybe something for you too. But it follows the Forge register order so you don't have to do it yourself hehe.

  • Like 1
Link to comment
Share on other sites

16 hours ago, SatyPardus said:

A really nice registry class from a tutorial that I can sadly not find anymore, otherwise I would link it.

It's really compact and nice to use. Maybe something for you too. But it follows the Forge register order so you don't have to do it yourself hehe.

Hi!

Sorry, I only had a chance to have a look at your answer now. :)

 

So, I tried using your class, but I think I went wrong somewhere...

This would be my "RegistryHandler", as I called it:

package com.korlimann.sushimod.util.handlers;

import com.korlimann.sushimod.init.ModBlocks;
import com.korlimann.sushimod.init.ModItems;
import com.korlimann.sushimod.util.IHasModel;

import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

@EventBusSubscriber
public class RegistryHandler {
	
	@SubscribeEvent
	public static void onBlockRegister(RegistryEvent.Register<Block> event) {
		event.getRegistry().registerAll(ModBlocks.BLOCKS.toArray(new Block[0]));
	}
	
	@SubscribeEvent
	public static void onItemRegister(RegistryEvent.Register<Item> event) {
		event.getRegistry().registerAll(ModItems.ITEMS.toArray(new Item[0]));
	}	
	
	@SubscribeEvent
	public static void onModelRegister(ModelRegistryEvent event) {		
		for(Block block : ModBlocks.BLOCKS) {
			if(block instanceof IHasModel) {
				((IHasModel)block).registerModels();
			}
		}
		for(Item item : ModItems.ITEMS) {
			if(item instanceof IHasModel) {
				((IHasModel)item).registerModels();
			}
		}
	}
}
 

I changed all of my Block and Item classes, so they'll add themselves to the items and blocks list from your ObjectRegistry class. But I'm not sure if I have to do something else, because for now, nothing of the items or blocks gets shown. Do I have to create an instance of the ObjectRegistry class somewhere? I looked into my code, but I didn't find a single line, where my RegistryHandler would've been initialized.

 

As you can see, in my ModItems and my ModBlocks classes, I had an ArrayList of the blocks and items, that then would've been initialized by my RegistryHandler.

So, expect for that now, you have the lists in the ObjectRegistry class itself, I can't see any big differences between those two classes.

Edited by Korlimann
Forgot information that could've been important
Link to comment
Share on other sites

The important part of the class was, that the lists get filled inside the register event. When you add them in the other classes, they are probably added randomly again.

Also, toArray(new Item[0]) will probably create a empty array. Didn't use toArray myself yet, but in C# that thing would be empty :D

  • Like 1
Link to comment
Share on other sites

1 minute ago, SatyPardus said:

Also, toArray(new Item[0]) will probably create a empty array.

Nope:

https://www.tutorialspoint.com/java/util/arraylist_toarray.htm

Quote

a − This is the array into which the elements of the list are to be stored, if it is big enough; otherwise, a new array of the same runtime type is allocated for this purpose.

 

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

 

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

 

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

Link to comment
Share on other sites

6 minutes ago, SatyPardus said:

this looks like it creates a empty array

It does. It's just that that array gets tossed and a new one is created by toArray()

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

 

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

 

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

Link to comment
Share on other sites

51 minutes ago, SatyPardus said:

The important part of the class was, that the lists get filled inside the register event. When you add them in the other classes, they are probably added randomly again.

Also, toArray(new Item[0]) will probably create a empty array. Didn't use toArray myself yet, but in C# that thing would be empty :D

THANK YOU! :D

 

I managed to get it to work.

However, the texture for the crops does not get displayed. I think it's a pathing error, but I can't find the exact error. But I'll figure it out somehow. Thanks a lot anyways. :3

Link to comment
Share on other sites

Join the conversation

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • KILAT77 : Waspada Situs Scam dengan Withdraw Yang Tidak Dibayar Di era digital saat ini, banyak orang yang mencari keberuntungan melalui situs perjudian online. Namun, dibalik gemerlap janji-janji manis kemenangan, ada bahaya yang mengintai. Salah satu situs yang patut diwaspadai adalah KILAT77. Situs ini mendapat reputasi buruk karena banyak laporan dari pengguna yang mengklaim bahwa mereka tidak bisa menarik dana kemenangan mereka. Dalam artikel ini, kita akan membahas mengapa ROTER88 dianggap sebagai situs scam dan bagaimana Anda bisa melindungi diri dari penipuan serupa. Pengalaman Pengguna: Penarikan Tidak Dibayar Beberapa pengguna telah melaporkan pengalaman buruk mereka dengan KILAT77. Mereka mengaku bahwa setelah memenangkan sejumlah uang dan mencoba menariknya, proses penarikan mereka ditolak tanpa alasan yang jelas. Bahkan, beberapa pengguna melaporkan bahwa akun mereka tiba-tiba diblokir setelah mencoba melakukan penarikan, sehingga mereka kehilangan akses ke dana mereka sama sekali.
    • It is a dupe mod issue Remove Rubidium - you are already using Embeddium which is a fork of Rubidium
    • I made a block entity in forge 1.20.1, I want to prevent hopper from taking input slot item, i tried to override the extractItem method, it prevented hopper from taking input slot item, but the player also unable to take/change the item in input slot unless the slot is empty. public class FluidSeparatorBlockEntity extends BlockEntity implements MenuProvider { private static final int INPUT_SLOT = 0; private final CustomItemHandler itemHandler = new CustomItemHandler(3){ @Override protected void onContentsChanged(int slot) { setChanged(); } @Override public boolean isItemValid(int slot, @NotNull ItemStack stack) { return slot == INPUT_SLOT; } @Override public @NotNull ItemStack extractItem(int slot, int amount, boolean simulate) { if (slot == INPUT_SLOT) { return ItemStack.EMPTY; } return super.extractItem(slot, amount, simulate); } }; private LazyOptional<IItemHandler> lazyItemHandler = LazyOptional.empty(); protected final ContainerData data; private int progress = 0; private int maxProgress = 78; public FluidSeparatorBlockEntity(BlockPos pPos, BlockState pBlockState) { super(ModBlockEntities.FLUID_SEPARATOR_BE.get(), pPos, pBlockState); this.data = new ContainerData() { @Override public int get(int pIndex) { return switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress; default -> 0; }; } @Override public void set(int pIndex, int pValue) { switch (pIndex) { case 0 -> FluidSeparatorBlockEntity.this.progress = pValue; case 1, 2 -> FluidSeparatorBlockEntity.this.maxProgress = pValue; } } @Override public int getCount() { return 3; } }; } @Override public @NotNull <T> LazyOptional<T> getCapability(@NotNull Capability<T> cap, @Nullable Direction side) { if(cap == ForgeCapabilities.ITEM_HANDLER) { return lazyItemHandler.cast(); } return super.getCapability(cap, side); } @Override public void onLoad() { super.onLoad(); lazyItemHandler = LazyOptional.of(() -> itemHandler); } @Override public void invalidateCaps() { super.invalidateCaps(); lazyItemHandler.invalidate(); } public void drops() { SimpleContainer inventory = new SimpleContainer(itemHandler.getSlots()); for(int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, itemHandler.getStackInSlot(i)); } Containers.dropContents(this.level, this.worldPosition, inventory); } @Override public Component getDisplayName() { return Component.translatable("block.chemmaster.fluid_separator"); } @Nullable @Override public AbstractContainerMenu createMenu(int pContainerId, Inventory pPlayerInventory, Player pPlayer) { return new FluidSeparatorMenu(pContainerId, pPlayerInventory, this, this.data); } @Override protected void saveAdditional(CompoundTag pTag) { pTag.put("inventory", itemHandler.serializeNBT()); pTag.putInt("fluid_separator.progress", progress); super.saveAdditional(pTag); } @Override public void load(CompoundTag pTag) { super.load(pTag); itemHandler.deserializeNBT(pTag.getCompound("inventory")); progress = pTag.getInt("fluid_separator.progress"); } public void tick(Level pLevel, BlockPos pPos, BlockState pState) { ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { resetProgress(); return; } if(hasRecipe()) { increaseCraftingProgress(); setChanged(pLevel, pPos, pState); if(hasProgressFinished()) { craftItem(); resetProgress(); } } else { resetProgress(); } } private void resetProgress() { progress = 0; } private void craftItem() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isPresent()) { List<ItemStack> results = recipe.get().getOutputs(); ItemStack inputStack = this.itemHandler.getStackInSlot(INPUT_SLOT); if (inputStack.getCount() < 2) { // If there are not enough items, do not proceed with crafting return; } // Extract the input item from the input slot this.itemHandler.internalExtractItem(INPUT_SLOT, 2, false); // Loop through each result item and find suitable output slots for (ItemStack result : results) { int outputSlot = findSuitableOutputSlot(result); if (outputSlot != -1) { this.itemHandler.setStackInSlot(outputSlot, new ItemStack(result.getItem(), this.itemHandler.getStackInSlot(outputSlot).getCount() + result.getCount())); } else { // Handle the case where no suitable output slot is found // This can be logging an error, throwing an exception, or any other handling logic System.err.println("No suitable output slot found for item: " + result); } } } } private int findSuitableOutputSlot(ItemStack result) { // Implement logic to find a suitable output slot for the given result // Return the slot index or -1 if no suitable slot is found for (int i = 0; i < this.itemHandler.getSlots(); i++) { // Ensure we do not place the output item in the input slot if (i == INPUT_SLOT) { continue; } ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return i; } } return -1; } private boolean hasRecipe() { Optional<FluidSeparatingRecipe> recipe = getCurrentRecipe(); if (recipe.isEmpty()) { return false; } List<ItemStack> results = recipe.get().getOutputs(); for (ItemStack result : results) { if (!canInsertAmountIntoOutputSlot(result) || !canInsertItemIntoOutputSlot(result.getItem())) { return false; } } return true; } private Optional<FluidSeparatingRecipe> getCurrentRecipe(){ SimpleContainer inventory = new SimpleContainer(this.itemHandler.getSlots()); for (int i = 0; i < itemHandler.getSlots(); i++) { inventory.setItem(i, this.itemHandler.getStackInSlot(i)); } return this.level.getRecipeManager().getRecipeFor(FluidSeparatingRecipe.Type.INSTANCE, inventory, level); } private boolean canInsertAmountIntoOutputSlot(ItemStack result) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || (stackInSlot.getItem() == result.getItem() && stackInSlot.getCount() + result.getCount() <= stackInSlot.getMaxStackSize())) { return true; } } return false; } private boolean canInsertItemIntoOutputSlot(Item item) { for (int i = 1; i < this.itemHandler.getSlots(); i++) { ItemStack stackInSlot = this.itemHandler.getStackInSlot(i); if (stackInSlot.isEmpty() || stackInSlot.getItem() == item) { return true; } } return false; } private boolean hasProgressFinished() { return progress >= maxProgress; } private void increaseCraftingProgress() { progress++; } }  
    • No dice. Unfortunately this fix didn't work, thank you though.
  • Topics

×
×
  • Create New...

Important Information

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