Fixed Forge Hammer Bug
This commit is contained in:
@@ -55,7 +55,7 @@ public class Main {
|
||||
|
||||
public static final String MODID = "kitsumedievalcraft";
|
||||
public static final String MODNAME = "ForgeCraft";
|
||||
public static final String VERSION = "2.2.8";
|
||||
public static final String VERSION = "2.3.0";
|
||||
|
||||
public static SimpleNetworkWrapper sNet;
|
||||
|
||||
|
||||
@@ -13,13 +13,22 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.item.crafting.ShapelessRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
|
||||
public class FormTableCraftManager {
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
public class FormTableCraftManager implements IRecipe{
|
||||
|
||||
private static final FormTableCraftManager instance = new FormTableCraftManager();
|
||||
private List recipes = new ArrayList();
|
||||
private ItemStack output = null;
|
||||
private Object[] input = null;
|
||||
private int width = 0;
|
||||
private int height = 0;
|
||||
private boolean mirrored = true;
|
||||
//private static final String __OBFID = "CL_00000090";
|
||||
|
||||
public static final FormTableCraftManager getInstance() {
|
||||
@@ -51,8 +60,108 @@ public class FormTableCraftManager {
|
||||
|
||||
Collections.sort(this.recipes, new FormTableRecipeSorter(this));
|
||||
}
|
||||
|
||||
/* public ShapedOreRecipe(Block result, Object... recipe){ this(new ItemStack(result), recipe); }
|
||||
public ShapedOreRecipe(Item result, Object... recipe){ this(new ItemStack(result), recipe); }
|
||||
public ShapedOreRecipe(ItemStack result, Object... recipe)
|
||||
{
|
||||
output = result.copy();
|
||||
|
||||
public FormTableShapedRecipes addRecipe(ItemStack p_92103_1_, Object ... p_92103_2_)
|
||||
String shape = "";
|
||||
int idx = 0;
|
||||
|
||||
if (recipe[idx] instanceof Boolean)
|
||||
{
|
||||
mirrored = (Boolean)recipe[idx];
|
||||
if (recipe[idx+1] instanceof Object[])
|
||||
{
|
||||
recipe = (Object[])recipe[idx+1];
|
||||
}
|
||||
else
|
||||
{
|
||||
idx = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (recipe[idx] instanceof String[])
|
||||
{
|
||||
String[] parts = ((String[])recipe[idx++]);
|
||||
|
||||
for (String s : parts)
|
||||
{
|
||||
width = s.length();
|
||||
shape += s;
|
||||
}
|
||||
|
||||
height = parts.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (recipe[idx] instanceof String)
|
||||
{
|
||||
String s = (String)recipe[idx++];
|
||||
shape += s;
|
||||
width = s.length();
|
||||
height++;
|
||||
}
|
||||
}
|
||||
|
||||
if (width * height != shape.length())
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
|
||||
HashMap<Character, Object> itemMap = new HashMap<Character, Object>();
|
||||
|
||||
for (; idx < recipe.length; idx += 2)
|
||||
{
|
||||
Character chr = (Character)recipe[idx];
|
||||
Object in = recipe[idx + 1];
|
||||
|
||||
if (in instanceof ItemStack)
|
||||
{
|
||||
itemMap.put(chr, ((ItemStack)in).copy());
|
||||
}
|
||||
else if (in instanceof Item)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Item)in));
|
||||
}
|
||||
else if (in instanceof Block)
|
||||
{
|
||||
itemMap.put(chr, new ItemStack((Block)in, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
else if (in instanceof String)
|
||||
{
|
||||
itemMap.put(chr, OreDictionary.getOres((String)in));
|
||||
}
|
||||
else
|
||||
{
|
||||
String ret = "Invalid shaped ore recipe: ";
|
||||
for (Object tmp : recipe)
|
||||
{
|
||||
ret += tmp + ", ";
|
||||
}
|
||||
ret += output;
|
||||
throw new RuntimeException(ret);
|
||||
}
|
||||
}
|
||||
|
||||
input = new Object[width * height];
|
||||
int x = 0;
|
||||
for (char chr : shape.toCharArray())
|
||||
{
|
||||
input[x++] = itemMap.get(chr);
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
public FormTableShapedRecipes addRecipe(ItemStack p_92103_1_, Object ... p_92103_2_)
|
||||
{
|
||||
String s = "";
|
||||
int i = 0;
|
||||
@@ -155,6 +264,7 @@ public class FormTableCraftManager {
|
||||
arraylist.add(new ItemStack((Block)object1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.recipes.add(new ShapelessRecipes(p_77596_1_, arraylist));
|
||||
}
|
||||
@@ -222,4 +332,28 @@ public class FormTableCraftManager {
|
||||
{
|
||||
return this.recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(InventoryCrafting p_77569_1_, World p_77569_2_) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRecipeSize() {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRecipeOutput() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
|
||||
import com.kitsu.medievalcraft.block.ModBlocks;
|
||||
import com.kitsu.medievalcraft.item.ModItems;
|
||||
@@ -193,14 +194,14 @@ public final class ModCrafting {
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.firebox), new Object[]
|
||||
{"x x", "x x", "xxx",
|
||||
'x', Items.netherbrick});
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.firebox), new Object[]
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.firebox), new Object[]
|
||||
{"x x", "x x", "xxx",
|
||||
Character.valueOf('x'), "ingotBrickClay"});
|
||||
('x'), "ingotBrickClay"}));
|
||||
|
||||
//-----------------------LEATHER STUFF-----------------------//
|
||||
|
||||
//GameRegistry.addRecipe(new ItemStack(ModItems.rawCuredLeather), new Object[]{"x", "z", 'x', Items.leather, 'z', ModItems.salt});
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.rawCuredLeather), new Object[]{Items.leather, "foodSalt"});
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.rawCuredLeather), new Object[]{Items.leather, "foodSalt"}));
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.finishedLeather), new Object[]{"x",'x', ModItems.tannedLeather});
|
||||
//GameRegistry.addRecipe(new ItemStack(ModItems.rawCuredLeather), new Object[]{"x", "z", 'x', Items.leather, 'z', ModItems.salt});
|
||||
|
||||
@@ -218,7 +219,7 @@ public final class ModCrafting {
|
||||
|
||||
//-----------------------CRUCIBLE STUFF-----------------------//
|
||||
//GameRegistry.addRecipe(new ItemStack(ModItems.crucibleLid), new Object[]{"x", "y", 'x', Items.clay_ball, 'y', Blocks.stone_slab});
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.emptySoftCrucible), new Object[]{"y y", "y y", "yyy", 'y', Items.clay_ball});
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(ModBlocks.emptySoftCrucible), new Object[]{"y y", "y y", "yyy", 'y', "clumpClay"}));
|
||||
GameRegistry.addRecipe(new ItemStack(ModItems.charcoalLeafPellet), new Object[]{"xxx", "xyx", "xxx", 'x', new ItemStack(Blocks.leaves,0,3), 'y', new ItemStack(Items.coal,0,1)});
|
||||
GameRegistry.addRecipe(new ItemStack(ModBlocks.crucibleIronOre),
|
||||
new Object[]{" x ", "abc", " y ",
|
||||
|
||||
@@ -41,7 +41,7 @@ public class EntityITSpear extends EntityArrow implements IProjectile {
|
||||
public Entity shootingEntity;
|
||||
private int ticksInGround;
|
||||
private int ticksInAir;
|
||||
private double damage = 10.0D;
|
||||
private double damage = 35.0D;
|
||||
/** The amount of knockback an arrow applies when it hits a mob. */
|
||||
private int knockbackStrength;
|
||||
|
||||
@@ -327,7 +327,10 @@ public class EntityITSpear extends EntityArrow implements IProjectile {
|
||||
|
||||
if (this.shootingEntity == null)
|
||||
{
|
||||
//EntityPlayer player = (EntityPlayer) movingobjectposition.entityHit;
|
||||
//System.out.println(player.inventory.getTotalArmorValue());
|
||||
damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity);
|
||||
//damagesource = DamageSource.
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -372,7 +375,7 @@ public class EntityITSpear extends EntityArrow implements IProjectile {
|
||||
}
|
||||
}
|
||||
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
//this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
|
||||
if (!(movingobjectposition.entityHit instanceof EntityEnderman))
|
||||
{
|
||||
@@ -405,7 +408,7 @@ public class EntityITSpear extends EntityArrow implements IProjectile {
|
||||
this.posX -= this.motionX / (double)f2 * 0.05000000074505806D;
|
||||
this.posY -= this.motionY / (double)f2 * 0.05000000074505806D;
|
||||
this.posZ -= this.motionZ / (double)f2 * 0.05000000074505806D;
|
||||
this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
//this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
|
||||
this.inGround = true;
|
||||
this.arrowShake = 7;
|
||||
|
||||
@@ -415,6 +418,7 @@ public class EntityITSpear extends EntityArrow implements IProjectile {
|
||||
this.field_145790_g.onEntityCollidedWithBlock(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
|
||||
}
|
||||
}
|
||||
this.inGround=true;
|
||||
}
|
||||
|
||||
this.posX += this.motionX;
|
||||
@@ -562,7 +566,7 @@ public class EntityITSpear extends EntityArrow implements IProjectile {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public float getShadowSize()
|
||||
{
|
||||
return 1.0F;
|
||||
return 2.0F;
|
||||
}
|
||||
|
||||
public void setDamage(double p_70239_1_)
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ForgeHammer extends Item implements AnvilUtil{
|
||||
world.setBlock(x, y, z, ModBlocks.ironPlate, 0, 2);
|
||||
}
|
||||
}
|
||||
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
if((tileEnt.getStackInSlot(0).getItem().equals(Items.flower_pot))||tileEnt.getStackInSlot(0).getItem().equals(Items.bucket)){
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
Main.sNet.sendToAll(new MsgPacket(true));
|
||||
@@ -120,6 +120,7 @@ public class ForgeHammer extends Item implements AnvilUtil{
|
||||
world.spawnEntityInWorld(new EntityItem(world, x+0.5D, y+0.6D, z+0.5D, new ItemStack(Items.bucket, 1)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//IRON FORMS
|
||||
if(tileEnt.getStackInSlot(0)!=null){
|
||||
@@ -164,11 +165,12 @@ public class ForgeHammer extends Item implements AnvilUtil{
|
||||
}
|
||||
|
||||
if((block instanceof IngotBase)){
|
||||
TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y, z);
|
||||
//TileIngotBase tile = (TileIngotBase) world.getTileEntity(x, y, z);
|
||||
//REPAIR TOOLS
|
||||
Item checkItem = tileEnt.getStackInSlot(0).getItem();
|
||||
String displayName = tileEnt.getStackInSlot(0).getDisplayName();
|
||||
|
||||
if(tileEnt.getStackInSlot(0) != null){
|
||||
Item checkItem = tileEnt.getStackInSlot(0).getItem();
|
||||
String displayName = tileEnt.getStackInSlot(0).getDisplayName();
|
||||
if(displayName.equals(getTool(tileEnt.getStackInSlot(0)))&&(tile.hot == true)&&(block==ModBlocks.refinedIron)){
|
||||
if(tileEnt.getStackInSlot(0).isItemDamaged() == true){
|
||||
p.worldObj.playSoundAtEntity(p, Main.MODID + ":anvilhammer", 1.0F, 1.0F);
|
||||
@@ -207,6 +209,7 @@ public class ForgeHammer extends Item implements AnvilUtil{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* ItemStack gladius0 = new ItemStack(ModItems.gladius);
|
||||
|
||||
@@ -361,8 +361,10 @@ public class TileForge extends TileEntity implements IInventory{
|
||||
}
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z)>3&&world.getBlockMetadata(x, y, z)<8){
|
||||
if(this.getStackInSlot(1)!=null && (world.canBlockSeeTheSky(x, y+1, z)==true)){
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)+4, 3);
|
||||
if(this.getStackInSlot(1)!=null){
|
||||
if(world.canBlockSeeTheSky(x, y+1, z)==true || world.provider.isHellWorld==true){
|
||||
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)+4, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(world.getBlockMetadata(x, y, z)>7){
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"modid": "kitsumedievalcraft",
|
||||
"name": "ForgeCraft",
|
||||
"description": "ForgeCraft",
|
||||
"version": "{2.2.8}",
|
||||
"version": "{2.3.0}",
|
||||
"mcversion": "{1.7.10}",
|
||||
"url": "http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/wip-mods/2296334-wip-kitsus-forgecraft-blacksmith-style-forging",
|
||||
"updateUrl": "https://bitbucket.org/kitsushadow/kitsus-forgecraft/downloads",
|
||||
|
||||
Reference in New Issue
Block a user