diff --git a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java index b76efaef..d4da7abe 100644 --- a/src/main/java/com/minelittlepony/unicopia/client/URenderers.java +++ b/src/main/java/com/minelittlepony/unicopia/client/URenderers.java @@ -105,6 +105,12 @@ public interface URenderers { matrices.push(); }); + PolearmRenderer.register(UItems.WOODEN_POLEARM); + PolearmRenderer.register(UItems.STONE_POLEARM); + PolearmRenderer.register(UItems.IRON_POLEARM); + PolearmRenderer.register(UItems.GOLDEN_POLEARM); + PolearmRenderer.register(UItems.DIAMOND_POLEARM); + PolearmRenderer.register(UItems.NETHERITE_POLEARM); ModelPredicateProviderRegistry.register(UItems.GEMSTONE, new Identifier("affinity"), (stack, world, entity, seed) -> { return GemstoneItem.isEnchanted(stack) ? 1 + GemstoneItem.getSpellKey(stack).getAffinity().ordinal() : 0; }); diff --git a/src/main/java/com/minelittlepony/unicopia/client/render/PolearmRenderer.java b/src/main/java/com/minelittlepony/unicopia/client/render/PolearmRenderer.java new file mode 100644 index 00000000..04170d03 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/client/render/PolearmRenderer.java @@ -0,0 +1,82 @@ +package com.minelittlepony.unicopia.client.render; + +import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry; +import net.fabricmc.fabric.api.client.rendering.v1.BuiltinItemRendererRegistry.DynamicItemRenderer; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.item.ModelPredicateProviderRegistry; +import net.minecraft.client.item.UnclampedModelPredicateProvider; +import net.minecraft.client.model.*; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.VertexConsumerProvider; +import net.minecraft.client.render.entity.model.TridentEntityModel; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.client.render.model.BakedModel; +import net.minecraft.client.render.model.json.ModelTransformation.Mode; +import net.minecraft.client.util.ModelIdentifier; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.entity.LivingEntity; +import net.minecraft.item.*; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; + +public class PolearmRenderer implements DynamicItemRenderer, UnclampedModelPredicateProvider { + + private static final PolearmRenderer INSTANCE = new PolearmRenderer(); + private static final Identifier THROWING = new Identifier("throwing"); + + private final TridentEntityModel model = new TridentEntityModel(getTexturedModelData().createModel()); + + public static void register(Item item) { + BuiltinItemRendererRegistry.INSTANCE.register(item, INSTANCE); + ModelPredicateProviderRegistry.register(item, THROWING, INSTANCE); + ModelLoadingRegistry.INSTANCE.registerModelProvider((renderer, out) -> out.accept(getModelId(item))); + } + + static ModelIdentifier getModelId(ItemConvertible item) { + Identifier id = Registry.ITEM.getId(item.asItem()); + return new ModelIdentifier(id.toString() + "_in_inventory#inventory"); + } + + public static TexturedModelData getTexturedModelData() { + ModelData data = new ModelData(); + ModelPartData root = data.getRoot(); + + int y = -9; + + ModelPartData pole = root.addChild("pole", ModelPartBuilder.create().uv(0, 6).cuboid(-0.5f, y, -0.5f, 1, 25, 1), ModelTransform.NONE); + pole.addChild("base", ModelPartBuilder.create().uv(4, 0).cuboid(-1.5f, y - 2, -0.5f, 3, 2, 1), ModelTransform.NONE); + pole.addChild("head", ModelPartBuilder.create().uv(0, 0).cuboid(-0.5f, y - 6, -0.5f, 1, 4, 1), ModelTransform.NONE); + return TexturedModelData.of(data, 32, 32); + } + + @Override + public void render(ItemStack stack, Mode mode, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay) { + + if (mode == Mode.GUI || mode == Mode.GROUND || mode == Mode.FIXED) { + // render as normal sprite + ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer(); + + BakedModel model = renderer.getModels().getModelManager().getModel(getModelId(stack.getItem())); + matrices.pop(); + matrices.push(); + renderer.renderItem(stack, mode, false, matrices, vertexConsumers, light, overlay, model); + matrices.pop(); + matrices.push(); + } else { + matrices.push(); + matrices.scale(1, -1, -1); + Identifier id = Registry.ITEM.getId(stack.getItem()); + Identifier texture = new Identifier(id.getNamespace(), "textures/entity/polearm/" + id.getPath() + ".png"); + VertexConsumer vertexConsumer2 = ItemRenderer.getDirectItemGlintConsumer(vertexConsumers, model.getLayer(texture), false, stack.hasGlint()); + model.render(matrices, vertexConsumer2, light, overlay, 1, 1, 1, 1); + matrices.pop(); + } + } + + @Override + public float unclampedCall(ItemStack stack, ClientWorld world, LivingEntity entity, int seed) { + return entity != null && entity.isUsingItem() && entity.getActiveItem() == stack ? 1 : 0; + } +} diff --git a/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java b/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java index 0378b4f2..6fb66d94 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/UEntityAttributes.java @@ -16,7 +16,6 @@ public interface UEntityAttributes { EntityAttribute EXTRA_MINING_SPEED = register("earth.mining_speed", new ClampedEntityAttribute("player.miningSpeed", 1, 0, 5).setTracked(true)); EntityAttribute ENTITY_GRAVTY_MODIFIER = register("player.gravity", (new EntityAttribute("player.gravityModifier", 1) {}).setTracked(true)); - private static EntityAttribute register(String name, EntityAttribute attribute) { REGISTRY.add(attribute); return Registry.register(Registry.ATTRIBUTE, Unicopia.id(name), attribute); diff --git a/src/main/java/com/minelittlepony/unicopia/item/PolearmItem.java b/src/main/java/com/minelittlepony/unicopia/item/PolearmItem.java new file mode 100644 index 00000000..bfd9c334 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/item/PolearmItem.java @@ -0,0 +1,36 @@ +package com.minelittlepony.unicopia.item; + +import java.util.UUID; + +import com.google.common.collect.ImmutableMultimap; +import com.google.common.collect.Multimap; +import com.minelittlepony.unicopia.entity.UEntityAttributes; + +import net.minecraft.entity.EquipmentSlot; +import net.minecraft.entity.attribute.*; +import net.minecraft.item.*; + +public class PolearmItem extends SwordItem { + protected static final UUID ATTACK_RANGE_MODIFIER_ID = UUID.fromString("A7B3659C-AA74-469C-963A-09A391DCAA0F"); + + private final Multimap attributeModifiers; + + private final int attackRange; + + public PolearmItem(ToolMaterial material, int damage, float speed, int range, Settings settings) { + super(material, damage, speed, settings); + this.attackRange = range; + ImmutableMultimap.Builder builder = ImmutableMultimap.builder(); + builder.putAll(super.getAttributeModifiers(EquipmentSlot.MAINHAND)); + builder.put(UEntityAttributes.EXTENDED_REACH_DISTANCE, new EntityAttributeModifier(ATTACK_RANGE_MODIFIER_ID, "Weapon modifier", attackRange, EntityAttributeModifier.Operation.ADDITION)); + attributeModifiers = builder.build(); + } + + @Override + public Multimap getAttributeModifiers(EquipmentSlot slot) { + if (slot == EquipmentSlot.MAINHAND) { + return attributeModifiers; + } + return super.getAttributeModifiers(slot); + } +} diff --git a/src/main/java/com/minelittlepony/unicopia/item/UItems.java b/src/main/java/com/minelittlepony/unicopia/item/UItems.java index 32437ec4..a7486180 100644 --- a/src/main/java/com/minelittlepony/unicopia/item/UItems.java +++ b/src/main/java/com/minelittlepony/unicopia/item/UItems.java @@ -9,15 +9,10 @@ import com.minelittlepony.unicopia.entity.UEntities; import com.minelittlepony.unicopia.item.enchantment.UEnchantments; import com.minelittlepony.unicopia.item.toxin.UFoodComponents; -import net.minecraft.item.Item; +import net.minecraft.item.*; import net.minecraft.item.Item.Settings; -import net.minecraft.item.ItemGroup; -import net.minecraft.item.Items; import net.fabricmc.fabric.api.item.v1.FabricItemSettings; -import net.minecraft.item.BlockItem; -import net.minecraft.item.FoodComponents; -import net.minecraft.item.MusicDiscItem; -import net.minecraft.item.SpawnEggItem; +import net.fabricmc.fabric.api.registry.FuelRegistry; import net.minecraft.sound.SoundEvent; import net.minecraft.util.Rarity; import net.minecraft.util.registry.Registry; @@ -83,6 +78,13 @@ public interface UItems { Item DRAGON_BREATH_SCROLL = register("dragon_breath_scroll", new DragonBreathScrollItem(new Item.Settings().rarity(Rarity.UNCOMMON).group(ItemGroup.TOOLS))); + Item WOODEN_POLEARM = register("wooden_polearm", new PolearmItem(ToolMaterials.WOOD, 3, -2.4F, 2, new Item.Settings().group(ItemGroup.COMBAT))); + Item STONE_POLEARM = register("stone_polearm", new PolearmItem(ToolMaterials.STONE, 3, -2.4F, 2, new Item.Settings().group(ItemGroup.COMBAT))); + Item IRON_POLEARM = register("iron_polearm", new PolearmItem(ToolMaterials.IRON, 3, -2.4F, 3, new Item.Settings().group(ItemGroup.COMBAT))); + Item GOLDEN_POLEARM = register("golden_polearm", new PolearmItem(ToolMaterials.GOLD, 3, -2.4F, 4, new Item.Settings().group(ItemGroup.COMBAT))); + Item DIAMOND_POLEARM = register("diamond_polearm", new PolearmItem(ToolMaterials.DIAMOND, 3, -2.4F, 5, new Item.Settings().group(ItemGroup.COMBAT))); + Item NETHERITE_POLEARM = register("netherite_polearm", new PolearmItem(ToolMaterials.NETHERITE, 3, -2.4F, 5, new Item.Settings().group(ItemGroup.COMBAT).fireproof())); + Item BUTTERFLY_SPAWN_EGG = register("butterfly_spawn_egg", new SpawnEggItem(UEntities.BUTTERFLY, 0x222200, 0xaaeeff, new Item.Settings().group(ItemGroup.MISC))); Item BUTTERFLY = register("butterfly", new Item(new Item.Settings().group(ItemGroup.FOOD).food(UFoodComponents.INSECTS))); diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinReachDistanceFix.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinReachDistanceFix.java new file mode 100644 index 00000000..a66b8035 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinReachDistanceFix.java @@ -0,0 +1,49 @@ +package com.minelittlepony.unicopia.mixin; + +import org.objectweb.asm.Opcodes; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.injection.*; +import com.minelittlepony.unicopia.entity.player.Pony; + +import net.minecraft.server.network.*; + +@Mixin(value = { + ServerPlayerInteractionManager.class, + ServerPlayNetworkHandler.class +}) +abstract class MixinReachDistanceFix { + + @Accessor + public abstract ServerPlayerEntity getPlayer(); + + @Redirect( + method = { + "processBlockBreakingAction", + "onPlayerInteractBlock", + "onPlayerInteractEntity" + }, + at = @At( + value = "FIELD", + target = "net/minecraft/server/network/ServerPlayNetworkHandler.MAX_BREAK_SQUARED_DISTANCE:D", + opcode = Opcodes.GETSTATIC + ) + ) + private double getMaxBreakSquaredDistance() { + double reach = 6 + Pony.of(getPlayer()).getExtendedReach(); + return reach * reach; + } +/* + @ModifyConstant( + method = { + "processBlockBreakingAction", + "onPlayerInteractBlock", + "onPlayerInteractEntity" + }, + constant = @Constant(doubleValue = 36D) + ) + private double modifyMaxBreakSquaredDistance(double initial) { + double reach = 6 + Pony.of(getPlayer()).getExtendedReach(); + return reach * reach; + }*/ +} diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayNetworkHandler.java b/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayNetworkHandler.java index a07cb481..2c567e7f 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayNetworkHandler.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/MixinServerPlayNetworkHandler.java @@ -2,8 +2,7 @@ package com.minelittlepony.unicopia.mixin; 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.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.minelittlepony.unicopia.entity.duck.ServerPlayerEntityDuck; diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinClientPlayerInteractionManager.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinClientPlayerInteractionManager.java index 429bfce2..3ab60ef1 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinClientPlayerInteractionManager.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinClientPlayerInteractionManager.java @@ -20,4 +20,11 @@ abstract class MixinClientPlayerInteractionManager { info.setReturnValue(player.getExtendedReach() + info.getReturnValueF()); } } + + @Inject(method = "hasExtendedReach", at = @At("HEAD"), cancellable = true) + private void onHasExtendedReach(CallbackInfoReturnable info) { + if (!info.getReturnValueZ() && Pony.of(MinecraftClient.getInstance().player).getExtendedReach() > 0) { + info.setReturnValue(true); + } + } } diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java index 702d9204..250c2387 100644 --- a/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/MixinGameRenderer.java @@ -1,14 +1,15 @@ package com.minelittlepony.unicopia.mixin.client; -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.*; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.minelittlepony.unicopia.EquinePredicates; import com.minelittlepony.unicopia.client.BatEyesApplicator; import com.minelittlepony.unicopia.client.UnicopiaClient; + +import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.Camera; import net.minecraft.client.render.GameRenderer; import net.minecraft.client.util.math.MatrixStack; @@ -19,6 +20,18 @@ import net.minecraft.resource.SynchronousResourceReloader; @Mixin(GameRenderer.class) abstract class MixinGameRenderer implements AutoCloseable, SynchronousResourceReloader { + + @Shadow + private @Final MinecraftClient client; + + @ModifyConstant( + method = "updateTargetedEntity", + constant = @Constant(doubleValue = 6) + ) + private double onUpdateTargetedEntity(double initial) { + return Math.max(initial, client.interactionManager.getReachDistance()); + } + @Inject(method = "getFov(Lnet/minecraft/client/render/Camera;FZ)D", at = @At("RETURN"), cancellable = true) diff --git a/src/main/resources/assets/unicopia/lang/en_us.json b/src/main/resources/assets/unicopia/lang/en_us.json index 7dc6bc87..c25c3c78 100644 --- a/src/main/resources/assets/unicopia/lang/en_us.json +++ b/src/main/resources/assets/unicopia/lang/en_us.json @@ -69,6 +69,13 @@ "item.unicopia.alicorn_amulet": "Alicorn Amulet", "item.unicopia.alicorn_amulet.lore": "Time worn: %d", + + "item.unicopia.wooden_polearm": "Wooden Polearm", + "item.unicopia.stone_polearm": "Stone Polearm", + "item.unicopia.iron_polearm": "Iron Polearm", + "item.unicopia.golden_polearm": "Golden Polearm", + "item.unicopia.diamond_polearm": "Diamond Polearm", + "item.unicopia.netherite_polearm": "Netherite Polearm", "item.unicopia.music_disc_pet": "Music Disc", "item.unicopia.music_disc_pet.desc": "Danial Ingram - pet", diff --git a/src/main/resources/assets/unicopia/models/item/diamond_polearm.json b/src/main/resources/assets/unicopia/models/item/diamond_polearm.json new file mode 100644 index 00000000..d4fa68f0 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/diamond_polearm.json @@ -0,0 +1,14 @@ +{ + "parent": "item/trident_in_hand", + "textures": { + "particle": "unicopia:item/diamond_polearm" + }, + "overrides": [ + { + "predicate": { + "throwing": 1 + }, + "model": "unicopia:item/diamond_polearm_throwing" + } + ] +} diff --git a/src/main/resources/assets/unicopia/models/item/diamond_polearm_in_inventory.json b/src/main/resources/assets/unicopia/models/item/diamond_polearm_in_inventory.json new file mode 100644 index 00000000..d2bb0d76 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/diamond_polearm_in_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/diamond_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/diamond_polearm_throwing.json b/src/main/resources/assets/unicopia/models/item/diamond_polearm_throwing.json new file mode 100644 index 00000000..c23fa56c --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/diamond_polearm_throwing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/trident_throwing", + "textures": { + "particle": "unicopia:item/diamond_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/golden_polearm.json b/src/main/resources/assets/unicopia/models/item/golden_polearm.json new file mode 100644 index 00000000..d5876f57 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/golden_polearm.json @@ -0,0 +1,14 @@ +{ + "parent": "item/trident_in_hand", + "textures": { + "particle": "unicopia:item/golden_polearm" + }, + "overrides": [ + { + "predicate": { + "throwing": 1 + }, + "model": "unicopia:item/golden_polearm_throwing" + } + ] +} diff --git a/src/main/resources/assets/unicopia/models/item/golden_polearm_in_inventory.json b/src/main/resources/assets/unicopia/models/item/golden_polearm_in_inventory.json new file mode 100644 index 00000000..a368786e --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/golden_polearm_in_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/golden_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/golden_polearm_throwing.json b/src/main/resources/assets/unicopia/models/item/golden_polearm_throwing.json new file mode 100644 index 00000000..d36f86fe --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/golden_polearm_throwing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/trident_throwing", + "textures": { + "particle": "unicopia:item/golden_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/iron_polearm.json b/src/main/resources/assets/unicopia/models/item/iron_polearm.json new file mode 100644 index 00000000..50ff1f53 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/iron_polearm.json @@ -0,0 +1,14 @@ +{ + "parent": "item/trident_in_hand", + "textures": { + "particle": "unicopia:item/iron_polearm" + }, + "overrides": [ + { + "predicate": { + "throwing": 1 + }, + "model": "unicopia:item/iron_polearm_throwing" + } + ] +} diff --git a/src/main/resources/assets/unicopia/models/item/iron_polearm_in_inventory.json b/src/main/resources/assets/unicopia/models/item/iron_polearm_in_inventory.json new file mode 100644 index 00000000..e1619d5e --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/iron_polearm_in_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/iron_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/iron_polearm_throwing.json b/src/main/resources/assets/unicopia/models/item/iron_polearm_throwing.json new file mode 100644 index 00000000..50d9c2e1 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/iron_polearm_throwing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/trident_throwing", + "textures": { + "particle": "unicopia:item/iron_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/netherite_polearm.json b/src/main/resources/assets/unicopia/models/item/netherite_polearm.json new file mode 100644 index 00000000..e9021ea1 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/netherite_polearm.json @@ -0,0 +1,14 @@ +{ + "parent": "item/trident_in_hand", + "textures": { + "particle": "unicopia:item/netherite_polearm" + }, + "overrides": [ + { + "predicate": { + "throwing": 1 + }, + "model": "unicopia:item/netherite_polearm_throwing" + } + ] +} diff --git a/src/main/resources/assets/unicopia/models/item/netherite_polearm_in_inventory.json b/src/main/resources/assets/unicopia/models/item/netherite_polearm_in_inventory.json new file mode 100644 index 00000000..1abde3fe --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/netherite_polearm_in_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/netherite_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/netherite_polearm_throwing.json b/src/main/resources/assets/unicopia/models/item/netherite_polearm_throwing.json new file mode 100644 index 00000000..39c652a5 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/netherite_polearm_throwing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/trident_throwing", + "textures": { + "particle": "unicopia:item/netherite_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/stone_polearm.json b/src/main/resources/assets/unicopia/models/item/stone_polearm.json new file mode 100644 index 00000000..fc92f268 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/stone_polearm.json @@ -0,0 +1,14 @@ +{ + "parent": "item/trident_in_hand", + "textures": { + "particle": "unicopia:item/stone_polearm" + }, + "overrides": [ + { + "predicate": { + "throwing": 1 + }, + "model": "unicopia:item/stone_polearm_throwing" + } + ] +} diff --git a/src/main/resources/assets/unicopia/models/item/stone_polearm_in_inventory.json b/src/main/resources/assets/unicopia/models/item/stone_polearm_in_inventory.json new file mode 100644 index 00000000..2e9256ee --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/stone_polearm_in_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/stone_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/stone_polearm_throwing.json b/src/main/resources/assets/unicopia/models/item/stone_polearm_throwing.json new file mode 100644 index 00000000..3e82373a --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/stone_polearm_throwing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/trident_throwing", + "textures": { + "particle": "unicopia:item/stone_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/wooden_polearm.json b/src/main/resources/assets/unicopia/models/item/wooden_polearm.json new file mode 100644 index 00000000..fa5b2759 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/wooden_polearm.json @@ -0,0 +1,14 @@ +{ + "parent": "item/trident_in_hand", + "textures": { + "particle": "unicopia:item/wooden_polearm" + }, + "overrides": [ + { + "predicate": { + "throwing": 1 + }, + "model": "unicopia:item/wooden_polearm_throwing" + } + ] +} diff --git a/src/main/resources/assets/unicopia/models/item/wooden_polearm_in_inventory.json b/src/main/resources/assets/unicopia/models/item/wooden_polearm_in_inventory.json new file mode 100644 index 00000000..6dd937b6 --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/wooden_polearm_in_inventory.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "unicopia:item/wooden_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/models/item/wooden_polearm_throwing.json b/src/main/resources/assets/unicopia/models/item/wooden_polearm_throwing.json new file mode 100644 index 00000000..8f087c5d --- /dev/null +++ b/src/main/resources/assets/unicopia/models/item/wooden_polearm_throwing.json @@ -0,0 +1,6 @@ +{ + "parent": "item/trident_throwing", + "textures": { + "particle": "unicopia:item/wooden_polearm" + } +} diff --git a/src/main/resources/assets/unicopia/textures/entity/polearm/diamond_polearm.png b/src/main/resources/assets/unicopia/textures/entity/polearm/diamond_polearm.png new file mode 100644 index 00000000..ed7b846e Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/entity/polearm/diamond_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/entity/polearm/golden_polearm.png b/src/main/resources/assets/unicopia/textures/entity/polearm/golden_polearm.png new file mode 100644 index 00000000..056e380b Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/entity/polearm/golden_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/entity/polearm/iron_polearm.png b/src/main/resources/assets/unicopia/textures/entity/polearm/iron_polearm.png new file mode 100644 index 00000000..0132b7e6 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/entity/polearm/iron_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/entity/polearm/netherite_polearm.png b/src/main/resources/assets/unicopia/textures/entity/polearm/netherite_polearm.png new file mode 100644 index 00000000..9e196657 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/entity/polearm/netherite_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/entity/polearm/stone_polearm.png b/src/main/resources/assets/unicopia/textures/entity/polearm/stone_polearm.png new file mode 100644 index 00000000..56a44869 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/entity/polearm/stone_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/entity/polearm/wooden_polearm.png b/src/main/resources/assets/unicopia/textures/entity/polearm/wooden_polearm.png new file mode 100644 index 00000000..8fd92b99 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/entity/polearm/wooden_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/diamond_polearm.png b/src/main/resources/assets/unicopia/textures/item/diamond_polearm.png new file mode 100644 index 00000000..8c099b9f Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/diamond_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/golden_polearm.png b/src/main/resources/assets/unicopia/textures/item/golden_polearm.png new file mode 100644 index 00000000..f7c83a49 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/golden_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/iron_polearm.png b/src/main/resources/assets/unicopia/textures/item/iron_polearm.png new file mode 100644 index 00000000..3fe4ebc6 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/iron_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/netherite_polearm.png b/src/main/resources/assets/unicopia/textures/item/netherite_polearm.png new file mode 100644 index 00000000..b0cf6b5a Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/netherite_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/stone_polearm.png b/src/main/resources/assets/unicopia/textures/item/stone_polearm.png new file mode 100644 index 00000000..ab10ec66 Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/stone_polearm.png differ diff --git a/src/main/resources/assets/unicopia/textures/item/wooden_polearm.png b/src/main/resources/assets/unicopia/textures/item/wooden_polearm.png new file mode 100644 index 00000000..6e0c808d Binary files /dev/null and b/src/main/resources/assets/unicopia/textures/item/wooden_polearm.png differ diff --git a/src/main/resources/data/unicopia/advancements/recipes/tools/diamond_polearm.json b/src/main/resources/data/unicopia/advancements/recipes/tools/diamond_polearm.json new file mode 100644 index 00000000..52794d3d --- /dev/null +++ b/src/main/resources/data/unicopia/advancements/recipes/tools/diamond_polearm.json @@ -0,0 +1,30 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "unicopia:diamond_polearm" + ] + }, + "criteria": { + "has_ingredients": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "items": [ "minecraft:diamond" ] } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "unicopia:diamond_polearm" + } + } + }, + "requirements": [ + [ + "has_ingredients", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/advancements/recipes/tools/golden_polearm.json b/src/main/resources/data/unicopia/advancements/recipes/tools/golden_polearm.json new file mode 100644 index 00000000..ab03c0bd --- /dev/null +++ b/src/main/resources/data/unicopia/advancements/recipes/tools/golden_polearm.json @@ -0,0 +1,30 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "unicopia:golden_polearm" + ] + }, + "criteria": { + "has_ingredients": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "items": [ "minecraft:gold_ingot" ] } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "unicopia:golden_polearm" + } + } + }, + "requirements": [ + [ + "has_ingredients", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/advancements/recipes/tools/iron_polearm.json b/src/main/resources/data/unicopia/advancements/recipes/tools/iron_polearm.json new file mode 100644 index 00000000..4db161bd --- /dev/null +++ b/src/main/resources/data/unicopia/advancements/recipes/tools/iron_polearm.json @@ -0,0 +1,30 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "unicopia:iron_polearm" + ] + }, + "criteria": { + "has_ingredients": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "items": [ "minecraft:iron_ingot" ] } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "unicopia:iron_polearm" + } + } + }, + "requirements": [ + [ + "has_ingredients", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/advancements/recipes/tools/netherite_polearm_smithing.json b/src/main/resources/data/unicopia/advancements/recipes/tools/netherite_polearm_smithing.json new file mode 100644 index 00000000..07d09b50 --- /dev/null +++ b/src/main/resources/data/unicopia/advancements/recipes/tools/netherite_polearm_smithing.json @@ -0,0 +1,30 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "unicopia:netherite_polearm_smithing" + ] + }, + "criteria": { + "has_ingredients": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "items": [ "minecraft:netherite_ingot" ] } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "unicopia:netherite_polearm_smithing" + } + } + }, + "requirements": [ + [ + "has_ingredients", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/advancements/recipes/tools/stone_polearm.json b/src/main/resources/data/unicopia/advancements/recipes/tools/stone_polearm.json new file mode 100644 index 00000000..bd846770 --- /dev/null +++ b/src/main/resources/data/unicopia/advancements/recipes/tools/stone_polearm.json @@ -0,0 +1,30 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "unicopia:stone_polearm" + ] + }, + "criteria": { + "has_ingredients": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "tag": "minecraft:stone_tool_materials" } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "unicopia:stone_polearm" + } + } + }, + "requirements": [ + [ + "has_ingredients", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/advancements/recipes/tools/wooden_polearm.json b/src/main/resources/data/unicopia/advancements/recipes/tools/wooden_polearm.json new file mode 100644 index 00000000..fd9a8fd9 --- /dev/null +++ b/src/main/resources/data/unicopia/advancements/recipes/tools/wooden_polearm.json @@ -0,0 +1,30 @@ +{ + "parent": "minecraft:recipes/root", + "rewards": { + "recipes": [ + "unicopia:wooden_polearm" + ] + }, + "criteria": { + "has_ingredients": { + "trigger": "minecraft:inventory_changed", + "conditions": { + "items": [ + { "items": [ "minecraft:stick" ] } + ] + } + }, + "has_the_recipe": { + "trigger": "minecraft:recipe_unlocked", + "conditions": { + "recipe": "unicopia:wooden_polearm" + } + } + }, + "requirements": [ + [ + "has_ingredients", + "has_the_recipe" + ] + ] +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/recipes/diamond_polearm.json b/src/main/resources/data/unicopia/recipes/diamond_polearm.json new file mode 100644 index 00000000..5818e4cb --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/diamond_polearm.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " X", + " # ", + "# " + ], + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "item": "minecraft:diamond" + } + }, + "result": { + "item": "unicopia:diamond_polearm" + } +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/recipes/golden_polearm.json b/src/main/resources/data/unicopia/recipes/golden_polearm.json new file mode 100644 index 00000000..6c5297a3 --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/golden_polearm.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " X", + " # ", + "# " + ], + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "item": "minecraft:gold_ingot" + } + }, + "result": { + "item": "unicopia:golden_polearm" + } +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/recipes/iron_polearm.json b/src/main/resources/data/unicopia/recipes/iron_polearm.json new file mode 100644 index 00000000..ceceac21 --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/iron_polearm.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " X", + " # ", + "# " + ], + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "item": "minecraft:iron_ingot" + } + }, + "result": { + "item": "unicopia:iron_polearm" + } +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/recipes/netherite_polearm_smithing.json b/src/main/resources/data/unicopia/recipes/netherite_polearm_smithing.json new file mode 100644 index 00000000..37635070 --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/netherite_polearm_smithing.json @@ -0,0 +1,12 @@ +{ + "type": "minecraft:smithing", + "addition": { + "item": "minecraft:netherite_ingot" + }, + "base": { + "item": "unicopia:diamond_polearm" + }, + "result": { + "item": "unicopia:netherite_polearm" + } +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/recipes/stone_polearm.json b/src/main/resources/data/unicopia/recipes/stone_polearm.json new file mode 100644 index 00000000..49dcd70a --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/stone_polearm.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " X", + " # ", + "# " + ], + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "tag": "minecraft:stone_tool_materials" + } + }, + "result": { + "item": "unicopia:stone_polearm" + } +} \ No newline at end of file diff --git a/src/main/resources/data/unicopia/recipes/wooden_polearm.json b/src/main/resources/data/unicopia/recipes/wooden_polearm.json new file mode 100644 index 00000000..3b659c76 --- /dev/null +++ b/src/main/resources/data/unicopia/recipes/wooden_polearm.json @@ -0,0 +1,19 @@ +{ + "type": "minecraft:crafting_shaped", + "pattern": [ + " X", + " # ", + "# " + ], + "key": { + "#": { + "item": "minecraft:stick" + }, + "X": { + "tag": "minecraft:planks" + } + }, + "result": { + "item": "unicopia:wooden_polearm" + } +} \ No newline at end of file diff --git a/src/main/resources/unicopia.mixin.json b/src/main/resources/unicopia.mixin.json index 1cbce8ea..b4f2d9a8 100644 --- a/src/main/resources/unicopia.mixin.json +++ b/src/main/resources/unicopia.mixin.json @@ -23,6 +23,7 @@ "MixinPersistentProjectileEntity", "MixinPlayerEntity", "MixinProjectileEntity", + "MixinReachDistanceFix", "MixinServerPlayerEntity", "MixinServerPlayNetworkHandler", "MixinServerWorld",