Jump to content

deadrecon98

Forge Modder
  • Posts

    316
  • Joined

Converted

  • Gender
    Undisclosed
  • Personal Text
    Creator of the Realistic Deaths mod!

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

deadrecon98's Achievements

Diamond Finder

Diamond Finder (5/8)

-16

Reputation

  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?
×
×
  • Create New...

Important Information

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