mirror of
https://github.com/chylex/Hardcore-Ender-Expansion.git
synced 2025-04-10 20:15:42 +02:00
Fixes and stuff and.. fixes...
This commit is contained in:
parent
847fbbf5c1
commit
0f8e2a1e6c
src/main/java/chylex/hee
block
entity/mob
mechanics/misc
system/creativetab
world/structure/island/biome
@ -52,6 +52,11 @@ public class BlockEnderGoo extends BlockFluidClassic{
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand){
|
||||
if (!world.blockExists(x-1,y,z-1) || !world.blockExists(x+1,y,z+1)){
|
||||
world.scheduleBlockUpdate(x,y,z,this,tickRate(world));
|
||||
return;
|
||||
}
|
||||
|
||||
super.updateTick(world,x,y,z,rand);
|
||||
|
||||
if (shouldBattleWater){
|
||||
|
@ -4,6 +4,8 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.entity.monster.EntityMob;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -35,6 +37,9 @@ import chylex.hee.system.util.MathUtil;
|
||||
import chylex.hee.world.structure.island.biome.feature.island.StructureEndermanStash;
|
||||
|
||||
public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRenderer{
|
||||
private static final UUID attackingSpeedBoostModifierUUID = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
|
||||
private static final AttributeModifier attackingSpeedBoostModifier = (new AttributeModifier(attackingSpeedBoostModifierUUID,"Attacking speed boost",6.2D,0)).setSaved(false);
|
||||
|
||||
private HomelandRole homelandRole;
|
||||
private long groupId = -1;
|
||||
private OvertakeGroupRole overtakeGroupRole;
|
||||
@ -43,6 +48,8 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
private int currentTaskTimer;
|
||||
private Object currentTaskData;
|
||||
|
||||
private Entity lastEntityToAttack;
|
||||
|
||||
private byte stareTimer, fallTimer, randomTpTimer, attackTpTimer, screamTimer, recruitCooldown;
|
||||
|
||||
public EntityMobHomelandEnderman(World world){
|
||||
@ -73,8 +80,10 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
|
||||
switch(homelandRole){
|
||||
case ISLAND_LEADERS:
|
||||
boolean maxHealth = MathUtil.floatEquals(getHealth(),getMaxHealth());
|
||||
getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(70D);
|
||||
getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(12D);
|
||||
if (maxHealth)setHealth(getMaxHealth());
|
||||
break;
|
||||
|
||||
case GUARD:
|
||||
@ -82,7 +91,15 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
break;
|
||||
|
||||
case BUSINESSMAN:
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.35D);
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.65D);
|
||||
break;
|
||||
|
||||
case WORKER:
|
||||
getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.45D);
|
||||
// fall through
|
||||
|
||||
case INTELLIGENCE:
|
||||
getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -91,6 +108,8 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
|
||||
@Override
|
||||
public void onLivingUpdate(){
|
||||
entityAge = 0; // 5 seconds and mobs stop moving, this is fucking stupid
|
||||
|
||||
if (worldObj.isRemote){
|
||||
refreshRoles();
|
||||
|
||||
@ -110,7 +129,8 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
}
|
||||
}
|
||||
else if (isEntityAlive()){
|
||||
setCustomNameTag(homelandRole.name()+" / "+(overtakeGroupRole == null ? "null" : overtakeGroupRole.name())+" / "+currentTask+" -- "+currentTaskTimer+" / "+entityToAttack);
|
||||
setCustomNameTag(homelandRole.name()+" / "+(overtakeGroupRole == null ? "null" : overtakeGroupRole.name())+" / "+currentTask+" -- "+currentTaskTimer+" / "+(hasPath() ? "haspath" : "nopath"));
|
||||
// TODO remove
|
||||
|
||||
if (isWet())attackEntityFrom(DamageSource.drown,1F);
|
||||
|
||||
@ -289,7 +309,7 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
if (currentTask == EndermanTask.NONE && rand.nextInt(80) == 0){
|
||||
switch(homelandRole){
|
||||
case ISLAND_LEADERS:
|
||||
if (rand.nextInt(10) == 0){
|
||||
if (rand.nextInt(13) == 0){
|
||||
teleportRandomly();
|
||||
}
|
||||
else{
|
||||
@ -323,9 +343,14 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
EntityMobHomelandEnderman enderman = businessmen.get(rand.nextInt(businessmen.size()));
|
||||
|
||||
if (enderman.currentTask == EndermanTask.NONE){
|
||||
currentTask = enderman.currentTask = EndermanTask.COMMUNICATE;
|
||||
currentTaskTimer = enderman.currentTaskTimer = 30+rand.nextInt(50+rand.nextInt(80));
|
||||
System.out.println("businessman communicating at "+posX+","+posY+","+posZ);
|
||||
for(int tpAttempt = 0; tpAttempt < 20; tpAttempt++){
|
||||
if (teleportTo(enderman.posX+(rand.nextDouble()-0.5D)*2D,enderman.posY,enderman.posZ+(rand.nextDouble()-0.5D)*2D)){
|
||||
currentTask = enderman.currentTask = EndermanTask.COMMUNICATE;
|
||||
currentTaskTimer = enderman.currentTaskTimer = 30+rand.nextInt(50+rand.nextInt(80));
|
||||
System.out.println("businessman communicating at "+posX+","+posY+","+posZ);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -497,18 +522,26 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
else{
|
||||
attackTpTimer = -80;
|
||||
|
||||
if (currentTask == EndermanTask.NONE && entityToAttack == null && ++randomTpTimer > 50+rand.nextInt(70)){
|
||||
if (rand.nextInt(18) == 0){
|
||||
if (currentTask == EndermanTask.NONE && entityToAttack == null && ++randomTpTimer > 70+rand.nextInt(50)){
|
||||
if (rand.nextInt(19) == 0){
|
||||
for(int attempt = 0; attempt < 5; attempt++){
|
||||
if (teleportRandomly(10D))break;
|
||||
}
|
||||
}
|
||||
|
||||
randomTpTimer -= 80+rand.nextInt(40);
|
||||
randomTpTimer -= 110+rand.nextInt(40);
|
||||
}
|
||||
|
||||
if (screamTimer > 0 && --screamTimer == 0 && isScreaming())setScreaming(false);
|
||||
}
|
||||
|
||||
if (lastEntityToAttack != entityToAttack){
|
||||
IAttributeInstance attribute = getEntityAttribute(SharedMonsterAttributes.movementSpeed);
|
||||
attribute.removeModifier(attackingSpeedBoostModifier);
|
||||
if (entityToAttack != null)attribute.applyModifier(attackingSpeedBoostModifier);
|
||||
|
||||
lastEntityToAttack = entityToAttack;
|
||||
}
|
||||
}
|
||||
|
||||
isJumping = false;
|
||||
@ -573,7 +606,7 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
|
||||
for(int a = 0, amt = Math.max(2,Math.round(list.size()*guardPerc)); a < amt && !list.isEmpty(); a++){
|
||||
EntityMobHomelandEnderman guard = list.remove(rand.nextInt(list.size()));
|
||||
guard.setTarget(this);
|
||||
guard.setTarget(source.getEntity());
|
||||
guard.setScreaming(true);
|
||||
}
|
||||
}
|
||||
@ -636,6 +669,8 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
|
||||
if (homelandRole == null || (groupId != -1 && overtakeGroupRole == null))setDead();
|
||||
else if (!worldObj.isRemote)refreshRoles();
|
||||
|
||||
updateAttributes();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -652,6 +687,8 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
resetTask();
|
||||
setPathToEntity(worldObj.getPathEntityToEntity(this,entityToAttack,16F,true,false,false,true));
|
||||
}
|
||||
|
||||
System.out.println("attacking "+target);
|
||||
}
|
||||
|
||||
private void resetTask(){
|
||||
@ -767,7 +804,7 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
double newX = posX+(rand.nextDouble()-0.5D)*8D-vec.xCoord*16D;
|
||||
double newY = posY+(rand.nextInt(16)-8)-vec.yCoord*16D;
|
||||
double newZ = posZ+(rand.nextDouble()-0.5D)*8D-vec.zCoord*16D;
|
||||
return this.teleportTo(newX,newY,newZ);
|
||||
return teleportTo(newX,newY,newZ);
|
||||
}
|
||||
|
||||
private boolean teleportTo(double x, double y, double z){
|
||||
@ -821,7 +858,7 @@ public class EntityMobHomelandEnderman extends EntityMob implements IEndermanRen
|
||||
if (is != null && is.getItem() == Item.getItemFromBlock(Blocks.pumpkin))return false;
|
||||
else{
|
||||
Vec3 playerLook = player.getLook(1F).normalize();
|
||||
Vec3 eyeVecDiff = Vec3.createVectorHelper(posX-player.posX,boundingBox.minY+(height/2F)-(player.posY+player.getEyeHeight()),posZ-player.posZ);
|
||||
Vec3 eyeVecDiff = Vec3.createVectorHelper(posX-player.posX,boundingBox.minY+(height*0.5F)-(player.posY+player.getEyeHeight()),posZ-player.posZ);
|
||||
double eyeVecLen = eyeVecDiff.lengthVector();
|
||||
return playerLook.dotProduct(eyeVecDiff.normalize()) > 1D-0.025D/eyeVecLen && player.canEntityBeSeen(this);
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ public final class HomelandEndermen{
|
||||
public static final OvertakeGroupRole[] values = values();
|
||||
|
||||
public static OvertakeGroupRole getRandomMember(Random rand){
|
||||
int r = rand.nextInt(10);
|
||||
int r = rand.nextInt(8);
|
||||
|
||||
if (r < 6)return FIGHTER;
|
||||
else if (r < 8)return CHAOSMAKER;
|
||||
if (r < 4)return FIGHTER;
|
||||
else if (r < 6)return CHAOSMAKER;
|
||||
else return TELEPORTER;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public class CreativeTabItemList{
|
||||
|
||||
public CreativeTabItemList addBlocks(Block...blocks){
|
||||
for(Block block:blocks){
|
||||
this.blocks.add(block); // TODO change to item
|
||||
this.blocks.add(block);
|
||||
block.setCreativeTab(ModCreativeTab.tab);
|
||||
}
|
||||
|
||||
|
@ -4,10 +4,12 @@ import net.minecraft.entity.monster.EntityEnderman;
|
||||
import net.minecraft.world.World;
|
||||
import chylex.hee.block.BlockEndstoneTerrain;
|
||||
import chylex.hee.entity.mob.EntityMobBabyEnderman;
|
||||
import chylex.hee.world.structure.island.biome.data.AbstractBiomeInteraction.BiomeInteraction;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeContentVariation;
|
||||
import chylex.hee.world.structure.island.biome.data.BiomeRandomDeviation;
|
||||
import chylex.hee.world.structure.island.biome.decorator.BiomeDecoratorEnchantedIsland;
|
||||
import chylex.hee.world.structure.island.biome.decorator.IslandBiomeDecorator;
|
||||
import chylex.hee.world.structure.island.biome.interaction.BiomeInteractionEnchantedIsland.InteractionOvertake;
|
||||
import chylex.hee.world.structure.util.pregen.LargeStructureWorld;
|
||||
import chylex.hee.world.util.SpawnEntry;
|
||||
|
||||
@ -36,6 +38,10 @@ public class IslandBiomeEnchantedIsland extends IslandBiomeBase{
|
||||
new SpawnEntry(EntityEnderman.class,10,10),
|
||||
new SpawnEntry(EntityMobEnderGuardian.class,15,7)
|
||||
});*/
|
||||
|
||||
getInteractions(HOMELAND).addAll(new BiomeInteraction[]{
|
||||
new BiomeInteraction("EI_Homeland_Overtake",InteractionOvertake.class,10)
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -80,7 +86,7 @@ public class IslandBiomeEnchantedIsland extends IslandBiomeBase{
|
||||
|
||||
@Override
|
||||
public float getInteractionChance(BiomeContentVariation variation){
|
||||
return variation == HOMELAND ? 0.01F : 0F; // 0.01 = 1/100 = every 25 seconds
|
||||
return variation == HOMELAND ? 0.005F : 0F; // 0.005 = 1/200 = every 50 seconds
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -103,9 +103,6 @@ public class BiomeDecoratorEnchantedIsland extends IslandBiomeDecorator{
|
||||
}
|
||||
}
|
||||
|
||||
for(HomelandRole role:map.keySet())System.out.println("GEN "+role.name()+": "+map.get(role));
|
||||
// TODO debug
|
||||
|
||||
List<EntityMobHomelandEnderman> endermanList = world.getAllEntities(EntityMobHomelandEnderman.class);
|
||||
int size = endermanList.size();
|
||||
|
||||
|
@ -9,19 +9,21 @@ import chylex.hee.world.structure.island.biome.data.AbstractBiomeInteraction;
|
||||
public class BiomeInteractionEnchantedIsland{
|
||||
public static class InteractionOvertake extends AbstractBiomeInteraction{
|
||||
public long groupId = -1L;
|
||||
private int overtakeTimer;
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
List<EntityMobHomelandEnderman> endermen = world.getEntitiesWithinAABB(EntityMobHomelandEnderman.class,getIslandBoundingBox());
|
||||
System.out.println("spawned overtake thing");
|
||||
|
||||
for(int attempt = 0; attempt < 5 && !endermen.isEmpty(); attempt++){
|
||||
for(int attempt = 0; attempt < 3 && !endermen.isEmpty(); attempt++){
|
||||
EntityMobHomelandEnderman subject = endermen.remove(rand.nextInt(endermen.size()));
|
||||
|
||||
if (subject.getGroupId() != -1L){
|
||||
List<EntityMobHomelandEnderman> sameGroup = HomelandEndermen.getInSameGroup(subject);
|
||||
if (sameGroup.size() < 5)continue;
|
||||
|
||||
if (rand.nextInt(666) < MathUtil.square(sameGroup.size())){
|
||||
if (rand.nextInt(666) < MathUtil.square(sameGroup.size()) && rand.nextInt(3) == 0){
|
||||
groupId = subject.getGroupId();
|
||||
|
||||
System.out.println("STARTING OVERTAKE WITH "+sameGroup.size()+" MEMBERS");
|
||||
@ -35,12 +37,20 @@ public class BiomeInteractionEnchantedIsland{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){}
|
||||
public void update(){
|
||||
if (++overtakeTimer > 500+rand.nextInt(300))entity.setDead();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveToNBT(NBTTagCompound nbt){}
|
||||
public void saveToNBT(NBTTagCompound nbt){
|
||||
nbt.setLong("group",groupId);
|
||||
nbt.setShort("timer",(short)overtakeTimer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadFromNBT(NBTTagCompound nbt){}
|
||||
public void loadFromNBT(NBTTagCompound nbt){
|
||||
groupId = nbt.getLong("group");
|
||||
overtakeTimer = nbt.getShort("timer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user