changed/removed terra originum shti

This commit is contained in:
2026-02-14 20:01:45 +02:00
parent 185522a308
commit 7dd1c66dcc
306 changed files with 97 additions and 5699 deletions

View File

@@ -0,0 +1,23 @@
package com.smithy.faithful;
import net.fabricmc.api.ModInitializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.smithy.faithful.items.*;
import com.smithy.faithful.registry.ModPowers;
public class Faithful implements ModInitializer {
public static final String MOD_ID = "faithful";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
@Override
public void onInitialize() {
IconItems.register();
ModPowers.register();
LOGGER.info("man this Origins is " + MOD_ID);
}
}

View File

@@ -1,8 +1,8 @@
package com.smithy.terraoriginum.client;
package com.smithy.faithful.client;
import net.fabricmc.api.ClientModInitializer;
public class TerraOriginumClient implements ClientModInitializer {
public class FaithfulOriginsClient implements ClientModInitializer {
@Override

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.client;
package com.smithy.faithful.client;
import io.github.apace100.apoli.ApoliClient;
import net.fabricmc.api.ClientModInitializer;

View File

@@ -1,6 +1,7 @@
package com.smithy.terraoriginum.items;
package com.smithy.faithful.items;
import com.smithy.faithful.Faithful;
import com.smithy.terraoriginum.TerraOriginum;
import net.minecraft.item.Item;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
@@ -14,9 +15,9 @@ public class IconItems {
public static final Item TINY = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC));
public static void register() {
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "mync_eye"), MYNC_EYE);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "spirit"), SPIRIT);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "tiny"), TINY);
Registry.register(Registries.ITEM, new Identifier(Faithful.MOD_ID, "mync_eye"), MYNC_EYE);
Registry.register(Registries.ITEM, new Identifier(Faithful.MOD_ID, "spirit"), SPIRIT);
Registry.register(Registries.ITEM, new Identifier(Faithful.MOD_ID, "tiny"), TINY);
}
}

View File

@@ -0,0 +1,27 @@
package com.smithy.faithful.mixin;
import io.github.apace100.apoli.component.PowerHolderComponent;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.smithy.faithful.power.PreventBlockSlowness;
@Mixin(Entity.class)
public abstract class EntityMixin {
@Inject(method = "slowMovement", at = @At("HEAD"), cancellable = true)
private void terraoriginum$preventBlockSlowness(BlockState state, Vec3d multiplier, CallbackInfo ci) {
for (PreventBlockSlowness power : PowerHolderComponent.getPowers((Entity) (Object) this, PreventBlockSlowness.class)) {
if (power.isActive()) {
ci.cancel();
return;
}
}
}
}

View File

@@ -1,9 +1,10 @@
package com.smithy.terraoriginum.mixin;
package com.smithy.faithful.mixin;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.smithy.terraoriginum.power.WingsPower;
import com.smithy.faithful.power.WingsPower;
import dev.cammiescorner.icarus.api.IcarusPlayerValues;
import dev.cammiescorner.icarus.util.IcarusHelper;
import io.github.apace100.apoli.component.PowerHolderComponent;

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.mixin;
package com.smithy.faithful.mixin;
import io.github.apace100.apoli.component.PowerHolderComponent;
import net.minecraft.block.PowderSnowBlock;
@@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import com.smithy.terraoriginum.power.CanStandOnPowderSnow;
import com.smithy.faithful.power.CanStandOnPowderSnow;
@Mixin(PowderSnowBlock.class)
public class PowderSnowBlockMixin {

View File

@@ -1,7 +1,8 @@
package com.smithy.terraoriginum.mixin.client;
package com.smithy.faithful.mixin.client;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.smithy.terraoriginum.power.WingsPower;
import com.smithy.faithful.power.WingsPower;
import dev.cammiescorner.icarus.client.IcarusClient;
import io.github.apace100.apoli.component.PowerHolderComponent;
import net.minecraft.entity.LivingEntity;

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.power;
package com.smithy.faithful.power;
import io.github.apace100.apoli.power.Power;
import io.github.apace100.apoli.power.PowerType;

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.power;
package com.smithy.faithful.power;
import io.github.apace100.apoli.power.Power;
import io.github.apace100.apoli.power.PowerType;

View File

@@ -1,8 +1,4 @@
package com.smithy.terraoriginum.power;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.util.CustomDataTypes;
import com.smithy.terraoriginum.util.OptionalBool;
package com.smithy.faithful.power;
import dev.cammiescorner.icarus.api.IcarusPlayerValues;
import dev.cammiescorner.icarus.util.ServerPlayerFallbackValues;
@@ -17,9 +13,13 @@ import net.minecraft.item.ItemStack;
import java.util.OptionalDouble;
import java.util.OptionalInt;
import com.smithy.faithful.Faithful;
import com.smithy.faithful.util.CustomDataTypes;
import com.smithy.faithful.util.OptionalBool;
public class WingsPower extends Power implements IcarusPlayerValues {
public static final Identifier POWER_TYPE_ID = new Identifier(TerraOriginum.MOD_ID, "wings");
public static final Identifier POWER_TYPE_ID = new Identifier(Faithful.MOD_ID, "wings");
private final ItemStack wingsType;
private final OptionalBool armorSlows;

View File

@@ -1,9 +1,9 @@
package com.smithy.terraoriginum.registry;
package com.smithy.faithful.registry;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.power.CanStandOnPowderSnow;
import com.smithy.terraoriginum.power.PreventBlockSlowness;
import com.smithy.terraoriginum.power.WingsPower;
import com.smithy.faithful.Faithful;
import com.smithy.faithful.power.CanStandOnPowderSnow;
import com.smithy.faithful.power.PreventBlockSlowness;
import com.smithy.faithful.power.WingsPower;
import io.github.apace100.apoli.power.factory.PowerFactory;
import io.github.apace100.apoli.registry.ApoliRegistries;
@@ -13,8 +13,8 @@ import net.minecraft.util.Identifier;
public class ModPowers {
public static final PowerFactory<?> CAN_WALK_ON_POWDER_SNOW = new PowerFactory<>( new Identifier(TerraOriginum.MOD_ID, "can_walk_on_powder_snow"), new SerializableData(), data -> (type, entity) -> new CanStandOnPowderSnow(type, entity)).allowCondition();
public static final PowerFactory<?> PREVENT_BLOCK_SLOWNESS = new PowerFactory<>(new Identifier(TerraOriginum.MOD_ID, "prevent_block_slowness"), new SerializableData(), data -> (type, entity) -> new PreventBlockSlowness(type, entity)).allowCondition();
public static final PowerFactory<?> CAN_WALK_ON_POWDER_SNOW = new PowerFactory<>( new Identifier(Faithful.MOD_ID, "can_walk_on_powder_snow"), new SerializableData(), data -> (type, entity) -> new CanStandOnPowderSnow(type, entity)).allowCondition();
public static final PowerFactory<?> PREVENT_BLOCK_SLOWNESS = new PowerFactory<>(new Identifier(Faithful.MOD_ID, "prevent_block_slowness"), new SerializableData(), data -> (type, entity) -> new PreventBlockSlowness(type, entity)).allowCondition();
public static final PowerFactory<?> WINGS_POWER = WingsPower.createFactory().allowCondition();

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.util;
package com.smithy.faithful.util;
import com.mojang.datafixers.util.Either;
import com.mojang.serialization.Codec;

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.util;
package com.smithy.faithful.util;
import com.google.gson.JsonParseException;
import com.mojang.serialization.JsonOps;
import io.github.apace100.calio.data.SerializableDataType;

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.util;
package com.smithy.faithful.util;
import com.mojang.serialization.Codec;
import com.mojang.serialization.MapCodec;

View File

@@ -1,4 +1,4 @@
package com.smithy.terraoriginum.util;
package com.smithy.faithful.util;
import net.minecraft.entity.Entity;

View File

@@ -1,45 +0,0 @@
package com.smithy.terraoriginum;
import com.smithy.terraoriginum.blocks.CottonCropBlock;
import com.smithy.terraoriginum.blocks.Crucifix;
import com.smithy.terraoriginum.items.*;
import com.smithy.terraoriginum.registry.ModEnchantments;
import com.smithy.terraoriginum.registry.ModPowers;
import com.smithy.terraoriginum.util.LootTableModifiers;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
// import net.minecraft.item.ItemGroups;
import net.minecraft.item.ItemGroups;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class TerraOriginum implements ModInitializer {
public static final String MOD_ID = "terraoriginum";
public static final Logger LOGGER = LogManager.getLogger(MOD_ID);
@Override
public void onInitialize() {
Umbrella.registerItems();
IconItems.register();
ModEnchantments.register();
Crucifix.register();
CottonCropBlock.register();
CottonItems.register();
SunTotem.register();
GhostlyItems.register();
GhostlyArmourItems.register();
ModPowers.register();
LootTableModifiers.modifyLootTables();
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(Umbrella.UMBRELLA));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.TOOLS).register((content) -> content.add(SunTotem.SUN_TOTEM));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.FUNCTIONAL).register((content) -> content.add(Crucifix.CRUCIFIX));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.NATURAL).register((content) -> content.add(CottonItems.COTTON_SEEDS));
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((content) -> content.add(CottonItems.COTTON_BALL));
LOGGER.info("man this Origins is " + MOD_ID);
}
}

View File

@@ -1,49 +0,0 @@
package com.smithy.terraoriginum.blocks;
import com.smithy.terraoriginum.items.CottonItems;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CropBlock;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemConvertible;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.BlockView;
public class CottonCropBlock extends CropBlock{
private static final VoxelShape[] AGE_TO_SHAPE = new VoxelShape[]{Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 2.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 3.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 4.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 5.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 6.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 7.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 8.0D, 16.0D),
Block.createCuboidShape(0.0D, 0.0D, 0.0D, 16.0D, 9.0D, 16.0D)
};
public CottonCropBlock(AbstractBlock.Settings settings) {
super(settings);
}
public ItemConvertible getSeedsItem() {
return CottonItems.COTTON_SEEDS;
}
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context) {
return AGE_TO_SHAPE[(Integer)state.get(this.getAgeProperty())];
}
public static final CropBlock COTTON_CROP_BLOCK = new CropBlock(AbstractBlock.Settings.create().nonOpaque().noCollision().ticksRandomly().breakInstantly().sounds(BlockSoundGroup.CROP));
public static void register() {
Registry.register(Registries.BLOCK, new Identifier("terraoriginum", "cotton_crop_block"), COTTON_CROP_BLOCK);
}
}

View File

@@ -1,22 +0,0 @@
package com.smithy.terraoriginum.blocks;
import com.smithy.terraoriginum.TerraOriginum;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class Crucifix {
public static final Block CRUCIFIX = new CrucifixClass(FabricBlockSettings.create().strength(5.5f, 4.8f).requiresTool());
public static void register() {
// Registry.register(Registries.BLOCK, new Identifier(TerraOriginum.MOD_ID, "crucifix"), new BlockItem(CRUCIFIX, new FabricItemSettings()));
// Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "crucifix"), CRUCIFIX);
Registry.register(Registries.BLOCK, new Identifier(TerraOriginum.MOD_ID, "crucifix"), CRUCIFIX);
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "crucifix"), new BlockItem(CRUCIFIX, new Item.Settings()));
}
}

View File

@@ -1,28 +0,0 @@
package com.smithy.terraoriginum.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
public class CrucifixClass extends Block {
public CrucifixClass(Settings properties) {
super(properties);
}
@Override
public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos, ShapeContext context) {
VoxelShape shape = VoxelShapes.empty();
shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.375, 0, 0.375, 0.5625, 0.75, 0.5625));
shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.5625, 0.375, 0.375, 0.75, 0.5625, 0.5625));
shape = VoxelShapes.union(shape, VoxelShapes.cuboid(0.1875, 0.375, 0.375, 0.375, 0.5625, 0.5625));
return shape;
}
}

View File

@@ -1,17 +0,0 @@
package com.smithy.terraoriginum.client;
import com.smithy.terraoriginum.blocks.CottonCropBlock;
import com.smithy.terraoriginum.items.Umbrella;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.client.render.RenderLayer;
public class LayerRenderer implements ClientModInitializer {
@Override
public void onInitializeClient() {
Umbrella.registerRenderLayers();
BlockRenderLayerMap.INSTANCE.putBlocks(RenderLayer.getCutout(), CottonCropBlock.COTTON_CROP_BLOCK);
}
}

View File

@@ -1,23 +0,0 @@
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

@@ -1,16 +0,0 @@
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

@@ -1,89 +0,0 @@
package com.smithy.terraoriginum.customMaterials;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.ArmorMaterial;
import net.minecraft.recipe.Ingredient;
import net.minecraft.sound.SoundEvent;
import net.minecraft.sound.SoundEvents;
import java.util.function.Supplier;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.items.CottonItems;
public enum RobesMaterial implements ArmorMaterial {
ROBES("robes", 42, new int[] { 4, 9, 7, 4 }, 19,
SoundEvents.ITEM_ARMOR_EQUIP_NETHERITE, 5, 0.1f, () -> Ingredient.ofItems(CottonItems.COTTON_BALL));
private final String name;
private final int durabilityMultiplier;
private final int[] protectionAmounts;
private final int enchantability;
private final SoundEvent equipSound;
private final float toughness;
private final float knockbackResistance;
private final Supplier<Ingredient> repairIngredient;
private static final int[] BASE_DURABILITY = { 11, 16, 15, 13 };
RobesMaterial(
String name,
int durabilityMultiplier,
int[] protectionAmounts,
int enchantability,
SoundEvent equipSound,
float toughness,
float knockbackResistance,
Supplier<Ingredient> repairIngredient
) {
this.name = name;
this.durabilityMultiplier = durabilityMultiplier;
this.protectionAmounts = protectionAmounts;
this.enchantability = enchantability;
this.equipSound = equipSound;
this.toughness = toughness;
this.knockbackResistance = knockbackResistance;
this.repairIngredient = repairIngredient;
}
@Override
public int getDurability(ArmorItem.Type type) {
return BASE_DURABILITY[type.ordinal()] * this.durabilityMultiplier;
}
@Override
public int getProtection(ArmorItem.Type type) {
return protectionAmounts[type.ordinal()];
}
@Override
public int getEnchantability() {
return this.enchantability;
}
@Override
public SoundEvent getEquipSound() {
return this.equipSound;
}
@Override
public Ingredient getRepairIngredient() {
return this.repairIngredient.get();
}
@Override
public String getName() {
return TerraOriginum.MOD_ID + ":" + this.name;
}
@Override
public float getToughness() {
return this.toughness;
}
@Override
public float getKnockbackResistance() {
return this.knockbackResistance;
}
}

View File

@@ -1,39 +0,0 @@
package com.smithy.terraoriginum.enchantment;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.enchantment.ProtectionEnchantment;
import net.minecraft.entity.EquipmentSlot;
public class LightProtectionEnchantment extends Enchantment{
public LightProtectionEnchantment(Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes) {
super(weight, type, slotTypes);
}
public int getMinPower(int level) {
return 8 + level * 5;
}
public int getMaxPower(int level) {
return this.getMinPower(level) + 8;
}
public boolean isTreasure() {
return true;
}
public int getMaxLevel() {
return 1;
}
@Override
protected boolean canAccept(Enchantment other) {
if(other == this || ((other instanceof ProtectionEnchantment && !(((ProtectionEnchantment)other).protectionType == ProtectionEnchantment.Type.ALL)))) {
return false;
}
return super.canAccept(other);
}
}

View File

@@ -1,39 +0,0 @@
package com.smithy.terraoriginum.enchantment;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.enchantment.ProtectionEnchantment;
import net.minecraft.entity.EquipmentSlot;
public class SunProtectionEnchantment extends Enchantment {
public SunProtectionEnchantment(Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes) {
super(weight, type, slotTypes);
}
public int getMinPower(int level) {
return 8 + level * 5;
}
public int getMaxPower(int level) {
return this.getMinPower(level) + 8;
}
public boolean isTreasure() {
return true;
}
public int getMaxLevel() {
return 4;
}
@Override
protected boolean canAccept(Enchantment other) {
if(other == this || ((other instanceof ProtectionEnchantment && !(((ProtectionEnchantment)other).protectionType == ProtectionEnchantment.Type.ALL)))) {
return true; // true because its somehow incompatible with every other protection, except protection
}
return super.canAccept(other);
}
}

View File

@@ -1,19 +0,0 @@
package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.blocks.CottonCropBlock;
import net.minecraft.item.AliasedBlockItem;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class CottonItems {
public static final Item COTTON_SEEDS = new AliasedBlockItem(CottonCropBlock.COTTON_CROP_BLOCK, new Item.Settings());
public static final Item COTTON_BALL = new Item(new Item.Settings());
public static void register() {
Registry.register(Registries.ITEM, new Identifier("terraoriginum", "cotton_seeds"), COTTON_SEEDS);
Registry.register(Registries.ITEM, new Identifier("terraoriginum", "cotton_ball"), COTTON_BALL);
}
}

View File

@@ -1,108 +0,0 @@
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

@@ -1,37 +0,0 @@
package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.customMaterials.RobesMaterial;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.ArmorItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
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, "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(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

@@ -1,24 +0,0 @@
package com.smithy.terraoriginum.items;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroups;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
public class GhostlyItems {
public static final Item GHOSTLY_CLOTH = new Item(new FabricItemSettings());
public static void register() {
Registry.register(Registries.ITEM, new Identifier("terraoriginum", "ghostly_cloth"), GHOSTLY_CLOTH);
ItemGroupEvents.modifyEntriesEvent(ItemGroups.INGREDIENTS).register((content) -> content.add(GHOSTLY_CLOTH));
}
}

View File

@@ -1,17 +0,0 @@
package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.TerraOriginum;
import net.minecraft.item.Item;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;
public class SunTotem {
public static final Item SUN_TOTEM = new Item(new Item.Settings().maxCount(1).rarity(Rarity.EPIC));
public static void register() {
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "sun_totem"), SUN_TOTEM);
}
}

View File

@@ -1,26 +0,0 @@
package com.smithy.terraoriginum.items;
import com.smithy.terraoriginum.TerraOriginum;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.item.DyeableItem;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
public class Umbrella {
public static final UmbrellaDyeTest UMBRELLA = new UmbrellaDyeTest(new FabricItemSettings().maxCount(1).maxDamage(1200));
public static void registerItems() {
Registry.register(Registries.ITEM, new Identifier(TerraOriginum.MOD_ID, "umbrella"), UMBRELLA);
}
@Environment(EnvType.CLIENT)
public static void registerRenderLayers() {
ColorProviderRegistry.ITEM.register((stack, tintIndex) -> (tintIndex > 0) ? -1 : ((DyeableItem) stack.getItem()).getColor(stack), UMBRELLA);
}
}

View File

@@ -1,12 +0,0 @@
package com.smithy.terraoriginum.items;
import net.minecraft.item.DyeableItem;
import net.minecraft.item.Item;
public class UmbrellaDyeTest extends Item implements DyeableItem {
public UmbrellaDyeTest(Settings settings) {
super(settings);
}
}

View File

@@ -1,52 +0,0 @@
package com.smithy.terraoriginum.mixin;
import com.smithy.terraoriginum.items.Umbrella;
import com.smithy.terraoriginum.power.PreventBlockSlowness;
import io.github.apace100.apoli.component.PowerHolderComponent;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Entity.class)
public abstract class EntityMixin {
@Shadow World world;
@Shadow abstract BlockPos getBlockPos();
@Shadow abstract Box getBoundingBox();
@Shadow abstract Iterable<ItemStack> getHandItems();
@Inject(method = "isBeingRainedOn", at = @At("HEAD"), cancellable = true)
private void isBeingRainedOn(CallbackInfoReturnable<Boolean> cir) {
Iterable<ItemStack> hands = this.getHandItems();
for (ItemStack stack : hands) {
if (stack.getItem() == Umbrella.UMBRELLA)
cir.setReturnValue(false);
}
}
@Inject(method = "slowMovement", at = @At("HEAD"), cancellable = true)
private void terraoriginum$preventBlockSlowness(BlockState state, Vec3d multiplier, CallbackInfo ci) {
for (PreventBlockSlowness power : PowerHolderComponent.getPowers((Entity) (Object) this, PreventBlockSlowness.class)) {
if (power.isActive()) {
ci.cancel();
return;
}
}
}
}

View File

@@ -1,35 +0,0 @@
package com.smithy.terraoriginum.mixin;
import io.github.apace100.apoli.power.factory.condition.EntityConditions;
import io.github.apace100.calio.data.SerializableData;
import com.smithy.terraoriginum.items.Umbrella;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(EntityConditions.class)
public class PlayerConditionsMixin {
@Inject(method = { "lambda$register$10" }, at = { @At("HEAD") }, cancellable = true)
private static void sunDamagePrevention(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) {
for (ItemStack stack : player.getHandItems()) {
if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) {
cir.setReturnValue(false);
}
}
}
@Inject(method = { "lambda$register$11" }, at = { @At("HEAD") }, cancellable = true)
private static void umbrellaRainedOn(SerializableData.Instance data, Entity player, CallbackInfoReturnable<Boolean> cir) {
for (ItemStack stack : player.getHandItems()) {
if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) {
cir.setReturnValue(false);
}
}
}
}

View File

@@ -1,73 +0,0 @@
package com.smithy.terraoriginum.mixin;
import io.github.apace100.apoli.mixin.EntityAccessor;
import com.smithy.terraoriginum.items.Umbrella;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(PlayerEntity.class)
public abstract class PlayerEntityMixin extends Entity {
@Shadow
public abstract ItemStack getEquippedStack(EquipmentSlot slot);
@Shadow
public abstract Iterable<ItemStack> getHandItems();
@Shadow
public abstract PlayerInventory getInventory();
protected PlayerEntityMixin(EntityType<? extends LivingEntity> entityType, World world) {
super(entityType, world);
}
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
private void tick(CallbackInfo ci) {
boolean isBeingRainedOn = ((EntityAccessor) this).callIsBeingRainedOn();
if (isBeingRainedOn && this.age % 10 == 0) {
for (ItemStack stack : this.getHandItems()) {
if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.getDamage() < stack.getMaxDamage() - 1) {
// Set damage instead of calling stack.damage, otherwise an animation is
// triggered for each damage tick.
stack.setDamage(stack.getDamage() + 1);
}
}
} else if (!isBeingRainedOn && this.age % 20 == 0) {
ItemStack offHand = this.getEquippedStack(EquipmentSlot.OFFHAND);
boolean isHot = getWorld().getBiome(this.getBlockPos()).value().isCold(this.getBlockPos());
// Repair off-hand umbrella.
this.repairStack(offHand, isHot, true);
// Repair any umbrellas in the player's inventory.
for (int i = 0; i < 36; i++) {
this.repairStack(this.getInventory().getStack(i), isHot, this.getInventory().selectedSlot == i);
}
}
}
private void repairStack(ItemStack stack, boolean isHot, boolean isExposed) {
if (stack.getItem().equals(Umbrella.UMBRELLA) && stack.isDamaged()) {
stack.setDamage(stack.getDamage() - 1);
if (isHot) {
// Umbrellas dry faster in hot climates.
stack.setDamage(stack.getDamage() - 1);
}
if (isExposed) {
// Umbrellas dry faster if they're exposed (not tucked away in inventory).
stack.setDamage(stack.getDamage() - 1);
}
}
}
}

View File

@@ -1,27 +0,0 @@
package com.smithy.terraoriginum.registry;
import com.smithy.terraoriginum.TerraOriginum;
import com.smithy.terraoriginum.enchantment.LightProtectionEnchantment;
import com.smithy.terraoriginum.enchantment.SunProtectionEnchantment;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentTarget;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.registry.Registries;
import net.minecraft.util.Identifier;
import net.minecraft.registry.Registry;
public class ModEnchantments {
public static final Enchantment SUN_PROTECTION = new SunProtectionEnchantment(Enchantment.Rarity.RARE, EnchantmentTarget.ARMOR, new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET});
public static final Enchantment LIGHT_PROTECTION = new LightProtectionEnchantment(Enchantment.Rarity.RARE, EnchantmentTarget.ARMOR_CHEST, new EquipmentSlot[]{EquipmentSlot.CHEST});
public static void register() {
register("sun_protection", SUN_PROTECTION);
register("light_protection", LIGHT_PROTECTION);
}
private static Enchantment register(String path, Enchantment enchantment) {
Registry.register(Registries.ENCHANTMENT, new Identifier(TerraOriginum.MOD_ID, path), enchantment);
return enchantment;
}
}

View File

@@ -1,30 +0,0 @@
package com.smithy.terraoriginum.util;
import com.smithy.terraoriginum.items.CottonItems;
import net.fabricmc.fabric.api.loot.v2.LootTableEvents;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.condition.RandomChanceLootCondition;
import net.minecraft.loot.entry.ItemEntry;
import net.minecraft.loot.function.SetCountLootFunction;
import net.minecraft.loot.provider.number.ConstantLootNumberProvider;
import net.minecraft.loot.provider.number.UniformLootNumberProvider;
import net.minecraft.util.Identifier;
public class LootTableModifiers {
private static final Identifier GRASS_ID =
new Identifier("minecraft", "blocks/grass");
public static void modifyLootTables() {
LootTableEvents.MODIFY.register((resourceManager, lootManager, id, tableBuilder, source) -> {
if(GRASS_ID.equals(id)) {
LootPool.Builder poolBuilder = LootPool.builder()
.rolls(ConstantLootNumberProvider.create(1))
.conditionally(RandomChanceLootCondition.builder(0.08f))
.with(ItemEntry.builder(CottonItems.COTTON_SEEDS))
.apply(SetCountLootFunction.builder(UniformLootNumberProvider.create(1.0f, 1.0f)).build());
tableBuilder.pool(poolBuilder.build());
}
});
}
}