#ÖCT Posted May 3, 2018 Posted May 3, 2018 Hey, I have a problem... I want to add an Item, who "spawns" a .schematic File in the World I write for that two Handlers: The ObjectHandler: Reveal hidden contents package oect.lwaltens.luckyblockoect.utils; import net.minecraft.block.state.IBlockState; import net.minecraft.util.BlockPos; public class ObjectHandler { private BlockPos position; private IBlockState state; public ObjectHandler (BlockPos position, IBlockState state) { this.position = position; this.state = state; } public BlockPos getPosition() { return position; } public IBlockState getState() { return state; } public BlockPos getPositionWithOffset(int x, int y, int z) { return new BlockPos(x+position.getX(), y+position.getY(), z+position.getZ()); } } And the SchematicHandler: Reveal hidden contents package oect.lwaltens.luckyblockoect.utils; import java.io.IOException; import java.io.InputStream; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.BlockPos; import net.minecraft.world.World; public class SchematicHandler { private short width; private short height; private short lenght; private int size; private ObjectHandler[] ObjektHandler; public SchematicHandler (String fileName) { try { InputStream is = SchematicHandler.class.getResourceAsStream("assets/luckyblockoect/schematics/"+fileName); NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(is); is.close(); width = nbtdata.getShort("Width"); height = nbtdata.getShort("Height"); lenght = nbtdata.getShort("Length"); size = width*lenght*height; ObjektHandler = new ObjectHandler[size]; byte[] BlockIDs = nbtdata.getByteArray("Blocks"); byte[] metadata = nbtdata.getByteArray("Data"); int counter = 0; for (int i = 0; i < height; i++) { for (int j = 0; j < lenght; j++) { for (int k = 0; k < width; k++) { BlockPos pos = new BlockPos(k, i, j); IBlockState state = Block.getBlockById(BlockIDs[counter]).getStateFromMeta(metadata[counter]); ObjektHandler[counter] = new ObjectHandler(pos, state); counter++; } } } } catch (IOException e) { e.printStackTrace(); } } public void generate(World world, int x, int y, int z) { for (ObjectHandler obj : ObjektHandler) { world.setBlockState(obj.getPositionWithOffset(x, y, z), obj.getState()); } } } Here is my Item class: Reveal hidden contents package oect.lwaltens.luckyblockoect.items; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import oect.lwaltens.luckyblockoect.LuckyBlockOect; import oect.lwaltens.luckyblockoect.LuckyBlockOect_Items; import oect.lwaltens.luckyblockoect.creativetabs.LuckyBlockOectTab; import oect.lwaltens.luckyblockoect.entities.EntityProjektilGun; import oect.lwaltens.luckyblockoect.utils.SchematicHandler; public class BuildPitTrap extends Item { public static String name = "baum"; public BuildPitTrap() { setUnlocalizedName(name); } @Override @SideOnly(Side.CLIENT) public CreativeTabs getCreativeTab() { return LuckyBlockOect.luckyblockoecttab; } public SchematicHandler schematic = new SchematicHandler("pit_trap.schematic"); public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { schematic.generate(world, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ()); return itemStack; } } But if I want to instance the Schematic, the game Crashes in the Initialization... Here is the Crash-Report: Reveal hidden contents ---- Minecraft Crash Report ---- // On the bright side, I bought you a teddy bear! Time: 03.05.18 13:37 Description: There was a severe problem during mod loading that has caused the game to fail net.minecraftforge.fml.common.LoaderException: java.lang.ExceptionInInitializerError at net.minecraftforge.fml.common.LoadController.transition(LoadController.java:162) at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:543) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:208) at net.minecraft.client.Minecraft.startGame(Minecraft.java:451) at net.minecraft.client.Minecraft.run(Minecraft.java:360) at net.minecraft.client.main.Main.main(Main.java:116) 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) Caused by: java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at net.minecraftforge.fml.common.FMLModContainer.constructMod(FMLModContainer.java:468) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:211) at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:189) 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 com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) at com.google.common.eventbus.EventBus.post(EventBus.java:275) at net.minecraftforge.fml.common.LoadController.distributeStateMessage(LoadController.java:118) at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:512) ... 16 more Caused by: java.lang.NullPointerException at java.util.zip.InflaterInputStream.<init>(Unknown Source) at java.util.zip.GZIPInputStream.<init>(Unknown Source) at java.util.zip.GZIPInputStream.<init>(Unknown Source) at net.minecraft.nbt.CompressedStreamTools.readCompressed(CompressedStreamTools.java:28) at oect.lwaltens.luckyblockoect.utils.SchematicHandler.<init>(SchematicHandler.java:23) at oect.lwaltens.luckyblockoect.items.BuildPitTrap.<init>(BuildPitTrap.java:33) at oect.lwaltens.luckyblockoect.LuckyBlockOect_Items.<init>(LuckyBlockOect_Items.java:96) at oect.lwaltens.luckyblockoect.LuckyBlockOect.<clinit>(LuckyBlockOect.java:46) ... 41 more A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- System Details -- Details: Minecraft Version: 1.8.9 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_151, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 687191704 bytes (655 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB) JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: MCP 9.19 Powered by Forge 11.15.1.1722 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 UC mcp{9.19} [Minecraft Coder Pack] (minecraft.jar) UC FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.8.9-11.15.1.1722.jar) UC Forge{11.15.1.1722} [Minecraft Forge] (forgeSrc-1.8.9-11.15.1.1722.jar) UE luckyblockoect{1.11.0} [luckyblockoect] (bin) UC XaeroMinimap{1.14.9.1} [Xaero's Minimap] (Xaeros_Minimap_1.14.9.1_Forge_1.8.9.jar) Loaded coremods (and transformers): GL info: ' Vendor: 'Intel' Version: '4.5.0 - Build 22.20.16.4836' Renderer: 'Intel(R) HD Graphics 630' Can you help me, thank you very much! 1 Quote
#ÖCT Posted May 3, 2018 Author Posted May 3, 2018 (edited) On 5/3/2018 at 11:47 AM, diesieben07 said: Can you please take the hint of me moving them every single time and stop posting your threads in the ForgeGradle forum when they have nothing to do with ForgeGradle? Thank you. Expand Were should I post the Topic? Edited May 3, 2018 by #ÖCT 1 Quote
#ÖCT Posted May 3, 2018 Author Posted May 3, 2018 On 5/3/2018 at 11:53 AM, diesieben07 said: Look at where I moved all your topics so far... Seriously? Expand ahh, ok! 1 Quote
#ÖCT Posted May 3, 2018 Author Posted May 3, 2018 On 5/3/2018 at 11:53 AM, diesieben07 said: Look at where I moved all your topics so far... Seriously? Expand Can you help me with my problem? 1 Quote
Recommended Posts
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.