
dude22072
Members-
Posts
185 -
Joined
-
Last visited
Everything posted by dude22072
-
In the ESC menu for minecraft forge adds a "mod options" button. Is their a tutorial lying around anywhere on how to add/use a button to this page?
-
Found the replacement: public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
-
If I comment the line it tells me I need a return statement. In 1.7.10 the code worked just fine.
-
Code from 1.7.10: public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) { if(!par3World.isRemote && /*par3World.getBlockId(par4, par5, par6) == 2 &&*/ par2EntityPlayer.capabilities.isCreativeMode == false) { par2EntityPlayer.addExperienceLevel(1); par1ItemStack.damageItem(2, par2EntityPlayer); this.dropItemStack(new ItemStack(LOZmod.itemizedExperienceEmpty, 1), par3World, par4, par5, par6); } return super.onItemUse(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10); } What's the replacement for the the "return super.onItemUse" part?
-
When I attempt to launch minecraft I get this in the console: [19:55:53] [main/INFO] [LaunchWrapper]: Loading tweak class name cpw.mods.fml.common.launcher.FMLTweaker [19:55:53] [main/ERROR] [LaunchWrapper]: Unable to launch java.lang.ClassNotFoundException: cpw.mods.fml.common.launcher.FMLTweaker at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_67] at java.net.URLClassLoader$1.run(Unknown Source) ~[?:1.7.0_67] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.7.0_67] at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.7.0_67] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_67] at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) ~[?:1.7.0_67] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_67] at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:106) ~[launchwrapper-1.11.jar:?] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_67] at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.7.0_67] at java.lang.Class.forName0(Native Method) ~[?:1.7.0_67] at java.lang.Class.forName(Unknown Source) ~[?:1.7.0_67] at net.minecraft.launchwrapper.Launch.launch(Launch.java:98) [launchwrapper-1.11.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.11.jar:?] My run configuration is this: Main Class: net.minecraft.launchwrapper.Launch Program Arguments: --version 1.8 --tweakClass cpw.mods.fml.common.launcher.FMLTweaker --accessToken FML --userProperties {} VM Arguments: -Dfml.ignoreInvalidMinecraftCertificates=true
-
[1.7.2]Doing things when a player kills an entity?
dude22072 replied to dude22072's topic in Modder Support
I use FMLCommonHandler.instance().bus().register(new AchievementEvent()); Unsure if it makes a diffrence -
[1.7.2]Doing things when a player kills an entity?
dude22072 replied to dude22072's topic in Modder Support
I've tried LivingDeathEvent @SubscribeEvent public void onEntityDeath(LivingDeathEvent event) { System.out.println("Entity Death"); Entity e = event.entityLiving; DamageSource source = event.source; if(source.getSourceOfDamage() instanceof EntityPlayer) { System.out.println("Player Kill!"); if(e instanceof EntityZombie ) { System.out.println("Zombie Killed!"); mobZombieKill = true; } } } @SubscribeEvent public void onPlayerTick(TickEvent.PlayerTickEvent event) { if (mobZombieKill == true) { System.out.println("Achievement"); event.player.addStat(ExtraAchievements.mobKillZombie, 1); mobZombieKill = false; } } and none of the "System.out.println"s get triggered. -
[1.7.2] adding wearable items that arent armor
dude22072 replied to sigurd4's topic in Modder Support
public static ArmorMaterial NAME = EnumHelper.addArmorMaterial("NAME", DURABILITY, new int[]{0, 0, 0, 0}, 0); This would suffice for you needs. Replace NAME with what you'd like to call it and DURABILITY with the durability of the armour. -
[1.7.2] adding wearable items that arent armor
dude22072 replied to sigurd4's topic in Modder Support
1. i dont want to have a recipe for it, which i think ItemArmor forces you to have and automaticly uses the same pattern as other armorpieces with a chosen item for craftin recipe. 2. i want to have 0 armor value. 3. i only want a head piece, and not any chestplate etc. ItemArmor doesn't force recipes, you can make the protection value 0, if you don't want more than a helmet then make only a helmet. -
I want to give the player an achievement when they kill a specific mob, but I don't know how to do things when a mob dies.
-
[1.7.2][unsolved]Generating custom "vines"?
dude22072 replied to dude22072's topic in Modder Support
~bump~? -
You people overlook the simplest things sometimes. Mike, in your item class @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("mike:greendiamond" + texture); } should be @SideOnly(Side.CLIENT) public void registerIcons(IconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("mike:" + texture); }
-
[1.7.2][unsolved]Generating custom "vines"?
dude22072 replied to dude22072's topic in Modder Support
How do i check for neighboring blocks? kind of a noob... -
I have a block that is essentially vines. I was wondering how to make it so that they generate in the world on the sides of trees?
-
[1.7.2][SOLVED]Custom Furnace is always active?
dude22072 replied to dude22072's topic in Modder Support
FIXED IT I HAD isActive AS A STATIC BOOLEAN. -
[1.7.2][SOLVED]Custom Furnace is always active?
dude22072 replied to dude22072's topic in Modder Support
So, I just tried to smelt something [19:33:50] [server thread/ERROR]: Encountered an unexpected exception net.minecraft.util.ReportedException: Ticking block entity at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:699) ~[MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:604) ~[MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:118) ~[integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:482) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer$2.run(MinecraftServer.java:742) [MinecraftServer$2.class:?] Caused by: java.lang.NullPointerException at dudesmods.fermentation.tileentity.TileEntityFermenter.canSmelt(TileEntityFermenter.java:246) ~[TileEntityFermenter.class:?] at dudesmods.fermentation.tileentity.TileEntityFermenter.updateEntity(TileEntityFermenter.java:181) ~[TileEntityFermenter.class:?] at net.minecraft.world.World.updateEntities(World.java:2116) ~[World.class:?] at net.minecraft.world.WorldServer.updateEntities(WorldServer.java:528) ~[WorldServer.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:693) ~[MinecraftServer.class:?] ... 4 more full TileEntityFermenter package dudesmods.fermentation.tileentity; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; import cpw.mods.fml.common.registry.GameRegistry; import dudesmods.fermentation.FermentationMod; import dudesmods.fermentation.block.Fermenter; public class TileEntityFermenter extends TileEntity implements ISidedInventory { private String localizedName; private static final int[] slots_top = new int[]{3,4,0}; private static final int[] slots_bottom = new int[]{2, 1}; private static final int[] slots_side = new int[]{1}; private ItemStack[] slots = new ItemStack [5]; public int furnaceSpeed = 150; public int burnTime; public int currentItemBurnTime; public int cookTime; public void setGuiDisplayName(String displayName) { this.localizedName = displayName; } public String getInventoryName() { return this.hasCustomInventoryName() ? this.localizedName : "container.fermenter"; } public boolean hasCustomInventoryName() { return this.localizedName != null && this.localizedName.length() > 0; } public int getSizeInventory() { return this.slots.length; } @Override public ItemStack getStackInSlot(int var1) { return this.slots[var1]; } @Override public ItemStack decrStackSize(int var1, int var2) { if(this.slots[var1] != null) { ItemStack itemstack; if(this.slots[var1].stackSize <= var2 ){ itemstack = this.slots[var1]; this.slots[var1] = null; return itemstack; }else{ itemstack = this.slots[var1].splitStack(var2); if(this.slots[var1].stackSize == 0){ this.slots[var1] = null; } return itemstack; } }else { return null; } } @Override public ItemStack getStackInSlotOnClosing(int var1) { if(this.slots[var1] != null) { ItemStack itemstack = this.slots[var1]; this.slots[var1] = null; return itemstack; } return null; } @Override public void setInventorySlotContents(int var1, ItemStack var2) { this.slots[var1] = var2; if(var2 != null && var2.stackSize > this.getInventoryStackLimit()) { var2.stackSize = this.getInventoryStackLimit(); } } @Override public int getInventoryStackLimit() { return 64; } @Override public boolean isUseableByPlayer(EntityPlayer var1) { return this.worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : var1.getDistanceSq((double)xCoord +0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64.0D; } @Override public void openInventory() { } @Override public void closeInventory() { } @Override public boolean isItemValidForSlot(int var1, ItemStack var2) { //return var1 == 2 ? false : (var1 == 1 ? isItemFuel(var2) : true); if(var1 == 2) { return false; } else if(var1 == 1){ return isItemFuel(var2); } else if(var1 == 3) { if(var2.getItem().equals(Items.potionitem)){ return true; } else{ return false; } } else if(var1 == 4){ if(var2.getItem().equals(FermentationMod.yeast)){ return true; } else{ return false; } } return true; } public static boolean isItemFuel(ItemStack var1) { return getItemBurnTime(var1) > 0; } private static int getItemBurnTime(ItemStack var1) { if(var1 == null){ return 0; }else{ Item item = var1.getItem(); if(item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.air) { Block block = Block.getBlockFromItem(item); if(block == Blocks.sapling) return 100; if(block == Blocks.coal_block) return 14400; } if(item == Items.coal) return 1600; if(item == Items.stick) return 100; if(item == Items.lava_bucket) return 20000; if(item == Items.blaze_rod) return 2400; } return GameRegistry.getFuelValue(var1); } public void updateEntity() { boolean flag = this.burnTime > 0; boolean flag1 = false; if (this.burnTime > 0) { --this.burnTime; } if (!this.worldObj.isRemote) { if (this.burnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.slots[1]); if (this.burnTime > 0) { flag1 = true; if (this.slots[1] != null) { --this.slots[1].stackSize; if (this.slots[1].stackSize == 0) { this.slots[1] = slots[1].getItem().getContainerItem(slots[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.cookTime; if (this.cookTime == 200) { this.cookTime = 0; this.smeltItem(); flag1 = true; } } else { this.cookTime = 0; } if (flag != this.burnTime > 0) { flag1 = true; Fermenter.updateFermenterBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (flag1) { this.markDirty(); } } public boolean canSmelt() { if(this.slots[0] == null || this.slots[3] == null || this.slots[4] == null) { return false; }else{ ItemStack itemstack = FermenterRecipes.smelting().getSmeltingResult(this.slots[0]); ItemStack waterBottle = this.slots[3]; ItemStack yeastItem = this.slots[4]; if(waterBottle.getItem().equals(Items.potionitem)) { if(yeastItem.getItem().equals(FermentationMod.yeast)){ if(itemstack == null) {return false;} if(this.slots[2] == null) {return true;} if(!this.slots[2].isItemEqual(itemstack)) {return false;} } } int result = slots[2].stackSize + itemstack.stackSize; return result <= getInventoryStackLimit() && result <= this.slots[2].getMaxStackSize(); } } public void smeltItem() { if(this.canSmelt() == false) { } if (this.canSmelt() == true) { ItemStack itemstack = FermenterRecipes.smelting().getSmeltingResult(this.slots[0]); System.out.println(itemstack); if(this.slots[2] == null) { this.slots[2] = itemstack.copy(); }else if(this.slots[2].getItem() == itemstack.getItem()) { this.slots[2].stackSize += itemstack.stackSize; } this.slots[0].stackSize--;this.slots[3].stackSize--;this.slots[4].stackSize--; if (this.slots[0].stackSize <= 0) { this.slots[0] = null; } if (this.slots[3].stackSize <= 0) { this.slots[3] = null; } if (this.slots[4].stackSize <= 0) { this.slots[4] = null; } } } public boolean isBurning() { return this.burnTime > 0; } @Override public int[] getAccessibleSlotsFromSide(int var1) { return var1 == 0 ? slots_bottom : (var1 == 1 ? slots_top : slots_side); } @Override public boolean canInsertItem(int var1, ItemStack var2, int var3) { return this.isItemValidForSlot(var1, var2); } @Override public boolean canExtractItem(int var1, ItemStack var2, int var3) { return var3 != 0 || var1 != 1 || var2.getItem() == Items.bucket; } public int getBurnTimeRemainingScaled(int i) { if(this.currentItemBurnTime == 0) { this.currentItemBurnTime = this.furnaceSpeed; } return this.burnTime * i / this.currentItemBurnTime; } public int getCookProgressScaled(int i) { return this.cookTime * i / this.furnaceSpeed; } public void readFromNBT(NBTTagCompound nbt) { super.readFromNBT(nbt); NBTTagList list = nbt.getTagList("Items", 10); this.slots = new ItemStack[this.getSizeInventory()]; for(int i = 0; i < list.tagCount(); i++) { NBTTagCompound compound = (NBTTagCompound) list.getCompoundTagAt(i); byte b = compound.getByte("Slot"); if(b >= 0 && b < this.slots.length) { this.slots[b] = ItemStack.loadItemStackFromNBT(compound); } } this.burnTime = (int)nbt.getShort("BurnTime"); this.cookTime = (int)nbt.getShort("CookTime"); this.currentItemBurnTime = (int)nbt.getShort("CurrentBurnTime"); if(nbt.hasKey("CustomName")) { this.localizedName = nbt.getString("CustomName"); } } public void writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setShort("BurnTime", (short)this.burnTime); nbt.setShort("CookTime", (short)this.cookTime); nbt.setShort("CurrentBurnTime", (short)this.currentItemBurnTime); NBTTagList list = new NBTTagList(); for(int i = 0; i< this.slots.length; i++) { if(this.slots[i] != null) { NBTTagCompound compound = new NBTTagCompound(); compound.setByte("Slot", (byte)i); this.slots[i].writeToNBT(compound); list.appendTag(compound); } } nbt.setTag("Items", list); if(this.hasCustomInventoryName()) { nbt.setString("CustomName", this.localizedName); } } } Fixed that, but i'm still having the particle issues. -
[1.7.2][SOLVED]Custom Furnace is always active?
dude22072 replied to dude22072's topic in Modder Support
Copy/Pasted the code from TileEntityFurnace. still isnt working right public void updateEntity() { boolean flag = this.burnTime > 0; boolean flag1 = false; if (this.burnTime > 0) { --this.burnTime; } if (!this.worldObj.isRemote) { if (this.burnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.slots[1]); if (this.burnTime > 0) { flag1 = true; if (this.slots[1] != null) { --this.slots[1].stackSize; if (this.slots[1].stackSize == 0) { this.slots[1] = slots[1].getItem().getContainerItem(slots[1]); } } } } if (this.isBurning() && this.canSmelt()) { ++this.cookTime; if (this.cookTime == 200) { this.cookTime = 0; this.smeltItem(); flag1 = true; } } else { this.cookTime = 0; } if (flag != this.burnTime > 0) { flag1 = true; Fermenter.updateFermenterBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if (flag1) { this.markDirty(); } } -
[1.7.2][SOLVED]Custom Furnace is always active?
dude22072 replied to dude22072's topic in Modder Support
public void updateEntity() { boolean flag = this.burnTime > 0; boolean flag1 = false; if(this.isBurning()) { this.burnTime--; } if(!this.worldObj.isRemote) { if(this.burnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.burnTime = getItemBurnTime(this.slots[1]); if(this.isBurning()){ flag1 = true; if(this.slots[1] != null) { this.slots[1].stackSize--; if(this.slots[1].stackSize == 0) { this.slots[1] = this.slots[1].getItem().getContainerItem(this.slots[1]); } } } } } if(this.isBurning() && this.canSmelt()) { this.cookTime++; if(this.cookTime == this.furnaceSpeed) { this.cookTime = 0; this.smeltItem(); flag1 = true; }else{ } if(flag != this.isBurning()) { flag1 = true; Fermenter.updateFermenterBlockState(this.burnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); } } if(this.slots[0] == null) { this.cookTime = 0; } if(flag1) { this.markDirty(); } } -
Forge 1.7.2 [SOLVED] Items taking damage when used in crafting
dude22072 replied to VikkeHD's topic in Modder Support
Event Class: package dudesmods.lozmod.lozmod3.proxy; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.PlayerEvent; import dudesmods.lozmod.lozmod3.LOZmod; public class LOZmodEVENT { @SubscribeEvent public void onCrafting(PlayerEvent.ItemCraftedEvent e) { for(int i=0; i < e.craftMatrix.getSizeInventory(); i++) { if(e.craftMatrix.getStackInSlot(i) != null) { ItemStack j = e.craftMatrix.getStackInSlot(i); if(j.getItem() != null && j.getItem() == LOZmod.magic_powder) { ItemStack k = new ItemStack(LOZmod.magic_powder, 2, (j.getItemDamage() + 1)); e.craftMatrix.setInventorySlotContents(i, k); } } } } } Stuff in main class: @EventHandler public void PreInitialization(FMLPreInitializationEvent event) { //blah blah blah FMLCommonHandler.instance().bus().register(new LOZmodEVENT()); //blah blah blah } -
I've made a custom furnace and the front texture is always the active one (even when in-hand) and particles are always showing. Fermenter (Block Class) package dudesmods.fermentation.block; import java.util.Random; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; 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.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import cpw.mods.fml.common.network.internal.FMLNetworkHandler; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import dudesmods.fermentation.FermentationMod; import dudesmods.fermentation.tileentity.TileEntityFermenter; public class Fermenter extends BlockContainer { private static boolean isActive; @SideOnly(Side.CLIENT) private IIcon iconFront; @SideOnly(Side.CLIENT) private IIcon iconTop; private static boolean keepInventory; private Random rand = new Random(); public Fermenter(boolean par1) { super(Material.iron); setHardness(3.5F); this.isActive = par1; if(par1 == false) { setCreativeTab(FermentationMod.tabFermentMod); } } @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("fermentmod:fermenter_side"); this.iconFront = iconRegister.registerIcon("fermentmod:" + (this.isActive == true ? "fermenter_front_lit" : "fermenter_front")); this.iconTop = iconRegister.registerIcon("fermentmod:fermenter_top"); } @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { return metadata == 0 && side == 3 ? this.iconFront : side == 1 ? this.iconTop : (side == 0 ? this.iconTop : (side == metadata ? this.iconFront : this.blockIcon)); //return side == 1 ? this.iconTop : (side == 0 ? this.iconTop : (side != metadata ? this.blockIcon : this.iconFront)); } public Item getItemDropped(int i, Random random, int j) { return Item.getItemFromBlock(FermentationMod.blockFermenterIdle); } public void onBlockAdded(World world, int x, int y, int z) { super.onBlockAdded(world, x, y, z); this.setDefaultDirection(world, x, y, z); } private void setDefaultDirection(World world, int x, int y, int z) { if(!world.isRemote) { Block b1 = world.getBlock(x, y, z - 1); Block b2 = world.getBlock(x, y, z + 1); Block b3 = world.getBlock(x - 1, y, z); Block b4 = world.getBlock(x + 1, y, z); byte b0 = 3; if (b1.func_149730_j() && !b2.func_149730_j()) { b0 = 3; } if (b2.func_149730_j() && !b1.func_149730_j()) { b0 = 2; } if (b3.func_149730_j() && !b4.func_149730_j()) { b0 = 5; } if (b4.func_149730_j() && !b3.func_149730_j()) { b0 = 4; } world.setBlockMetadataWithNotify(x, y, z, b0, 2); } } public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { if(!world.isRemote) { FMLNetworkHandler.openGui(player, FermentationMod.instance, FermentationMod.guiFermenter, world, x, y, z); } return true; } @Override public TileEntity createNewTileEntity(World world, int i) { return new TileEntityFermenter(); } @SideOnly(Side.CLIENT) public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) { if (this.isActive) { int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_); float f = (float)p_149734_2_ + 0.5F; float f1 = (float)p_149734_3_ + 0.0F + p_149734_5_.nextFloat() * 6.0F / 16.0F; float f2 = (float)p_149734_4_ + 0.5F; float f3 = 0.52F; float f4 = p_149734_5_.nextFloat() * 0.6F - 0.3F; if (l == 4) { p_149734_1_.spawnParticle("smoke", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f - f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 5) { p_149734_1_.spawnParticle("smoke", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f3), (double)f1, (double)(f2 + f4), 0.0D, 0.0D, 0.0D); } else if (l == 2) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 - f3), 0.0D, 0.0D, 0.0D); } else if (l == 3) { p_149734_1_.spawnParticle("smoke", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); p_149734_1_.spawnParticle("flame", (double)(f + f4), (double)f1, (double)(f2 + f3), 0.0D, 0.0D, 0.0D); } } } public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityplayer, ItemStack itemstack) { int l = MathHelper.floor_double((double)(entityplayer.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; if(l == 0) { world.setBlockMetadataWithNotify(x, y, z, 2, 2); } if(l == 1) { world.setBlockMetadataWithNotify(x, y, z, 5, 2); } if(l == 2) { world.setBlockMetadataWithNotify(x, y, z, 3, 2); } if(l == 3) { world.setBlockMetadataWithNotify(x, y, z, 4, 2); } if(itemstack.hasDisplayName()) { ((TileEntityFermenter)world.getTileEntity(x, y, z)).setGuiDisplayName(itemstack.getDisplayName()); } } public static void updateFermenterBlockState(boolean active, World worldObj, int xCoord, int yCoord, int zCoord) { int i = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); TileEntity tileentity = worldObj.getTileEntity(xCoord, yCoord, zCoord); keepInventory = true; if(active) { worldObj.setBlock(xCoord, yCoord, zCoord, FermentationMod.blockFermenterActive); }else{ worldObj.setBlock(xCoord, yCoord, zCoord, FermentationMod.blockFermenterIdle); } keepInventory = false; worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, i, 2); if(tileentity != null) { tileentity.validate(); worldObj.setTileEntity(xCoord, yCoord, zCoord, tileentity); } } public void breakBlock(World world, int x, int y, int z, Block oldblock, int oldMetadata) { if(!keepInventory) { TileEntityFermenter tileentity = (TileEntityFermenter) world.getTileEntity(x, y, z); if(tileentity != null) { for(int i = 0; i < tileentity.getSizeInventory(); i++) { ItemStack itemstack = tileentity.getStackInSlot(i); if(itemstack != null) { float f = this.rand.nextFloat() * 0.8F + 0.1F; float f1 = this.rand.nextFloat() * 0.8F + 0.1F; float f2 = this.rand.nextFloat() * 0.8F + 0.1F; while(itemstack.stackSize > 0) { int j = this.rand.nextInt(21) + 10; if(j > itemstack.stackSize) { j = itemstack.stackSize; } itemstack.stackSize -= j; EntityItem item = new EntityItem(world, (double)((float)x + f), (double)((float)y + f1), (double)((float)z + f2), new ItemStack(itemstack.getItem(), j, itemstack.getItemDamage())); if(itemstack.hasTagCompound()) { item.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); } world.spawnEntityInWorld(item); } } } world.func_147453_f(x, y, z, oldblock); } } super.breakBlock(world, x, y, z, oldblock, oldMetadata); } public Item getItem(World world, int x, int y, int z) { return Item.getItemFromBlock(FermentationMod.blockFermenterIdle); } }
-
[1.7.x] How to add custom Drops to vanilla mobs
dude22072 replied to SuperHB's topic in Modder Support
copied it exactly I keep on getting an error at the MinecraftForge.EVENT_BUS.register(new LivingDropsEvent()); Part I now the other person who posted trying to help that I had to use the Handler but you dont have one from the looks of it and it... If you look at my code its "ModLivingDropsEvent" not "LivingDropsEvent". -
[1.7.x] How to add custom Drops to vanilla mobs
dude22072 replied to SuperHB's topic in Modder Support
hey, if you still need help, Here's the code i use. works 100%. In the main class: @EventHandler public void PreInitialization(FMLPreInitializationEvent event) { //blah blah blah /*Vanilla Mob Drops*/ MinecraftForge.EVENT_BUS.register(new ModLivingDropsEvent()); //blah blah blah } My "ModLivingDropsEvent" class package dudesmods.lozmod.lozmod3.proxy; import java.util.Random; import net.minecraft.entity.boss.EntityDragon; import net.minecraft.entity.boss.EntityWither; import net.minecraft.entity.monster.EntityBlaze; import net.minecraft.entity.monster.EntityCaveSpider; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMagmaCube; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.monster.EntitySilverfish; import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySlime; import net.minecraft.entity.monster.EntitySnowman; import net.minecraft.entity.monster.EntitySpider; import net.minecraft.entity.monster.EntityWitch; import net.minecraft.entity.monster.EntityZombie; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.passive.EntitySheep; import net.minecraftforge.event.entity.living.LivingDropsEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import dudesmods.lozmod.lozmod3.LOZmod; public class ModLivingDropsEvent { public static double rand; public Random r = new Random(); @SubscribeEvent public void onEntityDrop(LivingDropsEvent event) { if(event.entityLiving instanceof EntityCow) { event.entityLiving.dropItem(LOZmod.green_tanned_leather, r.nextInt(1)); event.entityLiving.dropItem(LOZmod.red_tanned_leather, r.nextInt(1)); event.entityLiving.dropItem(LOZmod.blue_tanned_leather, r.nextInt(1)); event.entityLiving.dropItem(LOZmod.rupee_green, 5); } if(event.entityLiving instanceof EntityPig) { event.entityLiving.dropItem(LOZmod.rupee_green, 5); } if(event.entityLiving instanceof EntitySheep) { event.entityLiving.dropItem(LOZmod.rupee_green, 5); } if(event.entityLiving instanceof EntityHorse) { event.entityLiving.dropItem(LOZmod.rupee_green, 10); } if(event.entityLiving instanceof EntityChicken) { event.entityLiving.dropItem(LOZmod.rupee_green, 5); } if(event.entityLiving instanceof EntitySnowman) { event.entityLiving.dropItem(LOZmod.rupee_green, 1); } if(event.entityLiving instanceof EntityIronGolem) { event.entityLiving.dropItem(LOZmod.rupee_green, 20); } if(event.entityLiving instanceof EntityZombie) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40)); } if(event.entityLiving instanceof EntityPigZombie) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40)); } if(event.entityLiving instanceof EntitySpider) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40)); } if(event.entityLiving instanceof EntityCaveSpider) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(50)); } if(event.entityLiving instanceof EntityBlaze) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(60)); } if(event.entityLiving instanceof EntityCreeper) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(100)); } if(event.entityLiving instanceof EntityEnderman) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(120)); } if(event.entityLiving instanceof EntityGhast) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200)); } if(event.entityLiving instanceof EntitySilverfish) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(200)); } if(event.entityLiving instanceof EntitySkeleton) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40)); } if(event.entityLiving instanceof EntitySlime) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40)); } if(event.entityLiving instanceof EntityMagmaCube) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40)); } if(event.entityLiving instanceof EntityWitch) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, r.nextInt(40)); } if(event.entityLiving instanceof EntityWither) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, 500); } if(event.entityLiving instanceof EntityDragon) { event.entityLiving.dropItem(LOZmod.magic_powder_dust, r.nextInt(5)); event.entityLiving.dropItem(LOZmod.rupee_green, 700); } } } -
Without your code we cannot see if you are doing anything wrong.