mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 04:57:27 +00:00
Revert recipe overlay to achievement banner
This commit is contained in:
1 parent
62e11d8caa
commit
d05e28918d
3 files changed
+3
-21
No files matched your search
@@ -35,19 +35,13 @@ import noppes.npcs.scripted.event.*;
|
||||
import noppes.npcs.scripted.event.player.*;
|
||||
import noppes.npcs.scripted.event.player.PlayerEvent.*;
|
||||
import noppes.npcs.scripted.item.ScriptItemStack;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.packets.data.script.ScriptOverlayClosePacket;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.scripted.overlay.ScriptOverlay;
|
||||
import noppes.npcs.scripted.overlay.ScriptOverlayLabel;
|
||||
import kamkeel.npcs.network.packets.data.AchievementPacket;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class EventHooks {
|
||||
// Overlay id used for recipe pre-event banner messages
|
||||
public static final int RECIPE_OVERLAY_ID = 901;
|
||||
public EventHooks() {
|
||||
}
|
||||
|
||||
@@ -187,14 +181,8 @@ public class EventHooks {
|
||||
NpcAPI.EVENT_BUS.post(event);
|
||||
if (!player.worldObj.isRemote) {
|
||||
String msg = event.getMessage();
|
||||
if (msg == null) msg = "";
|
||||
if (!msg.isEmpty()) {
|
||||
ScriptOverlay overlay = new ScriptOverlay(RECIPE_OVERLAY_ID);
|
||||
ScriptOverlayLabel lbl = (ScriptOverlayLabel) overlay.addLabel(0, msg, 0, 5, 200, 20);
|
||||
lbl.setAlignment(1);
|
||||
CustomGuiController.openOverlay(NoppesUtilServer.getIPlayer(player), overlay);
|
||||
} else {
|
||||
PacketHandler.Instance.sendToPlayer(new ScriptOverlayClosePacket(RECIPE_OVERLAY_ID), (EntityPlayerMP) player);
|
||||
if (msg != null && !msg.isEmpty()) {
|
||||
AchievementPacket.sendAchievement((EntityPlayerMP) player, false, "", msg);
|
||||
}
|
||||
}
|
||||
return event;
|
||||
|
||||
@@ -11,8 +11,6 @@ import noppes.npcs.api.handler.data.IAnvilRecipe;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.data.RecipeAnvil;
|
||||
import noppes.npcs.scripted.event.RecipeScriptEvent;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.packets.data.script.ScriptOverlayClosePacket;
|
||||
|
||||
public class ContainerAnvilRepair extends Container {
|
||||
// A 2-slot crafting matrix: slot 0 = damaged item, slot 1 = repair material.
|
||||
@@ -214,7 +212,6 @@ public class ContainerAnvilRepair extends Container {
|
||||
public void onContainerClosed(EntityPlayer player) {
|
||||
super.onContainerClosed(player);
|
||||
if (!this.worldObj.isRemote) {
|
||||
PacketHandler.Instance.sendToPlayer(new ScriptOverlayClosePacket(EventHooks.RECIPE_OVERLAY_ID), (EntityPlayerMP) player);
|
||||
for (int i = 0; i < this.anvilMatrix.getSizeInventory(); i++) {
|
||||
ItemStack stack = this.anvilMatrix.getStackInSlotOnClosing(i);
|
||||
if (stack != null) {
|
||||
|
||||
@@ -9,8 +9,6 @@ import net.minecraft.network.play.server.S2FPacketSetSlot;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.CustomItems;
|
||||
import noppes.npcs.EventHooks;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.packets.data.script.ScriptOverlayClosePacket;
|
||||
import noppes.npcs.scripted.event.RecipeScriptEvent;
|
||||
import noppes.npcs.controllers.RecipeController;
|
||||
import noppes.npcs.controllers.data.RecipeCarpentry;
|
||||
@@ -104,7 +102,6 @@ public class ContainerCarpentryBench extends Container {
|
||||
super.onContainerClosed(par1EntityPlayer);
|
||||
|
||||
if (!this.worldObj.isRemote) {
|
||||
PacketHandler.Instance.sendToPlayer(new ScriptOverlayClosePacket(EventHooks.RECIPE_OVERLAY_ID), (EntityPlayerMP) par1EntityPlayer);
|
||||
for (int var2 = 0; var2 < 16; ++var2) {
|
||||
ItemStack var3 = this.craftMatrix.getStackInSlotOnClosing(var2);
|
||||
|
||||
|
||||
Reference in new issue
Block a user