diff --git a/src/tconstruct/client/TProxyClient.java b/src/tconstruct/client/TProxyClient.java index 00b3f253..99a5a979 100644 --- a/src/tconstruct/client/TProxyClient.java +++ b/src/tconstruct/client/TProxyClient.java @@ -92,12 +92,8 @@ import tconstruct.client.block.TableForgeRender; import tconstruct.client.block.TableRender; import tconstruct.client.block.TankRender; import tconstruct.client.entity.CartRender; -import tconstruct.client.entity.CloneHeadModel; -import tconstruct.client.entity.CrystalGuardianRender; import tconstruct.client.entity.CrystalRender; import tconstruct.client.entity.FancyItemRender; -import tconstruct.client.entity.MiniGardyRender; -import tconstruct.client.entity.SlimeCloneRender; import tconstruct.client.entity.SlimeRender; import tconstruct.client.entity.projectile.ArrowRenderCustom; import tconstruct.client.entity.projectile.DaggerRenderCustom; @@ -109,7 +105,6 @@ import tconstruct.client.gui.FrypanGui; import tconstruct.client.gui.GuiLandmine; import tconstruct.client.gui.GuiManual; import tconstruct.client.gui.KnapsackGui; -import tconstruct.client.gui.MiniGardyGui; import tconstruct.client.gui.PartCrafterGui; import tconstruct.client.gui.PatternChestGui; import tconstruct.client.gui.SmelteryGui; @@ -136,13 +131,10 @@ import tconstruct.client.tabs.InventoryTabVanilla; import tconstruct.client.tabs.TabRegistry; import tconstruct.common.TContent; import tconstruct.common.TProxyCommon; -import tconstruct.entity.Automaton; import tconstruct.entity.BlueSlime; import tconstruct.entity.CartEntity; import tconstruct.entity.Crystal; import tconstruct.entity.FancyEntityItem; -import tconstruct.entity.MiniGardy; -import tconstruct.entity.SlimeClone; import tconstruct.entity.projectile.ArrowEntity; import tconstruct.entity.projectile.DaggerEntity; import tconstruct.entity.projectile.LaunchedPotion; @@ -155,6 +147,9 @@ import tconstruct.library.tools.ToolCore; import tconstruct.util.player.ArmorExtended; import tconstruct.util.player.KnapsackInventory; +import bastion.client.model.CloneHeadModel; +import bastion.inventory.MiniGardyGui; + import com.google.common.collect.Lists; import cpw.mods.fml.client.registry.ClientRegistry; @@ -218,18 +213,6 @@ public class TProxyClient extends TProxyCommon TProxyClient.knapsack.init(Minecraft.getMinecraft().thePlayer); return new KnapsackGui(player.inventory, TProxyClient.knapsack); } - if (ID == miniGardyGui) - { - for (Object o : world.loadedEntityList) - { - Entity entity = (Entity) o; - if (entity.entityId == x) - { - return new MiniGardyGui(player.inventory, (MiniGardy) entity); - } - } - return null; - } return null; } @@ -353,12 +336,9 @@ public class TProxyClient extends TProxyCommon // Entities RenderingRegistry.registerEntityRenderingHandler(FancyEntityItem.class, new FancyItemRender()); RenderingRegistry.registerEntityRenderingHandler(BlueSlime.class, new SlimeRender(new ModelSlime(16), new ModelSlime(0), 0.25F)); - RenderingRegistry.registerEntityRenderingHandler(SlimeClone.class, new SlimeCloneRender(new CloneHeadModel(0), new CloneHeadModel(1f), 0.25F)); RenderingRegistry.registerEntityRenderingHandler(CartEntity.class, new CartRender()); RenderingRegistry.registerEntityRenderingHandler(Crystal.class, new CrystalRender()); - RenderingRegistry.registerEntityRenderingHandler(MiniGardy.class, new MiniGardyRender()); - RenderingRegistry.registerEntityRenderingHandler(Automaton.class, new CrystalGuardianRender()); RenderingRegistry.registerEntityRenderingHandler(LaunchedPotion.class, new LaunchedItemRender(Item.potion, 16384)); RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRenderCustom()); RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRenderCustom()); diff --git a/src/tconstruct/client/entity/CloneHeadModel.java b/src/tconstruct/client/entity/CloneHeadModel.java deleted file mode 100644 index 17145f47..00000000 --- a/src/tconstruct/client/entity/CloneHeadModel.java +++ /dev/null @@ -1,33 +0,0 @@ -package tconstruct.client.entity; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class CloneHeadModel extends ModelBase -{ - /** The slime's bodies, both the inside box and the outside box */ - ModelRenderer slimeBodies; - ModelRenderer slimeHeadwear; - - public CloneHeadModel(float scale) - { - this.slimeBodies = new ModelRenderer(this, 0, 0); - this.slimeBodies.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8); - this.slimeHeadwear = new ModelRenderer(this, 32, 0); - this.slimeHeadwear.addBox(-4.0F, 16.0F, -4.0F, 8, 8, 8, scale); - } - - /** - * Sets the models various rotation angles then renders the model. - */ - public void render (Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) - { - this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity); - this.slimeBodies.render(par7); - this.slimeHeadwear.render(par7); - } -} diff --git a/src/tconstruct/client/entity/CrystalGuardianModel.java b/src/tconstruct/client/entity/CrystalGuardianModel.java deleted file mode 100644 index 5c026c70..00000000 --- a/src/tconstruct/client/entity/CrystalGuardianModel.java +++ /dev/null @@ -1,121 +0,0 @@ -package tconstruct.client.entity; - -import tconstruct.entity.Automaton; -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; - -public class CrystalGuardianModel extends ModelBase -{ - public ModelRenderer chest; - public ModelRenderer leftarm; - public ModelRenderer rightarm; - public ModelRenderer leftleg; - public ModelRenderer rightleg; - public ModelRenderer neckplate; - public ModelRenderer head; - public ModelRenderer crystal; - public ModelRenderer eyeleft; - public ModelRenderer eyeright; - - public CrystalGuardianModel() - { - textureWidth = 64; - textureHeight = 64; - - chest = new ModelRenderer(this, 0, 0); - chest.addBox(-8F, -8F, -5F, 16, 16, 10); - chest.setRotationPoint(0F, 0F, 0F); - setRotation(chest, 0F, 0F, 0F); - leftarm = new ModelRenderer(this, 0, 26); - leftarm.mirror = true; - leftarm.addBox(0F, -2F, -2F, 4, 22, 4); - leftarm.setRotationPoint(8F, -5F, 0F); - setRotation(leftarm, 0F, 0F, 0F); - rightarm = new ModelRenderer(this, 0, 26); - rightarm.mirror = false; - rightarm.addBox(-4F, -2F, -2F, 4, 22, 4); - rightarm.setRotationPoint(-8F, -5F, 0F); - setRotation(rightarm, 0F, 0F, 0F); - leftleg = new ModelRenderer(this, 16, 26); - leftleg.mirror = true; - leftleg.addBox(-2F, 0F, -3F, 4, 16, 6); - leftleg.setRotationPoint(4F, 8F, 0F); - setRotation(leftleg, 0F, 0F, 0F); - rightleg = new ModelRenderer(this, 16, 26); - rightleg.mirror = false; - rightleg.addBox(-2F, 0F, -3F, 4, 16, 6); - rightleg.setRotationPoint(-4F, 8F, 0F); - setRotation(rightleg, 0F, 0F, 0F); - neckplate = new ModelRenderer(this, 8, 48); - neckplate.addBox(-4F, -1F, -4F, 8, 1, 8); - neckplate.setRotationPoint(0F, -8F, 0F); - setRotation(neckplate, 0F, 0F, 0F); - head = new ModelRenderer(this, 36, 26); - head.addBox(-3F, -6F, -3F, 6, 6, 6); - head.setRotationPoint(0F, -9F, 0F); - setRotation(head, 0F, 0F, 0F); - crystal = new ModelRenderer(this, 36, 38); - crystal.addBox(-1F, -8F, -1F, 2, 2, 2); - crystal.setRotationPoint(0F, -9F, 0F); - setRotation(crystal, 0F, 0F, 0F); - eyeleft = new ModelRenderer(this, 36, 42); - eyeleft.addBox(1F, -4F, -4F, 2, 2, 1); - eyeleft.setRotationPoint(0F, -9F, 0F); - setRotation(eyeleft, 0F, 0F, 0F); - eyeright = new ModelRenderer(this, 36, 42); - eyeright.addBox(-3F, -4F, -4F, 2, 2, 1); - eyeright.setRotationPoint(0F, -9F, 0F); - setRotation(eyeright, 0F, 0F, 0F); - } - - public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - chest.render(f5); - leftarm.render(f5); - rightarm.render(f5); - leftleg.render(f5); - rightleg.render(f5); - neckplate.render(f5); - head.render(f5); - crystal.render(f5); - eyeleft.render(f5); - eyeright.render(f5); - } - - private void setRotation (ModelRenderer model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - @Override - public void setRotationAngles (float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity) - { - //super.setRotationAngles(f, f1, f2, f3, f4, f5, entity); - - this.rightleg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2; - this.leftleg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2; - } - - @Override - public void setLivingAnimations (EntityLivingBase par1EntityLiving, float par2, float par3, float par4) - { - Automaton entityirongolem = (Automaton) par1EntityLiving; - int i = 0;//entityirongolem.getAttackTimer(); - - this.rightarm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3; - this.leftarm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3; - /*this.rightarm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F); - this.leftarm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);*/ - } - - private float func_78172_a (float par1, float par2) - { - return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F); - } -} diff --git a/src/tconstruct/client/entity/CrystalGuardianRender.java b/src/tconstruct/client/entity/CrystalGuardianRender.java deleted file mode 100644 index ef2f94dd..00000000 --- a/src/tconstruct/client/entity/CrystalGuardianRender.java +++ /dev/null @@ -1,195 +0,0 @@ -package tconstruct.client.entity; - -import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED; -import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.MinecraftForgeClient; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class CrystalGuardianRender extends RenderLiving -{ - CrystalGuardianModel model; - - public CrystalGuardianRender() - { - super(new CrystalGuardianModel(), 0.5F); - this.model = (CrystalGuardianModel) this.mainModel; - } - - @Override - protected void renderEquippedItems (EntityLivingBase par1EntityLiving, float par2) - { - float f1 = 1.0F; - GL11.glColor3f(f1, f1, f1); - super.renderEquippedItems(par1EntityLiving, par2); - ItemStack itemstack = par1EntityLiving.getHeldItem(); - ItemStack itemstack1 = par1EntityLiving.getCurrentItemOrArmor(4); - float f2; - - if (itemstack1 != null) - { - GL11.glPushMatrix(); - this.model.head.postRender(0.0625F); - - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D)); - - if (itemstack1.getItem() instanceof ItemBlock) - { - if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())) - { - f2 = 0.625F; - GL11.glTranslatef(0.0F, -0.25F, 0.0F); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(f2, -f2, -f2); - } - - this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack1, 0); - } - else if (itemstack1.getItem().itemID == Item.skull.itemID) - { - f2 = 1.0625F; - GL11.glScalef(f2, -f2, -f2); - String s = ""; - - if (itemstack1.hasTagCompound() && itemstack1.getTagCompound().hasKey("SkullOwner")) - { - s = itemstack1.getTagCompound().getString("SkullOwner"); - } - - TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack1.getItemDamage(), s); - } - - GL11.glPopMatrix(); - } - - if (itemstack != null) - { - GL11.glPushMatrix(); - - if (this.mainModel.isChild) - { - f2 = 0.5F; - GL11.glTranslatef(0.0F, 0.625F, 0.0F); - GL11.glRotatef(-20.0F, -1.0F, 0.0F, 0.0F); - GL11.glScalef(f2, f2, f2); - } - - this.model.rightarm.postRender(0.0625F); - GL11.glTranslatef(-0.125F, 1F, 0F); - - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack, BLOCK_3D)); - - if (itemstack.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))) - { - f2 = 0.5F; - GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); - f2 *= 0.75F; - GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(-f2, -f2, f2); - } - else if (itemstack.itemID == Item.bow.itemID) - { - f2 = 0.625F; - GL11.glTranslatef(0.0F, 0.125F, 0.3125F); - GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(f2, -f2, f2); - GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else if (Item.itemsList[itemstack.itemID].isFull3D()) - { - f2 = 0.625F; - - if (Item.itemsList[itemstack.itemID].shouldRotateAroundWhenRendering()) - { - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(0.0F, -0.125F, 0.0F); - } - - this.func_82422_c(); - GL11.glScalef(f2, -f2, f2); - GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else - { - f2 = 0.375F; - GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); - GL11.glScalef(f2, f2, f2); - GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); - } - - float f6; - float f11; - int j; - float f12; - - if (itemstack.getItem().requiresMultipleRenderPasses()) - { - for (j = 0; j < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); j++) - { - int k = itemstack.getItem().getColorFromItemStack(itemstack, j); - f12 = (float) (k >> 16 & 255) / 255.0F; - f11 = (float) (k >> 8 & 255) / 255.0F; - f6 = (float) (k & 255) / 255.0F; - GL11.glColor4f(f12, f11, f6, 1.0F); - this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, j); - } - } - else - { - j = itemstack.getItem().getColorFromItemStack(itemstack, 0); - f6 = (float) (j >> 16 & 255) / 255.0F; - f12 = (float) (j >> 8 & 255) / 255.0F; - f11 = (float) (j & 255) / 255.0F; - GL11.glColor4f(f6, f12, f11, 1.0F); - this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0); - } - - /*this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0); - - if (itemstack.getItem().requiresMultipleRenderPasses()) - { - for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) - { - this.renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, x); - } - }*/ - - GL11.glPopMatrix(); - } - } - - protected void func_82422_c () - { - GL11.glTranslatef(0.0F, 0.1875F, 0.0F); - } - - @Override - protected ResourceLocation getEntityTexture (Entity par1Entity) - { - return texture; - } - - static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/crystalguardamber.png"); -} diff --git a/src/tconstruct/client/entity/MiniGardyRender.java b/src/tconstruct/client/entity/MiniGardyRender.java deleted file mode 100644 index a4d4bada..00000000 --- a/src/tconstruct/client/entity/MiniGardyRender.java +++ /dev/null @@ -1,186 +0,0 @@ -package tconstruct.client.entity; - -import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED; -import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.IItemRenderer; -import net.minecraftforge.client.MinecraftForgeClient; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class MiniGardyRender extends RenderLiving -{ - public MiniGardyRender() - { - super(new ModelMiniGardy(), 0.5F); - } - - @Override - protected void renderEquippedItems (EntityLivingBase par1EntityLiving, float par2) - { - float f1 = 1.0F; - GL11.glColor3f(f1, f1, f1); - super.renderEquippedItems(par1EntityLiving, par2); - ItemStack heldItem = par1EntityLiving.getHeldItem(); - ItemStack helmetItem = par1EntityLiving.getCurrentItemOrArmor(4); - float f2; - - ModelMiniGardy model = (ModelMiniGardy) this.mainModel; - if (helmetItem != null) - { - GL11.glPushMatrix(); - model.head.postRender(0.0625F); - - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(helmetItem, EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, helmetItem, BLOCK_3D)); - - if (helmetItem.getItem() instanceof ItemBlock) - { - if (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[helmetItem.itemID].getRenderType())) - { - f2 = 0.625F; - GL11.glTranslatef(0.0F, -0.25F, 0.0F); - GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(f2, -f2, -f2); - } - - this.renderManager.itemRenderer.renderItem(par1EntityLiving, helmetItem, 0); - } - else if (helmetItem.getItem().itemID == Item.skull.itemID) - { - f2 = 1.0625F; - GL11.glScalef(f2, -f2, -f2); - String s = ""; - - if (helmetItem.hasTagCompound() && helmetItem.getTagCompound().hasKey("SkullOwner")) - { - s = helmetItem.getTagCompound().getString("SkullOwner"); - } - - TileEntitySkullRenderer.skullRenderer.func_82393_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, helmetItem.getItemDamage(), s); - } - - GL11.glPopMatrix(); - } - - if (heldItem != null) - { - GL11.glPushMatrix(); - - //if (this.mainModel.isChild) - { - f2 = 0.5F; - GL11.glTranslatef(0.0F, 0.75F, 0.0F); - GL11.glRotatef(-10.0F, 0F, 0.0F, 1.0F); - GL11.glScalef(f2, f2, f2); - } - - model.torso.postRender(0.0625F); - model.rightArm.postRender(0.0625F); - model.rightHand.postRender(0.0625F); - GL11.glTranslatef(-0.125F, 1F, 0F); - - IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(heldItem, EQUIPPED); - boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, heldItem, BLOCK_3D)); - - if (heldItem.getItem() instanceof ItemBlock && (is3D || RenderBlocks.renderItemIn3d(Block.blocksList[heldItem.itemID].getRenderType()))) - { - f2 = 0.5F; - GL11.glTranslatef(0.0F, 0.1875F, -0.3125F); - f2 *= 0.75F; - GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(-f2, -f2, f2); - } - else if (heldItem.itemID == Item.bow.itemID) - { - f2 = 0.625F; - GL11.glTranslatef(-0.175F, 0.125F, 0.3125F); - GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F); - GL11.glScalef(f2, -f2, f2); - GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - else - //if (Item.itemsList[heldItem.itemID].isFull3D()) - { - f2 = 0.625F; - - if (Item.itemsList[heldItem.itemID].shouldRotateAroundWhenRendering()) - { - GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F); - GL11.glTranslatef(0.0F, -0.125F, 0.0F); - } - - this.translateItem(); - GL11.glScalef(f2, -f2, f2); - GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F); - } - /*else - { - f2 = 0.375F; - GL11.glTranslatef(0.25F, 0.1875F, -0.1875F); - GL11.glScalef(f2, f2, f2); - GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F); - GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F); - GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F); - }*/ - - float f6; - float f11; - int j; - float f12; - - if (heldItem.getItem().requiresMultipleRenderPasses()) - { - for (j = 0; j < heldItem.getItem().getRenderPasses(heldItem.getItemDamage()); j++) - { - int k = heldItem.getItem().getColorFromItemStack(heldItem, j); - f12 = (float) (k >> 16 & 255) / 255.0F; - f11 = (float) (k >> 8 & 255) / 255.0F; - f6 = (float) (k & 255) / 255.0F; - GL11.glColor4f(f12, f11, f6, 1.0F); - this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, j); - } - } - else - { - j = heldItem.getItem().getColorFromItemStack(heldItem, 0); - f6 = (float) (j >> 16 & 255) / 255.0F; - f12 = (float) (j >> 8 & 255) / 255.0F; - f11 = (float) (j & 255) / 255.0F; - GL11.glColor4f(f6, f12, f11, 1.0F); - this.renderManager.itemRenderer.renderItem(par1EntityLiving, heldItem, 0); - } - - GL11.glPopMatrix(); - } - } - - protected void translateItem () - { - GL11.glTranslatef(0.0F, 0.1875F, 0.0F); - } - - @Override - protected ResourceLocation getEntityTexture (Entity par1Entity) - { - return texture; - } - - static final ResourceLocation texture = new ResourceLocation("assets/tinker/textures/mob/googirl.png"); -} diff --git a/src/tconstruct/client/entity/ModelBoxDegrees.java b/src/tconstruct/client/entity/ModelBoxDegrees.java deleted file mode 100644 index 423756c4..00000000 --- a/src/tconstruct/client/entity/ModelBoxDegrees.java +++ /dev/null @@ -1,120 +0,0 @@ -package tconstruct.client.entity; - -import net.minecraft.client.model.PositionTextureVertex; -import net.minecraft.client.model.TexturedQuad; -import net.minecraft.client.renderer.Tessellator; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ModelBoxDegrees -{ - /** - * The (x,y,z) vertex positions and (u,v) texture coordinates for each of the 8 points on a cube - */ - private PositionTextureVertex[] vertexPositions; - - /** An array of 6 TexturedQuads, one for each face of a cube */ - private TexturedQuad[] quadList; - - /** X vertex coordinate of lower box corner */ - public final float posX1; - - /** Y vertex coordinate of lower box corner */ - public final float posY1; - - /** Z vertex coordinate of lower box corner */ - public final float posZ1; - - /** X vertex coordinate of upper box corner */ - public final float posX2; - - /** Y vertex coordinate of upper box corner */ - public final float posY2; - - /** Z vertex coordinate of upper box corner */ - public final float posZ2; - public String field_78247_g; - - public ModelBoxDegrees(ModelRendererDegrees par1ModelRenderer, int par2, int par3, float par4, float par5, float par6, int par7, int par8, int par9, float par10) - { - this.posX1 = par4; - this.posY1 = par5; - this.posZ1 = par6; - this.posX2 = par4 + (float) par7; - this.posY2 = par5 + (float) par8; - this.posZ2 = par6 + (float) par9; - this.vertexPositions = new PositionTextureVertex[8]; - this.quadList = new TexturedQuad[6]; - float f4 = par4 + (float) par7; - float f5 = par5 + (float) par8; - float f6 = par6 + (float) par9; - par4 -= par10; - par5 -= par10; - par6 -= par10; - f4 += par10; - f5 += par10; - f6 += par10; - - if (par1ModelRenderer.mirror) - { - float f7 = f4; - f4 = par4; - par4 = f7; - } - - PositionTextureVertex positiontexturevertex = new PositionTextureVertex(par4, par5, par6, 0.0F, 0.0F); - PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f4, par5, par6, 0.0F, 8.0F); - PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(f4, f5, par6, 8.0F, 8.0F); - PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(par4, f5, par6, 8.0F, 0.0F); - PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(par4, par5, f6, 0.0F, 0.0F); - PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f4, par5, f6, 0.0F, 8.0F); - PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(f4, f5, f6, 8.0F, 8.0F); - PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(par4, f5, f6, 8.0F, 0.0F); - this.vertexPositions[0] = positiontexturevertex; - this.vertexPositions[1] = positiontexturevertex1; - this.vertexPositions[2] = positiontexturevertex2; - this.vertexPositions[3] = positiontexturevertex3; - this.vertexPositions[4] = positiontexturevertex4; - this.vertexPositions[5] = positiontexturevertex5; - this.vertexPositions[6] = positiontexturevertex6; - this.vertexPositions[7] = positiontexturevertex7; - this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex1, positiontexturevertex2, positiontexturevertex6 }, par2 + par9 + par7, par3 - + par9, par2 + par9 + par7 + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex, positiontexturevertex4, positiontexturevertex7, positiontexturevertex3 }, par2, par3 + par9, par2 - + par9, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex5, positiontexturevertex4, positiontexturevertex, positiontexturevertex1 }, par2 + par9, par3, par2 - + par9 + par7, par3 + par9, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex2, positiontexturevertex3, positiontexturevertex7, positiontexturevertex6 }, par2 + par9 + par7, par3 - + par9, par2 + par9 + par7 + par7, par3, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex1, positiontexturevertex, positiontexturevertex3, positiontexturevertex2 }, par2 + par9, par3 + par9, - par2 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] { positiontexturevertex4, positiontexturevertex5, positiontexturevertex6, positiontexturevertex7 }, par2 + par9 + par7 + par9, - par3 + par9, par2 + par9 + par7 + par9 + par7, par3 + par9 + par8, par1ModelRenderer.textureWidth, par1ModelRenderer.textureHeight); - - if (par1ModelRenderer.mirror) - { - for (int j1 = 0; j1 < this.quadList.length; ++j1) - { - this.quadList[j1].flipFace(); - } - } - } - - /** - * Draw the six sided box defined by this ModelBox - */ - @SideOnly(Side.CLIENT) - public void render (Tessellator par1Tessellator, float par2) - { - for (int i = 0; i < this.quadList.length; ++i) - { - this.quadList[i].draw(par1Tessellator, par2); - } - } - - public ModelBoxDegrees func_78244_a (String par1Str) - { - this.field_78247_g = par1Str; - return this; - } -} diff --git a/src/tconstruct/client/entity/ModelMiniGardy.java b/src/tconstruct/client/entity/ModelMiniGardy.java deleted file mode 100644 index 12b770b6..00000000 --- a/src/tconstruct/client/entity/ModelMiniGardy.java +++ /dev/null @@ -1,208 +0,0 @@ -package tconstruct.client.entity; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.entity.Entity; -import net.minecraft.util.MathHelper; - -public class ModelMiniGardy extends ModelBase -{ - ModelRendererDegrees body; - ModelRendererDegrees torso; - ModelRendererDegrees head; - ModelRendererDegrees rightArm; - ModelRendererDegrees rightHand; - ModelRendererDegrees leftArm; - ModelRendererDegrees leftHand; - ModelRendererDegrees hairTop; - ModelRendererDegrees hairRight; - ModelRendererDegrees lockLeft; - ModelRendererDegrees lockRight; - ModelRendererDegrees hairLeft; - ModelRendererDegrees hairBack; - ModelRendererDegrees hairFront; - ModelRendererDegrees hairTopFront; - ModelRendererDegrees hairTopBack; - ModelRendererDegrees lockInsideRight; - ModelRendererDegrees lockInsideLeft; - - public ModelMiniGardy() - { - body = new ModelRendererDegrees(this, 0, 0); - body.addBox(-3F, 0F, -3F, 6, 6, 6); - body.setRotationPoint(0F, 18F, 0F); - body.mirror = true; - setRotation(body, 0F, 0F, 0F); - - torso = new ModelRendererDegrees(this, 16, 12); - torso.addBox(-1F, -5F, -1F, 2, 5, 2); - torso.setRotationPoint(0F, 0F, 0F); - torso.mirror = true; - setRotation(torso, 0F, 0F, 0F); - body.addChild(torso); - - rightArm = new ModelRendererDegrees(this, 24, 0); - rightArm.addBox(-1F, -1F, -1F, 2, 4, 2); - rightArm.setRotationPoint(-2F, -3F, 0F); - rightArm.mirror = true; - setRotation(rightArm, 0F, 0F, 15F);//convertDegrees(30.0f));//0.2617994F); - torso.addChild(rightArm); - - rightHand = new ModelRendererDegrees(this, 24, 6); - rightHand.addBox(-1F, 0F, -2F, 2, 4, 2); - rightHand.setRotationPoint(0F, 3F, 1F); - rightHand.setTextureSize(64, 32); - rightHand.mirror = true; - setRotation(rightHand, 0F, 0F, 0F); - rightArm.addChild(rightHand); - - leftArm = new ModelRendererDegrees(this, 32, 0); - leftArm.addBox(-1F, -1F, -1F, 2, 4, 2); - leftArm.setRotationPoint(2F, -3F, 0F); - leftArm.mirror = true; - setRotation(leftArm, 0F, 0F, -15F); - torso.addChild(leftArm); - - leftHand = new ModelRendererDegrees(this, 32, 6); - leftHand.addBox(-1F, 0F, -2F, 2, 4, 2); - leftHand.setRotationPoint(0F, 3F, 1F); - leftHand.mirror = true; - setRotation(leftHand, 0F, 0F, 0F); - leftArm.addChild(leftHand); - - //Head - head = new ModelRendererDegrees(this, 0, 12); - head.addBox(-2F, -4F, -2F, 4, 4, 4); - head.setRotationPoint(0F, -5F, 0F); - head.mirror = true; - setRotation(head, 0F, 0F, 0F); - torso.addChild(head); - - hairTop = new ModelRendererDegrees(this, 40, 2); - hairTop.addBox(-3F, 0F, -2F, 6, 1, 4); - hairTop.setRotationPoint(0F, -5F, 0F); - hairTop.mirror = true; - setRotation(hairTop, 0F, 0F, 0F); - head.addChild(hairTop); - - hairRight = new ModelRendererDegrees(this, 40, 7); - hairRight.addBox(0F, 0F, 0F, 2, 5, 4); - hairRight.setRotationPoint(-3F, -4F, -1F); - hairRight.mirror = true; - setRotation(hairRight, 0F, 0F, 0F); - head.addChild(hairRight); - - lockLeft = new ModelRendererDegrees(this, 46, 19); - lockLeft.addBox(0F, 0F, 0F, 1, 2, 2); - lockLeft.setRotationPoint(2F, -1F, -3F); - lockLeft.mirror = true; - setRotation(lockLeft, 0F, 0F, 0F); - head.addChild(lockLeft); - - lockRight = new ModelRendererDegrees(this, 40, 19); - lockRight.addBox(-1F, 0F, 0F, 1, 2, 2); - lockRight.setRotationPoint(-2F, -1F, -3F); - lockRight.mirror = true; - setRotation(lockRight, 0F, 0F, 0F); - head.addChild(lockRight); - - hairLeft = new ModelRendererDegrees(this, 52, 7); - hairLeft.addBox(0F, 0F, 0F, 2, 5, 4); - hairLeft.setRotationPoint(1F, -4F, -1F); - hairLeft.mirror = true; - setRotation(hairLeft, 0F, 0F, 0F); - head.addChild(hairLeft); - - hairBack = new ModelRendererDegrees(this, 56, 16); - hairBack.addBox(-1F, 0F, 0F, 2, 4, 1); - hairBack.setRotationPoint(0F, -4F, 2F); - hairBack.mirror = true; - setRotation(hairBack, 0F, 0F, 0F); - head.addChild(hairBack); - - hairFront = new ModelRendererDegrees(this, 40, 16); - hairFront.addBox(0F, 0F, 0F, 6, 1, 2); - hairFront.setRotationPoint(-3F, -4F, -3F); - hairFront.mirror = true; - setRotation(hairFront, 0F, 0F, 0F); - head.addChild(hairFront); - - hairTopFront = new ModelRendererDegrees(this, 50, 0); - hairTopFront.addBox(0F, 0F, 0F, 4, 1, 1); - hairTopFront.setRotationPoint(-2F, -5F, -3F); - hairTopFront.mirror = true; - setRotation(hairTopFront, 0F, 0F, 0F); - head.addChild(hairTopFront); - - hairTopBack = new ModelRendererDegrees(this, 40, 0); - hairTopBack.addBox(0F, 0F, 0F, 4, 1, 1); - hairTopBack.setRotationPoint(-2F, -5F, 2F); - hairTopBack.mirror = true; - setRotation(hairTopBack, 0F, 0F, 0F); - head.addChild(hairTopBack); - - lockInsideRight = new ModelRendererDegrees(this, 40, 23); - lockInsideRight.addBox(0F, 0F, 0F, 1, 1, 2); - lockInsideRight.setRotationPoint(-2F, 0F, -3F); - lockInsideRight.mirror = true; - setRotation(lockInsideRight, 0F, 0F, 0F); - head.addChild(lockInsideRight); - - lockInsideLeft = new ModelRendererDegrees(this, 46, 23); - lockInsideLeft.addBox(-1F, 0F, 0F, 1, 1, 2); - lockInsideLeft.setRotationPoint(2F, 0F, -3F); - lockInsideLeft.mirror = true; - setRotation(lockInsideLeft, 0F, 0F, 0F); - head.addChild(lockInsideLeft); - } - - @Override - public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { - super.render(entity, f, f1, f2, f3, f4, f5); - setRotationAngles(f, f1, f2, f3, f4, f5, entity); - body.render(f5); - } - - private void setRotation (ModelRendererDegrees model, float x, float y, float z) - { - model.rotateAngleX = x; - model.rotateAngleY = y; - model.rotateAngleZ = z; - } - - private float convertDegrees (float f) - { - return f * ((float) Math.PI / 180F); - } - - private float convertRadians (float f) - { - return f * (180F / (float) Math.PI); - } - - @Override - public void setRotationAngles (float limbSwing, float limbDelta, float ticksExisted, float rotation, float rotationDelta, float par6, Entity entity) - { - float bodyRotation = convertRadians(MathHelper.cos(limbSwing * 0.6662F + (float) Math.PI) * 2.0F * limbDelta * 0.5F); - this.rightArm.rotateAngleX = bodyRotation; - this.leftArm.rotateAngleX = -bodyRotation; - this.torso.rotateAngleY = bodyRotation / 2; - this.head.rotateAngleY = rotation - bodyRotation / 2; - this.head.rotateAngleX = rotationDelta; - if (bodyRotation <= 0) - { - this.rightHand.rotateAngleX = bodyRotation; - } - if (-bodyRotation <= 0) - { - this.leftHand.rotateAngleX = -bodyRotation; - } - this.rightArm.rotateAngleZ = 15F; - this.leftArm.rotateAngleZ = -15F; - this.torso.rotationPointY = 0F; - this.rightArm.rotateAngleZ += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F); - this.leftArm.rotateAngleZ -= convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.05F + 0.05F); - this.torso.rotationPointY += convertRadians(MathHelper.cos(ticksExisted * 0.09F) * 0.01F + 0.01F); - } - -} diff --git a/src/tconstruct/client/entity/ModelRendererDegrees.java b/src/tconstruct/client/entity/ModelRendererDegrees.java deleted file mode 100644 index 8175d4e3..00000000 --- a/src/tconstruct/client/entity/ModelRendererDegrees.java +++ /dev/null @@ -1,321 +0,0 @@ -package tconstruct.client.entity; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.model.TextureOffset; -import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.Tessellator; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class ModelRendererDegrees -{ - /** The size of the texture file's width in pixels. */ - public float textureWidth; - - /** The size of the texture file's height in pixels. */ - public float textureHeight; - - /** The X offset into the texture used for displaying this model */ - private int textureOffsetX; - - /** The Y offset into the texture used for displaying this model */ - private int textureOffsetY; - public float rotationPointX; - public float rotationPointY; - public float rotationPointZ; - public float rotateAngleX; - public float rotateAngleY; - public float rotateAngleZ; - private boolean compiled; - - /** The GL display list rendered by the Tessellator for this model */ - private int displayList; - public boolean mirror; - public boolean showModel; - - /** Hides the model. */ - public boolean isHidden; - public List cubeList; - public List childModels; - public final String boxName; - private ModelBase baseModel; - public float field_82906_o; - public float field_82908_p; - public float field_82907_q; - - public ModelRendererDegrees(ModelBase par1ModelBase, String par2Str) - { - this.textureWidth = 64.0F; - this.textureHeight = 32.0F; - this.compiled = false; - this.displayList = 0; - this.mirror = false; - this.showModel = true; - this.isHidden = false; - this.cubeList = new ArrayList(); - this.baseModel = par1ModelBase; - par1ModelBase.boxList.add(this); - this.boxName = par2Str; - this.setTextureSize(par1ModelBase.textureWidth, par1ModelBase.textureHeight); - } - - public ModelRendererDegrees(ModelBase par1ModelBase) - { - this(par1ModelBase, (String) null); - } - - public ModelRendererDegrees(ModelBase par1ModelBase, int par2, int par3) - { - this(par1ModelBase); - this.setTextureOffset(par2, par3); - } - - /** - * Sets the current box's rotation points and rotation angles to another box. - */ - public void addChild (ModelRendererDegrees par1ModelRenderer) - { - if (this.childModels == null) - { - this.childModels = new ArrayList(); - } - - this.childModels.add(par1ModelRenderer); - } - - public ModelRendererDegrees setTextureOffset (int par1, int par2) - { - this.textureOffsetX = par1; - this.textureOffsetY = par2; - return this; - } - - public ModelRendererDegrees addBox (String par1Str, float par2, float par3, float par4, int par5, int par6, int par7) - { - par1Str = this.boxName + "." + par1Str; - TextureOffset textureoffset = this.baseModel.getTextureOffset(par1Str); - this.setTextureOffset(textureoffset.textureOffsetX, textureoffset.textureOffsetY); - this.cubeList.add((new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par2, par3, par4, par5, par6, par7, 0.0F)).func_78244_a(par1Str)); - return this; - } - - public ModelRendererDegrees addBox (float par1, float par2, float par3, int par4, int par5, int par6) - { - this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, 0.0F)); - return this; - } - - /** - * Creates a textured box. Args: originX, originY, originZ, width, height, depth, scaleFactor. - */ - public void addBox (float par1, float par2, float par3, int par4, int par5, int par6, float par7) - { - this.cubeList.add(new ModelBoxDegrees(this, this.textureOffsetX, this.textureOffsetY, par1, par2, par3, par4, par5, par6, par7)); - } - - public void setRotationPoint (float par1, float par2, float par3) - { - this.rotationPointX = par1; - this.rotationPointY = par2; - this.rotationPointZ = par3; - } - - @SideOnly(Side.CLIENT) - public void render (float par1) - { - if (!this.isHidden) - { - if (this.showModel) - { - if (!this.compiled) - { - this.compileDisplayList(par1); - } - - GL11.glTranslatef(this.field_82906_o, this.field_82908_p, this.field_82907_q); - int i; - - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) - { - if (this.rotationPointX == 0.0F && this.rotationPointY == 0.0F && this.rotationPointZ == 0.0F) - { - GL11.glCallList(this.displayList); - - if (this.childModels != null) - { - for (i = 0; i < this.childModels.size(); ++i) - { - ((ModelRendererDegrees) this.childModels.get(i)).render(par1); - } - } - } - else - { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - GL11.glCallList(this.displayList); - - if (this.childModels != null) - { - for (i = 0; i < this.childModels.size(); ++i) - { - ((ModelRendererDegrees) this.childModels.get(i)).render(par1); - } - } - - GL11.glTranslatef(-this.rotationPointX * par1, -this.rotationPointY * par1, -this.rotationPointZ * par1); - } - } - else - { - GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - - if (this.rotateAngleZ != 0.0F) - { - GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) - { - GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) - { - GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F); - } - - GL11.glCallList(this.displayList); - - if (this.childModels != null) - { - for (i = 0; i < this.childModels.size(); ++i) - { - ((ModelRendererDegrees) this.childModels.get(i)).render(par1); - } - } - - GL11.glPopMatrix(); - } - - GL11.glTranslatef(-this.field_82906_o, -this.field_82908_p, -this.field_82907_q); - } - } - } - - @SideOnly(Side.CLIENT) - public void renderWithRotation (float par1) - { - if (!this.isHidden) - { - if (this.showModel) - { - if (!this.compiled) - { - this.compileDisplayList(par1); - } - - GL11.glPushMatrix(); - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - - if (this.rotateAngleY != 0.0F) - { - GL11.glRotatef(this.rotateAngleY * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) - { - GL11.glRotatef(this.rotateAngleX * (180F / (float) Math.PI), 1.0F, 0.0F, 0.0F); - } - - if (this.rotateAngleZ != 0.0F) - { - GL11.glRotatef(this.rotateAngleZ * (180F / (float) Math.PI), 0.0F, 0.0F, 1.0F); - } - - GL11.glCallList(this.displayList); - GL11.glPopMatrix(); - } - } - } - - /** - * Allows the changing of Angles after a box has been rendered - */ - @SideOnly(Side.CLIENT) - public void postRender (float par1) - { - if (!this.isHidden) - { - if (this.showModel) - { - if (!this.compiled) - { - this.compileDisplayList(par1); - } - - if (this.rotateAngleX == 0.0F && this.rotateAngleY == 0.0F && this.rotateAngleZ == 0.0F) - { - if (this.rotationPointX != 0.0F || this.rotationPointY != 0.0F || this.rotationPointZ != 0.0F) - { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - } - } - else - { - GL11.glTranslatef(this.rotationPointX * par1, this.rotationPointY * par1, this.rotationPointZ * par1); - - if (this.rotateAngleZ != 0.0F) - { - GL11.glRotatef(this.rotateAngleZ, 0.0F, 0.0F, 1.0F); - } - - if (this.rotateAngleY != 0.0F) - { - GL11.glRotatef(this.rotateAngleY, 0.0F, 1.0F, 0.0F); - } - - if (this.rotateAngleX != 0.0F) - { - GL11.glRotatef(this.rotateAngleX, 1.0F, 0.0F, 0.0F); - } - } - } - } - } - - /** - * Compiles a GL display list for this model - */ - @SideOnly(Side.CLIENT) - private void compileDisplayList (float par1) - { - this.displayList = GLAllocation.generateDisplayLists(1); - GL11.glNewList(this.displayList, GL11.GL_COMPILE); - Tessellator tessellator = Tessellator.instance; - - for (int i = 0; i < this.cubeList.size(); ++i) - { - ((ModelBoxDegrees) this.cubeList.get(i)).render(tessellator, par1); - } - - GL11.glEndList(); - this.compiled = true; - } - - /** - * Returns the model renderer with the new texture parameters. - */ - public ModelRendererDegrees setTextureSize (int par1, int par2) - { - this.textureWidth = (float) par1; - this.textureHeight = (float) par2; - return this; - } -} diff --git a/src/tconstruct/client/entity/SlimeCloneRender.java b/src/tconstruct/client/entity/SlimeCloneRender.java deleted file mode 100644 index f19fdf9e..00000000 --- a/src/tconstruct/client/entity/SlimeCloneRender.java +++ /dev/null @@ -1,101 +0,0 @@ -package tconstruct.client.entity; - -import net.minecraft.client.model.ModelBase; -import net.minecraft.client.renderer.entity.RenderLiving; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; -import net.minecraft.util.ResourceLocation; - -import org.lwjgl.opengl.GL11; - -import tconstruct.entity.SlimeClone; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -@SideOnly(Side.CLIENT) -public class SlimeCloneRender extends RenderLiving -{ - private ModelBase scaleAmount; - - public SlimeCloneRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3) - { - super(par1ModelBase, par3); - this.scaleAmount = par2ModelBase; - } - - /** - * Determines whether Slime Render should pass or not. - */ - protected int shouldSlimeRenderPass (SlimeClone blueSlime, int par2, float par3) - { - if (blueSlime.isInvisible()) - { - return 0; - } - else if (par2 == 0) - { - this.setRenderPassModel(this.scaleAmount); - GL11.glEnable(GL11.GL_NORMALIZE); - GL11.glEnable(GL11.GL_BLEND); - GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - return 1; - } - else - { - if (par2 == 1) - { - GL11.glDisable(GL11.GL_BLEND); - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - } - - return -1; - } - } - - /** - * sets the scale for the slime based on getSlimeSize in EdibleSlime - */ - protected void scaleSlime (SlimeClone slimeClone, float par2) - { - float f1 = slimeClone.getSlimeSize(); - float f2 = (slimeClone.sizeHeight + (slimeClone.sizeFactor - slimeClone.sizeHeight) * par2) / (f1 * 0.5F + 1.0F); - float f3 = 1.0F / (f2 + 1.0F); - GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1); - } - - /** - * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args: - * entityLiving, partialTickTime - */ - protected void preRenderCallback (EntityLiving par1EntityLiving, float par2) - { - this.scaleSlime((SlimeClone) par1EntityLiving, par2); - } - - /** - * Queries whether should render the specified pass or not. - */ - protected int shouldRenderPass (EntityLiving par1EntityLiving, int par2, float par3) - { - return this.shouldSlimeRenderPass((SlimeClone) par1EntityLiving, par2, par3); - } - - /*protected ResourceLocation func_98191_a (SlimeClone slime) - { - this.loadDownloadableImageTexture(slime.skinUrl, slime.getTexture()); - } - - @Override - protected void func_98190_a (EntityLiving par1EntityLiving) - { - this.func_98191_a((SlimeClone) par1EntityLiving); - }*/ - - @Override - protected ResourceLocation getEntityTexture (Entity entity) - { - //return func_98191_a((SlimeClone)entity); - return null; - } -} diff --git a/src/tconstruct/client/gui/MiniGardyGui.java b/src/tconstruct/client/gui/MiniGardyGui.java deleted file mode 100644 index 5273ce3e..00000000 --- a/src/tconstruct/client/gui/MiniGardyGui.java +++ /dev/null @@ -1,39 +0,0 @@ -package tconstruct.client.gui; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.StatCollector; - -import org.lwjgl.opengl.GL11; - -import tconstruct.entity.MiniGardy; -import tconstruct.inventory.MiniGardyContainer; - -public class MiniGardyGui extends GuiContainer -{ - public MiniGardy gardy; - - public MiniGardyGui(InventoryPlayer inventoryplayer, MiniGardy gardy) - { - super(new MiniGardyContainer(inventoryplayer, gardy)); - this.gardy = gardy; - } - - protected void drawGuiContainerForegroundLayer (int par1, int par2) - { - fontRenderer.drawString(gardy.getEntityName(), 8, 6, 0x404040); - fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040); - } - - private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/googirl.png"); - - protected void drawGuiContainerBackgroundLayer (float f, int i, int j) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - this.mc.getTextureManager().bindTexture(background); - int cornerX = (width - xSize) / 2; - int cornerY = (height - ySize) / 2; - drawTexturedModalRect(cornerX, cornerY, 0, 0, xSize, ySize); - } -} diff --git a/src/tconstruct/common/TContent.java b/src/tconstruct/common/TContent.java index 36f92f3e..960b5d9c 100644 --- a/src/tconstruct/common/TContent.java +++ b/src/tconstruct/common/TContent.java @@ -5,6 +5,10 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import bastion.entity.friendly.Automaton; +import bastion.entity.friendly.GardeSlime; +import bastion.entity.friendly.SlimeClone; + import net.minecraft.block.Block; import net.minecraft.block.BlockDispenser; import net.minecraft.block.StepSound; @@ -94,12 +98,9 @@ import tconstruct.blocks.traps.BarricadeBlock; import tconstruct.blocks.traps.Punji; import tconstruct.client.StepSoundSlime; import tconstruct.compat.mystcraft.MystImcHandler; -import tconstruct.entity.Automaton; import tconstruct.entity.BlueSlime; import tconstruct.entity.Crystal; import tconstruct.entity.FancyEntityItem; -import tconstruct.entity.MiniGardy; -import tconstruct.entity.SlimeClone; import tconstruct.entity.projectile.ArrowEntity; import tconstruct.entity.projectile.DaggerEntity; import tconstruct.entity.projectile.LaunchedPotion; @@ -458,7 +459,6 @@ public class TContent implements IFuelHandler EntityRegistry.registerModEntity(SlimeClone.class, "SlimeClone", 10, TConstruct.instance, 32, 3, true); EntityRegistry.registerModEntity(Automaton.class, "Automaton", 11, TConstruct.instance, 64, 3, true); EntityRegistry.registerModEntity(BlueSlime.class, "EdibleSlime", 12, TConstruct.instance, 64, 5, true); - EntityRegistry.registerModEntity(MiniGardy.class, "MiniGardy", 13, TConstruct.instance, 64, 3, true); //EntityRegistry.registerModEntity(MetalSlime.class, "MetalSlime", 13, TConstruct.instance, 64, 5, true); /*BiomeGenBase[] plains = BiomeDictionary.getBiomesForType(BiomeDictionary.Type.PLAINS); diff --git a/src/tconstruct/common/TProxyCommon.java b/src/tconstruct/common/TProxyCommon.java index 5d67f253..ca63c81c 100644 --- a/src/tconstruct/common/TProxyCommon.java +++ b/src/tconstruct/common/TProxyCommon.java @@ -1,16 +1,16 @@ package tconstruct.common; +import bastion.entity.friendly.GardeSlime; +import bastion.inventory.MiniGardyContainer; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import tconstruct.TConstruct; import tconstruct.blocks.logic.TileEntityLandmine; -import tconstruct.entity.MiniGardy; import tconstruct.inventory.ArmorExtendedContainer; import tconstruct.inventory.ContainerLandmine; import tconstruct.inventory.KnapsackContainer; -import tconstruct.inventory.MiniGardyContainer; import tconstruct.library.blocks.InventoryLogic; import tconstruct.util.player.TPlayerStats; import cpw.mods.fml.common.network.IGuiHandler; @@ -37,7 +37,6 @@ public class TProxyCommon implements IGuiHandler public static int armorGuiID = 101; public static int knapsackGuiID = 102; - public static int miniGardyGui = 131; public static int manualGuiID = -1; @@ -77,18 +76,6 @@ public class TProxyCommon implements IGuiHandler TPlayerStats stats = TConstruct.playerTracker.getPlayerStats(player.username); return new KnapsackContainer(player.inventory, stats.knapsack); } - if (ID == miniGardyGui) - { - for (Object o : world.loadedEntityList) - { - Entity entity = (Entity) o; - if (entity.entityId == x) - { - return new MiniGardyContainer(player.inventory, (MiniGardy) entity); - } - } - return null; - } } return null; } diff --git a/src/tconstruct/entity/Automaton.java b/src/tconstruct/entity/Automaton.java deleted file mode 100644 index 74001cbe..00000000 --- a/src/tconstruct/entity/Automaton.java +++ /dev/null @@ -1,76 +0,0 @@ -package tconstruct.entity; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import tconstruct.entity.ai.GAIAttackTarget; -import tconstruct.entity.ai.GAIFindTarget; -import tconstruct.entity.ai.GAIFollowOwner; - -public class Automaton extends GolemBase -{ - int state; - - /*TaskBase currentTask; - HashMap taskList = new HashMap();*/ - - public Automaton(World world) - { - super(world); - this.setSize(0.9F, 2.42F); - //this.texture = "/mods/tinker/textures/mob/crystalguardamber.png"; - this.tasks.addTask(1, new GAIAttackTarget(this)); - this.tasks.addTask(2, new GAIFindTarget(this)); - this.tasks.addTask(3, new GAIFollowOwner(this)); - - /*taskList.put("wait", new TaskWait(this)); - TaskBase task = new TaskClearcut(this); - taskList.put("clearcut", task); - currentTask = task;*/ - } - - /*@Override - public void initCreature () - { - baseAttack = 5; - maxHealth = 50; - }*/ - - /*@Override - public void updateAITick() - { - if (!currentTask.update()) - { - currentTask.finishTask(); - } - }*/ - - protected String getHurtSound () - { - return "mob.irongolem.hit"; - } - - /** - * Returns the sound this mob makes on death. - */ - protected String getDeathSound () - { - return "mob.irongolem.death"; - } - - /** - * Plays step sound at given x, y, z for the entity - */ - protected void playStepSound (int par1, int par2, int par3, int par4) - { - this.playSound("mob.irongolem.walk", 1.0F, 1.0F); - } - - public boolean interact (EntityPlayer par1EntityPlayer) - { - ItemStack equipped = par1EntityPlayer.getCurrentEquippedItem(); - if (equipped != null) - this.setCurrentItemOrArmor(0, equipped.copy()); - return true; - } -} diff --git a/src/tconstruct/entity/GolemBase.java b/src/tconstruct/entity/GolemBase.java deleted file mode 100644 index aad426b2..00000000 --- a/src/tconstruct/entity/GolemBase.java +++ /dev/null @@ -1,623 +0,0 @@ -package tconstruct.entity; - -import java.lang.ref.WeakReference; -import java.util.Iterator; -import java.util.List; -import java.util.Random; - -import net.minecraft.crash.CrashReport; -import net.minecraft.crash.CrashReportCategory; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.Icon; -import net.minecraft.util.ReportedException; -import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class GolemBase extends EntityCreature implements IInventory -{ - public WeakReference leader; //Monster - public String ownerName = ""; //Player - public int maxHealth = 20; - public int baseAttack; - public boolean paused; - int useTime; - protected static Random rand = new Random(); - //public static CoordTuple target; - public int targetX; - public int targetY; - public int targetZ; - public boolean targetLock; - - public ItemStack[] inventory; - - public GolemBase(World world) - { - super(world); - setupInventory(); - //setCanPickUpLoot(true); - } - - public void setupInventory () - { - inventory = new ItemStack[0]; - } - - /*@Override - public int getMaxHealth () - { - //Workaround for dying on spawn - if (maxHealth == 0) - return 20; - - return maxHealth; - } - - @Override - public void initCreature () - { - baseAttack = 3; - paused = false; - }*/ - - public EntityLivingBase getOwner () - { - if (leader == null || leader.get() == null) - return this.worldObj.getPlayerEntityByName(ownerName); - return leader.get(); - } - - public void setOwner (EntityLivingBase living) - { - if (living instanceof EntityPlayer) - ownerName = ((EntityPlayer) living).username; - else - leader = new WeakReference(living); - } - - public boolean isOwner (Entity entity) - { - if (entity == null) - { - return false; - } - if (entity instanceof EntityPlayer) - { - EntityPlayer entityplayer = (EntityPlayer) entity; - return entityplayer.username.equalsIgnoreCase(ownerName); - } - return false; - } - - public float getSpeed () - { - return 0.25f; - } - - /* AI */ - - @Override - protected boolean isAIEnabled () - { - return true; - } - - public void updateWanderPath () - { - if (!paused) - super.updateWanderPath(); - } - - public boolean standby () - { - return false; - } - - public boolean following () - { - return false; - } - - public boolean patrolling () - { - return true; - } - - public void attackEntityAsGolem (Entity target) - { - /*ItemStack stack = getHeldItem(); - if (stack == null) - target.attackEntityFrom(DamageSource.causeMobDamage(this), baseAttack); - - else if (stack.getItem() instanceof ToolCore) - { - if (stack.hasTagCompound()) - { - AbilityHelper.onLeftClickEntity(stack, this, target, (ToolCore) stack.getItem(), baseAttack); - } - else - target.attackEntityFrom(DamageSource.causeMobDamage(this), baseAttack); - } - else - { - if (target.canAttackWithItem()) - { - if (!target.func_85031_j(this)) - { - int i = stack.getDamageVsEntity(target) + baseAttack; - - if (this.isPotionActive(Potion.damageBoost)) - { - i += 3 << this.getActivePotionEffect(Potion.damageBoost).getAmplifier(); - } - - if (this.isPotionActive(Potion.weakness)) - { - i -= 2 << this.getActivePotionEffect(Potion.weakness).getAmplifier(); - } - - int j = 0; - int k = 0; - - if (target instanceof EntityLivingBase) - { - k = EnchantmentHelper.getEnchantmentModifierLiving(this, (EntityLivingBase) target); - j += EnchantmentHelper.getKnockbackModifier(this, (EntityLivingBase) target); - } - - if (this.isSprinting()) - { - ++j; - } - - if (i > 0 || k > 0) - { - boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.isOnLadder() && !this.isInWater() && !this.isPotionActive(Potion.blindness) && this.ridingEntity == null - && target instanceof EntityLivingBase; - - if (flag && i > 0) - { - i += this.rand.nextInt(i / 2 + 2); - } - - i += k; - boolean flag1 = false; - int l = EnchantmentHelper.getFireAspectModifier(this); - - if (target instanceof EntityLivingBase && l > 0 && !target.isBurning()) - { - flag1 = true; - target.setFire(1); - } - - boolean flag2 = target.attackEntityFrom(DamageSource.causeMobDamage(this), i); - - if (flag2) - { - if (j > 0) - { - target.addVelocity((double) (-MathHelper.sin(this.rotationYaw * (float) Math.PI / 180.0F) * (float) j * 0.5F), 0.1D, - (double) (MathHelper.cos(this.rotationYaw * (float) Math.PI / 180.0F) * (float) j * 0.5F)); - this.motionX *= 0.6D; - this.motionZ *= 0.6D; - this.setSprinting(false); - } - this.setLastAttackingEntity(target); - - if (target instanceof EntityLivingBase) - { - EnchantmentThorns.func_92096_a(this, (EntityLivingBase) target, this.rand); - } - } - - //ItemStack stack = this.getCurrentEquippedItem(); - Object object = target; - - if (target instanceof EntityDragonPart) - { - IEntityMultiPart ientitymultipart = ((EntityDragonPart) target).entityDragonObj; - - if (ientitymultipart != null && ientitymultipart instanceof EntityLivingBase) - { - object = (EntityLivingBase) ientitymultipart; - } - } - - if (stack != null && object instanceof EntityLivingBase) - { - //stack.hitEntity((EntityLiving)object, this); - Item.itemsList[stack.itemID].hitEntity(stack, (EntityLivingBase) object, this); - - if (stack.stackSize <= 0) - { - this.destroyCurrentEquippedItem(); - } - } - - if (target instanceof EntityLivingBase) - { - - if (l > 0 && flag2) - { - target.setFire(l * 4); - } - else if (flag1) - { - target.extinguish(); - } - } - - //this.addExhaustion(0.3F); - } - } - } - }*/ - } - - public void teleport (double x, double y, double z) - { - this.setPosition(x, y, z); - worldObj.playSoundAtEntity(this, "mob.endermen.portal", 0.5F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); - } - - /* Other */ - protected boolean canDespawn () - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public Icon getItemIcon (ItemStack par1ItemStack, int par2) - { - Icon icon = super.getItemIcon(par1ItemStack, par2); - if (par1ItemStack.getItem().requiresMultipleRenderPasses()) - { - return par1ItemStack.getItem().getIcon(par1ItemStack, par2); - } - - return icon; - } - - /* Inventory */ - - @Override - public void onLivingUpdate () - { - super.onLivingUpdate(); - if (!this.worldObj.isRemote && !this.dead && this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing")) - { - List list = this.worldObj.getEntitiesWithinAABB(EntityItem.class, this.boundingBox.expand(1.5D, 0.0D, 1.5D)); - Iterator iterator = list.iterator(); - - while (iterator.hasNext()) - { - EntityItem entityitem = (EntityItem) iterator.next(); - - if (!entityitem.isDead && entityitem.getEntityItem() != null) - { - ItemStack itemstack = entityitem.getEntityItem(); - if (addItemStackToInventory(itemstack)) - { - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); - entityitem.setDead(); - } - } - } - } - } - - @Override - public ItemStack getStackInSlot (int slot) - { - if (slot < 0 || slot >= inventory.length) - return null; - return inventory[slot]; - } - - public boolean isStackInSlot (int slot) - { - if (slot < 0 || slot >= inventory.length) - return false; - return inventory[slot] != null; - } - - @Override - public int getSizeInventory () - { - return inventory.length; - } - - @Override - public int getInventoryStackLimit () - { - return 64; - } - - @Override - public void setInventorySlotContents (int slot, ItemStack itemstack) - { - inventory[slot] = itemstack; - if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) - { - itemstack.stackSize = getInventoryStackLimit(); - } - } - - @Override - public ItemStack decrStackSize (int slot, int quantity) - { - if (inventory[slot] != null) - { - if (inventory[slot].stackSize <= quantity) - { - ItemStack stack = inventory[slot]; - inventory[slot] = null; - return stack; - } - ItemStack split = inventory[slot].splitStack(quantity); - if (inventory[slot].stackSize == 0) - { - inventory[slot] = null; - } - return split; - } - else - { - return null; - } - } - - /* Inventory Management */ - - public boolean addItemStackToInventory (ItemStack par1ItemStack) - { - if (par1ItemStack == null) - { - return false; - } - else - { - try - { - int i; - - if (par1ItemStack.isItemDamaged()) - { - i = this.getFirstEmptyStack(); - - if (i >= 0) - { - this.inventory[i] = ItemStack.copyItemStack(par1ItemStack); - this.inventory[i].animationsToGo = 5; - par1ItemStack.stackSize = 0; - return true; - } - else - { - return false; - } - } - else - { - do - { - i = par1ItemStack.stackSize; - par1ItemStack.stackSize = this.storePartialItemStack(par1ItemStack); - } while (par1ItemStack.stackSize > 0 && par1ItemStack.stackSize < i); - - return par1ItemStack.stackSize < i; - } - } - catch (Throwable throwable) - { - CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Adding item to inventory"); - CrashReportCategory crashreportcategory = crashreport.makeCategory("Item being added"); - crashreportcategory.addCrashSection("Item ID", Integer.valueOf(par1ItemStack.itemID)); - crashreportcategory.addCrashSection("Item data", Integer.valueOf(par1ItemStack.getItemDamage())); - throw new ReportedException(crashreport); - } - } - } - - public int getFirstEmptyStack () //Equipped? - { - for (int i = 0; i < this.inventory.length; ++i) - { - if (this.inventory[i] == null) - { - return i; - } - } - - return -1; - } - - private int storePartialItemStack (ItemStack par1ItemStack) - { - int i = par1ItemStack.itemID; - int j = par1ItemStack.stackSize; - int k; - - if (par1ItemStack.getMaxStackSize() == 1) - { - k = this.getFirstEmptyStack(); - - if (k < 0) - { - return j; - } - else - { - if (this.inventory[k] == null) - { - this.inventory[k] = ItemStack.copyItemStack(par1ItemStack); - } - - return 0; - } - } - else - { - k = this.storeItemStack(par1ItemStack); - - if (k < 0) - { - k = this.getFirstEmptyStack(); - } - - if (k < 0) - { - return j; - } - else - { - if (this.inventory[k] == null) - { - this.inventory[k] = new ItemStack(i, 0, par1ItemStack.getItemDamage()); - - if (par1ItemStack.hasTagCompound()) - { - this.inventory[k].setTagCompound((NBTTagCompound) par1ItemStack.getTagCompound().copy()); - } - } - - int l = j; - - if (j > this.inventory[k].getMaxStackSize() - this.inventory[k].stackSize) - { - l = this.inventory[k].getMaxStackSize() - this.inventory[k].stackSize; - } - - if (l > this.getInventoryStackLimit() - this.inventory[k].stackSize) - { - l = this.getInventoryStackLimit() - this.inventory[k].stackSize; - } - - if (l == 0) - { - return j; - } - else - { - j -= l; - this.inventory[k].stackSize += l; - this.inventory[k].animationsToGo = 5; - return j; - } - } - } - } - - private int storeItemStack (ItemStack par1ItemStack) - { - for (int i = 0; i < this.inventory.length; ++i) - { - if (this.inventory[i] != null && this.inventory[i].itemID == par1ItemStack.itemID && this.inventory[i].isStackable() && this.inventory[i].stackSize < this.inventory[i].getMaxStackSize() - && this.inventory[i].stackSize < this.getInventoryStackLimit() && (!this.inventory[i].getHasSubtypes() || this.inventory[i].getItemDamage() == par1ItemStack.getItemDamage()) - && ItemStack.areItemStackTagsEqual(this.inventory[i], par1ItemStack)) - { - return i; - } - } - - return -1; - } - - /* Misc */ - - @Override - public String getInvName () - { - return "golem.none"; - } - - @Override - public boolean isInvNameLocalized () - { - return false; - } - - @Override - public void onInventoryChanged () - { - - } - - public ItemStack getStackInSlotOnClosing (int slot) - { - return null; - } - - public void openChest () - { - } - - public void closeChest () - { - } - - @Override - public boolean isItemValidForSlot (int i, ItemStack itemstack) - { - return true; - } - - @Override - public boolean isUseableByPlayer (EntityPlayer entityplayer) - { - return true; - } - - public void destroyCurrentEquippedItem () - { - worldObj.playSoundAtEntity(this, "random.break", 0.5F, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F); - this.setCurrentItemOrArmor(0, null); - } - - /* Saving */ - public void writeEntityToNBT (NBTTagCompound tags) - { - super.writeEntityToNBT(tags); - tags.setString("OwnerName", ownerName); - NBTTagList nbttaglist = new NBTTagList(); - for (int iter = 0; iter < inventory.length; iter++) - { - if (inventory[iter] != null) - { - NBTTagCompound tagList = new NBTTagCompound(); - tagList.setByte("Slot", (byte) iter); - inventory[iter].writeToNBT(tagList); - nbttaglist.appendTag(tagList); - } - } - - tags.setTag("Items", nbttaglist); - - } - - public void readEntityFromNBT (NBTTagCompound tags) - { - super.readEntityFromNBT(tags); - ownerName = tags.getString("OwnerName"); - NBTTagList nbttaglist = tags.getTagList("Items"); - inventory = new ItemStack[getSizeInventory()]; - for (int iter = 0; iter < nbttaglist.tagCount(); iter++) - { - NBTTagCompound tagList = (NBTTagCompound) nbttaglist.tagAt(iter); - byte slotID = tagList.getByte("Slot"); - if (slotID >= 0 && slotID < inventory.length) - { - inventory[slotID] = ItemStack.loadItemStackFromNBT(tagList); - } - } - } -} diff --git a/src/tconstruct/entity/MiniGardy.java b/src/tconstruct/entity/MiniGardy.java deleted file mode 100644 index 7181b0b0..00000000 --- a/src/tconstruct/entity/MiniGardy.java +++ /dev/null @@ -1,71 +0,0 @@ -package tconstruct.entity; - -import tconstruct.TConstruct; -import tconstruct.common.TProxyCommon; -import tconstruct.entity.ai.GAIFellTree; -import tconstruct.entity.ai.GAIFollowOwner; -import tconstruct.entity.ai.GAISwim; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -public class MiniGardy extends GolemBase -{ - public MiniGardy(World world) - { - super(world); - //this.texture = "/mods/tinker/textures/mob/googirl.png"; - this.setSize(0.375F, 0.875F); - this.tasks.addTask(1, new GAISwim(this)); - this.tasks.addTask(8, new GAIFellTree(this)); - this.tasks.addTask(10, new GAIFollowOwner(this)); - } - - @Override - public void setupInventory () - { - inventory = new ItemStack[14]; - } - - @SideOnly(Side.CLIENT) - public float getShadowSize () //Opacity, not size - { - return 1.0F; - } - - public boolean interact (EntityPlayer player) - { - if (player.isSneaking()) - { - if (!worldObj.isRemote) - player.openGui(TConstruct.instance, TProxyCommon.miniGardyGui, this.worldObj, this.entityId, 0, 0); - return true; - //return false; - } - else - { - ItemStack stack = this.getHeldItem(); - if (stack == null) - { - ItemStack playerStack = player.getCurrentEquippedItem(); - if (playerStack != null) - { - this.setCurrentItemOrArmor(0, playerStack.copy()); - player.destroyCurrentEquippedItem(); - } - } - else - { - if (player.inventory.addItemStackToInventory(stack.copy())) - { - //this.worldObj.playSoundAtEntity(this, par1Str, par2, par3); - this.worldObj.playSoundAtEntity(player, "random.pop", 0.3F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); - this.setCurrentItemOrArmor(0, null); - } - } - return true; - } - } -} diff --git a/src/tconstruct/entity/SlimeClone.java b/src/tconstruct/entity/SlimeClone.java deleted file mode 100644 index 0158391b..00000000 --- a/src/tconstruct/entity/SlimeClone.java +++ /dev/null @@ -1,175 +0,0 @@ -package tconstruct.entity; - -import tconstruct.TConstruct; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.util.MathHelper; -import net.minecraft.world.World; -import net.minecraftforge.common.ForgeHooks; - -import com.google.common.io.ByteArrayDataInput; -import com.google.common.io.ByteArrayDataOutput; - -import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData; - -public class SlimeClone extends GolemBase implements IEntityAdditionalSpawnData -{ - public float sizeOffset; - public float sizeFactor; - public float sizeHeight; - public String username = ""; - public String skinUrl = ""; - - public SlimeClone(World world) - { - super(world); - //this.texture = "/mob/char.png"; - } - - public SlimeClone(World world, String username) - { - this(world); - this.username = username; - } - - /*@Override - public void initCreature () - { - maxHealth = 100; - //health = 100; - baseAttack = 3; - paused = false; - }*/ - - public void onUpdate () - { - if (!this.worldObj.isRemote && this.worldObj.difficultySetting == 0 && this.getSlimeSize() > 0) - { - this.isDead = true; - } - - this.sizeFactor += (this.sizeOffset - this.sizeFactor) * 0.5F; - this.sizeHeight = this.sizeFactor; - boolean flag = this.onGround; - super.onUpdate(); - float i; - - if (this.onGround && !flag) - { - i = this.getSlimeSize(); - - for (int j = 0; j < i * 8; ++j) - { - float f = this.rand.nextFloat() * (float) Math.PI * 2.0F; - float offset = this.rand.nextFloat() * 0.5F + 0.5F; - float xPos = MathHelper.sin(f) * (float) i * 0.5F * offset; - float zPos = MathHelper.cos(f) * (float) i * 0.5F * offset; - TConstruct.proxy.spawnParticle(this.getSlimeParticle(), this.posX + (double) xPos, this.boundingBox.minY, this.posZ + (double) zPos, 0.0D, 0.0D, 0.0D); - } - - if (this.makesSoundOnLand()) - { - this.playSound(this.getJumpSound(), this.getSoundVolume(), ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F) / 0.8F); - } - - this.sizeOffset = -0.5F; - } - else if (!this.onGround && flag) - { - this.sizeOffset = 1.0F; - } - - this.func_70808_l(); - - if (this.worldObj.isRemote) - { - i = this.getSlimeSize(); - this.setSize(0.6F * (float) i, 0.6F * (float) i); - } - } - - protected void func_70808_l () - { - this.sizeOffset *= 0.6F; - } - - protected String getJumpSound () - { - return "mob.slime." + (this.getSlimeSize() > 1 ? "big" : "small"); - } - - public void jump () - { - this.motionY = 0.05 * getSlimeSize() + 0.37; - - if (this.isPotionActive(Potion.jump)) - { - this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F); - } - - if (this.isSprinting()) - { - float f = this.rotationYaw * 0.017453292F; - this.motionX -= (double) (MathHelper.sin(f) * 0.2F); - this.motionZ += (double) (MathHelper.cos(f) * 0.2F); - } - - this.isAirBorne = true; - ForgeHooks.onLivingJump(this); - } - - protected void fall (float par1) - { - } - - protected String getSlimeParticle () - { - return "blueslime"; - } - - public float getSlimeSize () - { - return 1.5f; - } - - /** - * Returns true if the slime makes a sound when it jumps (based upon the slime's size) - */ - protected boolean makesSoundOnJump () - { - return this.getSlimeSize() > 0; - } - - /** - * Returns true if the slime makes a sound when it lands after a jump (based upon the slime's size) - */ - protected boolean makesSoundOnLand () - { - return this.getSlimeSize() > 2; - } - - public void writeEntityToNBT (NBTTagCompound tags) - { - super.writeEntityToNBT(tags); - tags.setString("Username", username); - } - - public void readEntityFromNBT (NBTTagCompound tags) - { - super.readEntityFromNBT(tags); - username = tags.getString("Username"); - } - - @Override - public void writeSpawnData (ByteArrayDataOutput data) - { - data.writeUTF(username); - } - - @Override - public void readSpawnData (ByteArrayDataInput data) - { - username = data.readUTF(); - skinUrl = "http://skins.minecraft.net/MinecraftSkins/" + username + ".png"; - } -} diff --git a/src/tconstruct/entity/ai/GAIAttackTarget.java b/src/tconstruct/entity/ai/GAIAttackTarget.java deleted file mode 100644 index 91cf7c1a..00000000 --- a/src/tconstruct/entity/ai/GAIAttackTarget.java +++ /dev/null @@ -1,138 +0,0 @@ -package tconstruct.entity.ai; - -import tconstruct.entity.GolemBase; -import net.minecraft.entity.EntityList; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.pathfinding.PathNavigate; - -public class GAIAttackTarget extends GolemAIBase -{ - private PathNavigate pathfinder; - private EntityLivingBase theTarget; - private float speed; - private int counter; - private boolean avoidsWater = true; - - //public static String targetEntityRegex; - - public GAIAttackTarget(GolemBase doll) - { - super(doll); - this.speed = doll.getSpeed(); - this.pathfinder = doll.getNavigator(); - this.setMutexBits(3); - } - - @Override - public boolean shouldExecute () - { - if (golem.paused) - { - return false; - } - /*if (golem.isStandbyMode() || golem.isRideonMode()) - { - return false; - } - if (golem.getDollID() != DollRegistry.getDollID("Shanghai")) - { - return false; - }*/ - theTarget = golem.getAttackTarget(); - if (theTarget == null) - { - return false; - } - - String name = EntityList.getEntityString(theTarget); - if (name == null) - { - return false; - } - - /*Pattern targetPattern = Pattern.compile(targetEntityRegex); - Matcher targetMatcher = targetPattern.matcher(name); - - if (!targetMatcher.find()) - { - return false; - }*/ - - return true; - } - - @Override - public void startExecuting () - { - counter = 0; - this.avoidsWater = this.golem.getNavigator().getAvoidsWater(); - this.golem.getNavigator().setAvoidsWater(true); - } - - @Override - public boolean continueExecuting () - { - /* if (!golem.isEnable()) - { - return false; - } - if (golem.isStandbyMode() || golem.isRideonMode()) - { - return false; - }*/ - if (this.pathfinder.noPath()) - { - return false; - } - if (this.theTarget == null) - { - return false; - } - if (!this.theTarget.isEntityAlive()) - { - return false; - } - return true; - } - - @Override - public void resetTask () - { - this.theTarget = null; - this.pathfinder.clearPathEntity(); - this.golem.getNavigator().setAvoidsWater(this.avoidsWater); - } - - @Override - public void updateTask () - { - if (!this.pathfinder.noPath()) - { - this.golem.getLookHelper().setLookPositionWithEntity(this.theTarget, 10.0F, (float) this.golem.getVerticalFaceSpeed()); - } - - if (--this.counter <= 0) - { - this.counter = 20; - - this.pathfinder.tryMoveToEntityLiving(this.theTarget, this.speed); - if (this.golem.getDistanceSqToEntity(this.theTarget) < 9f && this.golem.getEntitySenses().canSee(this.theTarget)) - { - if (this.golem.getHeldItem() != null) - { - this.golem.swingItem(); - } - //theTarget.attackEntityFrom(DamageSource.causeMobDamage(golem), attackStrength); - golem.attackEntityAsGolem(theTarget); - - /*if (golem.getOwner() != null) - { - theTarget.attackEntityFrom(DamageSource.causePlayerDamage(golem.getOwner()), attackStrength); - } - else - {*/ - //} - } - } - } -} diff --git a/src/tconstruct/entity/ai/GAIFellTree.java b/src/tconstruct/entity/ai/GAIFellTree.java deleted file mode 100644 index 53ce9485..00000000 --- a/src/tconstruct/entity/ai/GAIFellTree.java +++ /dev/null @@ -1,233 +0,0 @@ -package tconstruct.entity.ai; - -import tconstruct.entity.GolemBase; -import net.minecraft.block.Block; -import net.minecraft.block.StepSound; -import net.minecraft.util.MathHelper; - -public class GAIFellTree extends GolemAIBase -{ - private int counter; - private int logID; - private int blockStrength; - private int cutX, cutY, cutZ; - - public static int cutRange = 4; - public static double cutSpeed = 2.5; - - public GAIFellTree(GolemBase golem) - { - super(golem); - this.setMutexBits(3); - } - - @Override - public boolean shouldExecute () - { - if (golem.paused) - { - return false; - } - - int golemX = MathHelper.floor_double(golem.posX); - int golemY = MathHelper.floor_double(golem.posY + (double) golem.getEyeHeight()); - int golemZ = MathHelper.floor_double(golem.posZ); - int logCount = 0; - int leavesCount = 0; - int targetX = cutRange; - int targetY = 0; - int targetZ = cutRange; - boolean isTarget = false; - - for (int iterX = -cutRange; iterX <= cutRange; ++iterX) - { - for (int iterZ = -cutRange; iterZ <= cutRange; ++iterZ) - { - int dy = 0; - int distanceToBlock = Math.abs(iterX) + Math.abs(iterZ); - if (distanceToBlock > cutRange) - { - continue; - } - int bid = world.getBlockId(golemX + iterX, golemY + dy, golemZ + iterZ); - Block log = Block.blocksList[bid]; - if (log == null) - { - continue; - } - - if (log.isWood(world, golemX + iterX, golemY + dy, golemZ + iterZ)) - { - if (Math.abs(targetX) + Math.abs(targetZ) > distanceToBlock) - { - - while (golemY + dy > 0) - { - int cbid = world.getBlockId(golemX + iterX, golemY + dy - 1, golemZ + iterZ); - if (cbid != bid) - { - break; - } - --dy; - } - int lCount = 0; - int blockCount = 0; - while (golemY + dy < world.getHeight()) - { - int cbid = world.getBlockId(golemX + iterX, golemY + dy, golemZ + iterZ); - if (cbid != bid) - { - break; - } - - int[][] coords = new int[][] { { golemX + iterX + 1, golemY + dy, golemZ + iterZ }, { golemX + iterX - 1, golemY + dy, golemZ + iterZ }, - { golemX + iterX, golemY + dy, golemZ + iterZ + 1 }, { golemX + iterX, golemY + dy, golemZ + iterZ - 1 } }; - for (int i = 0; i < 4; ++i) - { - Block leaves = Block.blocksList[world.getBlockId(coords[i][0], coords[i][1], coords[i][2])]; - if (leaves != null && leaves.isLeaves(world, coords[i][0], coords[i][1], coords[i][2])) - { - blockCount++; - } - } - ++lCount; - ++dy; - } - - if (blockCount >= 4) - { - targetX = iterX; - targetY = dy - 1; - targetZ = iterZ; - isTarget = true; - logCount = blockCount; - leavesCount = lCount; - logID = bid; - } - } - } - } - } - golem.targetX = golemX + targetX; - golem.targetY = golemY + targetY; - golem.targetZ = golemZ + targetZ; - golem.targetLock = isTarget; - - if (!isTarget) - { - return false; - } - - golem.teleport((double) (golem.targetX) + 0.5D, (double) (golem.targetY + 1), (double) (golem.targetZ) + 0.5D); - golem.getNavigator().clearPathEntity(); - - return true; - } - - public void startExecuting () - { - counter = 0; - } - - public boolean continueExecuting () - { - if (golem.paused) - { - return false; - } - if (Math.abs(MathHelper.floor_double(golem.posX - golem.targetX)) + Math.abs(MathHelper.floor_double(golem.posY - golem.targetY)) - + Math.abs(MathHelper.floor_double(golem.posZ - golem.targetZ)) > cutRange) - { - System.out.println("Too far away"); - return false; - } - if (!golem.targetLock) - { - System.out.println("Target lost"); - return false; - } - return true; - } - - @Override - public void resetTask () - { - golem.targetLock = false; - } - - @Override - public void updateTask () - { - if (counter == 0) - { - boolean isCutting = false; - for (int dx = -cutRange; dx <= cutRange; ++dx) - { - for (int dz = -cutRange; dz <= cutRange; ++dz) - { - if (Math.abs(dx) + Math.abs(dz) > cutRange) - { - continue; - } - if (world.getBlockId(golem.targetX + dx, golem.targetY, golem.targetZ + dz) == logID) - { - cutX = golem.targetX + dx; - cutY = golem.targetY; - cutZ = golem.targetZ + dz; - isCutting = true; - } - if (isCutting) - { - break; - } - } - if (isCutting) - { - break; - } - } - if (!isCutting) - { - cutX = golem.targetX; - cutY = golem.targetY; - cutZ = golem.targetZ; - golem.targetY--; - if (world.getBlockId(golem.targetX, golem.targetY, golem.targetZ) == logID) - { - isCutting = true; - } - else - { - golem.targetLock = isCutting = false; - return; - } - } - - Block b = Block.blocksList[world.getBlockId(cutX, cutY, cutZ)]; - blockStrength = b == null ? 0 : MathHelper.floor_double(1.0 + 30.0 * b.getBlockHardness(world, cutX, cutY, cutZ) / cutSpeed); - blockStrength = blockStrength < 0 ? 0 : blockStrength; - } - - if (counter >= blockStrength) - { - Block b = Block.blocksList[world.getBlockId(cutX, cutY, cutZ)]; - if (b != null) - { - world.destroyBlock(cutX, cutY, cutZ, true); - } - counter = 0; - return; - } - if (counter % 4 == 0) - { - Block b = Block.blocksList[world.getBlockId(golem.targetX, golem.targetY, golem.targetZ)]; - if (b != null) - { - StepSound stepsound = b.stepSound; - world.playSoundEffect(golem.targetX + 0.5f, golem.targetY + 0.5f, golem.targetZ + 0.5f, stepsound.getBreakSound(), (stepsound.getVolume() + 1.0f) / 8f, stepsound.getPitch() * 0.5f); - } - } - this.golem.getLookHelper().setLookPosition((double) (cutX) + 0.5D, (double) (cutY) + 0.5D, (double) (cutZ) + 0.5D, 20.0F, (float) this.golem.getVerticalFaceSpeed()); - counter++; - } -} diff --git a/src/tconstruct/entity/ai/GAIFindTarget.java b/src/tconstruct/entity/ai/GAIFindTarget.java deleted file mode 100644 index 673413fd..00000000 --- a/src/tconstruct/entity/ai/GAIFindTarget.java +++ /dev/null @@ -1,167 +0,0 @@ -package tconstruct.entity.ai; - -import java.util.List; - -import tconstruct.entity.GolemBase; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityCreature; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.monster.EntityIronGolem; -import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.passive.EntityMooshroom; -import net.minecraft.entity.passive.EntitySheep; - -public class GAIFindTarget extends GolemAIBase -{ - private int counter; - public static double searchRange = 16; - public static double searchHeight = 4; - - public GAIFindTarget(GolemBase golem) - { - super(golem); - this.setMutexBits(8); - } - - public boolean shouldExecute () - { - if (golem.paused) - { - return false; - } - return true; - } - - public void startExecuting () - { - counter = 0; - } - - public boolean continueExecuting () - { - return !golem.paused; - } - - public void updateTask () - { - if (counter == 0) - { - List targetList = (List) (world.getEntitiesWithinAABB(EntityLiving.class, golem.boundingBox.expand(searchRange, searchHeight, searchRange))); - EntityLiving theTarget = null; - EntityLiving stealTarget = null; - - theTarget = null; - for (EntityLiving e : targetList) - { - if (golem.patrolling()) - { - if (e instanceof IMob) - { - if (theTarget == null) - { - theTarget = e; - } - else - { - if (golem.getDistanceSqToEntity(theTarget) > golem.getDistanceSqToEntity(e)) - { - theTarget = e; - } - } - } - } - - if (golem.following()) - { - Entity tt = null; - if (e instanceof EntityCreature) - { - tt = ((EntityCreature) e).getEntityToAttack(); - } - else - { - tt = e.getAttackTarget(); - } - if (golem.isOwner(tt)) - { - if (theTarget == null) - { - theTarget = e; - } - else - { - if (golem.getDistanceSqToEntity(theTarget) > golem.getDistanceSqToEntity(e)) - { - theTarget = e; - } - } - } - } - - if (golem.patrolling()) - { - if (e instanceof EntitySheep) - { - EntitySheep sheep = (EntitySheep) e; - - if (!sheep.getSheared() && !sheep.isChild()) - { - if (stealTarget == null) - { - stealTarget = e; - } - else - { - if (golem.getDistanceSqToEntity(stealTarget) > golem.getDistanceSqToEntity(e)) - { - stealTarget = e; - } - } - } - } - else if (e instanceof EntityChicken || e instanceof EntityMooshroom || e instanceof EntityIronGolem) - { - if (stealTarget == null) - { - stealTarget = e; - } - else - { - if (golem.getDistanceSqToEntity(stealTarget) > golem.getDistanceSqToEntity(e)) - { - stealTarget = e; - } - } - } - } - } - - /*StringBuffer msg = new StringBuffer(golem.getDollName() + " : "); - - if (entityCount.isEmpty()) - { - msg.append("No target"); - golem.chatMessage(msg.toString(), 2); - } - else - { - Iterator it = entityCount.keySet().iterator(); - while (it.hasNext()) - { - String s = (String) it.next(); - int v = entityCount.get(s).intValue(); - msg.append(s); - msg.append("["); - msg.append(v); - msg.append("] "); - } - golem.chatMessage(msg.toString(), 1); - }*/ - - golem.setAttackTarget(theTarget == null ? stealTarget : theTarget); - } - counter = (counter + 1) % 20; - } -} diff --git a/src/tconstruct/entity/ai/GAIFollowOwner.java b/src/tconstruct/entity/ai/GAIFollowOwner.java deleted file mode 100644 index cb64969a..00000000 --- a/src/tconstruct/entity/ai/GAIFollowOwner.java +++ /dev/null @@ -1,106 +0,0 @@ -package tconstruct.entity.ai; - -import tconstruct.entity.GolemBase; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.pathfinding.PathNavigate; -import net.minecraft.util.MathHelper; - -public class GAIFollowOwner extends GolemAIBase -{ - private EntityLivingBase leader; - private float speed; - private float maxDist; - private float minDist; - private PathNavigate pathfinder; - private boolean avoidsWater; - private int counter; - - public GAIFollowOwner(GolemBase golem) - { - super(golem); - this.speed = golem.getSpeed(); - this.minDist = 4.0f; - this.maxDist = 2.5f; - this.pathfinder = golem.getNavigator(); - this.setMutexBits(3); - } - - public boolean shouldExecute () - { - EntityLivingBase owner = this.golem.getOwner(); - - if (owner == null) - { - return false; - } - if (this.golem.getDistanceSqToEntity(owner) < (double) (this.minDist * this.minDist)) - { - return false; - } - - this.leader = owner; - return true; - } - - public boolean continueExecuting () - { - if (this.pathfinder.noPath()) - { - return false; - } - if (this.golem.getDistanceSqToEntity(this.leader) < (double) (this.maxDist * this.maxDist)) - { - return false; - } - return true; - } - - public void startExecuting () - { - this.counter = 0; - this.avoidsWater = this.golem.getNavigator().getAvoidsWater(); - this.golem.getNavigator().setAvoidsWater(false); - } - - public void resetTask () - { - this.leader = null; - this.pathfinder.clearPathEntity(); - this.golem.getNavigator().setAvoidsWater(this.avoidsWater); - } - - public void updateTask () - { - this.golem.getLookHelper().setLookPositionWithEntity(this.leader, 10.0F, (float) this.golem.getVerticalFaceSpeed()); - - if (--this.counter <= 0) - { - this.counter = 10; - - if (!this.pathfinder.tryMoveToEntityLiving(this.leader, this.speed)) - { - if (this.golem.getDistanceSqToEntity(this.leader) >= 144.0D) - { - int var1 = MathHelper.floor_double(this.leader.posX) - 2; - int var2 = MathHelper.floor_double(this.leader.posZ) - 2; - int var3 = MathHelper.floor_double(this.leader.boundingBox.minY); - - for (int var4 = 0; var4 <= 4; ++var4) - { - for (int var5 = 0; var5 <= 4; ++var5) - { - if ((var4 < 1 || var5 < 1 || var4 > 3 || var5 > 3) && this.world.doesBlockHaveSolidTopSurface(var1 + var4, var3 - 1, var2 + var5) - && !this.world.isBlockNormalCube(var1 + var4, var3, var2 + var5) && !this.world.isBlockNormalCube(var1 + var4, var3 + 1, var2 + var5)) - { - this.golem.setLocationAndAngles((double) ((float) (var1 + var4) + 0.5F), (double) var3, (double) ((float) (var2 + var5) + 0.5F), this.golem.rotationYaw, - this.golem.rotationPitch); - this.pathfinder.clearPathEntity(); - return; - } - } - } - } - } - } - } -} diff --git a/src/tconstruct/entity/ai/GAISwim.java b/src/tconstruct/entity/ai/GAISwim.java deleted file mode 100644 index c46aa849..00000000 --- a/src/tconstruct/entity/ai/GAISwim.java +++ /dev/null @@ -1,38 +0,0 @@ -package tconstruct.entity.ai; - -import tconstruct.entity.GolemBase; - -public class GAISwim extends GolemAIBase -{ - public GAISwim(GolemBase golem) - { - super(golem); - this.setMutexBits(4); - golem.getNavigator().setCanSwim(true); - } - - public boolean shouldExecute () - { - if (golem.isInWater() || this.golem.handleLavaMovement()) - { - return true; - } - return false; - } - - /*public void startExecuting() - { - if(golem.standby()) - { - golem.setPatrolMode(); - } - }*/ - - public void updateTask () - { - if (this.golem.getRNG().nextFloat() < 0.8F) - { - this.golem.getJumpHelper().setJumping(); - } - } -} diff --git a/src/tconstruct/entity/ai/GolemAIBase.java b/src/tconstruct/entity/ai/GolemAIBase.java deleted file mode 100644 index 429d2608..00000000 --- a/src/tconstruct/entity/ai/GolemAIBase.java +++ /dev/null @@ -1,23 +0,0 @@ -package tconstruct.entity.ai; - -import tconstruct.entity.GolemBase; -import net.minecraft.entity.ai.EntityAIBase; -import net.minecraft.world.World; - -public class GolemAIBase extends EntityAIBase -{ - protected GolemBase golem; - protected World world; - - public GolemAIBase(GolemBase entity) - { - golem = entity; - world = entity.worldObj; - } - - @Override - public boolean shouldExecute () - { - return false; - } -} diff --git a/src/tconstruct/inventory/MiniGardyContainer.java b/src/tconstruct/inventory/MiniGardyContainer.java deleted file mode 100644 index 7f4cfa0d..00000000 --- a/src/tconstruct/inventory/MiniGardyContainer.java +++ /dev/null @@ -1,81 +0,0 @@ -package tconstruct.inventory; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; -import net.minecraft.item.ItemStack; -import tconstruct.entity.MiniGardy; - -public class MiniGardyContainer extends Container -{ - public MiniGardy gardy; - - public MiniGardyContainer(InventoryPlayer inventoryplayer, MiniGardy entity) - { - gardy = entity; - for (int column = 0; column < 2; column++) - { - for (int row = 0; row < 7; row++) - { - this.addSlotToContainer(new Slot(entity, row + column * 7, 44 + row * 18, 36 + column * 18)); - } - } - - /* Player inventory */ - for (int column = 0; column < 3; column++) - { - for (int row = 0; row < 9; row++) - { - this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 86 + column * 18)); - } - } - - for (int column = 0; column < 9; column++) - { - this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 144)); - } - } - - @Override - public boolean canInteractWith (EntityPlayer entityplayer) - { - return gardy.isUseableByPlayer(entityplayer); - } - - @Override - public ItemStack transferStackInSlot (EntityPlayer player, int slotID) - { - ItemStack stack = null; - Slot slot = (Slot) this.inventorySlots.get(slotID); - - if (slot != null && slot.getHasStack()) - { - ItemStack slotStack = slot.getStack(); - stack = slotStack.copy(); - - if (slotID < gardy.getSizeInventory()) - { - if (!this.mergeItemStack(slotStack, gardy.getSizeInventory(), this.inventorySlots.size(), true)) - { - return null; - } - } - else if (!this.mergeItemStack(slotStack, 0, gardy.getSizeInventory(), false)) - { - return null; - } - - if (slotStack.stackSize == 0) - { - slot.putStack((ItemStack) null); - } - else - { - slot.onSlotChanged(); - } - } - - return stack; - } -} diff --git a/test/XinStick.java b/test/XinStick.java index 62ef982a..3f263b96 100644 --- a/test/XinStick.java +++ b/test/XinStick.java @@ -8,7 +8,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.Icon; import net.minecraft.world.World; -import bastion.entity.WoodMinecartEntity; +import bastion.entity.friendly.GardeSlime; /* * mDiyo's development testing item @@ -32,8 +32,8 @@ public class XinStick extends Item public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player) { //clearInventoryExeptHotbar(player); - WoodMinecartEntity entity = new WoodMinecartEntity(world); - //entity.setOwner(player); + GardeSlime entity = new GardeSlime(world); + entity.setLeader(player); //entity.setCustomNameTag("Cutie"); spawnEntity(player.posX, player.posY + 1, player.posZ, entity, world, player); /*EntityChicken chicken = new EntityChicken(world);