Skip to content

Commit 5035852

Browse files
authored
Fix duplicate output hatches when using HatchMIHookContext#registerHatches (#125)
1 parent 91dea4e commit 5035852

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/main/java/net/swedz/tesseract/neoforge/compat/mi/hook/context/listener/HatchMIHookContext.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,19 @@ public interface HatchModification<T>
4343
{
4444
void apply(T value, boolean input);
4545
}
46+
47+
@SafeVarargs
48+
private void registerHatch(String id, String englishName, String overlayFolder, MachineCasing casing,
49+
Consumer<BlockWithItemHolder<?, ?>> modifyBlock,
50+
Consumer<BlockBehaviour.Properties> overrideProperties,
51+
boolean defaultMineableTags,
52+
HatchFactory factory,
53+
boolean input,
54+
Consumer<BlockEntityType<?>>... extraRegistrators)
55+
{
56+
HackedMachineRegistrationHelper.registerMachine(hook, englishName, id, modifyBlock, overrideProperties, defaultMineableTags, (bep) -> factory.create(bep, input, hook.id(id)), extraRegistrators);
57+
HackedMachineRegistrationHelper.addMachineModel(hook, id, casing, overlayFolder, true, false, true, false);
58+
}
4659

4760
@SafeVarargs
4861
public final void registerHatch(String id, String englishName, String overlayFolder, MachineCasing casing,
@@ -52,8 +65,7 @@ public final void registerHatch(String id, String englishName, String overlayFol
5265
HatchFactory factory,
5366
Consumer<BlockEntityType<?>>... extraRegistrators)
5467
{
55-
HackedMachineRegistrationHelper.registerMachine(hook, englishName, id, modifyBlock, overrideProperties, defaultMineableTags, (bep) -> factory.create(bep, false, hook.id(id)), extraRegistrators);
56-
HackedMachineRegistrationHelper.addMachineModel(hook, id, casing, overlayFolder, true, false, true, false);
68+
registerHatch(id, englishName, overlayFolder, casing, modifyBlock, overrideProperties, defaultMineableTags, factory, false, extraRegistrators);
5769
}
5870

5971
@SafeVarargs
@@ -91,7 +103,7 @@ public final void registerHatches(String id, String englishName, String overlayF
91103
machineId, machineEnglishName, overlayFolder, casing,
92104
modifyBlock != null ? (holder) -> modifyBlock.apply(holder, input) : null,
93105
overrideProperties != null ? (properties) -> overrideProperties.apply(properties, input) : null,
94-
defaultMineableTags, factory, extraRegistrators
106+
defaultMineableTags, factory, input, extraRegistrators
95107
);
96108
}
97109
}

0 commit comments

Comments
 (0)