Jump to content

Silly511

Members
  • Posts

    176
  • Joined

Everything posted by Silly511

  1. Minecraft#isSingleplayer will return false if the player is connected to a server, and true if the player is in singleplayer or hosting a LAN world. Minecraft#getIntegratedServer().getPublic() will return true if the player is hosting a LAN world but will throw a NullPointerException if the player is connected to a server. So you could use !mc.isSingleplayer() || mc.getIntegratedServer().getPublic() which will be true if the player is connected to a server or hosting a LAN world and false if the player is in a singleplayer world.
  2. Your BlockRegistry class is never registered as an event handler. Change all the registry methods to static and annotate the class with @EventBusSubscriber.
  3. TileEntitySpecialRenderer has a method called setLightmapDisabled that allows you to disable and enable lighting. The lighting in GlStateManager causes your polygons to be shaded slightly darker on the sides and bottom.
  4. You can use RenderWorldLastEvent#getPartialTicks instead of that horribly hacky thing.
  5. I was about to edit my post when you replied, I should have been more specific. You can't use the code you posted because you can't read the string afterwards. You need to know how long the string is so you know how many bytes to read. ByteBufUtils.writeString will write the length so that ByteBufUtils.readString knows how many bytes to read.
  6. You should use ByteBufUtils.writeString and ByteBufUtils.readString instead.
  7. I'm rendering some things in RenderWorldLastEvent and would like to have fog applied to them. However when I enable fog, it originates from vertex position instead of player position. Here's my code: Tessellator tess = Tessellator.getInstance(); BufferBuilder buffer = tess.getBuffer(); GlStateManager.pushMatrix(); RenderHelper.translateToZero(); GlStateManager.disableTexture2D(); GlStateManager.color(1, 0, 0); GlStateManager.disableCull(); GlStateManager.enableFog(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); buffer.pos(0, 100, 0).endVertex(); buffer.pos(-1.1, 100, 0).endVertex(); buffer.pos(-100, 100, 0).endVertex(); buffer.pos(-101.1, 100, 0).endVertex(); tess.draw(); GlStateManager.disableFog(); GlStateManager.enableCull(); GlStateManager.enableTexture2D(); GlStateManager.popMatrix(); And this is the translateToZero() method: public static void translateToZero() { Entity entity = mc.getRenderViewEntity(); float partialTicks = mc.getRenderPartialTicks(); GlStateManager.translate( -(entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks), -(entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks), -(entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks) ); } Do I need to draw my quads in a different way? I've never done anything with OpenGL fog.
  8. I have a capability that I'm attaching to all items. There are a couple of values that I would like to sync to the client, however since I am attaching this capability to all items I can't override onUpdate or getNBTShareTag to do the syncing. How can I do this, or is it even possible?
  9. Just make a daemon thread. public class StatDownloadThread extends Thread { public StatDownloadThread() { this.setDaemon(true); this.start(); } public void run() { //Fetch stats. } }
  10. 14.22.1.2479 on 1.12.1. I forgot to put the version in the title.
  11. For some reason my JSON model is shading the opposite side that a block is placed on. Without blocks behind it: And this with blocks behind it: Why is this happening? Is there something wrong with my model or is this a forge bug? Here's the JSON: "textures": { "main": "#normal", "particle": "#normal" }, "elements": [ { "from": [0, 0, 0], "to": [8, 8, 8], "faces": { "north": { "uv": [8, 8, 16, 16], "cullface": "north", "tintindex": 0, "texture": "#main" }, "west": { "uv": [0, 8, 8, 16], "cullface": "west", "tintindex": 0, "texture": "#main" }, "down": { "uv": [0, 8, 8, 16], "cullface": "down", "tintindex": 0, "texture": "#main" } } }, { "from": [8, 0, 0], "to": [16, 8, 8], "faces": { "north": { "uv": [0, 8, 8, 16], "cullface": "north", "tintindex": 0, "texture": "#main" }, "east": { "uv": [8, 8, 16, 16], "cullface": "east", "tintindex": 0, "texture": "#main" }, "down": { "uv": [8, 8, 16, 16], "cullface": "down", "tintindex": 0, "texture": "#main" } } }, { "from": [0, 0, 8], "to": [8, 8, 16], "faces": { "south": { "uv": [0, 8, 8, 16], "cullface": "south", "tintindex": 0, "texture": "#main" }, "west": { "uv": [8, 8, 16, 16], "cullface": "west", "tintindex": 0, "texture": "#main" }, "down": { "uv": [0, 0, 8, 8], "cullface": "down", "tintindex": 0, "texture": "#main" } } }, { "from": [8, 0, 8], "to": [16, 8, 16], "faces": { "east": { "uv": [0, 8, 8, 16], "cullface": "east", "tintindex": 0, "texture": "#main" }, "south": { "uv": [8, 8, 16, 16], "cullface": "south", "tintindex": 0, "texture": "#main" }, "down": { "uv": [8, 0, 16, 8], "cullface": "down", "tintindex": 0, "texture": "#main" } } }, { "from": [0, 8, 0], "to": [8, 16, 8], "faces": { "north": { "uv": [8, 0, 16, 8], "cullface": "north", "tintindex": 0, "texture": "#main" }, "west": { "uv": [0, 0, 8, 8], "cullface": "west", "tintindex": 0, "texture": "#main" }, "up": { "uv": [0, 0, 8, 8], "cullface": "up", "tintindex": 0, "texture": "#main" } } }, { "from": [8, 8, 0], "to": [16, 16, 8], "faces": { "north": { "uv": [0, 0, 8, 8], "cullface": "north", "tintindex": 0, "texture": "#main" }, "east": { "uv": [8, 0, 16, 8], "cullface": "east", "tintindex": 0, "texture": "#main" }, "up": { "uv": [8, 0, 16, 8], "cullface": "up", "tintindex": 0, "texture": "#main" } } }, { "from": [0, 8, 8], "to": [8, 16, 16], "faces": { "south": { "uv": [0, 0, 8, 8], "cullface": "south", "tintindex": 0, "texture": "#main" }, "west": { "uv": [8, 0, 16, 8], "cullface": "west", "tintindex": 0, "texture": "#main" }, "up": { "uv": [0, 8, 8, 16], "cullface": "up", "tintindex": 0, "texture": "#main" } } }, { "from": [8, 8, 8], "to": [16, 16, 16], "faces": { "east": { "uv": [0, 0, 8, 8], "cullface": "east", "tintindex": 0, "texture": "#main" }, "south": { "uv": [8, 0, 16, 8], "cullface": "south", "tintindex": 0, "texture": "#main" }, "up": { "uv": [8, 8, 16, 16], "cullface": "up", "tintindex": 0, "texture": "#main" } } } ] }
  12. I think if you return false from hitEntity then player damage is canceled.
  13. RenderHandEvent, or if you want a specific hand, RenderSpecificHandEvent.
  14. You should use Entity#setPosition instead as it will setup a bounding box.
  15. I knew there was some way other than a custom IModel but I couldn't remember it.
  16. If it's a static model then you can just create a JSON model. If it needs to be based off item NBT or has an animation then you can to create a custom IModel/IBakedModel. Forge has lots of examples of this.
  17. I cloned the 1.12.x branch wanting to add a new event, but after I ran gradle setupForge and opened it in Eclipse, I got 2,222 errors from forge. After looking at some of them, it seems random classes like AbstractIllager, Advancement, RecipeBook, etc. were missing. What could be causing this?
  18. EntityRegistry.registerModEntity(new ResourceLocation("modid:name"), EntityTameableDragon.class, "RealmOfTheDragon", ENTITY_ID, RealmOfTheDragons.instance, ENTITY_TRACKING_RANGE, ENTITY_UPDATE_FREQ, ENTITY_SEND_VELO_UPDATES); It's as simple as that. Have you not used ResourceLocations when registering your items?
×
×
  • Create New...

Important Information

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