Refactor Tools

This commit is contained in:
kitsushadow
2015-07-09 06:13:43 -04:00
parent b4f5347cda
commit c1ef01dd0c
19 changed files with 95 additions and 103 deletions

View File

@@ -59,23 +59,6 @@ public class Firebox extends BlockContainer{
1.0F, 1.00F, 1.0F);
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
if(!world.isRemote){
if(world.getBlockMetadata(x, y, z)==1){
//this.setLightLevel(9999);
this.setLightLevel(1F);
//this.setLightOpacity(0);
//System.out.println(this.getLightValue()+" "+this.getLightOpacity());
}
if(world.getBlockMetadata(x, y, z)==0){
//this.setLightLevel(9999);
this.setLightLevel(0F);
//this.setLightOpacity(0);
//System.out.println(this.getLightValue()+" "+this.getLightOpacity());
}
}
}
@Override
public boolean isFlammable(IBlockAccess world, int x, int y, int z, ForgeDirection face){
@@ -122,9 +105,8 @@ public class Firebox extends BlockContainer{
(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)
){
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
//world.notifyBlockChange(x, y, z, this);
world.scheduleBlockUpdate(x, y, z, this, 10);
world.setBlockMetadataWithNotify(x, y, z, 1, 3);
this.setLightLevel(1f);
player.inventory.getCurrentItem().damageItem(1, player);
if(world.getBlock(x, y, z).equals(Blocks.air)){
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);

View File

@@ -162,7 +162,8 @@ public class Forge extends BlockContainer implements TileForgePlaceables{
(player.inventory.getCurrentItem().getItem()==Items.flint_and_steel)||
(player.inventory.getCurrentItem().getItem()==ModItems.fireBow)){
if(world.getBlockMetadata(x, y, z)<=3){
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)+4, 2);
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)+4, 3);
this.setLightLevel(1f);
}
tileEnt.markForUpdate();
if(tileEnt.getStackInSlot(1)!=null){

View File

@@ -756,11 +756,16 @@ public final class ModItems {
GameRegistry.registerItem(battleAxe = new ItemBattleAxe("battleAxe", heavymacemat), "battleAxe");
GameRegistry.registerItem(customIronPick = new CustomIronPick("customIronPick", customWoodNormal), "customIronPick");
GameRegistry.registerItem(customStrongIronPick = new CustomStrongIronPick("customStrongIronPick", customWoodStrong), "customStrongIronPick");
GameRegistry.registerItem(customStrongIronPick = new CustomIronPick("customStrongIronPick", customWoodStrong), "customStrongIronPick");
GameRegistry.registerItem(customWeakIronPick = new CustomIronPick("customWeakIronPick", customWoodWeak), "customWeakIronPick");
GameRegistry.registerItem(customHandleIronPick = new CustomIronPick("customHandleIronPick", customIronToolRodNormal), "customHandleIronPick");
GameRegistry.registerItem(customHandleStrongIronPick = new CustomIronPick("customHandleStrongIronPick", customIronToolRodStrong), "customHandleStrongIronPick");
/* GameRegistry.registerItem(customStrongIronPick = new CustomStrongIronPick("customStrongIronPick", customWoodStrong), "customStrongIronPick");
GameRegistry.registerItem(customWeakIronPick = new CustomWeakIronPick("customWeakIronPick", customWoodWeak), "customWeakIronPick");
GameRegistry.registerItem(customHandleIronPick = new CustomHandleIronPick("customHandleIronPick", customIronToolRodNormal), "customHandleIronPick");
GameRegistry.registerItem(customHandleStrongIronPick = new CustomHandleStrongIronPick("customHandleStrongIronPick", customIronToolRodStrong), "customHandleStrongIronPick");
*/
GameRegistry.registerItem(customIronShovel = new CustomIronShovel("customIronShovel", customWoodNormal), "customIronShovel");
GameRegistry.registerItem(customStrongIronShovel = new CustomStrongIronShovel("customStrongIronShovel", customWoodStrong), "customStrongIronShovel");
GameRegistry.registerItem(customWeakIronShovel = new CustomWeakIronShovel("customWeakIronShovel", customWoodWeak), "customWeakIronShovel");

View File

@@ -1,5 +1,8 @@
package com.kitsu.medievalcraft.item.tools;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPickaxe;
@@ -14,18 +17,26 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class CustomIronPick extends ItemPickaxe{
private String name = "customIronPick";
private Item item;
//private String name = "customIronPick";
//private Item item;
public CustomIronPick(String name, ToolMaterial mat) {
super(mat);
item = this;
//item = this;
setUnlocalizedName(name);
setCreativeTab(CustomTab.MedievalCraftTab);
setTextureName(Main.MODID + ":" + name);
this.toolMaterial = ModItems.customWoodNormal;
GameRegistry.registerItem(this, name);
//this.toolMaterial = ModItems.customWoodNormal;
//GameRegistry.registerItem(this, name);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add("");
}
@Override
public int getItemEnchantability () {
return 0;

View File

@@ -220,22 +220,13 @@ public class TileEntityFirebox extends TileEntity implements IInventory{
}
private void fireboxMaint(World world, int x, int y, int z){
if(world.getBlockMetadata(x, y, z)==0&&world.getBlock(x, y+1, z).equals(Blocks.fire)){
//world.setBlock(x, y+1, z, Blocks.air, 0, 2);
world.scheduleBlockUpdate(x, y, z, world.getBlock(x,y,z), 10);
}
if((this.getStackInSlot(0)==null)){
world.setBlockMetadataWithNotify(x, y, z, 0, 2);
world.scheduleBlockUpdate(x, y, z, world.getBlock(x, y, z), 10);
if((this.getStackInSlot(0)==null)&&(world.getBlockMetadata(x, y, z)==1)){
world.setBlockMetadataWithNotify(x, y, z, 0, 3);
world.getBlock(x, y, z).setLightLevel(0f);
}
if(world.getBlockMetadata(x, y, z)==1 && world.getBlock(x, y+1, z).equals(Blocks.air)){
world.setBlock(x, y+1, z, Blocks.fire, 0, 2);
}
if(world.getBlockMetadata(x, y, z)==1){
//this.worldObj.markBlockForUpdate(x, y, z);
world.scheduleBlockUpdate(x, y, z, world.getBlock(x,y,z), 10);
}
}
private void fireboxFuelDec(World world, int x, int y, int z, ItemStack stack, int time){
if(world.getBlock(x, y+1, z).equals(Blocks.fire)){

View File

@@ -335,12 +335,14 @@ public class TileForge extends TileEntity implements IInventory{
private void forgeMaint(World world, int x, int y, int z){
if(this.getStackInSlot(0)==null){
if(world.getBlockMetadata(x, y, z)>=4&&world.getBlockMetadata(x, y, z)<=7){
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)-4, 2);
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)-4, 3);
world.getBlock(x, y, z).setLightLevel(0f);
}
}
if(this.getStackInSlot(0)==null){
if(world.getBlockMetadata(x, y, z)>7){
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)-8, 2);
world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z)-8, 3);
world.getBlock(x, y, z).setLightLevel(0f);
}
}
if(this.getStackInSlot(1)==null){