Posted February 10, 201510 yr i got my pick smelting the ore when broken but it has a graphical glitch that it drops 2 ingots and when i break stuff that cant be smelted say Dirt it crashes the game. Code: package com.ProjectTronopolis.PTmod.Items.Tools; import java.util.ArrayList; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.world.World; public class redstonePick extends ItemPickaxe { public redstonePick(ToolMaterial p_i45347_1_) { super(p_i45347_1_); // TODO Auto-generated constructor stub } @Override public boolean onBlockStartBreak(ItemStack itemstack, int i, int j, int k, EntityPlayer player) { return bFull3D; } @Override public boolean onBlockDestroyed(ItemStack itemStack, World world, Block block, int x, int y, int z, EntityLivingBase player) { ItemStack stack = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block)).copy(); if (stack != null) { System.out.println(stack); world.setBlockToAir(x, y, z); player.entityDropItem(stack, 1); } return true; } } Please help Thanks Tom
February 10, 201510 yr You need to do !world.isRemote check to run the code only on server side. For e.g dirt-crash. You need to check if item can be smelted (has smelting result) obviously 1.7.10 is no longer supported by forge, you are on your own.
February 10, 201510 yr Author so how would i implement that? could you give me an example in code as thats the best way i learn
February 10, 201510 yr public void method(World world) { if (!world.isRemote) { //runs on server } else //runs on client } When you spawn entity (item in this case) you always do it on server only. 1.7.10 is no longer supported by forge, you are on your own.
February 10, 201510 yr Author So like this? public void method(World world) { if (!world.isRemote) { @Override public boolean onBlockStartBreak(ItemStack itemstack, int i, int j, int k, EntityPlayer player) { return bFull3D;} else { @Override public boolean onBlockDestroyed(ItemStack itemStack, World world, Block block, int x, int y, int z, EntityLivingBase player) { } ItemStack stack = FurnaceRecipes.smelting().getSmeltingResult(new ItemStack(block)).copy(); if (stack != null) { System.out.println(stack); world.setBlockToAir(x, y, z); player.entityDropItem(stack, 1); { return true; } Or am i doing it wrong?
February 10, 201510 yr Author Or am i doing it wrong? Yes, very much so. Please learn at least the absolute basics of Java before starting to make a mod. Welp in that case got any suggestions where to start as im willing to learn anything and woudlnt know where to start any books/sites/vids on teaching java that you would highly reccommend? OR even a teacher that would do it through skype or something
February 12, 201510 yr http://bit.ly/sbfpYy Always diesieben with the let me google that for you. I'm back from being gone for... I think its been about a year. I'm pretty sure nobody remembers me, but hello anybody who does!
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.