Doing progress

This commit is contained in:
fewizz committed 2015-07-11 13:32:13 +03:00
1 parent 727ab4820e
commit c057c4c88a
35 files changed
+842 -217

No files matched your search

@@ -64,7 +64,7 @@ public class EMTResearch {
research.setPages(new ResearchPage(text));
text = "1";
research = new EMTResearchItem("The One Ring", "EMT", new AspectList(), 6, -7, 0, new ItemStack(ItemRegistry.baseBaubles)).setRound().setAutoUnlock().registerResearchItem();
research = new EMTResearchItem("The One Ring", "EMT", new AspectList(), 6, -7, 0, new ItemStack(ItemRegistry.onering)).setRound().setAutoUnlock().registerResearchItem();
research.setPages(new ResearchPage(text));
text = "1";
@@ -52,6 +52,7 @@ public class ElectroMagicTools {
ElectroMagicTools.logger.info(localize("console.EMT.preInit.begin"));
ConfigHandler.init(event.getSuggestedConfigurationFile());
MinecraftForge.EVENT_BUS.register(new RenderPlayerHandler());
FMLCommonHandler.instance().bus().register(new EventHandlerEMT());
Registry.register();
EssentiasOutputs.addPrimalOutputs();
@@ -67,7 +68,6 @@ public class ElectroMagicTools {
ElectroMagicTools.logger.info(localize("console.EMT.init.loadProxies"));
proxy.load();
ElectroMagicTools.logger.info(localize("console.EMT.init.mobDrops"));
MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
ElectroMagicTools.logger.info(localize("console.EMT.init.dungeon"));
DungeonChestGenerator.generateLoot();
@@ -0,0 +1,234 @@
package tombenpotter.emt.client.model;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class ModelCpecialArmor extends ModelBiped
{
public ModelRenderer bipedHead;
public ModelRenderer bipedBody;
public ModelRenderer bipedRightArm;
public ModelRenderer bipedLeftArm;
public ModelRenderer rightWing;
public ModelRenderer leftWing;
public ModelRenderer center;
public ModelRenderer jetpack;
public boolean isJumping;
public int type = 0;//0 - nothing, 1 - jetpack, 2 - wings
public int heldItemLeft;
public int heldItemRight;
public boolean isSneak;
public boolean aimedBow;
private static final String __OBFID = "CL_00000840";
public ModelCpecialArmor()
{
this(0.0F, 0);
}
public ModelCpecialArmor(float p_i1148_1_, int type)
{
this(p_i1148_1_, 0.0F, 64, 32, type);
}
public ModelCpecialArmor(float p_i1149_1_, float p_i1149_2_, int p_i1149_3_, int p_i1149_4_, int type)
{
this.type = type;
switch(this.type){
case 1 :
this.textureWidth = 128;
this.textureHeight = 96;
this.jetpack = new ModelRenderer(this, 16, 69);
this.jetpack.setTextureSize(64, 48);
this.jetpack.addBox(-4.0F, -12.0F, -2.0F, 8, 12 * 2, 4, p_i1149_1_ * 2);
this.jetpack.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
break;
case 2 :
this.textureWidth = 64;
this.textureHeight = 64;
rightWing = new ModelRenderer(this, 24, 0 + 32);
rightWing.addBox(-11F, -1F, 0F, 11, 13, 1);
rightWing.setRotationPoint(-2F, 0F, 3F);
rightWing.setTextureSize(64, 32);
rightWing.mirror = false;
setRotation(rightWing, 0F, 0.1570796F, 0F);
leftWing = new ModelRenderer(this, 0, 0 + 32);
leftWing.addBox(0F, -1F, 0F, 11, 13, 1);
leftWing.setRotationPoint(2F, 0F, 3F);
leftWing.setTextureSize(64, 32);
leftWing.mirror = true;
setRotation(leftWing, 0F, -0.1570796F, 0F);
center = new ModelRenderer(this, 0, 14 + 32);
center.addBox(0F, 0F, 1F, 8, 14, 1);
center.setRotationPoint(-4F, 0F, 3F);
center.setTextureSize(64, 32);
center.mirror = true;
setRotation(center, 0F, 0F, 0F);
break;
}
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, p_i1149_1_);
this.bipedHead.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
this.bipedBody = new ModelRenderer(this, 16, 16);
this.bipedBody.addBox(-4.0F, 0.0F, -2.0F, 8, 12, 4, p_i1149_1_);
this.bipedBody.setRotationPoint(0.0F, 0.0F + p_i1149_2_, 0.0F);
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightArm.addBox(-3.0F, -2.0F, -2.0F, 4, 12, 4, p_i1149_1_);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F + p_i1149_2_, 0.0F);
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -2.0F, 4, 12, 4, p_i1149_1_);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F + p_i1149_2_, 0.0F);
}
private void setRotation (ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_)
{
this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_);
this.bipedBody.render(p_78088_7_);
this.bipedRightArm.render(p_78088_7_);
this.bipedLeftArm.render(p_78088_7_);
switch(this.type){
case 1 :
this.jetpack.render(p_78088_7_);
break;
case 2 :
this.center.render(p_78088_7_);
this.leftWing.render(p_78088_7_);
this.rightWing.render(p_78088_7_);
}
}
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity)
{
this.bipedHead.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI);
this.bipedHead.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI);
this.bipedRightArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 2.0F * p_78087_2_ * 0.5F;
this.bipedLeftArm.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 2.0F * p_78087_2_ * 0.5F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
if (entity.isRiding())
{
this.bipedRightArm.rotateAngleX += -((float)Math.PI / 5F);
this.bipedLeftArm.rotateAngleX += -((float)Math.PI / 5F);
}
if(isJumping){
this.rightWing.rotateAngleY = 0.5f;
this.leftWing.rotateAngleY = -0.5f;
}
if (this.heldItemLeft != 0)
{
this.bipedLeftArm.rotateAngleX = this.bipedLeftArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemLeft;
}
if (this.heldItemRight != 0)
{
this.bipedRightArm.rotateAngleX = this.bipedRightArm.rotateAngleX * 0.5F - ((float)Math.PI / 10F) * (float)this.heldItemRight;
}
this.bipedRightArm.rotateAngleY = 0.0F;
this.bipedLeftArm.rotateAngleY = 0.0F;
float f6;
float f7;
if (this.onGround > -9990.0F)
{
f6 = this.onGround;
this.bipedBody.rotateAngleY = MathHelper.sin(MathHelper.sqrt_float(f6) * (float)Math.PI * 2.0F) * 0.2F;
this.bipedRightArm.rotationPointZ = MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightArm.rotationPointX = -MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointZ = -MathHelper.sin(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedLeftArm.rotationPointX = MathHelper.cos(this.bipedBody.rotateAngleY) * 5.0F;
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleY += this.bipedBody.rotateAngleY;
this.bipedLeftArm.rotateAngleX += this.bipedBody.rotateAngleY;
f6 = 1.0F - this.onGround;
f6 *= f6;
f6 *= f6;
f6 = 1.0F - f6;
f7 = MathHelper.sin(f6 * (float)Math.PI);
float f8 = MathHelper.sin(this.onGround * (float)Math.PI) * -(this.bipedHead.rotateAngleX - 0.7F) * 0.75F;
this.bipedRightArm.rotateAngleX = (float)((double)this.bipedRightArm.rotateAngleX - ((double)f7 * 1.2D + (double)f8));
this.bipedRightArm.rotateAngleY += this.bipedBody.rotateAngleY * 2.0F;
this.bipedRightArm.rotateAngleZ = MathHelper.sin(this.onGround * (float)Math.PI) * -0.4F;
}
if (entity.isSneaking())
{
this.bipedBody.rotateAngleX = 0.5F;
switch(this.type){
case 1 :
this.jetpack.rotateAngleX = 0.5F;
break;
case 2 :
this.center.offsetY -= 0.1;
this.rightWing.offsetY -= 0.1;
this.leftWing.offsetY -= 0.1;
this.center.rotateAngleX = 0.5F;
this.rightWing.rotateAngleX = 0.5F;
this.leftWing.rotateAngleX = 0.5F;
break;
}
this.bipedRightArm.rotateAngleX += 0.4F;
this.bipedLeftArm.rotateAngleX += 0.4F;
this.bipedHead.rotationPointY = 1.0F;
}
else
{
this.bipedBody.rotateAngleX = 0.0F;
this.bipedHead.rotationPointY = 0.0F;
}
this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
if (this.aimedBow)
{
f6 = 0.0F;
f7 = 0.0F;
this.bipedRightArm.rotateAngleZ = 0.0F;
this.bipedLeftArm.rotateAngleZ = 0.0F;
this.bipedRightArm.rotateAngleY = -(0.1F - f6 * 0.6F) + this.bipedHead.rotateAngleY;
this.bipedLeftArm.rotateAngleY = 0.1F - f6 * 0.6F + this.bipedHead.rotateAngleY + 0.4F;
this.bipedRightArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedLeftArm.rotateAngleX = -((float)Math.PI / 2F) + this.bipedHead.rotateAngleX;
this.bipedRightArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
this.bipedLeftArm.rotateAngleX -= f6 * 1.2F - f7 * 0.4F;
this.bipedRightArm.rotateAngleZ += MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedLeftArm.rotateAngleZ -= MathHelper.cos(p_78087_3_ * 0.09F) * 0.05F + 0.05F;
this.bipedRightArm.rotateAngleX += MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
this.bipedLeftArm.rotateAngleX -= MathHelper.sin(p_78087_3_ * 0.067F) * 0.05F;
}
}
}
@@ -11,6 +11,8 @@ public class ModelWings extends ModelBiped {
ModelRenderer rightWing;
ModelRenderer leftWing;
ModelRenderer center;
public boolean isJumping = false;
public ModelWings() {
textureWidth = 64;
@@ -59,7 +61,7 @@ public class ModelWings extends ModelBiped {
public void setRotationAngles(float f, float f1, float pt, float f3, float f4, float f5, Entity entity){
if(Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed()){
if(isJumping){
this.rightWing.rotateAngleY = 0.5f;
this.leftWing.rotateAngleY = -0.5f;
}
@@ -22,13 +22,13 @@ import tombenpotter.emt.common.util.TextHelper;
import java.util.List;
import java.util.Random;
public class ItemBaseBaubles extends ItemBase implements IBauble {
public class ItemOneRing extends ItemBase implements IBauble {
public IIcon[] icon = new IIcon[16];
public static int wornTick;
public Random random = new Random();
public ItemBaseBaubles() {
public ItemOneRing() {
super("bauble");
this.setHasSubtypes(true);
this.setMaxDamage(0);
@@ -1,5 +1,6 @@
package tombenpotter.emt.common.items;
import ic2.core.init.InternalName;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@@ -10,6 +11,7 @@ import net.minecraftforge.common.util.EnumHelper;
import net.minecraftforge.oredict.OreDictionary;
import thaumcraft.api.ThaumcraftApi;
import tombenpotter.emt.ModInformation;
import tombenpotter.emt.common.items.armor.ItemEMTQuantum;
import tombenpotter.emt.common.items.armor.wings.ItemFeatherWing;
import tombenpotter.emt.common.items.armor.wings.ItemThaumiumReinforcedWing;
import tombenpotter.emt.common.items.armor.boots.ItemElectricBootsTraveller;
@@ -37,15 +39,11 @@ import tombenpotter.emt.common.items.tools.omnitools.ItemOmnitoolIron;
import tombenpotter.emt.common.items.tools.omnitools.ItemOmnitoolThaumium;
public class ItemRegistry {
//public static Item woodenDrill, stoneDrill, ironDrill, goldenDrill, diamondDrill, copperDrill, tinDrill, leadDrill, bronzeDrill;
//public static Item woodenChainsaw, stoneChainsaw, ironChainsaw, goldenChainsaw, diamondChainsaw, copperChainsaw, tinChainsaw, leadChainsaw, bronzeChainsaw;
//public static Item ironOmnitool, goldenOmnitool, diamondOmnitool, copperOmnitool, tinOmnitool, leadOmnitool, bronzeOmnitool;
//public static Item woodCarver, stoneCarver, ironCarver, obsidianCarver, diamondCarver;
public static Item baseBaubles, materials, craftingComponents;
public static Item focusChristmas;
public static Item onering;
public static Item materials;
public static Item craftingComponents;
public static Item focusChristmas;
public static Item thaumiumDrill;
public static Item thaumiumChainsaw;
public static Item quantumThaumicHelmet;
@@ -77,45 +75,39 @@ public class ItemRegistry {
public static Item thaumiumWing;
public static Item nanoWing;
public static Item quantumWing;
public static Item quantumArmor;
public static ItemArmor.ArmorMaterial featherWingMaterial = EnumHelper.addArmorMaterial("FEATEHRWiNG", 1, new int[]{2, 2, 2, 2}, 6);
//public static Item.ToolMaterial copperMaterial = EnumHelper.addToolMaterial("copperToolMaterial", 2, 300, 6.0F, 2.0F, 14);
//public static Item.ToolMaterial tinMaterial = EnumHelper.addToolMaterial("tinToolMatierial", 2, 200, 8.0F, 4F, 18);
//public static Item.ToolMaterial leadMaterial = EnumHelper.addToolMaterial("leadToolMaterial", 2, 250, 7.0F, 3F, 15);
//public static Item.ToolMaterial bronzeMaterial = EnumHelper.addToolMaterial("bronzeToolMaterial", 2, 350, 7.0F, 3.0F, 16);
public static void registerItems() {
//craftingComponents = new ItemCraftingComponents("components");
//GameRegistry.registerItem(craftingComponents, "craftingComponents");
//focusChristmas = new ItemChristmasFocus();
//GameRegistry.registerItem(focusChristmas, "FocusChristmas");
quantumArmor = new ItemEMTQuantum(InternalName.itemArmorQuantumChestplate, 1).setUnlocalizedName(ModInformation.modid + "quantum");
itemEMTItems = new ItemMaterials().setUnlocalizedName(ModInformation.modid + ".emtitems");
GameRegistry.registerItem(itemEMTItems, "EMTItems");
emtBauble = new ItemIC2Baubles().setUnlocalizedName(ModInformation.modid + ".emtbauble");
GameRegistry.registerItem(emtBauble, "EMTBaubles");
baseBaubles = new ItemBaseBaubles();
GameRegistry.registerItem(baseBaubles, "BaseBaubles");
onering = new ItemOneRing();
GameRegistry.registerItem(onering, "BaseBaubles");
electricGoggles = new ItemElectricGoggles(ItemArmor.ArmorMaterial.IRON, 3, 0).setUnlocalizedName(ModInformation.modid + ".goggles.electric");
GameRegistry.registerItem(electricGoggles, "ElectricGogglesRevealing");
nanoThaumicHelmet = new ItemNanoGoggles(ItemArmor.ArmorMaterial.DIAMOND, 3, 0).setUnlocalizedName(ModInformation.modid + ".goggles.nano");
GameRegistry.registerItem(nanoThaumicHelmet, "NanosuitGogglesRevealing");
quantumThaumicHelmet = new ItemQuantumGoggles(ItemArmor.ArmorMaterial.DIAMOND, 3, 0).setUnlocalizedName(ModInformation.modid + ".goggles.quantum");
GameRegistry.registerItem(quantumThaumicHelmet, "QuantumGogglesRevealing");
solarHelmetRevealing = new ItemSolarHelmetRevealing(ItemArmor.ArmorMaterial.DIAMOND, 3, 0).setUnlocalizedName(ModInformation.modid + ".goggles.solar");
GameRegistry.registerItem(solarHelmetRevealing, "SolarHelmetRevealing");
electricBootsTraveller = new ItemElectricBootsTraveller(3, 3).setUnlocalizedName(ModInformation.modid + ".boots.traveller.electric");
GameRegistry.registerItem(electricBootsTraveller, "ElectricBootsTraveller");
nanoBootsTraveller = new ItemNanoBootsTraveller(3, 3).setUnlocalizedName(ModInformation.modid + ".boots.traveller.nano");
GameRegistry.registerItem(nanoBootsTraveller, "NanoBootsTraveller");
quantumBootsTraveller = new ItemQuantumBootsTraveller(3, 3).setUnlocalizedName(ModInformation.modid + ".boots.traveller.quantum");
GameRegistry.registerItem(quantumBootsTraveller, "QuantumBootsTraveller");
@@ -124,17 +116,22 @@ public class ItemRegistry {
featherWing = new ItemFeatherWing(featherWingMaterial, 7, 1).setUnlocalizedName(ModInformation.modid + ".wing.feather");
GameRegistry.registerItem(featherWing, "FeatherWing");
thaumiumWing = new ItemThaumiumReinforcedWing(ThaumcraftApi.armorMatThaumium, 7, 1).setUnlocalizedName(ModInformation.modid + ".wing.thaumium");
GameRegistry.registerItem(thaumiumWing, "ThaumiumWing");
nanoWing = new ItemNanoWing(ItemArmor.ArmorMaterial.DIAMOND, 7, 1).setUnlocalizedName(ModInformation.modid + ".wing.nano");
GameRegistry.registerItem(nanoWing, "NanosuitWing");
quantumWing = new ItemQuantumWing(ItemArmor.ArmorMaterial.DIAMOND, 7, 1).setUnlocalizedName(ModInformation.modid + ".wing.quantum");
GameRegistry.registerItem(quantumWing, "QuantumWing");
thorHammer = new ItemThorHammer().setUnlocalizedName(ModInformation.modid + ".hammer");
GameRegistry.registerItem(thorHammer, "Mjolnir");
taintedThorHammer = new ItemThorHammerBroken().setUnlocalizedName(ModInformation.modid + ".hammer.broken");
GameRegistry.registerItem(taintedThorHammer, "TaintedMjolnir");
electricThorHammer = new ItemElectricThorHammer().setUnlocalizedName(ModInformation.modid + ".hammer.electric");
GameRegistry.registerItem(electricThorHammer, "SuperchargedMjolnir");
@@ -143,96 +140,41 @@ public class ItemRegistry {
diamondChainsaw = new ItemDiamondChainsaw().setUnlocalizedName(ModInformation.modid + ".chainsaw.diamond");
GameRegistry.registerItem(diamondChainsaw, "DiamondChainsaw");
thaumiumChainsaw = new ItemThaumiumChainsaw().setUnlocalizedName(ModInformation.modid + ".chainsaw.thaumium");
GameRegistry.registerItem(thaumiumChainsaw, "ThaumiumChainsaw");
ironOmnitool = new ItemOmnitoolIron().setUnlocalizedName(ModInformation.modid + ".omnitool.iron");
GameRegistry.registerItem(ironOmnitool, "Omnitool");
diamondOmnitool = new ItemOmnitoolDiamond().setUnlocalizedName(ModInformation.modid + ".omnitool.diamond");
GameRegistry.registerItem(diamondOmnitool, "Diamond Omnitool");
thaumiumOmnitool = new ItemOmnitoolThaumium().setUnlocalizedName(ModInformation.modid + ".omnitool.thaumium");
GameRegistry.registerItem(thaumiumOmnitool, "ThaumiumOmnitool");
streamChainsaw = new ItemStreamChainsaw().setUnlocalizedName(ModInformation.modid + ".chainsaw.stream");
GameRegistry.registerItem(streamChainsaw, "ChainsawStream");
rockbreakerDrill = new ItemRockbreakerDrill().setUnlocalizedName(ModInformation.modid + ".drill.rockbreaker");
GameRegistry.registerItem(rockbreakerDrill, "DrillRockbreaker");
electricHoeGrowth = new ItemElectricHoeGrowth().setUnlocalizedName(ModInformation.modid + ".hoeofgrowth.electric");
GameRegistry.registerItem(electricHoeGrowth, "ElectricHoeGrowth");
explosionFocus = new ItemExplosionFocus();
GameRegistry.registerItem(explosionFocus, "ExplosionFocus");
christmasFocus = new ItemChristmasFocus();
GameRegistry.registerItem(christmasFocus, "ChristmasFocus");
shieldFocus = new ItemShieldFocus();
GameRegistry.registerItem(shieldFocus, "ShieldFocus");
chargeFocus = new ItemChargeFocus();
GameRegistry.registerItem(chargeFocus, "ChargingFocus");
wandChargeFocus = new ItemWandChargingFocus();
GameRegistry.registerItem(wandChargeFocus, "WandChargingFocus");
//woodCarver = new ItemShardCarver(8).setUnlocalizedName(ModInformation.modid + ".carver.wood");
//GameRegistry.registerItem(woodCarver, "woodCarver");
//stoneCarver = new ItemShardCarver(32).setUnlocalizedName(ModInformation.modid + ".carver.stone");
//GameRegistry.registerItem(stoneCarver, "stoneCarver");
//ironCarver = new ItemShardCarver(128).setUnlocalizedName(ModInformation.modid + ".carver.iron");
//GameRegistry.registerItem(ironCarver, "ironCarver");
//obsidianCarver = new ItemShardCarver(256).setUnlocalizedName(ModInformation.modid + ".carver.obsidian");
//GameRegistry.registerItem(obsidianCarver, "obsidianCarver");
//diamondCarver = new ItemShardCarver(1204).setUnlocalizedName(ModInformation.modid + ".carver.diamond");
//GameRegistry.registerItem(diamondCarver, "diamondCarver");
//woodenDrill = new ItemVanillaDrill(Item.ToolMaterial.WOOD, 75, "drill_wood", new ItemStack(Item.getItemFromBlock(Blocks.planks))).setUnlocalizedName(ModInformation.modid + ".drill.wood");
//GameRegistry.registerItem(woodenDrill, "woodenDrill");
//stoneDrill = new ItemVanillaDrill(Item.ToolMaterial.STONE, 165, "drill_stone", new ItemStack(Item.getItemFromBlock(Blocks.cobblestone))).setUnlocalizedName(ModInformation.modid + ".drill.stone");
//GameRegistry.registerItem(stoneDrill, "stoneDrill");
//ironDrill = new ItemVanillaDrill(Item.ToolMaterial.IRON, 400, "drill_iron", new ItemStack(Items.iron_ingot)).setUnlocalizedName(ModInformation.modid + ".drill.iron");
//GameRegistry.registerItem(ironDrill, "ironDrill");
//goldenDrill = new ItemVanillaDrill(Item.ToolMaterial.GOLD, 55, "drill_gold", new ItemStack(Items.gold_ingot)).setUnlocalizedName(ModInformation.modid + ".drill.gold");
//GameRegistry.registerItem(goldenDrill, "goldenDrill");
//diamondDrill = new ItemVanillaDrill(Item.ToolMaterial.EMERALD, 2015, "drill_diamond", new ItemStack(Items.diamond)).setUnlocalizedName(ModInformation.modid + ".drill.diamond");
//GameRegistry.registerItem(diamondDrill, "diamondDrill");
//copperDrill = new ItemVanillaDrill(copperMaterial, 450, "drill_copper", OreDictionary.getOres("ingotCopper").get(0)).setUnlocalizedName(ModInformation.modid + ".drill.copper");
//GameRegistry.registerItem(copperDrill, "copperDrill");
//tinDrill = new ItemVanillaDrill(tinMaterial, 350, "drill_tin", OreDictionary.getOres("ingotTin").get(0)).setUnlocalizedName(ModInformation.modid + ".drill.tin");
//GameRegistry.registerItem(tinDrill, "tinDrill");
//leadDrill = new ItemVanillaDrill(leadMaterial, 400, "drill_lead", OreDictionary.getOres("ingotLead").get(0)).setUnlocalizedName(ModInformation.modid + ".drill.lead");
//GameRegistry.registerItem(leadDrill, "leadDrill");
//bronzeDrill = new ItemVanillaDrill(bronzeMaterial, 650, "drill_bronze", OreDictionary.getOres("ingotBronze").get(0)).setUnlocalizedName(ModInformation.modid + ".drill.bronze");
//GameRegistry.registerItem(bronzeDrill, "bronzeDrill");
//woodenChainsaw = new ItemVanillaChainsaw(Item.ToolMaterial.WOOD, 75, "chainsaw_wooden", Item.getItemFromBlock(Blocks.planks)).setUnlocalizedName(ModInformation.modid + ".chainsaw.wood");
//GameRegistry.registerItem(woodenChainsaw, "woodenChainsaw");
//stoneChainsaw = new ItemVanillaChainsaw(Item.ToolMaterial.STONE, 165, "chainsaw_stone", Item.getItemFromBlock(Blocks.cobblestone)).setUnlocalizedName(ModInformation.modid + ".chainsaw.stone");
//GameRegistry.registerItem(stoneChainsaw, "stoneChainsaw");
//ironChainsaw = new ItemVanillaChainsaw(Item.ToolMaterial.IRON, 315, "chainsaw_iron", Items.iron_ingot, 3F).setUnlocalizedName(ModInformation.modid + ".chainsaw.iron");
//GameRegistry.registerItem(ironChainsaw, "ironChainsaw");
//goldenChainsaw = new ItemVanillaChainsaw(Item.ToolMaterial.GOLD, 55, "chainsaw_gold", Items.gold_ingot).setUnlocalizedName(ModInformation.modid + ".chainsaw.gold");
//GameRegistry.registerItem(goldenChainsaw, "goldenChainsaw");
//diamondChainsaw = new ItemVanillaChainsaw(Item.ToolMaterial.EMERALD, 2015, "chainsaw_diamond", Items.diamond, 6F).setUnlocalizedName(ModInformation.modid + ".chainsaw.diamond");
//GameRegistry.registerItem(diamondChainsaw, "diamondChainsaw");
//copperChainsaw = new ItemVanillaChainsaw(copperMaterial, 450, "chainsaw_copper", OreDictionary.getOres("ingotCopper").get(0).getItem(), 3F).setUnlocalizedName(ModInformation.modid + ".chainsaw.copper");
//GameRegistry.registerItem(copperChainsaw, "copperChainsaw");
//tinChainsaw = new ItemVanillaChainsaw(tinMaterial, 350, "chainsaw_tin", OreDictionary.getOres("ingotTin").get(0).getItem(), 5F).setUnlocalizedName(ModInformation.modid + ".chainsaw.tin");
//GameRegistry.registerItem(tinChainsaw, "tinChainsaw");
//leadChainsaw = new ItemVanillaChainsaw(leadMaterial, 400, "chainsaw_lead", OreDictionary.getOres("ingotLead").get(0).getItem(), 3.5F).setUnlocalizedName(ModInformation.modid + ".chainsaw.lead");
//GameRegistry.registerItem(leadChainsaw, "leadChainsaw");
//bronzeChainsaw = new ItemVanillaChainsaw(bronzeMaterial, 650, "chainsaw_bronze", OreDictionary.getOres("ingotBronze").get(0).getItem(), 4F).setUnlocalizedName(ModInformation.modid + ".chainsaw.bronze");
//GameRegistry.registerItem(bronzeChainsaw, "bronzeChainsaw");
//ironOmnitool = new ItemVanillaOmnitool(Item.ToolMaterial.IRON, 500, "omnitool_iron", Items.iron_ingot).setUnlocalizedName(ModInformation.modid + ".omnitool.iron");
//GameRegistry.registerItem(ironOmnitool, "ironOmnitool");
//goldenOmnitool = new ItemVanillaOmnitool(Item.ToolMaterial.GOLD, 100, "omnitool_gold", Items.gold_ingot).setUnlocalizedName(ModInformation.modid + ".omnitool.gold");
//GameRegistry.registerItem(goldenOmnitool, "goldenOmnitool");
//diamondOmnitool = new ItemVanillaOmnitool(Item.ToolMaterial.EMERALD, 3900, "omnitool_diamond", Items.diamond).setUnlocalizedName(ModInformation.modid + ".omnitool.diamond");
//GameRegistry.registerItem(diamondOmnitool, "diamondOmnitool");
//copperOmnitool = new ItemVanillaOmnitool(copperMaterial, 850, "omnitool_copper", OreDictionary.getOres("ingotCopper").get(0).getItem()).setUnlocalizedName(ModInformation.modid + ".omnitool.copper");
//GameRegistry.registerItem(copperOmnitool, "copperOmnitool");
//tinOmnitool = new ItemVanillaOmnitool(tinMaterial, 640, "omnitool_tin", OreDictionary.getOres("ingotTin").get(0).getItem()).setUnlocalizedName(ModInformation.modid + ".omnitool.tin");
//GameRegistry.registerItem(tinOmnitool, "tinOmnitool");
//leadOmnitool = new ItemVanillaOmnitool(leadMaterial, 700, "omnitool_lead", OreDictionary.getOres("ingotLead").get(0).getItem()).setUnlocalizedName(ModInformation.modid + ".omnitool.lead");
//GameRegistry.registerItem(leadOmnitool, "leadOmnitool");
//bronzeOmnitool = new ItemVanillaOmnitool(bronzeMaterial, 950, "omnitool_bronze", OreDictionary.getOres("ingotBronze").get(0).getItem()).setUnlocalizedName(ModInformation.modid + ".omnitool.bronze");
//GameRegistry.registerItem(bronzeOmnitool, "bronzeOmnitool");
}
}
@@ -0,0 +1,467 @@
package tombenpotter.emt.common.items.armor;
import cpw.mods.fml.common.eventhandler.EventBus;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ic2.api.item.ElectricItem;
import ic2.api.item.IC2Items;
import ic2.api.item.IElectricItemManager;
import ic2.core.IC2;
import ic2.core.IC2Achievements;
import ic2.core.IC2Potion;
import ic2.core.Ic2Items;
import ic2.core.Platform;
import ic2.core.audio.AudioManager;
import ic2.core.audio.AudioSource;
import ic2.core.audio.PositionSpec;
import ic2.core.init.InternalName;
import ic2.core.init.MainConfig;
import ic2.core.item.ItemTinCan;
import ic2.core.item.armor.ItemArmorElectric;
import ic2.core.util.ConfigUtil;
import ic2.core.util.Keyboard;
import ic2.core.util.StackUtil;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import tombenpotter.emt.ElectroMagicTools;
import tombenpotter.emt.ModInformation;
import tombenpotter.emt.client.model.ModelCpecialArmor;
import tombenpotter.emt.client.model.ModelWings;
import tombenpotter.emt.common.items.ItemRegistry;
import tombenpotter.emt.common.util.ConfigHandler;
import tombenpotter.emt.common.util.RandomHelper;
import tombenpotter.emt.common.util.TextHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.FoodStats;
import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingFallEvent;
public class ItemEMTQuantum extends ItemArmorElectric {
IIcon icon0;
IIcon icon1;
IIcon icon2;
IIcon icon3;
IIcon icon4;
public int f = 0;
boolean isHolding = false;
protected static final Map<Integer, Integer> potionRemovalCost = new HashMap();
private float jumpCharge;
public static AudioSource audioSource;
private static boolean lastJetpackUsed = false;
public ItemEMTQuantum(InternalName internalName, int armorType1) {
super(internalName, InternalName.quantum, armorType1, 2000000, 12000.0D, 4);
MinecraftForge.EVENT_BUS.register(this);
this.setCreativeTab(ElectroMagicTools.tabEMT);
potionRemovalCost.put(Integer.valueOf(Potion.poison.id), Integer.valueOf(10000));
potionRemovalCost.put(Integer.valueOf(IC2Potion.radiation.id), Integer.valueOf(10000));
potionRemovalCost.put(Integer.valueOf(Potion.wither.id), Integer.valueOf(25000));
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconRegister) {
icon0 = iconRegister.registerIcon(ModInformation.texturePath + ":armor/armor_quantum_chest");
icon1 = iconRegister.registerIcon(ModInformation.texturePath + ":armor/armor_quantum_chest_jetpack");
icon2 = iconRegister.registerIcon(ModInformation.texturePath + ":armor/armor_quantum_chest_wing_t");
icon3 = iconRegister.registerIcon(ModInformation.texturePath + ":armor/armor_quantum_chest_wing_n");
icon4 = iconRegister.registerIcon(ModInformation.texturePath + ":armor/armor_quantum_chest_wing_q");
}
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int par1, int par2) {
return getIconFromDamage(par1);
}
@SubscribeEvent
public void onEntityLivingFallEvent(LivingFallEvent event) {
if ((IC2.platform.isSimulating()) && ((event.entity instanceof EntityLivingBase))) {
EntityLivingBase entity = (EntityLivingBase) event.entity;
ItemStack armor = entity.getEquipmentInSlot(1);
if ((armor != null) && (armor.getItem() == this)) {
int fallDamage = Math.max((int) event.distance - 10, 0);
double energyCost = getEnergyPerDamage() * fallDamage;
if (energyCost <= ElectricItem.manager.getCharge(armor)) {
ElectricItem.manager.discharge(armor, energyCost, Integer.MAX_VALUE, true, false, false);
event.setCanceled(true);
}
}
}
}
public ISpecialArmor.ArmorProperties getProperties(EntityLivingBase entity, ItemStack armor, DamageSource source, double damage, int slot)
{
return super.getProperties(entity, armor, source, damage, slot);
}
public double getDamageAbsorptionRatio() {
return 1.1D;
}
public int getEnergyPerDamage() {
return 20000;
}
@SideOnly(Side.CLIENT)
public EnumRarity getRarity(ItemStack stack) {
return EnumRarity.rare;
}
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
NBTTagCompound nbtData = StackUtil.getOrCreateNbtData(itemStack);
byte toggleTimer = nbtData.getByte("toggleTimer");
boolean ret = false;
IC2.platform.profilerStartSection("QuantumBodyarmor");
boolean jetpack = nbtData.getBoolean("jetpack");
boolean hoverMode = nbtData.getBoolean("hoverMode");
boolean jetpackUsed = false;
if ((IC2.keyboard.isJumpKeyDown(player)) && (IC2.keyboard.isModeSwitchKeyDown(player)) && (toggleTimer == 0)) {
toggleTimer = 30;
hoverMode = !hoverMode;
if (IC2.platform.isSimulating())
{
nbtData.setBoolean("hoverMode", hoverMode);
if (hoverMode)
{
IC2.platform.messagePlayer(player, "Hover Mode enabled.", new Object[0]);
} else
{
IC2.platform.messagePlayer(player, "Hover Mode disabled.", new Object[0]);
}
}
}
if(player.inventory.getCurrentItem() != null){
if(IC2.keyboard.isSneakKeyDown(player) && (player.inventory.getCurrentItem().getUnlocalizedName().equals("ic2.itemArmorJetpackElectric")) && toggleTimer == 0){
toggleTimer = 30;
if (IC2.platform.isSimulating()) {
player.inventory.armorInventory[2].stackTagCompound.setBoolean("jetpack", true);
IC2.platform.messagePlayer(player, "Jetpack enabled.", new Object[0]);
if(player.inventory.armorInventory[2] == itemStack){
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "Jetpack");
player.inventory.armorInventory[2].stackTagCompound.setInteger("jetpackCharge", (int) ElectricItem.manager.getCharge(player.inventory.getCurrentItem()));
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
}
if(player.inventory.getCurrentItem() != null){
if(IC2.keyboard.isSneakKeyDown(player) && (player.inventory.getCurrentItem().getUnlocalizedName().equals("item.EMT.wing.thaumium")) && toggleTimer == 0){
toggleTimer = 30;
if (IC2.platform.isSimulating()) {
IC2.platform.messagePlayer(player, "Thaumium wings enabled.", new Object[0]);
if(player.inventory.armorInventory[2] == itemStack){
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "TW");
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
}
if(player.inventory.getCurrentItem() != null){
if(IC2.keyboard.isSneakKeyDown(player) && (player.inventory.getCurrentItem().getUnlocalizedName().equals("item.EMT.wing.nano")) && toggleTimer == 0){
toggleTimer = 30;
if (IC2.platform.isSimulating()) {
IC2.platform.messagePlayer(player, "Nano wings enabled.", new Object[0]);
if(player.inventory.armorInventory[2] == itemStack){
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "NW");
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
}
if(player.inventory.getCurrentItem() != null){
if(IC2.keyboard.isSneakKeyDown(player) && (player.inventory.getCurrentItem().getUnlocalizedName().equals("item.EMT.wing.quantum")) && toggleTimer == 0){
toggleTimer = 30;
if (IC2.platform.isSimulating()) {
IC2.platform.messagePlayer(player, "Quantum wings enabled.", new Object[0]);
if(player.inventory.armorInventory[2] == itemStack){
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "QW");
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
}
}
}
if(player.inventory.getCurrentItem() == null && IC2.keyboard.isBoostKeyDown(player) && IC2.keyboard.isSneakKeyDown(player) && toggleTimer == 0 && IC2.platform.isSimulating()){
toggleTimer = 30;
if(player.inventory.armorInventory[2] == itemStack){
if(player.inventory.getCurrentItem() == null){
if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("Jetpack")){
IC2.platform.messagePlayer(player, "Jetpack disabled.", new Object[0]);
jetpack = false;
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None");
ItemStack charged = new ItemStack(IC2Items.getItem("electricJetpack").getItem());
ElectricItem.manager.charge(charged, player.inventory.armorInventory[2].stackTagCompound.getInteger("jetpackCharge"), player.inventory.armorInventory[2].stackTagCompound.getInteger("jetpackCharge"), true, false);
player.inventory.setInventorySlotContents(player.inventory.currentItem, charged);
}
if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("TW")){
IC2.platform.messagePlayer(player, "Thaumium wings disabled.", new Object[0]);
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None");
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemRegistry.thaumiumWing));
}
if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("NW")){
IC2.platform.messagePlayer(player, "Nano wings disabled.", new Object[0]);
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None");
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemRegistry.nanoWing));
}
if(player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("QW")){
IC2.platform.messagePlayer(player, "Quantum wings disabled.", new Object[0]);
player.inventory.armorInventory[2].stackTagCompound.setString("useother", "None");
player.inventory.setInventorySlotContents(player.inventory.currentItem, new ItemStack(ItemRegistry.quantumWing));
}
}
}
}
if ((jetpack) && ((IC2.keyboard.isJumpKeyDown(player)) && (player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("Jetpack")) || ((hoverMode) && (player.motionY < -0.029999999329447746D)))) {
jetpackUsed = useJetpack(player, hoverMode, itemStack);
}
if ((player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("TW"))) {
useWings(player, itemStack, world, 0.15f, 0.8f, 0.5f);
}
if ((player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("NW"))) {
useWings(player, itemStack, world, 0.25f, 0.7f, 0.3f);
}
if ((player.inventory.armorInventory[2].stackTagCompound.getString("useother").equals("QW"))) {
useWings(player, itemStack, world, 0.33f, 0.6f, 0.3f);
}
if ((IC2.platform.isSimulating()) && (toggleTimer > 0)) {
toggleTimer = (byte) (toggleTimer - 1);
nbtData.setByte("toggleTimer", toggleTimer);
}
if ((IC2.platform.isRendering()) && (player == IC2.platform.getPlayerInstance())) {
if (lastJetpackUsed != jetpackUsed) {
if (jetpackUsed) {
if (audioSource == null) {
audioSource = IC2.audioManager.createSource(player, PositionSpec.Backpack, "Tools/Jetpack/JetpackLoop.ogg", true, false, IC2.audioManager.getDefaultVolume());
}
if (audioSource != null) {
audioSource.play();
}
} else if (audioSource != null) {
audioSource.remove();
audioSource = null;
}
lastJetpackUsed = jetpackUsed;
}
if (audioSource != null) {
audioSource.updatePosition();
}
}
if(world.isRemote)
getIconIndex(itemStack);
ret = jetpackUsed;
player.extinguish();
IC2.platform.profilerEndSection();
if (ret) {
player.inventoryContainer.detectAndSendChanges();
}
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIconIndex(ItemStack stack){
if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){
return icon1;
}
if((stack.stackTagCompound.getString("useother")).equals("TW")){
return icon2;
}
if((stack.stackTagCompound.getString("useother")).equals("NW")){
return icon3;
}
if((stack.stackTagCompound.getString("useother")).equals("QW")){
return icon4;
}
return icon0;
}
@Override
public int getItemEnchantability() {
if (ConfigHandler.enchanting == false) {
return 0;
} else {
return 4;
}
}
@Override
@SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){
return ModInformation.texturePath + ":textures/models/quantum_jetpack.png";
}
if((stack.stackTagCompound.getString("useother")).equals("TW")){
return ModInformation.texturePath + ":textures/models/quantum_wings_t.png";
}
if((stack.stackTagCompound.getString("useother")).equals("NW")){
return ModInformation.texturePath + ":textures/models/quantum_wings_n.png";
}
if((stack.stackTagCompound.getString("useother")).equals("QW")){
return ModInformation.texturePath + ":textures/models/quantum_wings_q.png";
}
return super.getArmorTexture(stack, entity, slot, type);
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack stack, int armorSlot) {
if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){
ModelCpecialArmor mbm = new ModelCpecialArmor(1, 1);
return mbm;
}
if((stack.stackTagCompound.getString("useother")).equals("TW") || (stack.stackTagCompound.getString("useother")).equals("NW") || (stack.stackTagCompound.getString("useother")).equals("QW")){
ModelCpecialArmor mbm = new ModelCpecialArmor(1, 2);
mbm.isJumping = stack.stackTagCompound.getBoolean("isJumping");
return mbm;
}
return super.getArmorModel(entityLiving, stack, armorSlot);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
list.add(String.valueOf((int)ElectricItem.manager.getCharge(stack)) + " EU");
if((stack.stackTagCompound.getString("useother")).equals("Jetpack")){
list.add((stack.stackTagCompound.getInteger("jetpackCharge")) + " EU JETPACK");
}
}
public boolean useJetpack(EntityPlayer player, boolean hoverMode, ItemStack stack) {
int jetpackMaxCharge = 30000;
ItemStack jetpack = player.inventory.armorInventory[2];
if (stack.stackTagCompound.getInteger("jetpackCharge") == 0){
return false;
}
float power = 1.0F;
float dropPercentage = 0.05F;
if (((float)stack.stackTagCompound.getInteger("jetpackCharge") / (float)jetpackMaxCharge) <= dropPercentage){
power = (float) (power * (stack.stackTagCompound.getInteger("jetpackCharge") / (float)jetpackMaxCharge) * dropPercentage);
}
if (IC2.keyboard.isForwardKeyDown(player)) {
float retruster = 3.5F;
if (hoverMode) {
retruster = 0.5F;
}
float forwardpower = power * retruster * 2.0F;
if (forwardpower > 0.0F) {
player.moveFlying(0.0F, 0.4F * forwardpower, 0.02F);
}
}
int worldHeight = IC2.getWorldHeight(player.worldObj);
double y = player.posY;
if (y > worldHeight - 25) {
if (y > worldHeight) {
y = worldHeight;
}
power = (float) (power * ((worldHeight - y) / 25.0D));
}
double prevmotion = player.motionY;
player.motionY = Math.min(player.motionY + power * 0.2F, 0.6000000238418579D);
if (hoverMode) {
float maxHoverY = -0.025F;
if (IC2.keyboard.isSneakKeyDown(player)) {
maxHoverY = -0.1F;
}
if (IC2.keyboard.isJumpKeyDown(player)) {
maxHoverY = 0.1F;
}
if (player.motionY > maxHoverY) {
player.motionY = maxHoverY;
if (prevmotion > player.motionY) {
player.motionY = prevmotion;
}
}
}
double consume = 8.0D;
if (hoverMode) {
consume = 10.0D;
}
stack.stackTagCompound.setInteger("jetpackCharge", (int)(stack.stackTagCompound.getInteger("jetpackCharge") - consume));
player.fallDistance = 0.0F;
player.distanceWalkedModified = 0.0F;
IC2.platform.resetPlayerInAirTime(player);
return true;
}
void useWings(EntityPlayer player, ItemStack stack, World world, float motionY, float motionXZ, float f1){
NBTTagCompound nbtData = StackUtil.getOrCreateNbtData(stack);
nbtData.setBoolean("isJumping", IC2.keyboard.isJumpKeyDown(player));
if(nbtData.getBoolean("isJumping")){
nbtData.setBoolean("isHolding", true);
f += 1;
if(f > 7) f = 7;
}
else if(nbtData.getBoolean("isHolding")){
nbtData.setBoolean("isHolding", false);
player.motionY = motionY * f;
player.motionX /= motionXZ;
player.motionZ /= motionXZ;
f = 0;
}
if (nbtData.getBoolean("isJumping") && !player.onGround && player.motionY < 0 && !player.capabilities.isCreativeMode)
player.motionY *= f1;
if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.2;
if(ConfigHandler.impactOfRain){
if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode)
player.motionY = -0.3;
}
if (player.isSneaking() && !player.onGround) player.motionY = -0.6;
if (player.fallDistance > 0.0F) player.fallDistance = 0;
}
}
@@ -1,5 +1,7 @@
package tombenpotter.emt.common.items.armor.wings;
import ic2.core.IC2;
import ic2.core.util.StackUtil;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
@@ -10,6 +12,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tombenpotter.emt.ElectroMagicTools;
import tombenpotter.emt.ModInformation;
@@ -19,8 +22,7 @@ import tombenpotter.emt.common.util.ConfigHandler;
public class ItemFeatherWing extends ItemArmor {
public int visDiscount = 0;
public int f = 0;
boolean isHolding = false;
int f;
public ItemFeatherWing(ArmorMaterial material, int par3, int par4) {
super(material, par3, par4);
@@ -39,44 +41,57 @@ public class ItemFeatherWing extends ItemArmor {
@Override
@SideOnly(Side.CLIENT)
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
if(stack.stackTagCompound.getBoolean("isJumping")){ return ModInformation.texturePath + ":textures/models/quantumwing.png";}
return ModInformation.texturePath + ":textures/models/featherwing.png";
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
return new ModelWings();
public ModelBiped getArmorModel(EntityLivingBase entity, ItemStack stack, int armorSlot) {
if(entity instanceof EntityPlayer){
ModelWings mw = new ModelWings();
mw.isJumping = stack.stackTagCompound.getBoolean("isJumping");
return mw;
}
return new ModelWings();
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
if (world.isRemote) {
boolean isJumping = Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed();
boolean isHoldingJump = Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
if(isHoldingJump){
isHolding = true;
updateWings(player, stack, world, 0.09f, 0.9f, 0.9f);
}
public void updateWings(EntityPlayer player, ItemStack stack, World world, float motionY, float motionXZ, float f1){
NBTTagCompound nbtData = StackUtil.getOrCreateNbtData(stack);
nbtData.setBoolean("isJumping", IC2.keyboard.isJumpKeyDown(player));
if(nbtData.getBoolean("isJumping")){
nbtData.setBoolean("isHolding", true);
f += 1;
if(f > 7) f = 7;
}
else if(isHolding){
isHolding = false;
player.motionY = 0.09 * f;
}
else if(nbtData.getBoolean("isHolding")){
nbtData.setBoolean("isHolding", false);
player.motionY = motionY * f;
player.motionX /= motionXZ;
player.motionZ /= motionXZ;
f = 0;
}
if (isHoldingJump && !player.onGround && player.motionY < 0 && !player.capabilities.isCreativeMode)
player.motionY *= 0.9;
if (nbtData.getBoolean("isJumping") && !player.onGround && player.motionY < 0 && !player.capabilities.isCreativeMode)
player.motionY *= f1;
if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.2;
if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.2;
if(ConfigHandler.impactOfRain){
if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode)
player.motionY = -0.3;
}
if(ConfigHandler.impactOfRain){
if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode)
player.motionY = -0.3;
}
if (player.isSneaking() && !player.onGround) player.motionY = -0.6;
}
if (player.isSneaking() && !player.onGround) player.motionY = -0.6;
if (player.fallDistance > 0.0F) player.fallDistance = 0;
}
}
@@ -66,36 +66,7 @@ public class ItemNanoWing extends ItemThaumiumReinforcedWing implements IElectri
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
if (world.isRemote) {
boolean isJumping = Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed();
boolean isHoldingJump = Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
if(isHoldingJump){
isHolding = true;
f += 1;
if(f > 7) f = 7;
}
else if(isHolding){
isHolding = false;
player.motionY = 0.25 * f;
player.motionX /= 0.7;
player.motionZ /= 0.7;
f = 0;
}
if (isHoldingJump && !player.onGround && player.motionY < 0 && !player.capabilities.isCreativeMode)
player.motionY *= 0.3;
if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.2;
if(ConfigHandler.impactOfRain){
if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode)
player.motionY = -0.2;
}
if (player.isSneaking() && !player.onGround) player.motionY = -0.6;
}
if (player.fallDistance > 0.0F) player.fallDistance = 0;
this.updateWings(player, stack, world, 0.25f, 0.7f, 0.3f);
}
@Override
@@ -39,37 +39,6 @@ public class ItemQuantumWing extends ItemNanoWing {
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
if (world.isRemote) {
boolean isJumping = Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed();
boolean isHoldingJump = Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
if(isHoldingJump){
isHolding = true;
f += 1;
if(f > 7) f = 7;
}
else if(isHolding){
isHolding = false;
player.motionY = 0.33 * f;
player.motionX /= 0.6;
player.motionZ /= 0.6;
f = 0;
}
if (isHoldingJump && !player.onGround && player.motionY < 0 && !player.capabilities.isCreativeMode)
player.motionY *= 0.3;
if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.1;
if(ConfigHandler.impactOfRain){
if ((player.worldObj.isRaining() || player.worldObj.isThundering()) && !player.capabilities.isCreativeMode)
player.motionY = -0.05;
}
if (player.isSneaking() && isHoldingJump) player.motionY = 0;
if (player.isSneaking() && !player.onGround && !isHoldingJump) player.motionY = -0.6;
}
if (player.fallDistance > 0.0F) player.fallDistance = 0;
this.updateWings(player, stack, world, 0.33f, 0.6f, 0.3f);
}
}
@@ -7,6 +7,7 @@ import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import thaumcraft.api.IRepairable;
import thaumcraft.api.IVisDiscountGear;
@@ -15,6 +16,8 @@ import tombenpotter.emt.ElectroMagicTools;
import tombenpotter.emt.ModInformation;
import tombenpotter.emt.common.util.ConfigHandler;
import tombenpotter.emt.common.util.TextHelper;
import ic2.core.IC2;
import ic2.core.util.StackUtil;
import java.util.List;
@@ -54,24 +57,28 @@ public class ItemThaumiumReinforcedWing extends ItemFeatherWing implements IVisD
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
this.updateWings(player, stack, world, 0.15f, 0.8f, 0.5f);
NBTTagCompound nbtData = StackUtil.getOrCreateNbtData(stack);
nbtData.setBoolean("isJumping", IC2.keyboard.isJumpKeyDown(player));
if (world.isRemote) {
boolean isJumping = Minecraft.getMinecraft().gameSettings.keyBindJump.isPressed();
boolean isHoldingJump = Minecraft.getMinecraft().gameSettings.keyBindJump.getIsKeyPressed();
if(isHoldingJump){
isHolding = true;
if(nbtData.getBoolean("isJumping")){
nbtData.setBoolean("isHolding", true);
f += 1;
if(f > 7) f = 7;
}
else if(isHolding){
isHolding = false;
else if(nbtData.getBoolean("isJumping")){
nbtData.setBoolean("isHolding", false);
player.motionY = 0.15 * f;
player.motionX /= 0.8;
player.motionZ /= 0.8;
f = 0;
}
if (isHoldingJump && !player.onGround && player.motionY < 0 && !player.capabilities.isCreativeMode)
if (nbtData.getBoolean("isJumping") && !player.onGround && player.motionY < 0 && !player.capabilities.isCreativeMode)
player.motionY *= 0.5;
if (player.isInWater() && !player.capabilities.isCreativeMode) player.motionY += -0.2;
@@ -12,7 +12,7 @@ public class DungeonChestGenerator {
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ItemRegistry.taintedThorHammer), 0, 1, ConfigHandler.chanceTaintedMjolnir));
}
if (!ConfigHandler.oneRingSpawn) {
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ItemRegistry.baseBaubles), 0, 1, ConfigHandler.chanceOneRing));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ItemRegistry.onering), 0, 1, ConfigHandler.chanceOneRing));
}
}
}
@@ -1,28 +0,0 @@
package tombenpotter.emt.common.util;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import thaumcraft.common.entities.monster.EntityTaintChicken;
import tombenpotter.emt.common.items.ItemRegistry;
public class EntityEventHandler {
@SubscribeEvent
public void onEntityLivingDrops(LivingDropsEvent event) {
if (event.source.getEntity() != null && event.source.getEntity() instanceof EntityPlayer) {
if (event.entityLiving instanceof EntityCreeper) {
EntityCreeper creeper = (EntityCreeper) event.entityLiving;
if (creeper.getPowered()) {
event.entityLiving.entityDropItem(new ItemStack(ItemRegistry.itemEMTItems, 1, 6), 1);
}
}
if (event.entityLiving instanceof EntityTaintChicken) {
event.entityLiving.entityDropItem(new ItemStack(ItemRegistry.itemEMTItems, 1, 14), 1);
}
}
}
}
@@ -1,5 +1,9 @@
package tombenpotter.emt.common.util;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
@@ -9,6 +13,15 @@ import net.minecraftforge.event.ForgeEventFactory;
public class RandomHelper {
public static boolean isRKMPressed(World world){
if(FMLCommonHandler.instance().getSide().isClient()){
return Minecraft.getMinecraft().gameSettings.keyBindUseItem.getIsKeyPressed();
}
else return true;
}
public static boolean placeTorch(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
for (int i = 0; i < player.inventory.mainInventory.length; i++) {
ItemStack torchStack = player.inventory.mainInventory[i];
@@ -29,4 +42,6 @@ public class RandomHelper {
}
return false;
}
}
@@ -0,0 +1,18 @@
package tombenpotter.emt.common.util;
import net.minecraft.client.model.ModelRenderer;
import net.minecraftforge.client.event.RenderPlayerEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class RenderPlayerHandler {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void PlayerRend(RenderPlayerEvent.Pre event){
//System.out.println("vse norm");
}
}