Skip to content

Commit 774c01a

Browse files
committed
remove omnitool functionality from omni-breaker -- was honestly too finicky to deal with
1 parent 4e642ef commit 774c01a

6 files changed

Lines changed: 13 additions & 158 deletions

File tree

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ A GregTech Modern addon, adding some nice quality-of-life features.
44
Current features:
55

66
* A Sterile Cleaning Maintenance Hatch
7-
* An omni-breaker, a tool that can break anything instantly and combines multiple GregTech tools into one
8-
* Swappable by shift-right-clicking the air, the current mode is displayed on the tooltip (tool switching developed by Kolatra)
7+
* An omni-breaker, a tool that can break anything instantly like a modern Vajra
98
* 64A Energy Converters
10-
* The Power Transfer Einstein-Rosen Bridge (PTERB), a wireless version of the Active Transformer
11-
* Has an opt-in coolant system, where the PTERB requires coolant to be used, or it'll explode (or just stop if GTm is set to have harmless active transformers)
9+
* The Wireless Active Transformer (WAT)
10+
* Has an opt-in coolant system, where the WAT requires coolant to be used, or it'll explode (or just stop if GTm is set to have harmless active transformers)
1211

1312
All features can be enabled or disabled in the config.
1413

1514
While this mod was originally created for Monifactory, feel free to use it in any GregTech modpack you like!
1615

17-
All features (except for the sterile cleaning hatch and optional coolant for the PTERB) have default recipes.
16+
All features (except for the sterile cleaning hatch and optional coolant for the WAT) have default recipes.
1817
Feel free to change recipes in your own pack!
1918

2019
## License

changelog.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
# GregTech Modern Utilities version 2.0.0
22

3-
* Fix terminal problems (as much as possible) and remove warning about building PTERB with terminal
3+
* Port to GTM 7.0.0
4+
* Make omni-breaker teleport drops to player on right-click

src/main/java/net/neganote/gtutilities/common/item/OmniBreakerItem.java

Lines changed: 1 addition & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22

33
import com.gregtechceu.gtceu.api.GTValues;
44
import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper;
5-
import com.gregtechceu.gtceu.api.data.chemical.material.Material;
65
import com.gregtechceu.gtceu.api.item.ComponentItem;
7-
import com.gregtechceu.gtceu.api.item.IGTTool;
8-
import com.gregtechceu.gtceu.api.item.tool.GTToolType;
9-
import com.gregtechceu.gtceu.api.item.tool.IGTToolDefinition;
10-
import com.gregtechceu.gtceu.api.item.tool.ToolDefinitionBuilder;
11-
import com.gregtechceu.gtceu.api.sound.SoundEntry;
12-
import com.gregtechceu.gtceu.common.data.GTMaterials;
136

147
import net.minecraft.ChatFormatting;
158
import net.minecraft.core.BlockPos;
@@ -26,15 +19,13 @@
2619
import org.jetbrains.annotations.NotNull;
2720
import org.jetbrains.annotations.Nullable;
2821

29-
import java.util.HashSet;
3022
import java.util.List;
3123
import java.util.Objects;
32-
import java.util.Set;
3324

3425
import javax.annotation.ParametersAreNonnullByDefault;
3526

3627
@ParametersAreNonnullByDefault
37-
public class OmniBreakerItem extends ComponentItem implements IGTTool {
28+
public class OmniBreakerItem extends ComponentItem {
3829

3930
protected int tier;
4031

@@ -120,85 +111,7 @@ public void appendHoverText(@NotNull ItemStack stack, @Nullable Level level,
120111
.add(Component.translatable("tooltip.omnibreaker.can_break_anything").withStyle(ChatFormatting.GRAY));
121112
tooltipComponents
122113
.add(Component.translatable("tooltip.omnibreaker.right_click_function").withStyle(ChatFormatting.GRAY));
123-
tooltipComponents
124-
.add(Component.translatable("tooltip.omnibreaker.swappable_tools").withStyle(ChatFormatting.GRAY));
125-
126-
var nbt = stack.getOrCreateTag();
127-
var mode = nbt.getByte("OmniModeTag");
128114

129-
tooltipComponents
130-
.add(Component.translatable("tooltip.omnibreaker.tool_mode", getToolMode(mode))
131-
.withStyle(ChatFormatting.GRAY));
132115
super.appendHoverText(stack, level, tooltipComponents, isAdvanced);
133116
}
134-
135-
protected static Component getToolMode(int mode) {
136-
return switch (mode) {
137-
case 1 -> Component.translatable("tooltip.omnibreaker.tool_mode_1");
138-
case 2 -> Component.translatable("tooltip.omnibreaker.tool_mode_2");
139-
case 3 -> Component.translatable("tooltip.omnibreaker.tool_mode_3");
140-
case 4 -> Component.translatable("tooltip.omnibreaker.tool_mode_4");
141-
default -> Component.translatable("tooltip.omnibreaker.tool_mode_0");
142-
};
143-
}
144-
145-
@Override
146-
public GTToolType getToolType() {
147-
return GTToolType.builder("Meowni").build();
148-
}
149-
150-
@Override
151-
public Set<GTToolType> getToolClasses(ItemStack stack) {
152-
Set<GTToolType> set = new HashSet<>();
153-
var compound = stack.getOrCreateTag();
154-
if (!compound.contains("OmniModeTag")) {
155-
compound.putByte("OmniModeTag", (byte) 0);
156-
}
157-
if (!compound.contains("Unbreakable")) {
158-
compound.putBoolean("Unbreakable", true);
159-
}
160-
var mode = compound.getByte("OmniModeTag");
161-
162-
if (mode == 1) {
163-
set.add(GTToolType.WRENCH);
164-
} else if (mode == 2) {
165-
set.add(GTToolType.SCREWDRIVER);
166-
} else if (mode == 3) {
167-
set.add(GTToolType.WIRE_CUTTER);
168-
} else if (mode == 4) {
169-
set.add(GTToolType.CROWBAR);
170-
}
171-
172-
return set;
173-
}
174-
175-
@Override
176-
public Material getMaterial() {
177-
return GTMaterials.Neutronium;
178-
}
179-
180-
@Override
181-
public boolean isElectric() {
182-
return true;
183-
}
184-
185-
@Override
186-
public int getElectricTier() {
187-
return tier;
188-
}
189-
190-
@Override
191-
public IGTToolDefinition getToolStats() {
192-
return new ToolDefinitionBuilder().build();
193-
}
194-
195-
@Override
196-
public @Nullable SoundEntry getSound() {
197-
return null;
198-
}
199-
200-
@Override
201-
public boolean playSoundOnBlockDestroy() {
202-
return true;
203-
}
204117
}

src/main/java/net/neganote/gtutilities/common/item/PrecisionBreakBehavior.java

Lines changed: 1 addition & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
package net.neganote.gtutilities.common.item;
22

33
import com.gregtechceu.gtceu.api.GTValues;
4-
import com.gregtechceu.gtceu.api.blockentity.MetaMachineBlockEntity;
54
import com.gregtechceu.gtceu.api.capability.GTCapabilityHelper;
6-
import com.gregtechceu.gtceu.api.capability.IToolable;
75
import com.gregtechceu.gtceu.api.item.component.IInteractionItem;
86

9-
import net.minecraft.ChatFormatting;
107
import net.minecraft.core.BlockPos;
11-
import net.minecraft.nbt.CompoundTag;
12-
import net.minecraft.network.chat.Component;
138
import net.minecraft.server.level.ServerLevel;
14-
import net.minecraft.world.InteractionHand;
159
import net.minecraft.world.InteractionResult;
16-
import net.minecraft.world.InteractionResultHolder;
17-
import net.minecraft.world.entity.player.Player;
18-
import net.minecraft.world.item.Item;
19-
import net.minecraft.world.item.ItemStack;
2010
import net.minecraft.world.item.context.UseOnContext;
2111
import net.minecraft.world.item.enchantment.Enchantments;
2212
import net.minecraft.world.level.Level;
@@ -32,34 +22,6 @@ public PrecisionBreakBehavior(int tier) {
3222
this.tier = tier;
3323
}
3424

35-
@Override
36-
public InteractionResultHolder<ItemStack> use(Item item, Level level, Player player, InteractionHand usedHand) {
37-
if (player.isShiftKeyDown()) {
38-
var stack = player.getItemInHand(usedHand);
39-
var compound = stack.getOrCreateTag();
40-
41-
if (!compound.contains("OmniModeTag")) {
42-
compound.putInt("OmniModeTag", 0);
43-
}
44-
45-
var currentMode = compound.getInt("OmniModeTag");
46-
currentMode += 1;
47-
if (currentMode > 4) {
48-
currentMode = 0;
49-
}
50-
51-
compound.putInt("OmniModeTag", currentMode);
52-
stack.setTag(compound);
53-
54-
player.displayClientMessage(
55-
Component.translatable("tooltip.omnibreaker.tool_mode", OmniBreakerItem.getToolMode(currentMode))
56-
.withStyle(ChatFormatting.WHITE),
57-
true);
58-
}
59-
60-
return IInteractionItem.super.use(item, level, player, usedHand);
61-
}
62-
6325
@Override
6426
public InteractionResult useOn(UseOnContext context) {
6527
Level level = context.getLevel();
@@ -74,10 +36,6 @@ public InteractionResult useOn(UseOnContext context) {
7436
return InteractionResult.PASS;
7537
}
7638

77-
CompoundTag tag = itemStack.getTag();
78-
assert tag != null;
79-
byte omniModeTag = tag.getByte("OmniModeTag");
80-
8139
int unbreaking = context.getItemInHand().getItem().getAllEnchantments(itemStack)
8240
.getOrDefault(Enchantments.UNBREAKING, 0);
8341
double chance = 1.0 / (unbreaking + 1);
@@ -91,25 +49,7 @@ public InteractionResult useOn(UseOnContext context) {
9149
return InteractionResult.PASS;
9250
}
9351

94-
if (omniModeTag > 0) {
95-
var be = level.getBlockEntity(context.getClickedPos());
96-
var item = (OmniBreakerItem) itemStack.getItem();
97-
var set = item.getToolClasses(itemStack);
98-
99-
InteractionResult toolResult;
100-
if (be instanceof IToolable toolable) {
101-
toolResult = toolable.onToolClick(set, itemStack, context).getSecond();
102-
} else if (be instanceof MetaMachineBlockEntity mmbe) {
103-
toolResult = mmbe.getMetaMachine().onToolClick(set, itemStack, context).getSecond();
104-
} else {
105-
return InteractionResult.PASS;
106-
}
107-
108-
if (toolResult.consumesAction() && !level.isClientSide() && rand <= chance) {
109-
electricItem.discharge(GTValues.V[tier], tier, true, false, false);
110-
}
111-
return toolResult;
112-
} else if (!level.isClientSide()) {
52+
if (!level.isClientSide()) {
11353
var drops = getDrops(blockState, (ServerLevel) level, pos, level.getBlockEntity(pos));
11454
var player = context.getPlayer();
11555
assert player != null;

src/main/java/net/neganote/gtutilities/common/machine/UtilMachines.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ public class UtilMachines {
6161
.translatable(CleanroomType.STERILE_CLEANROOM.getTranslationKey())
6262
.withStyle(ChatFormatting.GREEN))))
6363
.tier(UHV)
64-
.overlayTieredHullModel(GregTechModernUtilities.id("block/machine/part/sterile_cleaning_maintenance_hatch"))
64+
.overlayTieredHullModel(
65+
GregTechModernUtilities.id("block/machine/part/sterile_cleaning_maintenance_hatch"))
6566
// Tier can always be changed later
6667
.register();
6768
}
@@ -161,7 +162,8 @@ public static MachineDefinition[] registerTieredMachines(String name,
161162
.where('C', controller(blocks(definition.getBlock())))
162163
.where('F', frames(GTMaterials.Neutronium))
163164
.build())
164-
.workableCasingModel(GTCEu.id("block/casings/solid/machine_casing_palladium_substation"), GTCEu.id("block/multiblock/data_bank"))
165+
.workableCasingModel(GTCEu.id("block/casings/solid/machine_casing_palladium_substation"),
166+
GTCEu.id("block/multiblock/data_bank"))
165167
.allowExtendedFacing(true)
166168
.hasBER(true)
167169
.register();

src/main/java/net/neganote/gtutilities/config/UtilConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static class FeatureConfigs {
2929

3030
@Configurable
3131
@Configurable.Comment({ "Whether the Sterile Cleaning Maintenance Hatch is enabled." })
32-
public boolean sterileHatchEnabled = true;
32+
public boolean sterileHatchEnabled = false;
3333
@Configurable
3434
@Configurable.Comment({ "Whether the 64A energy converters are enabled." })
3535
public boolean converters64aEnabled = true;

0 commit comments

Comments
 (0)