Initial 1.11.2 update
This commit is contained in:
@@ -10,7 +10,6 @@ import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
|
||||
import net.minecraft.entity.monster.EntityBlaze;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.EnumParticleTypes;
|
||||
@@ -27,18 +26,41 @@ public class EntityBlazeMinion extends EntityBlaze implements ISummonedCreature
|
||||
private UUID casterUUID;
|
||||
|
||||
// Setter + getter implementations
|
||||
@Override public int getLifetime(){ return lifetime; }
|
||||
@Override public void setLifetime(int lifetime){ this.lifetime = lifetime; }
|
||||
@Override public WeakReference<EntityLivingBase> getCasterReference(){ return casterReference; }
|
||||
@Override public void setCasterReference(WeakReference<EntityLivingBase> reference){ casterReference = reference; }
|
||||
@Override public UUID getCasterUUID() { return casterUUID; }
|
||||
@Override public void setCasterUUID(UUID uuid) { this.casterUUID = uuid; }
|
||||
@Override
|
||||
public int getLifetime(){
|
||||
return lifetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLifetime(int lifetime){
|
||||
this.lifetime = lifetime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WeakReference<EntityLivingBase> getCasterReference(){
|
||||
return casterReference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCasterReference(WeakReference<EntityLivingBase> reference){
|
||||
casterReference = reference;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UUID getCasterUUID(){
|
||||
return casterUUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCasterUUID(UUID uuid){
|
||||
this.casterUUID = uuid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default shell constructor, only used by client. Lifetime defaults arbitrarily to 600, but this doesn't
|
||||
* matter because the client side entity immediately gets the lifetime value copied over to it by this class
|
||||
* anyway. When extending this class, you must override this constructor or Minecraft won't like it, but there's
|
||||
* no need to do anything inside it other than call super().
|
||||
* Default shell constructor, only used by client. Lifetime defaults arbitrarily to 600, but this doesn't matter
|
||||
* because the client side entity immediately gets the lifetime value copied over to it by this class anyway. When
|
||||
* extending this class, you must override this constructor or Minecraft won't like it, but there's no need to do
|
||||
* anything inside it other than call super().
|
||||
*/
|
||||
public EntityBlazeMinion(World world){
|
||||
super(world);
|
||||
@@ -46,8 +68,8 @@ public class EntityBlazeMinion extends EntityBlaze implements ISummonedCreature
|
||||
}
|
||||
|
||||
/**
|
||||
* Set lifetime to -1 to allow this creature to last forever. This constructor should be overridden when
|
||||
* extending this class (be sure to call super()) so that AI and other things can be added.
|
||||
* Set lifetime to -1 to allow this creature to last forever. This constructor should be overridden when extending
|
||||
* this class (be sure to call super()) so that AI and other things can be added.
|
||||
*/
|
||||
public EntityBlazeMinion(World world, double x, double y, double z, EntityLivingBase caster, int lifetime){
|
||||
super(world);
|
||||
@@ -56,21 +78,20 @@ public class EntityBlazeMinion extends EntityBlaze implements ISummonedCreature
|
||||
this.experienceValue = 0;
|
||||
this.lifetime = lifetime;
|
||||
}
|
||||
|
||||
|
||||
// EntityBlaze overrides
|
||||
|
||||
|
||||
// This particular override is pretty standard: let the superclass handle basic AI like swimming, but replace its
|
||||
// targeting system with one that targets hostile mobs and takes the ADS into account.
|
||||
@Override
|
||||
protected void initEntityAI()
|
||||
{
|
||||
protected void initEntityAI(){
|
||||
super.initEntityAI();
|
||||
this.targetTasks.taskEntries.clear();
|
||||
this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
|
||||
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class,
|
||||
0, false, true, this.getTargetSelector()));
|
||||
}
|
||||
|
||||
this.targetTasks.addTask(2, new EntityAINearestAttackableTarget<EntityLivingBase>(this, EntityLivingBase.class,
|
||||
0, false, true, this.getTargetSelector()));
|
||||
}
|
||||
|
||||
// Implementations
|
||||
|
||||
@Override
|
||||
@@ -93,27 +114,30 @@ public class EntityBlazeMinion extends EntityBlaze implements ISummonedCreature
|
||||
public void onDespawn(){
|
||||
this.spawnParticleEffect();
|
||||
}
|
||||
|
||||
/** Normally this would be private, but since this class has subclasses with different spawn/despawn particle
|
||||
* effects, it makes sense to have them override this rather than both onSpawn() and onDespawn(). */
|
||||
|
||||
/**
|
||||
* Normally this would be private, but since this class has subclasses with different spawn/despawn particle
|
||||
* effects, it makes sense to have them override this rather than both onSpawn() and onDespawn().
|
||||
*/
|
||||
protected void spawnParticleEffect(){
|
||||
if(this.worldObj.isRemote){
|
||||
for(int i=0;i<15;i++){
|
||||
this.worldObj.spawnParticle(EnumParticleTypes.FLAME, this.posX + this.rand.nextFloat(), this.posY + 1 + this.rand.nextFloat(), this.posZ + this.rand.nextFloat(), 0, 0, 0);
|
||||
if(this.world.isRemote){
|
||||
for(int i = 0; i < 15; i++){
|
||||
this.world.spawnParticle(EnumParticleTypes.FLAME, this.posX + this.rand.nextFloat(),
|
||||
this.posY + 1 + this.rand.nextFloat(), this.posZ + this.rand.nextFloat(), 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasParticleEffect() {
|
||||
public boolean hasParticleEffect(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean processInteract(EntityPlayer player, EnumHand hand, ItemStack stack) {
|
||||
protected boolean processInteract(EntityPlayer player, EnumHand hand){
|
||||
// In this case, the delegate method determines whether super is called.
|
||||
// Rather handily, we can make use of Java's 'stop as soon as you find true' method of evaluating OR statements.
|
||||
return this.interactDelegate(player, hand, stack) || super.processInteract(player, hand, stack);
|
||||
return this.interactDelegate(player, hand) || super.processInteract(player, hand);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,12 +154,31 @@ public class EntityBlazeMinion extends EntityBlaze implements ISummonedCreature
|
||||
|
||||
// Recommended overrides
|
||||
|
||||
@Override protected int getExperiencePoints(EntityPlayer player){ return 0; }
|
||||
@Override protected boolean canDropLoot(){ return false; }
|
||||
@Override protected Item getDropItem(){ return null; }
|
||||
@Override protected ResourceLocation getLootTable(){ return null; }
|
||||
@Override
|
||||
protected int getExperiencePoints(EntityPlayer player){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canDropLoot(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Item getDropItem(){
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getLootTable(){
|
||||
return null;
|
||||
}
|
||||
|
||||
// This vanilla method has nothing to do with the custom despawn() method.
|
||||
@Override protected boolean canDespawn(){ return false; }
|
||||
@Override
|
||||
protected boolean canDespawn(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAttackClass(Class<? extends EntityLivingBase> entityType){
|
||||
@@ -145,7 +188,7 @@ public class EntityBlazeMinion extends EntityBlaze implements ISummonedCreature
|
||||
@Override
|
||||
public ITextComponent getDisplayName(){
|
||||
if(getCaster() != null){
|
||||
return new TextComponentTranslation(NAMEPLATE_TRANSLATION_KEY, getCaster().getName(),
|
||||
return new TextComponentTranslation(NAMEPLATE_TRANSLATION_KEY, getCaster().getName(),
|
||||
new TextComponentTranslation("entity." + this.getEntityString() + ".name"));
|
||||
}else{
|
||||
return super.getDisplayName();
|
||||
|
||||
Reference in New Issue
Block a user