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.

TrashCaster

Members
  • Joined

  • Last visited

Everything posted by TrashCaster

  1. I don't know the default parameters of drawHorizontalLine, but that (the arguments you passed, particularly '64_000') does seem odd to me. Maybe compare it to the GUI/GUI screen methods, and make sure you have the right parameters/arguments. I know the functions aren't broken since I used them before without issue.
  2. Type '\u00a7' instead of the section sign. Java doesn't like symbols, so it's best to pass the unicode index from the JVM to the system.
  3. You can't define models for data values you don't know. Like I said, I'm using a UUID for the paintings. They are randomly generated. There is a way to do this. I just need to be pointed in the right direction.
  4. Almost a week has gone by, and I've got not a single hint to help me further. I'm really begging here. I would like to solve this issue. Recap: I need a dynamic GL texture to be used on the item model. I have tried remapping the texture atlas sprite as is done with compass and clock. No luck. - both by replacing the the parent value, and by replacing the layer1 value (ie, modid:item/texture) used in the model I have not tried to use a smart model, since I'm only changing the texture based on NBT, and the NBT never has predictable values. (UUID to represent painting images, as they are named that way when saved to disk) I don't know what else to try.
  5. I know you may already have the first one solved, but in case others don't know, and would like to know, you can subscribe to the ClientChatReceivedEvent and use regex to separate the player name from the chat. try { if (event.type == 0) { UUID player = null; Pattern p = Pattern.compile("\\<(.*?)\\>"); Matcher m = p.matcher(event.message.getUnformattedText()); while (m.find()) { String s = m.group(1); for (EntityPlayer ep:(List<EntityPlayer>)Minecraft.getMinecraft().theWorld.playerEntities) { if (ep.getName().equals(s)) { player = ep.getUniqueID(); break; } } } if (player != null && event.message.getFormattedText() != null) { String chat = event.message.getFormattedText().replaceFirst("\\<(.*?)\\> ", ""); } } } catch (Exception e) { e.printStackTrace(); }
  6. Just putting it out there, it's generally bad practice to test for an item class since they tend to be used for multiple instances. You can test stack.getItem().equals(Items.steak) There is the odd time where you'll test for a class to group the instances, but you can then instead use stack.getItem() instanceof ItemSteak
  7. I looked up some how-to about GitHub, and now have my source hosted there. Thanks for the tip guys. I've only done my first commit to get it online, and it's not well documented. I'll fix that in the second commit. I've added it to the main post. So as I said, any help on how to do this would be magnificent. Please try not to spoon feed me code, unless it's something I can learn from. I don't just want this to work, I would like to learn why it works, and what does what, so that in the future I can use my acquired knowledge to solve it, instead of making another thread.
  8. I don't know how to do that. What if I use paste bin?
  9. I have uploaded the source to Uppit. Here it is if you want to toy with it. Cause at this point, I don't know what I'm doing to get it working. I've tried all suggestions, and all alternatives, and I'm close to giving up doing it that way. I really want the item model to have the texture though. Worst case scenario, I could re-generate the item with ISmartItemModel and set the face colors per pixel, right?
  10. You need to use packets. Send information back from the client to the server, so the server can update the item.
  11. Well, lets assume blocks get rendered first, then entities, and then tile entities. If Mojang enables the item lighting for the entities (since they hold items) and forget to disable it, then it'll carry over to the tile entities. This is all assuming the order is as described.
  12. Probably just the way the ordering is of the Minecraft code.
  13. For what version of Minecraft? It's pretty different between 1.7 and 1.8
  14. Still nothing. Could I upload a zipped src for you to look through, so you could see if I did anything wrong?
  15. Try setting it to true and see if it changes?
  16. I tried that too. Still, no dice. And the compass JSON uses builtin/compass and then applies texture layer0 to the compass PNG. So I did exactly that. And the other thing is, the updateAnimation method is never being called in my new class. It is overriden properly, and it's getting instantiated. But it is never called. I confirmed this by adding a System out line, and I get no feedback.
  17. So I've tried both Post and Pre, and neither seem to work. It's making my item model into the pink and black cube. My code is: @SubscribeEvent @SideOnly(Side.CLIENT) public void onTextureStitch(TextureStitchEvent.Pre event) { event.map.setTextureEntry("tsm/paint", new TextureCanvas("tsm/paint")); } My item JSON model is: { "parent": "tsm/paint", "textures": { "layer0": "tsm:items/canvas" }, "display": { "thirdperson": { "rotation": [ 0, 90, -35 ], "translation": [ 0, 1.25, -3.5 ], "scale": [ 0.85, 0.85, 0.85 ] }, "firstperson": { "rotation": [ 0, -135, 25 ], "translation": [ 0, 4, 2 ], "scale": [ 1.7, 1.7, 1.7 ] } } } I made this all based on how I see the compass and clock register . They use the resource location's string as their icon name, which happens to check for builtin/compass and builtin/clock. The models for them use those exact strings for their parent tag. I basically have a direct copy of it, changed to my own string and class. So the problem can be either, I'm registering the new class wrong, my update method in the class is wrong, or this just doesn't work for some other unexplainable reason. I don't like asking to be spoon fed code, but I'm beginning to feel like I need to see some code to get mine to work. Anybody feel like rigging something up?
  18. Like the title says. Is there any way for me to bake a GL texture into a base texture? I am doing this because my mod adds canvases, easel, and palletes to allow user made paintings. It renders the paintings onto the canvas model in the easel just fine, as it does when put in an item frame (through the use of an render item frame event). If I can make my texture use a base texture, and overlay the GL texture onto it, I can have the item show the painting in all places, and possibly remove the need to hijack the item frame's render event (which may reduce lag, though none is noticed right now). I did a small bit of reading, and example scavenging, and I know TheGreyGhost has the MBE tutorials, but I'm not seeing how that could apply to my case. I assume I will need to use an ISmartItemModel, but as far as that goes, I don't know. Never really delved into that. I saw one post with a similar need to mine, and TheGreyGhost mentioned stitching the GL texture into the TextureAtlas. So if that's something I could get a bit of help on, that'd be really cool. Edit: I have added my mod's GitHub repo so people can download this and monkey with it, since I personally haven't been able to get it to work.
  19. Ok, I found the location of it. They do render it in the entity rendering class too, so that shouldn't be too bad. If I solve it, I will adjust my first post. Otherwise, input is greatly appreciated in the mean time.
  20. I honestly don't even know where to start digging. I've searched basically everywhere, and too much is obfuscated that I don't even know what to be looking for. I know in previous Minecraft versions it was easy to find. Also, to prevent any confusion, I'll explain in detail how my hook shot system is working, and rendering. My hookshot item runs on a "two and three state system". This basically is that it has its normal state, the state that ejects the entity from the player, and the state where the player is being pulled to the entity. The "two state" part of it is just the fact that the item model/texture has no hook in it in the last two stages. Rendering is being done from the entity, but the issue with that is the renderer is ignoring me setting "ignore frustum check", and also that if the entity gets too far away, the chain disappears since it gets unloaded client side. I also don't know the proper transformations to apply to the one end of the hookshot chain, so it'd be a heck of a lot easier to have it render from the player's hand. Either way, I have to make GL calls to get the chain to display, so I'd be really happy to have IItemRenderer (or a variant) (re-)added, but just noted that it shouldn't be used for anything other than rendering things that you cannot do with JSON models.
  21. You could create the model with all the potential element spaces, and UV map them in such a way that an animated texture would "animate the model". Imagine this. You have a block where the model is a thin pipe-like element that moves around, between 3 points, let's say. You could model it with the pipe in the various positions (the JSON model would have all 3 points modeled and ready to use). Then you can animate the texture so that in the first frame, the texture matching the first pipe's UV coordinates is opaque, while the rest of the image is completely transparent. Doing this for all the model elements, you can create a "frame by frame" model. This will look choppy, cheap, and will always be rendering unnecessary geometry, but it's a simple, tacky way to do it.
  22. MinecraftServer.getServer().worldServers[0].setSpawnPoint(new BlockPos(100,100,100));
  23. So I'm making a hookshot, and I have the chain rendering because I leeched the code from the guardian beam. It works, but it's not at the position I want, nor does it ignore the frustum for whatever reason (in the grapple hook entity, I used this.ignoreFrustumCheck = true which doesn't seem to do anything). Here's what I need to happen. Firstly, the chain needs to render no matter what, so long as the hook is loaded on the client. Second, it needs to appear to be coming out of the hook shot item, kind of like how the fishing line comes out of the rod. I wanted to draw from the hookshot item to the hook, but that's not really possible since the IItemRenderer is deprecated/removed. How should I go about this? [spoiler=Rendering Code] public void doRender(EntityGrappleHook entity, double x, double y, double z, float p_76986_8_, float partialTicks) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); this.bindEntityTexture(entity); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks - 90.0F, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks, 0.0F, 0.0F, 1.0F); byte b0 = 0; float f2 = 0.0F; float f3 = 0.5F; float f4 = (float)(0 + b0 * 10) / 32.0F; float f5 = (float)(5 + b0 * 10) / 32.0F; float f6 = 0.0F; float f7 = 0.15625F; float f8 = (float)(5 + b0 * 10) / 32.0F; float f9 = (float)(10 + b0 * 10) / 32.0F; float f10 = 0.05625F; GlStateManager.enableRescaleNormal(); GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F); GlStateManager.scale(f10, f10, f10); GlStateManager.translate(-4.0F, 0.0F, 0.0F); GL11.glNormal3f(f10, 0.0F, 0.0F); for (int i = 0; i < 4; ++i) { GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); worldrenderer.startDrawingQuads(); worldrenderer.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double)f2, (double)f4); worldrenderer.addVertexWithUV(8.0D, -2.0D, 0.0D, (double)f3, (double)f4); worldrenderer.addVertexWithUV(8.0D, 2.0D, 0.0D, (double)f3, (double)f5); worldrenderer.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double)f2, (double)f5); tessellator.draw(); } GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); if (entity.shootingEntity != null) { Entity shooter = entity.shootingEntity; renderChain(shooter,entity,x,y,z,partialTicks); } super.doRender(entity, x, y, z, p_76986_8_, partialTicks); } private Vec3 func_177110_a(Entity entity, double height, float partialTicks) { double d1 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks; double d2 = height + entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks; double d3 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks; return new Vec3(d1, d2, d3); } public void renderChain(Entity shooter, EntityGrappleHook hookEntity, double x, double y, double z, float partialTicks) { Tessellator tessellator = Tessellator.getInstance(); WorldRenderer worldrenderer = tessellator.getWorldRenderer(); this.bindTexture(chainTexture); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT); GlStateManager.disableLighting(); GlStateManager.disableCull(); GlStateManager.disableBlend(); GlStateManager.depthMask(true); float f3 = 240.0F; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, f3, f3); GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0); float f4 = (float)hookEntity.worldObj.getTotalWorldTime() + partialTicks; f4 = 0f; float f5 = f4 * 0.5F % 1.0F; float f6 = shooter.getEyeHeight()/2f; GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y + f6, (float)z); Vec3 vec3 = this.func_177110_a(hookEntity, -(double)hookEntity.height * 0.0D, partialTicks); Vec3 vec31 = this.func_177110_a(shooter, (double)f6, partialTicks); Vec3 vec32 = vec31.subtract(vec3); double d3 = vec32.lengthVector() + 0.0D; vec32 = vec32.normalize(); float f7 = (float)Math.acos(vec32.yCoord); float f8 = (float)Math.atan2(vec32.zCoord, vec32.xCoord); GlStateManager.rotate((((float)Math.PI / 2F) + -f8) * (180F / (float)Math.PI), 0.0F, 1.0F, 0.0F); GlStateManager.rotate(f7 * (180F / (float)Math.PI), 1.0F, 0.0F, 0.0F); byte b0 = 1; double d4 = (double)f4 * 0.05D * (1.0D - (double)(b0 & 1) * 2.5D); worldrenderer.startDrawingQuads(); worldrenderer.setColorRGBA(255, 255, 255, 255); double d5 = (double)b0 * 0.02D; double d6 = d5 * 1.41D; double d7 = 0.0D + Math.cos(d4 + 2.356194490192345D) * d6; double d8 = 0.0D + Math.sin(d4 + 2.356194490192345D) * d6; double d9 = 0.0D + Math.cos(d4 + (Math.PI / 4D)) * d6; double d10 = 0.0D + Math.sin(d4 + (Math.PI / 4D)) * d6; double d11 = 0.0D + Math.cos(d4 + 3.9269908169872414D) * d6; double d12 = 0.0D + Math.sin(d4 + 3.9269908169872414D) * d6; double d13 = 0.0D + Math.cos(d4 + 5.497787143782138D) * d6; double d14 = 0.0D + Math.sin(d4 + 5.497787143782138D) * d6; double d15 = 0.0D + Math.cos(d4 + Math.PI) * d5; double d16 = 0.0D + Math.sin(d4 + Math.PI) * d5; double d17 = 0.0D + Math.cos(d4 + 0.0D) * d5; double d18 = 0.0D + Math.sin(d4 + 0.0D) * d5; double d19 = 0.0D + Math.cos(d4 + (Math.PI / 2D)) * d5; double d20 = 0.0D + Math.sin(d4 + (Math.PI / 2D)) * d5; double d21 = 0.0D + Math.cos(d4 + (Math.PI * 3D / 2D)) * d5; double d22 = 0.0D + Math.sin(d4 + (Math.PI * 3D / 2D)) * d5; double d23 = 0.0D; double d24 = 0.4999D; double d25 = (double)(-1.0F + f5); double d26 = d3 * (0.5D / d5) + d25; worldrenderer.addVertexWithUV(d15, d3, d16, d24, d26); worldrenderer.addVertexWithUV(d15, 0.0D, d16, d24, d25); worldrenderer.addVertexWithUV(d17, 0.0D, d18, d23, d25); worldrenderer.addVertexWithUV(d17, d3, d18, d23, d26); worldrenderer.addVertexWithUV(d19, d3, d20, d24, d26); worldrenderer.addVertexWithUV(d19, 0.0D, d20, d24, d25); worldrenderer.addVertexWithUV(d21, 0.0D, d22, d23, d25); worldrenderer.addVertexWithUV(d21, d3, d22, d23, d26); double d27 = 0.0D; if (hookEntity.ticksExisted % 2 == 0) { d27 = 0.5D; } worldrenderer.addVertexWithUV(d7, d3, d8, 0.5D, d27 + 0.5D); worldrenderer.addVertexWithUV(d9, d3, d10, 1.0D, d27 + 0.5D); worldrenderer.addVertexWithUV(d13, d3, d14, 1.0D, d27); worldrenderer.addVertexWithUV(d11, d3, d12, 0.5D, d27); tessellator.draw(); GlStateManager.popMatrix(); }
  24. Why do you set the item in use if you are spawning it upon right click? Setting the item in use is so you can "charge up" the item, like a bow. Try removing that and see if it corrects it.
  25. See, the thing is, is I have no block states since the blocks aren't real. They are only ItemStacks. Should I just fetch the default states from the blocks?

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.