Skip to content

Commit

Permalink
5.0.0 Final
Browse files Browse the repository at this point in the history
  • Loading branch information
itsmeow committed Feb 12, 2019
1 parent f0180a0 commit fd85152
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 101 deletions.
19 changes: 10 additions & 9 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
5.0.0
-
- Added Boars
- Added Boar heads
- Added Squirrels
- Animal head items now match their block texture wise (and show up seperately in the creative menu)
- Spawn eggs now show in the BA+ tab as well as misc
- Fixed jellyfish floating
- Fixed reindeer neck moving along the wrong part
- Redo render factory system (use method references)
- Fix Esperanto translation
- Fixed some random crashes with Entity datamanager (may still afflict old worlds with older entities)
- Removed the useless "Common Proxy"
- Added Boar heads
- Animal head items have textures for each variant
- Spawn eggs now show in the Better Animals Plus tab
- Fixed jellyfish floating/being too large
- Fixed reindeer neck rotating strangely when eating
- Fixed lammergeiers derping before attacking ("hesitating")
- Fixed minor offsets on resting leg models (should prevent feet half clipping into the ground or being angled)
- Fixed Esperanto translation
- Fixed some random crashes with Entity datamanager (may still afflict old worlds with older entities, try removing mod, loading world, and re-adding mod)
- Redo render factory system (use method references)
- Removed the useless "Common Proxy"


4.1.0
-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public RenderJellyfish(RenderManager rendermanagerIn) {
protected void preRenderCallback(EntityJellyfish entitylivingbaseIn, float partialTickTime) {
float s = entitylivingbaseIn.getSize();
GlStateManager.scale(s,s,s);
GlStateManager.translate(0, 0.6F, 0);
GlStateManager.translate(0, 1F, 0);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
public class RenderSquirrel extends RenderLiving<EntitySquirrel> {

public RenderSquirrel(RenderManager rendermanagerIn) {
super(rendermanagerIn, new ModelSquirrel(), 0.5F);
super(rendermanagerIn, new ModelSquirrel(), 0.3F);
}

@Override
protected void preRenderCallback(EntitySquirrel entitylivingbaseIn, float partialTickTime) {
if (getMainModel().isChild) {
GlStateManager.scale(0.55D, 0.55D, 0.55D);
GlStateManager.scale(0.35D, 0.35D, 0.35D);
} else {
GlStateManager.scale(1.0D, 1.0D, 1.0D);
GlStateManager.scale(0.5D, 0.5D, 0.5D);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable
livingdata = super.onInitialSpawn(difficulty, livingdata);
if(!this.isChild()) {
int i = this.rand.nextInt(6) + 1; // Values 1 to 6
float rand = (float) (this.rand.nextInt(50) + 1F) / 50F;
float rand = (float) (this.rand.nextInt(30) + 1F) / 50F + 0.05F;

if (livingdata instanceof JellyfishData)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ public void startExecuting()
Random random = this.parentEntity.getRNG();
if(random.nextInt(30) != 1 && !this.parentEntity.landedLast) {
this.parentEntity.setFlying(true);
BlockPos rPos = this.parentEntity.fromPolarCoordinates(new PolarVector3D(this.parentEntity.rotationYaw + (random.nextInt(20) - 10), random.nextInt(20) - 10, random.nextInt(15) + 1 + random.nextFloat()));
BlockPos rPos = this.parentEntity.fromPolarCoordinates(new PolarVector3D(this.parentEntity.rotationYaw + (random.nextInt(50) - 25), random.nextInt(30) - 10, random.nextInt(50) + 1 + random.nextFloat()));
BlockPos pos = this.parentEntity.getPosition();
rPos = rPos.add(pos);
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.entity.ai.EntityAISwimming;
import net.minecraft.entity.ai.EntityAITempt;
import net.minecraft.entity.ai.EntityAIWanderAvoidWater;
import net.minecraft.entity.ai.EntityAIWatchClosest;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
Expand All @@ -31,44 +30,43 @@
import net.minecraft.world.World;

public class EntitySquirrel extends EntityAnimal {

private static final DataParameter<Byte> CLIMBING = EntityDataManager.<Byte>createKey(EntitySquirrel.class, DataSerializers.BYTE);
private static final DataParameter<Integer> TYPE_NUMBER = EntityDataManager.<Integer>createKey(EntitySquirrel.class, DataSerializers.VARINT);

private int climbTimeWithoutLog = 0;

public EntitySquirrel(World worldIn) {
super(worldIn);
this.setSize(1F, 1F);
this.setSize(0.5F, 0.5F);

}

@Override
protected void initEntityAI() {
this.tasks.addTask(1, new EntityAISwimming(this));
this.tasks.addTask(2, new EntityAIPanic(this, 0.72D));
this.tasks.addTask(3, new EntityAIMate(this, 0.5D));
this.tasks.addTask(4, new EntityAITempt(this, 0.5D, Items.WHEAT_SEEDS, false));
this.tasks.addTask(5, new EntityAIAvoidEntity<EntityPlayer>(this, EntityPlayer.class, 10F, 0.5D, 0.7D));
this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 0.5D));
this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 15.0F));
this.tasks.addTask(8, new EntityAILookIdle(this));
this.tasks.addTask(6, new EntityAIWanderAvoidWater(this, 0.5D));
this.tasks.addTask(7, new EntityAILookIdle(this));
}

protected void applyEntityAttributes()
{
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(4.5D);
this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(0.5D);
}

protected void entityInit()
{
super.entityInit();
this.dataManager.register(CLIMBING, Byte.valueOf((byte)0));
this.dataManager.register(TYPE_NUMBER, Integer.valueOf(0));
}
{
super.entityInit();
this.dataManager.register(CLIMBING, Byte.valueOf((byte)0));
this.dataManager.register(TYPE_NUMBER, Integer.valueOf(0));
}

public int getTypeNumber() {
return ((Integer)this.dataManager.get(TYPE_NUMBER)).intValue();
}
Expand All @@ -77,7 +75,7 @@ public void setType(int typeId)
{
this.dataManager.set(TYPE_NUMBER, Integer.valueOf(typeId));
}

/**
* (abstract) Protected helper method to write subclass entity data to NBT.
*/
Expand All @@ -95,7 +93,7 @@ public void readEntityFromNBT(NBTTagCompound compound)
super.readEntityFromNBT(compound);
this.setType(compound.getInteger("TypeNumber"));
}

/**
* Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
* when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
Expand Down Expand Up @@ -132,80 +130,89 @@ public TypeData(int type)
this.typeData = type;
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();

if (!this.world.isRemote)
{
boolean nearLog = false;
for(EnumFacing facing : EnumFacing.values()) {
BlockPos pos = this.getPosition().offset(facing);
Block block = this.world.getBlockState(pos).getBlock();
if(block == Blocks.LOG || block == Blocks.LOG2) {
nearLog = true;
}
}
this.setBesideClimbableBlock((this.collidedHorizontally && nearLog) || (this.collidedHorizontally && this.climbTimeWithoutLog < 15));
if(this.collidedHorizontally && !nearLog) {
this.climbTimeWithoutLog++;
} else if(this.climbTimeWithoutLog > 0 || (this.collidedHorizontally && nearLog)) {
this.climbTimeWithoutLog = 0;
}
}
}

public boolean isOnLadder()
{
return this.isBesideClimbableBlock();
}
/**
* Returns true if the WatchableObject (Byte) is 0x01 otherwise returns false. The WatchableObject is updated using
* setBesideClimableBlock.
*/
public boolean isBesideClimbableBlock()
{
return (((Byte)this.dataManager.get(CLIMBING)).byteValue() & 1) != 0;
}

/**
* Updates the WatchableObject (Byte) created in entityInit(), setting it to 0x01 if par1 is true or 0x00 if it is
* false.
*/
public void setBesideClimbableBlock(boolean climbing)
{
byte b0 = ((Byte)this.dataManager.get(CLIMBING)).byteValue();

if (climbing)
{
b0 = (byte)(b0 | 1);
}
else
{
b0 = (byte)(b0 & -2);
}

this.dataManager.set(CLIMBING, Byte.valueOf(b0));
}

/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
super.onUpdate();

if (!this.world.isRemote)
{
boolean nearLog = false;
for(EnumFacing facing : EnumFacing.values()) {
BlockPos pos = this.getPosition().offset(facing);
Block block = this.world.getBlockState(pos).getBlock();
if(block == Blocks.LOG || block == Blocks.LOG2) {
nearLog = true;
}
}
this.setBesideClimbableBlock((this.collidedHorizontally && nearLog) || (this.collidedHorizontally && this.climbTimeWithoutLog < 15));
if(this.collidedHorizontally && !nearLog) {
this.climbTimeWithoutLog++;
} else if(this.climbTimeWithoutLog > 0 || (this.collidedHorizontally && nearLog)) {
this.climbTimeWithoutLog = 0;
}
}
}


public boolean isOnLadder()
{
return this.isBesideClimbableBlock();
}

/**
* Returns true if the WatchableObject (Byte) is 0x01 otherwise returns false. The WatchableObject is updated using
* setBesideClimableBlock.
*/
public boolean isBesideClimbableBlock()
{
return (((Byte)this.dataManager.get(CLIMBING)).byteValue() & 1) != 0;
}

/**
* Updates the WatchableObject (Byte) created in entityInit(), setting it to 0x01 if par1 is true or 0x00 if it is
* false.
*/
public void setBesideClimbableBlock(boolean climbing)
{
byte b0 = ((Byte)this.dataManager.get(CLIMBING)).byteValue();

if (climbing)
{
b0 = (byte)(b0 | 1);
}
else
{
b0 = (byte)(b0 & -2);
}

this.dataManager.set(CLIMBING, Byte.valueOf(b0));
}

protected PathNavigate createNavigator(World worldIn) {
return new PathNavigateClimber(this, worldIn);
}
return new PathNavigateClimber(this, worldIn);
}

@Override
public EntityAgeable createChild(EntityAgeable ageable) {
return new EntitySquirrel(ageable.world);
EntitySquirrel squirrel = new EntitySquirrel(this.world);
if(ageable instanceof EntitySquirrel) {
EntitySquirrel other = (EntitySquirrel) ageable;
if((this.getTypeNumber() == 3 || other.getTypeNumber() == 3) && this.getTypeNumber() != other.getTypeNumber()) {
squirrel.setType(this.getTypeNumber() == 3 ? other.getTypeNumber() : this.getTypeNumber());
} else {
squirrel.setType(this.rand.nextBoolean() ? this.getTypeNumber() : other.getTypeNumber());
}
}
return squirrel;
}

@Override
public boolean isBreedingItem(ItemStack stack) {
return stack.getItem() == Items.WHEAT_SEEDS || stack.getItem() == Items.BEETROOT_SEEDS || stack.getItem() == Items.MELON_SEEDS || stack.getItem() == Items.PUMPKIN_SEEDS;
}

}

0 comments on commit fd85152

Please sign in to comment.