From 93d52670793bb4fa500d79de8dbe46dcc690de38 Mon Sep 17 00:00:00 2001 From: fewizz Date: Tue, 2 Feb 2016 19:20:27 +0300 Subject: [PATCH] small cleanup --- .../java/tombenpotter/emt/client/EMTKeys.java | 4 - .../emt/client/model/ModelCpecialArmor.java | 214 ------------------ .../emt/client/model/ModelSpecialArmor.java | 126 +++++++++++ .../common/block/BlockEssentiaGenerators.java | 21 +- .../ItemInfusedQuantumChestplate.java | 10 +- .../item/tool/ItemThorHammerBroken.java | 7 +- .../generator/TileEntityBaseGenerator.java | 29 ++- .../emt/common/util/EMTEventHandler.java | 2 +- 8 files changed, 162 insertions(+), 251 deletions(-) delete mode 100644 src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java create mode 100644 src/main/java/tombenpotter/emt/client/model/ModelSpecialArmor.java diff --git a/src/main/java/tombenpotter/emt/client/EMTKeys.java b/src/main/java/tombenpotter/emt/client/EMTKeys.java index 5f639c3..0223c23 100644 --- a/src/main/java/tombenpotter/emt/client/EMTKeys.java +++ b/src/main/java/tombenpotter/emt/client/EMTKeys.java @@ -19,8 +19,4 @@ public class EMTKeys { keyUnequip = new KeyBinding(EMTTextHelper.localize("gui.EMT.key.unequip"), Keyboard.KEY_Z, "EMT"); ClientRegistry.registerKeyBinding(keyUnequip); } - - public static boolean keyUnequipPressed() { - return keyUnequip.getIsKeyPressed(); - } } \ No newline at end of file diff --git a/src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java b/src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java deleted file mode 100644 index 9cd91ca..0000000 --- a/src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java +++ /dev/null @@ -1,214 +0,0 @@ -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.item.EnumAction; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBow; -import net.minecraft.util.MathHelper; - -import org.lwjgl.opengl.GL11; - -@SideOnly(Side.CLIENT) -public class ModelCpecialArmor extends ModelBiped { - 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 ModelCpecialArmor() { - this(1, 0); - } - - public ModelCpecialArmor(float scale, int type) { - this(scale, 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 entity, 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_, entity); - - 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) { - EntityPlayer player = (EntityPlayer) entity; - if (player.inventory.getCurrentItem() != null) - this.heldItemRight = 1; - else - this.heldItemRight = 0; - 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 (player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem().getItemUseAction(player.inventory.getCurrentItem()) == EnumAction.bow && player.isUsingItem()) { - 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; - } - } -} \ No newline at end of file diff --git a/src/main/java/tombenpotter/emt/client/model/ModelSpecialArmor.java b/src/main/java/tombenpotter/emt/client/model/ModelSpecialArmor.java new file mode 100644 index 0000000..bdfde48 --- /dev/null +++ b/src/main/java/tombenpotter/emt/client/model/ModelSpecialArmor.java @@ -0,0 +1,126 @@ +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.item.EnumAction; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBow; +import net.minecraft.util.MathHelper; + +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class ModelSpecialArmor extends ModelBiped { + 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 ModelSpecialArmor() { + this(1, 0); + } + + public ModelSpecialArmor(float scale, int type) { + this(scale, 0.0F, type); + } + + public ModelSpecialArmor(float scale, float offset, int type) { + super(scale, offset, type == 1? 128 : 64, type == 0? 32 : type == 1? 96 : 64); + 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, scale * 2); + this.jetpack.setRotationPoint(0.0F, 0.0F + offset, 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; + } + } + + private void setRotation(ModelRenderer model, float x, float y, float z) { + model.rotateAngleX = x; + model.rotateAngleY = y; + model.rotateAngleZ = z; + } + + public void render(Entity entity, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) { + EntityPlayer player = (EntityPlayer)entity; + this.heldItemRight = player.inventory.getCurrentItem() != null? 1 : 0; + this.isRiding = player.isRiding(); + this.isSneak = player.isSneaking(); + this.aimedBow = player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem().getItemUseAction(player.inventory.getCurrentItem()) == EnumAction.bow && player.isUsingItem(); + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entity); + + this.bipedBody.render(scale); + this.bipedRightArm.render(scale); + this.bipedLeftArm.render(scale); + switch (this.type) { + case 1: + this.jetpack.render(scale); + break; + case 2: + this.center.render(scale); + this.leftWing.render(scale); + this.rightWing.render(scale); + } + + } + + 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) { + super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entity); + if (this.isJumping) { + this.rightWing.rotateAngleY = 0.5f; + this.leftWing.rotateAngleY = -0.5f; + } + + if (this.isSneak) { + 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; + } + } + } +} \ No newline at end of file diff --git a/src/main/java/tombenpotter/emt/common/block/BlockEssentiaGenerators.java b/src/main/java/tombenpotter/emt/common/block/BlockEssentiaGenerators.java index 456e842..7db4413 100644 --- a/src/main/java/tombenpotter/emt/common/block/BlockEssentiaGenerators.java +++ b/src/main/java/tombenpotter/emt/common/block/BlockEssentiaGenerators.java @@ -77,15 +77,16 @@ public class BlockEssentiaGenerators extends BlockBaseContainer { @SideOnly(Side.CLIENT) public void randomDisplayTick(World world, int x, int y, int z, Random random) { - int color = ((TileEntityBaseGenerator)world.getTileEntity(x, y, z)).aspect.getColor(); - float r = (float)(color >> 16 & 0xff) / 255F; - float g = (float)(color >> 8 & 0xff) / 255F; - float b = (float)(color & 0xff) / 255F; - - for(int i = 0; i < 3; i++){ - EntitySmokeFX fx = new EntitySmokeFX(world, x + 0.5f, y + 1.1, z + 0.5f, 0, 0.1, 0, 3); - fx.setRBGColorF(r, g, b); - Minecraft.getMinecraft().effectRenderer.addEffect(fx); - } + TileEntityBaseGenerator te = (TileEntityBaseGenerator)world.getTileEntity(x, y, z); + if(te.isActive){ + int color = te.aspect.getColor(); + float r = (float)(color >> 16 & 0xff) / 255F; + float g = (float)(color >> 8 & 0xff) / 255F; + float b = (float)(color & 0xff) / 255F; + + EntitySmokeFX fx = new EntitySmokeFX(world, x + 0.5f, y + 1.1, z + 0.5f, 0, 0.1, 0, 3); + fx.setRBGColorF(r, g, b); + Minecraft.getMinecraft().effectRenderer.addEffect(fx); + } } } diff --git a/src/main/java/tombenpotter/emt/common/item/armor/chestplate/ItemInfusedQuantumChestplate.java b/src/main/java/tombenpotter/emt/common/item/armor/chestplate/ItemInfusedQuantumChestplate.java index 7b1e03a..5c6f952 100644 --- a/src/main/java/tombenpotter/emt/common/item/armor/chestplate/ItemInfusedQuantumChestplate.java +++ b/src/main/java/tombenpotter/emt/common/item/armor/chestplate/ItemInfusedQuantumChestplate.java @@ -32,7 +32,7 @@ import java.util.Random; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.ModInformation; -import tombenpotter.emt.client.model.ModelCpecialArmor; +import tombenpotter.emt.client.model.ModelSpecialArmor; import tombenpotter.emt.client.model.ModelWings; import tombenpotter.emt.common.init.ItemRegistry; import tombenpotter.emt.common.item.armor.wings.ItemNanoWing; @@ -412,19 +412,19 @@ public class ItemInfusedQuantumChestplate extends ItemArmorElectric { if (entity instanceof EntityPlayer) { byte wing = stack.stackTagCompound.getByte("wing"); if (wing == JETPACK) { - ModelCpecialArmor mbm = new ModelCpecialArmor(1, 1); + ModelSpecialArmor mbm = new ModelSpecialArmor(1, 1); return mbm; } else if (wing != 0) { - ModelCpecialArmor mbm = new ModelCpecialArmor(1, 2); + ModelSpecialArmor mbm = new ModelSpecialArmor(1, 2); mbm.isJumping = stack.stackTagCompound.getBoolean("isJumping"); return mbm; } } } catch (NullPointerException e) { - new ModelCpecialArmor(1, 0); + new ModelSpecialArmor(1, 0); } - return new ModelCpecialArmor(1, 0); + return new ModelSpecialArmor(1, 0); } @Override diff --git a/src/main/java/tombenpotter/emt/common/item/tool/ItemThorHammerBroken.java b/src/main/java/tombenpotter/emt/common/item/tool/ItemThorHammerBroken.java index fb655ad..4e70e9c 100644 --- a/src/main/java/tombenpotter/emt/common/item/tool/ItemThorHammerBroken.java +++ b/src/main/java/tombenpotter/emt/common/item/tool/ItemThorHammerBroken.java @@ -45,13 +45,10 @@ public class ItemThorHammerBroken extends ItemSword implements IRepairable { world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 4, player.posZ)); world.spawnEntityInWorld(new EntityAlumentum(world, player.posX, player.posY + 8, player.posZ)); - if (player.capabilities.isCreativeMode) { - return itemstack; - } - else { + if (!player.capabilities.isCreativeMode) { itemstack.damageItem(20, player); - return itemstack; } + return itemstack; } @Override diff --git a/src/main/java/tombenpotter/emt/common/tile/generator/TileEntityBaseGenerator.java b/src/main/java/tombenpotter/emt/common/tile/generator/TileEntityBaseGenerator.java index be6c7a8..ecec278 100644 --- a/src/main/java/tombenpotter/emt/common/tile/generator/TileEntityBaseGenerator.java +++ b/src/main/java/tombenpotter/emt/common/tile/generator/TileEntityBaseGenerator.java @@ -1,6 +1,9 @@ package tombenpotter.emt.common.tile.generator; +import java.util.Random; + import ic2.api.energy.prefab.BasicSource; +import net.minecraft.client.particle.EntitySmokeFX; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; @@ -18,6 +21,8 @@ public abstract class TileEntityBaseGenerator extends TileEntityEMT { public Aspect aspect; public double output; public int tick = 0; + public boolean isActive = false; + Random rnd = new Random(); public TileEntityBaseGenerator() { output = 2000; @@ -30,6 +35,7 @@ public abstract class TileEntityBaseGenerator extends TileEntityEMT { if (tick == 0) { energySource.updateEntity(); + isActive = false; createEnergy(); tick = 20; } @@ -37,18 +43,17 @@ public abstract class TileEntityBaseGenerator extends TileEntityEMT { public void createEnergy() { int count = 0; - if (!this.worldObj.isRemote) { - for (int x = this.xCoord - 4; x < this.xCoord + 4; x++) { - for (int y = this.yCoord - 4; y < this.yCoord + 4; y++) { - for (int z = this.zCoord - 4; z < this.zCoord + 4; z++) { - TileEntity tile = this.worldObj.getTileEntity(x, y, z); - if (tile != null && tile instanceof IAspectSource) { - IAspectSource as = (IAspectSource) tile; - if (as.doesContainerContainAmount(aspect, 1)) { - if (as.takeFromContainer(aspect, 1)) { - PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(xCoord, yCoord, zCoord, (byte) (xCoord - x), (byte) (yCoord - y), (byte) (zCoord - z), aspect.getColor()), new cpw.mods.fml.common.network.NetworkRegistry.TargetPoint(this.getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 32.0D)); - energySource.addEnergy(output / 30D); - } + for (int x = this.xCoord - 4; x < this.xCoord + 4; x++) { + for (int y = this.yCoord - 4; y < this.yCoord + 4; y++) { + for (int z = this.zCoord - 4; z < this.zCoord + 4; z++) { + TileEntity tile = this.worldObj.getTileEntity(x, y, z); + if (tile != null && tile instanceof IAspectSource) { + IAspectSource as = (IAspectSource) tile; + if (as.doesContainerContainAmount(aspect, 1)) { + if (as.takeFromContainer(aspect, 1)) { + isActive = true; + PacketHandler.INSTANCE.sendToAllAround(new PacketFXEssentiaSource(xCoord, yCoord, zCoord, (byte) (xCoord - x), (byte) (yCoord - y), (byte) (zCoord - z), aspect.getColor()), new cpw.mods.fml.common.network.NetworkRegistry.TargetPoint(this.getWorldObj().provider.dimensionId, xCoord, yCoord, zCoord, 32.0D)); + energySource.addEnergy(output / 30D); } } } diff --git a/src/main/java/tombenpotter/emt/common/util/EMTEventHandler.java b/src/main/java/tombenpotter/emt/common/util/EMTEventHandler.java index 8fa6f38..bd9ffcb 100644 --- a/src/main/java/tombenpotter/emt/common/util/EMTEventHandler.java +++ b/src/main/java/tombenpotter/emt/common/util/EMTEventHandler.java @@ -46,7 +46,7 @@ public class EMTEventHandler { @SubscribeEvent public void clientTick(ClientTickEvent e) { - if (EMTKeys.keyUnequipPressed()) { + if (EMTKeys.keyUnequip.getIsKeyPressed()) { ElectroMagicTools.INSTANCE.sendToServer(new PacketEMTKeys()); } }