diff --git a/mods/tinker/resources/lang/en_US.xml b/mods/tinker/resources/lang/en_US.xml index 8f3f795d..57e0bea8 100644 --- a/mods/tinker/resources/lang/en_US.xml +++ b/mods/tinker/resources/lang/en_US.xml @@ -172,6 +172,7 @@ Empty Canister Miniature Red Heart Heart Canister + Dirtmover Gloves Casting Table Seared Faucet diff --git a/mods/tinker/tconstruct/TConstruct.java b/mods/tinker/tconstruct/TConstruct.java index a34c1f7a..433810e2 100644 --- a/mods/tinker/tconstruct/TConstruct.java +++ b/mods/tinker/tconstruct/TConstruct.java @@ -2,20 +2,21 @@ package mods.tinker.tconstruct; import mods.tinker.tconstruct.common.TContent; import mods.tinker.tconstruct.common.TProxyCommon; +import mods.tinker.tconstruct.library.SkillRegistry; import mods.tinker.tconstruct.library.TConstructRegistry; import mods.tinker.tconstruct.library.crafting.Detailing; import mods.tinker.tconstruct.library.crafting.LiquidCasting; import mods.tinker.tconstruct.library.util.TabTools; +import mods.tinker.tconstruct.skill.Jump; +import mods.tinker.tconstruct.skill.WallBuilding; import mods.tinker.tconstruct.util.PHConstruct; import mods.tinker.tconstruct.util.TCraftingHandler; import mods.tinker.tconstruct.util.TEventHandler; import mods.tinker.tconstruct.util.player.TPlayerHandler; -import mods.tinker.tconstruct.worldgen.OverworldProvider; import mods.tinker.tconstruct.worldgen.TBaseWorldGenerator; import mods.tinker.tconstruct.worldgen.village.TVillageTrades; import mods.tinker.tconstruct.worldgen.village.VillageSmelteryHandler; import mods.tinker.tconstruct.worldgen.village.VillageToolStationHandler; -import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; @@ -37,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry; * @dependencies: IC2 API, MFR API */ -@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.dev49", dependencies = "required-after:Forge@[7.7.1.675,)") +@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.4", dependencies = "required-after:Forge@[7.7.1.675,)") @NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class) public class TConstruct { @@ -106,6 +107,8 @@ public class TConstruct content.modIntegration(); content.createEntities(); + SkillRegistry.registerSkill("Wall Building", new WallBuilding()); + SkillRegistry.registerSkill("Jump", new Jump()); } public static LiquidCasting getTableCasting() @@ -122,11 +125,12 @@ public class TConstruct { return chiselDetailing; } - + public static TEventHandler events; public static TPlayerHandler playerTracker; public static TContent content; public static LiquidCasting tableCasting; public static LiquidCasting basinCasting; public static Detailing chiselDetailing; + public static SkillRegistry skillRegistry; } diff --git a/mods/tinker/tconstruct/blocks/OreberryBush.java b/mods/tinker/tconstruct/blocks/OreberryBush.java index 41660c01..5a6f1e6a 100644 --- a/mods/tinker/tconstruct/blocks/OreberryBush.java +++ b/mods/tinker/tconstruct/blocks/OreberryBush.java @@ -116,7 +116,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable } else { - return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 1.0D, (double) z + 1.0D); + return AxisAlignedBB.getBoundingBox(x+0.0625, y, z+0.0625, (double) x + 0.9375D, (double) y + 0.9375D, (double) z + 0.9375D); } } diff --git a/mods/tinker/tconstruct/blocks/logic/SmelteryLogic.java b/mods/tinker/tconstruct/blocks/logic/SmelteryLogic.java index 544d724f..5b03980a 100644 --- a/mods/tinker/tconstruct/blocks/logic/SmelteryLogic.java +++ b/mods/tinker/tconstruct/blocks/logic/SmelteryLogic.java @@ -612,7 +612,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci { for (int zPos = z - 1; zPos <= z + 1; zPos++) { - if (worldObj.getBlockId(xPos, y, zPos) != 0) + Block block = Block.blocksList[worldObj.getBlockId(xPos, y, zPos)]; + if (block != null && block.isAirBlock(worldObj, xPos, y, zPos)) return count; } } @@ -646,7 +647,8 @@ public class SmelteryLogic extends InventoryLogic implements IActiveLogic, IFaci for (int zPos = z - 1; zPos <= z + 1; zPos++) { int blockID = worldObj.getBlockId(xPos, y, zPos); - if (blockID != 0) + Block block = Block.blocksList[blockID]; + if (block != null && !block.isAirBlock(worldObj, xPos, y, zPos)) { if (blockID == TContent.smeltery.blockID) return validateBottom(x, y, z, count); diff --git a/mods/tinker/tconstruct/client/TClientEvents.java b/mods/tinker/tconstruct/client/TClientEvents.java index 990b5c96..a8aa383a 100644 --- a/mods/tinker/tconstruct/client/TClientEvents.java +++ b/mods/tinker/tconstruct/client/TClientEvents.java @@ -1,8 +1,12 @@ package mods.tinker.tconstruct.client; +import java.util.List; + import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.client.armor.WingModel; import mods.tinker.tconstruct.common.TContent; +import mods.tinker.tconstruct.skill.Skill; +import mods.tinker.tconstruct.util.player.TPlayerStats; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.model.ModelBiped; @@ -13,7 +17,12 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.TextureStitchEvent; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.liquids.LiquidStack; + +import org.lwjgl.opengl.GL11; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @@ -22,6 +31,22 @@ public class TClientEvents { Minecraft mc = Minecraft.getMinecraft(); EntityPlayer player; + + /*@ForgeSubscribe + public void interact (PlayerInteractEvent event) + { + if (event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote) + { + System.out.println("Fired"); + List skills = TProxyClient.skillList; + if (skills.size() > 0) + { + Skill walls = TConstruct.playerTracker.getPlayerStats(event.entityPlayer.username).skillList.get(0); + walls.rightClickActivate(event.entityPlayer, event.entityPlayer.worldObj); + } + } + }*/ + /* Sounds */ @ForgeSubscribe public void onSound (SoundLoadEvent event) @@ -51,20 +76,22 @@ public class TClientEvents } } - /* Health */ + /* HUD */ @ForgeSubscribe public void renderHealthbar (RenderGameOverlayEvent.Post event) { + if (player == null) + player = mc.thePlayer; + + ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); + int scaledWidth = scaledresolution.getScaledWidth(); + int scaledHeight = scaledresolution.getScaledHeight(); + int xBasePos = scaledWidth / 2 - 91; + int yBasePos = scaledHeight - 39; + TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); + if (event.type == RenderGameOverlayEvent.ElementType.HEALTH) - { - if (player == null) - player = mc.thePlayer; - - ScaledResolution scaledresolution = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight); - int scaledWidth = scaledresolution.getScaledWidth(); - int scaledHeight = scaledresolution.getScaledHeight(); - int xBasePos = scaledWidth / 2 - 91; - int yBasePos = scaledHeight - 39; + { this.mc.renderEngine.bindTexture("/mods/tinker/textures/gui/newhearts.png"); int hp = player.getHealth(); @@ -85,9 +112,22 @@ public class TClientEvents this.mc.renderEngine.bindTexture("/gui/icons.png"); } + + if (event.type == RenderGameOverlayEvent.ElementType.HOTBAR) + { + int amount = 0; + GL11.glScalef(1/16f, 1/16f, 1/16f); + for (Skill skill : stats.skillList) + { + if (!skill.getActive()) + GL11.glColor4f(0.5f, 0.5f, 0.5f, 1.0F); + this.mc.renderEngine.bindTexture(skill.getTextureFile(scaledresolution.getScaleFactor())); + this.drawTexturedModalRect((2+amount*18)*16, 32, 0, 0, 256, 256); + amount++; + } + GL11.glScalef(16f, 16f, 16f); + } } - - public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6) { diff --git a/mods/tinker/tconstruct/client/TControls.java b/mods/tinker/tconstruct/client/TControls.java index a99d485f..60922b27 100644 --- a/mods/tinker/tconstruct/client/TControls.java +++ b/mods/tinker/tconstruct/client/TControls.java @@ -4,13 +4,13 @@ import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.util.EnumSet; -import mods.tinker.tconstruct.client.gui.InventoryTab; -import net.minecraft.block.Block; +import mods.tinker.tconstruct.TConstruct; +import mods.tinker.tconstruct.skill.Skill; +import mods.tinker.tconstruct.util.player.TPlayerStats; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.settings.KeyBinding; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.network.packet.Packet250CustomPayload; import cpw.mods.fml.common.TickType; import cpw.mods.fml.common.network.PacketDispatcher; @@ -19,22 +19,29 @@ public class TControls extends TKeyHandler { //static KeyBinding grabKey = new KeyBinding("key.grab", 29); //static KeyBinding stiltsKey = new KeyBinding("key.stilts", 46); - public static KeyBinding armorKey = new KeyBinding("key.tarmor", 24); + public static KeyBinding armorKey = new KeyBinding("key.tarmor", 24); + public static KeyBinding skillOne = new KeyBinding("key.skill.one", 44); + public static KeyBinding skillTwo = new KeyBinding("key.skill.two", 45); + public static KeyBinding skillThree = new KeyBinding("key.skill.three", 46); + public static KeyBinding skillFour = new KeyBinding("key.skill.four", 47); + public static KeyBinding skillFive = new KeyBinding("key.skill.five", 48); static KeyBinding jumpKey; static KeyBinding invKey; static Minecraft mc; + boolean jumping; boolean doubleJump = true; boolean climbing = false; boolean onGround = false; boolean onStilts = false; - + //boolean onStilts = false; public TControls() { - super(new KeyBinding[] { armorKey }, new boolean[] { false }, getVanillaKeyBindings(), new boolean[] { false, false }); - //System.out.println("Controls registered"); + super(new KeyBinding[] { armorKey, skillOne, skillTwo, skillThree, skillFour, skillFive }, new boolean[] { false, false, false, false, false, false }, getVanillaKeyBindings(), new boolean[] { + false, false }); + //System.out.println("Controls registered");Natura } private static KeyBinding[] getVanillaKeyBindings () @@ -56,15 +63,34 @@ public class TControls extends TKeyHandler { if (tickEnd && mc.theWorld != null) { - if (kb == armorKey && mc.currentScreen == null) //Extended Armor - { - openArmorGui(mc.thePlayer.username); - } - if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// && !mc.playerController.isInCreativeMode()) - { - TProxyClient.addTabsToInventory(); - - } + if (kb == armorKey && mc.currentScreen == null) //Extended Armor + { + openArmorGui();//mc.thePlayer.username); + } + if (kb == invKey && mc.currentScreen != null && mc.currentScreen.getClass() == GuiInventory.class)// && !mc.playerController.isInCreativeMode()) + { + TProxyClient.addTabsToInventory(); + } + if (kb == skillOne) + { + sendSkillkey(mc.thePlayer, (byte) 0);//, mc.thePlayer.dimension, mc.thePlayer.entityId); + } + if (kb == skillTwo) + { + sendSkillkey(mc.thePlayer, (byte) 1);//, mc.thePlayer.dimension, mc.thePlayer.entityId); + } + if (kb == skillThree) + { + sendSkillkey(mc.thePlayer, (byte) 2);//, mc.thePlayer.dimension, mc.thePlayer.entityId); + } + if (kb == skillFour) + { + sendSkillkey(mc.thePlayer, (byte) 3);//, mc.thePlayer.dimension, mc.thePlayer.entityId); + } + if (kb == skillFive) + { + sendSkillkey(mc.thePlayer, (byte) 4);//, mc.thePlayer.dimension, mc.thePlayer.entityId); + } /*if (kb == jumpKey) //Double jump { if (jumping && !doubleJump) @@ -124,8 +150,8 @@ public class TControls extends TKeyHandler doubleJump = false; jumping = false; } - - public void resetControls() + + public void resetControls () { doubleJump = false; jumping = false; @@ -150,7 +176,7 @@ public class TControls extends TKeyHandler updateServer(bos); } - + void updateSize (String name, float size) { ByteArrayOutputStream bos = new ByteArrayOutputStream(8); @@ -168,25 +194,57 @@ public class TControls extends TKeyHandler updateServer(bos); } - - public static void openArmorGui(String username) - { - ByteArrayOutputStream bos = new ByteArrayOutputStream(8); - DataOutputStream outputStream = new DataOutputStream(bos); - try - { - outputStream.writeByte(3); - outputStream.writeUTF(username); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - updateServer(bos); + public static void openArmorGui ()//String username) + { + ByteArrayOutputStream bos = new ByteArrayOutputStream(8); + DataOutputStream outputStream = new DataOutputStream(bos); + try + { + outputStream.writeByte(3); + //outputStream.writeUTF(username); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + updateServer(bos); } - static void updateServer(ByteArrayOutputStream bos) + /*public void activateSkill (EntityPlayer player, int slot) + { + if (TProxyClient.skillList.size() > slot) + { + Skill skill = TProxyClient.skillList.get(slot); + if (skill != null) + { + skill.activate(player, player.worldObj); + } + } + }*/ + + public void sendSkillkey (EntityPlayer player, byte key)//, int dim, int id) + { + TConstruct.playerTracker.activateSkill(player, key); + ByteArrayOutputStream bos = new ByteArrayOutputStream(8); + DataOutputStream outputStream = new DataOutputStream(bos); + try + { + outputStream.writeByte(4); + //outputStream.writeInt(dim); + //outputStream.writeInt(id); + outputStream.writeByte(key); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + + updateServer(bos); + } + + static void updateServer (ByteArrayOutputStream bos) { Packet250CustomPayload packet = new Packet250CustomPayload(); packet.channel = "TConstruct"; diff --git a/mods/tinker/tconstruct/client/TProxyClient.java b/mods/tinker/tconstruct/client/TProxyClient.java index fddc50c2..865d7e1b 100644 --- a/mods/tinker/tconstruct/client/TProxyClient.java +++ b/mods/tinker/tconstruct/client/TProxyClient.java @@ -9,7 +9,6 @@ import java.util.List; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; -import mods.natura.entity.NitroCreeper; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.blocks.logic.CastingBasinLogic; import mods.tinker.tconstruct.blocks.logic.CastingTableLogic; @@ -67,7 +66,9 @@ import mods.tinker.tconstruct.library.client.TConstructClientRegistry; import mods.tinker.tconstruct.library.client.ToolGuiElement; import mods.tinker.tconstruct.library.crafting.ToolBuilder; import mods.tinker.tconstruct.library.tools.ToolCore; +import mods.tinker.tconstruct.skill.Skill; import mods.tinker.tconstruct.util.player.ArmorExtended; +import mods.tinker.tconstruct.util.player.ArmorExtendedClient; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; @@ -99,7 +100,6 @@ import net.minecraft.client.particle.EntitySplashFX; import net.minecraft.client.particle.EntitySuspendFX; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.entity.RenderCreeper; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.KeyBinding; @@ -125,8 +125,9 @@ public class TProxyClient extends TProxyCommon public static SmallFontRenderer smallFontRenderer; public static Icon metalBall; public static Minecraft mc; - public static ArmorExtended armorExtended = new ArmorExtended(); public static RenderItem itemRenderer = new RenderItem(); + + public static ArmorExtended armorExtended = new ArmorExtended(); @Override public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z) diff --git a/mods/tinker/tconstruct/client/gui/InventoryTab.java b/mods/tinker/tconstruct/client/gui/InventoryTab.java index f79d4144..151c3efc 100644 --- a/mods/tinker/tconstruct/client/gui/InventoryTab.java +++ b/mods/tinker/tconstruct/client/gui/InventoryTab.java @@ -65,7 +65,7 @@ public class InventoryTab extends GuiButton if (this.id == 2) TProxyClient.openInventoryGui(); if (this.id == 3) - TControls.openArmorGui(mc.thePlayer.username); + TControls.openArmorGui();//mc.thePlayer.username); } return inWindow; } diff --git a/mods/tinker/tconstruct/common/TContent.java b/mods/tinker/tconstruct/common/TContent.java index f3fc52fc..96102f33 100644 --- a/mods/tinker/tconstruct/common/TContent.java +++ b/mods/tinker/tconstruct/common/TContent.java @@ -47,6 +47,7 @@ import mods.tinker.tconstruct.items.StrangeFood; import mods.tinker.tconstruct.items.TitleIcon; import mods.tinker.tconstruct.items.ToolPart; import mods.tinker.tconstruct.items.ToolShard; +import mods.tinker.tconstruct.items.armor.Glove; import mods.tinker.tconstruct.items.armor.TArmorBase; import mods.tinker.tconstruct.items.blocks.CraftedSoilItemBlock; import mods.tinker.tconstruct.items.blocks.GravelOreItem; @@ -233,11 +234,12 @@ public class TContent implements IFuelHandler public static Item notebook; public static Item note; - //Wearaables + //Wearables public static Item heavyHelmet; public static Item heavyChestplate; public static Item heavyPants; public static Item heavyBoots; + public static Item glove; public static Item heartCanister; @@ -484,6 +486,7 @@ public class TContent implements IFuelHandler //heavyHelmet = new TArmorBase(PHConstruct.heavyHelmet, 0).setUnlocalizedName("tconstruct.HeavyHelmet"); heartCanister = new HeartCanister(PHConstruct.heartCanister).setUnlocalizedName("tconstruct.canister"); heavyBoots = new TArmorBase(PHConstruct.heavyBoots, 3).setUnlocalizedName("tconstruct.HeavyBoots"); + glove = new Glove(PHConstruct.glove).setUnlocalizedName("tconstruct.Glove"); /*public static Item heavyHelmet; public static Item heavyChestplate; public static Item heavyPants; diff --git a/mods/tinker/tconstruct/items/HeartCanister.java b/mods/tinker/tconstruct/items/HeartCanister.java index 005a6b53..09197122 100644 --- a/mods/tinker/tconstruct/items/HeartCanister.java +++ b/mods/tinker/tconstruct/items/HeartCanister.java @@ -40,7 +40,7 @@ public class HeartCanister extends CraftingItem slotStack.stackSize++; stack.stackSize--; } - armor.recalculateHealth(); + armor.recalculateHealth(player, stats); } } return stack; diff --git a/mods/tinker/tconstruct/items/TitleIcon.java b/mods/tinker/tconstruct/items/TitleIcon.java index 2207c033..2cb16280 100644 --- a/mods/tinker/tconstruct/items/TitleIcon.java +++ b/mods/tinker/tconstruct/items/TitleIcon.java @@ -2,7 +2,6 @@ package mods.tinker.tconstruct.items; import java.util.List; -import mods.natura.entity.NitroCreeper; import mods.tinker.tconstruct.client.TProxyClient; import mods.tinker.tconstruct.entity.BlueSlime; import mods.tinker.tconstruct.library.tools.ToolCore; @@ -10,7 +9,6 @@ import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityList; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -106,9 +104,6 @@ public class TitleIcon extends Item case 1: spawnBossSlime(posX, posY, posZ, new BlueSlime(world), world, player); break; - case 2: - spawnEntity(posX, posY, posZ, new NitroCreeper(world), world, player); - break; } if (!player.capabilities.isCreativeMode) { diff --git a/mods/tinker/tconstruct/items/armor/Glove.java b/mods/tinker/tconstruct/items/armor/Glove.java new file mode 100644 index 00000000..324fc096 --- /dev/null +++ b/mods/tinker/tconstruct/items/armor/Glove.java @@ -0,0 +1,20 @@ +package mods.tinker.tconstruct.items.armor; + +import mods.tinker.tconstruct.library.TConstructRegistry; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.item.Item; + +public class Glove extends Item +{ + public Glove(int par1) + { + super(par1); + this.setCreativeTab(TConstructRegistry.materialTab); + } + + @Override + public void registerIcons (IconRegister iconRegister) + { + itemIcon = iconRegister.registerIcon("tinker:armor/dirthand"); + } +} diff --git a/mods/tinker/tconstruct/library/SkillRegistry.java b/mods/tinker/tconstruct/library/SkillRegistry.java new file mode 100644 index 00000000..064164a3 --- /dev/null +++ b/mods/tinker/tconstruct/library/SkillRegistry.java @@ -0,0 +1,24 @@ +package mods.tinker.tconstruct.library; + +import java.util.HashMap; + +import mods.tinker.tconstruct.skill.Skill; + +public class SkillRegistry +{ + public static HashMap skills = new HashMap(); + + static int skillID = 0; + public static HashMap skillMapping = new HashMap(); //Simplifies network transmission + + public static void registerSkill(String name, Skill skill) + { + skills.put(name, skill); + skillMapping.put(getNextID(), name); + } + + static Integer getNextID () + { + return skillID++; + } +} diff --git a/mods/tinker/tconstruct/library/tools/AbilityHelper.java b/mods/tinker/tconstruct/library/tools/AbilityHelper.java index 6ffadaee..ca1abd50 100644 --- a/mods/tinker/tconstruct/library/tools/AbilityHelper.java +++ b/mods/tinker/tconstruct/library/tools/AbilityHelper.java @@ -20,6 +20,7 @@ import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.passive.EntityWolf; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.potion.Potion; @@ -28,6 +29,8 @@ import net.minecraft.stats.StatList; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.Vec3; import net.minecraft.world.World; import net.minecraftforge.common.FakePlayer; import net.minecraftforge.common.MinecraftForge; @@ -610,4 +613,28 @@ public class AbilityHelper world.spawnEntityInWorld(entityitem); return entityitem; } + + public static MovingObjectPosition raytraceFromEntity (World world, Entity player, boolean par3, double range) + { + float f = 1.0F; + float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; + float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; + double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; + double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f + 1.62D - (double) player.yOffset; + double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; + Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2); + float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); + float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); + float f5 = -MathHelper.cos(-f1 * 0.017453292F); + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; + double d3 = range; + if (player instanceof EntityPlayerMP) + { + d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); + } + Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + return world.rayTraceBlocks_do_do(vec3, vec31, par3, !par3); + } } diff --git a/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java b/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java index ecd52859..c4a5a249 100644 --- a/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java +++ b/mods/tinker/tconstruct/modifiers/TActiveOmniMod.java @@ -14,11 +14,13 @@ import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class TActiveOmniMod extends ActiveToolMod @@ -50,7 +52,7 @@ public class TActiveOmniMod extends ActiveToolMod { if (player.capabilities.isCreativeMode) return false; - + if (tool instanceof HarvestTool) TContent.modL.midStreamModify(stack); @@ -89,6 +91,33 @@ public class TActiveOmniMod extends ActiveToolMod entityitem.delayBeforeCanPickup = 10; world.spawnEntityInWorld(entityitem); world.playAuxSFX(2001, x, y, z, bID + (meta << 12)); + + int i = spawnme.stackSize; + float f = FurnaceRecipes.smelting().getExperience(spawnme); + int j; + + if (f == 0.0F) + { + i = 0; + } + else if (f < 1.0F) + { + j = MathHelper.floor_float((float) i * f); + + if (j < MathHelper.ceiling_float_int((float) i * f) && (float) Math.random() < (float) i * f - (float) j) + { + ++j; + } + + i = j; + } + + while (i > 0) + { + j = EntityXPOrb.getXPSplit(i); + i -= j; + player.worldObj.spawnEntityInWorld(new EntityXPOrb(world, x, y + 0.5, z, j)); + } } for (int i = 0; i < 6; i++) { diff --git a/mods/tinker/tconstruct/plugins/minefactoryreloaded/MineFactoryReloaded.java b/mods/tinker/tconstruct/plugins/minefactoryreloaded/MineFactoryReloaded.java index fa1a9aaf..52dc1351 100644 --- a/mods/tinker/tconstruct/plugins/minefactoryreloaded/MineFactoryReloaded.java +++ b/mods/tinker/tconstruct/plugins/minefactoryreloaded/MineFactoryReloaded.java @@ -1,16 +1,11 @@ package mods.tinker.tconstruct.plugins.minefactoryreloaded; -import mods.natura.entity.NitroCreeper; import mods.tinker.tconstruct.common.TContent; import mods.tinker.tconstruct.entity.BlueSlime; -import mods.tinker.tconstruct.entity.Crystal; -import mods.tinker.tconstruct.entity.MetalSlime; -import mods.tinker.tconstruct.entity.Skyla; import mods.tinker.tconstruct.plugins.minefactoryreloaded.grindables.GrindableStandard; import mods.tinker.tconstruct.plugins.minefactoryreloaded.harvestables.HarvestableOreBerry; - -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import powercrystals.minefactoryreloaded.api.FarmingRegistry; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Mod; @@ -18,8 +13,6 @@ import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; -import powercrystals.minefactoryreloaded.api.FarmingRegistry; - @Mod(modid = "TConstruct|CompatMineFactoryReloaded", name = "TConstruct Compat: MFR", version = "0.1", dependencies = "after:MineFactoryReloaded;after:TConstruct") @NetworkMod(clientSideRequired = false, serverSideRequired = false) @@ -42,10 +35,10 @@ public class MineFactoryReloaded // A note: in 1.6, this method of registering grindables will no longer exist, once MFR moves to a more universal way of gathering drops. FarmingRegistry.registerGrindable(new GrindableStandard(BlueSlime.class, new ItemStack(TContent.strangeFood))); - FarmingRegistry.registerGrindable(new GrindableStandard(Crystal.class, new ItemStack(Item.gunpowder))); - FarmingRegistry.registerGrindable(new GrindableStandard(MetalSlime.class, new ItemStack(TContent.strangeFood))); - FarmingRegistry.registerGrindable(new GrindableStandard(NitroCreeper.class, new ItemStack(Item.gunpowder))); - FarmingRegistry.registerGrindable(new GrindableStandard(Skyla.class, new ItemStack(Item.gunpowder))); + //FarmingRegistry.registerGrindable(new GrindableStandard(Crystal.class, new ItemStack(Item.gunpowder))); + //FarmingRegistry.registerGrindable(new GrindableStandard(MetalSlime.class, new ItemStack(TContent.strangeFood))); + //FarmingRegistry.registerGrindable(new GrindableStandard(NitroCreeper.class, new ItemStack(Item.gunpowder))); + //FarmingRegistry.registerGrindable(new GrindableStandard(Skyla.class, new ItemStack(Item.gunpowder))); /* * Perhaps TC ores should be registered as drops from the MFR Laser Drill here, but I don't know which things would be suitable for that. diff --git a/mods/tinker/tconstruct/skill/Jump.java b/mods/tinker/tconstruct/skill/Jump.java new file mode 100644 index 00000000..de1efc9f --- /dev/null +++ b/mods/tinker/tconstruct/skill/Jump.java @@ -0,0 +1,35 @@ +package mods.tinker.tconstruct.skill; + +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.world.World; + +public class Jump extends Skill +{ + + @Override + public String getTextureFile (int guiscale) + { + /*if (guiscale == 2) + return "/mods/tinker/textures/skill/Jump32x.png"; + if (guiscale == 3) + return "/mods/tinker/textures/skill/Jump48x.png"; + + return "/mods/tinker/textures/skill/Jump16x.png";*/ + return "/mods/tinker/textures/skill/Jump48x.png"; + } + + @Override + public String getSkillName () + { + return "Jump"; + } + + @Override + public void activate (Entity entity, World world) + { + if (entity.onGround) + entity.motionY = 0.8f; + } + +} diff --git a/mods/tinker/tconstruct/skill/Skill.java b/mods/tinker/tconstruct/skill/Skill.java new file mode 100644 index 00000000..9efe11ef --- /dev/null +++ b/mods/tinker/tconstruct/skill/Skill.java @@ -0,0 +1,57 @@ +package mods.tinker.tconstruct.skill; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.world.World; + +/* Base skill + * + */ + +public abstract class Skill +{ + boolean active = true; + public abstract String getTextureFile(int guiscale); + public abstract String getSkillName(); + public abstract void activate(Entity entity, World world); + public void rightClickActivate(Entity entity, World world) {}; + + public int chargeTime() //Ticks + { + return 0; + } + + public boolean canEntityUseSkill(Entity entity) + { + return true; + } + + public int getSkillCost() + { + return 0; + } + + public boolean getActive() + { + return active; + } + + public Skill copy() throws InstantiationException, IllegalAccessException + { + return this.getClass().newInstance(); + } + + /* Save/Load */ + public void saveToNBT (NBTTagCompound tag) + { + + } + + public void readFromNBT (NBTTagCompound tag) + { + + } +} diff --git a/mods/tinker/tconstruct/skill/SkillBase.java b/mods/tinker/tconstruct/skill/SkillBase.java deleted file mode 100644 index f80949c5..00000000 --- a/mods/tinker/tconstruct/skill/SkillBase.java +++ /dev/null @@ -1,34 +0,0 @@ -package mods.tinker.tconstruct.skill; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -/* Base skill - * - */ - -public abstract class SkillBase -{ - public abstract String getTextureFile(); - public abstract String getSkillName(); - - public int chargeTime() //Ticks - { - return 0; - } - - public boolean canPlayerUseSkill() - { - return true; - } - - public void activateSkill(EntityPlayer player, World world) - { - - } - - public int getSkillCost() - { - return 0; - } -} diff --git a/mods/tinker/tconstruct/skill/WallBuilding.java b/mods/tinker/tconstruct/skill/WallBuilding.java new file mode 100644 index 00000000..46989045 --- /dev/null +++ b/mods/tinker/tconstruct/skill/WallBuilding.java @@ -0,0 +1,135 @@ +package mods.tinker.tconstruct.skill; + +import mods.tinker.tconstruct.library.tools.AbilityHelper; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraft.util.MathHelper; +import net.minecraft.util.MovingObjectPosition; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; + +public class WallBuilding extends Skill +{ + + @Override + public String getTextureFile (int guiscale) + { + if (guiscale == 2) + return "/mods/tinker/textures/skill/Wall32x.png"; + if (guiscale == 3) + return "/mods/tinker/textures/skill/Wall48x.png"; + + return "/mods/tinker/textures/skill/Wall16x.png"; + } + + @Override + public String getSkillName () + { + return "Wall Building"; + } + + @Override + public void activate (Entity entity, World world) + { + if (!world.isRemote) + this.active = !active; + } + + @Override + public void rightClickActivate (Entity entity, World world) + { + if (!world.isRemote && active) + { + if (entity instanceof EntityPlayer) + { + EntityPlayer player = (EntityPlayer) entity; + ItemStack stack = player.getCurrentEquippedItem(); + if (stack != null && stack.getItem() instanceof ItemBlock) + { + MovingObjectPosition mop = AbilityHelper.raytraceFromEntity(world, entity, true, 6); + + if (mop != null) + { + int xPos = mop.blockX; + int yPos = mop.blockY; + int zPos = mop.blockZ; + /*ForgeDirection sideHit = ForgeDirection.getOrientation(mop.sideHit); + switch (sideHit) + { + case UP: + yPos += 1; + break; + case DOWN: + yPos -= 1; + break; + case NORTH: + zPos -= 1; + break; + case SOUTH: + zPos += 1; + break; + case EAST: + xPos += 1; + break; + case WEST: + xPos -= 1; + break; + default: + break; + }*/ + + int facing = MathHelper.floor_double((double) (entity.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3; + int xMin = 0; + int xMax = 0; + int zMin = 0; + int zMax = 0; + if (facing % 2 == 0) + { + xMin = -1; + xMax = 1; + } + else + { + zMin = -1; + zMax = 1; + } + + for (int y = -1; y <= 1; y++) + { + for (int x = xMin; x <= xMax; x++) + { + for (int z = zMin; z <= zMax; z++) + { + stack.getItem().onItemUse(stack, player, world, xPos + x, yPos + y, zPos + z, mop.sideHit, 0, 0, 0); + if (stack.stackSize < 1) + { + player.inventory.setInventorySlotContents(player.inventory.currentItem, null); + break; + } + //world.setBlock(xPos + x, yPos + y, zPos + z, Block.whiteStone.blockID); + } + } + } + //entity.worldObj.setBlock(xPos, yPos, zPos, Block.stone.blockID, 0, 3); + world.playAuxSFX(2001, xPos, yPos, zPos, Block.stone.blockID + (0 << 12)); + } + } + } + /*for (int x = -2; x <= 2; x++) + { + for (int y = -1; y <= 1; y++) + { + //for (int z = -2; z <= 2; z++) + { + world.setBlock((int) Math.floor(entity.posX) + x, (int) Math.floor(entity.posY) + y, (int) Math.floor(entity.posZ) + 2, Block.whiteStone.blockID); + } + } + } + world.playAuxSFX(2001, (int) entity.posX, (int) entity.posY, (int) entity.posZ, Block.stone.blockID + (0 << 12));*/ + } + } + +} diff --git a/mods/tinker/tconstruct/util/PHConstruct.java b/mods/tinker/tconstruct/util/PHConstruct.java index 52d0fbb1..de9a7a96 100644 --- a/mods/tinker/tconstruct/util/PHConstruct.java +++ b/mods/tinker/tconstruct/util/PHConstruct.java @@ -148,6 +148,7 @@ public class PHConstruct heavyChestplate = config.getItem("Equipables", "Heavy Chestplate", 14108).getInt(14108); heavyPants = config.getItem("Equipables", "Heavy Pants", 14109).getInt(14109); heavyBoots = config.getItem("Equipables", "Heavy Boots", 14110).getInt(14110); + glove = config.getItem("Equipables", "Gloves", 14111).getInt(14111); boolean ic2 = true; boolean xycraft = true; @@ -334,6 +335,7 @@ public class PHConstruct public static int heavyChestplate; public static int heavyPants; public static int heavyBoots; + public static int glove; public static int heartCanister; diff --git a/mods/tinker/tconstruct/util/TEventHandler.java b/mods/tinker/tconstruct/util/TEventHandler.java index f4b85126..b501de22 100644 --- a/mods/tinker/tconstruct/util/TEventHandler.java +++ b/mods/tinker/tconstruct/util/TEventHandler.java @@ -1,9 +1,9 @@ package mods.tinker.tconstruct.util; import java.util.ArrayList; +import java.util.List; import java.util.Random; -import mods.natura.entity.NitroCreeper; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.blocks.logic.LiquidTextureLogic; import mods.tinker.tconstruct.common.TContent; @@ -11,9 +11,11 @@ import mods.tinker.tconstruct.library.crafting.PatternBuilder; import mods.tinker.tconstruct.library.crafting.Smeltery; import mods.tinker.tconstruct.library.crafting.ToolBuilder; import mods.tinker.tconstruct.modifiers.ModAttack; +import mods.tinker.tconstruct.skill.Skill; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityGhast; import net.minecraft.entity.monster.EntitySkeleton; @@ -23,666 +25,692 @@ import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityCow; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EntityDamageSource; import net.minecraft.util.EnumMovingObjectType; import net.minecraft.world.World; import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; -import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.player.FillBucketEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.liquids.LiquidStack; import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent; public class TEventHandler { - Random random = new Random(); - - @ForgeSubscribe - public void onHurt (LivingHurtEvent event) - { - if (event.source instanceof EntityDamageSource && event.source.damageType.equals("explosion.player") && ((EntityDamageSource) event.source).getEntity() instanceof NitroCreeper) - { - if (event.entityLiving.worldObj.difficultySetting == 3) - event.ammount /= 2.3; - else - event.ammount /= 1.5; - } - } - - /* Drops */ - @ForgeSubscribe - public void onLivingDrop (LivingDropsEvent event) - { - if (random.nextInt(500) == 0 && event.entityLiving instanceof IMob && event.entityLiving.dimension == 0) - { - ItemStack dropStack = new ItemStack(TContent.heartCanister, 1, 1); - EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); - entityitem.delayBeforeCanPickup = 10; - event.drops.add(entityitem); - } - - if (!event.entityLiving.isChild()) - { - if (event.entityLiving.getClass() == EntityCow.class) - { - int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1; - - for (int iter = 0; iter < amount; ++iter) - { - ItemStack dropStack = new ItemStack(Item.leather, 1); - EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); - entityitem.delayBeforeCanPickup = 10; - event.drops.add(entityitem); - } - } - - else if (event.entityLiving.getClass() == EntityChicken.class) - { - int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1; - - for (int iter = 0; iter < amount; ++iter) - { - ItemStack dropStack = new ItemStack(Item.feather, 1); - EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); - entityitem.delayBeforeCanPickup = 10; - event.drops.add(entityitem); - } - } - } - - if (event.recentlyHit && event.entityLiving.getClass() == EntitySkeleton.class) - { - EntitySkeleton skeleton = (EntitySkeleton) event.entityLiving; - if (skeleton.getSkeletonType() == 1 && random.nextInt(Math.max(1, 5 - event.lootingLevel)) == 0) - { - ItemStack dropStack = new ItemStack(TContent.materials, 1, 8); - EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); - entityitem.delayBeforeCanPickup = 10; - event.drops.add(entityitem); - } - } - - else if (event.entityLiving.getClass() == EntityGhast.class) - { - ItemStack dropStack = new ItemStack(Item.ghastTear, 1); - EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); - entityitem.delayBeforeCanPickup = 10; - event.drops.add(entityitem); - } - } - - @ForgeSubscribe - public void onLivingSpawn (LivingSpawnEvent.SpecialSpawn event) - { - if (event.entityLiving.getClass() == EntitySpider.class && random.nextInt(100) == 0) - { - EntityCreeper creeper = new EntityCreeper(event.entityLiving.worldObj); - spawnEntity(event.entityLiving.posX, event.entityLiving.posY+1, event.entityLiving.posZ, creeper, event.entityLiving.worldObj); - creeper.mountEntity(event.entityLiving); - } - } - - public static void spawnEntity (double x, double y, double z, Entity entity, World world) - { - if (!world.isRemote) - { - entity.setPosition(x, y, z); - ((EntityLiving) entity).initCreature(); - world.spawnEntityInWorld(entity); - } - } - - /* Ore Dictionary */ - @ForgeSubscribe - public void registerOre (OreRegisterEvent evt) - { - if (evt.Name == "battery") - TConstruct.content.modE.batteries.add(evt.Ore); - - else if (evt.Name == "basicCircuit") - TConstruct.content.modE.circuits.add(evt.Ore); - - else if (evt.Name == "plankWood") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Wood"); - } - - else if (evt.Name == "crystalQuartz") - { - ToolBuilder.instance.registerToolMod(new ModAttack("Quartz", new ItemStack[] { evt.Ore }, 11, 2)); - } - - else if (evt.Name == "crystalCerusQuartz") - { - ToolBuilder.instance.registerToolMod(new ModAttack("Quartz", new ItemStack[] { evt.Ore }, 11, 24)); - } - - //Ingots - else if (evt.Name == "ingotCopper") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Copper"); - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 2)); - } - - else if (evt.Name == "ingotTin") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 3)); - } - - else if (evt.Name == "ingotBronze") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Bronze"); - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 7)); - } - - else if (evt.Name == "ingotCobalt") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Cobalt"); - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 5)); - } - - else if (evt.Name == "ingotArdite") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Ardite"); - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 6)); - } - - else if (evt.Name == "ingotManyullyn") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Manyullyn"); - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 9)); - } - - else if (evt.Name == "ingotNaturalAluminum") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 4)); - } - - else if (evt.Name == "naturalAluminum") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 4)); - } - - else if (evt.Name == "ingotAluminumBrass") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 8)); - } - - else if (evt.Name == "ingotAlumite") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Alumite"); - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 10)); - } - - else if (evt.Name == "ingotSteel") - { - PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Steel"); - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 12)); - } - - //Ores - else if (evt.Name == "oreCopper") - { - Smeltery.addMelting(evt.Ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 2)); - } - - else if (evt.Name == "oreTin") - { - Smeltery.addMelting(evt.Ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 3)); - } - - else if (evt.Name == "oreNaturalAluminum") - { - Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 4)); - } - - else if (evt.Name == "oreCobalt") - { - Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 5)); - } - - else if (evt.Name == "oreArdite") - { - Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 6)); - } - - //Blocks - else if (evt.Name == "blockCopper") - { - Smeltery.addMelting(evt.Ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 2)); - } - - else if (evt.Name == "blockTin") - { - Smeltery.addMelting(evt.Ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 3)); - } - - else if (evt.Name == "blockBronze") - { - Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 7)); - } - - else if (evt.Name == "blockNaturalAluminum") - { - Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 4)); - } - - else if (evt.Name == "blockCobalt") - { - Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 5)); - } - - else if (evt.Name == "blockArdite") - { - Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 6)); - } - - else if (evt.Name == "blockManyullyn") - { - Smeltery.addMelting(evt.Ore, 800, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 9)); - } - - else if (evt.Name == "blockAluminumBrass") - { - Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8)); - } - - else if (evt.Name == "blockAlumite") - { - Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 10)); - } - - else if (evt.Name == "blockSteel") - { - Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 12)); - } - - //Dust - else if (evt.Name == "dustCopper") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 2)); - } - - else if (evt.Name == "dustTin") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 3)); - } - - else if (evt.Name == "dustBronze") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 7)); - } - - else if (evt.Name == "dustCobalt") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 5)); - } - - else if (evt.Name == "dustArdite") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 6)); - } - - else if (evt.Name == "dustManyullyn") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 9)); - } - - else if (evt.Name == "dustAluminum") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 4)); - } - - else if (evt.Name == "dustNaturalAluminum") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 4)); - } - - else if (evt.Name == "dustAluminumBrass") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 8)); - } - - else if (evt.Name == "dustAlumite") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 10)); - } - - else if (evt.Name == "dustSteel") - { - Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue, 12)); - } - } - - public void unfuxOreDictionary () //TODO: This isn't the best - { - ArrayList ores = OreDictionary.getOres("ingotCopper"); - for (ItemStack ore : ores) - { - PatternBuilder.instance.registerMaterial(ore, 2, "Copper"); - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 2)); - } - - ores = OreDictionary.getOres("ingotTin"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 3)); - } - - ores = OreDictionary.getOres("ingotBronze"); - for (ItemStack ore : ores) - { - PatternBuilder.instance.registerMaterial(ore, 2, "Bronze"); - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 7)); - } - - ores = OreDictionary.getOres("ingotCobalt"); - for (ItemStack ore : ores) - { - PatternBuilder.instance.registerMaterial(ore, 2, "Cobalt"); - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 5)); - } - - ores = OreDictionary.getOres("ingotArdite"); - for (ItemStack ore : ores) - { - PatternBuilder.instance.registerMaterial(ore, 2, "Ardite"); - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 6)); - } - - ores = OreDictionary.getOres("ingotManyullyn"); - for (ItemStack ore : ores) - { - PatternBuilder.instance.registerMaterial(ore, 2, "Manyullyn"); - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 9)); - } - - ores = OreDictionary.getOres("naturalAluminum"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 4)); - } - - ores = OreDictionary.getOres("ingotNaturalAluminum"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 4)); - } - - ores = OreDictionary.getOres("ingotAluminumBrass"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 8)); - } - - ores = OreDictionary.getOres("ingotAlumite"); - for (ItemStack ore : ores) - { - PatternBuilder.instance.registerMaterial(ore, 2, "Alumite"); - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 10)); - } - - ores = OreDictionary.getOres("ingotSteel"); - for (ItemStack ore : ores) - { - PatternBuilder.instance.registerMaterial(ore, 2, "Steel"); - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 12)); - } - - ores = OreDictionary.getOres("oreCopper"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 2)); - } - - ores = OreDictionary.getOres("oreTin"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 3)); - } - - ores = OreDictionary.getOres("oreNaturalAluminum"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 4)); - } - - ores = OreDictionary.getOres("oreCobalt"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 5)); - } - - ores = OreDictionary.getOres("oreArdite"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 6)); - } - - ores = OreDictionary.getOres("blockCopper"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 2)); - } - - ores = OreDictionary.getOres("blockTin"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 3)); - } - - ores = OreDictionary.getOres("blockBronze"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 7)); - } - - ores = OreDictionary.getOres("blockNaturalAluminum"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 4)); - } - - ores = OreDictionary.getOres("blockCobalt"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 5)); - } - - ores = OreDictionary.getOres("blockArdite"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 6)); - } - - ores = OreDictionary.getOres("blockManyullyn"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 800, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 9)); - } - - ores = OreDictionary.getOres("blockAluminumBrass"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8)); - } - - ores = OreDictionary.getOres("blockAlumite"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 10)); - } - - ores = OreDictionary.getOres("blockSteel"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 12)); - } - - ores = OreDictionary.getOres("dustCopper"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 2)); - } - - ores = OreDictionary.getOres("dustTin"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 3)); - } - - ores = OreDictionary.getOres("dustBronze"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 7)); - } - - ores = OreDictionary.getOres("dustCobalt"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 5)); - } - - ores = OreDictionary.getOres("dustArdite"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 6)); - } - - ores = OreDictionary.getOres("dustManyullyn"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 9)); - } - - ores = OreDictionary.getOres("dustNaturalAluminum"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 4)); - } - - ores = OreDictionary.getOres("dustAluminumBrass"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 8)); - } - - ores = OreDictionary.getOres("dustAlumite"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 10)); - } - - ores = OreDictionary.getOres("dustSteel"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, - 12)); - } - - ores = OreDictionary.getOres("nuggetIron"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue / 9, 2)); - } - - ores = OreDictionary.getOres("nuggetCopper"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue / 9, 2)); - } - - ores = OreDictionary.getOres("nuggetTin"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue / 9, 3)); - } - - ores = OreDictionary.getOres("nuggetNaturalAluminum"); - for (ItemStack ore : ores) - { - Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, - TConstruct.ingotLiquidValue / 9, 4)); - } - } - - @ForgeSubscribe - public void bucketFill (FillBucketEvent evt) - { - if (evt.current.getItem() == Item.bucketEmpty && evt.target.typeOfHit == EnumMovingObjectType.TILE) - { - int hitX = evt.target.blockX; - int hitY = evt.target.blockY; - int hitZ = evt.target.blockZ; - - if (evt.entityPlayer != null && !evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current)) - { - return; - } - - int bID = evt.world.getBlockId(hitX, hitY, hitZ); - int meta = -1; - - if (bID == TContent.liquidMetalStill.blockID) - { - LiquidTextureLogic logic = (LiquidTextureLogic) evt.world.getBlockTileEntity(hitX, hitY, hitZ); - meta = logic.getLiquidType(); - } - - if (meta != -1) - { - evt.world.setBlockToAir(hitX, hitY, hitZ); //Set air block - evt.result = new ItemStack(TContent.buckets, 1, meta); - evt.setResult(Result.ALLOW); - } - } - } + Random random = new Random(); + + /* Interact */ + + @ForgeSubscribe + public void interact (PlayerInteractEvent event) + { + if (event.action == Action.RIGHT_CLICK_BLOCK)// && !event.entityPlayer.worldObj.isRemote) + { + List skills = TConstruct.playerTracker.getPlayerStats(event.entityPlayer.username).skillList; + if (skills.size() > 0) + { + Skill walls = TConstruct.playerTracker.getPlayerStats(event.entityPlayer.username).skillList.get(0); + walls.rightClickActivate(event.entityPlayer, event.entityPlayer.worldObj); + } + } + } + + /*@ForgeSubscribe + public void onHurt (LivingHurtEvent event) + { + if (event.source instanceof EntityDamageSource && event.source.damageType.equals("explosion.player") && ((EntityDamageSource) event.source).getEntity() instanceof NitroCreeper) + { + if (event.entityLiving.worldObj.difficultySetting == 3) + event.ammount /= 2.3; + else + event.ammount /= 1.5; + } + }*/ + + /* Drops */ + @ForgeSubscribe + public void onLivingDrop (LivingDropsEvent event) + { + if (random.nextInt(500) == 0 && event.entityLiving instanceof IMob && event.entityLiving.dimension == 0) + { + ItemStack dropStack = new ItemStack(TContent.heartCanister, 1, 1); + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + + if (!event.entityLiving.isChild()) + { + if (event.entityLiving.getClass() == EntityCow.class) + { + int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1; + + for (int iter = 0; iter < amount; ++iter) + { + ItemStack dropStack = new ItemStack(Item.leather, 1); + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + } + + else if (event.entityLiving.getClass() == EntityChicken.class) + { + int amount = random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + random.nextInt(3) + random.nextInt(1 + event.lootingLevel) + 1; + + for (int iter = 0; iter < amount; ++iter) + { + ItemStack dropStack = new ItemStack(Item.feather, 1); + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + } + } + + if (event.recentlyHit && event.entityLiving.getClass() == EntitySkeleton.class) + { + EntitySkeleton skeleton = (EntitySkeleton) event.entityLiving; + if (skeleton.getSkeletonType() == 1 && random.nextInt(Math.max(1, 5 - event.lootingLevel)) == 0) + { + ItemStack dropStack = new ItemStack(TContent.materials, 1, 8); + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + } + + else if (event.entityLiving.getClass() == EntityGhast.class) + { + ItemStack dropStack = new ItemStack(Item.ghastTear, 1); + EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack); + entityitem.delayBeforeCanPickup = 10; + event.drops.add(entityitem); + } + } + + @ForgeSubscribe + public void onLivingSpawn (EntityJoinWorldEvent event) + { + if (event.entity instanceof EntityXPOrb) + { + System.out.println("Entity: " + event.entity); + } + } + + @ForgeSubscribe + public void onLivingSpawn (LivingSpawnEvent.SpecialSpawn event) + { + if (event.entityLiving.getClass() == EntitySpider.class && random.nextInt(100) == 0) + { + EntityCreeper creeper = new EntityCreeper(event.entityLiving.worldObj); + spawnEntity(event.entityLiving.posX, event.entityLiving.posY + 1, event.entityLiving.posZ, creeper, event.entityLiving.worldObj); + creeper.mountEntity(event.entityLiving); + } + } + + public static void spawnEntity (double x, double y, double z, Entity entity, World world) + { + if (!world.isRemote) + { + entity.setPosition(x, y, z); + ((EntityLiving) entity).initCreature(); + world.spawnEntityInWorld(entity); + } + } + + /* Ore Dictionary */ + @ForgeSubscribe + public void registerOre (OreRegisterEvent evt) + { + if (evt.Name == "battery") + TConstruct.content.modE.batteries.add(evt.Ore); + + else if (evt.Name == "basicCircuit") + TConstruct.content.modE.circuits.add(evt.Ore); + + else if (evt.Name == "plankWood") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Wood"); + } + + else if (evt.Name == "crystalQuartz") + { + ToolBuilder.instance.registerToolMod(new ModAttack("Quartz", new ItemStack[] { evt.Ore }, 11, 2)); + } + + else if (evt.Name == "crystalCerusQuartz") + { + ToolBuilder.instance.registerToolMod(new ModAttack("Quartz", new ItemStack[] { evt.Ore }, 11, 24)); + } + + //Ingots + else if (evt.Name == "ingotCopper") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Copper"); + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 2)); + } + + else if (evt.Name == "ingotTin") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 3)); + } + + else if (evt.Name == "ingotBronze") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Bronze"); + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 7)); + } + + else if (evt.Name == "ingotCobalt") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Cobalt"); + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 5)); + } + + else if (evt.Name == "ingotArdite") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Ardite"); + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 6)); + } + + else if (evt.Name == "ingotManyullyn") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Manyullyn"); + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 9)); + } + + else if (evt.Name == "ingotNaturalAluminum") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 4)); + } + + else if (evt.Name == "naturalAluminum") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 4)); + } + + else if (evt.Name == "ingotAluminumBrass") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 8)); + } + + else if (evt.Name == "ingotAlumite") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Alumite"); + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 10)); + } + + else if (evt.Name == "ingotSteel") + { + PatternBuilder.instance.registerMaterial(evt.Ore, 2, "Steel"); + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 12)); + } + + //Ores + else if (evt.Name == "oreCopper") + { + Smeltery.addMelting(evt.Ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 2)); + } + + else if (evt.Name == "oreTin") + { + Smeltery.addMelting(evt.Ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 3)); + } + + else if (evt.Name == "oreNaturalAluminum") + { + Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 4)); + } + + else if (evt.Name == "oreCobalt") + { + Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 5)); + } + + else if (evt.Name == "oreArdite") + { + Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 6)); + } + + //Blocks + else if (evt.Name == "blockCopper") + { + Smeltery.addMelting(evt.Ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 2)); + } + + else if (evt.Name == "blockTin") + { + Smeltery.addMelting(evt.Ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 3)); + } + + else if (evt.Name == "blockBronze") + { + Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 7)); + } + + else if (evt.Name == "blockNaturalAluminum") + { + Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 4)); + } + + else if (evt.Name == "blockCobalt") + { + Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 5)); + } + + else if (evt.Name == "blockArdite") + { + Smeltery.addMelting(evt.Ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 6)); + } + + else if (evt.Name == "blockManyullyn") + { + Smeltery.addMelting(evt.Ore, 800, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 9)); + } + + else if (evt.Name == "blockAluminumBrass") + { + Smeltery.addMelting(evt.Ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8)); + } + + else if (evt.Name == "blockAlumite") + { + Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 10)); + } + + else if (evt.Name == "blockSteel") + { + Smeltery.addMelting(evt.Ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 12)); + } + + //Dust + else if (evt.Name == "dustCopper") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 2)); + } + + else if (evt.Name == "dustTin") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 3)); + } + + else if (evt.Name == "dustBronze") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 7)); + } + + else if (evt.Name == "dustCobalt") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 5)); + } + + else if (evt.Name == "dustArdite") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 6)); + } + + else if (evt.Name == "dustManyullyn") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 9)); + } + + else if (evt.Name == "dustAluminum") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 4)); + } + + else if (evt.Name == "dustNaturalAluminum") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 4)); + } + + else if (evt.Name == "dustAluminumBrass") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 8)); + } + + else if (evt.Name == "dustAlumite") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 10)); + } + + else if (evt.Name == "dustSteel") + { + Smeltery.addMelting(new ItemStack(evt.Ore.itemID, 2, evt.Ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue, 12)); + } + } + + public void unfuxOreDictionary () //TODO: This isn't the best + { + ArrayList ores = OreDictionary.getOres("ingotCopper"); + for (ItemStack ore : ores) + { + PatternBuilder.instance.registerMaterial(ore, 2, "Copper"); + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 2)); + } + + ores = OreDictionary.getOres("ingotTin"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 3)); + } + + ores = OreDictionary.getOres("ingotBronze"); + for (ItemStack ore : ores) + { + PatternBuilder.instance.registerMaterial(ore, 2, "Bronze"); + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 7)); + } + + ores = OreDictionary.getOres("ingotCobalt"); + for (ItemStack ore : ores) + { + PatternBuilder.instance.registerMaterial(ore, 2, "Cobalt"); + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 5)); + } + + ores = OreDictionary.getOres("ingotArdite"); + for (ItemStack ore : ores) + { + PatternBuilder.instance.registerMaterial(ore, 2, "Ardite"); + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 6)); + } + + ores = OreDictionary.getOres("ingotManyullyn"); + for (ItemStack ore : ores) + { + PatternBuilder.instance.registerMaterial(ore, 2, "Manyullyn"); + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 9)); + } + + ores = OreDictionary.getOres("naturalAluminum"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 4)); + } + + ores = OreDictionary.getOres("ingotNaturalAluminum"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 4)); + } + + ores = OreDictionary.getOres("ingotAluminumBrass"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 8)); + } + + ores = OreDictionary.getOres("ingotAlumite"); + for (ItemStack ore : ores) + { + PatternBuilder.instance.registerMaterial(ore, 2, "Alumite"); + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 10)); + } + + ores = OreDictionary.getOres("ingotSteel"); + for (ItemStack ore : ores) + { + PatternBuilder.instance.registerMaterial(ore, 2, "Steel"); + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 12)); + } + + ores = OreDictionary.getOres("oreCopper"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 2)); + } + + ores = OreDictionary.getOres("oreTin"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 3)); + } + + ores = OreDictionary.getOres("oreNaturalAluminum"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 4)); + } + + ores = OreDictionary.getOres("oreCobalt"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 5)); + } + + ores = OreDictionary.getOres("oreArdite"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 2, 6)); + } + + ores = OreDictionary.getOres("blockCopper"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 550, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 2)); + } + + ores = OreDictionary.getOres("blockTin"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 275, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 3)); + } + + ores = OreDictionary.getOres("blockBronze"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 7)); + } + + ores = OreDictionary.getOres("blockNaturalAluminum"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 4)); + } + + ores = OreDictionary.getOres("blockCobalt"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 5)); + } + + ores = OreDictionary.getOres("blockArdite"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 6)); + } + + ores = OreDictionary.getOres("blockManyullyn"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 800, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 9)); + } + + ores = OreDictionary.getOres("blockAluminumBrass"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 8)); + } + + ores = OreDictionary.getOres("blockAlumite"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 10)); + } + + ores = OreDictionary.getOres("blockSteel"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(ore, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue * 9, 12)); + } + + ores = OreDictionary.getOres("dustCopper"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 2)); + } + + ores = OreDictionary.getOres("dustTin"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 3)); + } + + ores = OreDictionary.getOres("dustBronze"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 4, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 7)); + } + + ores = OreDictionary.getOres("dustCobalt"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 0, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 5)); + } + + ores = OreDictionary.getOres("dustArdite"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 1, 650, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 6)); + } + + ores = OreDictionary.getOres("dustManyullyn"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 2, 750, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 9)); + } + + ores = OreDictionary.getOres("dustNaturalAluminum"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 4)); + } + + ores = OreDictionary.getOres("dustAluminumBrass"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 7, 350, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 8)); + } + + ores = OreDictionary.getOres("dustAlumite"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 8, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 10)); + } + + ores = OreDictionary.getOres("dustSteel"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 9, 500, new LiquidStack(TContent.liquidMetalStill.blockID, TConstruct.ingotLiquidValue, + 12)); + } + + ores = OreDictionary.getOres("nuggetIron"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue / 9, 2)); + } + + ores = OreDictionary.getOres("nuggetCopper"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 3, 450, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue / 9, 2)); + } + + ores = OreDictionary.getOres("nuggetTin"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 5, 175, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue / 9, 3)); + } + + ores = OreDictionary.getOres("nuggetNaturalAluminum"); + for (ItemStack ore : ores) + { + Smeltery.addMelting(new ItemStack(ore.itemID, 2, ore.getItemDamage()), TContent.metalBlock.blockID, 6, 250, new LiquidStack(TContent.liquidMetalStill.blockID, + TConstruct.ingotLiquidValue / 9, 4)); + } + } + + @ForgeSubscribe + public void bucketFill (FillBucketEvent evt) + { + if (evt.current.getItem() == Item.bucketEmpty && evt.target.typeOfHit == EnumMovingObjectType.TILE) + { + int hitX = evt.target.blockX; + int hitY = evt.target.blockY; + int hitZ = evt.target.blockZ; + + if (evt.entityPlayer != null && !evt.entityPlayer.canPlayerEdit(hitX, hitY, hitZ, evt.target.sideHit, evt.current)) + { + return; + } + + int bID = evt.world.getBlockId(hitX, hitY, hitZ); + int meta = -1; + + if (bID == TContent.liquidMetalStill.blockID) + { + LiquidTextureLogic logic = (LiquidTextureLogic) evt.world.getBlockTileEntity(hitX, hitY, hitZ); + meta = logic.getLiquidType(); + } + + if (meta != -1) + { + evt.world.setBlockToAir(hitX, hitY, hitZ); //Set air block + evt.result = new ItemStack(TContent.buckets, 1, meta); + evt.setResult(Result.ALLOW); + } + } + } } diff --git a/mods/tinker/tconstruct/util/network/TPacketHandler.java b/mods/tinker/tconstruct/util/network/TPacketHandler.java index b34a7c28..cef35108 100644 --- a/mods/tinker/tconstruct/util/network/TPacketHandler.java +++ b/mods/tinker/tconstruct/util/network/TPacketHandler.java @@ -6,9 +6,10 @@ import java.io.IOException; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.blocks.logic.ToolStationLogic; -import mods.tinker.tconstruct.inventory.SmelteryContainer; import mods.tinker.tconstruct.library.blocks.InventoryLogic; +import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; import net.minecraft.network.INetworkManager; import net.minecraft.network.packet.Packet250CustomPayload; @@ -31,7 +32,7 @@ public class TPacketHandler implements IPacketHandler if (packet.channel.equals("TConstruct")) { if (side == Side.SERVER) - handleServerPacket(packet); + handleServerPacket(packet, (EntityPlayerMP) player); else handleClientPacket(packet); } @@ -60,7 +61,7 @@ public class TPacketHandler implements IPacketHandler } } - void handleServerPacket (Packet250CustomPayload packet) + void handleServerPacket (Packet250CustomPayload packet, EntityPlayerMP player) { DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data)); @@ -104,23 +105,23 @@ public class TPacketHandler implements IPacketHandler else if (packetID == 3) //Armor { - String user = inputStream.readUTF(); - EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user); + //String user = inputStream.readUTF(); + //EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user); player.openGui(TConstruct.instance, TConstruct.proxy.armorGuiID, player.worldObj, (int)player.posX, (int)player.posY, (int)player.posZ); } + else if (packetID == 4) //Active Skills + { + Byte id = inputStream.readByte(); + TConstruct.playerTracker.activateSkill(player, id); + } + else if (packetID == 10) //Double jump { - String user = inputStream.readUTF(); - EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user); + //String user = inputStream.readUTF(); + //EntityPlayer player = TConstruct.playerTracker.getEntityPlayer(user); player.fallDistance = 0; } - /*else if (packetID == 11) - { - String user = inputStream.readUTF(); - float size = inputStream.readFloat(); - TConstruct.playerTracker.updateSize(user, size); - }*/ } catch (IOException e) { @@ -129,4 +130,14 @@ public class TPacketHandler implements IPacketHandler return; } } + + Entity getEntity (World world, int id) + { + for (Object o : world.loadedEntityList) + { + if (((Entity)o).entityId == id) + return (Entity) o; + } + return null; + } } diff --git a/mods/tinker/tconstruct/util/player/ArmorExtended.java b/mods/tinker/tconstruct/util/player/ArmorExtended.java index d0a8b90c..844476d6 100644 --- a/mods/tinker/tconstruct/util/player/ArmorExtended.java +++ b/mods/tinker/tconstruct/util/player/ArmorExtended.java @@ -4,6 +4,7 @@ import java.lang.ref.WeakReference; import mods.tinker.tconstruct.TConstruct; import mods.tinker.tconstruct.common.TContent; +import mods.tinker.tconstruct.library.SkillRegistry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -55,7 +56,9 @@ public class ArmorExtended implements IInventory { inventory[slot] = null; } - recalculateHealth(); + EntityPlayer player = parent.get(); + TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); + recalculateHealth(player, stats); return split; } else @@ -79,7 +82,10 @@ public class ArmorExtended implements IInventory { itemstack.stackSize = getInventoryStackLimit(); } - recalculateHealth(); + + EntityPlayer player = parent.get(); + TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); + recalculateHealth(player, stats); } @Override @@ -103,10 +109,38 @@ public class ArmorExtended implements IInventory @Override public void onInventoryChanged () { - recalculateHealth(); + EntityPlayer player = parent.get(); + TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); + recalculateSkills(player, stats); + recalculateHealth(player, stats); } - public void recalculateHealth() + public void recalculateSkills(EntityPlayer player, TPlayerStats stats) + { + if (inventory[1] != null && inventory[1].getItem() == TContent.glove) + { + if (stats.skillList.size() < 1) + { + try + { + stats.skillList.add(SkillRegistry.skills.get("Wall Building").copy()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + else + { + if (stats.skillList.size() > 0) + { + stats.skillList.remove(0); + } + } + } + + public void recalculateHealth(EntityPlayer player, TPlayerStats stats) { if (inventory[6] != null && inventory[6].getItem() == TContent.heartCanister) { @@ -114,8 +148,6 @@ public class ArmorExtended implements IInventory int meta = stack.getItemDamage(); if (meta == 2) { - EntityPlayer player = parent.get(); - TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); int bonusHP = stack.stackSize * 2; stats.bonusHealth = bonusHP; player.maxHealth = 20 + bonusHP; @@ -147,7 +179,7 @@ public class ArmorExtended implements IInventory return false; } - //Save/Load + /* Save/Load */ public void saveToNBT (EntityPlayer entityplayer) { NBTTagCompound tags = entityplayer.getEntityData(); @@ -168,7 +200,7 @@ public class ArmorExtended implements IInventory tags.setTag("TConstruct.Inventory", tagList); } - public void loadFromNBT (EntityPlayer entityplayer) + public void readFromNBT (EntityPlayer entityplayer) { NBTTagCompound tags = entityplayer.getEntityData(); NBTTagList tagList = tags.getTagList("TConstruct.Inventory"); diff --git a/mods/tinker/tconstruct/util/player/ArmorExtendedClient.java b/mods/tinker/tconstruct/util/player/ArmorExtendedClient.java new file mode 100644 index 00000000..0486db56 --- /dev/null +++ b/mods/tinker/tconstruct/util/player/ArmorExtendedClient.java @@ -0,0 +1,35 @@ +package mods.tinker.tconstruct.util.player; + +import mods.tinker.tconstruct.client.TProxyClient; +import mods.tinker.tconstruct.common.TContent; +import mods.tinker.tconstruct.library.SkillRegistry; +import net.minecraft.entity.player.EntityPlayer; + +public class ArmorExtendedClient extends ArmorExtended +{ + /*public void recalculateSkills(EntityPlayer player, TPlayerStats stats) + { + System.out.println("Client skills"); + if (inventory[1] != null && inventory[1].getItem() == TContent.glove) + { + if (TProxyClient.skillList.size() < 1) + { + try + { + TProxyClient.skillList.add(SkillRegistry.skills.get("Wall Building").copy()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + } + else + { + if (TProxyClient.skillList.size() > 0) + { + TProxyClient.skillList.remove(0); + } + } + }*/ +} diff --git a/mods/tinker/tconstruct/util/player/TPlayerHandler.java b/mods/tinker/tconstruct/util/player/TPlayerHandler.java index 55c257fb..74b32431 100644 --- a/mods/tinker/tconstruct/util/player/TPlayerHandler.java +++ b/mods/tinker/tconstruct/util/player/TPlayerHandler.java @@ -1,11 +1,15 @@ package mods.tinker.tconstruct.util.player; import java.lang.ref.WeakReference; +import java.util.ArrayList; import java.util.Random; import java.util.concurrent.ConcurrentHashMap; import mods.tinker.tconstruct.common.TContent; +import mods.tinker.tconstruct.library.SkillRegistry; import mods.tinker.tconstruct.library.tools.AbilityHelper; +import mods.tinker.tconstruct.skill.Skill; +import mods.tinker.tconstruct.skill.WallBuilding; import mods.tinker.tconstruct.util.PHConstruct; import net.minecraft.entity.Entity; import net.minecraft.entity.EnumEntitySize; @@ -28,6 +32,7 @@ public class TPlayerHandler implements IPlayerTracker @Override public void onPlayerLogin (EntityPlayer entityplayer) { + System.out.println("Player: "+entityplayer); //Lookup player TFoodStats food = new TFoodStats(); food.readStats(entityplayer.foodStats); @@ -41,7 +46,7 @@ public class TPlayerHandler implements IPlayerTracker stats.player = new WeakReference(entityplayer); stats.armor = new ArmorExtended(); stats.armor.init(entityplayer); - stats.armor.loadFromNBT(entityplayer); + stats.armor.readFromNBT(entityplayer); stats.level = entityplayer.experienceLevel; stats.hunger = entityplayer.getFoodStats().getFoodLevel(); @@ -59,9 +64,38 @@ public class TPlayerHandler implements IPlayerTracker } } + stats.skillList = new ArrayList(); + stats.armor.recalculateSkills(entityplayer, stats); + /*try + { + stats.skillList.add(SkillRegistry.skills.get("Wall Building").copy()); + } + catch (Exception e) + { + e.printStackTrace(); + }/* + //stats.skillList.add(new ActiveSkill(new Jump())); + /*for (Map.Entry entry : SkillRegistry.skills.entrySet()) + { + SkillBase skill = entry.getValue(); + }*/ + playerStats.put(entityplayer.username, stats); } + public void activateSkill (EntityPlayer player, int slot) + { + TPlayerStats stats = getPlayerStats(player.username); + if (stats.skillList.size() > slot) + { + Skill skill = stats.skillList.get(slot); + if (skill != null) + { + skill.activate(player, player.worldObj); + } + } + } + @Override public void onPlayerLogout (EntityPlayer entityplayer) { @@ -85,9 +119,10 @@ public class TPlayerHandler implements IPlayerTracker if (clean) playerStats.remove(player.username); } - else //Revalidate all players + else + //Revalidate all players { - + } } } @@ -98,7 +133,7 @@ public class TPlayerHandler implements IPlayerTracker //Boom! TPlayerStats stats = getPlayerStats(entityplayer.username); stats.player = new WeakReference(entityplayer); - stats.armor.recalculateHealth(); + stats.armor.recalculateHealth(entityplayer, stats); TFoodStats food = new TFoodStats(); entityplayer.foodStats = food; diff --git a/mods/tinker/tconstruct/util/player/TPlayerStats.java b/mods/tinker/tconstruct/util/player/TPlayerStats.java index acf26682..52d6f99f 100644 --- a/mods/tinker/tconstruct/util/player/TPlayerStats.java +++ b/mods/tinker/tconstruct/util/player/TPlayerStats.java @@ -1,11 +1,10 @@ package mods.tinker.tconstruct.util.player; import java.lang.ref.WeakReference; +import java.util.List; +import mods.tinker.tconstruct.skill.Skill; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.FMLCommonHandler; public class TPlayerStats { @@ -18,4 +17,5 @@ public class TPlayerStats public boolean materialManual; public boolean smelteryManual; public ArmorExtended armor; + public List skillList; } diff --git a/mods/tinker/textures/items/armor/dirthand.png b/mods/tinker/textures/items/armor/dirthand.png new file mode 100644 index 00000000..ed069069 Binary files /dev/null and b/mods/tinker/textures/items/armor/dirthand.png differ diff --git a/mods/tinker/textures/skill/Float48x.png b/mods/tinker/textures/skill/Float48x.png new file mode 100644 index 00000000..5061c90d Binary files /dev/null and b/mods/tinker/textures/skill/Float48x.png differ diff --git a/mods/tinker/textures/skill/Jump48x.png b/mods/tinker/textures/skill/Jump48x.png new file mode 100644 index 00000000..ee525031 Binary files /dev/null and b/mods/tinker/textures/skill/Jump48x.png differ diff --git a/mods/tinker/textures/skill/Wall16x.png b/mods/tinker/textures/skill/Wall16x.png new file mode 100644 index 00000000..48ddf36e Binary files /dev/null and b/mods/tinker/textures/skill/Wall16x.png differ diff --git a/mods/tinker/textures/skill/Wall32x.png b/mods/tinker/textures/skill/Wall32x.png new file mode 100644 index 00000000..c2edeaab Binary files /dev/null and b/mods/tinker/textures/skill/Wall32x.png differ diff --git a/mods/tinker/textures/skill/Wall48x.png b/mods/tinker/textures/skill/Wall48x.png new file mode 100644 index 00000000..81a6f2ee Binary files /dev/null and b/mods/tinker/textures/skill/Wall48x.png differ