mirror of
https://github.com/TechnoVisionDev/Forge-Modding-Tutorial-1.16
synced 2024-10-27 20:34:04 +00:00
Update some entity values
This commit is contained in:
parent
3bf0c35082
commit
542173bc7d
@ -17,8 +17,8 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@Mod("tutorial")
|
||||
public class Tutorial
|
||||
{
|
||||
public class Tutorial {
|
||||
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final String MOD_ID = "tutorial";
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class HogEntity extends AnimalEntity {
|
||||
private static final Ingredient TEMPTATION_ITEMS = Ingredient.fromItems(Items.CARROT, Items.POTATO, Items.BEETROOT);
|
||||
|
||||
private EatGrassGoal eatGrassGoal;
|
||||
private int goatTimer;
|
||||
private int hogTimer;
|
||||
|
||||
public HogEntity(EntityType<? extends AnimalEntity> type, World worldIn) {
|
||||
super(type, worldIn);
|
||||
@ -56,6 +56,11 @@ public class HogEntity extends AnimalEntity {
|
||||
this.goalSelector.addGoal(8, new LookRandomlyGoal(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getExperiencePoints(PlayerEntity player) {
|
||||
return 1 + this.world.rand.nextInt(4);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() { return SoundEvents.ENTITY_PIG_AMBIENT; }
|
||||
|
||||
@ -74,14 +79,14 @@ public class HogEntity extends AnimalEntity {
|
||||
|
||||
@Override
|
||||
protected void updateAITasks() {
|
||||
this.goatTimer = this.eatGrassGoal.getEatingGrassTimer();
|
||||
this.hogTimer = this.eatGrassGoal.getEatingGrassTimer();
|
||||
super.updateAITasks();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void livingTick() {
|
||||
if (this.world.isRemote) {
|
||||
this.goatTimer = Math.max(0, this.goatTimer - 1);
|
||||
this.hogTimer = Math.max(0, this.hogTimer - 1);
|
||||
}
|
||||
super.livingTick();
|
||||
}
|
||||
@ -89,10 +94,9 @@ public class HogEntity extends AnimalEntity {
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public void handleStatusUpdate(byte id) {
|
||||
if (id == 10) {
|
||||
this.goatTimer = 40;
|
||||
this.hogTimer = 40;
|
||||
} else {
|
||||
super.handleStatusUpdate(id);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user