Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Toolbelt #2493

Open
wants to merge 88 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
d9916e9
Pain
M-W-K Jun 5, 2024
31dfb44
Recipe & texture
M-W-K Jun 5, 2024
b31987d
Finalize in-world handling
M-W-K Jun 5, 2024
58705fb
Spotless
M-W-K Jun 5, 2024
7c37fa8
Maintenance
M-W-K Jun 5, 2024
d8079df
Shift-click
M-W-K Jun 5, 2024
b2162f9
Spotless, once more
M-W-K Jun 5, 2024
affb2f5
Passthrough methods
M-W-K Jun 5, 2024
307ef14
Less cringe
M-W-K Jun 5, 2024
aca0e87
Oops
M-W-K Jun 5, 2024
0fc4a3d
Passthrough / toolbelt detection improvements
M-W-K Jun 5, 2024
3c14c4f
Prevent unexpected behavior on removal of selected tool
M-W-K Jun 5, 2024
31fd761
Better toolbelt GUI handling
M-W-K Jun 5, 2024
a7c3cb5
mui2 (pain)
M-W-K Jun 5, 2024
d426c64
sp3tless
M-W-K Jun 5, 2024
b319b28
improve a fallback
M-W-K Jun 5, 2024
6488ebb
I'm dyeing
M-W-K Jun 6, 2024
cd6e017
improve passthrough
M-W-K Jun 6, 2024
bd2bf01
More universal solution to toolbelt crafting
M-W-K Jun 6, 2024
a2d6f0c
sp4tless
M-W-K Jun 6, 2024
d88e658
Dynamic toolbelt render
M-W-K Jun 15, 2024
bf38ef0
Fix excessive passthrough and toolbelt render and improve IDyeableItem
M-W-K Jun 15, 2024
0158726
Sp4tless
M-W-K Jun 15, 2024
f783a33
Pain
M-W-K Jun 5, 2024
724884d
Recipe & texture
M-W-K Jun 5, 2024
74a4878
Finalize in-world handling
M-W-K Jun 5, 2024
0dceb77
Spotless
M-W-K Jun 5, 2024
247cc31
Maintenance
M-W-K Jun 5, 2024
d062ae8
Shift-click
M-W-K Jun 5, 2024
deeb74e
Spotless, once more
M-W-K Jun 5, 2024
2e81c34
Passthrough methods
M-W-K Jun 5, 2024
e922f65
Less cringe
M-W-K Jun 5, 2024
d85110e
Oops
M-W-K Jun 5, 2024
edbe78f
Passthrough / toolbelt detection improvements
M-W-K Jun 5, 2024
002074f
Prevent unexpected behavior on removal of selected tool
M-W-K Jun 5, 2024
6d2716d
Better toolbelt GUI handling
M-W-K Jun 5, 2024
86c5b20
mui2 (pain)
M-W-K Jun 5, 2024
1d69ba1
sp3tless
M-W-K Jun 5, 2024
48f543f
improve a fallback
M-W-K Jun 5, 2024
05f423d
I'm dyeing
M-W-K Jun 6, 2024
93e17ba
improve passthrough
M-W-K Jun 6, 2024
d7d29f4
More universal solution to toolbelt crafting
M-W-K Jun 6, 2024
f9eeb27
sp4tless
M-W-K Jun 6, 2024
0da1cf9
Dynamic toolbelt render
M-W-K Jun 15, 2024
81ab217
Fix excessive passthrough and toolbelt render and improve IDyeableItem
M-W-K Jun 15, 2024
64a7b67
Sp4tless
M-W-K Jun 15, 2024
57e8438
convert asm to mixin
ghzdude Jun 28, 2024
adec6c6
Merge branch 'toolbelt' into toolbelt
M-W-K Jun 28, 2024
c278468
Merge pull request #1 from ghzdude/toolbelt
M-W-K Jun 28, 2024
76bd281
fix an oops in the merge process
M-W-K Jun 28, 2024
002d772
toolbelt JEI complete
M-W-K Jun 28, 2024
b0ccde3
improve JEI shift-complete behavior
M-W-K Jun 28, 2024
647285c
sp6tless
M-W-K Jun 28, 2024
b9fdd95
sound
M-W-K Jun 28, 2024
2af2cf8
Alternate mixin
M-W-K Jun 30, 2024
899b2de
Merge remote-tracking branch 'main/master' into toolbelt
M-W-K Oct 16, 2024
5628363
Merge with master
M-W-K Oct 16, 2024
03c55bc
Fixes and change to JEI behavior
M-W-K Nov 8, 2024
f374049
Allow toolbelt to fix maintenance in-world and prevent merge crafting
M-W-K Nov 8, 2024
a862a1d
Tweaks and rebalance slot counts
M-W-K Nov 8, 2024
e836de9
Behold, RENDERING
M-W-K Nov 8, 2024
566ed93
Sync moment
M-W-K Nov 9, 2024
45f4bb8
Merge remote-tracking branch 'main/master' into toolbelt
M-W-K Nov 9, 2024
c6c0276
Hide durability until damaged
M-W-K Nov 9, 2024
860db4e
Minor Tweaks
M-W-K Nov 9, 2024
a23249b
spotless
M-W-K Nov 9, 2024
38f5902
actually spotless
M-W-K Nov 9, 2024
ee1a9ea
Fixes
M-W-K Nov 9, 2024
1de6728
rework `buildUI()` (it bothered me)
ghzdude Nov 9, 2024
2b197fe
rework toolbelt's `buildUI()` (it looked at me wrong)
ghzdude Nov 9, 2024
f91468a
Refactor
M-W-K Nov 9, 2024
dad2678
Merge remote-tracking branch 'personal/toolbelt' into toolbelt
M-W-K Nov 9, 2024
f2100bd
Minor change
M-W-K Nov 22, 2024
9ad3259
Address review
M-W-K Nov 24, 2024
531f868
spotless
M-W-K Nov 26, 2024
f46d4d6
mixin to relocate tool highlight text
M-W-K Nov 26, 2024
b1d9262
WrapOperation-ify
M-W-K Nov 27, 2024
a1ae9d2
address review
M-W-K Nov 27, 2024
2fd02a4
fix my side of reviews
ghzdude Nov 29, 2024
c37e0c7
fix aoe size flickering
ghzdude Nov 29, 2024
33bd4f8
add ui title
ghzdude Nov 30, 2024
65b9ff8
address review
M-W-K Nov 30, 2024
6e4f40a
i hate this, but it works
ghzdude Nov 30, 2024
ee3d959
resize arrays on load
ghzdude Nov 30, 2024
6ad5e61
Merge branch 'master' into toolbelt
M-W-K Nov 30, 2024
d190f05
better fix for resizing arrays
ghzdude Nov 30, 2024
7c39e00
initialize threadlocal
ghzdude Dec 18, 2024
8561291
actually fix syncing to client (please)
ghzdude Dec 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions src/main/java/gregtech/api/items/IDyeableItem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package gregtech.api.items;

import net.minecraft.block.BlockCauldron;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.util.Constants;

import org.jetbrains.annotations.NotNull;

public interface IDyeableItem {

String COLOR_KEY = "gt_color";

default boolean hasColor(ItemStack stack) {
NBTTagCompound nbttagcompound = stack.getTagCompound();
return nbttagcompound != null && nbttagcompound.hasKey(COLOR_KEY, Constants.NBT.TAG_INT);
}

default int getColor(ItemStack stack) {
NBTTagCompound nbttagcompound = stack.getTagCompound();
if (nbttagcompound != null && nbttagcompound.hasKey(COLOR_KEY, Constants.NBT.TAG_INT)) {
return nbttagcompound.getInteger(COLOR_KEY);
}
return getDefaultColor(stack);
}

default int getDefaultColor(ItemStack stack) {
M-W-K marked this conversation as resolved.
Show resolved Hide resolved
return 0xFFFFFF;
}

default void removeColor(ItemStack stack) {
NBTTagCompound nbttagcompound = stack.getTagCompound();
if (nbttagcompound != null && nbttagcompound.hasKey(COLOR_KEY)) {
nbttagcompound.removeTag(COLOR_KEY);
}
}

default void setColor(ItemStack stack, int color) {
NBTTagCompound nbttagcompound = stack.getTagCompound();
if (nbttagcompound == null) {
nbttagcompound = new NBTTagCompound();
stack.setTagCompound(nbttagcompound);
}
nbttagcompound.setInteger(COLOR_KEY, color);
}

default @NotNull EnumActionResult onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world,
M-W-K marked this conversation as resolved.
Show resolved Hide resolved
@NotNull BlockPos pos, @NotNull EnumFacing side, float hitX,
float hitY, float hitZ, @NotNull EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (this.hasColor(stack)) {
IBlockState iblockstate = world.getBlockState(pos);
if (iblockstate.getBlock() instanceof BlockCauldron cauldron) {
int water = iblockstate.getValue(BlockCauldron.LEVEL);
if (water > 0) {
this.removeColor(stack);
cauldron.setWaterLevel(world, pos, iblockstate, water - 1);
return EnumActionResult.SUCCESS;
}
}
}
return EnumActionResult.PASS;
}

/**
* Controls whether the dyeing recipe simply removes the dyeable item from the crafting grid,
* or calls {@link net.minecraftforge.common.ForgeHooks#getContainerItem(ItemStack)} on it.
*/
default boolean shouldGetContainerItem() {
return true;
}
}
166 changes: 108 additions & 58 deletions src/main/java/gregtech/api/items/toolitem/IGTTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@
import gregtech.api.capability.GregtechCapabilities;
import gregtech.api.capability.impl.CombinedCapabilityProvider;
import gregtech.api.capability.impl.ElectricItem;
import gregtech.api.gui.GuiTextures;
import gregtech.api.gui.ModularUI;
import gregtech.api.gui.widgets.ClickButtonWidget;
import gregtech.api.gui.widgets.DynamicLabelWidget;
import gregtech.api.items.gui.ItemUIFactory;
import gregtech.api.items.gui.PlayerInventoryHolder;
import gregtech.api.items.metaitem.ElectricStats;
import gregtech.api.items.toolitem.aoe.AoESymmetrical;
import gregtech.api.items.toolitem.behavior.IToolBehavior;
import gregtech.api.mui.GTGuiTextures;
import gregtech.api.mui.GTGuis;
import gregtech.api.recipes.ModHandler;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.Material;
Expand Down Expand Up @@ -63,6 +60,19 @@
import appeng.api.implementations.items.IAEWrench;
import buildcraft.api.tools.IToolWrench;
import cofh.api.item.IToolHammer;
import com.cleanroommc.modularui.api.drawable.IKey;
import com.cleanroommc.modularui.api.widget.IWidget;
import com.cleanroommc.modularui.api.widget.Interactable;
import com.cleanroommc.modularui.factory.HandGuiData;
import com.cleanroommc.modularui.factory.ItemGuiFactory;
import com.cleanroommc.modularui.screen.ModularPanel;
import com.cleanroommc.modularui.utils.Alignment;
import com.cleanroommc.modularui.value.sync.IntSyncValue;
import com.cleanroommc.modularui.value.sync.PanelSyncManager;
import com.cleanroommc.modularui.widgets.ButtonWidget;
import com.cleanroommc.modularui.widgets.TextWidget;
import com.cleanroommc.modularui.widgets.layout.Column;
import com.cleanroommc.modularui.widgets.layout.Row;
import com.enderio.core.common.interfaces.IOverlayRenderAware;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
Expand Down Expand Up @@ -207,7 +217,7 @@ default ItemStack get(Material material) {

// Set behaviours
NBTTagCompound behaviourTag = getBehaviorsTag(stack);
getToolStats().getBehaviors().forEach(behavior -> behavior.addBehaviorNBT(stack, behaviourTag));
getBehaviors(stack).forEach(behavior -> behavior.addBehaviorNBT(stack, behaviourTag));

if (aoeDefinition != AoESymmetrical.none()) {
behaviourTag.setInteger(MAX_AOE_COLUMN_KEY, aoeDefinition.column);
Expand Down Expand Up @@ -409,14 +419,14 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {
}

default boolean definition$hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) {
getToolStats().getBehaviors().forEach(behavior -> behavior.hitEntity(stack, target, attacker));
getBehaviors(stack).forEach(behavior -> behavior.hitEntity(stack, target, attacker));
damageItem(stack, attacker, getToolStats().getToolDamagePerAttack(stack));
return true;
}

default boolean definition$onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player) {
if (player.world.isRemote) return false;
getToolStats().getBehaviors().forEach(behavior -> behavior.onBlockStartBreak(stack, pos, player));
getBehaviors(stack).forEach(behavior -> behavior.onBlockStartBreak(stack, pos, player));

if (!player.isSneaking()) {
EntityPlayerMP playerMP = (EntityPlayerMP) player;
Expand Down Expand Up @@ -458,7 +468,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {
default boolean definition$onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos,
EntityLivingBase entityLiving) {
if (!worldIn.isRemote) {
getToolStats().getBehaviors()
getBehaviors(stack)
.forEach(behavior -> behavior.onBlockDestroyed(stack, worldIn, state, pos, entityLiving));

if ((double) state.getBlockHardness(worldIn, pos) != 0.0D) {
Expand Down Expand Up @@ -522,7 +532,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {

default boolean definition$canDisableShield(ItemStack stack, ItemStack shield, EntityLivingBase entity,
EntityLivingBase attacker) {
return getToolStats().getBehaviors().stream()
return getBehaviors(stack).stream()
.anyMatch(behavior -> behavior.canDisableShield(stack, shield, entity, attacker));
}

Expand Down Expand Up @@ -570,7 +580,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {
}

default boolean definition$onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) {
getToolStats().getBehaviors().forEach(behavior -> behavior.onEntitySwing(entityLiving, stack));
getBehaviors(stack).forEach(behavior -> behavior.onEntitySwing(entityLiving, stack));
return false;
}

Expand Down Expand Up @@ -622,7 +632,7 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {
if (isElectric()) {
providers.add(ElectricStats.createElectricItem(0L, getElectricTier()).createProvider(stack));
}
for (IToolBehavior behavior : getToolStats().getBehaviors()) {
for (IToolBehavior behavior : getBehaviors(stack)) {
ICapabilityProvider behaviorProvider = behavior.createProvider(stack, nbt);
if (behaviorProvider != null) {
providers.add(behaviorProvider);
Expand All @@ -633,10 +643,15 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {
return new CombinedCapabilityProvider(providers);
}

@NotNull
default List<IToolBehavior> getBehaviors(ItemStack stack) {
return getToolStats().getBehaviors();
}

default EnumActionResult definition$onItemUseFirst(@NotNull EntityPlayer player, @NotNull World world,
@NotNull BlockPos pos, @NotNull EnumFacing facing, float hitX,
float hitY, float hitZ, @NotNull EnumHand hand) {
for (IToolBehavior behavior : getToolStats().getBehaviors()) {
for (IToolBehavior behavior : getBehaviors(player.getHeldItem(hand))) {
if (behavior.onItemUseFirst(player, world, pos, facing, hitX, hitY, hitZ, hand) ==
EnumActionResult.SUCCESS) {
return EnumActionResult.SUCCESS;
Expand All @@ -648,8 +663,9 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {

default EnumActionResult definition$onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ) {
for (IToolBehavior behavior : getToolStats().getBehaviors()) {
if (behavior.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ) == EnumActionResult.SUCCESS) {
for (IToolBehavior behavior : getBehaviors(player.getHeldItem(hand))) {
if (behavior.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ) ==
EnumActionResult.SUCCESS) {
return EnumActionResult.SUCCESS;
}
}
Expand All @@ -662,12 +678,12 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {
if (!world.isRemote) {
// TODO: relocate to keybind action when keybind PR happens
if (player.isSneaking() && getMaxAoEDefinition(stack) != AoESymmetrical.none()) {
PlayerInventoryHolder.openHandItemUI(player, hand);
ItemGuiFactory.open((EntityPlayerMP) player, hand);
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}
}

for (IToolBehavior behavior : getToolStats().getBehaviors()) {
for (IToolBehavior behavior : getBehaviors(stack)) {
if (behavior.onItemRightClick(world, player, hand).getType() == EnumActionResult.SUCCESS) {
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}
Expand Down Expand Up @@ -762,10 +778,10 @@ default AoESymmetrical getAoEDefinition(ItemStack stack) {
tooltip.add(I18n.format("item.gt.tool.behavior.relocate_mining"));
}

if (!addedBehaviorNewLine && !toolStats.getBehaviors().isEmpty()) {
if (!addedBehaviorNewLine && !getBehaviors(stack).isEmpty()) {
tooltip.add("");
}
toolStats.getBehaviors().forEach(behavior -> behavior.addInformation(stack, world, tooltip, flag));
getBehaviors(stack).forEach(behavior -> behavior.addInformation(stack, world, tooltip, flag));

// unique tooltip
String uniqueTooltip = "item.gt.tool." + getToolId() + ".tooltip";
Expand Down Expand Up @@ -878,6 +894,7 @@ default ModelResourceLocation getModelLocation() {

// Sound Playing
default void playCraftingSound(EntityPlayer player, ItemStack stack) {
stack = toolbeltPassthrough(stack);
// player null check for things like auto-crafters
if (ConfigHolder.client.toolCraftingSounds && getSound() != null && player != null) {
if (canPlaySound(stack)) {
Expand All @@ -903,45 +920,78 @@ default void playSound(EntityPlayer player) {
}
}

default ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) {
NBTTagCompound tag = getBehaviorsTag(holder.getCurrentItem());
AoESymmetrical defaultDefinition = getMaxAoEDefinition(holder.getCurrentItem());
return ModularUI.builder(GuiTextures.BORDERED_BACKGROUND, 120, 80)
.label(6, 10, "item.gt.tool.aoe.columns")
.label(49, 10, "item.gt.tool.aoe.rows")
.label(79, 10, "item.gt.tool.aoe.layers")
.widget(new ClickButtonWidget(15, 24, 20, 20, "+", data -> {
AoESymmetrical.increaseColumn(tag, defaultDefinition);
holder.markAsDirty();
}))
.widget(new ClickButtonWidget(15, 44, 20, 20, "-", data -> {
AoESymmetrical.decreaseColumn(tag, defaultDefinition);
holder.markAsDirty();
}))
.widget(new ClickButtonWidget(50, 24, 20, 20, "+", data -> {
AoESymmetrical.increaseRow(tag, defaultDefinition);
holder.markAsDirty();
}))
.widget(new ClickButtonWidget(50, 44, 20, 20, "-", data -> {
AoESymmetrical.decreaseRow(tag, defaultDefinition);
holder.markAsDirty();
}))
.widget(new ClickButtonWidget(85, 24, 20, 20, "+", data -> {
AoESymmetrical.increaseLayer(tag, defaultDefinition);
holder.markAsDirty();
}))
.widget(new ClickButtonWidget(85, 44, 20, 20, "-", data -> {
AoESymmetrical.decreaseLayer(tag, defaultDefinition);
holder.markAsDirty();
}))
.widget(new DynamicLabelWidget(23, 65, () -> Integer.toString(
1 + 2 * AoESymmetrical.getColumn(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition))))
.widget(new DynamicLabelWidget(58, 65, () -> Integer.toString(
1 + 2 * AoESymmetrical.getRow(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition))))
.widget(new DynamicLabelWidget(93, 65,
() -> Integer.toString(1 +
AoESymmetrical.getLayer(getBehaviorsTag(holder.getCurrentItem()), defaultDefinition))))
.build(holder, entityPlayer);
@Override
default ModularPanel buildUI(HandGuiData guiData, PanelSyncManager manager) {
final var usedStack = guiData.getUsedItemStack();
final var behaviorsTag = getBehaviorsTag(usedStack);
final var defaultDefinition = getMaxAoEDefinition(usedStack);

var columnValue = new IntSyncValue(
() -> AoESymmetrical.getColumn(behaviorsTag, defaultDefinition),
i -> AoESymmetrical.setColumn(behaviorsTag, i, defaultDefinition));
var rowValue = new IntSyncValue(
() -> AoESymmetrical.getRow(behaviorsTag, defaultDefinition),
i -> AoESymmetrical.setRow(behaviorsTag, i, defaultDefinition));
var layerValue = new IntSyncValue(
() -> AoESymmetrical.getLayer(behaviorsTag, defaultDefinition),
i -> AoESymmetrical.setLayer(behaviorsTag, i, defaultDefinition));

manager.syncValue("row_value", rowValue);
manager.syncValue("column_value", columnValue);
manager.syncValue("layer_value", layerValue);

return GTGuis.createPanel(usedStack.getTranslationKey(), 120, 80)
.child(new Row()
.widthRel(1f)
.margin(4, 0)
.alignY(0.5f)
.coverChildrenHeight()
.mainAxisAlignment(Alignment.MainAxis.SPACE_BETWEEN)
.child(createColumn(columnValue, "columns", true, defaultDefinition.column))
.child(createColumn(rowValue, "rows", true, defaultDefinition.row))
.child(createColumn(layerValue, "layers", false, defaultDefinition.layer)));
}

default Column createColumn(IntSyncValue syncValue, String lang, boolean shouldDouble, int max) {
final var display = IKey.dynamic(
() -> String.valueOf(1 + (shouldDouble ? 2 * syncValue.getIntValue() : syncValue.getIntValue())));

IWidget increaseButton = new ButtonWidget<>()
.size(9, 18)
.background(GTGuiTextures.MC_BUTTON)
.overlay(GTGuiTextures.PLUS)
.disableHoverBackground()
.onMousePressed(data -> {
int val = syncValue.getIntValue();
if (val < max) syncValue.setIntValue(++val);
Interactable.playButtonClickSound();
return true;
});

IWidget decreaseButton = new ButtonWidget<>()
.size(9, 18)
.background(GTGuiTextures.MC_BUTTON)
.overlay(GTGuiTextures.MINUS)
.disableHoverBackground()
.onMousePressed(data -> {
int val = syncValue.getIntValue();
if (val > 0) syncValue.setIntValue(--val);
Interactable.playButtonClickSound();
return true;
});

return new Column()
.coverChildren()
.child(new TextWidget(IKey.lang("item.gt.tool.aoe." + lang))
.marginBottom(5))
.child(new Row()
.coverChildren()
.marginBottom(5)
.child(increaseButton)
.child(decreaseButton))
.child(new TextWidget(display)
.alignment(Alignment.Center)
.widthRel(1f));
}

Set<String> getToolClasses(ItemStack stack);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gregtech/api/items/toolitem/ItemGTHoe.java
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ public EnumActionResult onItemUse(@NotNull EntityPlayer player, @NotNull World w
@Override
public boolean hitEntity(@NotNull ItemStack stack, @NotNull EntityLivingBase target,
@NotNull EntityLivingBase attacker) {
getToolStats().getBehaviors().forEach(behavior -> behavior.hitEntity(stack, target, attacker));
getBehaviors(stack).forEach(behavior -> behavior.hitEntity(stack, target, attacker));
// damage by 1, as this is what vanilla does
ToolHelper.damageItem(stack, attacker, 1);
return true;
Expand Down
Loading
Loading