[add] Shark
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
// 1.21.1 2026-09-24T18:18:13.079823188 Languages: en_us for mod: masterwild
|
||||
57c760308c9f5032b784687dcf1070b4c3f3cc6d assets/masterwild/lang/en_us.json
|
||||
// 1.21.1 2026-09-24T20:03:22.379929654 Languages: en_us for mod: masterwild
|
||||
983f6e76a68757a3db42ee7909f23c5af0aa3833 assets/masterwild/lang/en_us.json
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// 1.21.1 2026-09-24T17:08:07.016016258 Item Models: masterwild
|
||||
// 1.21.1 2026-09-24T20:03:49.185849858 Item Models: masterwild
|
||||
63ec6c618a3a23eab4cab9c52d7d3250de9b516e assets/masterwild/models/item/firefly_spawn_egg.json
|
||||
63ec6c618a3a23eab4cab9c52d7d3250de9b516e assets/masterwild/models/item/pinguin_spawn_egg.json
|
||||
63ec6c618a3a23eab4cab9c52d7d3250de9b516e assets/masterwild/models/item/rooster_spawn_egg.json
|
||||
63ec6c618a3a23eab4cab9c52d7d3250de9b516e assets/masterwild/models/item/shark_spawn_egg.json
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
"entity.masterwild.firefly": "Firefly",
|
||||
"entity.masterwild.pinguin": "Pinguin",
|
||||
"entity.masterwild.rooster": "Rooster",
|
||||
"entity.masterwild.shark": "Shark",
|
||||
"item.masterwild.firefly_spawn_egg": "Firefly Spawn Egg",
|
||||
"item.masterwild.pinguin_spawn_egg": "Pinguin Spawn Egg",
|
||||
"item.masterwild.rooster_spawn_egg": "Rooster Spawn Egg",
|
||||
"item.masterwild.shark_spawn_egg": "Shark Spawn Egg",
|
||||
"subtitles.masterwild.rooster_crow": "Rooster crows"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parent": "minecraft:item/template_spawn_egg"
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package ovh.glitchlabs.masterwild;
|
||||
|
||||
import net.minecraft.core.registries.BuiltInRegistries;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.neoforged.bus.api.SubscribeEvent;
|
||||
import net.neoforged.fml.common.EventBusSubscriber;
|
||||
import net.neoforged.fml.event.config.ModConfigEvent;
|
||||
import net.neoforged.neoforge.common.ModConfigSpec;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// An example config class. This is not required, but it's a good idea to have one to keep your config organized.
|
||||
// Demonstrates how to use Neo's config APIs
|
||||
@EventBusSubscriber(modid = Masterwild.MODID, bus = EventBusSubscriber.Bus.MOD)
|
||||
public class Config {
|
||||
private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder();
|
||||
|
||||
private static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER.comment("Whether to log the dirt block on common setup").define("logDirtBlock", true);
|
||||
|
||||
private static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER.comment("A magic number").defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE);
|
||||
|
||||
public static final ModConfigSpec.ConfigValue<String> MAGIC_NUMBER_INTRODUCTION = BUILDER.comment("What you want the introduction message to be for the magic number").define("magicNumberIntroduction", "The magic number is... ");
|
||||
|
||||
// a list of strings that are treated as resource locations for items
|
||||
private static final ModConfigSpec.ConfigValue<List<? extends String>> ITEM_STRINGS = BUILDER.comment("A list of items to log on common setup.").defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), Config::validateItemName);
|
||||
|
||||
static final ModConfigSpec SPEC = BUILDER.build();
|
||||
|
||||
public static boolean logDirtBlock;
|
||||
public static int magicNumber;
|
||||
public static String magicNumberIntroduction;
|
||||
public static Set<Item> items;
|
||||
|
||||
private static boolean validateItemName(final Object obj) {
|
||||
return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(ResourceLocation.parse(itemName));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
static void onLoad(final ModConfigEvent event) {
|
||||
logDirtBlock = LOG_DIRT_BLOCK.get();
|
||||
magicNumber = MAGIC_NUMBER.get();
|
||||
magicNumberIntroduction = MAGIC_NUMBER_INTRODUCTION.get();
|
||||
|
||||
// convert the list of strings into a set of items
|
||||
items = ITEM_STRINGS.get().stream().map(itemName -> BuiltInRegistries.ITEM.get(ResourceLocation.parse(itemName))).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,9 @@ public class ModItems {
|
||||
public static final DeferredItem<Item> ROOSTER_SPAWN_EGG = ITEMS.register("rooster_spawn_egg",
|
||||
() -> new DeferredSpawnEggItem(ModEntities.ROOSTER, 0xc4551c, 0x4f5026,
|
||||
new Item.Properties()));
|
||||
public static final DeferredItem<Item> SHARK_SPAWN_EGG = ITEMS.register("shark_spawn_egg",
|
||||
() -> new DeferredSpawnEggItem(ModEntities.SHARK, 0x1d598b, 0x8daec4,
|
||||
new Item.Properties()));
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
ITEMS.register(eventBus);
|
||||
|
||||
@@ -20,6 +20,7 @@ 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.Rooster.RoosterRenderer;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Shark.SharkRenderer;
|
||||
import ovh.glitchlabs.masterwild.entity.client.firefly.FireflyRenderer;
|
||||
|
||||
// The value here should match an entry in the META-INF/neoforge.mods.toml file
|
||||
@@ -46,8 +47,6 @@ public class Masterwild {
|
||||
// Do not add this line if there are no @SubscribeEvent-annotated functions in this class, like onServerStarting() below.
|
||||
NeoForge.EVENT_BUS.register(this);
|
||||
|
||||
// Register our mod's ModConfigSpec so that FML can create and load the config file for us
|
||||
modContainer.registerConfig(ModConfig.Type.COMMON, Config.SPEC);
|
||||
}
|
||||
|
||||
private void commonSetup(final FMLCommonSetupEvent event) {
|
||||
@@ -71,6 +70,7 @@ public class Masterwild {
|
||||
EntityRenderers.register(ModEntities.PINGUIN.get(), PinguinRenderer::new);
|
||||
EntityRenderers.register(ModEntities.FIREFLY.get(), FireflyRenderer::new);
|
||||
EntityRenderers.register(ModEntities.ROOSTER.get(), RoosterRenderer::new);
|
||||
EntityRenderers.register(ModEntities.SHARK.get(), SharkRenderer::new);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,5 +17,6 @@ public class ModItemModelProvider extends ItemModelProvider {
|
||||
withExistingParent(ModItems.PINGUIN_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
withExistingParent(ModItems.FIREFLY_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
withExistingParent(ModItems.ROOSTER_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
withExistingParent(ModItems.SHARK_SPAWN_EGG.getId().getPath(), mcLoc("item/template_spawn_egg"));
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,12 @@ public class ModLanguageProvider extends LanguageProvider {
|
||||
add(ModEntities.PINGUIN.get(), "Pinguin");
|
||||
add(ModEntities.FIREFLY.get(), "Firefly");
|
||||
add(ModEntities.ROOSTER.get(), "Rooster");
|
||||
add(ModEntities.SHARK.get(), "Shark");
|
||||
|
||||
add(ModItems.PINGUIN_SPAWN_EGG.get(), "Pinguin Spawn Egg");
|
||||
add(ModItems.FIREFLY_SPAWN_EGG.get(), "Firefly Spawn Egg");
|
||||
add(ModItems.ROOSTER_SPAWN_EGG.get(), "Rooster Spawn Egg");
|
||||
add(ModItems.SHARK_SPAWN_EGG.get(), "Shark Spawn Egg");
|
||||
|
||||
add("subtitles.masterwild.rooster_crow", "Rooster crows");
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import ovh.glitchlabs.masterwild.Masterwild;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.FireflyEntity;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.PinguinEntity;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.RoosterEntity;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.SharkEntity;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -28,6 +29,10 @@ public class ModEntities {
|
||||
ENTITY_TYPES.register("rooster", () -> EntityType.Builder.of(RoosterEntity::new, MobCategory.CREATURE)
|
||||
.sized(0.5f, 0.75f).build("rooster"));
|
||||
|
||||
public static final Supplier<EntityType<SharkEntity>> SHARK =
|
||||
ENTITY_TYPES.register("shark", () -> EntityType.Builder.of(SharkEntity::new, MobCategory.WATER_CREATURE)
|
||||
.sized(1.6f, 0.8f).build("shark"));
|
||||
|
||||
|
||||
public static void register(IEventBus eventBus) {
|
||||
ENTITY_TYPES.register(eventBus);
|
||||
|
||||
+165
@@ -0,0 +1,165 @@
|
||||
package ovh.glitchlabs.masterwild.entity.client.Shark;// Save this class in your mod and generate all required imports
|
||||
|
||||
import net.minecraft.client.animation.AnimationChannel;
|
||||
import net.minecraft.client.animation.AnimationDefinition;
|
||||
import net.minecraft.client.animation.Keyframe;
|
||||
import net.minecraft.client.animation.KeyframeAnimations;
|
||||
/**
|
||||
* Made with Blockbench 5.2.0
|
||||
* Exported for Minecraft version 1.19 or later with Mojang mappings
|
||||
* @author Author
|
||||
*/
|
||||
public class SharkAnimation {
|
||||
public static final AnimationDefinition shark_swim = AnimationDefinition.Builder.withLength(0.5F).looping()
|
||||
.addAnimation("head", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("head", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("head", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_L", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_L", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_L", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_R", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_R", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_R", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body1", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, -5.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, 5.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body1", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body1", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body2", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 7.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, -7.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body2", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body2", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body3", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 17.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, -17.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body3", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body3", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.build();
|
||||
|
||||
public static final AnimationDefinition shark_attack = AnimationDefinition.Builder.withLength(0.5F)
|
||||
.addAnimation("head", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
|
||||
new Keyframe(0.2083F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
|
||||
new Keyframe(0.3333F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("head", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("head", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_L", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_L", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_L", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_R", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_R", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("flos_R", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body1", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 7.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.25F, KeyframeAnimations.degreeVec(-10.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, -7.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body1", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.25F, KeyframeAnimations.posVec(0.0F, 0.0F, -3.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body1", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body2", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, -5.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, 5.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body2", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body2", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body3", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.1667F, KeyframeAnimations.degreeVec(0.0F, 17.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.3333F, KeyframeAnimations.degreeVec(0.0F, -17.5F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body3", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("body3", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("head_down", new AnimationChannel(AnimationChannel.Targets.ROTATION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.25F, KeyframeAnimations.degreeVec(15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM),
|
||||
new Keyframe(0.5F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("head_down", new AnimationChannel(AnimationChannel.Targets.POSITION,
|
||||
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.addAnimation("head_down", new AnimationChannel(AnimationChannel.Targets.SCALE,
|
||||
new Keyframe(0.0F, KeyframeAnimations.scaleVec(1.0F, 1.0F, 1.0F), AnimationChannel.Interpolations.CATMULLROM)
|
||||
))
|
||||
.build();
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package ovh.glitchlabs.masterwild.entity.client.Shark;// Made with Blockbench 5.2.0
|
||||
// Exported for Minecraft version 1.17 or later with Mojang mappings
|
||||
// Paste this class into your mod and generate all required imports
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import net.minecraft.client.model.EntityModel;
|
||||
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.SharkEntity;
|
||||
|
||||
public class SharkModel<T extends SharkEntity> extends HierarchicalModel<T> {
|
||||
// This layer location should be baked with EntityRendererProvider.Context in the entity renderer and passed into this model's constructor
|
||||
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "shark"), "main");
|
||||
private final ModelPart Shark;
|
||||
private final ModelPart body;
|
||||
private final ModelPart body1;
|
||||
private final ModelPart flos_R;
|
||||
private final ModelPart flos_L;
|
||||
private final ModelPart head;
|
||||
private final ModelPart head_down;
|
||||
private final ModelPart body2;
|
||||
private final ModelPart body3;
|
||||
|
||||
public SharkModel(ModelPart root) {
|
||||
this.Shark = root.getChild("Shark");
|
||||
this.body = this.Shark.getChild("body");
|
||||
this.body1 = this.body.getChild("body1");
|
||||
this.flos_R = this.body1.getChild("flos_R");
|
||||
this.flos_L = this.body1.getChild("flos_L");
|
||||
this.head = this.body1.getChild("head");
|
||||
this.head_down = this.head.getChild("head_down");
|
||||
this.body2 = this.body1.getChild("body2");
|
||||
this.body3 = this.body2.getChild("body3");
|
||||
}
|
||||
|
||||
public static LayerDefinition createBodyLayer() {
|
||||
MeshDefinition meshdefinition = new MeshDefinition();
|
||||
PartDefinition partdefinition = meshdefinition.getRoot();
|
||||
|
||||
PartDefinition Shark = partdefinition.addOrReplaceChild("Shark", CubeListBuilder.create(), PartPose.offset(0.0F, 19.0F, -9.0F));
|
||||
|
||||
PartDefinition body = Shark.addOrReplaceChild("body", CubeListBuilder.create(), PartPose.offset(0.0F, 5.0F, 9.0F));
|
||||
|
||||
PartDefinition body1 = body.addOrReplaceChild("body1", CubeListBuilder.create().texOffs(0, 0).addBox(-7.7143F, -4.18F, -9.6524F, 12.0F, 8.0F, 16.0F, new CubeDeformation(0.0F)), PartPose.offset(1.7143F, -3.82F, 1.6524F));
|
||||
|
||||
PartDefinition cube_r1 = body1.addOrReplaceChild("cube_r1", CubeListBuilder.create().texOffs(56, 6).addBox(-1.0F, -6.0F, -4.0F, 2.0F, 5.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-1.7143F, -2.68F, 1.3476F, 0.7854F, 0.0F, 0.0F));
|
||||
|
||||
PartDefinition flos_R = body1.addOrReplaceChild("flos_R", CubeListBuilder.create(), PartPose.offset(4.2857F, 3.32F, -3.6524F));
|
||||
|
||||
PartDefinition cube_r2 = flos_R.addOrReplaceChild("cube_r2", CubeListBuilder.create().texOffs(56, 0).addBox(-9.0F, -1.0F, -1.0F, 10.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(-12.0F, 0.0F, 0.0F, 0.0F, 0.3927F, 0.0F));
|
||||
|
||||
PartDefinition flos_L = body1.addOrReplaceChild("flos_L", CubeListBuilder.create(), PartPose.offset(4.2857F, 3.32F, -3.6524F));
|
||||
|
||||
PartDefinition cube_r3 = flos_L.addOrReplaceChild("cube_r3", CubeListBuilder.create().texOffs(30, 53).addBox(-1.0F, -1.0F, -1.0F, 10.0F, 1.0F, 5.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, -0.3927F, 0.0F));
|
||||
|
||||
PartDefinition head = body1.addOrReplaceChild("head", CubeListBuilder.create().texOffs(0, 24).addBox(-5.0F, -2.0F, -9.0F, 10.0F, 4.0F, 10.0F, new CubeDeformation(0.0F))
|
||||
.texOffs(0, 50).addBox(-4.0F, 2.0F, -8.0F, 8.0F, 1.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.7143F, -1.18F, -10.6524F));
|
||||
|
||||
PartDefinition head_down = head.addOrReplaceChild("head_down", CubeListBuilder.create(), PartPose.offset(0.0F, 2.0F, 1.0F));
|
||||
|
||||
PartDefinition cube_r4 = head_down.addOrReplaceChild("cube_r4", CubeListBuilder.create().texOffs(0, 38).addBox(-5.0F, -0.0872F, -9.9962F, 10.0F, 2.0F, 10.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 0.0F, 0.5F, 0.0873F, 0.0F, 0.0F));
|
||||
|
||||
PartDefinition body2 = body1.addOrReplaceChild("body2", CubeListBuilder.create().texOffs(40, 24).addBox(-5.0F, -3.1893F, -1.0251F, 10.0F, 6.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(-1.7143F, 0.0094F, 6.3727F));
|
||||
|
||||
PartDefinition cube_r5 = body2.addOrReplaceChild("cube_r5", CubeListBuilder.create().texOffs(40, 59).addBox(-1.0F, -6.0F, -4.0F, 2.0F, 2.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -1.6893F, 7.9749F, 0.7854F, 0.0F, 0.0F));
|
||||
|
||||
PartDefinition body3 = body2.addOrReplaceChild("body3", CubeListBuilder.create().texOffs(20, 59).addBox(-3.0F, -2.0453F, -2.0168F, 6.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -0.144F, 7.9916F));
|
||||
|
||||
PartDefinition cube_r6 = body3.addOrReplaceChild("cube_r6", CubeListBuilder.create().texOffs(0, 58).addBox(-1.0F, -5.0F, -8.0F, 2.0F, 3.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, 7.9547F, 3.9832F, -0.7854F, 0.0F, 0.0F));
|
||||
|
||||
PartDefinition cube_r7 = body3.addOrReplaceChild("cube_r7", CubeListBuilder.create().texOffs(40, 38).addBox(-1.0F, -6.0F, -8.0F, 2.0F, 4.0F, 11.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -1.5453F, 9.9832F, 0.7854F, 0.0F, 0.0F));
|
||||
|
||||
return LayerDefinition.create(meshdefinition, 128, 128);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setupAnim(T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
|
||||
this.root().getAllParts().forEach(ModelPart::resetPose);
|
||||
|
||||
this.Shark.xRot = headPitch * ((float) Math.PI / 180f);
|
||||
|
||||
float swimSpeed = 0.5f + Math.min(limbSwingAmount * 2f, 1f);
|
||||
this.animate(entity.swimAnimationState, SharkAnimation.shark_swim, ageInTicks, swimSpeed);
|
||||
this.animate(entity.attackAnimationState, SharkAnimation.shark_attack, ageInTicks, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderToBuffer(PoseStack poseStack, VertexConsumer vertexConsumer, int packedLight, int packedOverlay, int color) {
|
||||
Shark.render(poseStack, vertexConsumer, packedLight, packedOverlay, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelPart root() {
|
||||
return Shark;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package ovh.glitchlabs.masterwild.entity.client.Shark;
|
||||
|
||||
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.SharkEntity;
|
||||
|
||||
public class SharkRenderer extends MobRenderer<SharkEntity, SharkModel<SharkEntity>> {
|
||||
private static final ResourceLocation TEXTURE =
|
||||
ResourceLocation.fromNamespaceAndPath(Masterwild.MODID, "textures/entity/shark.png");
|
||||
|
||||
public SharkRenderer(EntityRendererProvider.Context context) {
|
||||
super(context, new SharkModel<>(context.bakeLayer(SharkModel.LAYER_LOCATION)), 0.8f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTextureLocation(SharkEntity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package ovh.glitchlabs.masterwild.entity.custom;
|
||||
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.AnimationState;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MoverType;
|
||||
import net.minecraft.world.entity.ai.attributes.AttributeSupplier;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.ai.control.SmoothSwimmingLookControl;
|
||||
import net.minecraft.world.entity.ai.control.SmoothSwimmingMoveControl;
|
||||
import net.minecraft.world.entity.ai.goal.MeleeAttackGoal;
|
||||
import net.minecraft.world.entity.ai.goal.RandomLookAroundGoal;
|
||||
import net.minecraft.world.entity.ai.goal.RandomSwimmingGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.HurtByTargetGoal;
|
||||
import net.minecraft.world.entity.ai.goal.target.NearestAttackableTargetGoal;
|
||||
import net.minecraft.world.entity.ai.navigation.PathNavigation;
|
||||
import net.minecraft.world.entity.ai.navigation.WaterBoundPathNavigation;
|
||||
import net.minecraft.world.entity.animal.AbstractFish;
|
||||
import net.minecraft.world.entity.animal.WaterAnimal;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
public class SharkEntity extends WaterAnimal {
|
||||
public final AnimationState swimAnimationState = new AnimationState();
|
||||
public final AnimationState attackAnimationState = new AnimationState();
|
||||
|
||||
public SharkEntity(EntityType<? extends WaterAnimal> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
this.xpReward = 10;
|
||||
this.moveControl = new SmoothSwimmingMoveControl(this, 85, 10, 0.02F, 0.1F, true);
|
||||
this.lookControl = new SmoothSwimmingLookControl(this, 10);
|
||||
}
|
||||
|
||||
public static AttributeSupplier.Builder createAttributes() {
|
||||
return Mob.createMobAttributes()
|
||||
.add(Attributes.MAX_HEALTH, 18)
|
||||
.add(Attributes.MOVEMENT_SPEED, 1.2)
|
||||
.add(Attributes.ATTACK_DAMAGE, 6)
|
||||
.add(Attributes.FOLLOW_RANGE, 32)
|
||||
.add(Attributes.KNOCKBACK_RESISTANCE, 0.3);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected PathNavigation createNavigation(Level level) {
|
||||
return new WaterBoundPathNavigation(this, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerGoals() {
|
||||
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.2, true));
|
||||
this.goalSelector.addGoal(2, new RandomSwimmingGoal(this, 1.0, 10));
|
||||
this.goalSelector.addGoal(3, new RandomLookAroundGoal(this));
|
||||
|
||||
this.targetSelector.addGoal(1, new HurtByTargetGoal(this));
|
||||
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, Player.class, true));
|
||||
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractFish.class, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void travel(Vec3 travelVector) {
|
||||
if (this.isControlledByLocalInstance() && this.isInWater()) {
|
||||
this.moveRelative(this.getSpeed(), travelVector);
|
||||
this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
this.setDeltaMovement(this.getDeltaMovement().scale(0.9));
|
||||
if (this.getTarget() == null) {
|
||||
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.005, 0.0));
|
||||
}
|
||||
} else {
|
||||
super.travel(travelVector);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doHurtTarget(Entity target) {
|
||||
this.level().broadcastEntityEvent(this, (byte) 4);
|
||||
return super.doHurtTarget(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEntityEvent(byte id) {
|
||||
if (id == 4) {
|
||||
this.attackAnimationState.start(this.tickCount);
|
||||
} else {
|
||||
super.handleEntityEvent(id);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (this.level().isClientSide()) {
|
||||
this.swimAnimationState.startIfStopped(this.tickCount);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getHurtSound(DamageSource source) {
|
||||
return SoundEvents.DOLPHIN_HURT;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected SoundEvent getDeathSound() {
|
||||
return SoundEvents.DOLPHIN_DEATH;
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,12 @@ 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.Rooster.RoosterModel;
|
||||
import ovh.glitchlabs.masterwild.entity.client.Shark.SharkModel;
|
||||
import ovh.glitchlabs.masterwild.entity.client.firefly.FireflyModel;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.FireflyEntity;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.PinguinEntity;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.RoosterEntity;
|
||||
import ovh.glitchlabs.masterwild.entity.custom.SharkEntity;
|
||||
|
||||
@EventBusSubscriber(modid = Masterwild.MODID, bus = EventBusSubscriber.Bus.MOD)
|
||||
public class ModEventBusEvents {
|
||||
@@ -20,6 +22,7 @@ public class ModEventBusEvents {
|
||||
event.registerLayerDefinition(PinguinModel.LAYER_LOCATION, PinguinModel::createBodyLayer);
|
||||
event.registerLayerDefinition(FireflyModel.LAYER_LOCATION, FireflyModel::createBodyLayer);
|
||||
event.registerLayerDefinition(RoosterModel.LAYER_LOCATION, RoosterModel::createBodyLayer);
|
||||
event.registerLayerDefinition(SharkModel.LAYER_LOCATION, SharkModel::createBodyLayer);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -27,5 +30,6 @@ public class ModEventBusEvents {
|
||||
event.put(ModEntities.PINGUIN.get(), PinguinEntity.createAttributes().build());
|
||||
event.put(ModEntities.FIREFLY.get(), FireflyEntity.createAttributes().build());
|
||||
event.put(ModEntities.ROOSTER.get(), RoosterEntity.createAttributes().build());
|
||||
event.put(ModEntities.SHARK.get(), SharkEntity.createAttributes().build());
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.2 KiB |
Reference in New Issue
Block a user