aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/github/romangraef/skyblockplayersanonymous/SPA.java (renamed from src/main/java/com/github/romangraef/skyblockplayersanonymous/ExampleMod.java)4
-rw-r--r--src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinGuiMainMenu.java16
-rw-r--r--src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinNetHandlerPlayClient.java22
-rw-r--r--src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinPlayerController.java31
4 files changed, 55 insertions, 18 deletions
diff --git a/src/main/java/com/github/romangraef/skyblockplayersanonymous/ExampleMod.java b/src/main/java/com/github/romangraef/skyblockplayersanonymous/SPA.java
index 7fe7102..dd3c780 100644
--- a/src/main/java/com/github/romangraef/skyblockplayersanonymous/ExampleMod.java
+++ b/src/main/java/com/github/romangraef/skyblockplayersanonymous/SPA.java
@@ -5,9 +5,9 @@ import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
@Mod(modid = "skyblockplayersanonymous", useMetadata=true)
-public class ExampleMod {
+public class SPA {
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
- System.out.println("Dirt: " + Blocks.dirt.getUnlocalizedName());
+
}
}
diff --git a/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinGuiMainMenu.java b/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinGuiMainMenu.java
deleted file mode 100644
index c42ad81..0000000
--- a/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinGuiMainMenu.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.github.romangraef.skyblockplayersanonymous.mixin;
-
-import net.minecraft.client.gui.GuiMainMenu;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-import org.spongepowered.asm.mixin.injection.Inject;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-
-@Mixin(GuiMainMenu.class)
-public class MixinGuiMainMenu {
-
- @Inject(method = "initGui", at = @At("HEAD"))
- public void onInitGui(CallbackInfo ci) {
- System.out.println("Hello from Main Menu!");
- }
-}
diff --git a/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinNetHandlerPlayClient.java b/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinNetHandlerPlayClient.java
new file mode 100644
index 0000000..2cc0a17
--- /dev/null
+++ b/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinNetHandlerPlayClient.java
@@ -0,0 +1,22 @@
+package com.github.romangraef.skyblockplayersanonymous.mixin;
+
+import net.minecraft.client.network.NetHandlerPlayClient;
+import net.minecraft.network.Packet;
+import net.minecraft.network.play.client.C01PacketChatMessage;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
+
+@Mixin(NetHandlerPlayClient.class)
+public class MixinNetHandlerPlayClient {
+ @Inject(method = "addToSendQueue", cancellable = true, at = @At("HEAD"))
+ public void onAddtoSendQueue(Packet p_147297_1_, CallbackInfo ci) {
+ if (p_147297_1_ instanceof C01PacketChatMessage) {
+ String message = ((C01PacketChatMessage) p_147297_1_).getMessage();
+ if (message != null && (message.equalsIgnoreCase("/play sb") || message.equalsIgnoreCase("/play skyblock") || message.equalsIgnoreCase("/skyblock"))) {
+ ci.cancel();
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinPlayerController.java b/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinPlayerController.java
new file mode 100644
index 0000000..5ed370d
--- /dev/null
+++ b/src/main/java/com/github/romangraef/skyblockplayersanonymous/mixin/MixinPlayerController.java
@@ -0,0 +1,31 @@
+package com.github.romangraef.skyblockplayersanonymous.mixin;
+
+import net.minecraft.client.multiplayer.PlayerControllerMP;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+@Mixin(PlayerControllerMP.class)
+public class MixinPlayerController {
+
+ @Inject(method = "windowClick", cancellable = true, at = @At("HEAD"))
+ public void onClick(int windowId, int slotId, int mouseButtonClicked, int mode, EntityPlayer playerIn, CallbackInfoReturnable<ItemStack> cir) {
+ if (playerIn == null || playerIn.openContainer == null) return;
+ Slot slot = playerIn.openContainer.getSlot(slotId);
+ if (slot == null) {
+ return;
+ }
+ ItemStack stack = slot.getStack();
+ if (stack == null) {
+ return;
+ }
+ if (stack.getItem() == Items.skull && stack.getDisplayName().startsWith("§aSkyBlock")) {
+ cir.setReturnValue(null);
+ }
+ }
+}