TastesLikeBleach
Members-
Posts
28 -
Joined
-
Last visited
Everything posted by TastesLikeBleach
-
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
-
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
-
Getting an entities Mod ID and unlocalized name.
TastesLikeBleach replied to TastesLikeBleach's topic in Modder Support
thank -
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.
-
How to keep my mod from being skipped by forge?
TastesLikeBleach replied to TastesLikeBleach's topic in Modder Support
fixed, just make sure you have your mcmod.info shit in order -
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)
-
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
-
Rendering Bug Stuff /w Translucent Blocks
TastesLikeBleach replied to TastesLikeBleach's topic in Modder Support
Thanks alot, You're really good at this. -
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
-
Tried that, didn't work.
-
When I right clicked using ItemPruningShears my game crashed, the traceback lead to a conditional statement which tests if the block right-clicked is a netherwart with an age of 7. https://pastebin.com/Uhx37TjR <- Item class
-
Good to know, also i was using the class name as a placeholder.
-
yeah it worked
-
So then in conclusion the fix would be if(World.isRemote != true){ Word.spawnEntity(item); }
-
I understand that if a world is in single player then worldIn.isRemote is true, if it is a server the value is false, my problem is as follows... if(WorldIn.isRemote){ /* what do i do here? */ }
-
I really am sorry to bother you, but I don't know how to apply the given information in code, an example, like a section of documentation, or code snippet would be appreciated.
-
I made an event where you rightclick with a tool on a crop block and it changes the block back to having an age of 0, as well as spawning in an itemstack. However when the event is triggered it spawns two itemstacks, one of which you can't interact with. Also instead of damaging the tool used it deletes it. https://pastebin.com/hGxcC1qJ -> the event class
-
Help with directional blocks [1.12]
TastesLikeBleach replied to TastesLikeBleach's topic in Modder Support
I have done it! https://pastebin.com/uGiWHUfZ -
[1.12.2]Issue with Block Variants Rendering
TastesLikeBleach replied to ChromeT's topic in Modder Support
please delete me -
Help with directional blocks [1.12]
TastesLikeBleach replied to TastesLikeBleach's topic in Modder Support
Are there any specific methods i need to implement in order to make my log block function like a log, and can i just use the vanilla blockstates for logs and models as templates for my log(s)