partial implementation of ghostly armour

This commit is contained in:
CosmoOrSth
2025-01-23 23:23:41 +05:30
parent ca3731a6ab
commit d153a4ca34
11 changed files with 508 additions and 20 deletions

View File

@@ -8,3 +8,5 @@
- added robes
- added the munch
- mobs are now passive to florian
- registered items related to ghostly armour
- added a model for ghostly armour

View File

@@ -28,7 +28,7 @@ public class TerraOriginum implements ModInitializer {
cottonItems.register();
sunTotem.register();
ghostlyItems.register();
robesItems.register();
ghostlyArmourItems.register();
modPowers.register();
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(umbrella.UMBRELLA));

View File

@@ -0,0 +1,13 @@
package com.smithy.terraoriginum.client;
import net.fabricmc.api.ClientModInitializer;
public class TerraOriginumClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
}
}

View File

@@ -0,0 +1,23 @@
package com.smithy.terraoriginum.client.armour;
import com.smithy.terraoriginum.items.ghostlyArmour;
import net.minecraft.util.Identifier;
import software.bernie.geckolib.model.GeoModel;
public class ghostlyArmourModel extends GeoModel<ghostlyArmour> {
@Override
public Identifier getModelResource(ghostlyArmour animatable) {
return new Identifier("terraoriginum", "geo/ghostly_armour.geo.json");
}
@Override
public Identifier getTextureResource(ghostlyArmour animatable) {
return new Identifier("terraoriginum", "textures/models/armor/ghost_armour_model_texture");
}
@Override
public Identifier getAnimationResource(ghostlyArmour animatable) {
return null;
}
}

View File

@@ -0,0 +1,16 @@
package com.smithy.terraoriginum.client.armour;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.items.ghostlyArmour;
import net.minecraft.util.Identifier;
import software.bernie.geckolib.GeckoLib;
import software.bernie.geckolib.model.DefaultedItemGeoModel;
import software.bernie.geckolib.renderer.GeoArmorRenderer;
public class ghostlyArmourRenderer extends GeoArmorRenderer<ghostlyArmour> {
public ghostlyArmourRenderer() {
super(new DefaultedItemGeoModel<>(new Identifier(TerraOriginum.MOD_ID, "armor/ghost_armour")));
}
}

View File

@@ -0,0 +1,108 @@
package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.client.armour.ghostlyArmourRenderer;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import net.minecraft.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import software.bernie.example.client.renderer.armor.GeckoArmorRenderer;
import software.bernie.geckolib.animatable.GeoItem;
import software.bernie.geckolib.animatable.client.RenderProvider;
import software.bernie.geckolib.constant.DataTickets;
import software.bernie.geckolib.constant.DefaultAnimations;
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.object.PlayState;
import software.bernie.geckolib.renderer.GeoArmorRenderer;
import software.bernie.geckolib.util.GeckoLibUtil;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Supplier;
public class ghostlyArmour extends ArmorItem implements GeoItem {
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
private final Supplier<Object> renderProvider = GeoItem.makeRenderer(this);
public ghostlyArmour(ArmorMaterial armorMaterial, ArmorItem.Type type, Settings properties) {
super(armorMaterial, type, properties);
}
// Create our armor model/renderer for Fabric and return it
@Override
public void createRenderer(Consumer<Object> consumer) {
consumer.accept(new RenderProvider() {
private GeoArmorRenderer<?> renderer;
@Override
public BipedEntityModel<LivingEntity> getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, BipedEntityModel<LivingEntity> original) {
if (this.renderer == null)
this.renderer = new ghostlyArmourRenderer();
// This prepares our GeoArmorRenderer for the current render frame.
// These parameters may be null however, so we don't do anything further with them
this.renderer.prepForRender(livingEntity, itemStack, equipmentSlot, original);
return this.renderer;
}
});
}
@Override
public Supplier<Object> getRenderProvider() {
return this.renderProvider;
}
// Let's add our animation controller
@Override
public void registerControllers(AnimatableManager.ControllerRegistrar controllers) {
controllers.add(new AnimationController<>(this, 20, state -> {
// Apply our generic idle animation.
// Whether it plays or not is decided down below
// Let's gather some data from the state to use below
// This is the entity that is currently wearing/holding the item
Entity entity = state.getData(DataTickets.ENTITY);
// We'll just have ArmorStands always animate, so we can return here
if (entity instanceof ArmorStandEntity)
return PlayState.CONTINUE;
// For this example, we only want the animation to play if the entity is wearing all pieces of the armor
// Let's collect the armor pieces the entity is currently wearing
Set<Item> wornArmor = new ObjectOpenHashSet<>();
for (ItemStack stack : entity.getArmorItems()) {
// We can stop immediately if any of the slots are empty
if (stack.isEmpty())
return PlayState.STOP;
wornArmor.add(stack.getItem());
}
// Check each of the pieces match our set
boolean isFullSet = wornArmor.containsAll(ObjectArrayList.of(
ghostlyArmourItems.GHOSTLY_BOOTS,
ghostlyArmourItems.GHOSTLY_LEGGING,
ghostlyArmourItems.GHOSTLY_CHESTPLATE,
ghostlyArmourItems.GHOSTLY_HELMET));
// Play the animation if the full set is being worn, otherwise stop
return isFullSet ? PlayState.CONTINUE : PlayState.STOP;
}));
}
@Override
public AnimatableInstanceCache getAnimatableInstanceCache() {
return this.cache;
}
}

View File

@@ -13,22 +13,25 @@ import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
public class robesItems {
public class ghostlyArmourItems {
public static final Item ROBES_HELMET = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.HELMET, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item ROBES_CHESTPLATE = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.CHESTPLATE, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item ROBES_LEGGING = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.LEGGINGS, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item ROBES_BOOTS = new ArmorItem(robesMaterial.ROBES, ArmorItem.Type.BOOTS, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item GHOSTLY_HELMET = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.HELMET, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item GHOSTLY_CHESTPLATE = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.CHESTPLATE, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item GHOSTLY_LEGGING = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.LEGGINGS, new FabricItemSettings().rarity(Rarity.EPIC));
public static final Item GHOSTLY_BOOTS = new ghostlyArmour(robesMaterial.ROBES, ArmorItem.Type.BOOTS, new FabricItemSettings().rarity(Rarity.EPIC));
public static void register() {
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_helmet"), ROBES_HELMET);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_chestplate"), ROBES_CHESTPLATE);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_leggings"), ROBES_LEGGING);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "robes_boots"), ROBES_BOOTS);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "ghostly_helmet"), GHOSTLY_HELMET);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "ghostly_chestplate"), GHOSTLY_CHESTPLATE);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "ghostly_leggings"), GHOSTLY_LEGGING);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "ghostly_boots"), GHOSTLY_BOOTS);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_HELMET));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_CHESTPLATE));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_LEGGING));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(ROBES_BOOTS));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(GHOSTLY_HELMET));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(GHOSTLY_CHESTPLATE));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(GHOSTLY_LEGGING));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register((content) -> content.add(GHOSTLY_BOOTS));
}
}

View File

@@ -0,0 +1,127 @@
{
"format_version": "1.8.0",
"animations": {
"walk": {
"loop": "hold_on_last_frame",
"animation_length": 0.25,
"bones": {
"torsoEnd": {
"rotation": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [20, 0, 0],
"easing": "linear"
}
},
"position": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [0, -2, -3],
"easing": "linear"
}
}
},
"bandanaEnd": {
"rotation": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [20, 0, 0],
"easing": "linear"
}
},
"position": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [0, -2, 1],
"easing": "linear"
}
}
}
}
},
"sprint": {
"loop": "hold_on_last_frame",
"animation_length": 0.25,
"bones": {
"bandanaEnd": {
"rotation": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [55, 0, 0],
"easing": "linear"
}
},
"position": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [0, -4, 4],
"easing": "linear"
}
}
},
"torsoEnd": {
"rotation": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [50, 0, 0],
"easing": "linear"
}
},
"position": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"0.25": {
"vector": [0, -6, -5],
"easing": "linear"
}
}
}
}
},
"idle": {
"animation_length": 3,
"bones": {
"bandanaEnd": {
"rotation": {
"0.0": {
"vector": [0, 0, 0],
"easing": "linear"
},
"1.5": {
"vector": [2.5, 0, 0],
"easing": "linear"
},
"3.0": {
"vector": [0, 0, 0],
"easing": "linear"
}
}
}
}
}
},
"geckolib_format_version": 2
}

View File

@@ -0,0 +1,135 @@
{
"format_version": "1.12.0",
"minecraft:geometry": [
{
"description": {
"identifier": "geometry.ghost_armour",
"texture_width": 128,
"texture_height": 128,
"visible_bounds_width": 3,
"visible_bounds_height": 3.5,
"visible_bounds_offset": [0, 1.25, 0]
},
"bones": [
{
"name": "bipedHead",
"pivot": [0, 24, 0]
},
{
"name": "armorHead",
"parent": "bipedHead",
"pivot": [0, 24, 0],
"cubes": [
{"origin": [-5, 24, -5], "size": [10, 9, 10], "uv": [0, 16]},
{"origin": [-4, 24, -4], "size": [8, 8, 8], "uv": [32, 35]}
]
},
{
"name": "bandana",
"parent": "armorHead",
"pivot": [0, 24, 0],
"cubes": [
{"origin": [-6, 23, -6], "size": [12, 4, 12], "uv": [0, 0]}
]
},
{
"name": "bandanaEnd",
"parent": "armorHead",
"pivot": [0, 24, 0],
"cubes": [
{"origin": [-4, 15, 6], "size": [3, 11, 0], "pivot": [-3, 24, 7], "rotation": [7.5, 0, 0], "uv": [72, 0]}
]
},
{
"name": "bipedBody",
"pivot": [0, 24, 0]
},
{
"name": "armorBody",
"parent": "bipedBody",
"pivot": [0, 24, 0]
},
{
"name": "torso",
"parent": "armorBody",
"pivot": [0, 24, 0],
"cubes": [
{"origin": [-4, 12, -3], "size": [8, 12, 6], "uv": [40, 16]}
]
},
{
"name": "torsoEnd",
"parent": "armorBody",
"pivot": [0, 24, 0],
"cubes": [
{"origin": [1, 7, 3], "size": [2, 10, 0], "pivot": [2, 15, 2], "rotation": [5, 0, 0], "uv": [76, 65]}
]
},
{
"name": "bipedRightArm",
"pivot": [-4, 22, 0]
},
{
"name": "armorRightArm",
"parent": "bipedRightArm",
"pivot": [-4, 22, 0],
"cubes": [
{"origin": [-9, 12, -3], "size": [5, 13, 6], "uv": [0, 51]}
]
},
{
"name": "bipedLeftArm",
"pivot": [4, 22, 0]
},
{
"name": "armorLeftArm",
"parent": "bipedLeftArm",
"pivot": [4, 22, 0],
"cubes": [
{"origin": [4, 12, -3], "size": [5, 13, 6], "uv": [22, 51]}
]
},
{
"name": "bipedLeftLeg",
"pivot": [2, 12, 0]
},
{
"name": "armorLeftLeg",
"parent": "bipedLeftLeg",
"pivot": [2, 12, 0],
"cubes": [
{"origin": [0, 4, -3], "size": [5, 9, 6], "uv": [44, 51]}
]
},
{
"name": "armorLeftBoot",
"parent": "bipedLeftLeg",
"pivot": [2, 12, 0],
"cubes": [
{"origin": [0, 0, -3], "size": [5, 4, 6], "uv": [0, 70]}
]
},
{
"name": "bipedRightLeg",
"pivot": [-2, 12, 0]
},
{
"name": "armorRightLeg",
"parent": "bipedRightLeg",
"pivot": [-2, 12, 0],
"cubes": [
{"origin": [-5, 4, -3], "size": [5, 9, 6], "uv": [64, 34]}
]
},
{
"name": "armorRightBoot",
"parent": "bipedRightLeg",
"pivot": [-2, 12, 0],
"cubes": [
{"origin": [-5, 0, -3], "size": [5, 4, 6], "uv": [22, 70]}
]
}
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -24,9 +24,70 @@
},
{
"condition": {
"type": "origins:and",
"conditions":[
{
"type": "origins:brightness",
"comparison": "<=",
"compare_to": 0.17948718
},
{
"inverted": true,
"type": "origins:inventory",
"process_mode": "items",
"slots": [
"armor.head"
],
"item_condition": {
"type": "origins:ingredient",
"ingredient": {
"item": "terraoriginum:ghostly_helmet"
}
}
},
{
"inverted": true,
"type": "origins:inventory",
"process_mode": "items",
"slots": [
"armor.chest"
],
"item_condition": {
"type": "origins:ingredient",
"ingredient": {
"item": "terraoriginum:ghostly_chestplate"
}
}
},
{
"inverted": true,
"type": "origins:inventory",
"process_mode": "items",
"slots": [
"armor.legs"
],
"item_condition": {
"type": "origins:ingredient",
"ingredient": {
"item": "terraoriginum:ghostly_leggings"
}
}
},
{
"inverted": true,
"type": "origins:inventory",
"process_mode": "items",
"slots": [
"armor.feet"
],
"item_condition": {
"type": "origins:ingredient",
"ingredient": {
"item": "terraoriginum:ghostly_boots"
}
}
}
]
},
"action": {
"type": "origins:and",