[add] Raccoon
This commit is contained in:
@@ -29,6 +29,7 @@ public class ModCreativeModeTabs {
|
||||
output.accept(ModItems.HEDGEHOG_SPAWN_EGG);
|
||||
output.accept(ModItems.RED_PANDA_SPAWN_EGG);
|
||||
output.accept(ModItems.BUTTERFLY_SPAWN_EGG);
|
||||
output.accept(ModItems.RACCOON_SPAWN_EGG);
|
||||
|
||||
}).build());
|
||||
|
||||
|
||||
@@ -44,7 +44,10 @@ public class ModItems {
|
||||
() -> new DeferredSpawnEggItem(ModEntities.RED_PANDA, 0x923918, 0x211b1b,
|
||||
new Item.Properties()));
|
||||
public static final DeferredItem<Item> BUTTERFLY_SPAWN_EGG = ITEMS.register("butterfly_spawn_egg",
|
||||
() -> new DeferredSpawnEggItem(ModEntities.BUTTERFLY, 0x923918, 0x0b0b17,
|
||||
() -> new DeferredSpawnEggItem(ModEntities.BUTTERFLY, 0x372a21, 0x0b0b17,
|
||||
new Item.Properties()));
|
||||
public static final DeferredItem<Item> RACCOON_SPAWN_EGG = ITEMS.register("raccoon_spawn_egg",
|
||||
() -> new DeferredSpawnEggItem(ModEntities.RACCOON, 0x68696a, 0xa6a4a3,
|
||||
new Item.Properties()));
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
|
||||
@@ -20,6 +20,7 @@ import ovh.glitchlabs.masterwild.Item.ModItems;
|
||||
import ovh.glitchlabs.masterwild.Sounds.ModSounds;
|
||||
import ovh.glitchlabs.masterwild.entity.ModEntities;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Pinguin.PinguinRenderer;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Raccoon.RaccoonRenderer;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Rooster.RoosterRenderer;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Shark.SharkRenderer;
|
||||
import ovh.glitchlabs.masterwild.entity.client.butterfly.ButterflyRenderer;
|
||||
@@ -80,6 +81,7 @@ public class Masterwild {
|
||||
EntityRenderers.register(ModEntities.HEDGEHOG.get(), HedgehogRenderer::new);
|
||||
EntityRenderers.register(ModEntities.RED_PANDA.get(), Red_PandaRenderer::new);
|
||||
EntityRenderers.register(ModEntities.BUTTERFLY.get(), ButterflyRenderer::new);
|
||||
EntityRenderers.register(ModEntities.RACCOON.get(), RaccoonRenderer::new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,5 +28,6 @@ public class ModItemModelProvider extends ItemModelProvider {
|
||||
withExistingParent(ModItems.HEDGEHOG_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
withExistingParent(ModItems.RED_PANDA_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
withExistingParent(ModItems.BUTTERFLY_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
withExistingParent(ModItems.RACCOON_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@ public class ModLanguageProvider extends LanguageProvider {
|
||||
add(ModEntities.HEDGEHOG.get(), "Hedgehog");
|
||||
add(ModEntities.RED_PANDA.get(), "Red Panda");
|
||||
add(ModEntities.BUTTERFLY.get(), "Butterfly");
|
||||
add(ModEntities.RACCOON.get(), "Raccoon");
|
||||
|
||||
add(ModItems.PINGUIN_SPAWN_EGG.get(), "Pinguin Spawn Egg");
|
||||
add(ModItems.FIREFLY_SPAWN_EGG.get(), "Firefly Spawn Egg");
|
||||
@@ -32,6 +33,7 @@ public class ModLanguageProvider extends LanguageProvider {
|
||||
add(ModItems.HEDGEHOG_SPAWN_EGG.get(), "Hedgehog Spawn Egg");
|
||||
add(ModItems.RED_PANDA_SPAWN_EGG.get(), "Red Panda Spawn Egg");
|
||||
add(ModItems.BUTTERFLY_SPAWN_EGG.get(), "Butterfly Spawn Egg");
|
||||
add(ModItems.RACCOON_SPAWN_EGG.get(), "Raccoon Spawn Egg");
|
||||
|
||||
add("creativetab.masterwild.masterwild", "MasterWild");
|
||||
add("subtitles.masterwild.rooster_crow", "Rooster crows");
|
||||
|
||||
@@ -42,6 +42,10 @@ public class ModEntities {
|
||||
ENTITY_TYPES.register("butterfly", () -> EntityType.Builder.of(ButterflyEntity::new, MobCategory.AMBIENT)
|
||||
.sized(0.6f, 0.7f).build("butterfly"));
|
||||
|
||||
public static final Supplier<EntityType<RaccoonEntity>> RACCOON =
|
||||
ENTITY_TYPES.register("raccoon", () -> EntityType.Builder.of(RaccoonEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.6f, 0.5f).build("raccoon"));
|
||||
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
ENTITY_TYPES.register(eventBus);
|
||||
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
package ovh.glitchlabs.masterwild.entity.client.Raccoon;// Made with Blockbench 5.2.0
|
||||
// Exported for Minecraft version 1.17 or later with Mojang mappings
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.model.HierarchicalModel;
|
||||
import net.minecraft.client.model.geom.ModelLayerLocation;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.model.geom.PartPose;
|
||||
import net.minecraft.client.model.geom.builders.*;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.Mth;
|
||||
import ovh.glitchlabs.masterwild.Masterwild;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.RaccoonEntity;
|
||||
|
||||
public class RaccoonModel<T extends RaccoonEntity> extends HierarchicalModel<T> {
|
||||
public static final ModelLayerLocation LAYER_LOCATION =
|
||||
new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "raccoon"), "main");
|
||||
|
||||
private final ModelPart root;
|
||||
private final ModelPart raccoon;
|
||||
private final ModelPart body;
|
||||
private final ModelPart R_back_leg;
|
||||
private final ModelPart L_back_leg;
|
||||
private final ModelPart R_frond_leg;
|
||||
private final ModelPart L_frond_leg;
|
||||
private final ModelPart body2;
|
||||
private final ModelPart head;
|
||||
private final ModelPart tail;
|
||||
|
||||
public RaccoonModel(ModelPart root) {
|
||||
this.root = root;
|
||||
this.raccoon = root.getChild("raccoon");
|
||||
this.body = this.raccoon.getChild("body");
|
||||
this.R_back_leg = this.body.getChild("R_back_leg");
|
||||
this.L_back_leg = this.body.getChild("L_back_leg");
|
||||
this.R_frond_leg = this.body.getChild("R_frond_leg");
|
||||
this.L_frond_leg = this.body.getChild("L_frond_leg");
|
||||
this.body2 = this.body.getChild("body2");
|
||||
this.head = this.raccoon.getChild("head");
|
||||
this.tail = this.raccoon.getChild("tail");
|
||||
}
|
||||
|
||||
public static LayerDefinition createBodyLayer() {
|
||||
MeshDefinition meshdefinition = new MeshDefinition();
|
||||
PartDefinition partdefinition = meshdefinition.getRoot();
|
||||
|
||||
PartDefinition raccoon = partdefinition.addOrReplaceChild("raccoon", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F));
|
||||
|
||||
PartDefinition body = raccoon.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.5F, -4.0F, -1.0F));
|
||||
|
||||
PartDefinition R_back_leg = body.addOrReplaceChild("R_back_leg", CubeListBuilder.create().texOffs(0, 33).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.5F, 0.0F, 6.5F));
|
||||
|
||||
PartDefinition L_back_leg = body.addOrReplaceChild("L_back_leg", CubeListBuilder.create().texOffs(32, 29).addBox(-1.5F, 0.0F, -1.5F, 3.0F, 4.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(1.5F, 0.0F, 6.5F));
|
||||
|
||||
PartDefinition R_frond_leg = body.addOrReplaceChild("R_frond_leg", CubeListBuilder.create().texOffs(32, 36).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(-2.75F, 0.0F, -2.75F));
|
||||
|
||||
PartDefinition L_frond_leg = body.addOrReplaceChild("L_frond_leg", CubeListBuilder.create().texOffs(24, 33).addBox(-1.0F, 0.0F, -1.0F, 2.0F, 4.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offset(1.75F, 0.0F, -2.75F));
|
||||
|
||||
PartDefinition body2 = body.addOrReplaceChild("body2", CubeListBuilder.create().texOffs(0, 0).addBox(-3.5F, -2.5F, -6.0F, 7.0F, 5.0F, 12.0F, new CubeDeformation(0.0F)), PartPose.offset(-0.5F, -2.5F, 2.0F));
|
||||
|
||||
PartDefinition head = raccoon.addOrReplaceChild("head", CubeListBuilder.create().texOffs(12, 33).addBox(-1.5F, 0.5F, -9.125F, 3.0F, 2.0F, 3.0F, new CubeDeformation(0.0F))
|
||||
.texOffs(32, 17).addBox(-4.5F, -3.5F, -6.125F, 9.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
|
||||
.texOffs(38, 0).addBox(-4.5F, -5.5F, -2.125F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F))
|
||||
.texOffs(38, 3).addBox(2.5F, -5.5F, -2.125F, 2.0F, 2.0F, 1.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -6.5F, -4.875F));
|
||||
|
||||
PartDefinition tail = raccoon.addOrReplaceChild("tail", CubeListBuilder.create().texOffs(0, 17).addBox(-3.0F, -3.0F, 0.0F, 6.0F, 6.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -8.0F, 7.0F));
|
||||
|
||||
return LayerDefinition.create(meshdefinition, 64, 64);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAnim(RaccoonEntity entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||
this.root().getAllParts().forEach(ModelPart::resetPose);
|
||||
this.applyHeadRotation(netHeadYaw, headPitch);
|
||||
this.walk(limbSwing, limbSwingAmount);
|
||||
}
|
||||
|
||||
private void applyHeadRotation(float headYaw, float headPitch) {
|
||||
headYaw = Mth.clamp(headYaw, -30f, 30f);
|
||||
headPitch = Mth.clamp(headPitch, -25f, 45f);
|
||||
this.head.yRot = headYaw * ((float) Math.PI / 180f);
|
||||
this.head.xRot = headPitch * ((float) Math.PI / 180f);
|
||||
}
|
||||
|
||||
private void walk(float limbSwing, float limbSwingAmount) {
|
||||
float amount = 1.0F * limbSwingAmount;
|
||||
this.R_frond_leg.xRot = Mth.cos(limbSwing * 0.6662F) * amount;
|
||||
this.L_back_leg.xRot = Mth.cos(limbSwing * 0.6662F) * amount;
|
||||
this.L_frond_leg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * amount;
|
||||
this.R_back_leg.xRot = Mth.cos(limbSwing * 0.6662F + (float) Math.PI) * amount;
|
||||
this.tail.yRot = Mth.cos(limbSwing * 0.3331F) * 0.2F * amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, int color) {
|
||||
root.render(poseStack, vertexConsumer, packedLight, packedOverlay, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelPart root() {
|
||||
return root;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package ovh.glitchlabs.masterwild.entity.client.Raccoon;
|
||||
|
||||
import net.minecraft.client.renderer.entity.EntityRendererProvider;
|
||||
import net.minecraft.client.renderer.entity.MobRenderer;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import ovh.glitchlabs.masterwild.Masterwild;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.RaccoonEntity;
|
||||
|
||||
public class RaccoonRenderer extends MobRenderer<RaccoonEntity, RaccoonModel<RaccoonEntity>> {
|
||||
private static final ResourceLocation TEXTURE =
|
||||
ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "textures/entity/raccoon.png");
|
||||
|
||||
public RaccoonRenderer(EntityRendererProvider.Context context) {
|
||||
super(context, new RaccoonModel<>(context.bakeLayer(RaccoonModel.LAYER_LOCATION)), 0.4f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(RaccoonEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package ovh.glitchlabs.masterwild.entity.custom;
|
||||
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.AgeableMob;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.goal.*;
|
||||
import net.minecraft.world.entity.animal.Animal;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.world.level.Level;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import ovh.glitchlabs.masterwild.entity.ModEntities;
|
||||
|
||||
public class RaccoonEntity extends Animal {
|
||||
private static final Ingredient FOOD = Ingredient.of(Items.SWEET_BERRIES, Items.APPLE, Items.BREAD);
|
||||
|
||||
public RaccoonEntity(EntityType<? extends Animal> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
return Mob.createMobAttributes()
|
||||
.add(Attributes.MAX_HEALTH, 6)
|
||||
.add(Attributes.MOVEMENT_SPEED, 0.25)
|
||||
.add(Attributes.FOLLOW_RANGE, 10)
|
||||
.add(Attributes.STEP_HEIGHT, 0.6);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(0, new FloatGoal(this));
|
||||
this.goalSelector.addGoal(1, new PanicGoal(this, 1.5));
|
||||
this.goalSelector.addGoal(2, new BreedGoal(this, 1.0));
|
||||
this.goalSelector.addGoal(3, new TemptGoal(this, 1.1, FOOD, false));
|
||||
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1));
|
||||
this.goalSelector.addGoal(5, new WaterAvoidingRandomStrollGoal(this, 0.8));
|
||||
this.goalSelector.addGoal(6, new LookAtPlayerGoal(this, Player.class, 6.0F));
|
||||
this.goalSelector.addGoal(7, new RandomLookAroundGoal(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFood(ItemStack stack) {
|
||||
return FOOD.test(stack);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public AgeableMob getBreedOffspring(ServerLevel level, AgeableMob partner) {
|
||||
return ModEntities.RACCOON.get().create(level);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getAmbientSound() {
|
||||
return SoundEvents.FOX_AMBIENT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource damageSource) {
|
||||
return SoundEvents.FOX_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound() {
|
||||
return SoundEvents.FOX_DEATH;
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import net.neoforged.neoforge.event.entity.EntityAttributeCreationEvent;
|
||||
import ovh.glitchlabs.masterwild.Masterwild;
|
||||
import ovh.glitchlabs.masterwild.entity.ModEntities;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Pinguin.PinguinModel;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Raccoon.RaccoonModel;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Rooster.RoosterModel;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Shark.SharkModel;
|
||||
import ovh.glitchlabs.masterwild.entity.client.butterfly.ButterflyModel;
|
||||
@@ -26,6 +27,7 @@ public class ModEventBusEvents {
|
||||
event.registerLayerDefinition(HedgehogModel.LAYER_LOCATION, HedgehogModel::createBodyLayer);
|
||||
event.registerLayerDefinition(Red_PandaModel.LAYER_LOCATION, Red_PandaModel::createBodyLayer);
|
||||
event.registerLayerDefinition(ButterflyModel.LAYER_LOCATION, ButterflyModel::createBodyLayer);
|
||||
event.registerLayerDefinition(RaccoonModel.LAYER_LOCATION, RaccoonModel::createBodyLayer);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -36,6 +38,6 @@ public class ModEventBusEvents {
|
||||
event.put(ModEntities.SHARK.get(), SharkEntity.createAttributes().build());
|
||||
event.put(ModEntities.HEDGEHOG.get(), HedgehogEntity.createAttributes().build());
|
||||
event.put(ModEntities.RED_PANDA.get(), Red_PandaEntity.createAttributes().build());
|
||||
event.put(ModEntities.BUTTERFLY.get(), ButterflyEntity.createAttributes().build());
|
||||
event.put(ModEntities.RACCOON.get(), RaccoonEntity.createAttributes().build());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user