Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

matijas1

Members
  • Joined

  • Last visited

Everything posted by matijas1

  1. Again thanks for the help (i knew i was being an idiot) Happy New Year to you Sir.
  2. I had a really cool idea for my mod and started making a tile entity,made a model and the TESR but it fails at binding the texture i think. Thanks in advance to anyone who answers. My TESR: package com.SlothBear.SocketingCrystals.Blocks.TileEntities; import org.lwjgl.opengl.GL11; import com.SlothBear.SocketingCrystals.Reference.Reference; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; public class GemCutterRender extends TileEntitySpecialRenderer { private GemCutterModel model; public static final ResourceLocation idle = new ResourceLocation(Reference.modid + ":textures/blocks/Gem Cutter_idle.png"); public static final ResourceLocation active = new ResourceLocation(Reference.modid + ":textures/blocks/Gem Cutter_active.png"); public static final ResourceLocation completed = new ResourceLocation(Reference.modid + ":textures/blocks/Gem Cutter_completed.png"); public void TileEntityGemCutterRender() { this.model = new GemCutterModel(); } private void adjustRotatePivotViaMeta(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); GL11.glPushMatrix(); GL11.glRotatef(meta * (-90), 0.0F, 0.0F, 1.0F); GL11.glPopMatrix(); } @Override public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) { TileEntityCutter cutter; int nTex = 0; if(te.hasWorldObj()) cutter = (TileEntityCutter)te; else cutter = null; GL11.glPushMatrix(); GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F); if(cutter != null && cutter.isIdle()) { this.bindTexture(idle); nTex = Minecraft.getMinecraft().renderEngine.getTexture(idle).getGlTextureId(); } else if(cutter != null && !cutter.isIdle() && !cutter.isFinished()) { this.bindTexture(active); nTex = Minecraft.getMinecraft().renderEngine.getTexture(active).getGlTextureId(); } else if(cutter != null && cutter.isFinished()) { this.bindTexture(completed); nTex = Minecraft.getMinecraft().renderEngine.getTexture(completed).getGlTextureId(); } GL11.glPushMatrix(); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glBindTexture(GL11.GL_TEXTURE_2D, nTex); this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); GL11.glPopMatrix(); } private void adjustLightFixture(World world, int i, int j, int k, Block block) { Tessellator tess = Tessellator.instance; float brightness = block.getLightValue(world, i, j, k); int skyLight = world.getLightBrightnessForSkyBlocks(i, j, k, 0); int modulousModifier = skyLight % 65536; int divModifier = skyLight / 65536; tess.setColorOpaque_F(brightness, brightness, brightness); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) modulousModifier, divModifier); } } The Error: at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:148) ~[TileEntityRendererDispatcher.class:?] at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntity(TileEntityRendererDispatcher.java:126) ~[TileEntityRendererDispatcher.class:?] at net.minecraft.client.renderer.RenderGlobal.renderEntities(RenderGlobal.java:544) ~[RenderGlobal.class:?] at net.minecraft.client.renderer.EntityRenderer.renderWorld(EntityRenderer.java:1295) ~[EntityRenderer.class:?] at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1098) ~[EntityRenderer.class:?] at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1024) ~[Minecraft.class:?] at net.minecraft.client.Minecraft.run(Minecraft.java:912) [Minecraft.class:?] at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_67] at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_67] at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_67] at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?] at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?] Caused by: java.lang.NullPointerException at com.SlothBear.SocketingCrystals.Blocks.TileEntities.GemCutterRender.renderTileEntityAt(GemCutterRender.java:64) ~[GemCutterRender.class:?] at net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher.renderTileEntityAt(TileEntityRendererDispatcher.java:141) ~[TileEntityRendererDispatcher.class:?]
  3. Although i failed miserably thanks for the quick responses and all the help
  4. It's not hard but i don't know why each sword isn't activating the addInformation() function and working with its number but instead modifying the first and not having the tag displayed. EDIT: Tested a bit and it seems that the onCrafted isn't called with GameRegistry.addShapelessRecipe This is the function: public void onCrafted(ItemStack itemStack, World world, EntityPlayer player) { sockets = ModItems.rngint(1,3); NBTHelp.setInteger(itemStack,ModItems.sockets,sockets); NBTHelp.setString(itemStack,"owner", player.getDisplayName()); NBTHelp.setInteger(itemStack, "iterator", i); i++; if(i == 10000) i=0; } EDIT 2:Wow i am a total idiot sorry for wasting your time...if you noticed I have onCrafted instead of onCreated...
  5. To give each sword that's crafted a random number of sockets in which u could put gems. So the sockets variable is the number of sockets on the sword and i need each sword to keep track of its own number. In my case the first sword that's crafted gets a tag with the number but the rest are just modifying that number instead of having their own.
  6. So do i need an array of ItemStacks?
  7. For setting NBTTags i have this public void onUpdate(ItemStack itemStack, World world, Entity player,int par4,boolean par5) { if(update) { sockets[NBTHelp.getInt(itemStack, "iterator")]--; NBTHelp.setInteger(itemStack,ModItems.sockets,sockets(i)); update = false; } update is only true if the item is crafted. If i have it like this different swords share the same sockets variable and i'm not sure why public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean par4) { if (itemStack.stackTagCompound != null) { list.add("Number of sockets: " + NBTHelp.getInt(itemStack,ModItems.sockets)); } }
  8. I actually didn't remove it from the game but put it into the condition of the matches() function. Although i cant seem to find a way to differentiate the NBTTags of the items because they're all the same itemstack and have the same category. If i differentiate the category by using an array of strings i still need which item in a row it is which contains the category so it would be an endless loop or when another person crafts the item between your upgrading of items it would give you the wrong tag
  9. Oh you're right lol i'm stupid Sorry dude.
  10. Wouldn't the removing written like that only remove the last recipe that was registered? Anyway got it to craft and such but it doesn't call the function onCreated to write the NBTTag which would be useful. Sorry if i am being kinda nooby to this
  11. Thanks for the quick reply i'll read that and its per player and per item. I should also probably mention that its a normal shaped/shapeless recipe
  12. Is there a way to stop being able to craft something after you have registered it in the game? For example being able to upgrade something via crafting only 3 times or a number from NBT. I want to make something like upgradeable tools and armor and this is kinda killing me right now. Thanks in advance

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.