Jump to content

deadrecon98

Forge Modder
  • Posts

    316
  • Joined

Everything posted by deadrecon98

  1. Okay i've solved the last issue. Turns out I had an unbroken while loop. Thanks for the help, I can't believe that bug didn't show up until now.
  2. If I don't return null then for whatever ungodly reason is it starts to give me negative item stack sizes. EDIT: Just for testing purposes I made it return the itemstack regardless but the error is still happening. EDIT EDIT: Well I take back my last edit, I see your reasoning so I made it return the itemstack and now it crashes without any errors.
  3. I don't even know what's causing this one. It happens whenever I right click an item that I created. Note: It works perfectly the first two times I use it but on the third one it crashes. Also this only seems to pertain to the Skin type. Error 14:22:29] [server thread/FATAL] [FML]: Exception caught executing FutureTask: java.util.concurrent.ExecutionException: java.lang.NullPointerException java.util.concurrent.ExecutionException: java.lang.NullPointerException at java.util.concurrent.FutureTask.report(Unknown Source) ~[?:1.7.0_79] at java.util.concurrent.FutureTask.get(Unknown Source) ~[?:1.7.0_79] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:715) [FMLCommonHandler.class:?] at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:727) [MinecraftServer.class:?] at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:669) [MinecraftServer.class:?] at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer.java:171) [integratedServer.class:?] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:540) [MinecraftServer.class:?] at java.lang.Thread.run(Unknown Source) [?:1.7.0_79] Caused by: java.lang.NullPointerException at net.minecraft.server.management.ItemInWorldManager.tryUseItem(ItemInWorldManager.java:398) ~[itemInWorldManager.class:?] at net.minecraft.network.NetHandlerPlayServer.processPlayerBlockPlacement(NetHandlerPlayServer.java:607) ~[NetHandlerPlayServer.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:67) ~[C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.play.client.C08PacketPlayerBlockPlacement.processPacket(C08PacketPlayerBlockPlacement.java:114) ~[C08PacketPlayerBlockPlacement.class:?] at net.minecraft.network.PacketThreadUtil$1.run(PacketThreadUtil.java:24) ~[PacketThreadUtil$1.class:?] at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:1.7.0_79] at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:1.7.0_79] at net.minecraftforge.fml.common.FMLCommonHandler.callFuture(FMLCommonHandler.java:714) ~[FMLCommonHandler.class:?] Item Class @Override public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn){ if (!worldIn.isRemote){ if(!playerIn.capabilities.isCreativeMode){ if(PackManager.crackPack(playerIn, type)){ itemStackIn.stackSize --; return null; }else{ playerIn.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "You are out of inventory space!")); } }else{ playerIn.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "You must be in survival mode to use this!")); } } return itemStackIn; } More code that might be helpful. /** * Opens a trail pack for the player. * @param player */ public static boolean crackPack(EntityPlayer player, EnumPackType type){ if(!player.worldObj.isRemote){ switch(type){ default: logger.error("Invalid pack type for type " + type + "!"); return false; case Trail: if(player.inventory.hasItem(ItemManager.trailPack)){ Trail trail = TrailManager.getRandomTrail(); ItemStack is = new ItemStack(ItemManager.openedTrailPack, 1); NBTTagCompound tag = new NBTTagCompound(); is.setTagCompound(tag); tag.setString("Type", EnumPackType.Trail.toString()); tag.setString("Trail", trail.getName()); is.setStackDisplayName("" + EnumAppRarity.getColorFromTrail(trail) + trail.getRarity() + EnumChatFormatting.AQUA + " Trail Pack"); if(player.inventory.addItemStackToInventory(is)){ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "You have cracked a " + EnumAppRarity.getColorFromTrail(trail) + trail.getRarity() + EnumChatFormatting.AQUA + " Trail of " + EnumAppRarity.getColorFromTrail(trail) + trail.getName() + "!")); if(trail.getRarity() == EnumAppRarity.Mythic){ PacketManager.sendPacketToAll(new PacketChatMessage(EnumChatFormatting.GOLD + player.getName() + " just cracked a " + EnumAppRarity.getColorFromTrail(trail) + trail.getRarity() + EnumChatFormatting.GOLD + " Trail of " + EnumAppRarity.getColorFromTrail(trail) + trail.getName() + "!")); } return true; }else{ return false; } } break; case Skin: if(player.inventory.hasItem(ItemManager.skinPack)){ Skin skin = SkinManager.getRandomSkin(); ItemStack is = new ItemStack(ItemManager.openedSkinPack, 1); NBTTagCompound tag = new NBTTagCompound(); is.setTagCompound(tag); tag.setString("Type", EnumPackType.Skin.toString()); tag.setString("Skin", skin.getName()); is.setStackDisplayName("" + EnumAppRarity.getColorFromRarity(skin.getRarity()) + skin.getRarity() + EnumChatFormatting.AQUA + " Skin Pack"); if(player.inventory.addItemStackToInventory(is)){ player.addChatMessage(new ChatComponentText(EnumChatFormatting.AQUA + "You have cracked a " + EnumAppRarity.getColorFromRarity(skin.getRarity()) + skin.getRarity() + EnumChatFormatting.AQUA + " Skin of " + EnumAppRarity.getColorFromRarity(skin.getRarity()) + skin.getName() + "!")); if(skin.getRarity() == EnumAppRarity.Mythic){ PacketManager.sendPacketToAll(new PacketChatMessage(EnumChatFormatting.GOLD + player.getName() + " just cracked a " + EnumAppRarity.getColorFromRarity(skin.getRarity()) + skin.getRarity() + EnumChatFormatting.GOLD + " Skin of " + EnumAppRarity.getColorFromRarity(skin.getRarity()) + skin.getName() + "!")); } return true; }else{ return false; } } break; } } return false; }
  4. Oh, I didn't realize it was just renamed. Well that solves a whole mess of issues for me, thanks!
  5. So i'm trying to something similar to what the bow does and render the item with a different texture based on state. The state in this case would be called from the ItemStack however I can't seem to figure out how to do this anymore. Back in 1.7 you could override getIcon or whatever it was called but now it's hardcoded directly into RenderItem. Does anyone know of a way to solve this?
  6. I am going to assume that the issue is in your render class and not the model. Try using this for the render class. If this doesn't fix it then you need to upload all of your code somewhere so that I can get a better look at it. Render Class:http://bit.ly/1feyNWD How to use Render http://bit.ly/1LMEjfs
  7. I think I may have found the issue. In your main class is the modid all lower-case? If not go into the render class and change all cases of where it grabs the modid to have .toLowerCase() after it. As for the switch statements you had a couple blank ones which immediately go onto the next statement.
  8. There is an entity onUpdate() method. Figure the rest out yourself.
  9. Just store the block's coordinates in the world nbt and use a block break event to take care of the rest.
  10. Figure it out, i'm not going to write your code for you.
  11. I don't think anyone here will help you unless you actually try first. You haven't given us any code or issues that you are having other than you want us to walk you through this. There are plenty of tutorials out there for dimensions and block manipulation.
  12. Change your render class to this, it should work fine afterwards. Also you really need to look up the basics of java, you don't seem to understand how switch statements work. package com.hammy.item; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.client.gui.inventory.GuiInventory; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.IItemRenderer; import net.minecraftforge.client.model.AdvancedModelLoader; import net.minecraftforge.client.model.IModelCustom; import com.hammy.item.LaserItem; import org.lwjgl.opengl.GL11; import com.hammy.lib.RefStrings; public class LaserRender implements IItemRenderer { public final ResourceLocation texture = new ResourceLocation(RefStrings.MODID, "models/LaserItem.png"); public IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/LaserItem.obj")); IModelCustom model; public LaserRender(){} @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { switch(type){ case EQUIPPED: return true; case EQUIPPED_FIRST_PERSON: return true; default: return false; } } @Override public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) { return true; } public void renderItem(ItemRenderType type, ItemStack stack, Object... data) { switch(type){ case EQUIPPED: GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); //Do all your GL11 rotations, scales, and translaters here... model.renderAll(); GL11.glPopMatrix(); break; case EQUIPPED_FIRST_PERSON:{ GL11.glPushMatrix(); Minecraft.getMinecraft().renderEngine.bindTexture(texture); //Do all your GL11 rotations, scales, and translaters here... model.renderAll(); GL11.glPopMatrix(); } default: break; } } }
  13. Can you actually confirm that the model is being loaded? Check the console, it should give you a few errors if something isn't loading properly. Also I have noticed another issue. @Override public boolean handleRenderType(ItemStack item, ItemRenderType type) { // TODO Auto-generated method stub switch(type){ [b] case EQUIPPED: case EQUIPPED_FIRST_PERSON: return true; default: return false;[/b] } } Whenever you return false you are telling it not to render it period. Also on case EQUIPPED you never told it to return anything. Try changing that, if you still need help afterwards let me know. EDIT: You're code is riddled with mistakes. Give me 1 minute to go through and give you what should be a working example.
  14. I think this might be you're issue. IModelCustom model; public LaserRender(){ IModelCustom model = AdvancedModelLoader.loadModel(modelResource); // public final ResourceLocation texture = new ResourceLocation("assets/textures/items/Laser-texture.jpg"); What you're doing is setting a variable but never actually defining it. What you need to do is change IModelCustom model to model alone. In java whenever you set a variable you do not need to declare it's type again.
  15. I don't quiet understand what you need help with. Is something not working properly? If so could I get an error log?
  16. It should render your custom armor texture assuming that you set it properly. You need to set 27 to be 0-4 because the item will only allow 0-4, anything else will crash the game.
  17. Ooh, that makes sense now. Thanks for explaining!
  18. The issue is in this and the other 3 lines of code. public static Item goldplateHelmet = new ArmorGoldplate(Material.Armor.GOLDPLATE, 27, 0).setUnlocalizedName(Names.Armor.GOLDPLATE_HELMET); You should have looked into the ItemArmor class before you started tossing in arguments for the hell of it. That argument is not item id or armor id, it is the render id. Here is the comment for the integer as found in ItemArmor.class. Used on RenderPlayer to select the correspondent armor to be rendered on the player: 0 is cloth, 1 is chain, 2 is iron, 3 is diamond and 4 is gold.
  19. No, it appears that I needed to have nullary constructors for whatever reason. It seems to be working for now. Ty
  20. That's something you need to add in the rendering yourself.
  21. Could we see all of your item, render, and main classes?
  22. You can solve the burst issue one of two ways. The first is to extend the range of the beam so that they match up when fired. The second way is to stop rendering the beam with the entity and render it based on position.
  23. Alright so apparently after switching my packet method and implementing it, it got the bright idea to just quit working. Basically it will encode it properly on the server but for whatever reason the client can't figure out how to decode the message. I am looking at PacketClientUpdate which works fine server-side, just not client-side. Error Report: http://bit.ly/1LN4N1k Packet Managers and Packets: http://bit.ly/1Cg4E3A Where the Packets are called from: http://bit.ly/1C7aK5G
  24. I am locking this topic everybody. I have found that my current system of sending packets is much too confusing for me to understand. I have found a much better packet system that I will now be using instead of this. If you wish to see it for yourself you can find it here. http://www.minecraftforge.net/wiki/Netty_Packet_Handling
  25. @Ernio Ok, so i've went through and changed a good bit of code to match your recommendations(Other than the variable naming, I just don't care to change those atm.). I am still getting the issue but I have noticed that it doesn't seem to sync the player data when you login. After I set the difficulty in the gui it works fine but for some reason it isn't actually syncing properly before then. Oh, as for the server packet thingy, basically it sends the player difficulty to the server so that the server can update the player on it's end. If it were my guess i'd say the issue was in the entity created or the entity constructed event but I can't really be sure. I've updated my new code so that you can get a better idea as to where i'm at now. EDIT: I did move network.registerMessage() out of only being called on the client side. It is now called on both. Also, you can see here that the data is correct on the server side but on the client side it's still reverted to it's defaults... https://i.pitter.us/khANHQv4e/jgxunwzGC.png EDIT: I have tried tracing the issue to it's root cause and I think that I may have found it but i'm not sure how to fix it. I was able to trace it back into the packet itself. The packet can send the data but it seems the client never recieves it to begin with. You can see where I am pointing these out here. http://bit.ly/1HAiZrI
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.