Everything posted by Izzy Axel
-
[1.7.10] Packet Won't Send To Server
Oh, so I need to override that function in both proxies...that's a little weird, but it works.
-
[1.7.10] Packet Won't Send To Server
So, you just can't make a real explosion with packets on SSP then, because it'll always be received by the client proxy, and just play the sound effect and particles but won't do block damage or hurt anything?
-
[1.7.10] Packet Won't Send To Server
I'm trying to send a packet from my test GUI button to the server to make an explosion, but no matter what I do, the function is always being run on clientproxy, which is odd because I followed the same process I used to do it elsewhere. I did try moving the sending to an item right click so it could be wrapped with world.isRemote easily, but that didn't help. Pretty sure I missed something simple, but I'm not seeing it. Main Message GUI commonProxy serverProxy clientProxy
-
[1.7.10] ISpecialArmor Issues
Nobody? Nothing?
-
[UNSOLVED] 2 weird problems with custom chestplate
I'm not entirely sure from looking at those classes, but what happened to me before , when setting damage from NBT on an itemstack was, I was gating it so it only occurred on the client, and as soon as the server resynced with the client, it would go back to the server side damage value, since the server is responsible for keeping track of most things, and syncing them to the client. May be a similar issue with how you return the method if the side is on the server at the beginning of the ArmorHandler class.
-
[Solved] My Mod Works for Me But Not For A Friend
This looks like it's the issue: java.lang.NoSuchMethodError: java.util.Map.replace(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; at com.tetra.skyrimmod.entity.player.extended.ExtendedPlayer.loadNBTData(ExtendedPlayer.java:179) ~[ExtendedPlayer.class:?] at com.tetra.skyrimmod.network.messages.MessageSyncPlayerProps$Handler.onMessage(MessageSyncPlayerProps.java:47) ~[MessageSyncPlayerProps$Handler.class:?] at com.tetra.skyrimmod.network.messages.MessageSyncPlayerProps$Handler.onMessage(MessageSyncPlayerProps.java:40) ~[MessageSyncPlayerProps$Handler.class:?] Something about your packets and ExtendedPlayer is screwy. You should post the relevant classes.
-
[1.7.10] ISpecialArmor Issues
I just merged my armor (which implements ISpecialArmor) from 4 classes to 1, and I'm having 3 issues with it now. First, I can't figure out what I need to change to alter the armor points it gives you; when it was 4 classes, it didn't give you any, and now it gives you 3 full icons for some reason, but nothing I change affects the points. Second, I set it up to spawn particles when the wearer is hit at night, and merging it into 1 class broke this. No clue why. Third, I added step-up capabilities to the armor when the full set is worn, but even though player.stepHeight is being set correctly every time in every situation, I get no step-up capability. PS, related to #2, the only vanilla particles that will show up for me when I try to spawn particles myself are the explosion varieties, why is this? Armor public class ItemMithrilArmor extends ItemArmor implements ISpecialArmor { private String texturePath = Reference.MODID + ":" + "textures/models/armor/"; public ItemMithrilArmor(String name, ArmorMaterial armormat, int renderIndex, int slot) { super(armormat, renderIndex, slot); setUnlocalizedName(name); setTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5)); setMaxStackSize(1); setCreativeTab(AACreativeTab.aaTab); MinecraftForge.EVENT_BUS.register(this); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { return slot == 2 ? Reference.MODID + ":textures/models/armor/mithrilArmor_layer_2.png" : Reference.MODID + ":textures/models/armor/mithrilArmor_layer_1.png"; } @Override public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { this.setDamage(stack, this.getDamage(stack) + damage); } @Override public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) { WorldServer overworldInst = null; if(!player.worldObj.isRemote) { overworldInst = MinecraftServer.getServer().worldServers[0]; } ArmorProperties mithArmor = null; if(overworldInst != null) { switch(slot) { case 0: mithArmor = new ArmorProperties(1, 1D, 2); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 8; } else { mithArmor.AbsorbMax = 2; } return mithArmor; case 1: mithArmor = new ArmorProperties(4, 1D, 4); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 16; } else { mithArmor.AbsorbMax = 4; } return mithArmor; case 2: mithArmor = new ArmorProperties(3, 1D, 3); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 12; } else { mithArmor.AbsorbMax = 3; } return mithArmor; case 3: mithArmor = new ArmorProperties(2, 1D, 2); if(!overworldInst.isDaytime()) { mithArmor.AbsorbMax = 8; } else { mithArmor.AbsorbMax = 2; } return mithArmor; default: mithArmor = new ArmorProperties(0, 0, 0); } } return mithArmor; } @Override public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { return slot; } @Override public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { if(player.getEquipmentInSlot(1) != null && player.getEquipmentInSlot(2) != null && player.getEquipmentInSlot(3) != null && player.getEquipmentInSlot(4) != null) { if(player.getEquipmentInSlot(1).getItem() instanceof ItemMithrilArmor && player.getEquipmentInSlot(2).getItem() instanceof ItemMithrilArmor && player.getEquipmentInSlot(3).getItem() instanceof ItemMithrilArmor && player.getEquipmentInSlot(4).getItem() instanceof ItemMithrilArmor) { if(!world.isDaytime()) { player.addPotionEffect(new PotionEffect(Potion.moveSpeed.getId(), 0, 1)); player.addPotionEffect(new PotionEffect(Potion.jump.getId(), 0, 1)); if(!player.isSneaking()) { if(player.stepHeight == 0.5F) { player.stepHeight = 1F; System.out.println(player.stepHeight); } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } else { if(player.stepHeight == 1F) { player.stepHeight = 0.5F; System.out.println(player.stepHeight); } } } @SubscribeEvent(receiveCanceled = true) public void reduceDurability(LivingHurtEvent event) { EntityLivingBase player = event.entityLiving; if(player instanceof EntityPlayer) { for (int i = 1; i < 5; ++i) { if(player.getEquipmentInSlot(i) != null) { Item entArmor = player.getEquipmentInSlot(i).getItem(); ItemStack entArmorStack = player.getEquipmentInSlot(i); if(entArmor instanceof ItemMithrilArmor) { if(player.dimension == 0 && !event.entityLiving.worldObj.isDaytime()) { ArcaneArtificing.snw.sendToAllAround(new MessageMithrilArmorParticles(i - 1, player.getEntityId()), new TargetPoint(player.dimension, player.posX, player.posY, player.posZ, 40)); ArcaneArtificing.snw.sendTo(new MessageMithrilArmorParticles(i - 1, player.getEntityId()), (EntityPlayerMP)player); } damageArmor(player, entArmorStack, event.source, (int)event.ammount, i); } } } } } } Creation of Armor public static ArmorMaterial mithrilAM = EnumHelper.addArmorMaterial("MithrilAM", 2456, new int[]{4, 8, 6, 4}, -1); public static Item mithrilHelmet; public static Item mithrilChestplate; public static Item mithrilLeggings; public static Item mithrilBoots; mithrilHelmet = new ItemMithrilArmor("mithrilHelmet", mithrilAM, 0, 0); RegisterHelper.registerItem(mithrilHelmet); mithrilChestplate = new ItemMithrilArmor("mithrilChestplate", mithrilAM, 0, 1); RegisterHelper.registerItem(mithrilChestplate); mithrilLeggings = new ItemMithrilArmor("mithrilLeggings", mithrilAM, 0, 2); RegisterHelper.registerItem(mithrilLeggings); mithrilBoots = new ItemMithrilArmor("mithrilBoots", mithrilAM, 0, 3); RegisterHelper.registerItem(mithrilBoots); Message/Handler public class MessageMithrilArmorParticles implements IMessage { public static int armorID; public static int playerID; public MessageMithrilArmorParticles(){} public MessageMithrilArmorParticles(int i, int p) { this.armorID = i; this.playerID = p; } @Override public void fromBytes(ByteBuf buf) { this.armorID = buf.readInt(); this.playerID = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(armorID); buf.writeInt(playerID); } public static class MessageMithrilArmorParticlesHandler implements IMessageHandler<MessageMithrilArmorParticles, IMessage> { @Override public IMessage onMessage(MessageMithrilArmorParticles message, MessageContext ctx) { ArcaneArtificing.proxy.doMithrilArmorParticles(message.armorID, message.playerID); return null; } } } ClientProxy @Override public void doMithrilArmorParticles(int armorID, int playerID) { if(Minecraft.getMinecraft().theWorld.getEntityByID(playerID) != null && Minecraft.getMinecraft().theWorld.getEntityByID(playerID) instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().theWorld.getEntityByID(playerID); switch(armorID) { case 0: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; case 1: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; case 2: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; case 3: player.worldObj.spawnParticle("largeexplode", player.posX, player.posY + 1, player.posZ, 2D, 2D, 2D); break; } } }
-
[1.7.10] Help
That's a small amount of info to go off of, best guess is the itemWand variable you're trying to initialize doesn't exist. You'll need to post more of the relevant code, and say what the error is, or people won't be able to help you very effectively.
-
[1.7.10] Prevent Item in Hand From "Bouncing" When Durability Changes?
The constant bouncing (item in hand moving up and down) when using durability as a timer is pretty annoying and looks bad, is there a way to keep it from doing this? This applies to most of the items I'm making, so here's an example of one of the item classes that needs it: public class ItemAirTalisman extends ItemArcaneArtifact { IIcon[] icons; public ItemAirTalisman() { super(); setUnlocalizedName("airTalisman"); setTextureName(Reference.MODID + ":" + getUnlocalizedName().substring(5)); setMaxStackSize(1); setMaxDamage(512); } @Override public void registerIcons(IIconRegister iconRegister) { icons = new IIcon[512]; for(int i = 0; i < icons.length; i++) { icons[i] = iconRegister.registerIcon(Reference.MODID + ":" + (this.getUnlocalizedName().substring(5)) + i); } } @Override public IIcon getIconFromDamage(int index) { return icons[index]; } @Override public void onCreated(ItemStack stack, World world, EntityPlayer player) { if(!NBTHelper.hasNBT(stack)) { NBTHelper.initNBT(stack); NBTHelper.setInt(stack, "Damage", 0); NBTHelper.setBool(stack, "Active", false); NBTHelper.setBool(stack, "Recharging", false); NBTHelper.setBool(stack, "Used", false); } } @Override public void onUpdate(ItemStack stack, World world, Entity player, int slot, boolean hahanope) { if(!NBTHelper.hasNBT(stack)) { NBTHelper.initNBT(stack); NBTHelper.setInt(stack, "Damage", 0); NBTHelper.setBool(stack, "Active", false); NBTHelper.setBool(stack, "Recharging", false); NBTHelper.setBool(stack, "Used", false); } if(NBTHelper.hasNBT(stack)) { if(player.isInWater()) { NBTHelper.setBool(stack, "Active", true); } else { NBTHelper.setBool(stack, "Active", false); } if(NBTHelper.getBool(stack, "Active") && !NBTHelper.getBool(stack, "Recharging") && !NBTHelper.getBool(stack, "Used") && NBTHelper.getInt(stack, "Damage") < this.getMaxDamage() - 2) { NBTHelper.setBool(stack, "Recharging", false); NBTHelper.incrementIntSetDamage(stack, "Damage"); player.setAir(300); } else if(NBTHelper.getInt(stack, "Damage") > 0 && !NBTHelper.getBool(stack, "Active")) { NBTHelper.decrementIntSetDamage(stack, "Damage"); } if(NBTHelper.getInt(stack, "Damage") == 0) { NBTHelper.setBool(stack, "Used", false); NBTHelper.setBool(stack, "Recharging", false); } if(!NBTHelper.getBool(stack, "Used") && NBTHelper.getInt(stack, "Damage") > this.getMaxDamage() - 12) { NBTHelper.setBool(stack, "Used", true); } NBTHelper.boundMin(stack, "Damage"); NBTHelper.boundMax(stack, "Damage", this.getMaxDamage() - 1); } }}
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
1. The server doesn't know about the clients keyboard, so the message has to be sent to the client for it to handle the checking of said keyboard. It's also gated to only send on the server side. 2. --stack.stackSize leaves the player with a phantom item in their inventory, you have to right click with it, pick it up in the inventory, try to drop it, try to use it, or break a block with it for it to disappear, so I always set the slots contents to null to graphically remove it immediately. And this works now, assuming this is what you meant for me to do: Flight Talisman MessageKeys ClientProxy ExtendedPlayer ServerProxy MessageFly
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Flight Talisman Message/Handler ClientProxy ExtendedPlayer NBTHelper
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Ok, so last 2 issues, the raytracing is only working on a dedicated server, and on my normal server, the flight talisman regains all of its durability when you open an Ender Pouch, change Mystcraft ages, or dimensions. Anyone know what either of those are about or how to fix them? The durability issue seems like an interaction bug with one of the mods on the server, because it doesnt happen on a clean server, or a server running in the dev environment.
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
What's LogHelper? Also, clarification, I was referring to it crashing on a dedicated server after putting in the isFlightAllowed check, so putting in the isDedicatedServer check before it doesn't solve the crash. Didn't see your edit before posting, added the isRemote check, and it works fine now.
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
That aside, there's 2 more things that aren't working. Most important is, how do you properly check if the server allows flight? I put if(MinecraftServer.getServer().isFlightAllowed()) in as a check before sending the packet, and this causes a crash with no error beyond the "a client unexpectedly left" one. Second is, the raytracing doesn't work at all on SSP, is there a solution that works on either an integrated or dedicated server?
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
No, I didn't see that. <_< PS. Is there a more accurate way to do this? It doesn't detect the block half the time when you're pointing right at it, which makes it very frustrating to use.
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
@Override public void breakBlockST(EntityPlayer player) { System.out.println("break block ST"); Vec3 vector1 = Vec3.createVectorHelper(player.posX, player.posY, player.posZ); Vec3 vector2 = Vec3.createVectorHelper(player.posX + (player.getLookVec().xCoord * 4), player.posY + (player.getLookVec().yCoord * 4), player.posZ + (player.getLookVec().zCoord * 4)); MovingObjectPosition mop = player.worldObj.rayTraceBlocks(vector1, vector2); int blockX = mop.blockX; int blockY = mop.blockY; int blockZ = mop.blockZ; Block targetBlock = player.worldObj.getBlock(blockX, blockY, blockZ); System.out.println(targetBlock + " " + blockX + " " + blockY + " " + blockZ); if(targetBlock instanceof BlockOre || targetBlock instanceof BlockRedstoneOre || targetBlock instanceof BlockModOre) { player.worldObj.spawnEntityInWorld(new EntityItem(player.worldObj, blockX, blockY, blockZ, new ItemStack(targetBlock))); player.worldObj.playAuxSFX(2001, blockX, blockY, blockZ, targetBlock.getIdFromBlock(targetBlock)); player.worldObj.setBlockToAir(blockX, blockY, blockZ); if(player.inventory.getCurrentItem() != null) { //--player.inventory.getCurrentItem().stackSize; //player.inventory.setInventorySlotContents(player.inventory.currentItem, null); } } } That's in ServerProxy, and running on a server, it detects the block below the player instead of where the player's aiming, it does break the block below the player correctly if it's an ore, and if the player's looking anywhere but relatively downward when you right click, it crashes on a NPE thrown at: int blockX = mop.blockX; PS just check out SSP, it doesn't work at all, doesn't call the method in the ServerProxy.
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Ok, but raytracing needs to be done on the client, so how am I going to manage that? Is there a server side way to get the block a player is looking at within a range?
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Anyone know why the methods in the client proxy aren't working? What am I missing?
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Ok, I fixed that, and cleaned everything up, and added logging. The message is being received, but it's not executing the method in the proxy like I told it to in onMessage, and I can't figure out why. It seems client/server related again, but I don't know what to do about it. Item Message ClientProxy Main EDIT: No wait, it's not being received...wth is going on here? EDIT 2: Through some witchcraft that left my code identical to the way it was before, the message is being received now, but it's running the CommonProxy methods, instead of the overridden methods in ClientProxy. Is there something else I'm missing?
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Wait wait wait...is world.isRemote client side? I thought it was server...if that's actually client, that could explain a lot of the issues I've had with this. <__> I thought I was saying that the mode checking and sending should only run on client side in there when I put !world.isRemote...
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
It would seem there's an issue with the packet sending on dedicated servers. To make sure it wasn't any of the non-packet stuff that was causing it, I added packets to another item that needs them, but doesn't need IEEP or anything fancy, and it's giving the same error that the flight talisman is giving. It seems like it's something obvious I'm overlooking Error Log Item Message ClientProxy Main
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Ok, so hows this? If that's how I want to do it, the only thing I need to know how to do is register IEEPs. FlightTalisman MessageKeys CommonProxy ClientProxy Main
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Thanks coolAlias, nobodies explicitly said that in any of the tutorials I've seen, and it was an easily overlooked detail when you aren't looking for it while going through repos for other mods. Brandon3055: though easier, that defeats the purpose here, puts off learning how to use packets for key handling, (procrastination is never a good thing) and I gave it jetpack type flight for balance anyway. Also the potion would add the potion effect to the inventory GUI, which is sloppy/undesirable imo. It can also be removed by one of my other talismans.
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Ok, then how do I use proxies?
-
[1.7.10] Get Player's Capabilities In OnUpdate & Key Handling With Packets
Ok...so I made this in ClientProxy: public static boolean spaceDown(World world) { if(!world.isRemote) { KeyHandler keyHandler = new KeyHandler(); if(FMLClientHandler.instance().getClient().inGameHasFocus && keyHandler.isKeyPressed(Keyboard.KEY_SPACE)) { return true; } else { return false; } } else { return false; } } This is what the onUpdate in the flight talisman class looks like now: @Override public void onUpdate(ItemStack stack, World world, Entity player, int slot, boolean p_77663_5_) { if(stack.stackTagCompound == null) { stack.stackTagCompound = new NBTTagCompound(); stack.stackTagCompound.setInteger("Damage", 0); stack.stackTagCompound.setBoolean("Holding Space", false); } if(stack.stackTagCompound != null) { if(ClientProxy.spaceDown(world)) { ArcaneArtificing.snw.sendToServer(new FlyMessage(1)); if(player.posY < Reference.HEIGHTLIMIT) { stack.stackTagCompound.setInteger("Damage", stack.stackTagCompound.getInteger("Damage") + 1); stack.setItemDamage(stack.stackTagCompound.getInteger("Damage")); if(stack.stackTagCompound.getInteger("Damage") > 100000) { stack.stackTagCompound.setInteger("Damage", 100000); stack.setItemDamage(stack.stackTagCompound.getInteger("Damage")); } player.motionY += Reference.TERMINAL * Reference.THRUST; if(player.motionY > Reference.TERMINAL) { player.motionY = Reference.TERMINAL; } } } else { ArcaneArtificing.snw.sendToServer(new FlyMessage(0)); } if(!player.onGround && player.motionY < 0) { player.fallDistance = (float)((player.motionY * -1) * Reference.DAMAGEREDUCTIONFACTOR); } } } And this is what the message handler/IMessage looks like now: public class FlyMessage implements IMessage { public static int packet; public FlyMessage(){} public FlyMessage(int p) { this.packet = p; } @Override public void fromBytes(ByteBuf buf) { this.packet = buf.readInt(); } @Override public void toBytes(ByteBuf buf) { buf.writeInt(packet); } public static class FlyMessageHandler implements IMessageHandler<FlyMessage, IMessage> { @Override public IMessage onMessage(FlyMessage message, MessageContext ctx) { if(packet == 1) { ctx.getServerHandler().playerEntity.registerExtendedProperties("SpaceDown", ?); } else { ctx.getServerHandler().playerEntity.registerExtendedProperties("SpaceDown", ?); } return message; } } } What do I need to do for the IExtendedEntityProperties instance that's supposed to go where the question marks are in the message, first off?
IPS spam blocked by CleanTalk.