Jump to content

The_SlayerMC

Members
  • Posts

    209
  • Joined

  • Last visited

Everything posted by The_SlayerMC

  1. Than how would a good STABLE way to check if the player is the source of damage and he/she is holding a sword? And ty, iv'e been told that people are much more helpful on these forums
  2. I never casted the source, are you telling me too or..?
  3. You can check the durability of the tool by going: int i = ((ItemPickaxe)Items.diamond_pickaxe).getMaxDamage(); That can be used for the armour/weapons/item just change the cast you can make an if statement for the weapon durability by going if(i < 1000) (that will check if 1000 is greater than the current tools durability) if you want to replace a broken tool with a new one go if(i < 0){ player.inventory.addStackToInventory(new ItemStack(Items.diamond)) }
  4. On my LivingDeathEvent, it just started to crash after I removed if(!event.world.isRemote) (it was placed above the checker if statement) and now it is crashing when i kill a mob the cause is the "if(event.source.getSourceOfDamage() instanceof EntityPlayer && p.getHeldItem().getItem() instanceof ItemSword){" And before that was crashing, it would crash when a mob would kill itself in lava or something! I don't know why it would crash on that, because I'm only checking if the source was the player and if the player is holding a sword. Here is my event (I would put it in a code spoiler but I'm new to the forge forums and idk how to!) @SubscribeEvent public void onKilledMob(LivingDeathEvent event){ EntityPlayer p = (EntityPlayer)event.source.getEntity(); if(event.source.getSourceOfDamage() instanceof EntityPlayer && p.getHeldItem().getItem() instanceof ItemSword){ final int level = rand.nextInt(2) + 1; DataHelper.setSwordLevel(p, DataHelper.getSwordLevel(p) + level); } }
  5. public static BiomeGenBase[] biomes = new BiomeGenBase[]{BiomeGenBase.plains, BiomeGenBase.extremeHills, BiomeGenBase.beach, BiomeGenBase.desert, BiomeGenBase.desertHills, BiomeGenBase.extremeHillsEdge, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.icePlains, BiomeGenBase.iceMountains, BiomeGenBase.river, BiomeGenBase.birchForest, BiomeGenBase.birchForestHills, BiomeGenBase.coldBeach, BiomeGenBase.coldTaiga, BiomeGenBase.coldTaigaHills, BiomeGenBase.deepOcean, BiomeGenBase.extremeHillsPlus, BiomeGenBase.jungleEdge, BiomeGenBase.megaTaiga, BiomeGenBase.megaTaigaHills, BiomeGenBase.mesa, BiomeGenBase.mesaPlateau, BiomeGenBase.mesaPlateau_F, BiomeGenBase.roofedForest, BiomeGenBase.savanna, BiomeGenBase.savannaPlateau, BiomeGenBase.stoneBeach}; EntityRegistry.addSpawn(mob.class, group, min, max, type, biomes);
  6. package com.budboy.betterfishing; import com.budboy.betterfishing.Proxy.ProxyCommon; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.*; import cpw.mods.fml.common.Mod.*; import cpw.mods.fml.common.event.*; import cpw.mods.fml.common.registry.*; @Mod(modid = BetterFishing.MODID, version = BetterFishing.VERSION, name = BetterFishing.NAME) public class BetterFishing { public static final String MODID = "betterFishing", VERSION = "1.0", NAME = "Better Fishing"; @Instance(MODID) public static BetterFishing instance; @SidedProxy(clientSide = "com.budboy.betterfishing.Proxy.ProxyClient", serverSide = "com.budboy.betterfishing.Proxy.ProxyCommon") public static ProxyCommon proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.registerRenderers(); addRecipes(); } @EventHandler public void init(FMLInitializationEvent event){ } @EventHandler public void postInit(FMLPostInitializationEvent event) { } public void addRecipes(){ GameRegistry.addRecipe(new ItemStack(Blocks.obsidian), new Object[]{"AAA", "AAA", "AAA", 'A', Items.cookie}); } }
  7. May i clean this code? its kinda annoying me
×
×
  • Create New...

Important Information

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