private void func_190876_a(double p_190876_1_, double p_190876_3_, double p_190876_5_, double p_190876_7_, float p_190876_9_, int p_190876_10_) { BlockPos blockpos = new BlockPos(p_190876_1_, p_190876_7_, p_190876_3_); boolean flag = false; double d0 = 0.0D; while (true) { if (!EntityEvoker.this.world.isBlockNormalCube(blockpos, true) && EntityEvoker.this.world.isBlockNormalCube(blockpos.down(), true)) { if (!EntityEvoker.this.world.isAirBlock(blockpos)) { IBlockState iblockstate = EntityEvoker.this.world.getBlockState(blockpos); AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(EntityEvoker.this.world, blockpos); if (axisalignedbb != null) { d0 = axisalignedbb.maxY; } } flag = true; break; } blockpos = blockpos.down(); if (blockpos.getY() < MathHelper.floor(p_190876_5_) - 1) { break; } } if (flag) { EntityEvokerFangs entityevokerfangs = new EntityEvokerFangs(EntityEvoker.this.world, p_190876_1_, (double)blockpos.getY() + d0, p_190876_3_, p_190876_9_, p_190876_10_, EntityEvoker.this); EntityEvoker.this.world.spawnEntityInWorld(entityevokerfangs); } }
/** * Renders the desired {@code T} type Entity. */ public void doRender(EntityEvokerFangs entity, double x, double y, double z, float entityYaw, float partialTicks) { float f = entity.func_190550_a(partialTicks); if (f != 0.0F) { float f1 = 2.0F; if (f > 0.9F) { f1 = (float)((double)f1 * ((1.0D - (double)f) / 0.10000000149011612D)); } GlStateManager.pushMatrix(); GlStateManager.disableCull(); GlStateManager.enableAlpha(); this.bindEntityTexture(entity); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.rotate(90.0F - entity.rotationYaw, 0.0F, 1.0F, 0.0F); GlStateManager.scale(-f1, -f1, f1); float f2 = 0.03125F; GlStateManager.translate(0.0F, -0.626F, 0.0F); this.field_191330_f.render(entity, f, 0.0F, 0.0F, entity.rotationYaw, entity.rotationPitch, 0.03125F); GlStateManager.popMatrix(); GlStateManager.enableCull(); super.doRender(entity, x, y, z, entityYaw, partialTicks); } }
@SubscribeEvent public void onAttack(LivingHurtEvent event) { //true source is player that was holding the fang item //immediate source is the entity. and we check the boolean flag to make sure it was one of these, not from illager or some other spawn reason if (event.getSource().getImmediateSource() instanceof EntityEvokerFangs && UtilNBT.getEntityBoolean(event.getSource().getImmediateSource(), NBT_FANG_FROMPLAYER)) { event.setAmount(event.getAmount() * 2); } }
public ModelAdapterEvokerFangs() { super(EntityEvokerFangs.class, "evocation_fangs", 0.0F); }
/** * Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture. */ protected ResourceLocation getEntityTexture(EntityEvokerFangs entity) { return field_191329_a; }
/** * cast a single fang from the caster towards the direction of the given coordinates with delay * * @param caster * @param x * @param y * @param z * @param yaw * @param delay */ private void summonFangSingle(EntityPlayer caster, double x, double y, double z, float yaw, int delay) { EntityEvokerFangs entityevokerfangs = new EntityEvokerFangs(caster.world, x, y, z, yaw, delay, caster); caster.world.spawnEntity(entityevokerfangs); // so. WE are using this hack because the entity has a MAGIC NUMBER of 6.0F hardcoded in a few places deep inside methods and if statements //this number is the damage that it deals. ( It should be a property ) UtilNBT.setEntityBoolean(entityevokerfangs, NBT_FANG_FROMPLAYER); }