-
-
Save SanAndreaP/f876fb64b62074d7791c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.minecraft.src; | |
import java.util.List; | |
import cpw.mods.fml.client.FMLClientHandler; | |
import cpw.mods.fml.common.FMLCommonHandler; | |
import cpw.mods.fml.common.Side; | |
import cpw.mods.fml.common.asm.SideOnly; | |
import net.minecraft.client.Minecraft; | |
public class CSM_EntityClayMan extends EntityCreature implements IAnimals { | |
public CSM_EntityClayMan(World world) { | |
super(world); | |
health = 20; | |
yOffset = 0.0F; | |
stepHeight = 0.1F; | |
moveSpeed = 0.3F; | |
setSize(0.15F, 0.4F); | |
setPosition(posX, posY, posZ); | |
AltSkin = clayTexturePick(0); | |
texture = clayManTexture(0); | |
renderDistanceWeight = 5D; | |
} | |
@Override | |
protected void entityInit() { | |
super.entityInit(); | |
this.dataWatcher.addObject(27, 0); // clay team | |
this.dataWatcher.addObject(28, 0); // weapon points | |
} | |
public CSM_EntityClayMan(World world, double x, double y, double z, int i) { | |
super(world); | |
health = 20; | |
yOffset = 0.0F; | |
stepHeight = 0.1F; | |
moveSpeed = 0.3F; | |
setSize(0.15F, 0.4F); | |
setPosition(x, y, z); | |
renderDistanceWeight = 5D; | |
worldObj.playSoundAtEntity(this, "step.gravel", 0.8F, ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) * 0.9F); | |
} | |
public boolean clayTexturePick (int i) { | |
if(rand.nextInt(8192) == 0) { | |
SpecSkin = true; | |
} | |
if( (i == 17 && rand.nextInt(3) == 0) || (i == 19 && rand.nextInt(4) == 0) ) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
public String clayManTexture(int i) { | |
String joe = "/claymans/soldiers/clay"; | |
if(SpecSkin) | |
{ | |
joe = "/claymans/soldiers rare/clay"; | |
} | |
if(i == 1) { | |
joe = joe + "Red"; | |
} else if(i == 2) { | |
joe = joe + "Yellow"; | |
} else if(i == 3 && easterEggCarambola && !SpecSkin) { | |
joe = joe + "Carambola"; | |
} else if(i == 3) { | |
joe = joe + "Green"; | |
} else if(i == 4) { | |
joe = joe + "Blue"; | |
} else if(i == 5) { | |
joe = joe + "Orange"; | |
} else if(i == 6) { | |
joe = joe + "Purple"; | |
} else if(i == 7) { | |
joe = joe + "Pink"; | |
} else if(i == 8) { | |
joe = joe + "Brown"; | |
} else if(i == 9) { | |
joe = joe + "White"; | |
} else if(i == 10) { | |
joe = joe + "Black"; | |
} else if(i == 11) { | |
joe = joe + "Cyan"; | |
} else if(i == 12) { | |
joe = joe + "LightGrey"; | |
} else if(i == 13) { | |
joe = joe + "Lime"; | |
} else if(i == 14) { | |
joe = joe + "LightBlue"; | |
} else if(i == 15) { | |
joe = joe + "Magenta"; | |
} else if(i == 16) { | |
joe = joe + "Melon"; | |
} else if(i == 17 && AltSkin) { | |
joe = joe + "Pumpkin2"; | |
} else if(i == 17){ | |
joe = joe + "Pumpkin"; | |
} else if(i == 18){ | |
joe = joe + "Coal"; | |
} else if(i == 19 && AltSkin){ | |
joe = joe + "Redstone2"; | |
} else if(i == 19){ | |
joe = joe + "Redstone"; | |
} else { | |
joe = joe + "Grey"; | |
} | |
return joe + ".png"; | |
} | |
public String getMusTrack() { | |
ItemRecord itemrecord = (ItemRecord)(new ItemStack(MusDiscID, 1, 0).getItem()); | |
return itemrecord.recordName; | |
} | |
public int teamEgg(int teamNum) { | |
if(teamNum == 0) { //zombie pig | |
return 57; | |
} else if(teamNum == 1) { //mooshroom | |
return 96; | |
} else if(teamNum == 2) { //chicken | |
return 93; | |
} else if(teamNum == 3) { //slime | |
return 55; | |
} else if(teamNum == 4) { //squid | |
return 94; | |
} else if(teamNum == 5) { //magma cube | |
return 62; | |
} else if(teamNum == 6) { //ghast | |
return 56; | |
} else if(teamNum == 7) { //silverfish | |
return 60; | |
} else if(teamNum == 8) { //villager | |
return 120; | |
} else if(teamNum == 9) { //skeleton | |
return 51; | |
} else if(teamNum == 10) { //enderman | |
return 58; | |
} else if(teamNum == 11) { //zombie | |
return 54; | |
} else if(teamNum == 12) { //sheep | |
return 91; | |
} else if(teamNum == 13) { //creeper | |
return 50; | |
} else if(teamNum == 14) { //cave spider | |
return 59; | |
} else if(teamNum == 15) { //cow | |
return 92; | |
} else if(teamNum == 16) { //wolf | |
return 95; | |
} else if(teamNum == 17) { //pig | |
return 90; | |
} else if(teamNum == 18) { //spider | |
return 52; | |
} else if(teamNum == 19) { //blaze | |
return 61; | |
} else { | |
return 10; | |
} | |
} | |
public int teamCloth(int teamNum) { | |
if(teamNum == 0) { | |
return 8; | |
} else if(teamNum == 1) { | |
return 14; | |
} else if(teamNum == 2) { | |
return 4; | |
} else if(teamNum == 3) { | |
return 13; | |
} else if(teamNum == 4) { | |
return 11; | |
} else if(teamNum == 5) { | |
return 1; | |
} else if(teamNum == 6) { | |
return 10; | |
} else if(teamNum == 7) { | |
return 6; | |
} else if(teamNum == 8) { | |
return 12; | |
} else if(teamNum == 9) { | |
return 0; | |
} else if(teamNum == 10) { | |
return 15; | |
} else if(teamNum == 11) { | |
return 9; | |
} else if(teamNum == 12) { | |
return 8; | |
} else if(teamNum == 13) { | |
return 5; | |
} else if(teamNum == 14) { | |
return 3; | |
} else if(teamNum == 15) { | |
return 2; | |
} else if(teamNum == 16) { | |
return 5; | |
} else if(teamNum == 17) { | |
return 1; | |
} else { | |
return 8; | |
} | |
} | |
public int teamDye(int teamNum) { | |
if(teamNum == 0) { | |
return 8; | |
} else if(teamNum == 1) { | |
return 1; | |
} else if(teamNum == 2) { | |
return 11; | |
} else if(teamNum == 3) { | |
return 2; | |
} else if(teamNum == 4) { | |
return 4; | |
} else if(teamNum == 5) { | |
return 14; | |
} else if(teamNum == 6) { | |
return 5; | |
} else if(teamNum == 7) { | |
return 9; | |
} else if(teamNum == 8) { | |
return 3; | |
} else if(teamNum == 9) { | |
return 15; | |
} else if(teamNum == 10) { | |
return 0; | |
} else if(teamNum == 11) { | |
return 6; | |
} else if(teamNum == 12) { | |
return 7; | |
} else if(teamNum == 13) { | |
return 10; | |
} else if(teamNum == 14) { | |
return 12; | |
} else if(teamNum == 15) { | |
return 13; | |
} else { | |
return 16; | |
} | |
} | |
public static final float padColorTable[][] = | |
{ | |
{ | |
1.0F, 1.0F, 1.0F | |
}, { | |
0.95F, 0.7F, 0.2F | |
}, { | |
0.9F, 0.5F, 0.85F | |
}, { | |
0.6F, 0.7F, 0.95F | |
}, { | |
0.9F, 0.9F, 0.2F | |
}, { | |
0.5F, 0.8F, 0.1F | |
}, { | |
0.95F, 0.7F, 0.8F | |
}, { | |
0.3F, 0.3F, 0.3F | |
}, { | |
0.6F, 0.6F, 0.6F | |
}, { | |
0.3F, 0.6F, 0.7F | |
}, { | |
0.7F, 0.4F, 0.9F | |
}, { | |
0.2F, 0.4F, 0.8F | |
}, { | |
0.5F, 0.4F, 0.3F | |
}, { | |
0.4F, 0.5F, 0.2F | |
}, { | |
0.8F, 0.3F, 0.3F | |
}, { | |
0.1F, 0.1F, 0.1F | |
} | |
}; | |
public boolean goingToBlock() { | |
return blockX != 0 || blockY != 0 || blockX != 0; | |
} | |
private boolean thisInWater = false; | |
private boolean handleThisWaterMovement() { | |
return worldObj.handleMaterialAcceleration(boundingBox.expand(0.0D, -0.40000000596046448D, 0.0D).contract(0.001D, 0.001D, 0.001D), Material.water, this); | |
} | |
@Override | |
public boolean isInWater() { | |
return thisInWater; | |
} | |
@Override | |
public boolean handleWaterMovement() { | |
return false; | |
} | |
@Override | |
public void onEntityUpdate() { | |
// if((int)this.dataWatcher.getWatchableObjectByte(16) != this.clayTeam) { | |
// this.clayTeam = (int)this.dataWatcher.getWatchableObjectByte(16); | |
// this.AltSkin = clayTexturePick(this.dataWatcher.getWatchableObjectByte(16)); | |
// this.texture = clayManTexture(this.dataWatcher.getWatchableObjectByte(16)); | |
// } | |
// System.out.println(this.dataWatcher.getWatchableObjectByte(16)); | |
// if(!this.texture.equals(clayManTexture(getClayTeam()))) { | |
// this.texture = clayManTexture(getClayTeam()); | |
// } | |
if(this.currClayTeam != this.getClayTeam()) { | |
this.currClayTeam = this.getClayTeam(); | |
texture = this.clayManTexture(this.currClayTeam); | |
AltSkin = this.clayTexturePick(this.currClayTeam); | |
} | |
super.onEntityUpdate(); | |
if(targetFollow != null && (targetFollow instanceof CSM_EntityHorse || targetFollow instanceof CSM_EntityTurtle) && targetFollow.riddenByEntity != null) { | |
targetFollow = null; | |
} | |
if (handleThisWaterMovement()) | |
{ | |
if (!thisInWater) | |
{ | |
float f = MathHelper.sqrt_double(motionX * motionX * 0.20000000298023224D + motionY * motionY + motionZ * motionZ * 0.20000000298023224D) * 0.2F; | |
if (f > 1.0F) | |
{ | |
f = 1.0F; | |
} | |
if(rand.nextInt(20) == 0) { | |
worldObj.playSoundAtEntity(this, "random.splash", f, 1.0F + (rand.nextFloat() - rand.nextFloat()) * 0.4F); | |
float f1 = MathHelper.floor_double(boundingBox.minY); | |
for (int l = 0; l < 1.0F + width * 20F; l++) | |
{ | |
float f2 = (rand.nextFloat() * 2.0F - 1.0F) * width; | |
float f4 = (rand.nextFloat() * 2.0F - 1.0F) * width; | |
worldObj.spawnParticle("bubble", posX + f2, f1 + 1.0F, posZ + f4, motionX, motionY - (rand.nextFloat() * 0.2F), motionZ); | |
} | |
for (int i1 = 0; i1 < 1.0F + width * 20F; i1++) | |
{ | |
float f3 = (rand.nextFloat() * 2.0F - 1.0F) * width; | |
float f5 = (rand.nextFloat() * 2.0F - 1.0F) * width; | |
worldObj.spawnParticle("splash", posX + f3, f1 + 1.0F, posZ + f5, motionX, motionY, motionZ); | |
} | |
} | |
} | |
fallDistance = 0.0F; | |
thisInWater = true; | |
setFire(0); | |
} | |
else | |
{ | |
thisInWater = false; | |
} | |
} | |
@Override | |
public void onLivingUpdate() { | |
if(isInWater()) { | |
if(hasPants) { | |
isJumping = false; | |
motionY = 0.00F; | |
} else if(!isOnLadder()) { | |
isJumping = false; | |
motionY = -0.5F; | |
} | |
if(worldObj.getBlockMaterial((int)Math.floor(posX), (int)Math.ceil(posY-0.5), (int)Math.floor(posZ)).equals(Material.water) && hasPants) { | |
motionY = 0.2F; | |
} | |
if(isOnLadder()) { | |
motionY = 0.2F; | |
} | |
} | |
if(hasMusicDisc > 20*60*8 && MusDiscID != 0) { | |
MusicCoord = new int[] { (int)posX, (int)posY, (int)posZ }; | |
worldObj.playRecord(getMusTrack(), MusicCoord[0], MusicCoord[1], MusicCoord[2]); | |
} | |
if(hasMusicDisc > 0) { | |
hasMusicDisc--; | |
if(ticksExisted % 10 == 0) | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityNoteFX(worldObj, posX, posY + 0.5D, posZ, rand.nextFloat(), rand.nextFloat(), rand.nextFloat())); | |
} | |
if(hasMusicDisc <= 0 && MusDiscID != 0) { | |
worldObj.playRecord(null, MusicCoord[0], MusicCoord[1], MusicCoord[2]); | |
dropItem(MusDiscID, 1); | |
MusDiscID = 0; | |
} | |
if(strikeTime > 0) { | |
strikeTime --; | |
} | |
if(victory > 0) { | |
victory --; | |
} | |
if(corrupt) { | |
essence --; | |
if(essence <= 0) { | |
hurtTime = 0; | |
attackEntityFrom(DamageSource.causeMobDamage(this), health + 20); | |
} | |
if(rand.nextInt(2) == 0 && FMLCommonHandler.instance().getSide().isClient() && FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) | |
{ | |
addSquirrelButts(); | |
} | |
} | |
fleeingTick = 0; | |
if(sugarTime > 0 || superSoldier) { | |
moveSpeed = 0.5F + (!goingToBlock() && entityToAttack == null && targetFollow == null ? 0.0F : 0.25F); | |
if(sugarTime > 0) {sugarTime --;} | |
} else { | |
moveSpeed = 0.3F + (!goingToBlock() && entityToAttack == null && targetFollow == null ? 0.0F : 0.15F); | |
} | |
// if(handleWaterMovement()) { | |
// isJumping = true; | |
// } | |
if(foodLeft > 0 && health <= 15 && health > 0) { | |
for(int j = 0; j < 8; j++) | |
{ | |
Vec3 vec3d = Vec3.createVectorHelper((rand.nextFloat() - 0.5D) * 0.10000000000000001D, Math.random() * 0.10000000000000001D + 0.10000000000000001D, 0.0D); | |
vec3d.rotateAroundX((-rotationPitch * 3.141593F) / 180F); | |
vec3d.rotateAroundY((-rotationYaw * 3.141593F) / 180F); | |
Vec3 vec3d1 = Vec3.createVectorHelper((rand.nextFloat() - 0.5D) * 0.29999999999999999D, (-rand.nextFloat()) * 0.59999999999999998D - 0.29999999999999999D, 0.59999999999999998D); | |
vec3d1.rotateAroundX((-rotationPitch * 3.141593F) / 180F); | |
vec3d1.rotateAroundY((-rotationYaw * 3.141593F) / 180F); | |
vec3d1 = vec3d1.addVector(posX, posY + getEyeHeight(), posZ); | |
worldObj.spawnParticle((new StringBuilder()).append("iconcrack_").append(Item.porkRaw.shiftedIndex).toString(), vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.050000000000000003D, vec3d.zCoord); | |
} | |
health += 15; | |
foodLeft --; | |
} | |
if(onGround) { | |
climbTime = 10; | |
} | |
if(smokeTime > 0) { | |
smokeTime --; | |
} | |
if(throwTime > 0) { | |
throwTime --; | |
} | |
if(timeBombTicks >= 0) { | |
timeBombTicks --; | |
} | |
if(timeBombTicks == 0) { | |
worldObj.createExplosion(null, posX, posY, posZ, 1F); | |
} | |
if(hasFeather && !featherDeployed && gooTime <= 0 && !onGround && fallDistance >= 3F && logs <= 0 && !heavyCore && ridingEntity == null) { | |
featherDeployed = true; | |
} | |
if(featherDeployed) { | |
throwTime = 5; | |
strikeTime = 5; | |
fallDistance = 0F; | |
motionX *= 0.8D; | |
motionZ *= 0.8D; | |
if(motionY < -0.08D) { | |
motionY = -0.08D; | |
} | |
if(motionY >= 0D || onGround || handleWaterMovement()) { | |
featherDeployed = false; | |
} | |
} | |
if(gooTime > 0) { | |
motionX = 0D; | |
motionY = 0D; | |
motionZ = 0D; | |
moveForward = 0F; | |
moveStrafing = 0F; | |
isJumping = false; | |
moveSpeed = 0F; | |
gooTime --; | |
int i = MathHelper.floor_double(posX); | |
int j = MathHelper.floor_double(boundingBox.minY - 1D); | |
int k = MathHelper.floor_double(posZ); | |
int p = worldObj.getBlockId(i, j, k); | |
if(j > 0 && j < 128 && (p == 0 || Block.blocksList[p].getCollisionBoundingBoxFromPool(worldObj, i, j, k) == null)) { | |
gooTime = 0; | |
} | |
} | |
if(throwTime > 6) { | |
moveSpeed = -moveSpeed; | |
} | |
super.onLivingUpdate(); | |
if(!hasPath()) { | |
blockX = 0; | |
blockY = 0; | |
blockZ = 0; | |
} | |
if(isSwinging) { | |
prevSwingProgress += 0.15F; | |
swingProgress += 0.15F; | |
if(prevSwingProgress > 1.0F || swingProgress > 1.0F) { | |
isSwinging = false; | |
prevSwingProgress = 0.0F; | |
swingProgress = 0.0F; | |
} | |
} | |
if(isSwingingLeft) { | |
swingLeft += 0.15F; | |
if(swingLeft > 1.0F) { | |
isSwingingLeft = false; | |
swingLeft = 0.0F; | |
} | |
} | |
if(superSoldier || caped) { | |
processCape(); | |
} | |
} | |
public boolean checkIfItemIsValid(ItemStack stack, int operation) { // operation: 0 = dropped Item | 1 = Item from chest | 2 = Item from minecart | |
if(stack.itemID == Item.stick.shiftedIndex && !villager && shearAPts <= 0 && rodPoints <= 0 && bonePoints <= 0 && getWeaponPoints() <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if (stack.getItem() instanceof ItemRecord && !villager && hasMusicDisc <= 0) { | |
return true; | |
} else if ((stack.getItem() instanceof ItemSword || | |
stack.getItem() instanceof ItemAxe || | |
stack.getItem() instanceof ItemPickaxe || | |
stack.getItem() instanceof ItemHoe || | |
stack.getItem() instanceof ItemSpade || | |
stack.getItem() instanceof ItemBow) && operation == 0) { | |
return true; | |
} else if(stack.itemID == Item.blazeRod.shiftedIndex && !villager && shearAPts <= 0 && rodPoints <= 0 && bonePoints <= 0 && getWeaponPoints() <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.bone.shiftedIndex && !villager && shearAPts <= 0 && rodPoints <= 0 && bonePoints <= 0 && king() && getWeaponPoints() <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.bucketMilk.shiftedIndex && (villager || brawler || neutral)) { | |
return true; | |
} else if(stack.itemID == Item.speckledMelon.shiftedIndex && !brawler && !corrupt && glisterPoints <= 0 && !((gooStock > 0) || (smokeStock > 0) || (blazeStock > 0) || hasBlazeRod() || hasBone() || hasFireballs() || hasRocks() || hasShield() || hasSnowballs() || hasTimeBomb() || hasStick() || (toxinStock > 0))) { | |
return true; | |
} else if(stack.itemID == Item.leather.shiftedIndex && armorPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.magmaCream.shiftedIndex && !villager && !timeBombReady && !gunpowdered && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Block.waterlily.blockID && !hasPants && !heavyCore) { | |
return true; | |
} else if(stack.itemID == Item.reed.shiftedIndex && !hasReed && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Block.blockGold.blockID && !goldBlocked && king) { | |
return true; | |
} else if(stack.itemID == mod_ClayMan.shearBlade.shiftedIndex && !corrupt && glisterPoints <= 0 && ((shearBPts <= 0 && shieldPts <= 0 && rocks <= 0 && snowballs <= 0 && firecharges <= 0) || (shearAPts <= 0 && rodPoints <= 0 && bonePoints <= 0 && getWeaponPoints() <= 0))) { | |
return true; | |
} else if(stack.itemID == Item.fermentedSpiderEye.shiftedIndex && !neutral) { | |
return true; | |
} else if(stack.itemID == Item.bowlEmpty.shiftedIndex && shieldPts <= 0 && shearBPts <= 0 && rocks <= 0 && snowballs <= 0 && firecharges <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Block.gravel.blockID && !villager && shearBPts <= 0 && rocks <= 0 && shieldPts <= 0 && snowballs <= 0 && firecharges <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.fireballCharge.shiftedIndex && !villager && shearBPts <= 0 && rocks <= 0 && shieldPts <= 0 && snowballs <= 0 && firecharges <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.snowball.shiftedIndex && !villager && shearBPts <= 0 && snowballs <= 0 && rocks <= 0 && shieldPts <= 0 && firecharges <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Block.blockSnow.blockID && !villager && shearBPts <= 0 && snowballs <= 0 && rocks <= 0 && shieldPts <= 0 && firecharges <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Block.mushroomRed.blockID && !villager && toxinStock <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Block.mushroomBrown.blockID && foodLeft <= 0) { | |
return true; | |
} else if(stack.itemID == Item.coal.shiftedIndex && !hasCoal && !villager && (hasBlazeRod() || hasFireballs())) { | |
return true; | |
} else if(stack.itemID == Item.lightStoneDust.shiftedIndex && !glowing) { | |
return true; | |
} else if(stack.itemID == Block.glowStone.blockID && !glowing) { | |
return true; | |
} else if(stack.itemID == Item.egg.shiftedIndex && !camouflaged) { | |
return true; | |
} else if(stack.itemID == Item.wheat.shiftedIndex && !villager && !brawler) { | |
return true; | |
} else if(stack.itemID == Item.netherStalkSeeds.shiftedIndex && !villager && !brawler) { | |
return true; | |
} else if(stack.itemID == Item.goldNugget.shiftedIndex && !king && !brawler) { | |
boolean jack = false; | |
List list2 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(24D, 16D, 24D)); | |
for(int k = 0; k < list2.size(); k++) { | |
Entity entity2 = (Entity)list2.get(k); | |
if(entity2 instanceof CSM_EntityClayMan) { | |
CSM_EntityClayMan clayman = (CSM_EntityClayMan)entity2; | |
if(clayman.getClayTeam() == this.getClayTeam() && clayman.king) { | |
jack = true; | |
break; | |
} | |
} | |
} | |
if(!jack) { | |
return true; | |
} | |
} else if(stack.itemID == Item.diamond.shiftedIndex && !superSoldier) { | |
return true; | |
} else if(stack.itemID == Item.paper.shiftedIndex && !superSoldier && !caped) { | |
return true; | |
} else if(stack.itemID == Item.book.shiftedIndex && !superSoldier && !caped) { | |
return true; | |
} else if(stack.itemID == Item.enderPearl.shiftedIndex && !corrupt) { | |
return true; | |
} else if(stack.itemID == Item.gunpowder.shiftedIndex && !gunpowdered) { | |
return true; | |
} else if(stack.itemID == Item.sugar.shiftedIndex && !superSoldier && sugarTime <= 0) { | |
return true; | |
} else if(stack.getItem() instanceof ItemFood && foodLeft <= 0) { | |
return true; | |
} else if(stack.itemID == Item.clay.shiftedIndex && !brawler && resPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.ghastTear.shiftedIndex && !brawler && ghastTearPts <= 0) {/*ADDED*/ | |
return true; | |
} else if(stack.itemID == Item.slimeBall.shiftedIndex && !villager && gooStock <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.redstone.shiftedIndex && !villager && smokeStock <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.blazePowder.shiftedIndex && !villager && blazeStock <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Item.flint.shiftedIndex && !villager && getWeaponPoints() > 0 && !stickSharp) { | |
return true; | |
} else if(stack.itemID == Item.arrow.shiftedIndex && !villager && shearAPts <= 0 && rodPoints <= 0 && bonePoints <= 0 && getWeaponPoints() <= 0 && glisterPoints <= 0) { | |
return true; | |
} else if(stack.itemID == Block.cloth.blockID && ((armorPoints > 0 && (!armorPadded || armorColor != stack.getItemDamage())) || (caped && capeColor != stack.getItemDamage()))) { | |
return true; | |
} else if(stack.itemID == Block.blockSteel.blockID && shieldPts > 0 && !shieldStuds) { | |
return true; | |
} else if((stack.itemID == Block.glass.blockID || stack.itemID == Item.glassBottle.shiftedIndex || stack.itemID == Block.thinGlass.blockID) && !goggles) { | |
return true; | |
} else if(stack.itemID == Item.ingotIron.shiftedIndex && !heavyCore && ridingEntity == null && !hasFeather && !hasPants) { | |
return true; | |
} else if(stack.itemID == Item.feather.shiftedIndex && !hasFeather && !heavyCore) { | |
return true; | |
} else if(stack.getItem() instanceof CSM_ItemClayMan && !brawler && resPoints > 0) { | |
if(stack.getItemDamage() == this.getClayTeam()) { | |
return true; | |
} | |
} else if(stack.itemID == mod_ClayMan.brickDoll.shiftedIndex && !brawler && ghastTearPts > 0) {/*ADDED*/ | |
return true; | |
} else if((stack.getItem() instanceof CSM_ItemHorses || stack.getItem() instanceof CSM_ItemBunny || stack.getItem() instanceof CSM_ItemGecko || stack.getItem() instanceof CSM_ItemTurtle) && resPoints > 0 && ridingEntity == null) { | |
return true; | |
} else if(stack.itemID == Item.melonSeeds.shiftedIndex && 16 == getClayTeam()) { | |
return true; | |
} else if(stack.itemID == Item.pumpkinSeeds.shiftedIndex && 17 == getClayTeam()) { | |
return true; | |
} else if(stack.itemID == Block.torchWood.blockID && 18 == getClayTeam()) { | |
return true; | |
} else if(stack.itemID == Block.torchRedstoneActive.blockID && 19 == getClayTeam()) { | |
return true; | |
} else if(stack.itemID == mod_ClayMan.clayCookie.shiftedIndex) { | |
return true; | |
} else if(stack.itemID == Item.monsterPlacer.shiftedIndex && stack.getItemDamage() == teamEgg(getClayTeam()) && !SpecSkin) { | |
return true; | |
} else if(stack.itemID == Item.dyePowder.shiftedIndex && stack.getItemDamage() == teamDye(getClayTeam()) && operation == 0) { | |
return true; | |
} else if(stack.itemID == Block.wood.blockID && ridingEntity == null && glisterPoints <= 0) { | |
int gottam = 0; | |
if(logs < 20 && stack.stackSize >= 5) { | |
gottam = 1; | |
} | |
if(gottam > 0) { | |
return true; | |
} | |
} | |
return false; | |
} | |
public boolean applyStatsFromItem(ItemStack stack) { | |
if(stack.itemID == Item.stick.shiftedIndex) { | |
setWeaponPoints(15 * (superSoldier ? 3 : 1)); | |
stickSharp = false; | |
return true; | |
} else if(stack.itemID == mod_ClayMan.shearBlade.shiftedIndex && shearAPts <= 0 && rodPoints <= 0 && bonePoints <= 0 && getWeaponPoints() <= 0) { | |
shearAPts = 10 * (superSoldier ? 3 : 1); | |
return true; | |
} else if(stack.itemID == mod_ClayMan.shearBlade.shiftedIndex) { | |
shearBPts = 10 * (superSoldier ? 3 : 1); | |
return true; | |
} else if(stack.itemID == Item.arrow.shiftedIndex) { | |
setWeaponPoints(15 * (superSoldier ? 3 : 1)); | |
dropItem(Item.feather.shiftedIndex, 1, 0); | |
stickSharp = true; | |
return true; | |
} else if(stack.getItem() instanceof ItemSword && FMLCommonHandler.instance().getSide().isClient()) { | |
attackEntityFrom(DamageSource.magic, 10000); | |
FMLClientHandler.instance().getClient().thePlayer.addChatMessage("Not everything needs to be possible!"); | |
} else if(stack.getItem() instanceof ItemAxe && FMLCommonHandler.instance().getSide().isClient()) { | |
attackEntityFrom(DamageSource.magic, 10000); | |
FMLClientHandler.instance().getClient().thePlayer.addChatMessage("The gods have spoken, you are smited!"); | |
} else if(stack.getItem() instanceof ItemPickaxe && FMLCommonHandler.instance().getSide().isClient()) { | |
attackEntityFrom(DamageSource.magic, 10000); | |
FMLClientHandler.instance().getClient().thePlayer.addChatMessage("This situation is about mind over matter. Now, if you don't mind, let us get back to matters that make sense."); | |
} else if(stack.getItem() instanceof ItemSpade && FMLCommonHandler.instance().getSide().isClient()) { | |
attackEntityFrom(DamageSource.magic, 10000); | |
FMLClientHandler.instance().getClient().thePlayer.addChatMessage("You lack the pre-determined number of starfruits required!"); | |
} else if(stack.getItem() instanceof ItemHoe && FMLCommonHandler.instance().getSide().isClient()) { | |
attackEntityFrom(DamageSource.magic, 10000); | |
FMLClientHandler.instance().getClient().thePlayer.addChatMessage("The Fae Lords have heared your request. Well, you can probably guess what they think."); | |
} else if(stack.getItem() instanceof ItemBow && FMLCommonHandler.instance().getSide().isClient()) { | |
attackEntityFrom(DamageSource.magic, 10000); | |
FMLClientHandler.instance().getClient().thePlayer.addChatMessage("Be careful around that stri- oh wait, nevermind."); | |
} else if(stack.itemID == Item.blazeRod.shiftedIndex) { | |
rodPoints = 20 * (superSoldier ? 3 : 1); | |
return true; | |
} else if(stack.itemID == Item.bone.shiftedIndex) { | |
bonePoints = 35 * (superSoldier ? 3 : 1); | |
return true; | |
} else if(stack.itemID == Item.fermentedSpiderEye.shiftedIndex) { | |
neutral = true; | |
return true; | |
} else if(stack.getItem() instanceof ItemRecord) { | |
hasMusicDisc = 20*60*8+1; | |
MusDiscID = stack.itemID; | |
return true; | |
} else if(stack.itemID == Item.speckledMelon.shiftedIndex) { | |
glisterPoints = 4 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.egg.shiftedIndex) { | |
camouflaged = true; | |
return true; | |
} else if(stack.itemID == Item.leather.shiftedIndex) { | |
armorPoints = 15 * (superSoldier ? 3 : 1); | |
armorPadded = false; | |
return true; | |
} else if(stack.itemID == Item.magmaCream.shiftedIndex) { | |
timeBombReady = true; | |
return true; | |
} else if(stack.itemID == Block.waterlily.blockID) { | |
hasPants = true; | |
return true; | |
} else if(stack.itemID == Item.bucketMilk.shiftedIndex) { | |
villager = false; | |
brawler = false; | |
neutral = false; | |
worldObj.playSoundAtEntity(this, "random.drink", 0.8F, 0.7F + Math.min(0.3F, rand.nextFloat())); | |
targetFollow = null; | |
} else if(stack.itemID == Item.reed.shiftedIndex) { | |
hasReed = true; | |
return true; | |
} else if(stack.itemID == Item.monsterPlacer.shiftedIndex && stack.getItemDamage() == teamEgg(getClayTeam())) { | |
SpecSkin = true; | |
texture = clayManTexture(getClayTeam()); | |
return true; | |
} else if(stack.itemID == mod_ClayMan.clayCookie.shiftedIndex) { | |
AltSkin = clayTexturePick(getClayTeam()); | |
texture = clayManTexture(getClayTeam()); | |
return true; | |
} else if(stack.itemID == Item.bowlEmpty.shiftedIndex) { | |
shieldPts = 10 * (superSoldier ? 3 : 1); | |
shieldStuds = false; | |
return true; | |
} else if(stack.itemID == Block.gravel.blockID) { | |
rocks = 15 * (superSoldier ? 3 : 1); | |
return true; | |
} else if(stack.itemID == Item.snowball.shiftedIndex) { | |
snowballs = 15 * (superSoldier ? 3 : 1); | |
snowBlocked = false; | |
return true; | |
} else if(stack.itemID == Block.blockSnow.blockID) { | |
snowballs = 15 * (superSoldier ? 3 : 1); | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.cloth, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "step.cloth", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
snowBlocked = true; | |
targetFollow = null; | |
} else if(stack.itemID == Item.fireballCharge.shiftedIndex) { | |
firecharges = 15 * (superSoldier ? 3 : 1); | |
return true; | |
} else if(stack.itemID == Block.mushroomRed.blockID) { | |
toxinStock = 2 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Block.mushroomBrown.blockID) { | |
foodLeft = 2 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.coal.shiftedIndex) { | |
hasCoal = true; | |
return true; | |
} else if(stack.itemID == Item.lightStoneDust.shiftedIndex) { | |
glowing = true; | |
glowBlocked = false; | |
return true; | |
} else if(stack.itemID == Block.glowStone.blockID) { | |
glowing = true; | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.glowStone, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "random.glass", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
glowBlocked = true; | |
targetFollow = null; | |
} else if(stack.itemID == Item.wheat.shiftedIndex) { | |
villager = true; | |
return true; | |
} else if(stack.itemID == Item.netherStalkSeeds.shiftedIndex) { | |
brawler = true; | |
return true; | |
} else if(stack.itemID == Item.goldNugget.shiftedIndex) { | |
king = true; | |
return true; | |
} else if(stack.itemID == Item.gunpowder.shiftedIndex) { | |
gunpowdered = true; | |
return true; | |
} else if(stack.itemID == Item.sugar.shiftedIndex) { | |
sugarTime = 1200; | |
return true; | |
} else if(stack.getItem() instanceof ItemFood) { | |
foodLeft = 4 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.clay.shiftedIndex) { | |
resPoints = 4 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.ghastTear.shiftedIndex) { | |
ghastTearPts = 1 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.redstone.shiftedIndex) { | |
smokeStock = 2 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.blazePowder.shiftedIndex) { | |
blazeStock = 1 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.slimeBall.shiftedIndex) { | |
gooStock = 2 * (superSoldier ? 2 : 1); | |
return true; | |
} else if(stack.itemID == Item.ingotIron.shiftedIndex) { | |
heavyCore = true; | |
return true; | |
} else if(stack.itemID == Item.feather.shiftedIndex) { | |
hasFeather = true; | |
return true; | |
} else if(stack.itemID == Item.diamond.shiftedIndex) { | |
superSoldier = true; | |
caped = false; | |
health *= 20; | |
setWeaponPoints(getWeaponPoints() * 3); | |
rodPoints *= 3; | |
bonePoints *= 3; | |
armorPoints *= 3; | |
shieldPts *= 3; | |
rocks *= 3; | |
snowballs *= 3; | |
firecharges *= 3; | |
resPoints *= 2; | |
foodLeft *= 2; | |
smokeStock *= 2; | |
gooStock *= 2; | |
ghastTearPts *= 2; | |
glisterPoints *= 2; | |
toxinStock *= 2; | |
return true; | |
} else if(stack.itemID == Block.blockGold.blockID) { | |
goldBlocked = true; | |
health *= 2; | |
setWeaponPoints(getWeaponPoints() * 2); | |
rodPoints *= 2; | |
bonePoints *= 2; | |
armorPoints *= 2; | |
shieldPts *= 2; | |
rocks *= 2; | |
snowballs *= 2; | |
firecharges *= 2; | |
resPoints *= 2; | |
foodLeft *= 2; | |
smokeStock *= 2; | |
gooStock *= 2; | |
ghastTearPts *= 2; | |
glisterPoints *= 2; | |
toxinStock *= 2; | |
worldObj.playSoundAtEntity(this, "random.wood click", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
targetFollow = null; | |
} else if(stack.itemID == Item.paper.shiftedIndex) { | |
caped = true; | |
return true; | |
} else if(stack.itemID == Item.book.shiftedIndex) { | |
caped = true; | |
worldObj.playSoundAtEntity(this, "random.pop", 0.8F, 1.0F); | |
targetFollow = null; | |
} else if(stack.itemID == Item.enderPearl.shiftedIndex) { | |
corrupt = true; | |
this.health = Math.max(this.health, 30); | |
essence = 3600; | |
worldObj.playSoundAtEntity(this, "mob.ghast.scream", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
return true; | |
} else if(stack.itemID == Item.flint.shiftedIndex) { | |
if(getWeaponPoints() > 0) { | |
stickSharp = true; | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.planks, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "random.wood click", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} | |
targetFollow = null; | |
} else if(stack.itemID == Block.cloth.blockID) { | |
if(armorPoints > 0) { | |
armorPadded = true; | |
armorColor = stack.getItemDamage(); | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.cloth, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "step.cloth", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} | |
if(caped && capeColor != stack.getItemDamage()) { | |
capeColor = stack.getItemDamage(); | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.cloth, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "step.cloth", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} | |
targetFollow = null; | |
} else if(stack.itemID == Block.blockSteel.blockID) { | |
if(shieldPts > 0) { | |
shieldStuds = true; | |
shieldPts += 5 * (superSoldier ? 2 : 1); | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.blockSteel, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "step.stone", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} | |
targetFollow = null; | |
} else if((stack.itemID == Block.glass.blockID)) { | |
if(!goggles) { | |
goggles = true; | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.glass, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "random.glass", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} | |
targetFollow = null; | |
} else if((stack.itemID == Item.glassBottle.shiftedIndex || stack.itemID == Block.thinGlass.blockID)) { | |
if(!goggles) { | |
goggles = true; | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect((new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.glass, 0, 0))); | |
} | |
worldObj.playSoundAtEntity(this, "random.glass", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} | |
return true; | |
} else if(stack.getItem() instanceof CSM_ItemClayMan) { | |
swingArm(); | |
worldObj.playSoundAtEntity(this, "step.gravel", 0.8F, ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) * 0.9F); | |
for(int q = 0; q < 18; q++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = posY + 0.25D + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.cloth, 0, teamCloth(getClayTeam()))); | |
} | |
CSM_EntityClayMan ec = new CSM_EntityClayMan(worldObj, this.posX, this.posY, this.posZ, getClayTeam()); | |
worldObj.spawnEntityInWorld(ec); | |
resPoints --; | |
return true; | |
} else if(stack.itemID == mod_ClayMan.brickDoll.shiftedIndex) { /*ADDED*/ | |
swingArm(); | |
worldObj.playSoundAtEntity(this, "step.gravel", 0.8F, ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) * 0.9F); | |
for(int q = 0; q < 18; q++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = posY + 0.25D + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.cloth, 0, teamCloth(getClayTeam()))); | |
} | |
CSM_EntityClayMan ec = new CSM_EntityClayMan(worldObj, this.posX, this.posY, this.posZ, getClayTeam()); | |
worldObj.spawnEntityInWorld(ec); | |
ghastTearPts --; | |
return true; | |
} else if((stack.getItem() instanceof CSM_ItemHorses || stack.getItem() instanceof CSM_ItemBunny || stack.getItem() instanceof CSM_ItemTurtle || stack.getItem() instanceof CSM_ItemGecko) ) { | |
swingArm(); | |
worldObj.playSoundAtEntity(this, "step.gravel", 0.8F, ((rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F) * 0.9F); | |
for(int q = 0; q < 18; q++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = posY + 0.25D + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.blockClay, 0, 0)); | |
} | |
CSM_IMount<EntityCreature> mount = null; | |
if(stack.getItem() instanceof CSM_ItemHorses) { | |
mount = new CSM_EntityHorse(worldObj, this.posX, this.posY, this.posZ, stack.getItemDamage()); | |
if(stack.getItem() == mod_ClayMan.pegasusDoll) { | |
mount = new CSM_EntityPegasus(worldObj, this.posX, this.posY, this.posZ, stack.getItemDamage()); | |
} | |
} else if(stack.getItem() instanceof CSM_ItemTurtle) { | |
mount = new CSM_EntityTurtle(worldObj, this.posX, this.posY, this.posZ, stack.getItemDamage()); | |
} else if(stack.getItem() instanceof CSM_ItemBunny) { | |
mount = new CSM_EntityBunny(worldObj, this.posX, this.posY, this.posZ, stack.getItemDamage()); | |
} else if(stack.getItem() instanceof CSM_ItemGecko) { | |
mount = new CSM_EntityGecko(worldObj, this.posX, this.posY, this.posZ, stack.getItemDamage()); | |
} | |
if(mount != null) { | |
worldObj.spawnEntityInWorld((EntityCreature) mount); | |
resPoints --; | |
} | |
return true; | |
} else if(stack.itemID == Block.wood.blockID && ridingEntity == null) { | |
int gottam = 0; | |
if(logs < 20 && stack.stackSize >= 5) { | |
gottam = 1; | |
} | |
if(gottam > 0) { | |
worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); | |
if(gottam == 1) { | |
logs += 5; | |
if(stack != null) { | |
stack.stackSize -= 5; | |
} | |
} | |
if(stack == null || stack.stackSize <= 0) { | |
return true; | |
} | |
} | |
setPathToEntity((PathEntity)null); | |
targetFollow = null; | |
} else if(stack.itemID == Item.dyePowder.shiftedIndex) { | |
targetFollow = null; | |
} | |
return false; | |
} | |
public boolean applyStatsFromDroppedItem(ItemStack stack, EntityItem item) { | |
if(applyStatsFromItem(stack)) { | |
gotcha(item); | |
return true; | |
} | |
return false; | |
} | |
public boolean applyStatsFromChestItem(ItemStack stack, TileEntityChest chest, int q) { | |
if(applyStatsFromItem(stack)) { | |
gotcha(chest, q); | |
return true; | |
} | |
return false; | |
} | |
public boolean applyStatsFromCartItem(ItemStack stack, EntityMinecart cart, int q) { | |
if(applyStatsFromItem(stack)) { | |
cart.decrStackSize(q, 1); | |
return true; | |
} | |
return false; | |
} | |
@Override | |
public void updateEntityActionState() { | |
super.updateEntityActionState(); | |
entCount ++; | |
if(entityToAttack != null && entityToAttack.isDead) { | |
entityToAttack = null; | |
setPathToEntity((PathEntity)null); | |
} else if(entityToAttack != null && rand.nextInt(25) == 0 && (getDistanceToEntity(entityToAttack) > goggleView() || !canEntityBeSeen(entityToAttack))) { | |
entityToAttack = null; | |
setPathToEntity((PathEntity)null); | |
} | |
if(entityToAttack != null && entityToAttack instanceof CSM_EntityClayNexus) { | |
if(((CSM_EntityClayNexus)entityToAttack).isDestroyed || !((CSM_EntityClayNexus)entityToAttack).nexusActive || ((CSM_EntityClayNexus)entityToAttack).color < 0) { | |
entityToAttack = null; | |
setPathToEntity((PathEntity)null); | |
} | |
} | |
EntityPlayer ep = this.worldObj.getClosestPlayerToEntity(this, 20D); | |
if(entityToAttack == null && (targetFollow == null || targetFollow == ep) && ep != null && canEntityBeSeen(ep)) { | |
ItemStack held = ep.getCurrentEquippedItem(); | |
if(held != null) { | |
if(held.itemID == 0) { | |
targetFollow = null; | |
} else if(held.itemID == Item.dyePowder.shiftedIndex && held.getItemDamage() == teamDye(getClayTeam())) { | |
targetFollow = ep; | |
} else if(held.itemID == Item.melonSeeds.shiftedIndex && getClayTeam()==16) { | |
targetFollow = ep; | |
} else if(held.itemID == Item.pumpkinSeeds.shiftedIndex && getClayTeam()==17) { | |
targetFollow = ep; | |
} else if(held.itemID == Block.torchWood.blockID && getClayTeam()==18) { | |
targetFollow = ep; | |
} else if(held.itemID == Block.torchRedstoneActive.blockID && getClayTeam()==19) { | |
targetFollow = ep; | |
} else { | |
targetFollow = null; | |
} | |
} else | |
targetFollow = null; | |
} | |
if(targetFollow != null && targetFollow.isDead) { | |
targetFollow = null; | |
setPathToEntity((PathEntity)null); | |
} else if(targetFollow != null && rand.nextInt(25) == 0 && (getDistanceToEntity(targetFollow) > goggleView() || !canEntityBeSeen(targetFollow))) { | |
targetFollow = null; | |
setPathToEntity((PathEntity)null); | |
} | |
if(blazeStock > 0 && ticksExisted % (20 + (rand.nextInt(2)==0?-1:1)*rand.nextInt(4)) == 0) { | |
worldObj.spawnParticle("flame", posX, posY+0.1D, posZ, 0.0D, 0.01D, 0.0D); | |
} | |
if(smokeTime <= 0 && entCount > 2 + rand.nextInt(2) && health > 0) { | |
entCount = 0; | |
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(goggleView(), 5D, goggleView())); | |
for(int j = 0; j < list.size(); j++) { | |
Entity entity = (Entity)list.get(j); | |
if(victory <= 0 && entity instanceof CSM_EntityClayMan && rand.nextInt(3) == 0 && canEntityBeSeen(entity) && logs <= 0 && glisterPoints <= 0) { | |
CSM_EntityClayMan clayman = (CSM_EntityClayMan)entity; | |
if(clayman.health > 0 && (!corrupt && !neutral && !villager && (clayman.getClayTeam() != this.getClayTeam() || brawler)) || (corrupt && !clayman.corrupt)) { | |
if(clayman.camouflaged && !goggles) { | |
continue; | |
} | |
if(clayman.king) { | |
if(entityToAttack != null && entityToAttack instanceof CSM_EntityClayMan) { | |
CSM_EntityClayMan clayman2 = (CSM_EntityClayMan)entityToAttack; | |
if(!clayman2.king) { | |
entityToAttack = clayman; | |
break; | |
} | |
} else { | |
entityToAttack = clayman; | |
break; | |
} | |
} else if(entityToAttack == null) { | |
entityToAttack = clayman; | |
break; | |
} | |
} else if(clayman.health > 0 && targetFollow == null && entityToAttack == null && clayman.king && clayman.getClayTeam() == this.getClayTeam() && getDistanceToEntity(clayman) > 3.0D) { | |
targetFollow = clayman; | |
break; | |
} | |
} else if(victory <= 0 && !neutral && !villager && entity instanceof CSM_EntityClayNexus && rand.nextInt(3) == 0 && canEntityBeSeen(entity) && logs <= 0 && glisterPoints <= 0) { | |
CSM_EntityClayNexus nexus = (CSM_EntityClayNexus)entity; | |
if(nexus.health > 0 && nexus.color != this.getClayTeam() && nexus.color >= 0 && !nexus.isDestroyed) { | |
if(entityToAttack == null) { | |
entityToAttack = nexus; | |
break; | |
} | |
} | |
} else if(victory <= 0 && !corrupt && !villager && entityToAttack == null && entity instanceof EntityMob && canEntityBeSeen(entity)) { | |
EntityMob mob = (EntityMob)entity; | |
if(mob.entityToAttack != null) { | |
entityToAttack = mob; | |
break; | |
} | |
} else if(victory <= 0 && corrupt && entityToAttack == null && entity instanceof EntityPlayer && canEntityBeSeen(entity)) { | |
entityToAttack = entity; | |
break; | |
} else if(corrupt) { | |
continue; | |
} else if(glisterPoints > 0 && entity instanceof CSM_EntityClayMan && canEntityBeSeen(entity)) { | |
CSM_EntityClayMan ecm = (CSM_EntityClayMan)entity; | |
if(ecm.getClayTeam() == this.getClayTeam() && ecm.getHealth() < (int)(ecm.getMaxHealth() / 100F * 75F) && !corrupt && !brawler && !ecm.corrupt && !ecm.brawler && ecm.glisterPoints <= 0) { | |
entityToAttack = entity; | |
break; | |
} | |
} else if(entityToAttack == null && targetFollow == null && !heavyCore && logs <= 0 && ridingEntity == null && (entity instanceof CSM_EntityHorse || entity instanceof CSM_EntityTurtle || entity instanceof CSM_IMount) && entity.riddenByEntity == null && canEntityBeSeen(entity)) { | |
targetFollow = entity; | |
break; | |
} else if(entityToAttack == null && targetFollow == null && entity instanceof EntityFishHook && canEntityBeSeen(entity)) { | |
targetFollow = entity; | |
break; | |
} else if(entityToAttack == null && (targetFollow == null || targetFollow instanceof CSM_EntityClayMan) && entity instanceof EntityItem && canEntityBeSeen(entity)) { | |
EntityItem item = (EntityItem)entity; | |
if(item.item != null) { | |
ItemStack stack = item.item; | |
if(stack.stackSize > 0) { | |
if(checkIfItemIsValid(stack, 0)) { | |
targetFollow = item; | |
break; | |
} | |
} | |
} | |
} else if(entityToAttack == null && targetFollow == null && rand.nextInt(4) == 0 && entity instanceof EntityMinecart && canEntityBeSeen(entity)) { | |
EntityMinecart cart = (EntityMinecart)entity; | |
if(cart.minecartType == 1 && cartOperations(cart, false)) { | |
targetFollow = cart; | |
break; | |
} | |
} | |
} | |
if(entityToAttack != null) { | |
if(rodPoints > 0 && strikeTime <= 0 && canEntityBeSeen(entityToAttack) && getDistanceToEntity(entityToAttack) < 0.6D + entityToAttack.width + (entityToAttack instanceof EntityPlayer ? 1.0F : 0F) + (rand.nextFloat() * 0.2D)) { | |
if(hasCoal) { | |
entityToAttack.setFire(8); | |
} else { | |
entityToAttack.setFire(4); | |
} | |
if(rodPoints > 0) { | |
rodPoints --; | |
} | |
else { | |
hasBlazeRod = false; | |
} | |
if(entityToAttack.attackEntityFrom(DamageSource.causeMobDamage(this), (3 + rand.nextInt(2)) + (superSoldier ? 2 : 0) + ((timeBombReady && rand.nextInt(4) == 0) ? 2 : 0))) | |
if(superSoldier) { | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityCrit2FX(worldObj, entityToAttack)); | |
} | |
if(entityToAttack instanceof EntityLiving) { | |
if(((EntityLiving)entityToAttack).health <= 0) { | |
if(!corrupt) { | |
victory = 50; | |
} | |
entityToAttack = null; | |
setPathToEntity((PathEntity)null); | |
} | |
} | |
} else if(strikeTime <= 0 && canEntityBeSeen(entityToAttack) && getDistanceToEntity(entityToAttack) < ((getWeaponPoints() > 0) ? 0.6D : 0.3D) + (bonePoints > 0 ? 0.4D : 0.0D) + entityToAttack.width + (entityToAttack instanceof EntityPlayer ? 1.0F : 0F) + (rand.nextFloat() * 0.2D)) { | |
if(toxinStock > 0 && (entityToAttack instanceof EntityLiving) && !((EntityLiving)entityToAttack).isPotionActive(Potion.harm)) { | |
toxinStock--; | |
((EntityLiving)entityToAttack).addPotionEffect(new PotionEffect(Potion.harm.getId(), 15, 0)); | |
} | |
if(hitTargetMakesDead(entityToAttack)) { | |
entityToAttack = null; | |
setPathToEntity((PathEntity)null); | |
} | |
} else if((rocks > 0 || snowballs > 0 || firecharges > 0) && throwTime <= 0 && canEntityBeSeen(entityToAttack)) { | |
double frogman = getDistanceToEntity(entityToAttack); | |
if(frogman >= 1.75D && frogman <= 7D) { | |
if(rocks > 0) rocks --; | |
if(snowballs > 0) snowballs--; | |
if(firecharges > 0) firecharges--; | |
throwTime = 20; | |
throwRockAtEnemy(entityToAttack); | |
} | |
} | |
} else if(!corrupt && targetFollow != null) { | |
if(!hasPath() || rand.nextInt(10) == 0) { | |
setPathToEntity(worldObj.getPathEntityToEntity(targetFollow, this, 16F, false, false, false, false)); | |
} | |
if(targetFollow instanceof EntityItem) { | |
EntityItem item = (EntityItem)targetFollow; | |
if(item.item != null && canEntityBeSeen(item) && getDistanceToEntity(item) < 0.75D) { | |
ItemStack stack = item.item; | |
if(stack.stackSize > 0) { | |
applyStatsFromDroppedItem(stack, item); | |
} | |
} | |
} else if(targetFollow instanceof CSM_EntityClayMan && getDistanceToEntity(targetFollow) < 1.75D) { | |
targetFollow = null; | |
} else if(targetFollow instanceof EntityFishHook && getDistanceToEntity(targetFollow) < 1.0D) { | |
targetFollow = null; | |
} else if((targetFollow instanceof CSM_EntityHorse || targetFollow instanceof CSM_EntityTurtle || targetFollow instanceof CSM_IMount) && getDistanceToEntity(targetFollow) < 0.75D && gooTime <= 0) { | |
if(ridingEntity == null && targetFollow.riddenByEntity == null && !heavyCore && logs <= 0) { | |
mountEntity(targetFollow); | |
worldObj.playSoundAtEntity(this, "step.gravel", 0.6F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} | |
targetFollow = null; | |
} else if(targetFollow instanceof EntityMinecart && getDistanceToEntity(targetFollow) < 1.25D) { | |
cartOperations((EntityMinecart)targetFollow, true); | |
targetFollow = null; | |
} | |
} else if(!corrupt) { | |
updateBlockFinder(); | |
if(logs > 0 && rand.nextInt(16) == 0) { | |
updateBuildings(); | |
} | |
} | |
} | |
} | |
public void updateBlockFinder() { | |
int x = MathHelper.floor_double(posX); | |
int y = MathHelper.floor_double(boundingBox.minY); | |
int z = MathHelper.floor_double(posZ); | |
if(blockX != 0 && blockY != 0 && blockZ != 0 && !hasPath()) { | |
PathEntity emily = worldObj.getEntityPathToXYZ(this, blockX, blockY, blockZ, 16F, false, false, false, false); | |
if(emily != null && rand.nextInt(5) != 0) { | |
setPathToEntity(emily); | |
} else { | |
blockX = 0; | |
blockY = 0; | |
blockZ = 0; | |
} | |
} | |
int i = x; | |
int j = y; | |
int k = z; | |
for(int q = 0; q < 32; q++) { | |
if(j < 4 || j > 124 || !isAirySpace(i, j, k) || isAirySpace(i, j - 1, k)) { | |
continue; | |
} | |
int a = i; | |
int b = j - 1; | |
int c = k; | |
if(checkSides(a, b, c, i, j, k, blocDist(a, b, c, x, y, z), q == 0)) { | |
break; | |
} | |
b += 1; | |
a -= 1; | |
if(checkSides(a, b, c, i, j, k, blocDist(a, b, c, x, y, z), q == 0)) { | |
break; | |
} | |
a += 2; | |
if(checkSides(a, b, c, i, j, k, blocDist(a, b, c, x, y, z),q == 0)) { | |
break; | |
} | |
a -= 1; | |
c -= 1; | |
if(checkSides(a, b, c, i, j, k, blocDist(a, b, c, x, y, z),q == 0)) { | |
break; | |
} | |
c += 2; | |
if(checkSides(a, b, c, i, j, k, blocDist(a, b, c, x, y, z),q == 0)) { | |
break; | |
} | |
i = x + rand.nextInt(8) - rand.nextInt(8); | |
j = y + rand.nextInt(4) - rand.nextInt(4); | |
k = z + rand.nextInt(8) - rand.nextInt(8); | |
} | |
} | |
public void processCape() { | |
field_20066_r = field_20063_u; | |
field_20065_s = field_20062_v; | |
field_20064_t = field_20061_w; | |
double d = posX - field_20063_u; | |
double d1 = posY - field_20062_v; | |
double d2 = posZ - field_20061_w; | |
double d3 = 10D; | |
if(d > d3) | |
{ | |
field_20066_r = field_20063_u = posX; | |
} | |
if(d2 > d3) | |
{ | |
field_20064_t = field_20061_w = posZ; | |
} | |
if(d1 > d3) | |
{ | |
field_20065_s = field_20062_v = posY; | |
} | |
if(d < -d3) | |
{ | |
field_20066_r = field_20063_u = posX; | |
} | |
if(d2 < -d3) | |
{ | |
field_20064_t = field_20061_w = posZ; | |
} | |
if(d1 < -d3) | |
{ | |
field_20065_s = field_20062_v = posY; | |
} | |
field_20063_u += d * 0.25D; | |
field_20061_w += d2 * 0.25D; | |
field_20062_v += d1 * 0.25D; | |
} | |
private double goggleView() { | |
if(goggles) { | |
return 13D; | |
} else { | |
return 8D; | |
} | |
} | |
public double blocDist(int a, int b, int c, int x, int y, int z) { | |
double i = (a - x); | |
double j = (b - y); | |
double k = (c - z); | |
return Math.sqrt((i * i) + (j * j) + (k * k)); | |
} | |
public boolean isAirySpace(int x, int y, int z) { | |
int p = worldObj.getBlockId(x, y, z); | |
return p == 0 || Block.blocksList[p].getCollisionBoundingBoxFromPool(worldObj, x, y, z) == null; | |
} | |
public boolean checkSides(int a, int b, int c, int i, int j, int k, double dist, boolean first) { | |
if(b > 4 && b < 124) { | |
if(worldObj.getBlockId(a, b, c) == Block.chest.blockID) { | |
if(first && blockX == i && blockY == j && blockZ == k) { | |
setPathToEntity((PathEntity)null); | |
blockX = 0; | |
blockY = 0; | |
blockZ = 0; | |
chestOperations(a, b, c, true); | |
return true; | |
} else if(blockX == 0 && blockY == 0 && blockZ == 0) { | |
if(chestOperations(a, b, c, false)) { | |
PathEntity emily = worldObj.getEntityPathToXYZ(this, i, j, k, 16F, false, false, false, false); | |
if(emily != null) { | |
setPathToEntity(emily); | |
blockX = i; | |
blockY = j; | |
blockZ = k; | |
return true; | |
} | |
} | |
} | |
} | |
else if(!easterEggCarambola && getClayTeam() == 3 && (worldObj.getBlockId(a, b, c) == Block.signPost.blockID || worldObj.getBlockId(a, b, c) == Block.signWall.blockID)) { | |
if(first && blockX == i && blockY == j && blockZ == k) { | |
setPathToEntity((PathEntity)null); | |
blockX = 0; | |
blockY = 0; | |
blockZ = 0; | |
TileEntitySign tesign = (TileEntitySign) worldObj.getBlockTileEntity(a, b, c); | |
if(tesign != null && tesign.signText[1].equals("STARFRUIT")) { | |
easterEggCarambola = true; | |
texture = clayManTexture(getClayTeam()); | |
for(int i1 = 0; i1 < 15; i1++) worldObj.spawnParticle("reddust", posX, posY+0.5F, posZ, -0.4F, 1F, 0F); | |
} | |
return true; | |
} else if(blockX == 0 && blockY == 0 && blockZ == 0) { | |
TileEntitySign tesign = (TileEntitySign) worldObj.getBlockTileEntity(a, b, c); | |
boolean b1 = false; | |
if(tesign != null && tesign.signText[1].equals("STARFRUIT")) { | |
easterEggCarambola = true; | |
texture = clayManTexture(getClayTeam()); | |
for(int i1 = 0; i1 < 15; i1++) worldObj.spawnParticle("reddust", posX, posY+0.5F, posZ, -0.4F, 1F, 0F); | |
b1 = true; | |
} | |
if(b1) { | |
PathEntity emily = worldObj.getEntityPathToXYZ(this, i, j, k, 16F, false, false, false, false); | |
if(emily != null) { | |
setPathToEntity(emily); | |
blockX = i; | |
blockY = j; | |
blockZ = k; | |
return true; | |
} | |
} | |
} | |
} | |
} | |
return false; | |
} | |
public boolean chestOperations(int x, int y, int z, boolean arrived) { | |
TileEntity te = worldObj.getBlockTileEntity(x, y, z); | |
if(te != null && te instanceof TileEntityChest) { | |
TileEntityChest chest = (TileEntityChest)te; | |
for(int q = 0; q < chest.getSizeInventory(); q++) { | |
if(chest.getStackInSlot(q) != null) { | |
ItemStack stack = chest.getStackInSlot(q); | |
if(stack.stackSize > 0) { | |
if(checkIfItemIsValid(stack, 1)) { | |
applyStatsFromChestItem(stack, chest, q); | |
return true; | |
} | |
} | |
} | |
} | |
} | |
return false; | |
} | |
public boolean cartOperations(EntityMinecart cart, boolean arrived) { | |
for(int q = 0; q < cart.getSizeInventory(); q++) { | |
ItemStack stack = cart.getStackInSlot(q); | |
if(stack != null) { | |
if(stack.stackSize > 0) { | |
if(checkIfItemIsValid(stack, 2)) { | |
applyStatsFromCartItem(stack, cart, q); | |
return true; | |
} | |
} | |
} | |
} | |
return false; | |
} | |
public void updateBuildings() { | |
int x = MathHelper.floor_double(posX); | |
int y = MathHelper.floor_double(boundingBox.minY); | |
int z = MathHelper.floor_double(posZ); | |
if(y < 4 || y > 120) { | |
return; | |
} | |
int broad = 2; | |
int high = 3; | |
if(logs == 20) { | |
broad = 3; | |
high = 4; | |
} | |
boolean flag = false; | |
for(int a = -broad; a < broad + 1 && !flag; a++) { | |
for(int b = -1; b < high + 1 && !flag; b++) { | |
for(int c = -broad; c < broad + 1 && !flag; c++) { | |
if(b == -1) { | |
if(isAirySpace(x + a, y + b, z + c)) { | |
flag = true; | |
} | |
} else { | |
if(!isAirySpace(x + a, y + b, z + c) || worldObj.getBlockMaterial(x + a, y + b, z + c) == Material.water) { | |
flag = true; | |
} | |
} | |
} | |
} | |
} | |
if(!flag) { | |
double gee = broad; | |
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.expand(gee, gee, gee)); | |
if(list.size() > 0) { | |
flag = true; | |
} | |
} | |
if(!flag) { | |
if(logs == 20 && rand.nextInt(2) == 0) { | |
buildHouseThree(); | |
} else if(logs >= 10 && rand.nextInt(3) > 0) { | |
buildHouseTwo(); | |
} else if(logs >= 5) { | |
buildHouseOne(); | |
} | |
} | |
} | |
@Override | |
public boolean interact(EntityPlayer entityplayer) { | |
if(mod_ClayMan.placeholder == null) { | |
CSM_EntityClayCam eddie = new CSM_EntityClayCam(worldObj, this); | |
mod_ClayMan.claycam = eddie; | |
worldObj.spawnEntityInWorld(eddie); | |
Minecraft game = FMLClientHandler.instance().getClient(); | |
game.renderViewEntity = eddie; | |
mod_ClayMan.showTheHUD = game.gameSettings.hideGUI; | |
mod_ClayMan.showTheGUY = game.gameSettings.thirdPersonView == 0; | |
game.gameSettings.hideGUI = true; | |
game.gameSettings.thirdPersonView = 0; | |
mod_ClayMan.placeholder = entityplayer; | |
} | |
return false; | |
} | |
public void dropLogs() { | |
dropItem(Block.wood.blockID, logs); | |
logs = 0; | |
} | |
public void buildHouseOne() { | |
int x = MathHelper.floor_double(posX + 0.5D); | |
int y = MathHelper.floor_double(boundingBox.minY); | |
int z = MathHelper.floor_double(posZ + 0.5D); | |
int direction = rand.nextInt(4); | |
for(int j = 0; j < 3; j++) { | |
int b = j; | |
for(int i = -1; i < 3; i++) { | |
for(int k = -1; k < 2; k++) { | |
int a = i; | |
int c = k; | |
if(direction % 2 == 0) { | |
a = -a; | |
c = -c; | |
} | |
if(direction / 2 == 0) { | |
int swap = a; | |
a = c; | |
c = swap; | |
} | |
if(j == 0) { | |
if(i == -1 || i == 2 || k == -1) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} | |
} else if(j == 1) { | |
if(i == -1) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2 + (direction % 2 == 0 ? 1 : -1)) % 4); | |
} else if(i == 2) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2) % 4); | |
} else if(k == -1) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} | |
} else { | |
if(i == 0) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2 + (direction % 2 == 0 ? 1 : -1)) % 4); | |
} else if(i == 1) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2) % 4); | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} | |
} | |
} | |
} | |
} | |
worldObj.playSoundAtEntity(this, "random.wood click", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
worldObj.playSoundAtEntity(this, "step.wood", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
logs -= 5; | |
} | |
public void buildHouseTwo() { | |
int x = MathHelper.floor_double(posX); | |
int y = MathHelper.floor_double(boundingBox.minY); | |
int z = MathHelper.floor_double(posZ); | |
int direction = rand.nextInt(4); | |
for(int j = 0; j < 3; j++) { | |
int b = j; | |
for(int i = -2; i < 3; i++) { | |
for(int k = -2; k < 3; k++) { | |
int a = i; | |
int c = k; | |
if(direction % 2 == 0) { | |
a = -a; | |
c = -c; | |
} | |
if(direction / 2 == 0) { | |
int swap = a; | |
a = c; | |
c = swap; | |
} | |
if((i == -2 || i == 2) && (k == -2 || k == 2)) { | |
continue; | |
} | |
if(j == 0 || j == 1) { | |
if(i == -2 || i == 2 || k == -2 || (k == 2 && (i != 0 || j == 1))) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} | |
} else if(j == 2) { | |
if(i == -2) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2 + (direction % 2 == 0 ? 1 : -1)) % 4); | |
} else if(i == 2) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2) % 4); | |
} else if(k == -2) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + (direction % 2 == 0 ? 1 : -1)) % 4); | |
} else if(k == 2) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction) % 4); | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} | |
} | |
} | |
} | |
} | |
worldObj.playSoundAtEntity(this, "random.wood click", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
worldObj.playSoundAtEntity(this, "step.wood", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
logs -= 10; | |
} | |
public void buildHouseThree() { | |
int x = MathHelper.floor_double(posX); | |
int y = MathHelper.floor_double(boundingBox.minY); | |
int z = MathHelper.floor_double(posZ); | |
int direction = rand.nextInt(4); | |
for(int j = 0; j < 4; j++) { | |
int b = j; | |
for(int i = -3; i < 4; i++) { | |
for(int k = -2; k < 3; k++) { | |
int a = i; | |
int c = k; | |
if(direction % 2 == 0) { | |
a = -a; | |
c = -c; | |
} | |
if(direction / 2 == 0) { | |
int swap = a; | |
a = c; | |
c = swap; | |
} | |
if((i == -3 || i == 3) && (k == -2 || k == 2)) { | |
continue; | |
} | |
if(j < 3) { | |
if(i == -3 || i == 3 || k == -2 || (k == 2 && (i != 0 || j > 0))) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} else { | |
if(i == -2 && j == 0 && k == 0) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.chest.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2) % 4); | |
TileEntityChest chest = (TileEntityChest)worldObj.getBlockTileEntity(x + a, y + b, z + c); | |
chest.setInventorySlotContents(0, new ItemStack(Item.stick, 16, 0)); | |
} else if(i == 0 && j == 0 && k == -1) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2 + (direction % 2 == 0 ? 1 : -1)) % 4); | |
} else if(i == 1 && j == 1 && k == -1) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + 2 + (direction % 2 == 0 ? 1 : -1)) % 4); | |
} else if(i == 2 && j == 1 && k == -1) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} else if(i == 2 && j == 2 && k == 0) { | |
worldObj.setBlock(x + a, y + b, z + c, Block.stairCompactPlanks.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, (direction + (direction % 2 == 0 ? 1 : -1)) % 4); | |
} else if(i == 0 && j == 2 && k == -1) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} else if(i == 1 && j == 2 && k == -1) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} else if(i == 2 && j == 2 && k == -1) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} else if(j == 2) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} | |
} | |
} else if(j == 3) { | |
if(i == -3 || i == 3 || k == -2 || (k == 2 && (i != 0 || j > 0))) { | |
if(i == -2 || i == 0 || i == 2 || k == 0) { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.planks.blockID); | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, Block.woodSingleSlab.blockID); | |
worldObj.setBlockMetadataWithNotify(x + a, y + b, z + c, 2); | |
} | |
} else { | |
worldObj.setBlockWithNotify(x + a, y + b, z + c, 0); | |
} | |
} | |
} | |
} | |
} | |
worldObj.playSoundAtEntity(this, "random.wood click", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
worldObj.playSoundAtEntity(this, "step.wood", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
logs -= 20; | |
} | |
@Override | |
public void moveEntityWithHeading(float f, float f1) | |
{ | |
super.moveEntityWithHeading(f, f1); | |
// double d2 = (posX - prevPosX) * 2.0F; | |
// double d3 = (posZ - prevPosZ) * 2.0F; | |
// float f5 = MathHelper.sqrt_double(d2 * d2 + d3 * d3) * 4F; | |
// if(f5 > 1.0F) | |
// { | |
// f5 = 1.0F; | |
// } | |
// | |
// this.field_70721_aZ += (f5 - this.field_70721_aZ) * 0.4F; | |
// this.field_70754_ba += this.field_70721_aZ; | |
if(ridingEntity != null && (ridingEntity instanceof CSM_EntityBunny)) { | |
isJumping = true; | |
} | |
} | |
public void swingArm() { | |
if(!isSwinging) { | |
isSwinging = true; | |
prevSwingProgress = 0.0F; | |
swingProgress = 0.0F; | |
} | |
} | |
public void swingLeftArm() { | |
if(!isSwingingLeft) { | |
isSwingingLeft = true; | |
swingLeft = 0.01F; | |
} | |
} | |
public boolean hitTargetMakesDead(Entity e) { | |
strikeTime = 12 - (superSoldier ? 4 : 0); | |
swingArm(); | |
int power = (getWeaponPoints() > 0 ? 3 + rand.nextInt(2) + (stickSharp ? 1 : 0) : 2) + (bonePoints > 0 ? 4 + rand.nextInt(2) : 0) + (superSoldier ? 2 : 0) + (shearAPts > 0 ? 2 - rand.nextInt(2) : 0) + (shearBPts > 0 ? 2 - rand.nextInt(2) : 0); | |
if(getWeaponPoints() > 0) { | |
setWeaponPoints(getWeaponPoints()-1); | |
} | |
if(shearAPts > 0) { | |
shearAPts --; | |
} | |
if(shearBPts > 0) { | |
shearBPts --; | |
} | |
if(bonePoints > 0) { | |
bonePoints --; | |
} | |
if((e instanceof CSM_EntityClayMan) && (shearAPts > 0 || shearBPts > 0) && camouflaged) { | |
boolean b = ((CSM_EntityClayMan)e).entityToAttack != this; | |
if(b) { | |
power += 1+rand.nextInt(2); | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityCrit2FX(worldObj, e)); | |
} | |
} | |
boolean flag = e.attackEntityFrom(DamageSource.causeMobDamage(this), power); | |
if(flag && e instanceof EntityLiving) { | |
EntityLiving el = (EntityLiving)e; | |
if(superSoldier) { | |
if(FMLCommonHandler.instance().getSide().isClient()) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityCrit2FX(worldObj, el)); | |
} | |
if(el.health <= 0) { | |
if(!corrupt) { | |
victory = 50; | |
} | |
return true; | |
} | |
} | |
return false; | |
} | |
@Override | |
public boolean canEntityBeSeen(Entity entity) | |
{ | |
return worldObj.rayTraceBlocks(Vec3.createVectorHelper(posX, posY + getEyeHeight() + 0.2D, posZ), Vec3.createVectorHelper(entity.posX, entity.posY + (entity.getEyeHeight() / 4D), entity.posZ)) == null; | |
} | |
public void throwRockAtEnemy(Entity entity) { | |
if(!featherDeployed) { | |
double d = entity.posX - posX; | |
double d1 = entity.posZ - posZ; | |
CSM_EntityGravelChunk entitygravelchunk = new CSM_EntityGravelChunk(worldObj, this, getClayTeam()); | |
if(rocks > 0) { | |
entitygravelchunk = new CSM_EntityGravelChunk(worldObj, this, getClayTeam()); | |
} | |
else if(snowballs > 0) { | |
entitygravelchunk = new CSM_EntitySnowball(worldObj, this, getClayTeam()); | |
} | |
else if(firecharges > 0) { | |
entitygravelchunk = new CSM_EntityFireball(worldObj, this, getClayTeam()); | |
} | |
entitygravelchunk.posY += 0.3999999761581421D; | |
entitygravelchunk.target = (EntityLiving)entity; | |
entitygravelchunk.canFollowTarget = hasReed; | |
double d2 = (entity.posY + entity.getEyeHeight()) - 0.10000000298023224D - entitygravelchunk.posY; | |
float f1 = MathHelper.sqrt_double(d * d + d1 * d1) * 0.2F; | |
worldObj.spawnEntityInWorld(entitygravelchunk); | |
entitygravelchunk.setArrowHeading(d, d2 + f1, d1, 0.6F, 12F); | |
attackTime = 30; | |
moveForward = -moveForward; | |
rotationYaw = (float)((Math.atan2(d1, d) * 180D) / 3.1415927410125732D) - 90F; | |
hasAttacked = true; | |
swingLeftArm(); | |
} | |
} | |
public void gotcha(EntityItem item) { | |
worldObj.playSoundAtEntity(item, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); | |
if(item.item != null) { | |
item.item.stackSize--; | |
if(item.item.stackSize <= 0) { | |
item.setDead(); | |
} | |
} else { | |
item.setDead(); | |
} | |
targetFollow = null; | |
setPathToEntity((PathEntity)null); | |
} | |
@Override | |
public void mountEntity(Entity e) { | |
if(!(e != null && e instanceof EntityMinecart)) { | |
super.mountEntity(e); | |
} | |
} | |
public void gotcha(TileEntityChest chest, int q) { | |
worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); | |
chest.decrStackSize(q, 1); | |
} | |
@Override | |
public void writeToNBT(NBTTagCompound nbttagcompound) | |
{ | |
super.writeToNBT(nbttagcompound); | |
nbttagcompound.setShort("ClayTeam", (short)getClayTeam()); | |
nbttagcompound.setShort("WeaponPoints", (short)getWeaponPoints()); | |
nbttagcompound.setShort("RodPoints", (short)rodPoints); | |
nbttagcompound.setShort("BonePoints", (short)bonePoints); | |
nbttagcompound.setShort("ArmorPoints", (short)armorPoints); | |
nbttagcompound.setShort("FoodLeft", (short)foodLeft); | |
nbttagcompound.setShort("SugarTime", (short)sugarTime); | |
nbttagcompound.setShort("ResPoints", (short)resPoints); | |
nbttagcompound.setShort("GhastTearPts", (short)ghastTearPts); | |
nbttagcompound.setShort("StrikeTime", (short)strikeTime); | |
nbttagcompound.setShort("ClimbTime", (short)climbTime); | |
nbttagcompound.setShort("GooTime", (short)gooTime); | |
nbttagcompound.setShort("SmokeTime", (short)smokeTime); | |
nbttagcompound.setShort("GooStock", (short)gooStock); | |
nbttagcompound.setShort("BlazeStock", (short)blazeStock); | |
nbttagcompound.setShort("SmokeStock", (short)smokeStock); | |
nbttagcompound.setShort("Logs", (short)logs); | |
nbttagcompound.setShort("Rocks", (short)rocks); | |
nbttagcompound.setShort("SoldierSnowballs", (short)snowballs); | |
nbttagcompound.setShort("SoldierFireballs", (short)firecharges); | |
nbttagcompound.setShort("ShieldPts", (short)shieldPts); | |
nbttagcompound.setShort("Essence", (short)essence); | |
nbttagcompound.setShort("Ink", (short)armorColor); | |
nbttagcompound.setShort("CapeInk", (short)capeColor); | |
nbttagcompound.setShort("melons", (short)glisterPoints); | |
nbttagcompound.setShort("poisoner", (short)toxinStock); | |
nbttagcompound.setShort("TimeBombTicks", (short)timeBombTicks); | |
nbttagcompound.setBoolean("Gunpowdered", gunpowdered); | |
nbttagcompound.setBoolean("TimeBomb", timeBombReady); | |
nbttagcompound.setBoolean("KingCrowned", king); | |
nbttagcompound.setBoolean("Glowing", glowing); | |
nbttagcompound.setBoolean("StickSharp", stickSharp); | |
nbttagcompound.setBoolean("ArmorPadded", armorPadded); | |
nbttagcompound.setBoolean("HeavyCore", heavyCore); | |
nbttagcompound.setBoolean("HasFeather", hasFeather); | |
nbttagcompound.setBoolean("FeatherDeployed", featherDeployed); | |
nbttagcompound.setBoolean("Goggles", goggles); | |
nbttagcompound.setBoolean("SuperSoldier", superSoldier); | |
nbttagcompound.setBoolean("Caped", caped); | |
nbttagcompound.setBoolean("Corrupt", corrupt); | |
nbttagcompound.setBoolean("wheat", villager); | |
nbttagcompound.setBoolean("netherwart", brawler); | |
nbttagcompound.setBoolean("RARE", SpecSkin); | |
nbttagcompound.setBoolean("ALT", AltSkin); | |
nbttagcompound.setBoolean("coals", hasCoal); | |
nbttagcompound.setBoolean("studs", shieldStuds); | |
nbttagcompound.setBoolean("pants", hasPants); | |
nbttagcompound.setBoolean("reeds", hasReed); | |
nbttagcompound.setBoolean("fromNexus", fromNexus); | |
nbttagcompound.setBoolean("isNeutral", neutral); | |
nbttagcompound.setBoolean("camouflaged", camouflaged); | |
nbttagcompound.setBoolean("goldBlocked", goldBlocked); | |
nbttagcompound.setBoolean("glowBlocked", glowBlocked); | |
nbttagcompound.setBoolean("snowBlocked", snowBlocked); | |
nbttagcompound.setInteger("MusicDiscID", MusDiscID); | |
nbttagcompound.setInteger("shearAPts", shearAPts); | |
nbttagcompound.setInteger("shearBPts", shearBPts); | |
} | |
@Override | |
public void readFromNBT(NBTTagCompound nbttagcompound) | |
{ | |
super.readFromNBT(nbttagcompound); | |
setClayTeam(nbttagcompound.getShort("ClayTeam")); | |
SpecSkin = nbttagcompound.getBoolean("RARE"); | |
AltSkin = nbttagcompound.getBoolean("ALT"); | |
texture = clayManTexture(getClayTeam()); | |
setWeaponPoints(nbttagcompound.getShort("WeaponPoints")); | |
rodPoints = nbttagcompound.getShort("RodPoints"); | |
bonePoints = nbttagcompound.getShort("BonePoints"); | |
armorPoints = nbttagcompound.getShort("ArmorPoints"); | |
foodLeft = nbttagcompound.getShort("FoodLeft"); | |
sugarTime = nbttagcompound.getShort("SugarTime"); | |
resPoints = nbttagcompound.getShort("ResPoints"); | |
ghastTearPts = nbttagcompound.getShort("GhastTearPts"); | |
strikeTime = nbttagcompound.getShort("StrikeTime"); | |
climbTime = nbttagcompound.getShort("ClimbTime"); | |
gooTime = nbttagcompound.getShort("GooTime"); | |
smokeTime = nbttagcompound.getShort("SmokeTime"); | |
gooStock = nbttagcompound.getShort("GooStock"); | |
smokeStock = nbttagcompound.getShort("SmokeStock"); | |
blazeStock = nbttagcompound.getShort("BlazeStock"); | |
logs = nbttagcompound.getShort("Logs"); | |
rocks = nbttagcompound.getShort("Rocks"); | |
snowballs = nbttagcompound.getShort("SoldierSnowballs"); | |
firecharges = nbttagcompound.getShort("SoldierFireballs"); | |
shieldPts = nbttagcompound.getShort("ShieldPts"); | |
essence = nbttagcompound.getShort("Essence"); | |
armorColor = nbttagcompound.getShort("Ink"); | |
capeColor = nbttagcompound.getShort("CapeInk"); | |
glisterPoints = nbttagcompound.getShort("melons"); | |
toxinStock = nbttagcompound.getShort("poisoner"); | |
timeBombTicks = nbttagcompound.getShort("TimeBombTicks"); | |
gunpowdered = nbttagcompound.getBoolean("Gunpowdered"); | |
timeBombReady = nbttagcompound.getBoolean("TimeBomb"); | |
king = nbttagcompound.getBoolean("KingCrowned"); | |
glowing = nbttagcompound.getBoolean("Glowing"); | |
stickSharp = nbttagcompound.getBoolean("StickSharp"); | |
armorPadded = nbttagcompound.getBoolean("ArmorPadded"); | |
heavyCore = nbttagcompound.getBoolean("HeavyCore"); | |
hasFeather = nbttagcompound.getBoolean("HasFeather"); | |
featherDeployed = nbttagcompound.getBoolean("FeatherDeployed"); | |
goggles = nbttagcompound.getBoolean("Goggles"); | |
corrupt = nbttagcompound.getBoolean("Corrupt"); | |
villager = nbttagcompound.getBoolean("wheat"); | |
brawler = nbttagcompound.getBoolean("netherwart"); | |
superSoldier = nbttagcompound.getBoolean("SuperSoldier"); | |
caped = nbttagcompound.getBoolean("Caped"); | |
hasCoal = nbttagcompound.getBoolean("coals"); | |
shieldStuds = nbttagcompound.getBoolean("studs"); | |
hasPants = nbttagcompound.getBoolean("pants"); | |
hasReed = nbttagcompound.getBoolean("reeds"); | |
fromNexus = nbttagcompound.getBoolean("fromNexus"); | |
neutral = nbttagcompound.getBoolean("isNeutral"); | |
camouflaged = nbttagcompound.getBoolean("camouflaged"); | |
goldBlocked = nbttagcompound.getBoolean("goldBlocked"); | |
glowBlocked = nbttagcompound.getBoolean("glowBlocked"); | |
snowBlocked = nbttagcompound.getBoolean("snowBlocked"); | |
shearAPts = nbttagcompound.getInteger("shearAPts"); | |
shearBPts = nbttagcompound.getInteger("shearBPts"); | |
MusDiscID = nbttagcompound.getInteger("MusicDiscID"); | |
} | |
@Override | |
protected String getHurtSound() | |
{ | |
if(corrupt) { | |
worldObj.playSoundAtEntity(this, "mob.ghast.scream", 0.5F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} else { | |
worldObj.playSoundAtEntity(this, "random.hurt", 0.6F, 1.0F * (rand.nextFloat() * 0.2F + 1.6F)); | |
} | |
worldObj.playSoundAtEntity(this, "step.gravel", 0.6F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
return ""; | |
} | |
@Override | |
protected String getDeathSound() | |
{ | |
if(corrupt) { | |
worldObj.playSoundAtEntity(this, "mob.ghast.death", 0.5F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
} else { | |
worldObj.playSoundAtEntity(this, "random.hurt", 0.6F, 1.0F * (rand.nextFloat() * 0.2F + 1.6F)); | |
} | |
return "step.gravel"; | |
} | |
@Override | |
protected void jump() | |
{ | |
if(gooTime > 0) { | |
return; | |
} | |
if(sugarTime > 0) { | |
motionY = 0.375D; | |
} else { | |
motionY = 0.275D; | |
} | |
} | |
@Override | |
public boolean isOnLadder() | |
{ | |
if(logs <= 0 && !featherDeployed && isCollidedHorizontally && climbTime > 0) { | |
if(climbTime == 10) { | |
if(motionY < 0.05D) { | |
climbTime --; | |
throwTime = 5; | |
return true; | |
} | |
} else { | |
throwTime = 5; | |
climbTime --; | |
return true; | |
} | |
} | |
return false; | |
} | |
@Override | |
protected boolean canDespawn() | |
{ | |
return false; | |
} | |
@Override | |
public boolean canBreatheUnderwater() | |
{ | |
return true; | |
} | |
public int getClayTeam() { | |
return this.dataWatcher.getWatchableObjectInt(27); | |
// return 0; | |
} | |
public void setClayTeam(int team) { | |
this.dataWatcher.updateObject(27, team); | |
AltSkin = clayTexturePick(team); | |
texture = clayManTexture(team); | |
} | |
public int getWeaponPoints() { | |
return this.dataWatcher.getWatchableObjectInt(28); | |
// return 0; | |
} | |
public void setWeaponPoints(int wpoints) { | |
this.dataWatcher.updateObject(28, wpoints); | |
} | |
public boolean king() { | |
return king; | |
} | |
public boolean hasArmor() { | |
return armorPoints > 0; | |
} | |
public boolean hasSpecks() { | |
return gunpowdered; | |
} | |
public boolean hasCrown() { | |
return king; | |
} | |
public boolean isGlowing() { | |
return glowing; | |
} | |
public boolean isSharpened() { | |
return stickSharp; | |
} | |
public boolean isPadded() { | |
return armorPadded; | |
} | |
public boolean isGooey() { | |
return gooTime > 0; | |
} | |
public boolean hasGoo() { | |
return gooStock > 0; | |
} | |
public boolean hasSmoke() { | |
return smokeStock > 0; | |
} | |
public boolean hasLogs() { | |
return logs > 0; | |
} | |
public boolean holdFeather() { | |
return featherDeployed; | |
} | |
public boolean hasTimeBomb() { | |
return timeBombTicks > 0; | |
} | |
public float armLeft() { | |
return swingLeft; | |
} | |
public boolean hasStick() { | |
return getWeaponPoints() > 0; | |
} | |
public boolean hasBlazeRod() { | |
return rodPoints > 0; | |
} | |
public boolean hasBone() { | |
return bonePoints > 0; | |
} | |
public boolean hasRocks() { | |
return rocks > 0 && throwTime <= 0 && logs <= 0; | |
} | |
public boolean hasSnowballs() { | |
return snowballs > 0 && throwTime <= 0 && logs <= 0; | |
} | |
public boolean hasFireballs() { | |
return firecharges > 0 && throwTime <= 0 && logs <= 0; | |
} | |
public boolean hasShield() { | |
return shieldPts > 0; | |
} | |
public boolean hasGoggles() { | |
return goggles; | |
} | |
public boolean isSuper() { | |
return superSoldier; | |
} | |
public boolean isCaped() { | |
return caped; | |
} | |
public float capeSwing() { | |
if(moveForward > 0F) { | |
return (float)Math.sqrt((motionX * motionX) + (motionZ * motionZ)) * 4F; | |
} else { | |
return 0F; | |
} | |
} | |
public boolean isCorrupt() { | |
return corrupt; | |
} | |
@Override | |
protected void dropFewItems(boolean flag, int i) { | |
if(!gunpowdered || !fireDeath) { | |
Item item1 = mod_ClayMan.greyDoll; | |
if(!fireDeath) { | |
dropItem(item1.shiftedIndex, 1, getClayTeam()); | |
} | |
if(fireDeath) { | |
dropItem(mod_ClayMan.brickDoll.shiftedIndex, 1); | |
} | |
if(resPoints > 0) { | |
dropItem(Item.clay.shiftedIndex, 1); | |
} | |
if(ghastTearPts > 0) { | |
dropItem(Item.ghastTear.shiftedIndex, 1); | |
} | |
if(MusDiscID != 0 && hasMusicDisc > 0) {/*ADDED*/ | |
dropItem(MusDiscID, 1); | |
MusDiscID = 0; | |
hasMusicDisc = 0; | |
worldObj.playRecord(null, MusicCoord[0], MusicCoord[1], MusicCoord[2]); | |
} | |
if(getWeaponPoints() > 7 && rand.nextInt(2) == 0) { | |
dropItem(Item.stick.shiftedIndex, 1); | |
} | |
if(shearAPts > 7 && rand.nextInt(2) == 0) { | |
dropItem(mod_ClayMan.shearBlade.shiftedIndex, 1); | |
} | |
if(shearBPts > 7 && rand.nextInt(2) == 0) { | |
dropItem(mod_ClayMan.shearBlade.shiftedIndex, 1); | |
} | |
if(rodPoints > 7 && rand.nextInt(2) == 0) { | |
dropItem(Item.blazeRod.shiftedIndex, 1); | |
} | |
if(bonePoints > 10 && rand.nextInt(2) == 0) { | |
dropItem(Item.bone.shiftedIndex, 1); | |
} | |
if(armorPoints > 7 && rand.nextInt(2) == 0) { | |
dropItem(Item.leather.shiftedIndex, 1); | |
} | |
if(hasPants && rand.nextInt(2) == 0) { | |
dropItem(Block.waterlily.blockID, 1); | |
} | |
if(hasReed && rand.nextInt(2) == 0) { | |
dropItem(Item.reed.shiftedIndex, 1); | |
} | |
if(rocks > 7 && rand.nextInt(2) == 0) { | |
dropItem(Block.gravel.blockID, 1); | |
} | |
if(snowballs > 7 && rand.nextInt(2) == 0 && !snowBlocked) { | |
dropItem(Item.snowball.shiftedIndex, 1); | |
} | |
if(firecharges > 7 && rand.nextInt(2) == 0) { | |
dropItem(Item.fireballCharge.shiftedIndex, 1); | |
} | |
if(shieldPts > 4 && rand.nextInt(2) == 0) { | |
dropItem(Item.bowlEmpty.shiftedIndex, 1); | |
} | |
if(smokeStock > 1 && rand.nextInt(2) == 0) { | |
dropItem(Item.redstone.shiftedIndex, 1); | |
} | |
if(blazeStock > 1 && rand.nextInt(2) == 0) { | |
dropItem(Item.blazePowder.shiftedIndex, 1); | |
} | |
if(gooStock > 1 && rand.nextInt(2) == 0) { | |
dropItem(Item.slimeBall.shiftedIndex, 1); | |
} | |
if(smokeStock > 1 && rand.nextInt(2) == 0) { | |
dropItem(Item.redstone.shiftedIndex, 1); | |
} | |
if(glowing && rand.nextInt(2) == 0 && !glowBlocked) { | |
dropItem(Item.lightStoneDust.shiftedIndex, 1); | |
} | |
if(king) { | |
dropItem(Item.goldNugget.shiftedIndex, 1); | |
} | |
if(camouflaged) { | |
dropItem(Item.egg.shiftedIndex, 1); | |
} | |
if(heavyCore) { | |
dropItem(Item.ingotIron.shiftedIndex, 1); | |
} | |
if(superSoldier) { | |
dropItem(Item.diamond.shiftedIndex, 1); | |
} | |
if(hasFeather) { | |
dropItem(Item.feather.shiftedIndex, 1); | |
} | |
if(logs > 0) { | |
dropLogs(); | |
} | |
} | |
} | |
@Override | |
public EntityItem entityDropItem(ItemStack par1ItemStack, float par2) { | |
return (fromNexus) ? null : super.entityDropItem(par1ItemStack, par2); | |
} | |
protected void dropItem(int shiftedIndex, int i, int j) { | |
entityDropItem(new ItemStack(shiftedIndex, i, j), 0.0F); | |
} | |
@Override | |
public boolean attackEntityFrom(DamageSource damagesource, int i) { | |
Entity e = damagesource.getEntity(); | |
if(e instanceof EntityPlayer && !(corrupt && superSoldier)) { | |
i = 970; | |
hurtTime = 0; | |
} | |
if(e instanceof CSM_EntityClayMan && !(corrupt || brawler) && !(e == this)) { | |
CSM_EntityClayMan ecm = (CSM_EntityClayMan)e; | |
if(ecm.glisterPoints > 0 && ecm.getClayTeam() == this.getClayTeam()) { | |
ecm.glisterPoints--; | |
health = getMaxHealth(); | |
if(isPotionActive(Potion.harm)) { | |
removePotionEffect(Potion.harm.getId()); | |
} | |
ecm.entityToAttack = null; | |
worldObj.spawnParticle("heart", posX, posY, posZ, 0.0F, 0.1F, 0.0F); | |
return false; | |
} | |
} | |
if(e instanceof CSM_EntityGravelChunk) { | |
if((((CSM_EntityGravelChunk)e).clayTeam == getClayTeam())) { | |
return false; | |
} | |
else if(shieldPts > 0 && shieldStuds) { | |
if(rand.nextInt(4) == 0) { | |
shieldPts--; | |
} | |
return false; | |
} | |
else if(shieldPts > 0) { | |
if(rand.nextInt(3) == 0) { | |
shieldPts--; | |
} | |
return false; | |
} | |
} | |
if(ridingEntity != null && i < 100 && rand.nextInt(2) == 0) { | |
return ridingEntity.attackEntityFrom(damagesource, i); | |
} | |
if(damagesource.fireDamage() && !isPotionActive(Potion.fireResistance)) { | |
boolean b = super.attackEntityFrom(damagesource, 1); | |
if(health <= 2) { | |
fireDeath = true; | |
} | |
if(health <= 0) { | |
setDead(); | |
} | |
return b; | |
} | |
boolean corrupted = false; | |
if((e == null || !(e instanceof CSM_EntityClayMan)) && !damagesource.fireDamage() && !(e instanceof CSM_EntityGravelChunk) && !(e instanceof CSM_EntityTurtle) && !(damagesource.equals(DamageSource.magic))) { | |
i += 30; | |
if(e instanceof EntityFishHook) { | |
return false; | |
} | |
} else if(!damagesource.fireDamage() && !(e instanceof CSM_EntityGravelChunk) && !(e instanceof CSM_EntityTurtle) && !(damagesource.equals(DamageSource.magic))) { | |
CSM_EntityClayMan james = (CSM_EntityClayMan)e; | |
if(james == this && !corrupt && !james.corrupt && !brawler && !james.brawler) { | |
return false; | |
} | |
if(james.heavyCore && ridingEntity != null) { | |
mountEntity(ridingEntity); | |
} | |
if(logs > 0) { | |
dropLogs(); | |
} | |
if(smokeTime <= 0 && !villager) { | |
entityToAttack = e; | |
} | |
if(armorPoints > 0) { | |
i /= 2; | |
if(armorPadded) { | |
i -= 1; | |
} | |
armorPoints --; | |
if(i < 0) { | |
i = 0; | |
} | |
} | |
if(shieldPts > 0) { | |
i /= 2; | |
if(shieldStuds) { | |
i -= 1; | |
} | |
shieldPts --; | |
if(i < 0) { | |
i = 0; | |
} | |
} | |
if(riddenByEntity instanceof CSM_EntityTurtle) { | |
int i1 = i/2; | |
james.attackEntityFrom(DamageSource.causeMobDamage((EntityLiving) riddenByEntity), i1); | |
} | |
else if(hasTimeBomb() && rand.nextInt(15) == 0) { | |
i *= 3; | |
if(FMLCommonHandler.instance().getSide().equals(Side.CLIENT)) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityCrit2FX(worldObj, this)); | |
} | |
if(health - i > 0) { | |
if((james.smokeStock <= 0 || smokeTime <= 0 || rand.nextInt(2) == 0) && james.gooStock > 0 && gooTime <= 0 && onGround && james.blazeStock <= 0) { | |
james.gooStock --; | |
if(!(shieldStuds && rand.nextInt(4) == 0)) { | |
gooTime = 150; | |
} | |
worldObj.playSoundAtEntity(this, "mob.slimeattack", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
worldObj.spawnParticle("slime", a, b, c, 0.0D, 0.1D, 0.0D); | |
} | |
motionX = 0D; | |
motionY = 0D; | |
motionZ = 0D; | |
moveForward = 0F; | |
moveStrafing = 0F; | |
isJumping = false; | |
} else if(james.smokeStock <= 0 && james.gooStock <= 0 && james.blazeStock > 0) { | |
james.blazeStock --; | |
worldObj.playAuxSFXAtEntity(null, 1009, (int)posX, (int)posY, (int)posZ, 0); | |
for(int j = 0; j < 4; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.125D + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
worldObj.spawnParticle("reddust", a, b, c, 0.0D, 0.8D, 0.0D); | |
} | |
if(shieldStuds && rand.nextInt(4) == 0) { | |
i = 1; | |
} else if(superSoldier) { | |
i = 30; | |
} else { | |
motionX = 0D; | |
motionY = 0D; | |
motionZ = 0D; | |
moveForward = 0F; | |
moveStrafing = 0F; | |
isJumping = false; | |
setDead(); | |
dropItem(mod_ClayMan.brickDoll.shiftedIndex, 1); | |
} | |
} else if(james.smokeStock > 0 && smokeTime <= 0 && blazeStock <= 0) { | |
james.smokeStock --; | |
if(!(shieldStuds && rand.nextInt(4) == 0)) { | |
smokeTime = 150; | |
} | |
worldObj.playSoundAtEntity(this, "random.fizz", 0.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
for(int j = 0; j < 8; j++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = boundingBox.minY + 0.25D + (rand.nextFloat() * 0.25D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
worldObj.spawnParticle("reddust", a, b, c, 0.0D, 0.1D, 0.0D); | |
} | |
targetFollow = null; | |
entityToAttack = null; | |
setPathToEntity((PathEntity)null); | |
} | |
} else if(james != this && james.corrupt) { | |
james.entityToAttack = null; | |
james.health = Math.max(james.health, 30); | |
james.essence = 3600; | |
entityToAttack = null; | |
health = Math.max(this.health, 30); | |
essence = 3600; | |
corrupt = true; | |
worldObj.playSoundAtEntity(this, "mob.ghast.scream", 1.75F, 1.0F / (rand.nextFloat() * 0.2F + 0.9F)); | |
return false; | |
} else if(timeBombReady) { | |
james.timeBombTicks = 20*5; | |
} | |
} | |
boolean fred = super.attackEntityFrom(damagesource, i); | |
if(fred && health <= 0) { | |
victory = 0; | |
for(int q = 0; q < 24; q++) { | |
double a = posX + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double b = posY + 0.25D + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
double c = posZ + ((rand.nextFloat() - rand.nextFloat()) * 0.125D); | |
if(FMLCommonHandler.instance().getSide().equals(Side.CLIENT)) | |
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new EntityDiggingFX(worldObj, a, b, c, 0.0D, 0.0D, 0.0D, Block.cloth, 0, teamCloth(getClayTeam()))); | |
} | |
isDead = true; | |
if(e != null && e instanceof EntityPlayer) { | |
killedByPlayer = e; | |
} | |
if(gunpowdered) { | |
worldObj.createExplosion(null, posX, posY, posZ, 1F); | |
} | |
} | |
return fred; | |
} | |
@Override | |
public void addVelocity(double d, double d1, double d2) | |
{ | |
if(gooTime > 0) { | |
return; | |
} | |
motionX += d; | |
motionY += d1; | |
motionZ += d2; | |
} | |
@Override | |
public void knockBack(Entity entity, int i, double d, double d1) | |
{ | |
if(gooTime > 0) { | |
return; | |
} | |
super.knockBack(entity, i, d, d1); | |
if(entity != null && entity instanceof CSM_EntityClayMan) { | |
CSM_EntityClayMan ec = (CSM_EntityClayMan) entity; | |
if((ec.heavyCore && heavyCore) || (!ec.heavyCore && !heavyCore)) { | |
motionX *= 0.6D; | |
motionY *= 0.75D; | |
motionZ *= 0.6D; | |
} else if(!ec.heavyCore && heavyCore) { | |
motionX *= 0.2D; | |
motionY *= 0.4D; | |
motionZ *= 0.2D; | |
} else { | |
motionX *= 1.5D; | |
motionZ *= 1.5D; | |
} | |
} else if(entity != null && entity instanceof CSM_EntityGravelChunk) { | |
motionX *= 0.6D; | |
motionY *= 0.75D; | |
motionZ *= 0.6D; | |
} | |
} | |
private void addSquirrelButts() { | |
worldObj.spawnParticle("portal", posX + (rand.nextDouble() - 0.5D) * width * 0.5D, (posY + rand.nextDouble() * height) - 0.05D, posZ + (rand.nextDouble() - 0.5D) * width * 0.5D, (rand.nextDouble() - 0.5D) * 0.75D, -rand.nextDouble() * 0.5D, (rand.nextDouble() - 0.5D) * 0.75D); | |
} | |
@Override | |
public int getBrightnessForRender(float f) { | |
return isGlowing() ? 0x0f00f0 : super.getBrightnessForRender(f); | |
} | |
@Override | |
public int getMaxHealth() { | |
return(villager ? 15 : (brawler || corrupt) ? 30 : 20) * (superSoldier ? 20 : 1); | |
} | |
public int ghastTearPts, blazeStock, hasMusicDisc, currClayTeam, MusDiscID, armorPoints, foodLeft, sugarTime, resPoints, entCount, strikeTime, climbTime, gooTime, smokeTime, gooStock, smokeStock, logs, rocks, snowballs, firecharges, bonePoints, rodPoints, armorColor, capeColor = 0, glisterPoints, toxinStock, timeBombTicks = -1; | |
public int shieldPts, blockX, blockY, blockZ, throwTime, essence, victory, shearAPts = 0, shearBPts = 0, sittingPos = 0; | |
public float swingLeft; | |
public boolean gunpowdered, king, glowing, isSwinging, stickSharp, armorPadded, heavyCore, isSwingingLeft, hasFeather, featherDeployed, goggles, superSoldier, corrupt, villager, brawler, fireDeath, caped, SpecSkin, AltSkin, hasStick, hasBone, hasBlazeRod, hasCoal, shieldStuds, hasPants, hasReed, timeBombReady; | |
public boolean camouflaged, glowBlocked = false, snowBlocked = false, fromNexus = false, neutral = false, easterEggCarambola = false, goldBlocked; | |
public int[] MusicCoord = new int[3]; | |
public double field_20066_r; | |
public double field_20065_s; | |
public double field_20064_t; | |
public double field_20063_u; | |
public double field_20062_v; | |
public double field_20061_w; | |
public Entity targetFollow, killedByPlayer; | |
public EntityAnimal spawnBabyAnimal(EntityAnimal var1) { | |
// TODO Auto-generated method stub | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment