Skip to content

Commit

Permalink
move onProcessRightClickPost from mixin to forge event
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Jan 31, 2024
1 parent 8e10413 commit a01cb47
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
## Change
- update mafglib to `0.1.8`
- update mafglib to `0.1.8`
- move `onProcessRightClickPost` from mixin to forge event
5 changes: 5 additions & 0 deletions src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package fi.dy.masa.tweakeroo;

import fi.dy.masa.malilib.compat.forge.ForgePlatformUtils;
import fi.dy.masa.tweakeroo.compat.forge.ForgeEventHandler;
import fi.dy.masa.tweakeroo.gui.GuiConfigs;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
Expand All @@ -26,10 +28,13 @@ public Tweakeroo() {
public void onInitializeClient(FMLClientSetupEvent event) {
ForgePlatformUtils.getInstance().getClientModIgnoredServerOnly();
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());

ForgePlatformUtils.getInstance().getMod(Reference.MOD_ID).registerModConfigScreen((screen) -> {
GuiConfigs gui = new GuiConfigs();
gui.setParent(screen);
return gui;
});

MinecraftForge.EVENT_BUS.register(new ForgeEventHandler());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package fi.dy.masa.tweakeroo.compat.forge;

import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;

public class ForgeEventHandler {
@SubscribeEvent
public void onPlayerDestroyItem(PlayerDestroyItemEvent event) {
PlacementTweaks.onProcessRightClickPost(event.getEntity(), event.getHand());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ private void onProcessRightClickFirst(PlayerEntity player, Hand hand, CallbackIn
}
}

/* Broken with Forge, use `PlayerDestroyItemEvent` to impl
@Inject(method = "method_41929",
slice = @Slice(from = @At(value = "INVOKE",
target = "Lnet/minecraft/item/ItemStack;use(" +
Expand All @@ -61,6 +62,7 @@ private void onProcessRightClickPost(Hand hand, PlayerEntity playerEntity,
{
PlacementTweaks.onProcessRightClickPost(playerEntity, hand);
}
*/

@Inject(method = "interactEntity(" +
"Lnet/minecraft/entity/player/PlayerEntity;" +
Expand Down

0 comments on commit a01cb47

Please sign in to comment.