feat: add penguin
This commit is contained in:
parent
6b268ac031
commit
5d8d160f98
|
@ -1,7 +1,19 @@
|
|||
package me.theclashfruit.arctic;
|
||||
|
||||
import me.theclashfruit.arctic.entity.ModEntities;
|
||||
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
|
||||
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
|
||||
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricDefaultAttributeRegistry;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroups;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.item.SpawnEggItem;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -11,11 +23,33 @@ public class Arctic implements ModInitializer {
|
|||
public static final String MOD_ID = "arctic";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
||||
|
||||
/* Items */
|
||||
|
||||
public static final Item BABY_EMPEROR_SPAWN_EGG = new SpawnEggItem(
|
||||
ModEntities.BABY_EMPEROR,
|
||||
0xB00B69,
|
||||
0xffffff,
|
||||
new FabricItemSettings().maxCount(1)
|
||||
);
|
||||
|
||||
/**
|
||||
* Runs the mod initializer.
|
||||
*/
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
FabricDefaultAttributeRegistry.register(
|
||||
ModEntities.BABY_EMPEROR,
|
||||
BabyEmperorEntity.createBabyEmperorAttributes()
|
||||
);
|
||||
|
||||
// ------------------------------ //
|
||||
|
||||
Registry.register(Registries.ITEM, new Identifier(MOD_ID, "baby_emperor_spawn_egg"), BABY_EMPEROR_SPAWN_EGG);
|
||||
|
||||
ItemGroupEvents.modifyEntriesEvent(ItemGroups.SPAWN_EGGS).register(content -> {
|
||||
content.addAfter(Items.AXOLOTL_SPAWN_EGG, BABY_EMPEROR_SPAWN_EGG);
|
||||
});
|
||||
|
||||
GeckoLib.initialize();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,9 @@
|
|||
package me.theclashfruit.arctic.client;
|
||||
|
||||
import me.theclashfruit.arctic.client.entity.penguin.BabyEmperorRenderer;
|
||||
import me.theclashfruit.arctic.entity.ModEntities;
|
||||
import net.fabricmc.api.ClientModInitializer;
|
||||
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
|
||||
|
||||
public class ArcticClient implements ClientModInitializer {
|
||||
/**
|
||||
|
@ -8,6 +11,9 @@ public class ArcticClient implements ClientModInitializer {
|
|||
*/
|
||||
@Override
|
||||
public void onInitializeClient() {
|
||||
|
||||
EntityRendererRegistry.register(
|
||||
ModEntities.BABY_EMPEROR,
|
||||
BabyEmperorRenderer::new
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package me.theclashfruit.arctic.client.entity.penguin;
|
||||
|
||||
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
|
||||
import static me.theclashfruit.arctic.Arctic.MOD_ID;
|
||||
|
||||
public class BabyEmperorModel extends GeoModel<BabyEmperorEntity> {
|
||||
@Override
|
||||
public Identifier getModelResource(BabyEmperorEntity animatable) {
|
||||
return new Identifier(MOD_ID, "geo/penguin/baby_emperor.geo.json");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTextureResource(BabyEmperorEntity animatable) {
|
||||
return new Identifier(MOD_ID, "textures/entity/penguin/baby_emperor.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getAnimationResource(BabyEmperorEntity animatable) {
|
||||
return new Identifier(MOD_ID, "animations/penguin/baby_emperor.animation.json");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
package me.theclashfruit.arctic.client.entity.penguin;
|
||||
|
||||
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
||||
import net.minecraft.client.render.entity.EntityRendererFactory;
|
||||
import net.minecraft.util.Identifier;
|
||||
import software.bernie.geckolib.model.GeoModel;
|
||||
import software.bernie.geckolib.renderer.GeoEntityRenderer;
|
||||
|
||||
import static me.theclashfruit.arctic.Arctic.MOD_ID;
|
||||
|
||||
public class BabyEmperorRenderer extends GeoEntityRenderer<BabyEmperorEntity> {
|
||||
public BabyEmperorRenderer(EntityRendererFactory.Context ctx) {
|
||||
super(ctx, new BabyEmperorModel());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTextureLocation(BabyEmperorEntity animatable) {
|
||||
return new Identifier(MOD_ID, "textures/entity/penguin/baby_emperor.png");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
package me.theclashfruit.arctic.entity;
|
||||
|
||||
import me.theclashfruit.arctic.entity.penguin.BabyEmperorEntity;
|
||||
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
|
||||
import net.minecraft.entity.EntityDimensions;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.SpawnGroup;
|
||||
import net.minecraft.registry.Registries;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import static me.theclashfruit.arctic.Arctic.MOD_ID;
|
||||
|
||||
public class ModEntities {
|
||||
public static final EntityType<BabyEmperorEntity> BABY_EMPEROR = Registry.register(
|
||||
Registries.ENTITY_TYPE,
|
||||
new Identifier(MOD_ID, "baby_emperor"),
|
||||
FabricEntityTypeBuilder.create(SpawnGroup.CREATURE, BabyEmperorEntity::new)
|
||||
.dimensions(EntityDimensions.fixed(0.8f, 1f))
|
||||
.build()
|
||||
);
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
package me.theclashfruit.arctic.entity.penguin;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.ai.goal.SwimGoal;
|
||||
import net.minecraft.entity.ai.goal.WanderAroundGoal;
|
||||
import net.minecraft.entity.attribute.DefaultAttributeContainer;
|
||||
import net.minecraft.entity.attribute.EntityAttributes;
|
||||
import net.minecraft.entity.passive.AnimalEntity;
|
||||
import net.minecraft.entity.passive.PassiveEntity;
|
||||
import net.minecraft.server.world.ServerWorld;
|
||||
import net.minecraft.world.World;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import software.bernie.geckolib.animatable.GeoEntity;
|
||||
import software.bernie.geckolib.core.animatable.GeoAnimatable;
|
||||
import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache;
|
||||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||
import software.bernie.geckolib.core.animation.AnimationController;
|
||||
import software.bernie.geckolib.core.animation.AnimationState;
|
||||
import software.bernie.geckolib.core.animation.RawAnimation;
|
||||
import software.bernie.geckolib.core.object.PlayState;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
public class BabyEmperorEntity extends AnimalEntity implements GeoEntity {
|
||||
private final AnimatableInstanceCache geoCache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
public BabyEmperorEntity(EntityType<? extends AnimalEntity> entityType, World world) {
|
||||
super(entityType, world);
|
||||
}
|
||||
|
||||
public static DefaultAttributeContainer.Builder createBabyEmperorAttributes() {
|
||||
return AnimalEntity.createMobAttributes()
|
||||
.add(EntityAttributes.GENERIC_MAX_HEALTH, 15.0D)
|
||||
.add(EntityAttributes.GENERIC_MOVEMENT_SPEED, 0.25D);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public PassiveEntity createChild(ServerWorld world, PassiveEntity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initGoals() {
|
||||
this.goalSelector.add(0, new SwimGoal(this));
|
||||
this.goalSelector.add(1, new WanderAroundGoal(this, 1.0D));
|
||||
}
|
||||
|
||||
protected <E extends BabyEmperorEntity> PlayState predicate(final AnimationState<E> event) {
|
||||
return event.setAndContinue(
|
||||
RawAnimation.begin().thenLoop("animation.FM-Penguin.new")
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
|
||||
controllers.add(new AnimationController<>(this, "controller", 0, this::predicate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AnimatableInstanceCache getAnimatableInstanceCache() {
|
||||
return this.geoCache;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"format_version": "1.8.0",
|
||||
"animations": {
|
||||
"animation.FM-Penguin.new": {
|
||||
"animation_length": 1.75,
|
||||
"bones": {
|
||||
"RightArm": {
|
||||
"rotation": {
|
||||
"0.0": {
|
||||
"vector": [0, 0, 0]
|
||||
},
|
||||
"0.5": {
|
||||
"vector": [0, 0, 0],
|
||||
"easing": "easeInBack"
|
||||
},
|
||||
"1.0": {
|
||||
"vector": [0, 0, -30],
|
||||
"easing": "easeInBack"
|
||||
},
|
||||
"1.5": {
|
||||
"vector": [0, 0, 5],
|
||||
"easing": "easeInBack"
|
||||
},
|
||||
"1.75": {
|
||||
"vector": [0, 0, 0],
|
||||
"easing": "easeInBack"
|
||||
}
|
||||
}
|
||||
},
|
||||
"LeftArm": {
|
||||
"rotation": {
|
||||
"0.0": {
|
||||
"vector": [0, 0, 0]
|
||||
},
|
||||
"0.5": {
|
||||
"vector": [0, 0, 25],
|
||||
"easing": "easeInBack"
|
||||
},
|
||||
"1.0": {
|
||||
"vector": [0, 0, -5],
|
||||
"easing": "easeInBack"
|
||||
},
|
||||
"1.25": {
|
||||
"vector": [0, 0, 0],
|
||||
"easing": "easeInBack"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"geckolib_format_version": 2
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
{
|
||||
"format_version": "1.12.0",
|
||||
"minecraft:geometry": [
|
||||
{
|
||||
"description": {
|
||||
"identifier": "geometry.Arctic-Penguin-BabyEmperor",
|
||||
"texture_width": 64,
|
||||
"texture_height": 64,
|
||||
"visible_bounds_width": 2,
|
||||
"visible_bounds_height": 2.5,
|
||||
"visible_bounds_offset": [0, 0.75, 0]
|
||||
},
|
||||
"bones": [
|
||||
{
|
||||
"name": "bb_main",
|
||||
"pivot": [0, 0, 0],
|
||||
"cubes": [
|
||||
{"origin": [-4, 0.5, -3], "size": [8, 10, 6], "uv": [0, 0]},
|
||||
{"origin": [-3, 10.5, -2.75], "size": [6, 5, 5.5], "uv": [0, 16]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Foots",
|
||||
"pivot": [0, 0, 0]
|
||||
},
|
||||
{
|
||||
"name": "LeftFoot",
|
||||
"parent": "Foots",
|
||||
"pivot": [0, 0, 0],
|
||||
"cubes": [
|
||||
{"origin": [0.5, 0, -3.75], "size": [3, 1, 6], "pivot": [0, 0, 0], "rotation": [2.5, -2.5, 0], "uv": [0, 28]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "RightFoot",
|
||||
"parent": "Foots",
|
||||
"pivot": [0, 0, 0],
|
||||
"cubes": [
|
||||
{"origin": [-3.5, 0, -3.75], "size": [3, 1, 6], "pivot": [0, 0, 0], "rotation": [2.5, 2.5, 0], "uv": [28, 0]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Tail",
|
||||
"pivot": [0, 0.5, 2.5],
|
||||
"cubes": [
|
||||
{"origin": [-1.5, 0.5, 2.5], "size": [3, 1, 2], "pivot": [0, 0.5, 2.5], "rotation": [-5, 0, 0], "uv": [22, 0]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Beak",
|
||||
"pivot": [0, 11.6, -2],
|
||||
"cubes": [
|
||||
{"origin": [-1, 11.35, -4], "size": [2, 1, 2], "pivot": [0, 11.6, -2], "rotation": [7.5, 0, 0], "uv": [22, 3]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Arms",
|
||||
"pivot": [-4, 10.5, 0]
|
||||
},
|
||||
{
|
||||
"name": "RightArm",
|
||||
"parent": "Arms",
|
||||
"pivot": [4, 10.5, 0],
|
||||
"cubes": [
|
||||
{"origin": [3.25, 2.2, -2.75], "size": [1, 8.25, 5.5], "pivot": [4, 10.5, 0], "rotation": [0, 0, -5], "uv": [24, 11]}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "LeftArm",
|
||||
"parent": "Arms",
|
||||
"pivot": [-4, 10.5, 0],
|
||||
"cubes": [
|
||||
{"origin": [-4.25, 2.2, -2.75], "size": [1, 8.25, 5.5], "pivot": [-4, 10.5, 0], "rotation": [0, 0, 5], "uv": [17, 21]}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"parent": "minecraft:item/template_spawn_egg"
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
Loading…
Reference in a new issue