diff options
Diffstat (limited to 'src/Java/gtPlusPlus')
14 files changed, 547 insertions, 480 deletions
diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index d22426246d..5ac47f085f 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -28,8 +28,6 @@ import gtPlusPlus.core.common.CommonProxy; import gtPlusPlus.core.config.ConfigHandler; import gtPlusPlus.core.handler.BookHandler; import gtPlusPlus.core.handler.Recipes.RegistrationHandler; -import gtPlusPlus.core.handler.analytics.SegmentAnalytics; -import gtPlusPlus.core.handler.analytics.SegmentHelper; import gtPlusPlus.core.handler.events.BlockEventHandler; import gtPlusPlus.core.handler.events.LoginEventHandler; import gtPlusPlus.core.handler.events.MissingMappingsEvent; @@ -166,14 +164,6 @@ public class GTplusplus implements ActionListener { @Mod.EventHandler public void serverStopping(final FMLServerStoppingEvent event) { - //Flush all data to Server at the end of the day. - if (SegmentAnalytics.sAnalyticsMasterList.size() > 0){ - for (SegmentAnalytics sa : SegmentAnalytics.sAnalyticsMasterList.values()){ - sa.flushDataFinal(); - SegmentAnalytics.LOG("Cleaned up Analytics Data for player "+sa.mLocalName+"."); - } - } - //Chunkload Handler if (ChunkManager.mChunkLoaderManagerMap.size() > 0) { Logger.INFO("Clearing Chunk Loaders."); @@ -250,15 +240,6 @@ public class GTplusplus implements ActionListener { } } - - private static final void initAnalytics(){ - SegmentAnalytics.isEnabled = CORE.ConfigSwitches.enableUpdateChecker; - if (!Utils.isServer() && PlayerUtils.isPlayerAlkalus()){ - SegmentAnalytics.isEnabled = true; - } - new SegmentHelper(); - } - private static final boolean setupMaterialBlacklist(){ Material.invalidMaterials.put(Materials._NULL); Material.invalidMaterials.put(Materials.Clay); diff --git a/src/Java/gtPlusPlus/core/client/model/ModelGiantChicken.java b/src/Java/gtPlusPlus/core/client/model/ModelGiantChicken.java new file mode 100644 index 0000000000..c0f5f79018 --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/model/ModelGiantChicken.java @@ -0,0 +1,102 @@ +package gtPlusPlus.core.client.model; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + +import net.minecraft.client.model.ModelChicken; +import net.minecraft.client.model.ModelRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.util.MathHelper; +import org.lwjgl.opengl.GL11; + +@SideOnly(Side.CLIENT) +public class ModelGiantChicken extends ModelChicken{ + + public ModelGiantChicken() + { + byte b0 = 16; + this.head = new ModelRenderer(this, 0, 0); + this.head.addBox(-2.0F, -6.0F, -2.0F, 4, 6, 3, 0.0F); + this.head.setRotationPoint(0.0F, (float)(-1 + b0), -4.0F); + this.bill = new ModelRenderer(this, 14, 0); + this.bill.addBox(-2.0F, -4.0F, -4.0F, 4, 2, 2, 0.0F); + this.bill.setRotationPoint(0.0F, (float)(-1 + b0), -4.0F); + this.chin = new ModelRenderer(this, 14, 4); + this.chin.addBox(-1.0F, -2.0F, -3.0F, 2, 2, 2, 0.0F); + this.chin.setRotationPoint(0.0F, (float)(-1 + b0), -4.0F); + this.body = new ModelRenderer(this, 0, 9); + this.body.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F); + this.body.setRotationPoint(0.0F, (float)b0, 0.0F); + this.rightLeg = new ModelRenderer(this, 26, 0); + this.rightLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.rightLeg.setRotationPoint(-2.0F, (float)(3 + b0), 1.0F); + this.leftLeg = new ModelRenderer(this, 26, 0); + this.leftLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3); + this.leftLeg.setRotationPoint(1.0F, (float)(3 + b0), 1.0F); + this.rightWing = new ModelRenderer(this, 24, 13); + this.rightWing.addBox(0.0F, 0.0F, -3.0F, 1, 4, 6); + this.rightWing.setRotationPoint(-4.0F, (float)(-3 + b0), 0.0F); + this.leftWing = new ModelRenderer(this, 24, 13); + this.leftWing.addBox(-1.0F, 0.0F, -3.0F, 1, 4, 6); + this.leftWing.setRotationPoint(4.0F, (float)(-3 + b0), 0.0F); + } + + /** + * Sets the models various rotation angles then renders the model. + */ + public void render(Entity p_78088_1_, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float p_78088_7_) + { + this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, p_78088_7_, p_78088_1_); + + if (this.isChild) + { + float f6 = 2.0F; + GL11.glPushMatrix(); + GL11.glTranslatef(0.0F, 5.0F * p_78088_7_, 2.0F * p_78088_7_); + this.head.render(p_78088_7_); + this.bill.render(p_78088_7_); + this.chin.render(p_78088_7_); + GL11.glPopMatrix(); + GL11.glPushMatrix(); + GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6); + GL11.glTranslatef(0.0F, 24.0F * p_78088_7_, 0.0F); + this.body.render(p_78088_7_); + this.rightLeg.render(p_78088_7_); + this.leftLeg.render(p_78088_7_); + this.rightWing.render(p_78088_7_); + this.leftWing.render(p_78088_7_); + GL11.glPopMatrix(); + } + else + { + this.head.render(p_78088_7_); + this.bill.render(p_78088_7_); + this.chin.render(p_78088_7_); + this.body.render(p_78088_7_); + this.rightLeg.render(p_78088_7_); + this.leftLeg.render(p_78088_7_); + this.rightWing.render(p_78088_7_); + this.leftWing.render(p_78088_7_); + } + } + + /** + * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms + * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how + * "far" arms and legs can swing at most. + */ + public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity p_78087_7_) + { + this.head.rotateAngleX = p_78087_5_ / (180F / (float)Math.PI); + this.head.rotateAngleY = p_78087_4_ / (180F / (float)Math.PI); + this.bill.rotateAngleX = this.head.rotateAngleX; + this.bill.rotateAngleY = this.head.rotateAngleY; + this.chin.rotateAngleX = this.head.rotateAngleX; + this.chin.rotateAngleY = this.head.rotateAngleY; + this.body.rotateAngleX = ((float)Math.PI / 2F); + this.rightLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F) * 1.4F * p_78087_2_; + this.leftLeg.rotateAngleX = MathHelper.cos(p_78087_1_ * 0.6662F + (float)Math.PI) * 1.4F * p_78087_2_; + this.rightWing.rotateAngleZ = p_78087_3_; + this.leftWing.rotateAngleZ = -p_78087_3_; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java b/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java new file mode 100644 index 0000000000..b3d1ce21fc --- /dev/null +++ b/src/Java/gtPlusPlus/core/client/renderer/RenderGiantChicken.java @@ -0,0 +1,116 @@ +package gtPlusPlus.core.client.renderer; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.client.model.ModelBase; +import net.minecraft.client.renderer.entity.RenderChicken; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.util.MathHelper; +import net.minecraft.util.ResourceLocation; + +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +@SideOnly(Side.CLIENT) +public class RenderGiantChicken extends RenderChicken { + + /** + * Fancy reflective handling of nabbing the original chicken texture object, should save reload the texture to memory. :) + */ + private static final ResourceLocation chickenTexturesEx; + static { + ResourceLocation mChicken; + try { + mChicken = (ResourceLocation) ReflectionUtils.getField(RenderGiantChicken.class, "chickenTextures").get(null); + } + catch (IllegalArgumentException | IllegalAccessException | NoSuchFieldException e) { + mChicken = new ResourceLocation("textures/entity/chicken.png"); + } + chickenTexturesEx = mChicken; + } + + public RenderGiantChicken(ModelBase p_i1252_1_, float p_i1252_2_) + { + super(p_i1252_1_, p_i1252_2_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(EntityChicken p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) + { + super.doRender((EntityLiving)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(EntityChicken p_110775_1_) + { + return chickenTexturesEx; + } + + /** + * Defines what float the third param in setRotationAngles of ModelBase is + */ + protected float handleRotationFloat(EntityChicken p_77044_1_, float p_77044_2_) + { + float f1 = p_77044_1_.field_70888_h + (p_77044_1_.field_70886_e - p_77044_1_.field_70888_h) * p_77044_2_; + float f2 = p_77044_1_.field_70884_g + (p_77044_1_.destPos - p_77044_1_.field_70884_g) * p_77044_2_; + return (MathHelper.sin(f1) + 1.0F) * f2; + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) + { + this.doRender((EntityChicken)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + /** + * Defines what float the third param in setRotationAngles of ModelBase is + */ + protected float handleRotationFloat(EntityLivingBase p_77044_1_, float p_77044_2_) + { + return this.handleRotationFloat((EntityChicken)p_77044_1_, p_77044_2_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) + { + this.doRender((EntityChicken)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } + + /** + * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. + */ + protected ResourceLocation getEntityTexture(Entity p_110775_1_) + { + return this.getEntityTexture((EntityChicken)p_110775_1_); + } + + /** + * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then + * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic + * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, + * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. + */ + public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) + { + this.doRender((EntityChicken)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java index ca46bca48b..81d8a789c5 100644 --- a/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java +++ b/src/Java/gtPlusPlus/core/entity/InternalEntityRegistry.java @@ -4,11 +4,13 @@ import cpw.mods.fml.common.registry.EntityRegistry; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; import gtPlusPlus.core.entity.projectile.EntitySulfuricAcidPotion; import gtPlusPlus.core.entity.projectile.EntityToxinballSmall; +import gtPlusPlus.core.util.Utils; public class InternalEntityRegistry { @@ -17,32 +19,35 @@ public class InternalEntityRegistry { public static void registerEntities(){ Logger.INFO("Registering GT++ Entities."); - EntityRegistry.registerGlobalEntityID(EntityPrimedMiningExplosive.class, "MiningCharge", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID(EntityPrimedMiningExplosive.class, "MiningCharge", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 0, 0), Utils.rgbtoHexValue(125, 125, 125)); EntityRegistry.registerModEntity(EntityPrimedMiningExplosive.class, "MiningCharge", mEntityID++, GTplusplus.instance, 64, 20, true); - EntityRegistry.registerGlobalEntityID(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(200, 0, 200), Utils.rgbtoHexValue(125, 125, 125)); EntityRegistry.registerModEntity(EntitySulfuricAcidPotion.class, "throwablePotionSulfuric", mEntityID++, GTplusplus.instance, 64, 20, true); - EntityRegistry.registerGlobalEntityID(EntityHydrofluoricAcidPotion.class, "throwablePotionHydrofluoric", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID(EntityHydrofluoricAcidPotion.class, "throwablePotionHydrofluoric", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 0, 0), Utils.rgbtoHexValue(255, 255, 255)); EntityRegistry.registerModEntity(EntityHydrofluoricAcidPotion.class, "throwablePotionHydrofluoric", mEntityID++, GTplusplus.instance, 64, 20, true); - EntityRegistry.registerGlobalEntityID(EntityToxinballSmall.class, "toxinBall", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID(EntityToxinballSmall.class, "toxinBall", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 25, 0), Utils.rgbtoHexValue(0, 125, 0)); EntityRegistry.registerModEntity(EntityToxinballSmall.class, "toxinBall", mEntityID++, GTplusplus.instance, 64, 20, true); - EntityRegistry.registerGlobalEntityID(EntityStaballoyConstruct.class, "constructStaballoy", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID(EntityStaballoyConstruct.class, "constructStaballoy", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 75, 0), Utils.rgbtoHexValue(50, 220, 50)); EntityRegistry.registerModEntity(EntityStaballoyConstruct.class, "constructStaballoy", mEntityID++, GTplusplus.instance, 64, 20, true); - EntityRegistry.registerGlobalEntityID(EntitySickBlaze.class, "sickBlaze", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID(EntitySickBlaze.class, "sickBlaze", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(0, 75, 0), Utils.rgbtoHexValue(75, 175, 75)); EntityRegistry.registerModEntity(EntitySickBlaze.class, "sickBlaze", mEntityID++, GTplusplus.instance, 64, 20, true); - EntityRegistry.registerGlobalEntityID(EntityTeslaTowerLightning.class, "plasmaBolt", EntityRegistry.findGlobalUniqueEntityId()); + EntityRegistry.registerGlobalEntityID(EntityTeslaTowerLightning.class, "plasmaBolt", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(125, 125, 125)); EntityRegistry.registerModEntity(EntityTeslaTowerLightning.class, "plasmaBolt", mEntityID++, GTplusplus.instance, 64, 5, true); + + EntityRegistry.registerGlobalEntityID(EntityGiantChickenBase.class, "bigChickenFriendly", EntityRegistry.findGlobalUniqueEntityId(), Utils.rgbtoHexValue(255, 0, 0), Utils.rgbtoHexValue(175, 175, 175)); + EntityRegistry.registerModEntity(EntityGiantChickenBase.class, "bigChickenFriendly", mEntityID++, GTplusplus.instance, 64, 20, true); } diff --git a/src/Java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java b/src/Java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java new file mode 100644 index 0000000000..071b893527 --- /dev/null +++ b/src/Java/gtPlusPlus/core/entity/monster/EntityGiantChickenBase.java @@ -0,0 +1,295 @@ +package gtPlusPlus.core.entity.monster; + +import net.minecraft.entity.*; +import net.minecraft.entity.ai.*; +import net.minecraft.entity.effect.EntityLightningBolt; +import net.minecraft.entity.passive.EntityChicken; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +import gtPlusPlus.core.item.ModItems; +import gtPlusPlus.core.item.general.ItemGemShards; +import gtPlusPlus.core.util.math.MathUtils; +import net.minecraftforge.common.ForgeHooks; + +public class EntityGiantChickenBase extends EntityChicken { + + /** The time until the next egg is spawned. */ + public int timeUntilNextBigEgg; + + public EntityGiantChickenBase(World aWorld) + { + super(aWorld); + this.setSize(0.6F, 1.4F); //Double + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + this.timeUntilNextBigEgg = this.rand.nextInt(16000) + 4000; + this.tasks.addTask(0, new EntityAISwimming(this)); + this.tasks.addTask(1, new EntityAIPanic(this, 1.4D)); + this.tasks.addTask(2, new EntityAIMate(this, 1.0D)); + this.tasks.addTask(3, new EntityAITempt(this, 1.0D, ModItems.itemGemShards, false)); + this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D)); + this.tasks.addTask(5, new EntityAIWander(this, 1.0D)); + this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F)); + this.tasks.addTask(7, new EntityAILookIdle(this)); + this.tasks.addTask(8, new EntityAIEatGrass(this)); + + } + + protected void applyEntityAttributes() + { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D); + } + + /** + * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons + * use this to react to sunlight and start to burn. + */ + public void onLivingUpdate() + { + super.onLivingUpdate(); + this.field_70888_h = this.field_70886_e; + this.field_70884_g = this.destPos; + this.destPos = (float)((double)this.destPos + (double)(this.onGround ? -1 : 4) * 0.3D); + + if (this.destPos < 0.0F) + { + this.destPos = 0.0F; + } + + if (this.destPos > 1.0F) + { + this.destPos = 1.0F; + } + + if (!this.onGround && this.field_70889_i < 1.0F) + { + this.field_70889_i = 1.0F; + } + + this.field_70889_i = (float)((double)this.field_70889_i * 0.9D); + + if (!this.onGround && this.motionY < 0.0D) + { + this.motionY *= 0.6D; + } + + this.field_70886_e += this.field_70889_i * 2.0F; + + if (!this.worldObj.isRemote && !this.isChild() && !this.isChickenJockey() && --this.timeUntilNextEgg <= 0) + { + this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.dropItem(Items.egg, 1); + this.timeUntilNextEgg = this.rand.nextInt(6000) + 6000; + } + if (!this.worldObj.isRemote && !this.isChild() && !this.isChickenJockey() && --this.timeUntilNextEgg <= 0) + { + this.playSound("mob.chicken.plop", 1.0F, (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F); + this.dropItem(ModItems.itemBigEgg, MathUtils.randInt(1, 4)); + this.timeUntilNextBigEgg = this.rand.nextInt(16000) + 4000; + } + } + + /** + * Called when the mob is falling. Calculates and applies fall damage. + */ + protected void fall(float p_70069_1_) {} + + protected Item getDropItem() + { + return ModItems.itemBigEgg; + } + + /** + * Drop 0-2 items of this living's type. @param par1 - Whether this entity has recently been hit by a player. @param + * par2 - Level of Looting used to kill this mob. + */ + protected void dropFewItems(boolean recentHit, int lootLevel) + { + int j = this.rand.nextInt(3) + this.rand.nextInt(1 + lootLevel); + + for (int k = 0; k < j; ++k) + { + this.dropItem(Items.feather, 1); + } + + //Large Egg Chance + for (int k = 0; k < j*2; ++k) + { + this.dropItem(ModItems.itemBigEgg, MathUtils.getRandomFromArray(new int[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2})); + } + + //Chicken Corpses Dropped + int mBodies = MathUtils.getRandomFromArray(new int[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 6}); + if (this.isBurning()) + { + this.dropItem(Items.cooked_chicken, mBodies); + } + else + { + this.dropItem(Items.chicken, mBodies); + } + } + + public EntityGiantChickenBase createChild(EntityAgeable p_90011_1_) + { + return new EntityGiantChickenBase(this.worldObj); + } + + /** + * Checks if the parameter is an item which this animal can be fed to breed it (wheat, carrots or seeds depending on + * the animal type) + */ + public boolean isBreedingItem(ItemStack aStack) + { + return aStack != null && aStack.getItem() instanceof ItemGemShards; + } + + /** + * (abstract) Protected helper method to read subclass entity data from NBT. + */ + public void readEntityFromNBT(NBTTagCompound aNBT) + { + super.readEntityFromNBT(aNBT); + timeUntilNextBigEgg = aNBT.getInteger("timeUntilNextBigEgg"); + } + + /** + * Get the experience points the entity currently has. + */ + protected int getExperiencePoints(EntityPlayer p_70693_1_) + { + return this.isChickenJockey() ? 20 : super.getExperiencePoints(p_70693_1_); + } + + /** + * (abstract) Protected helper method to write subclass entity data to NBT. + */ + public void writeEntityToNBT(NBTTagCompound aNBT) + { + super.writeEntityToNBT(aNBT); + aNBT.setInteger("timeUntilNextBigEgg", timeUntilNextBigEgg); + } + + /** + * Determines if an entity can be despawned, used on idle far away entities + */ + protected boolean canDespawn() + { + return this.isChickenJockey() && this.riddenByEntity == null; + } + + public void updateRiderPosition() + { + super.updateRiderPosition(); + float f = MathHelper.sin(this.renderYawOffset * (float)Math.PI / 180.0F); + float f1 = MathHelper.cos(this.renderYawOffset * (float)Math.PI / 180.0F); + float f2 = 0.1F; + float f3 = 0.0F; + this.riddenByEntity.setPosition(this.posX + (double)(f2 * f), this.posY + (double)(this.height * 0.5F) + this.riddenByEntity.getYOffset() + (double)f3, this.posZ - (double)(f2 * f1)); + + if (this.riddenByEntity instanceof EntityLivingBase) + { + ((EntityLivingBase)this.riddenByEntity).renderYawOffset = this.renderYawOffset; + } + } + + public boolean isChickenJockey() { + return func_152116_bZ(); + } + public void setIsChickenJockey(boolean isJockey) { + func_152117_i(isJockey); + } + + @Override + protected Entity findPlayerToAttack() { + // TODO Auto-generated method stub + return super.findPlayerToAttack(); + } + + @Override + public boolean interact(EntityPlayer p_70085_1_) { + // TODO Auto-generated method stub + return super.interact(p_70085_1_); + } + + @Override + public void setHomeArea(int p_110171_1_, int p_110171_2_, int p_110171_3_, int p_110171_4_) { + // TODO Auto-generated method stub + super.setHomeArea(p_110171_1_, p_110171_2_, p_110171_3_, p_110171_4_); + } + + @Override + public ChunkCoordinates getHomePosition() { + // TODO Auto-generated method stub + return super.getHomePosition(); + } + + @Override + public void detachHome() { + // TODO Auto-generated method stub + super.detachHome(); + } + + @Override + public boolean hasHome() { + // TODO Auto-generated method stub + return super.hasHome(); + } + + @Override + public void eatGrassBonus() { + if (this.isChild()) { + this.addGrowth(60); + } + } + + @Override + public float getRenderSizeModifier() { + return 1.5f; + } + + @Override + protected void jump() { + this.motionY = 0.68999998688697815D; + if (this.isPotionActive(Potion.jump)) + { + this.motionY += (double)((float)(this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.5F); + } + + 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); + } + + @Override + public void onStruckByLightning(EntityLightningBolt p_70077_1_) { + this.spawnExplosionParticle(); + this.spawnExplosionParticle(); + this.spawnExplosionParticle(); + this.spawnExplosionParticle(); + this.spawnExplosionParticle(); + this.spawnExplosionParticle(); + this.spawnExplosionParticle(); + super.onStruckByLightning(p_70077_1_); + } + + @Override + public boolean shouldDismountInWater(Entity rider) { + return true; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/analytics/AnalyticsLoggingPlugin.java b/src/Java/gtPlusPlus/core/handler/analytics/AnalyticsLoggingPlugin.java deleted file mode 100644 index 2d7fe35522..0000000000 --- a/src/Java/gtPlusPlus/core/handler/analytics/AnalyticsLoggingPlugin.java +++ /dev/null @@ -1,36 +0,0 @@ -package gtPlusPlus.core.handler.analytics; - -import com.segment.analytics.*; -import com.segment.analytics.messages.Message; - -import gtPlusPlus.api.objects.Logger; - -/** - * A {@link Plugin} implementation that redirects client logs to standard output and logs callback - * events. - */ -public class AnalyticsLoggingPlugin implements Plugin { - @Override public void configure(Analytics.Builder builder) { - builder.log(new Log() { - @Override public void print(Level level, String format, Object... args) { - Logger.WARNING(level + ":\t" + String.format(format, args)); - } - - @Override public void print(Level level, Throwable error, String format, Object... args) { - Logger.WARNING(level + ":\t" + String.format(format, args)); - //Utils.LOG_WARNING(error); - } - }); - - builder.callback(new Callback() { - @Override public void success(Message message) { - Logger.WARNING("Uploaded " + message); - } - - @Override public void failure(Message message, Throwable throwable) { - Logger.WARNING("Could not upload " + message); - //Utils.LOG_WARNING(throwable); - } - }); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/analytics/BlockingFlush.java b/src/Java/gtPlusPlus/core/handler/analytics/BlockingFlush.java deleted file mode 100644 index f1c4ece790..0000000000 --- a/src/Java/gtPlusPlus/core/handler/analytics/BlockingFlush.java +++ /dev/null @@ -1,65 +0,0 @@ -package gtPlusPlus.core.handler.analytics; - -import java.util.concurrent.Phaser; - -import com.segment.analytics.*; -import com.segment.analytics.messages.Message; -import com.segment.analytics.messages.MessageBuilder; - -/** - * The {@link Analytics} class doesn't come with a blocking {@link Analytics#flush()} implementation - * out of the box. It's trivial to build one using a {@link Phaser} that monitors requests and is - * able to block until they're uploaded. - * - * <pre><code> - * BlockingFlush mBlockingFlush = BlockingFlush.create(); - * Analytics mHelper = Analytics.builder(writeKey) - * .plugin(mBlockingFlush) - * .build(); - * - * // Do some work. - * - * mHelper.flush(); // Trigger a flush. - * mBlockingFlush.block(); // Block until the flush completes. - * mHelper.shutdown(); // Shut down after the flush is complete. - * </code></pre> - */ -public class BlockingFlush { - - public static BlockingFlush create() { - return new BlockingFlush(); - } - - BlockingFlush() { - this.phaser = new Phaser(1); - } - - final Phaser phaser; - - public Plugin plugin() { - return new Plugin() { - @Override public void configure(Analytics.Builder builder) { - builder.messageTransformer(new MessageTransformer() { - @Override public boolean transform(MessageBuilder builder) { - phaser.register(); - return true; - } - }); - - builder.callback(new Callback() { - @Override public void success(Message message) { - phaser.arrive(); - } - - @Override public void failure(Message message, Throwable throwable) { - phaser.arrive(); - } - }); - } - }; - } - - public void block() { - phaser.arriveAndAwaitAdvance(); - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/analytics/SegmentAnalytics.java b/src/Java/gtPlusPlus/core/handler/analytics/SegmentAnalytics.java deleted file mode 100644 index c64e6eae0b..0000000000 --- a/src/Java/gtPlusPlus/core/handler/analytics/SegmentAnalytics.java +++ /dev/null @@ -1,268 +0,0 @@ -package gtPlusPlus.core.handler.analytics; - -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.Phaser; - -import com.mojang.authlib.GameProfile; -import com.segment.analytics.Analytics; - -import net.minecraft.entity.player.EntityPlayer; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.api.objects.random.UUIDGenerator; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.data.UUIDUtils; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import ic2.core.IC2; - -public class SegmentAnalytics { - - //Globally Enabled - public static boolean isEnabled = true; - - //Analytics Map with IDs - public static final Map<Integer, SegmentAnalytics> sAnalyticsMasterList = new ConcurrentHashMap<Integer, SegmentAnalytics>(); - //ID count - private static int sAnalyticsMapID = 0; - - //Analytics Player Mapping - public static final Map<UUID, Integer> sAnalyticsToPlayermap = new ConcurrentHashMap<UUID, Integer>(); - - //Set some Vars - final BlockingFlush mBlockingFlush; - final SegmentHelper mHelper; - final UUIDGenerator mUuidGenerator; - - public final GameProfile mLocalProfile; - public final String mLocalName; - public final UUID mUUID; - public final String mUserName; - public final String mAnonymousId; - protected Map<String, Object> mProperties = new LinkedHashMap<>(); - final protected Phaser mPhaser; - - //Build a new instance of this class - public SegmentAnalytics(EntityPlayer mPlayer){ - LOG("Initializing Segment for "+mPlayer.getDisplayName()); - - //Give this Object an ID - int currentID = sAnalyticsMapID; - sAnalyticsMapID++; - - //Map this Object to it's ID and a Player UUID. - sAnalyticsMasterList.put(currentID, this); - sAnalyticsToPlayermap.put(mPlayer.getUniqueID(), currentID); - - //Create a Phaser - this.mPhaser = new Phaser(1); - - //Set vars for player - this.mLocalProfile = mPlayer.getGameProfile(); - this.mLocalName = mLocalProfile.getName(); - this.mUUID = PlayerUtils.getPlayersUUIDByName(mLocalName); - this.mUserName = mUUID.toString(); - this.mAnonymousId = getStringForm(generateIdForSession()); - - //Create a new UUID generator. - this.mUuidGenerator = new UUIDGenerator(); - - //Use Segment Analytics instead of plain Google Analytics. - this.mBlockingFlush = BlockingFlush.create(); - this.mHelper = SegmentHelper.getInstance(); - initTimer(mPlayer); - } - - //Sets vars and stops Analytics running if the player profile is invalid. - private boolean canProcess(){ - //Invalid Player Profile - if (mLocalProfile == null || !isEnabled){ - return false; - } - if (mLocalName == null || mUUID == null || mUserName == null || mAnonymousId == null){ - //LOG("One player var remained null, returning false."); - return false; - } - if (mLocalName != null && mUUID != null && mUserName != null && mAnonymousId != null){ - //LOG("All player vars are ok, returning true."); - return true; - } - LOG("Something went wrong, returning false."); - return false; - } - - - public void submitInitData(EntityPlayer mPlayer){ - if (!canProcess()){ - return; - } - mProperties = new LinkedHashMap<>(); - mProperties.put("username", mLocalName); - mProperties.put("gt_version", Utils.getGregtechVersionAsString()); - if (LoadedMods.IndustrialCraft2){ - mProperties.put("ic2_version", IC2.VERSION); - } - mProperties.put("country_code", CORE.USER_COUNTRY); - mProperties.put("gtnh", CORE.GTNH); - - LOG("Created new Data packet, queued for submission."); - - //Old Code, now passed to Helper Class - /*mHelper.enqueue(IdentifyMessage.builder() - .userId(mUserName) //Save Username as UUID, for future sessions to attach to. - .traits(mProperties) - //.anonymousId(mAnonymousId) //Save Random Session UUID - );*/ - - mHelper.addUser(this.mUserName, mProperties); - - if (CORE.GTNH){ - mHelper.groupUser("GT:NewHorizons", this.mUserName); - } - else { - mHelper.groupUser("GT:Vanilla", this.mUserName); - } - - } - - public void submitTrackingData(String aActionPerformed){ - submitTrackingData(aActionPerformed, null); - } - - public void submitTrackingData(String aActionPerformed, Object aObject){ - if (!canProcess()){ - return; - } - - Map<String, Object> properties = new LinkedHashMap<>(); - properties.put("blockType", aObject); - String mObjectAsString = "Unknown"; - - if (aObject != null){ - mObjectAsString = aObject.toString(); - } - - LOG("Queued submission of data for event "+aActionPerformed+". This was performed on "+mObjectAsString+"."); - - mHelper.trackUser(this.mUserName, aActionPerformed, properties); - - //Old Code, now passed to Helper Class - /*mHelper.enqueue(TrackMessage.builder(aActionPerformed) // - .userId(mUserName) // Save Username as UUID, for future sessions to attach to. - .properties(mProperties) //Save Stats - //.anonymousId(mAnonymousId) //Save Random Session UUID - ); - flushData(); - */ - } - - public void flushData(){ - getAnalyticObject().flush(); - } - - public void flushDataFinal(){ - LOG("Flushing all data from Queue to Segment Analytics database."); - getAnalyticObject().flush(); - mBlockingFlush.block(); - mPhaser.arriveAndAwaitAdvance(); - getAnalyticObject().shutdown(); - /*try { - this.finalize(); - } - catch (Throwable e) { - Utils.LOG_INFO("Could not finalize Analytics Object."); - }*/ - } - - public UUID generateIdForSession(){ - return UUIDUtils.getUUIDFromBytes(generateUUID()); - } - - private final byte[] generateUUID(){ - byte[] mUUID; - - if (this.mUuidGenerator != null){ - try { - if ((mUUID = mUuidGenerator.next(4)) != null){ - LOG("Generated Type 4 UUID for Session ID."); - return mUUID; - } - else if ((mUUID = mUuidGenerator.next(1)) != null){ - LOG("Generated Type 1 UUID for Session ID."); - return mUUID; - } - } - catch (Throwable t){ - t.printStackTrace(); - } - } - - LOG("Generated Type 3 UUID for Session ID."); - return UUIDUtils.getBytesFromUUID(UUID.randomUUID()); - - } - - public final String getStringForm(UUID mID){ - return mID.toString(); - } - - // Non-Dev Comments - public static void LOG(final String s) { - if (CORE.DEBUG){ - Logger.getLogger().info("[Analytics] "+s); - } - } - - public static SegmentAnalytics getAnalyticsForPlayer(EntityPlayer mPlayer){ - try { - if (mPlayer != null){ - if (SegmentAnalytics.sAnalyticsToPlayermap.containsKey(mPlayer.getUniqueID())){ - int ID = sAnalyticsToPlayermap.get(mPlayer.getUniqueID()); - return SegmentAnalytics.sAnalyticsMasterList.get(ID); - } - else { - LOG("Map does not contain Player."); - } - } - else { - LOG("Invalid Player."); - } - } - catch (Throwable t){ - t.printStackTrace(); - } - return null; - } - - public final Analytics getAnalyticObject() { - return mHelper.getAnalyticsClient(); - } - - public final Map<String, Object> getPlayerProperties(){ - return this.mProperties; - } - - - public final Timer initTimer(EntityPlayer mPlayer) { - Timer timer; - timer = new Timer(); - timer.schedule(new initPlayer(mPlayer), 2 * 1000); - return timer; - } - - //Timer Task for notifying the player. - class initPlayer extends TimerTask { - final EntityPlayer aPlayer; - public initPlayer(EntityPlayer mPlayer) { - this.aPlayer = mPlayer; - } - @Override - public void run() { - //Let us submit a doorknock to Segment to let them know who this is. - submitInitData(aPlayer); - } - } - -} diff --git a/src/Java/gtPlusPlus/core/handler/analytics/SegmentHelper.java b/src/Java/gtPlusPlus/core/handler/analytics/SegmentHelper.java deleted file mode 100644 index 09273f5b8e..0000000000 --- a/src/Java/gtPlusPlus/core/handler/analytics/SegmentHelper.java +++ /dev/null @@ -1,80 +0,0 @@ -package gtPlusPlus.core.handler.analytics; - -import java.util.Map; - -import com.segment.analytics.Analytics; -import com.segment.analytics.Callback; -import com.segment.analytics.messages.*; - -public class SegmentHelper implements Callback { - - /** - * Credits to Author: FLAMINSAGANAKI/Theodore Mavrakis - * http://domisydev.com/2015/11/05/using-segment-analytics-in-your-java-servlet/ - */ - - private static final String writeKey = "EDOWl9peleGlUqe1ZwTqKDyuTMFhyT4k"; - private static volatile SegmentHelper segment = new SegmentHelper(); - private Analytics analytics; - - public SegmentHelper(){ - try{ - this.analytics = Analytics.builder(writeKey).callback(this).build(); - }catch(Exception e){ - SegmentAnalytics.LOG("exception while creating Analytics : " + e); - } - } - - public static SegmentHelper getInstance(){ - return segment; - } - - public Analytics getAnalyticsClient(){ - return segment.analytics; - } - - public void success(Message message) { - SegmentAnalytics.LOG("Successfully uploaded " + message); - } - - public void failure(Message message, Throwable throwable) { - SegmentAnalytics.LOG("Could not upload " + message); - } - - public void addUser(String user_id, Map<String, Object> properties) { - try { - this.analytics.enqueue(IdentifyMessage.builder().userId(user_id).traits(properties)); - //trackUser(user_id, "Logged In", properties); - } catch (Exception e) { - SegmentAnalytics.LOG("Exception in addUser() - " + e); - } - } - - public void trackUser(String user_id, String description, Map<String, Object> properties) { - try { - this.analytics.enqueue(TrackMessage.builder(description).userId(user_id).properties(properties)); - } catch (Exception e) { - SegmentAnalytics.LOG("Exception in trackUser() - " + e); - } - } - - public void trackUser(String user_id, String description) { - try { - this.analytics.enqueue(TrackMessage.builder(description).userId(user_id)); - } catch (Exception e) { - SegmentAnalytics.LOG("Exception in trackUser() - " + e); - } - } - - public void groupUser(String group_id, String user_id) { - try { - this.analytics.enqueue(GroupMessage.builder(group_id).userId(user_id)); - } catch (Exception e) { - SegmentAnalytics.LOG("Exception in groupUser() - " + e); - } - } - - public static void main(String[] args){ - - } -}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java index 83c1bdac37..fbeca72090 100644 --- a/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/LoginEventHandler.java @@ -11,7 +11,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.handler.analytics.SegmentAnalytics; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.proxy.ClientProxy; import gtPlusPlus.core.util.Utils; @@ -37,10 +36,10 @@ public class LoginEventHandler { } try { - new SegmentAnalytics(event.player); + //new SegmentAnalytics(event.player); } catch (Throwable t){ - SegmentAnalytics.LOG("Failed to create Analytics submission during log in process."); + //SegmentAnalytics.LOG("Failed to create Analytics submission during log in process."); } try { diff --git a/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java index 9b7621a788..68df68aa2a 100644 --- a/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/ZombieBackupSpawnEventHandler.java @@ -9,7 +9,6 @@ import cpw.mods.fml.common.eventhandler.EventPriority; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.handler.analytics.SegmentHelper; import net.minecraftforge.event.entity.living.ZombieEvent; public class ZombieBackupSpawnEventHandler { @@ -31,7 +30,7 @@ public class ZombieBackupSpawnEventHandler { } catch(Throwable t){} if (event.attacker != null){ - SegmentHelper.getInstance().trackUser(event.attacker.getUniqueID().toString(), "Zombie Backup"); + //SegmentHelper.getInstance().trackUser(event.attacker.getUniqueID().toString(), "Zombie Backup"); } Logger.WARNING("[Zombie] ZombieEvent.SummonAidEvent."); event.setResult(Result.DENY); diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index e90fff3b89..7d4f20d968 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -260,6 +260,8 @@ public final class ModItems { public static Item dustNeptunium238; public static Item dustDecayedRadium226; public static Item dustRadium226; + + public static Item itemBigEgg; static { @@ -271,6 +273,7 @@ public final class ModItems { public static final void init(){ itemAlkalusDisk = new BaseItemDamageable("itemAlkalusDisk", AddToCreativeTab.tabMisc, 1, 0, "Unknown Use", EnumRarity.rare, EnumChatFormatting.AQUA, false, null); + itemBigEgg = new BaseItemBurnable("itemBigEgg", "Ginourmous Chicken Egg", tabMisc, 64, 0, "I had best try disassemble this.. for science!", "fuelLargeChickenEgg", 5000, 0).setTextureName(CORE.MODID + ":itemBigEgg"); //Debug Loading if (CORE.DEBUG){ diff --git a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java index d8f783be01..03ba920930 100644 --- a/src/Java/gtPlusPlus/core/proxy/ClientProxy.java +++ b/src/Java/gtPlusPlus/core/proxy/ClientProxy.java @@ -19,11 +19,13 @@ import net.minecraft.entity.Entity; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.client.model.ModelGiantChicken; import gtPlusPlus.core.client.renderer.*; import gtPlusPlus.core.common.CommonProxy; import gtPlusPlus.core.common.compat.COMPAT_PlayerAPI; import gtPlusPlus.core.entity.EntityPrimedMiningExplosive; import gtPlusPlus.core.entity.EntityTeslaTowerLightning; +import gtPlusPlus.core.entity.monster.EntityGiantChickenBase; import gtPlusPlus.core.entity.monster.EntitySickBlaze; import gtPlusPlus.core.entity.monster.EntityStaballoyConstruct; import gtPlusPlus.core.entity.projectile.EntityHydrofluoricAcidPotion; @@ -109,6 +111,9 @@ public class ClientProxy extends CommonProxy implements Runnable{ RenderingRegistry.registerEntityRenderingHandler(EntityHydrofluoricAcidPotion.class, new RenderSnowball(ModItems.itemHydrofluoricPotion)); RenderingRegistry.registerEntityRenderingHandler(EntityTeslaTowerLightning.class, new RenderPlasmaBolt()); + //Giant Chickens + RenderingRegistry.registerEntityRenderingHandler(EntityGiantChickenBase.class, new RenderGiantChicken(new ModelGiantChicken(), 1.5f)); + //ClientRegistry.bindTileEntitySpecialRenderer(TileEntityBloodSteelChest.class, new BloodSteelChestRenderer()); //MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ModBlocks.tutChest), new ItemRenderBloodSteelChest()); Logger.INFO("Registering Custom Renderer for the Fire Pit."); diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 3632499d8f..16e7f665ea 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -364,4 +364,15 @@ public class MathUtils { return number>GT_Values.V[GT_Values.V.length-1] ? safeInt(GT_Values.V[GT_Values.V.length-1],1) : number<Integer.MIN_VALUE ? Integer.MIN_VALUE : (int)number; } + public static int getRandomFromArray(int[] mValues) { + int[] mLargeChanceArray = new int[mValues.length*1000]; + int mValueSelection; + for (int g = 0; g < mLargeChanceArray.length; g++) { + mValueSelection = randInt(0, mValues.length); + mLargeChanceArray[g] = mValues[mValueSelection]; + } + return mLargeChanceArray[randInt(0, mLargeChanceArray.length)]; + + } + } |