mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 13:53:07 +00:00
MORE SWAPPING
This commit is contained in:
1 parent
4f5f870e2b
commit
e8c3fc4d0a
14 files changed
+86
-67
No files matched your search
@@ -630,7 +630,7 @@ public class NoppesUtilPlayer {
|
||||
}
|
||||
|
||||
playerData.save();
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketUtil.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
if(quest.type == EnumQuestType.Item && partyOptions.objectiveRequirement == EnumPartyObjectives.Shared){
|
||||
|
||||
@@ -5,6 +5,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import kamkeel.npcs.controllers.SyncController;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumSoundOperation;
|
||||
import kamkeel.npcs.network.enums.EnumSyncAction;
|
||||
import kamkeel.npcs.network.enums.EnumSyncType;
|
||||
@@ -110,8 +111,8 @@ public class ServerEventsHandler {
|
||||
return;
|
||||
NoppesUtilServer.setEditingNpc(event.entityPlayer, (EntityNPCInterface)event.target);
|
||||
event.setCanceled(true);
|
||||
Server.sendData((EntityPlayerMP)event.entityPlayer, EnumPacketClient.GUI, EnumGuiType.Script.ordinal());
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
PacketUtil.openGUI((EntityPlayerMP)event.entityPlayer, EnumGuiType.Script, 0, 0, 0);
|
||||
if(ConfigDebug.PlayerLogging && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER){
|
||||
LogWriter.script(String.format("[%s] (Player) %s OPEN NPC %s (%s, %s, %s) [%s]", "SCRIPTER", event.entityPlayer.getCommandSenderName(), ((EntityNPCInterface)(event.target)).display.getName(), (int)(event.target).posX, (int)(event.target).posY, (int)(event.target).posZ, (event.target).worldObj.getWorldInfo().getWorldName()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package noppes.npcs.blocks;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
@@ -25,29 +27,29 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlockMailbox extends BlockContainer{
|
||||
|
||||
|
||||
public int renderId = -1;
|
||||
|
||||
public BlockMailbox() {
|
||||
super(Material.iron);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
par3List.add(new ItemStack(par1, 1, 0));
|
||||
par3List.add(new ItemStack(par1, 1, 1));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World par1World, int i, int j, int k, EntityPlayer player, int par6, float par7, float par8, float par9){
|
||||
if(!par1World.isRemote){
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.GUI, EnumGuiType.PlayerMailbox, i, j, k);
|
||||
PacketUtil.openGUI((EntityPlayerMP)player, EnumGuiType.PlayerMailbox, i, j, k);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
|
||||
{
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
@@ -56,40 +58,40 @@ public class BlockMailbox extends BlockContainer{
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public int damageDropped(int par1)
|
||||
{
|
||||
return par1 >> 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack)
|
||||
{
|
||||
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
l %= 4;
|
||||
|
||||
|
||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, l | par6ItemStack.getItemDamage() << 2, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean isOpaqueCube(){
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Override
|
||||
public boolean renderAsNormalBlock(){
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
return renderId;
|
||||
return renderId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int p_149691_1_, int p_149691_2_)
|
||||
|
||||
@@ -48,37 +48,6 @@ public class PacketHandlerClient extends PacketHandlerServer{
|
||||
MarkData data = MarkData.get((EntityNPCInterface) entity);
|
||||
data.setNBT(Server.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketClient.QUEST_COMPLETION){
|
||||
NoppesUtil.guiQuestCompletion(player, Server.readNBT(buffer));
|
||||
}
|
||||
else if(type == EnumPacketClient.UPDATE_NPC){
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId"));
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
((EntityNPCInterface)entity).readSpawnData(compound);
|
||||
}
|
||||
else if(type == EnumPacketClient.ROLE){
|
||||
NBTTagCompound compound = Server.readNBT(buffer);
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(compound.getInteger("EntityId"));
|
||||
if(entity == null || !(entity instanceof EntityNPCInterface))
|
||||
return;
|
||||
((EntityNPCInterface)entity).advanced.setRole(compound.getInteger("Role"));
|
||||
((EntityNPCInterface)entity).roleInterface.readFromNBT(compound);
|
||||
NoppesUtil.setLastNpc((EntityNPCInterface) entity);
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI){
|
||||
EnumGuiType gui = EnumGuiType.values()[buffer.readInt()];
|
||||
CustomNpcs.proxy.openGui(NoppesUtil.getLastNpc(), gui, buffer.readInt(), buffer.readInt(), buffer.readInt());
|
||||
}
|
||||
else if(type == EnumPacketClient.SCROLL_SELECTED){
|
||||
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
|
||||
if(gui == null || !(gui instanceof IScrollData))
|
||||
return;
|
||||
String selected = Server.readString(buffer);
|
||||
|
||||
((IScrollData)gui).setSelected(selected);
|
||||
}
|
||||
else if(type == EnumPacketClient.GUI_REDSTONE){
|
||||
NoppesUtil.saveRedstoneBlock(player, Server.readNBT(buffer));
|
||||
}
|
||||
|
||||
@@ -2,11 +2,6 @@ package
|
||||
noppes.npcs.constants;
|
||||
|
||||
public enum EnumPacketClient {
|
||||
QUEST_COMPLETION,
|
||||
UPDATE_NPC,
|
||||
ROLE,
|
||||
GUI,
|
||||
SCROLL_SELECTED,
|
||||
GUI_REDSTONE,
|
||||
GUI_WAYPOINT,
|
||||
GUI_DATA,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package noppes.npcs.controllers.data;
|
||||
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -139,7 +140,7 @@ public class Quest implements ICompatibilty, IQuest {
|
||||
|
||||
public boolean instantComplete(EntityPlayer player, QuestData data) {
|
||||
if(completion == EnumQuestCompletion.Instant && NoppesUtilPlayer.questCompletion((EntityPlayerMP) player, data.quest.id)){
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketUtil.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -8,9 +8,11 @@ import io.netty.buffer.ByteBuf;
|
||||
import kamkeel.npcs.addon.DBCAddon;
|
||||
import kamkeel.npcs.addon.client.DBCClient;
|
||||
import kamkeel.npcs.network.PacketHandler;
|
||||
import kamkeel.npcs.network.PacketUtil;
|
||||
import kamkeel.npcs.network.enums.EnumSoundOperation;
|
||||
import kamkeel.npcs.network.packets.client.ChatBubblePacket;
|
||||
import kamkeel.npcs.network.packets.client.SoundManagementPacket;
|
||||
import kamkeel.npcs.network.packets.client.npc.UpdateNpcPacket;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -411,8 +413,8 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
public void updateClient() {
|
||||
NBTTagCompound compound = writeSpawnData();
|
||||
compound.setInteger("EntityId", getEntityId());
|
||||
Server.sendAssociatedData(this, EnumPacketClient.UPDATE_NPC, compound);
|
||||
updateClient = false;
|
||||
PacketHandler.Instance.sendTracking(new UpdateNpcPacket(compound), this);
|
||||
updateClient = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -452,7 +454,7 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
|
||||
}
|
||||
else if (data != null){
|
||||
NoppesUtilPlayer.questCompletion((EntityPlayerMP) player, data.quest.id);
|
||||
Server.sendData((EntityPlayerMP)player, EnumPacketClient.QUEST_COMPLETION, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
PacketUtil.sendQuestComplete((EntityPlayerMP)player, data.quest.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
else if (dialog != null){
|
||||
NoppesUtilServer.openDialog(player, this, dialog, 0);
|
||||
|
||||
Reference in new issue
Block a user