Skip to content

Commit

Permalink
Render children smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
d4rkm0nkey committed Mar 14, 2021
1 parent 701342b commit 0533b92
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import me.teajay.cheeky.monkeys.common.CheekyMonkeys;
import me.teajay.cheeky.monkeys.common.entity.MonkeyEntity;
import net.minecraft.util.Identifier;
import software.bernie.geckolib3.core.event.predicate.AnimationEvent;
import software.bernie.geckolib3.core.processor.IBone;
import software.bernie.geckolib3.model.AnimatedGeoModel;

public class MonkeyEntityModel extends AnimatedGeoModel<MonkeyEntity> {
Expand All @@ -21,4 +23,18 @@ public Identifier getModelLocation(MonkeyEntity monkey) {
public Identifier getTextureLocation(MonkeyEntity monkey) {
return new Identifier(CheekyMonkeys.MODID, "textures/entity/monkey.png");
}

@Override
public void setLivingAnimations(MonkeyEntity entity, Integer uniqueID, AnimationEvent customPredicate) {
super.setLivingAnimations(entity, uniqueID, customPredicate);

if (entity.isBaby()) {
IBone root = this.getAnimationProcessor().getBone("Root");
if (root != null) {
root.setScaleX(0.5f);
root.setScaleY(0.5f);
root.setScaleZ(0.5f);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import me.teajay.cheeky.monkeys.common.CheekyMonkeys;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.ai.goal.AnimalMateGoal;
import net.minecraft.entity.ai.goal.LookAroundGoal;
import net.minecraft.entity.ai.goal.LookAtEntityGoal;
import net.minecraft.entity.ai.goal.SitGoal;
Expand All @@ -17,6 +18,7 @@
import net.minecraft.entity.data.TrackedData;
import net.minecraft.entity.data.TrackedDataHandlerRegistry;
import net.minecraft.entity.mob.MobEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.passive.PassiveEntity;
import net.minecraft.entity.passive.TameableEntity;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -120,6 +122,7 @@ protected void initGoals() {
this.goalSelector.add(3, new WanderAroundFarGoal(this, 1.0D));
this.goalSelector.add(4, new LookAtEntityGoal(this, PlayerEntity.class, 8.0F));
this.goalSelector.add(5, new LookAroundGoal(this));
this.goalSelector.add(6, new AnimalMateGoal(this, 1.0D));
}

@Override
Expand Down Expand Up @@ -175,6 +178,25 @@ public ActionResult interactMob(PlayerEntity player, Hand hand) {
}
}

public boolean canBreedWith(AnimalEntity other) {
if (other == this) {
return false;
} else if (!this.isTamed()) {
return false;
} else if (!(other instanceof MonkeyEntity)) {
return false;
} else {
MonkeyEntity monkeyEntity = (MonkeyEntity)other;
if (!monkeyEntity.isTamed()) {
return false;
} else if (monkeyEntity.isInSittingPose()) {
return false;
} else {
return this.isInLove() && monkeyEntity.isInLove();
}
}
}

@Override
public boolean isSitting() {
return this.dataTracker.get(SITTING);
Expand All @@ -184,4 +206,5 @@ public boolean isSitting() {
public void setSitting(boolean sitting) {
this.dataTracker.set(SITTING, sitting);
}

}

0 comments on commit 0533b92

Please sign in to comment.