Skip to content

Commit

Permalink
more cleanups and attempt to fix fishing rods
Browse files Browse the repository at this point in the history
  • Loading branch information
jriwanek committed Apr 24, 2016
1 parent 8b42c83 commit 74a96a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/main/java/modernmetals/init/Recipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ private static void initMetalRecipes(){
if(rod != null && arrow != null) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(arrow), "x", "y", "z", 'x', "nugget"+oreDictName, 'y', "rod"+oreDictName,'z' ,Items.FEATHER));
if(rod != null && bow != null) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(bow), " xy", "x y", " xy", 'x', "rod"+oreDictName, 'y', Items.STRING));
if(rod != null && gear != null && crossbow != null) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(crossbow), "zxx", " yx", "x z", 'x', "rod"+oreDictName, 'y', "gear"+oreDictName, 'z', Items.STRING));
if(rod != null && gear != null && crossbow != null) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(crossbow), "xxz", "xy ", "z x", 'x', "rod"+oreDictName, 'y', "gear"+oreDictName, 'z', Items.STRING));
if(rod != null && bolt != null) GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(bolt), "x", "x", "y", 'x', "rod"+oreDictName, 'y', Items.FEATHER));
}

Expand Down
13 changes: 13 additions & 0 deletions src/main/java/modernmetals/items/ItemMetalFishingRod.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@
import cyano.basemetals.registry.IOreDictionaryEntry;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.ItemFishingRod;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;

public class ItemMetalFishingRod extends ItemFishingRod implements IOreDictionaryEntry, IMetalObject {
Expand All @@ -33,6 +38,14 @@ public ItemMetalFishingRod(MetalMaterial m){
} else {
regenerates = false;
}
this.addPropertyOverride(new ResourceLocation("cast"), new IItemPropertyGetter()
{
@SideOnly(Side.CLIENT)
public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn)
{
return entityIn == null ? 0.0F : (entityIn.getHeldItemMainhand() == stack && entityIn instanceof EntityPlayer && ((EntityPlayer)entityIn).fishEntity != null ? 1.0F : 0.0F);
}
});
this.oreDict = "fishingrod"+metal.getCapitalizedName();
}

Expand Down

0 comments on commit 74a96a3

Please sign in to comment.