From 87f3c9edb7d8fe6d2e5f8176ad7454079d1da6a4 Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 18 Aug 2020 21:51:01 +0200 Subject: [PATCH] Reworking Balls-O-Tron --- .../assets/hbm/textures/blocks/brick_base.png | Bin 0 -> 701 bytes .../textures/blocks/brick_cracked_base.png | Bin 0 -> 736 bytes .../hbm/textures/blocks/brick_jungle.png | Bin 0 -> 621 bytes .../textures/blocks/brick_jungle_cracked.png | Bin 0 -> 606 bytes .../hbm/textures/blocks/brick_jungle_trap.png | Bin 0 -> 642 bytes .../hbm/textures/models/machines/breeder.png | Bin 0 -> 2533 bytes src/main/java/com/hbm/blocks/ModBlocks.java | 8 + .../mob/botprime/EntityBOTPrimeBase.java | 57 ++++++ .../mob/botprime/EntityBOTPrimeBody.java | 86 +++++++++ .../mob/botprime/EntityBOTPrimeHead.java | 156 +++++++++++++++ .../mob/botprime/EntityBurrowingNT.java | 52 +++++ .../entity/mob/botprime/EntityWormBaseNT.java | 177 ++++++++++++++++++ .../mob/botprime/WormMovementBodyNT.java | 74 ++++++++ .../mob/botprime/WormMovementHeadNT.java | 92 +++++++++ .../EntityBallsOTronHead.java | 1 - .../java/com/hbm/items/tool/ItemWandD.java | 6 +- src/main/java/com/hbm/lib/HbmWorldGen.java | 2 +- .../hbm/world/generator/CellularDungeon.java | 9 +- .../generator/CellularDungeonFactory.java | 24 ++- .../hbm/world/generator/JungleDungeon.java | 18 ++ .../com/hbm/world/generator/TestDungeon.java | 4 +- .../generator/room/JungleDungeonRoom.java | 47 +++++ 22 files changed, 793 insertions(+), 20 deletions(-) create mode 100644 src/main/java/assets/hbm/textures/blocks/brick_base.png create mode 100644 src/main/java/assets/hbm/textures/blocks/brick_cracked_base.png create mode 100644 src/main/java/assets/hbm/textures/blocks/brick_jungle.png create mode 100644 src/main/java/assets/hbm/textures/blocks/brick_jungle_cracked.png create mode 100644 src/main/java/assets/hbm/textures/blocks/brick_jungle_trap.png create mode 100644 src/main/java/assets/hbm/textures/models/machines/breeder.png create mode 100644 src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java create mode 100644 src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBody.java create mode 100644 src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeHead.java create mode 100644 src/main/java/com/hbm/entity/mob/botprime/EntityBurrowingNT.java create mode 100644 src/main/java/com/hbm/entity/mob/botprime/EntityWormBaseNT.java create mode 100644 src/main/java/com/hbm/entity/mob/botprime/WormMovementBodyNT.java create mode 100644 src/main/java/com/hbm/entity/mob/botprime/WormMovementHeadNT.java create mode 100644 src/main/java/com/hbm/world/generator/JungleDungeon.java create mode 100644 src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java diff --git a/src/main/java/assets/hbm/textures/blocks/brick_base.png b/src/main/java/assets/hbm/textures/blocks/brick_base.png new file mode 100644 index 0000000000000000000000000000000000000000..9718c05ad5c80bbe473086c00fabd7b6f345109a GIT binary patch literal 701 zcmV;u0z&Q}k{6?oCYEL<3Pk8Gh&ITpf0@ zZ}tdvMd;5xZQ3jYb{OF zV2mM-V=k8q=kuBEcFW`OU>rw=Vc>eblBOw}%?9s1d7g8U`LXszk{o-E6l=NTacDoGNIF-R#HhJhqWsOuW7HA#}7wZ>YDwU&9F z2_f+F^Fx+pD5X#UZ*Olr9uJgKyk0MqQlx3Reg_aj(Dyy#IP!nI_o%9>NRoss%Me0v zxm-w+1R(?=1jccs?|YIY!F!Jof-K93;~0R=|I6Nc+O{Q4Q?%A}UB@_%E40_^#eTnE zYY8C$P+iv%Lg0SC6UQ-86w!4Z&N)H|0E7^TqKL9Aky5VJHk%FV>+6fMEIA&Jc<;I2 z?AH@( zt`S0TI2^FnQdJcjW6T=$^Yasc{eDjffe-@2FwnLwr_+fn%K&KG7AYlt-=m76U>rw` zF$f_ThJiFqx!rC^DLEdG2qF0U`(wY~aL!Q_ z1=d=OF}z+c(llKSskUvIrfH=srKBuNlu|h7P)bqPHN!BhtCXT?8kS{2P18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)A%y!oq_$Rc}3Fh}A z#(Qfc%kB-iwhde^_jKdf(ss^NoQtUIn!e}vbq<;aZZ~k3i`C}6{RdrlSBPV1nt+I{ zZ#Nskd#m+&1=loo*OSB!sKViJ?|-*5C)23`W-}wcT^pLW3q^<` z8Ud}6$)A#DW)CLKX=d!t_UF$Y@82)nY}Uu~Jnruc?(SlOAYirnWIT?js*2@u$Hm2f zrfD!{i*vBs!P^_?AOK@Z@*K2=mzR|JJf>+NO%3Zc#4$WR7DN$P3%(CwD0pQpcpl7V z5yK%Q34DI0WEteSR0=~lJALOH2~^WSRf#ZF1)B|wM$-THw}7k_%5DEjbqTz`Q(T+X_eGq#mg-F-Iw&Q+x)uf? zKHmrZ`}YBPUJ*ro9v(`D!;VpwN$_YSiB>DPyc}SyCC@94j$(9@R44_`mHP^H&5upq zK_KJ3zV2g8K^#W_Y&I#%80pbDxVagUBwZWMi4JKBx3@7$DXax!%zl)5Iu%e|!)BB3 z#}|eofY;ZQC=zCi1sop>M)i7%_xCPfGLc@_YY{Tba(cZUgMsYGVgV;7vRun0 z=q$7QF||z2&!tk5h}ucAX1f)?){K+P-~X_MpZ52QYdhE123NVE_OC07*qoM6N<$f{WS&g#Z8m literal 0 HcmV?d00001 diff --git a/src/main/java/assets/hbm/textures/blocks/brick_jungle_trap.png b/src/main/java/assets/hbm/textures/blocks/brick_jungle_trap.png new file mode 100644 index 0000000000000000000000000000000000000000..b11a1ae6b4982e308ab68b8f24d62d1e15870540 GIT binary patch literal 642 zcmV-|0)737P)1KiEs0|Y0&ot})Ue$S1jYcs>uZYEFrPzN zmh5&TmkU@c1?zP{7{cWONfL0o4JZXBiojZr)+gE)qDWDeo-l+cf-r<(fMIalZs0w9 zd^nN>i~$4i@Sr#z2aJL9*<%dE@tqw&DPg}}`8m#k$#aMzPm+LAip|CoMN;6s6kIOS zjdSvzBrux^i1|hiLueXL9Lwir`5PU8R#1HwjOT*qX91kg1suRMjRZv@g_8+14d@UK zhXR1U@6j6ed(iqWEe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o{=0s#K~ zuUECoH$Cs8{mI|=;o_giC(h3k01+7`Oy}Y)g!Z$@RlezYkL|bGbfy211FJFhrs{jw zH9En*f24rF2_YiGzCl+7Y}Yg?8|=433iuDhjnoQIzfJFd6GE7-u@UUA2IoZHRRJHB z3-;SnI}>B;<9!kAFGonFb)4D)>V3R#g8k*N3fMIK4dwlouZvMYQ~2xZ`KISRw%>~AvHk{YU-*7`?Sz6oJ#{Ua>jgy{JASOCD$(UDifr>Cc- z^I+d>|NobNILlQ|BYyw!4FKTV@9%%$v!Y*YAA7S&Uz}_cU9JD&ckW$jRmfj%QHAvV zwE5!n^z?ynMAz%TEOHEtzPUes|MAU(?xQJsMSa?&dg^q&{>#FE)olUrU0L0>>AmlJ ztfT&Ixc>)`O7^_%Q*7%deAq1Qx3pycyIB7=uyt<0@y#kdWF7dZyBq_>+b_qmR1MN? z#}Zc^yI%igVe8z0;~U?Nv2J|S-PnbG`~7j_P~7zNni_bSr}*gT$T%0Xb)j9Ve_KKn zT5*p~M4>9ao?aI|pJJV^*S{$VbrEFTXBNZv_;lY0Wcy9&v#!?v@Vj<46JK9^6;GE5 zswXvs{_|zoT>ah2>?*>hrVZ0}Q&U*beT3zk5EgVFVfiM6zm@g~%QqoxYU(&)V{gX^ z8+$iQ*x1{1!Wh_bf`A<-1Th^a1Th;X1Tj4)jDZ~|2-tCgfE_0Y*m1%%qT?j=59tHl v#JC<9csx`s1cxqk!xRhd{QUa*+WGlkmxs;B*q=jC00000NkvXXu0mjfJ#p_j literal 0 HcmV?d00001 diff --git a/src/main/java/com/hbm/blocks/ModBlocks.java b/src/main/java/com/hbm/blocks/ModBlocks.java index 52bb8f972..3a5be3fd4 100644 --- a/src/main/java/com/hbm/blocks/ModBlocks.java +++ b/src/main/java/com/hbm/blocks/ModBlocks.java @@ -205,6 +205,9 @@ public class ModBlocks { public static Block meteor_spawner; public static Block meteor_battery; + public static Block brick_jungle; + public static Block brick_jungle_cracked; + public static Block tape_recorder; public static Block steel_poles; public static Block pole_top; @@ -972,6 +975,9 @@ public class ModBlocks { meteor_pillar = new BlockRotatablePillar(Material.rock, RefStrings.MODID + ":meteor_pillar_top").setBlockName("meteor_pillar").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":meteor_pillar"); meteor_spawner = new BlockCybercrab(Material.rock).setBlockName("meteor_spawner").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F); meteor_battery = new BlockPillar(Material.rock, RefStrings.MODID + ":meteor_power").setBlockName("meteor_battery").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":meteor_spawner_side"); + + brick_jungle = new BlockGeneric(Material.rock).setBlockName("brick_jungle").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle"); + brick_jungle_cracked = new BlockGeneric(Material.rock).setBlockName("brick_jungle_cracked").setCreativeTab(MainRegistry.blockTab).setHardness(15.0F).setResistance(900.0F).setBlockTextureName(RefStrings.MODID + ":brick_jungle_cracked"); tape_recorder = new DecoTapeRecorder(Material.rock).setBlockName("tape_recorder").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":deco_tape_recorder"); steel_poles = new DecoSteelPoles(Material.rock).setBlockName("steel_poles").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(15.0F).setBlockTextureName(RefStrings.MODID + ":steel_beam"); @@ -1622,6 +1628,8 @@ public class ModBlocks { GameRegistry.registerBlock(meteor_pillar, meteor_pillar.getUnlocalizedName()); GameRegistry.registerBlock(meteor_spawner, meteor_spawner.getUnlocalizedName()); GameRegistry.registerBlock(meteor_battery, ItemBlockLore.class, meteor_battery.getUnlocalizedName()); + GameRegistry.registerBlock(brick_jungle, brick_jungle.getUnlocalizedName()); + GameRegistry.registerBlock(brick_jungle_cracked, brick_jungle_cracked.getUnlocalizedName()); GameRegistry.registerBlock(tape_recorder, tape_recorder.getUnlocalizedName()); GameRegistry.registerBlock(steel_poles, steel_poles.getUnlocalizedName()); GameRegistry.registerBlock(pole_top, pole_top.getUnlocalizedName()); diff --git a/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java new file mode 100644 index 000000000..159fdf03d --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBase.java @@ -0,0 +1,57 @@ +package com.hbm.entity.mob.botprime; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.util.Vec3; +import net.minecraft.world.World; + +public abstract class EntityBOTPrimeBase extends EntityWormBaseNT { + + public int attackCounter = 0; + + protected final IEntitySelector selector = new IEntitySelector() { + + @Override + public boolean isEntityApplicable(Entity ent) { + + if(ent instanceof EntityWormBaseNT && ((EntityWormBaseNT)ent).getHeadID() == EntityBOTPrimeBase.this.getHeadID()) + return false; + + return true; + } + + }; + + public EntityBOTPrimeBase(World world) { + super(world); + this.setSize(2.0F, 2.0F); + this.isImmuneToFire = true; + this.isAirBorne = true; + this.noClip = true; + this.renderDistanceWeight = 15.0D; + this.dragInAir = 0.995F; + this.dragInGround = 0.98F; + this.knockbackDivider = 1.0D; + } + + public boolean canEntityBeSeenThroughNonSolids(Entity p_70685_1_) { + return this.worldObj.func_147447_a(Vec3.createVectorHelper(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ), Vec3.createVectorHelper(p_70685_1_.posX, p_70685_1_.posY + (double)p_70685_1_.getEyeHeight(), p_70685_1_.posZ), false, true, false) == null; + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(5000.0D); + } + + @Override + protected boolean isAIEnabled() { + return true; + } + + @Override + protected boolean canDespawn() { + return false; + } +} diff --git a/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBody.java b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBody.java new file mode 100644 index 000000000..1d76b5e76 --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeBody.java @@ -0,0 +1,86 @@ +package com.hbm.entity.mob.botprime; + +import com.hbm.entity.mob.EntityAINearestAttackableTargetNT; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityBOTPrimeBody extends EntityBOTPrimeBase { + + private WormMovementBodyNT movement = new WormMovementBodyNT(this); + + public EntityBOTPrimeBody(World world) { + super(world); + this.bodySpeed = 0.6D; + this.rangeForParts = 70.0D; + this.segmentDistance = 1.9D; + this.maxBodySpeed = 1.4D; + this.targetTasks.addTask(1, new EntityAINearestAttackableTargetNT(this, EntityLivingBase.class, 0, true, false, this.selector, 128.0D)); + } + + @Override + protected void entityInit() { + super.entityInit(); + this.dataWatcher.addObject(17, (byte)0); + } + + @Override + public float getAttackStrength(Entity target) { + + if(target instanceof EntityLivingBase) { + return ((EntityLivingBase) target).getHealth() * 0.75F; + } + + return 100; + } + + @Override + protected void updateAITasks() { + this.movement.updateMovement(); + + if((this.followed != null) && (getPartNumber() == 0)) { + //this.dataWatcher.updateObject(17, Byte.valueOf((byte) (((EntityBallsOTronHead) this.followed).isArmored() ? 1 : 0))); + } else if(this.targetedEntity != null) { + this.dataWatcher.updateObject(17, Byte.valueOf(this.targetedEntity.getDataWatcher().getWatchableObjectByte(17))); + } + if(this.didCheck) { + if(this.targetedEntity == null || !this.targetedEntity.isEntityAlive()) { + setHealth(getHealth() - 1999.0F); + } + if(((this.followed == null) || (!this.followed.isEntityAlive())) && (this.rand.nextInt(60) == 0)) { + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 2.0F, false); + } + } + if((this.followed != null) && (getAttackTarget() != null)) { + if(canEntityBeSeenThroughNonSolids(getAttackTarget())) { + this.attackCounter += 1; + if(this.attackCounter == 10) { + //useLaser(o(), false); + + this.attackCounter = -20; + } + } else if(this.attackCounter > 0) { + this.attackCounter -= 1; + } + } else if(this.attackCounter > 0) { + this.attackCounter -= 1; + } + + float f3 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); + this.prevRotationYaw = this.rotationYaw = (float)(Math.atan2(motionX, motionZ) * 180.0D / Math.PI); + this.prevRotationPitch = this.rotationPitch = (float)(Math.atan2(motionY, f3) * 180.0D / Math.PI); + } + + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("partID", this.getPartNumber()); + } + + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + setPartNumber(nbt.getInteger("partID")); + } +} diff --git a/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeHead.java b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeHead.java new file mode 100644 index 000000000..c4124d06c --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/botprime/EntityBOTPrimeHead.java @@ -0,0 +1,156 @@ +package com.hbm.entity.mob.botprime; + +import com.hbm.entity.mob.EntityAINearestAttackableTargetNT; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.IEntityLivingData; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.entity.ai.EntityAIHurtByTarget; +import net.minecraft.entity.boss.IBossDisplayData; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IChatComponent; +import net.minecraft.util.MathHelper; +import net.minecraft.world.World; + +public class EntityBOTPrimeHead extends EntityBOTPrimeBase implements IBossDisplayData { + + /* ___ _ _ _ ___ ___ _____ ___ ___ _ _ ___ ___ _ _ _ ___ + * | _ ) /_\ | | | | / __| ___ | | ___ |_ _| _ )| | \| | | _ \ _ )| | \ / | __| + * | _ \/ _ \| |_| |_\__ \ |___| | | | |___| | | | \| | | | | _/ \| | V | _| + * |___/_/ \_\___|___|___/ |___| |_| |_|\_\___|_|\_| |_| |_|\_\_|_|V|_|___| + */ + + private final WormMovementHeadNT movement = new WormMovementHeadNT(this); + + public EntityBOTPrimeHead(World world) { + super(world); + this.experienceValue = 1000; + this.wasNearGround = false; + this.attackRange = 150.0D; + this.setSize(3.0F, 3.0F); + this.maxSpeed = 1.0D; + this.fallSpeed = 0.006D; + this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false)); + this.targetTasks.addTask(2, new EntityAINearestAttackableTargetNT(this, EntityPlayer.class, 0, false, false, null, 128.0D)); + this.targetTasks.addTask(3, new EntityAINearestAttackableTargetNT(this, Entity.class, 0, false, false, this.selector, 50.0D)); + } + + @Override + protected void applyEntityAttributes() { + super.applyEntityAttributes(); + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.15D); + } + + @Override + public boolean getIsHead() { + return true; + } + + @Override + public boolean attackEntityFrom(DamageSource par1DamageSource, float par2) { + + if(super.attackEntityFrom(par1DamageSource, par2)) { + this.dmgCooldown = 4; + return true; + } + + return false; + } + + public IEntityLivingData onSpawnWithEgg(IEntityLivingData data) { + + //TODO: check if this is even needed + setHeadID(this.getEntityId()); + + int x = MathHelper.floor_double(this.posX); + int y = MathHelper.floor_double(this.posY); + int z = MathHelper.floor_double(this.posZ); + + for (int i = 0; i < 119; i++) { + + EntityBOTPrimeBody bodyPart = new EntityBOTPrimeBody(this.worldObj); + bodyPart.setPartNumber(i); + bodyPart.setPosition(x, y, z); + bodyPart.setHeadID(getEntityId()); + this.worldObj.spawnEntityInWorld(bodyPart); + } + + setPosition(x, y, z); + this.spawnPoint.set(x, y, z); + + this.aggroCooldown = 60; + + return super.onSpawnWithEgg(data); + } + + @Override + protected void updateAITasks() { + + super.updateAITasks(); + + this.movement.updateMovement(); + + if ((getHealth() < getMaxHealth()) && (this.ticksExisted % 6 == 0)) { + if (this.targetedEntity != null) { + heal(1.0F); + } else if (this.recentlyHit == 0) { + heal(4.0F); + } + } + if ((this.targetedEntity != null) && (this.targetedEntity.getDistanceSqToEntity(this) < this.attackRange * this.attackRange)) + { + if (canEntityBeSeenThroughNonSolids(this.targetedEntity)) + { + this.attackCounter += 1; + if (this.attackCounter == 10) + { + //useLaser(this.targetedEntity, true); + + this.attackCounter = -20; + } + } + else if (this.attackCounter > 0) + { + this.attackCounter -= 1; + } + } + else if (this.attackCounter > 0) { + this.attackCounter -= 1; + } + } + + @Override + public float getAttackStrength(Entity target) { + + if(target instanceof EntityLivingBase) { + return ((EntityLivingBase) target).getHealth() * 0.75F; + } + + return 100; + } + + @Override + public IChatComponent func_145748_c_() { + return super.func_145748_c_(); + } + + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) + { + super.writeEntityToNBT(par1NBTTagCompound); + par1NBTTagCompound.setInteger("AggroCD", this.aggroCooldown); + par1NBTTagCompound.setInteger("CenterX", this.spawnPoint.posX); + par1NBTTagCompound.setInteger("CenterY", this.spawnPoint.posY); + par1NBTTagCompound.setInteger("CenterZ", this.spawnPoint.posZ); + } + + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) + { + super.readEntityFromNBT(par1NBTTagCompound); + this.aggroCooldown = par1NBTTagCompound.getInteger("AggroCD"); + this.spawnPoint.set(par1NBTTagCompound.getInteger("CenterX"), par1NBTTagCompound.getInteger("CenterY"), par1NBTTagCompound.getInteger("CenterZ")); + } + +} diff --git a/src/main/java/com/hbm/entity/mob/botprime/EntityBurrowingNT.java b/src/main/java/com/hbm/entity/mob/botprime/EntityBurrowingNT.java new file mode 100644 index 000000000..9215d6088 --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/botprime/EntityBurrowingNT.java @@ -0,0 +1,52 @@ +package com.hbm.entity.mob.botprime; + +import net.minecraft.entity.EntityCreature; +import net.minecraft.world.World; + +public abstract class EntityBurrowingNT extends EntityCreature { + + protected float dragInAir; + protected float dragInGround; + + public EntityBurrowingNT(World world) { + super(world); + } + + protected void fall(float dist) { } + + public float getEyeHeight() { + return this.height * 0.5F; + } + + public boolean getIsHead() { + return false; + } + + protected void updateFallState(double distFallen, boolean onGround) { } + + public void moveEntityWithHeading(float strafe, float forward) { + + float drag = this.dragInGround; + if ((!isEntityInsideOpaqueBlock()) && (!isInWater()) && (!handleLavaMovement())) + { + drag = this.dragInAir; + } + else + { + //TODO: sounds when tunneling + } + if (!getIsHead()) { + drag *= 0.9F; + } + moveFlying(strafe, forward, 0.02F); + + moveEntity(this.motionX, this.motionY, this.motionZ); + this.motionX *= drag; + this.motionY *= drag; + this.motionZ *= drag; + } + + public boolean isOnLadder() { + return false; + } +} diff --git a/src/main/java/com/hbm/entity/mob/botprime/EntityWormBaseNT.java b/src/main/java/com/hbm/entity/mob/botprime/EntityWormBaseNT.java new file mode 100644 index 000000000..31ac8fadf --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/botprime/EntityWormBaseNT.java @@ -0,0 +1,177 @@ +package com.hbm.entity.mob.botprime; + +import java.util.List; + +import com.hbm.entity.mob.sodtekhnologiyah.EntityBurrowing; + +import net.minecraft.command.IEntitySelector; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ChunkCoordinates; +import net.minecraft.util.DamageSource; +import net.minecraft.world.EnumDifficulty; +import net.minecraft.world.World; + +public abstract class EntityWormBaseNT extends EntityBurrowing { + + public int aggroCooldown = 0; + public int courseChangeCooldown = 0; + public double waypointX; + public double waypointY; + public double waypointZ; + protected Entity targetedEntity = null; + protected boolean canFly = false; + protected int dmgCooldown = 0; + protected boolean wasNearGround; + protected ChunkCoordinates spawnPoint = new ChunkCoordinates(); + protected double attackRange; + protected double maxSpeed; + protected double fallSpeed; + protected double rangeForParts; + protected EntityLivingBase followed; + protected int surfaceY; + private int headID; + private int partNum; + protected boolean didCheck; + protected double bodySpeed; + protected double maxBodySpeed; + protected double segmentDistance; + protected double knockbackDivider; + + public static final IEntitySelector wormSelector = new IEntitySelector() { + + @Override + public boolean isEntityApplicable(Entity target) { + return target instanceof EntityWormBaseNT; + } + }; + + public EntityWormBaseNT(World world) { + super(world); + this.setSize(1.0F, 1.0F); + this.surfaceY = 60; + this.renderDistanceWeight = 5.0D; + } + + public int getPartNumber() { + return this.partNum; + } + + public void setPartNumber(int num) { + this.partNum = num; + } + + public int getHeadID() { + return this.headID; + } + + public void setHeadID(int id) { + this.headID = id; + } + + @Override + public boolean attackEntityFrom(DamageSource source, float amount) { + + if(this.isEntityInvulnerable() || source == DamageSource.drown || source == DamageSource.inWall || ((source.getEntity() instanceof EntityWormBaseNT) && ((EntityWormBaseNT) source.getEntity()).getHeadID() == this.getHeadID())) { + return false; + } else { + this.setBeenAttacked(); + return super.attackEntityFrom(source, amount); + } + } + + //TODO: test this with onUpdate instead + protected void updateEntityActionState() { + + if((!this.worldObj.isRemote) && (this.worldObj.difficultySetting == EnumDifficulty.PEACEFUL)) { + setDead(); + } + if((this.targetedEntity != null) && (this.targetedEntity.isDead)) { + this.targetedEntity = null; + } + /*if((getIsHead()) && (this.targetedEntity != null) && ((this.targetedEntity instanceof EntityPlayer))) { + this.entityAge = 0; + }*/ + if(this.posY < -10.0D) { + setPositionAndUpdate(this.posX, 128.0D, this.posZ); + this.motionY = 0.0D; + } else if(this.posY < 3.0D) { + this.motionY = 0.3D; + } + + if(this.ticksExisted % 10 == 0) { + attackEntitiesInList(this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.expand(0.5D, 0.5D, 0.5D))); + } + } + + protected void attackEntitiesInList(List targets) { + + for(Entity target : targets) { + if(((target instanceof EntityLivingBase)) && (canAttackClass(target.getClass())) && ((!(target instanceof EntityWormBaseNT)) || (((EntityWormBaseNT) target).getHeadID() != this.getHeadID()))) { + attackEntityAsMob(target); + } + } + } + + @Override + public boolean canAttackClass(Class clazz) { + return true; + } + + @Override + public boolean attackEntityAsMob(Entity target) { + + boolean var2 = target.attackEntityFrom(DamageSource.causeMobDamage(this), getAttackStrength(target)); + + if(var2) { + this.entityAge = 0; + double tx = (this.boundingBox.minX + this.boundingBox.maxX) / 2.0D; + double tz = (this.boundingBox.minZ + this.boundingBox.maxZ) / 2.0D; + double ty = (this.boundingBox.minY + this.boundingBox.maxY) / 2.0D; + double deltaX = target.posX - tx; + double deltaZ = target.posZ - tz; + double deltaY = target.posY - ty; + double knockback = this.knockbackDivider * (deltaX * deltaX + deltaZ * deltaZ + deltaY * deltaY + 0.1D); + target.addVelocity(deltaX / knockback, deltaY / knockback, deltaZ / knockback); + } + + return var2; + } + + public abstract float getAttackStrength(Entity paramsa); + + @Override + public void addVelocity(double x, double y, double z) { + } + + @Override + public void faceEntity(Entity entity, float yaw, float pitch) { + } + + protected boolean isCourseTraversable() { + return (this.canFly) || (isEntityInsideOpaqueBlock()); + } + + @Override + protected float getSoundVolume() { + return 5.0F; + } + + @Override + public void setDead() { + playSound(getDeathSound(), getSoundVolume(), getSoundPitch()); + super.setDead(); + } + + public void writeEntityToNBT(NBTTagCompound nbt) { + super.writeEntityToNBT(nbt); + nbt.setInteger("wormID", this.getHeadID()); + } + + public void readEntityFromNBT(NBTTagCompound nbt) { + super.readEntityFromNBT(nbt); + setHeadID(nbt.getInteger("wormID")); + } + +} diff --git a/src/main/java/com/hbm/entity/mob/botprime/WormMovementBodyNT.java b/src/main/java/com/hbm/entity/mob/botprime/WormMovementBodyNT.java new file mode 100644 index 000000000..763a4b4ef --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/botprime/WormMovementBodyNT.java @@ -0,0 +1,74 @@ +package com.hbm.entity.mob.botprime; + +import java.util.List; + +import com.hbm.entity.mob.sodtekhnologiyah.EntityWormBase; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.MathHelper; + +public class WormMovementBodyNT { + private EntityWormBaseNT user; + + public WormMovementBodyNT(EntityWormBaseNT user) { + this.user = user; + } + + protected void updateMovement() { + + double targetingRange = 128.0D; + + if((this.user.targetedEntity != null) && (this.user.targetedEntity.getDistanceSqToEntity(this.user) < targetingRange * targetingRange)) { + this.user.waypointX = this.user.targetedEntity.posX; + this.user.waypointY = this.user.targetedEntity.posY; + this.user.waypointZ = this.user.targetedEntity.posZ; + } + + if(((this.user.ticksExisted % 60 == 0) || (this.user.ticksExisted == 1)) && ((this.user.targetedEntity == null) || (this.user.followed == null))) { + findEntityToFollow(this.user.worldObj.selectEntitiesWithinAABB(EntityLiving.class, this.user.boundingBox.expand(this.user.rangeForParts, this.user.rangeForParts, this.user.rangeForParts), EntityWormBase.wormSelector)); + } + + double deltaX = this.user.waypointX - this.user.posX; + double deltaY = this.user.waypointY - this.user.posY; + double deltaZ = this.user.waypointZ - this.user.posZ; + double deltaDist = MathHelper.sqrt_double(deltaX * deltaX + deltaY * deltaY + deltaZ * deltaZ); + + if(this.user.targetedEntity != null) { + this.user.faceEntity(this.user.targetedEntity, 180.0F, 180.0F); + } + + this.user.bodySpeed = Math.max(0.0D, Math.min(deltaDist - this.user.segmentDistance, this.user.maxBodySpeed)); + + if(deltaDist < this.user.segmentDistance * 0.895D) { + this.user.motionX *= 0.8D; + this.user.motionY *= 0.8D; + this.user.motionZ *= 0.8D; + } else { + this.user.motionX = (deltaX / deltaDist * this.user.bodySpeed); + this.user.motionY = (deltaY / deltaDist * this.user.bodySpeed); + this.user.motionZ = (deltaZ / deltaDist * this.user.bodySpeed); + } + } + + protected void findEntityToFollow(List segments) { + + for(EntityWormBaseNT segment : segments) { + + if(segment.getHeadID() == this.user.getHeadID()) { + + if(segment.getIsHead()) { + if(this.user.getPartNumber() == 0) { + this.user.targetedEntity = ((Entity) segment); + } + this.user.followed = ((EntityLivingBase) segment); + + } else if(segment.getPartNumber() == this.user.getPartNumber() - 1) { + this.user.targetedEntity = ((Entity) segment); + } + } + } + this.user.didCheck = true; + } +} diff --git a/src/main/java/com/hbm/entity/mob/botprime/WormMovementHeadNT.java b/src/main/java/com/hbm/entity/mob/botprime/WormMovementHeadNT.java new file mode 100644 index 000000000..678c7faf4 --- /dev/null +++ b/src/main/java/com/hbm/entity/mob/botprime/WormMovementHeadNT.java @@ -0,0 +1,92 @@ +package com.hbm.entity.mob.botprime; + +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.util.MathHelper; + +public class WormMovementHeadNT { + + private EntityWormBaseNT user; + + public WormMovementHeadNT(EntityWormBaseNT user) { + this.user = user; + } + + protected void updateMovement() { + + double var1 = this.user.waypointX - this.user.posX; + double var3 = this.user.waypointY - this.user.posY; + double var5 = this.user.waypointZ - this.user.posZ; + double var7 = var1 * var1 + var3 * var3 + var5 * var5; + + if(this.user.courseChangeCooldown-- <= 0) { + + this.user.courseChangeCooldown += this.user.getRNG().nextInt(5) + 2; + var7 = MathHelper.sqrt_double(var7); + + if(this.user.motionX * this.user.motionX + this.user.motionY * this.user.motionY + this.user.motionZ * this.user.motionZ < this.user.maxSpeed) { + + if(!this.user.isCourseTraversable()) { + var7 *= 8.0D; + } + + double moverSpeed = this.user.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getBaseValue(); + this.user.motionX += var1 / var7 * moverSpeed; + this.user.motionY += var3 / var7 * moverSpeed; + this.user.motionZ += var5 / var7 * moverSpeed; + } + } + + if(!this.user.isCourseTraversable()) { + this.user.motionY -= this.user.fallSpeed; + } + + if(this.user.dmgCooldown > 0) { + this.user.dmgCooldown -= 1; + } + + this.user.aggroCooldown -= 1; + + if(this.user.getAttackTarget() != null) { + + if(this.user.aggroCooldown <= 0) { + this.user.targetedEntity = this.user.getAttackTarget(); + this.user.aggroCooldown = 20; + } + + } else if(this.user.targetedEntity == null) { + this.user.waypointX = (this.user.spawnPoint.posX - 30 + this.user.getRNG().nextInt(60)); + this.user.waypointY = (this.user.spawnPoint.posY - 10 + this.user.getRNG().nextInt(20)); + this.user.waypointZ = (this.user.spawnPoint.posZ - 30 + this.user.getRNG().nextInt(60)); + } + + this.user.rotationYaw = (-(float) Math.atan2(this.user.motionX, this.user.motionZ) * 180.0F / 3.1415927F); + this.user.rotationPitch = ((float) -(Math.atan2(this.user.motionY, + MathHelper.sqrt_double(this.user.motionX * this.user.motionX + this.user.motionZ * this.user.motionZ)) + * 180.0D / 3.141592653589793D)); + + if((this.user.targetedEntity != null) && (this.user.targetedEntity .getDistanceSqToEntity(this.user) < this.user.attackRange * this.user.attackRange)) { + + if((this.user.wasNearGround) || (this.user.canFly)) { + + this.user.waypointX = this.user.targetedEntity.posX; + this.user.waypointY = this.user.targetedEntity.posY; + this.user.waypointZ = this.user.targetedEntity.posZ; + + if((this.user.getRNG().nextInt(80) == 0) && (this.user.posY > this.user.surfaceY) + && (!this.user.isCourseTraversable())) { + this.user.wasNearGround = false; + } + + } else { + + this.user.waypointX = this.user.targetedEntity.posX; + this.user.waypointY = 10.0D; + this.user.waypointZ = this.user.targetedEntity.posZ; + + if(this.user.posY < 15.0D) { + this.user.wasNearGround = true; + } + } + } + } +} diff --git a/src/main/java/com/hbm/entity/mob/sodtekhnologiyah/EntityBallsOTronHead.java b/src/main/java/com/hbm/entity/mob/sodtekhnologiyah/EntityBallsOTronHead.java index 5324e8297..856753c5d 100644 --- a/src/main/java/com/hbm/entity/mob/sodtekhnologiyah/EntityBallsOTronHead.java +++ b/src/main/java/com/hbm/entity/mob/sodtekhnologiyah/EntityBallsOTronHead.java @@ -12,7 +12,6 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.util.IChatComponent; -import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class EntityBallsOTronHead extends EntityBallsOTronBase implements IBossDisplayData { diff --git a/src/main/java/com/hbm/items/tool/ItemWandD.java b/src/main/java/com/hbm/items/tool/ItemWandD.java index c788f8f9f..da1acf00c 100644 --- a/src/main/java/com/hbm/items/tool/ItemWandD.java +++ b/src/main/java/com/hbm/items/tool/ItemWandD.java @@ -3,7 +3,7 @@ package com.hbm.items.tool; import java.util.List; import com.hbm.lib.Library; -import com.hbm.world.dungeon.Ruin001; +import com.hbm.world.generator.CellularDungeonFactory; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; @@ -27,9 +27,9 @@ public class ItemWandD extends Item { int z = pos.blockZ; int y = world.getHeightValue(x, z); - new Ruin001().generate_r0(world, world.rand, x, y - 8, z); + //new Ruin001().generate_r0(world, world.rand, x, y - 8, z); - //CellularDungeonFactory.test.generate(world, x, y, z, world.rand); + CellularDungeonFactory.jungle.generate(world, x, y, z, world.rand); } return stack; diff --git a/src/main/java/com/hbm/lib/HbmWorldGen.java b/src/main/java/com/hbm/lib/HbmWorldGen.java index 3a3a21c12..517e8bc1a 100644 --- a/src/main/java/com/hbm/lib/HbmWorldGen.java +++ b/src/main/java/com/hbm/lib/HbmWorldGen.java @@ -547,7 +547,7 @@ public class HbmWorldGen implements IWorldGenerator { int x = i + rand.nextInt(16); int z = j + rand.nextInt(16); - CellularDungeonFactory.test.generate(world, x, 10, z, rand); + CellularDungeonFactory.meteor.generate(world, x, 10, z, rand); if(MainRegistry.enableDebugMode) MainRegistry.logger.info("[Debug] Successfully spawned meteor dungeon at " + x + " 10 " + z); diff --git a/src/main/java/com/hbm/world/generator/CellularDungeon.java b/src/main/java/com/hbm/world/generator/CellularDungeon.java index db1cd9cbe..fa57e5de4 100644 --- a/src/main/java/com/hbm/world/generator/CellularDungeon.java +++ b/src/main/java/com/hbm/world/generator/CellularDungeon.java @@ -33,23 +33,26 @@ public class CellularDungeon { //the rooms that the dungeon can use public List rooms = new ArrayList(); int tries; + int branches; - public CellularDungeon(int width, int height, int dimX, int dimZ, int tries) { + public CellularDungeon(int width, int height, int dimX, int dimZ, int tries, int branches) { this.dimX = dimX; this.dimZ = dimZ; this.width = width; this.height = height; this.tries = tries; + this.branches = branches; } - public CellularDungeon(int width, int height, int dimX, int dimZ, int tries, Block floor, Block ceiling, Block wall) { + public CellularDungeon(int width, int height, int dimX, int dimZ, int tries, int branches, Block floor, Block ceiling, Block wall) { this.dimX = dimX; this.dimZ = dimZ; this.width = width; this.height = height; this.tries = tries; + this.branches = branches; this.floor.add(floor); this.ceiling.add(ceiling); this.wall.add(wall); @@ -121,7 +124,7 @@ public class CellularDungeon { order.add(new int[] { x, z }); } - for(int i = 0; i < 3; i++) { + for(int i = 0; i < branches; i++) { ForgeDirection dir = getRandomDir(rand); addRoom(x + dir.offsetX, z + dir.offsetZ, rand, dir.getOpposite(), DungeonToolbox.getRandom(rooms, rand)); } diff --git a/src/main/java/com/hbm/world/generator/CellularDungeonFactory.java b/src/main/java/com/hbm/world/generator/CellularDungeonFactory.java index 0cfab5f20..522ce5d8f 100644 --- a/src/main/java/com/hbm/world/generator/CellularDungeonFactory.java +++ b/src/main/java/com/hbm/world/generator/CellularDungeonFactory.java @@ -5,19 +5,23 @@ import com.hbm.world.generator.room.*; import net.minecraftforge.common.util.ForgeDirection; public class CellularDungeonFactory { - - public static CellularDungeon test; + + public static CellularDungeon meteor; + public static CellularDungeon jungle; public static void init() { - test = new TestDungeon(11, 7, 11, 11, 150); - test.rooms.add(new TestDungeonRoom1(test)); - test.rooms.add(new TestDungeonRoom2(test)); - test.rooms.add(new TestDungeonRoom3(test)); - test.rooms.add(new TestDungeonRoom4(test, new TestDungeonRoom5(test), ForgeDirection.NORTH)); - test.rooms.add(new TestDungeonRoom6(test)); - test.rooms.add(new TestDungeonRoom7(test)); - test.rooms.add(new TestDungeonRoom8(test)); + meteor = new TestDungeon(11, 7, 11, 11, 150, 3); + meteor.rooms.add(new TestDungeonRoom1(meteor)); + meteor.rooms.add(new TestDungeonRoom2(meteor)); + meteor.rooms.add(new TestDungeonRoom3(meteor)); + meteor.rooms.add(new TestDungeonRoom4(meteor, new TestDungeonRoom5(meteor), ForgeDirection.NORTH)); + meteor.rooms.add(new TestDungeonRoom6(meteor)); + meteor.rooms.add(new TestDungeonRoom7(meteor)); + meteor.rooms.add(new TestDungeonRoom8(meteor)); + + jungle = new JungleDungeon(5, 5, 21, 21, 500, 5); + jungle.rooms.add(new JungleDungeonRoom(jungle)); } } diff --git a/src/main/java/com/hbm/world/generator/JungleDungeon.java b/src/main/java/com/hbm/world/generator/JungleDungeon.java new file mode 100644 index 000000000..8e58b230d --- /dev/null +++ b/src/main/java/com/hbm/world/generator/JungleDungeon.java @@ -0,0 +1,18 @@ +package com.hbm.world.generator; + +import com.hbm.blocks.ModBlocks; + +public class JungleDungeon extends CellularDungeon { + + public JungleDungeon(int width, int height, int dimX, int dimZ, int tries, int branches) { + super(width, height, dimX, dimZ, tries, branches); + + this.floor.add(ModBlocks.brick_jungle); + this.floor.add(ModBlocks.brick_jungle_cracked); + this.wall.add(ModBlocks.brick_jungle); + this.wall.add(ModBlocks.brick_jungle_cracked); + this.ceiling.add(ModBlocks.brick_jungle); + this.ceiling.add(ModBlocks.brick_jungle_cracked); + } + +} diff --git a/src/main/java/com/hbm/world/generator/TestDungeon.java b/src/main/java/com/hbm/world/generator/TestDungeon.java index 48eee2ae0..7a14a239a 100644 --- a/src/main/java/com/hbm/world/generator/TestDungeon.java +++ b/src/main/java/com/hbm/world/generator/TestDungeon.java @@ -4,8 +4,8 @@ import com.hbm.blocks.ModBlocks; public class TestDungeon extends CellularDungeon { - public TestDungeon(int width, int height, int dimX, int dimZ, int tries) { - super(width, height, dimX, dimZ, tries); + public TestDungeon(int width, int height, int dimX, int dimZ, int tries, int branches) { + super(width, height, dimX, dimZ, tries, branches); this.floor.add(ModBlocks.meteor_polished); this.wall.add(ModBlocks.meteor_brick); diff --git a/src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java b/src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java new file mode 100644 index 000000000..62a4c6d62 --- /dev/null +++ b/src/main/java/com/hbm/world/generator/room/JungleDungeonRoom.java @@ -0,0 +1,47 @@ +package com.hbm.world.generator.room; + +import com.hbm.world.generator.CellularDungeon; +import com.hbm.world.generator.CellularDungeonRoom; +import com.hbm.world.generator.DungeonToolbox; + +import net.minecraft.init.Blocks; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class JungleDungeonRoom extends CellularDungeonRoom { + + public JungleDungeonRoom(CellularDungeon parent) { + super(parent); + } + + public void generateWall(World world, int x, int y, int z, ForgeDirection wall, boolean door) { + + if(wall == ForgeDirection.NORTH) { + DungeonToolbox.generateBox(world, x, y + 1, z, parent.width, parent.height - 2, 1, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x + parent.width / 2 - 1, y + 1, z, 3, 3, 1, Blocks.air); + } + + if(wall == ForgeDirection.SOUTH) { + DungeonToolbox.generateBox(world, x, y + 1, z + parent.width - 1, parent.width, parent.height - 2, 1, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x + parent.width / 2 - 1, y + 1, z + parent.width - 1, 3, 3, 1, Blocks.air); + } + + if(wall == ForgeDirection.WEST) { + DungeonToolbox.generateBox(world, x, y + 1, z, 1, parent.height - 2, parent.width, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x, y + 1, z + parent.width / 2 - 1, 1, 3, 3, Blocks.air); + } + + if(wall == ForgeDirection.EAST) { + DungeonToolbox.generateBox(world, x + parent.width - 1, y + 1, z, 1, parent.height - 2, parent.width, parent.wall); + + if(door) + DungeonToolbox.generateBox(world, x + parent.width - 1, y + 1, z + parent.width / 2 - 1, 1, 3, 3, Blocks.air); + } + } +}