diff --git a/src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java b/src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java index a596be0..b9f7e0c 100644 --- a/src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java +++ b/src/main/java/tombenpotter/emt/client/model/ModelCpecialArmor.java @@ -15,35 +15,22 @@ 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; public ModelCpecialArmor() { - this(0.0F, 0); + this(1, 0); } - public ModelCpecialArmor(float p_i1148_1_, int type) { - this(p_i1148_1_, 0.0F, 64, 32, type); + 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: diff --git a/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java b/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java index 603ce8b..2b34017 100644 --- a/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java +++ b/src/main/java/tombenpotter/emt/client/renderer/RenderLaser.java @@ -13,54 +13,45 @@ public class RenderLaser extends Render { private static final ResourceLocation laserTexture = new ResourceLocation(ModInformation.texturePath, "textures/models/lasermodel.png"); - public void renderArrow(EntityLaser entityLaser, double par2, double par4, double par6, float par8, float par9) { - + public void doRender(Entity entityLaser, double x, double y, double z, float par8, float par9) { this.bindEntityTexture(entityLaser); GL11.glPushMatrix(); - GL11.glTranslatef((float) par2, (float) par4, (float) par6); - GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); + GL11.glTranslated(x, y, z); + GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90, 0, 1, 0); + GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0, 0, 1); Tessellator tessellator = Tessellator.instance; byte b0 = 0; - float f2 = 0.4F; - float f3 = 0.7F; - float f4 = (float) (0 + b0 * 10) / 32.0F; - float f5 = (float) (5 + b0 * 10) / 32.0F; - float f6 = 0.0F; - float f7 = 0.15625F; - float f8 = (float) (5 + b0 * 10) / 32.0F; - float f9 = (float) (10 + b0 * 10) / 32.0F; + float f2 = 0.4f; + float f3 = 0.7f; + float f4 = (float) (0 + b0 * 10) / 32f; + float f5 = (float) (5 + b0 * 10) / 32f; float f10 = 0.05625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); - GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F); + GL11.glRotatef(45, 1, 0, 0); GL11.glScalef(f10, f10, f10); - GL11.glTranslatef(-4.0F, 0.0F, 0.0F); - GL11.glNormal3f(f10, 0.0F, 0.0F); - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9); - tessellator.draw(); - GL11.glNormal3f(-f10, 0.0F, 0.0F); - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8); - tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8); - tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9); - tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9); - tessellator.draw(); + GL11.glTranslatef(-4, 0, 0); + GL11.glPushAttrib(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_LIGHTING); for (int i = 0; i < 4; ++i) { - GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); - GL11.glNormal3f(0.0F, 0.0F, f10); + GL11.glRotatef(90, 1, 0, 0); + GL11.glNormal3f(0, 0, f10); tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4); - tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4); - tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5); - tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5); + tessellator.addVertexWithUV(-8, 0, 0, f2, f4); + tessellator.addVertexWithUV(8, 0, 0, f3, f4); + tessellator.addVertexWithUV(8, 4, 0, f3, f5); + tessellator.addVertexWithUV(-8, 4, 0, f2, f5); + tessellator.draw(); + + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(8, 0, 0, f2, f4); + tessellator.addVertexWithUV(-8, 0, 0, f3, f4); + tessellator.addVertexWithUV(-8, 4, 0, f3, f5); + tessellator.addVertexWithUV(8, 4, 0, f2, f5); tessellator.draw(); } + GL11.glPopAttrib(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); @@ -73,8 +64,4 @@ public class RenderLaser extends Render { protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.getArrowTextures((EntityLaser) par1Entity); } - - public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { - this.renderArrow((EntityLaser) par1Entity, par2, par4, par6, par8, par9); - } } diff --git a/src/main/java/tombenpotter/emt/client/renderer/RenderShield.java b/src/main/java/tombenpotter/emt/client/renderer/RenderShield.java new file mode 100644 index 0000000..69e8754 --- /dev/null +++ b/src/main/java/tombenpotter/emt/client/renderer/RenderShield.java @@ -0,0 +1,61 @@ +package tombenpotter.emt.client.renderer; + +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; + +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.entity.Render; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; +import tombenpotter.emt.ModInformation; +import tombenpotter.emt.common.entities.EntityLaser; + +public class RenderShield extends Render { + private static final ResourceLocation shieldTexture = new ResourceLocation(ModInformation.texturePath, "textures/models/shield.png"); + + public void doRender(Entity entityLaser, double x, double y, double z, float par8, float par9) { + this.bindEntityTexture(entityLaser); + GL11.glPushMatrix(); + GL11.glTranslated(x, y, z); + Tessellator tessellator = Tessellator.instance; + GL11.glEnable(GL11.GL_BLEND); + GL11.glPushAttrib(GL11.GL_LIGHTING); + GL11.glDisable(GL11.GL_LIGHTING); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); + + for (float h = 0; h < 360; h += 15) { + for (float angle = 0; angle < 360; angle += 15) { + float sin1 = (float) Math.sin(Math.toRadians(angle)); + float sin2 = (float) Math.sin(Math.toRadians(angle + 15)); + + float cos1 = (float) Math.cos(Math.toRadians(angle)); + float cos2 = (float) Math.cos(Math.toRadians(angle + 15)); + + float hsin1 = (float) Math.sin(Math.toRadians(h)); + float hsin2 = (float) Math.sin(Math.toRadians(h + 15)); + + float hcos1 = (float) Math.cos(Math.toRadians(h)); + float hcos2 = (float) Math.cos(Math.toRadians(h + 15)); + + tessellator.startDrawingQuads(); + tessellator.addVertexWithUV(sin1 * 2 * hcos1, 2 * hsin1, cos1 * 2 * hcos1, 1, 1); + tessellator.addVertexWithUV(sin1 * 2 * hcos2, 2 * hsin2, cos1 * 2 * hcos2, 1, 0); + tessellator.addVertexWithUV(sin2 * 2 * hcos2, 2 * hsin2, cos2 * 2 * hcos2, 0, 0); + tessellator.addVertexWithUV(sin2 * 2 * hcos1, 2 * hsin1, cos2 * 2 * hcos1, 0, 1); + tessellator.draw(); + } + } + + GL11.glPopAttrib(); + GL11.glDisable(GL12.GL_RESCALE_NORMAL); + GL11.glPopMatrix(); + } + + @Override + protected ResourceLocation getEntityTexture(Entity texture) { + return shieldTexture; + } + +} diff --git a/src/main/java/tombenpotter/emt/common/entities/EntityShield.java b/src/main/java/tombenpotter/emt/common/entities/EntityShield.java new file mode 100644 index 0000000..d42e830 --- /dev/null +++ b/src/main/java/tombenpotter/emt/common/entities/EntityShield.java @@ -0,0 +1,122 @@ +package tombenpotter.emt.common.entities; + +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ic2.core.IC2; +import net.minecraft.client.Minecraft; +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import net.minecraft.entity.IProjectile; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.PotionEffect; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityShield extends Entity implements IProjectile { + EntityPlayer owner; + + public EntityShield(World world) { + super(world); + this.setSize(4, 4); + this.ignoreFrustumCheck = true; + owner = Minecraft.getMinecraft().thePlayer; + this.setPosition(owner.posX, owner.posY, owner.posZ); + } + + public EntityShield(World world, EntityPlayer player) { + super(world); + this.setSize(4, 4); + owner = player; + this.setPosition(player.posX, player.posY, player.posZ); + this.ignoreFrustumCheck = true; + } + + @Override + protected void entityInit() { + this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); + } + + @SideOnly(Side.CLIENT) + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { + this.setPosition(par1, par3, par5); + this.setRotation(par7, par8); + } + + @Override + protected void readEntityFromNBT(NBTTagCompound p_70037_1_) { + } + + @Override + protected void writeEntityToNBT(NBTTagCompound p_70014_1_) { + } + + public AxisAlignedBB getBoundingBox() { + return this.boundingBox; + } + + @Override + public boolean canBePushed() { + return true; + } + + public void setPosition(double x, double y, double z) { + this.posX = x; + this.posY = y + 0.5f; + this.posZ = z; + float f = this.width / 2.0F; + float f1 = this.height; + this.boundingBox.setBounds(x - (double) f, y - (double) this.yOffset - 2 + (double) this.ySize, z - (double) f, x + (double) f, y - (double) this.yOffset - 2 + (double) this.ySize + (double) f1, z + (double) f); + } + + public void onUpdate() { + super.onUpdate(); + if (!owner.worldObj.isRemote) { + this.setPosition(owner.posX, owner.posY, owner.posZ); + if (!owner.isUsingItem()) { + this.setDead(); + } + } + } + + public void applyEntityCollision(Entity entity) { + if (entity.riddenByEntity != this && entity.ridingEntity != this) { + double ePosX = entity.posX - this.posX; + double ePosZ = entity.posZ - this.posZ; + double d2 = MathHelper.abs_max(ePosX, ePosZ); + d2 = (double) MathHelper.sqrt_double(d2); + ePosX /= d2; + ePosZ /= d2; + double d3 = 1.0D / d2; + + if (d3 > 1.0D) { + d3 = 1.0D; + } + + ePosX *= d3; + ePosZ *= d3; + ePosX *= 0.05000000074505806D; + ePosZ *= 0.05000000074505806D; + ePosX *= (double) (1.0F - this.entityCollisionReduction); + ePosZ *= (double) (1.0F - this.entityCollisionReduction); + this.addVelocity(-ePosX * 1000, 0.0D, -ePosZ * 1000); + entity.addVelocity(ePosX * 1000, 0.0D, ePosZ * 1000); + + } + } + + @SideOnly(Side.CLIENT) + @Override + public boolean isInRangeToRender3d(double x, double y, double z) { + return true; + } + + @Override + public void setThrowableHeading(double p_70186_1_, double p_70186_3_, double p_70186_5_, float p_70186_7_, float p_70186_8_) { + } +} diff --git a/src/main/java/tombenpotter/emt/common/init/EntityRegistry.java b/src/main/java/tombenpotter/emt/common/init/EntityRegistry.java index 9be62d9..a828bce 100644 --- a/src/main/java/tombenpotter/emt/common/init/EntityRegistry.java +++ b/src/main/java/tombenpotter/emt/common/init/EntityRegistry.java @@ -7,6 +7,7 @@ import net.minecraft.entity.EntityLiving; import tombenpotter.emt.ElectroMagicTools; import tombenpotter.emt.common.entities.EntityArcher; import tombenpotter.emt.common.entities.EntityLaser; +import tombenpotter.emt.common.entities.EntityShield; public class EntityRegistry { @@ -22,7 +23,6 @@ public class EntityRegistry { return startEID; } - @SuppressWarnings("unchecked") public static void registerEntityEgg(Class entity, int colPrim, int colSec) { int id = getUniqueEntityID(); EntityList.IDtoClassMapping.put(id, entity); @@ -34,6 +34,7 @@ public class EntityRegistry { cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityLaser.class, "laser", entityIDs++, ElectroMagicTools.instance, 80, 3, true); cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityArcher.class, "archer", entityIDs++, ElectroMagicTools.instance, 80, 3, true); + cpw.mods.fml.common.registry.EntityRegistry.registerModEntity(EntityShield.class, "shield", entityIDs++, ElectroMagicTools.instance, 80, 3, true); registerEntityEgg(EntityArcher.class, 0x99111F, 0xE5685); } } diff --git a/src/main/java/tombenpotter/emt/common/items/ItemMaterials.java b/src/main/java/tombenpotter/emt/common/items/ItemMaterials.java index 756b469..ba24d95 100644 --- a/src/main/java/tombenpotter/emt/common/items/ItemMaterials.java +++ b/src/main/java/tombenpotter/emt/common/items/ItemMaterials.java @@ -130,9 +130,8 @@ public class ItemMaterials extends Item { list.add(new ItemStack(this, 1, i)); } } - - public void onUsingTick(ItemStack stack, EntityPlayer player, int count) - { + + public void onUsingTick(ItemStack stack, EntityPlayer player, int count) { if (stack != null && stack.getItemDamage() == 6 && this.getMaxItemUseDuration(stack) - count >= 40) { World world = player.worldObj; player.swingItem(); @@ -171,7 +170,7 @@ public class ItemMaterials extends Item { } player.stopUsingItem(); } - } + } public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (stack.getItemDamage() == 6) { diff --git a/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java b/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java index dd0b5e3..a9371a1 100644 --- a/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java +++ b/src/main/java/tombenpotter/emt/common/items/foci/ItemShieldFocus.java @@ -1,8 +1,13 @@ package tombenpotter.emt.common.items.foci; +import java.util.ArrayList; +import java.util.LinkedList; + +import ic2.core.IC2; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.potion.PotionEffect; import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; @@ -11,13 +16,11 @@ import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.AspectList; import thaumcraft.common.items.wands.ItemWandCasting; import tombenpotter.emt.ElectroMagicTools; +import tombenpotter.emt.common.entities.EntityShield; import tombenpotter.emt.common.init.BlockRegistry; public class ItemShieldFocus extends ItemBaseFocus { - int y1 = 0; - ItemStack milk; - - private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 10).add(Aspect.WATER, 10).add(Aspect.AIR, 10); + private static final AspectList visCost = new AspectList().add(Aspect.ORDER, 5).add(Aspect.WATER, 5).add(Aspect.AIR, 5); public ItemShieldFocus() { super(".focus.shield", "focus_shield"); @@ -46,80 +49,24 @@ public class ItemShieldFocus extends ItemBaseFocus { @Override public void onUsingFocusTick(ItemStack itemstack, EntityPlayer player, int count) { ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); - - if (player.capabilities.isCreativeMode || wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) { - - player.motionX = 0.0D; - if (!player.capabilities.isCreativeMode && player.motionY < 0) - player.motionY = player.motionY / 2; - player.motionZ = 0.0D; - - int x = MathHelper.floor_double(player.posX); - int y = MathHelper.floor_double(player.posY); - int z = MathHelper.floor_double(player.posZ); - - if (milk == null) - milk = (new ItemStack(Items.milk_bucket)); - player.curePotionEffects(milk); - - if (player.motionY > -5) { - // Player Level - if (player.worldObj.isAirBlock(x + 1, y, z) && player.worldObj.isAirBlock(x - 1, y, z) && player.worldObj.isAirBlock(x, y, z + 1) && player.worldObj.isAirBlock(x, y, z - 1)) { - player.worldObj.setBlock(x + 1, y, z, BlockRegistry.shield); - player.worldObj.setBlock(x - 1, y, z, BlockRegistry.shield); - player.worldObj.setBlock(x, y, z + 1, BlockRegistry.shield); - player.worldObj.setBlock(x, y, z - 1, BlockRegistry.shield); - } - - // Above the player - if (player.worldObj.isAirBlock(x + 1, y + 1, z) && player.worldObj.isAirBlock(x - 1, y + 1, z) && player.worldObj.isAirBlock(x, y + 1, z + 1) && player.worldObj.isAirBlock(x, y + 1, z - 1)) { - player.worldObj.setBlock(x + 1, y + 1, z, BlockRegistry.shield); - player.worldObj.setBlock(x - 1, y + 1, z, BlockRegistry.shield); - player.worldObj.setBlock(x, y + 1, z + 1, BlockRegistry.shield); - player.worldObj.setBlock(x, y + 1, z - 1, BlockRegistry.shield); - } - - if (y > y1 && (player.worldObj.isAirBlock(x + 1, y - 2, z) && player.worldObj.isAirBlock(x - 1, y - 2, z) && player.worldObj.isAirBlock(x, y - 2, z + 1) && player.worldObj.isAirBlock(x, y - 2, z - 1)) - || (player.worldObj.getBlock(x + 1, y - 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x - 1, y - 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x, y - 2, z + 1) == BlockRegistry.shield && player.worldObj.getBlock(x, y - 2, z - 1) == BlockRegistry.shield)) { - player.worldObj.setBlockToAir(x + 1, y - 2, z); - player.worldObj.setBlockToAir(x - 1, y - 2, z); - player.worldObj.setBlockToAir(x, y - 2, z + 1); - player.worldObj.setBlockToAir(x, y - 2, z - 1); - } - - if (y < y1 && (player.worldObj.isAirBlock(x + 1, y + 2, z) && player.worldObj.isAirBlock(x - 1, y + 2, z) && player.worldObj.isAirBlock(x, y + 2, z + 1) && player.worldObj.isAirBlock(x, y + 2, z - 1)) - || (player.worldObj.getBlock(x + 1, y + 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x - 1, y + 2, z) == BlockRegistry.shield && player.worldObj.getBlock(x, y + 2, z + 1) == BlockRegistry.shield && player.worldObj.getBlock(x, y + 2, z - 1) == BlockRegistry.shield)) { - player.worldObj.setBlockToAir(x + 1, y + 2, z); - player.worldObj.setBlockToAir(x - 1, y + 2, z); - player.worldObj.setBlockToAir(x, y + 2, z + 1); - player.worldObj.setBlockToAir(x, y + 2, z - 1); - } - } - - y1 = y; + for (PotionEffect effect : new LinkedList(player.getActivePotionEffects())) { + IC2.platform.removePotion(player, effect.getPotionID()); + } + if (player.capabilities.isCreativeMode) + return; + if (!wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true)) { + player.stopUsingItem(); } } @Override - public void onPlayerStoppedUsingFocus(ItemStack itemstack, World world, EntityPlayer player, int count) { - int x = MathHelper.floor_double(player.posX); - int y = MathHelper.floor_double(player.posY); - int z = MathHelper.floor_double(player.posZ); - - // Player Level - if ((player.worldObj.getBlock(x + 1, y, z) == BlockRegistry.shield) && (player.worldObj.getBlock(x - 1, y, z) == BlockRegistry.shield) && (player.worldObj.getBlock(x, y, z + 1) == BlockRegistry.shield) && (player.worldObj.getBlock(x, y, z - 1) == BlockRegistry.shield)) { - player.worldObj.setBlockToAir(x + 1, y, z); - player.worldObj.setBlockToAir(x - 1, y, z); - player.worldObj.setBlockToAir(x, y, z + 1); - player.worldObj.setBlockToAir(x, y, z - 1); - } - - // Above the player - if ((player.worldObj.getBlock(x + 1, y + 1, z) == BlockRegistry.shield) && (player.worldObj.getBlock(x - 1, y + 1, z) == BlockRegistry.shield) && (player.worldObj.getBlock(x, y + 1, z + 1) == BlockRegistry.shield) && (player.worldObj.getBlock(x, y + 1, z - 1) == BlockRegistry.shield)) { - player.worldObj.setBlockToAir(x + 1, y + 1, z); - player.worldObj.setBlockToAir(x - 1, y + 1, z); - player.worldObj.setBlockToAir(x, y + 1, z + 1); - player.worldObj.setBlockToAir(x, y + 1, z - 1); + public ItemStack onFocusRightClick(ItemStack itemstack, World world, EntityPlayer player, MovingObjectPosition paramMovingObjectPosition) { + ItemWandCasting wand = (ItemWandCasting) itemstack.getItem(); + player.setItemInUse(itemstack, Integer.MAX_VALUE); + if (!world.isRemote && (player.capabilities.isCreativeMode || wand.consumeAllVis(itemstack, player, getVisCost(itemstack), true, true))) { + EntityShield shield = new EntityShield(world, player); + world.spawnEntityInWorld(shield); } + return itemstack; } } diff --git a/src/main/java/tombenpotter/emt/proxies/ClientProxy.java b/src/main/java/tombenpotter/emt/proxies/ClientProxy.java index e2b299d..5b89636 100644 --- a/src/main/java/tombenpotter/emt/proxies/ClientProxy.java +++ b/src/main/java/tombenpotter/emt/proxies/ClientProxy.java @@ -8,8 +8,10 @@ import cpw.mods.fml.client.registry.ClientRegistry; import cpw.mods.fml.client.registry.RenderingRegistry; import tombenpotter.emt.client.EMTKeys; import tombenpotter.emt.client.renderer.RenderLaser; +import tombenpotter.emt.client.renderer.RenderShield; import tombenpotter.emt.common.entities.EntityArcher; import tombenpotter.emt.common.entities.EntityLaser; +import tombenpotter.emt.common.entities.EntityShield; public class ClientProxy extends CommonProxy { @@ -22,5 +24,6 @@ public class ClientProxy extends CommonProxy { public void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderLaser()); RenderingRegistry.registerEntityRenderingHandler(EntityArcher.class, new RenderSnowMan()); + RenderingRegistry.registerEntityRenderingHandler(EntityShield.class, new RenderShield()); } } diff --git a/src/main/resources/assets/electromagictools/textures/blocks/shield.png b/src/main/resources/assets/electromagictools/textures/blocks/shield.png index eee7131..54056a2 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/shield.png and b/src/main/resources/assets/electromagictools/textures/blocks/shield.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airbottom.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airbottom.png new file mode 100644 index 0000000..9ddf27c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airbottom.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airside.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airside.png index 15a9035..02a5d25 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airside.png and b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airside.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airside32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airside32.png new file mode 100644 index 0000000..c8995c7 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/airside32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/air/doublesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/doublesolartop.png new file mode 100644 index 0000000..797aa00 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/doublesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/air/solartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/solartop.png new file mode 100644 index 0000000..ddf4eb3 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/solartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/air/triplesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/triplesolartop.png new file mode 100644 index 0000000..efe16f0 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/air/triplesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/bottom32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/bottom32.png new file mode 100644 index 0000000..68c7fe5 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/bottom32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkbottom.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkbottom.png new file mode 100644 index 0000000..9ddf27c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkbottom.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkside.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkside.png index bd4b554..587eff5 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkside.png and b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkside.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkside32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkside32.png new file mode 100644 index 0000000..454852c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/darkside32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/doublesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/doublesolartop.png new file mode 100644 index 0000000..797aa00 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/doublesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/solartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/solartop.png new file mode 100644 index 0000000..ddf4eb3 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/solartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/triplesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/triplesolartop.png new file mode 100644 index 0000000..efe16f0 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/dark/triplesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/doublesolartop32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/doublesolartop32.png new file mode 100644 index 0000000..5f56441 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/doublesolartop32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/doublesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/doublesolartop.png new file mode 100644 index 0000000..797aa00 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/doublesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthbottom.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthbottom.png new file mode 100644 index 0000000..9ddf27c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthbottom.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthside.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthside.png index e860147..551d78a 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthside.png and b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthside.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthside32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthside32.png new file mode 100644 index 0000000..a6d05e5 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/earthside32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/solartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/solartop.png new file mode 100644 index 0000000..ddf4eb3 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/solartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/triplesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/triplesolartop.png new file mode 100644 index 0000000..efe16f0 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/earth/triplesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/doublesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/doublesolartop.png new file mode 100644 index 0000000..797aa00 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/doublesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/firebottom.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/firebottom.png new file mode 100644 index 0000000..9ddf27c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/firebottom.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/fireside.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/fireside.png index 06ce193..73b28fd 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/fireside.png and b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/fireside.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/fireside32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/fireside32.png new file mode 100644 index 0000000..d902d48 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/fireside32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/solartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/solartop.png new file mode 100644 index 0000000..ddf4eb3 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/solartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/triplesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/triplesolartop.png new file mode 100644 index 0000000..efe16f0 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/fire/triplesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/order/doublesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/doublesolartop.png new file mode 100644 index 0000000..797aa00 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/doublesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderbottom.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderbottom.png new file mode 100644 index 0000000..9ddf27c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderbottom.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderside.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderside.png index ec7191a..dcd24e1 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderside.png and b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderside.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderside32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderside32.png new file mode 100644 index 0000000..b3e6582 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/orderside32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/order/solartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/solartop.png new file mode 100644 index 0000000..ddf4eb3 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/solartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/order/triplesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/triplesolartop.png new file mode 100644 index 0000000..efe16f0 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/order/triplesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/side.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/side.png index 1ded25e..d3527e3 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/solars/side.png and b/src/main/resources/assets/electromagictools/textures/blocks/solars/side.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/side32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/side32.png new file mode 100644 index 0000000..f9515c6 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/side32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/solartop32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/solartop32.png new file mode 100644 index 0000000..39b5f9b Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/solartop32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/triplesolartop32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/triplesolartop32.png new file mode 100644 index 0000000..192696c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/triplesolartop32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/water/doublesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/doublesolartop.png new file mode 100644 index 0000000..797aa00 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/doublesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/water/solartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/solartop.png new file mode 100644 index 0000000..ddf4eb3 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/solartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/water/triplesolartop.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/triplesolartop.png new file mode 100644 index 0000000..efe16f0 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/triplesolartop.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterbottom.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterbottom.png new file mode 100644 index 0000000..9ddf27c Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterbottom.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterside.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterside.png index e30fe95..200165f 100644 Binary files a/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterside.png and b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterside.png differ diff --git a/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterside32.png b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterside32.png new file mode 100644 index 0000000..77fd802 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/blocks/solars/water/waterside32.png differ diff --git a/src/main/resources/assets/electromagictools/textures/models/shield.png b/src/main/resources/assets/electromagictools/textures/models/shield.png new file mode 100644 index 0000000..2002bd2 Binary files /dev/null and b/src/main/resources/assets/electromagictools/textures/models/shield.png differ