From 2ee58a184f25af68cad4b23e0f5827949f74b9da Mon Sep 17 00:00:00 2001 From: TropheusJ Date: Sat, 11 Jan 2025 23:46:16 -0500 Subject: [PATCH] cannon makes your arms longer --- .../portalcubed/content/PortalCubedItems.java | 15 +++++++++++++++ .../content/cannon/ConstructionCannonItem.java | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/src/main/java/io/github/fusionflux/portalcubed/content/PortalCubedItems.java b/src/main/java/io/github/fusionflux/portalcubed/content/PortalCubedItems.java index 11887f99..ada6bb03 100644 --- a/src/main/java/io/github/fusionflux/portalcubed/content/PortalCubedItems.java +++ b/src/main/java/io/github/fusionflux/portalcubed/content/PortalCubedItems.java @@ -21,13 +21,19 @@ import net.fabricmc.fabric.api.loot.v3.LootTableEvents; import net.minecraft.Util; import net.minecraft.core.cauldron.CauldronInteraction; +import net.minecraft.core.component.DataComponents; import net.minecraft.sounds.SoundEvents; +import net.minecraft.world.entity.EquipmentSlotGroup; +import net.minecraft.world.entity.ai.attributes.AttributeModifier; +import net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation; +import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.food.Foods; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.BucketItem; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.item.SignItem; +import net.minecraft.world.item.component.ItemAttributeModifiers; import net.minecraft.world.item.equipment.ArmorType; import net.minecraft.world.level.block.DispenserBlock; import net.minecraft.world.level.storage.loot.BuiltInLootTables; @@ -57,6 +63,15 @@ public class PortalCubedItems { public static final ConstructionCannonItem CONSTRUCTION_CANNON = REGISTRAR.items.create("construction_cannon", ConstructionCannonItem::new) .properties(s -> s.stacksTo(1).fireResistant()) + .properties(p -> p.component( + DataComponents.ATTRIBUTE_MODIFIERS, + ItemAttributeModifiers.builder().add( + Attributes.BLOCK_INTERACTION_RANGE, + new AttributeModifier(ConstructionCannonItem.REACH_BOOST, 2.5, Operation.ADD_VALUE), + EquipmentSlotGroup.MAINHAND + ) + .build() + )) .build(); public static final Item LEMON = REGISTRAR.items.create("lemon", Item::new) diff --git a/src/main/java/io/github/fusionflux/portalcubed/content/cannon/ConstructionCannonItem.java b/src/main/java/io/github/fusionflux/portalcubed/content/cannon/ConstructionCannonItem.java index 0e1e76bb..ff79a9b4 100644 --- a/src/main/java/io/github/fusionflux/portalcubed/content/cannon/ConstructionCannonItem.java +++ b/src/main/java/io/github/fusionflux/portalcubed/content/cannon/ConstructionCannonItem.java @@ -2,6 +2,9 @@ import java.util.List; +import io.github.fusionflux.portalcubed.PortalCubed; +import net.minecraft.resources.ResourceLocation; + import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,6 +50,7 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox; public class ConstructionCannonItem extends Item implements CustomHoldPoseItem { + public static final ResourceLocation REACH_BOOST = PortalCubed.id("construction_cannon_reach_boost"); public static final Component MATERIAL_TOOLTIP = translate("material").withStyle(ChatFormatting.GRAY); public static final Component CONSTRUCT_TOOLTIP = translate("construct_set").withStyle(ChatFormatting.GRAY);