diff --git a/CHANGELOG b/CHANGELOG index 20df753..305bd6e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,4 +7,6 @@ - Renamed java class "sun_totem" to "sunTotem" to fit convention. - added robes - added the munch -- mobs are now passive to florian \ No newline at end of file +- mobs are now passive to florian +- registered items related to ghostly armour +- added a model for ghostly armour \ No newline at end of file diff --git a/src/main/java/com/smithy/terraoriginum/TerraOriginum.java b/src/main/java/com/smithy/terraoriginum/TerraOriginum.java index 05f213b..359a6e1 100644 --- a/src/main/java/com/smithy/terraoriginum/TerraOriginum.java +++ b/src/main/java/com/smithy/terraoriginum/TerraOriginum.java @@ -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)); diff --git a/src/main/java/com/smithy/terraoriginum/client/TerraOriginumClient.java b/src/main/java/com/smithy/terraoriginum/client/TerraOriginumClient.java new file mode 100644 index 0000000..58764a9 --- /dev/null +++ b/src/main/java/com/smithy/terraoriginum/client/TerraOriginumClient.java @@ -0,0 +1,13 @@ +package com.smithy.terraoriginum.client; + +import net.fabricmc.api.ClientModInitializer; + +public class TerraOriginumClient implements ClientModInitializer { + + + @Override + public void onInitializeClient() { + + + } +} diff --git a/src/main/java/com/smithy/terraoriginum/client/armour/ghostlyArmourModel.java b/src/main/java/com/smithy/terraoriginum/client/armour/ghostlyArmourModel.java new file mode 100644 index 0000000..4953e2a --- /dev/null +++ b/src/main/java/com/smithy/terraoriginum/client/armour/ghostlyArmourModel.java @@ -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 { + + @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; + } +} diff --git a/src/main/java/com/smithy/terraoriginum/client/armour/ghostlyArmourRenderer.java b/src/main/java/com/smithy/terraoriginum/client/armour/ghostlyArmourRenderer.java new file mode 100644 index 0000000..3c0d0cb --- /dev/null +++ b/src/main/java/com/smithy/terraoriginum/client/armour/ghostlyArmourRenderer.java @@ -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 { + + public ghostlyArmourRenderer() { + super(new DefaultedItemGeoModel<>(new Identifier(TerraOriginum.MOD_ID, "armor/ghost_armour"))); + } + +} diff --git a/src/main/java/com/smithy/terraoriginum/items/ghostlyArmour.java b/src/main/java/com/smithy/terraoriginum/items/ghostlyArmour.java new file mode 100644 index 0000000..2253206 --- /dev/null +++ b/src/main/java/com/smithy/terraoriginum/items/ghostlyArmour.java @@ -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 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 consumer) { + consumer.accept(new RenderProvider() { + private GeoArmorRenderer renderer; + + @Override + public BipedEntityModel getHumanoidArmorModel(LivingEntity livingEntity, ItemStack itemStack, EquipmentSlot equipmentSlot, BipedEntityModel 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 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 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; + } +} diff --git a/src/main/java/com/smithy/terraoriginum/items/robesItems.java b/src/main/java/com/smithy/terraoriginum/items/ghostlyArmourItems.java similarity index 50% rename from src/main/java/com/smithy/terraoriginum/items/robesItems.java rename to src/main/java/com/smithy/terraoriginum/items/ghostlyArmourItems.java index abf778b..957ecee 100644 --- a/src/main/java/com/smithy/terraoriginum/items/robesItems.java +++ b/src/main/java/com/smithy/terraoriginum/items/ghostlyArmourItems.java @@ -13,22 +13,25 @@ import net.minecraft.registry.Registry; import net.minecraft.util.Identifier; import net.minecraft.util.Rarity; -public class robesItems { - - 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 class ghostlyArmourItems { + + 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)); } + + + } diff --git a/src/main/resources/assets/terraoriginum/animations/item/armor/ghost_armour.animation.json b/src/main/resources/assets/terraoriginum/animations/item/armor/ghost_armour.animation.json new file mode 100644 index 0000000..1ec2009 --- /dev/null +++ b/src/main/resources/assets/terraoriginum/animations/item/armor/ghost_armour.animation.json @@ -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 +} \ No newline at end of file diff --git a/src/main/resources/assets/terraoriginum/geo/item/armor/ghost_armour.geo.json b/src/main/resources/assets/terraoriginum/geo/item/armor/ghost_armour.geo.json new file mode 100644 index 0000000..6577653 --- /dev/null +++ b/src/main/resources/assets/terraoriginum/geo/item/armor/ghost_armour.geo.json @@ -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]} + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/src/main/resources/assets/terraoriginum/textures/item/armor/ghost_armour.png b/src/main/resources/assets/terraoriginum/textures/item/armor/ghost_armour.png new file mode 100644 index 0000000..b6670a5 Binary files /dev/null and b/src/main/resources/assets/terraoriginum/textures/item/armor/ghost_armour.png differ diff --git a/src/main/resources/data/terraoriginum/powers/spirit-powers/ectodiff.json b/src/main/resources/data/terraoriginum/powers/spirit-powers/ectodiff.json index 3888d37..e24bafd 100644 --- a/src/main/resources/data/terraoriginum/powers/spirit-powers/ectodiff.json +++ b/src/main/resources/data/terraoriginum/powers/spirit-powers/ectodiff.json @@ -24,10 +24,71 @@ }, { "condition": { - "type": "origins:brightness", - "comparison": "<=", - "compare_to": 0.17948718 - }, + "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", "actions": [