Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.minecraft.src;
- import java.io.File;
- public class mod_MinerZombie extends BaseMod implements Runnable {
- public static World worldRef;
- public static Minecraft mc;
- public static EntityPlayer theplayer;
- @MLProp2 public static STBoolean NaziB;
- @MLProp2 public static STBoolean KnightB;
- @MLProp2 public static STBoolean hostilesBreakWallsB;
- @MLProp2 public static STFloat MiningZombieDigPower;
- public static long lastTickRun = 0;
- public static boolean inMenu = false;
- public ModSettings settings;
- public ModSettingScreen screen;
- public mod_MinerZombie() {
- ModLoader.RegisterEntityID(EntityZombieKnight.class, "ZombieKnight", ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityZombieNazi.class, "ZombieNazi", ModLoader.getUniqueEntityId());
- ModLoader.RegisterEntityID(EntityZombieMiner.class, "ZombieMiner", ModLoader.getUniqueEntityId());
- /*ModLoader.RegisterEntityID(EntityPetArrow.class, "PetArrow", ModLoader.getUniqueEntityId());*/
- ModLoader.AddSpawn(EntityZombieKnight.class, 10, 0, 1000, EnumCreatureType.monster);
- ModLoader.AddSpawn(EntityZombieNazi.class, 10, 0, 1000, EnumCreatureType.monster);
- ModLoader.AddSpawn(EntityZombieMiner.class, 10, 0, 1000, EnumCreatureType.monster);
- }
- public void ModsLoaded() {
- try {
- mod_PathingActivated.hasMinerZombie = true;
- } catch (Exception ex) {
- }
- loadConfig();
- }
- public void loadConfig() {
- NaziB = new STBoolean("NaziB", true);
- KnightB = new STBoolean("KnightB", true);
- hostilesBreakWallsB = new STBoolean("hostilesBreakWalls", true);
- MiningZombieDigPower = new STFloat("MiningZombieDigPower", 2.8F, 0.0F, 0.1F, 50F);
- settings = new ModSettings("Miner Zombie Settings");
- screen = new ModSettingScreen("Miner Zombie");
- settings.append(NaziB);
- screen.append(new WidgetBoolean(NaziB, "Enable Zombie Nazi"));
- settings.append(KnightB);
- screen.append(new WidgetBoolean(KnightB, "Enable Zombie Knight"));
- settings.append(hostilesBreakWallsB);
- screen.append(new WidgetBoolean(hostilesBreakWallsB, "Enable Zombie Miner"));
- settings.append(MiningZombieDigPower);
- screen.append(new WidgetFloat(MiningZombieDigPower, "Zombie dig power"));
- SimpleButtonModel simplebuttonmodel = new SimpleButtonModel();
- simplebuttonmodel.addActionCallback(new ModAction(settings, "resetAll", new Class[0]));
- Button button = new Button(simplebuttonmodel);
- button.setText("Reset all to defaults");
- screen.append(button);
- settings.load();
- //run();
- (new Thread(this)).start();
- inMenu = true;
- try {
- //enable for non guiapi
- //mod_AITools.setupProperties(this.getClass());
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
- public void run() {
- try {
- while(true) {
- if(mc == null) {
- mc = ModLoader.getMinecraftInstance();
- }
- if(mc == null) {
- Thread.sleep(500L);
- } else if(mc.thePlayer == null) {
- Thread.sleep(500L);
- } else {
- worldRef = mc.theWorld;
- theplayer = mc.thePlayer;
- Thread.sleep(5000L);
- }
- }
- } catch (Throwable var6) {
- var6.printStackTrace();
- }
- }
- public void AddRenderer(Map var1) {
- var1.put(EntityZombieKnight.class, new RenderBiped(new ModelBiped(), 0.5F));
- var1.put(EntityZombieNazi.class, new RenderBiped(new ModelBiped(), 0.5F));
- var1.put(EntityZombieMiner.class, new RenderBiped(new ModelBiped(), 0.5F));
- }
- public String Version() {
- return "v1.0 for MC b1.7.3";
- }
- public static void mineComplete(EntityCreature entityliving) {
- entityliving.mining = false;
- entityliving.noMoveTicks = 0;
- entityliving.curBlockDmg = 0.0F;
- if(entityliving instanceof EntityZombieMiner) {
- ((EntityZombieMiner)entityliving).swingArm = false;
- entityliving.forcejump = true;
- }
- }
- public static void tryDig(EntityCreature entityliving, EntityLiving entityliving1) {
- if(entityliving1 == null) {
- return;
- }
- float f = 2.0F;
- float f1 = entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * f;
- float f2 = entityliving.prevRotationPitch + (entityliving.rotationPitch - entityliving.prevRotationPitch) * f;
- f1 = 0.0F;
- float f3 = entityliving.prevRotationYaw + (entityliving.rotationYaw - entityliving.prevRotationYaw) * f;
- int i = (int)Math.floor((double)(f3 / 90F) + 0.5D);
- f3 = (float)i * 90F;
- double d = entityliving.prevPosX + (entityliving.posX - entityliving.prevPosX) * (double)f;
- double d1 = (entityliving.prevPosY + (entityliving.posY - entityliving.prevPosY) * (double)f + 1.6200000000000001D) - (double)entityliving.yOffset;
- double d2 = entityliving.prevPosZ + (entityliving.posZ - entityliving.prevPosZ) * (double)f;
- Vec3D vec3d = Vec3D.createVector(d, d1, d2);
- float f4 = MathHelper.cos(-f3 * 0.01745329F - 3.141593F);
- float f5 = MathHelper.sin(-f3 * 0.01745329F - 3.141593F);
- float f6 = -MathHelper.cos(-f1 * 0.01745329F - 0.7853982F);
- float f7 = MathHelper.sin(-f1 * 0.01745329F - 0.7853982F);
- float f8 = f5 * f6;
- float f9 = f7;
- float f10 = f4 * f6;
- entityliving.info = f3;
- double d3 = 1.0D;
- double d4 = 1.8D;
- double d5 = 0.050000000000000003D;
- Vec3D vec3d1 = vec3d.addVector((double)f8 * d3, (double)f9 * d3, (double)f10 * d3);
- MovingObjectPosition movingobjectposition = entityliving.worldObj.rayTraceBlocks_do(vec3d, vec3d1, true);
- if(movingobjectposition == null) {
- return;
- }
- int j = MathHelper.floor_float((float)(entityliving.posX - entityliving1.posX));
- int k = (int)(entityliving.posY - entityliving1.posY);
- int l = MathHelper.floor_float((float)(entityliving.posZ - entityliving1.posZ));
- boolean flag = false;
- if(j + l > 0) {
- if((float)(k / (j + l)) > 1.0F) {
- flag = true;
- }
- } else if(k > 2) {
- flag = true;
- }
- if(movingobjectposition.typeOfHit == EnumMovingObjectType.TILE || flag) {
- int i2 = f2 >= -20F ? 0 : 1;
- int i1;
- int j1;
- int k1;
- if(flag) {
- i1 = (int)entityliving.posX;
- j1 = (int)entityliving.posZ - 1;
- k1 = (int)entityliving.posZ;
- } else {
- i1 = movingobjectposition.blockX;
- j1 = movingobjectposition.blockY + i2;
- k1 = movingobjectposition.blockZ;
- }
- int l1 = entityliving.worldObj.getBlockId(i1, j1, k1);
- if(l1 == 0 && (i2 == 1 || flag)) {
- j1--;
- l1 = entityliving.worldObj.getBlockId(i1, j1, k1);
- if(l1 == 0 && i2 == 1) {
- j1--;
- l1 = entityliving.worldObj.getBlockId(i1, j1, k1);
- }
- }
- if(i1 != entityliving.curBlockX || j1 != entityliving.curBlockZ) {
- entityliving.curBlockDmg = 0.0F;
- entityliving.curBlockX = i1;
- entityliving.curBlockZ = j1;
- }
- Block block = Block.blocksList[l1];
- float f11 = MiningZombieDigPower.get() * (float)(entityliving.nearbyMinerCount + 1);
- if(block != null) {
- if(entityliving instanceof EntityZombieMiner) {
- ((EntityZombieMiner)entityliving).swingArm = true;
- }
- double d6 = (double)f8 * d5;
- double d7 = (double)f9 * d5;
- double d8 = (double)f10 * d5;
- for(int j2 = 0; j2 <= (int)entityliving.curBlockDmg; j2++) {
- entityliving.worldObj.spawnParticle("explode", d + ((double)f8 * d4 + (double)(entityliving.worldObj.rand.nextFloat() * (entityliving.curBlockDmg / 10F))), d1 + (double)f9 * d4 + 0.0D + (double)((entityliving.worldObj.rand.nextFloat() * entityliving.curBlockDmg) / 10F), d2 + ((double)f10 * d4 + (double)((entityliving.worldObj.rand.nextFloat() * entityliving.curBlockDmg) / 10F)), 0.0D, 0.0D, 0.0D);
- }
- mc.effectRenderer.addBlockHitEffects((int)i1, (int)j1, (int)k1, 0);
- entityliving.worldObj.playSoundAtEntity(entityliving, "step.stone", 1.0F, 1.0F / (entityliving.worldObj.rand.nextFloat() * 0.4F + 0.8F));
- entityliving.curBlockDmg += f11 / (float)block.blockHardness;
- if(entityliving.getDistanceToEntity(theplayer) >= 17F);
- if(entityliving.curBlockDmg > 10F) {
- entityliving.curBlockDmg = 0.0F;
- mc.effectRenderer.addBlockDestroyEffects((int)i1, (int)j1, (int)k1, 1, 0);
- entityliving.worldObj.spawnParticle("flame", d + (double)f8 * d4, d1 + (double)f9 * d4, d2 + (double)f10 * d4, d6 / 2D, d7 / 2D, d8 / 2D);
- entityliving.worldObj.setBlockWithNotify(i1, j1, k1, 0);
- mineComplete(entityliving);
- entityliving.nearbyMinerCount = 0;
- Object obj = null;
- List list = entityliving.worldObj.getEntitiesWithinAABBExcludingEntity(entityliving, entityliving.boundingBox.expand(2D, 2D, 2D));
- if(list != null) {
- for(int k2 = 0; k2 < list.size(); k2++) {
- Entity entity = (Entity)list.get(k2);
- if(entity instanceof EntityCreature) {
- entityliving.nearbyMinerCount++;
- mineComplete((EntityCreature)entity);
- }
- }
- }
- }
- if(entityliving.worldObj.getBlockMaterial(i1, j1, k1) != Material.ground) {
- if(entityliving.worldObj.getBlockMaterial(i1, j1, k1) != Material.rock);
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement