mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-19 17:39:39 +00:00
GeckoLib Addon is now an OPTIONAL Supported Addon [WIP]
This commit is contained in:
1 parent
5678029e30
commit
3c225f74db
20 files changed
+167
-476
No files matched your search
@@ -1,77 +0,0 @@
|
||||
package noppes.npcs.entity;
|
||||
|
||||
import net.minecraft.entity.EntityCreature;
|
||||
import net.minecraft.entity.ai.EntityAIWatchClosest;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import software.bernie.geckolib3.core.IAnimatable;
|
||||
import software.bernie.geckolib3.core.IAnimationTickable;
|
||||
import software.bernie.geckolib3.core.PlayState;
|
||||
import software.bernie.geckolib3.core.builder.AnimationBuilder;
|
||||
import software.bernie.geckolib3.core.controller.AnimationController;
|
||||
import software.bernie.geckolib3.core.event.predicate.AnimationEvent;
|
||||
import software.bernie.geckolib3.core.manager.AnimationData;
|
||||
import software.bernie.geckolib3.core.manager.AnimationFactory;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class EntityCustomModel extends EntityCreature implements IAnimatable, IAnimationTickable {
|
||||
private AnimationFactory factory = new AnimationFactory(this);
|
||||
public ResourceLocation modelResLoc=new ResourceLocation("geckolib3", "geo/npc.geo.json");
|
||||
public ResourceLocation animResLoc=new ResourceLocation("custom", "geo_npc.animation.json");
|
||||
public ResourceLocation textureResLoc = new ResourceLocation("geckolib3", "textures/model/entity/geo_npc.png");
|
||||
public String idleAnim = "";
|
||||
public String walkAnim = "";
|
||||
public String hurtAnim = "";
|
||||
public String attackAnim = "";
|
||||
private <E extends IAnimatable> PlayState predicateMovement(AnimationEvent<E> event) {
|
||||
if(!event.isMoving()){
|
||||
if(!Objects.equals(idleAnim, "")) {
|
||||
event.getController().setAnimation(new AnimationBuilder().addAnimation(idleAnim, true));
|
||||
}
|
||||
}else{
|
||||
if(!Objects.equals(idleAnim, "")) {
|
||||
event.getController().setAnimation(new AnimationBuilder().addAnimation(walkAnim, true));
|
||||
}
|
||||
}
|
||||
//event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.bat.fly", true));
|
||||
return PlayState.CONTINUE;
|
||||
}
|
||||
private <E extends IAnimatable> PlayState predicateAttack(AnimationEvent<E> event) {
|
||||
//event.getController().setAnimation(new AnimationBuilder().addAnimation("animation.bat.fly", true));
|
||||
return PlayState.CONTINUE;
|
||||
}
|
||||
private <E extends IAnimatable> PlayState predicateManual(AnimationEvent<E> event) {
|
||||
return PlayState.CONTINUE;
|
||||
}
|
||||
|
||||
public EntityCustomModel(World worldIn) {
|
||||
super(worldIn);
|
||||
this.ignoreFrustumCheck = true;
|
||||
this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
|
||||
this.setSize(0.7F, 2F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimationData data) {
|
||||
data.addAnimationController(new AnimationController<>(this, "movement", 10, this::predicateMovement));
|
||||
data.addAnimationController(new AnimationController<>(this, "attack", 10, this::predicateAttack));
|
||||
data.addAnimationController(new AnimationController<>(this, "manual", 10, this::predicateManual));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimationFactory getFactory() {
|
||||
return this.factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickTimer() {
|
||||
return ticksExisted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.onUpdate();
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package noppes.npcs.entity;
|
||||
|
||||
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.addon.GeckoAddonSupport;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
|
||||
Reference in new issue
Block a user