Jump to content

TastesLikeBleach

Members
  • Posts

    28
  • Joined

  • Last visited

Converted

  • Personal Text
    Wishes they could insert toaster as their gender for the lulz. I'm just a guy figuring out this modding stuff and I come here when I run into bumps, I usually link my code when I get this help, feel free to use the functional pieces for your own projects

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

TastesLikeBleach's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Alright show's over, using @Override on the read and write methods fixed it.
  2. public void loadFromNbt(NBTTagCompound compound, boolean isLogging) { NBTTagCompound itemTag = (NBTTagCompound) compound.getTag("item"); 108 >>> String itemId = itemTag.getString("id"); Item item = GameRegistry.findRegistry(Item.class).getValue(new ResourceLocation(itemId)); int count = itemTag.getInteger("count"); int damage = itemTag.getInteger("data"); this.currentItem = new ItemStack(item, count, damage); this.isValidAltar = compound.getBoolean("isValid"); if(isLogging) { QuickLogger.log("itemTag = " + itemTag.toString() + "\nitemId = " + itemId + "\ncount = " + count + "\ndata = " + damage + "\nisAltarValid = " + compound.getBoolean("isValid")); } } I should've overridden those methods, I'll do that now
  3. Could you please link a resource or something because I don't know how to do that.
  4. So I'm programming a tile entity for an altar block which uses some code to store an item. public void readFromNBT(NBTTagCompound compound) { super.readFromNBT(compound); this.loadFromNbt(compound, true); } public NBTTagCompound writeToNBT(NBTTagCompound compound) { NBTTagCompound itemTag = new NBTTagCompound(); itemTag.setString("id", this.currentItem.getItem().getRegistryName().getResourceDomain() + ':' + this.currentItem.getItem().getRegistryName().getResourcePath()); itemTag.setInteger("count", this.currentItem.getCount()); itemTag.setInteger("data", this.currentItem.getItemDamage()); compound.setTag("item", itemTag); compound.setBoolean("isValid", this.isValidAltar); super.writeToNBT(compound); return compound; } public void loadFromNbt(NBTTagCompound compound, boolean isLogging) { NBTTagCompound itemTag = (NBTTagCompound) compound.getTag("item"); String itemId = itemTag.getString("id"); Item item = GameRegistry.findRegistry(Item.class).getValue(new ResourceLocation(itemId)); int count = itemTag.getInteger("count"); int damage = itemTag.getInteger("data"); this.currentItem = new ItemStack(item, count, damage); this.isValidAltar = compound.getBoolean("isValid"); if(isLogging) { QuickLogger.log("itemTag = " + itemTag.toString() + "\nitemId = " + itemId + "\ncount = " + count + "\ndata = " + damage + "\nisAltarValid = " + compound.getBoolean("isValid")); } } and I keep getting this error in the log even though everything stores and loads seemingly fine, it raises a java.lang.NullPointerException on the line in loadFromNbt() which gets the String itemId Here's the little error traceback thing [16:30:23] [main/FATAL] [minecraft/Minecraft]: Error executing task java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.8.0_191] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.8.0_191] at net.minecraft.util.Util.runTask(Util.java:54) [Util.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1177) [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_191] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_191] 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_191] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_191] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_191] at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?] at GradleStart.main(GradleStart.java:25) [start/:?] Caused by: java.lang.NullPointerException at thetrueskeptic.ebtks.tileentity.TileEntityAltar.loadFromNbt(TileEntityAltar.java:108) ~[TileEntityAltar.class:?] at thetrueskeptic.ebtks.tileentity.TileEntityAltar.readFromNBT(TileEntityAltar.java:91) ~[TileEntityAltar.class:?] at net.minecraft.tileentity.TileEntity.handleUpdateTag(TileEntity.java:361) ~[TileEntity.class:?] at net.minecraft.client.network.NetHandlerPlayClient.handleChunkData(NetHandlerPlayClient.java:836) ~[NetHandlerPlayClient.class:?] at net.minecraft.network.play.server.SPacketChunkData.processPacket(SPacketChunkData.java:110) ~[SPacketChunkData.class:?] at net.minecraft.network.play.server.SPacketChunkData.processPacket(SPacketChunkData.java:20) ~[SPacketChunkData.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_191] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.8.0_191] at net.minecraft.util.Util.runTask(Util.java:53) ~[Util.class:?] ... 15 more
  5. I'm adding an object to my mod which creates spawn eggs on right-clicking a weakened mob. What I need to finish this event is a way to get the (modid:entityname) from an entity so I can turn it into a resource location and use it in the ItemMonsterPlacer.applyEntityIdToItemStack() method. Here's what I have so far. public class SoulStoneCaptureEvent { @SubscribeEvent public void onEvent(EntityInteract event){ EntityPlayer player = event.getEntityPlayer(); EntityLiving entity = (EntityLiving) event.getTarget(); BlockPos pos = player.getPosition(); if(player.getHeldItemMainhand().getItem() == ModItems.ash && event.getTarget() instanceof EntityLiving) { if(player.getHeldItemOffhand().getItem() == ModItems.voided_egg) { if(entity.isNonBoss() && entity.getHealth() < entity.getMaxHealth() / 2) { ItemStack itemstack = new ItemStack(Items.SPAWN_EGG); ItemMonsterPlacer.applyEntityIdToItemStack(itemstack, null); EntityItem item = new EntityItem(player.getEntityWorld(), pos.getX(), pos.getY(), pos.getZ(), new ItemStack(Items.SPAWN_EGG)); } } } } } Ps. the ash is a placeholder item until I code in the tool and stuff.
  6. fixed, just make sure you have your mcmod.info shit in order
  7. wft does this mean for my mod and why? Zip file ebtks-alpha-1.12.2-1.3.3.jar failed to read properly, it will be ignored java.lang.NullPointerException at net.minecraftforge.fml.common.MetadataCollection.parseModMetadataList(MetadataCollection.java:91) at net.minecraftforge.fml.common.MetadataCollection.from(MetadataCollection.java:79) at net.minecraftforge.fml.common.discovery.JarDiscoverer.discover(JarDiscoverer.java:65) at net.minecraftforge.fml.common.discovery.ContainerType.findMods(ContainerType.java:47) at net.minecraftforge.fml.common.discovery.ModCandidate.explore(ModCandidate.java:74) at net.minecraftforge.fml.common.discovery.ModDiscoverer.identifyMods(ModDiscoverer.java:93) at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:425) at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:566) at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:232) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:466) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:377) at net.minecraft.client.main.Main.main(SourceFile:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
  8. I'm making a custom tree with some log blocks (already working with canSustainLeaves overridden to true) and leaf block extending BlockLeaves (linked) When leaves more than 1 block away from the trunk of the tree decay they leave behind ghost blocks that can be broken or right-clicked to make them vanish, when right-clicking with a block while another ghost block is behind it the block in-hand will replace the ghost block but leave the one behind it intact, I think this is occurring on the client side but I don't know how to fix it. https://pastebin.com/DPw7bW6L
  9. I though I could use a method, thanks, I know how to do that.
  10. It's about a method called AddCrop, in ModCrops...
  11. what is the problem with the interactions with these classes? https://pastebin.com/htEnaKtX https://pastebin.com/t6aGZBqj
  12. Thanks alot, You're really good at this.
  13. I made a translucent block but when I placed it down it made the block below it transparent; Here it is | V Here's the block class -> https://pastebin.com/5A4HnBAx
  14. Tried that, didn't work.
×
×
  • Create New...

Important Information

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