Jump to content

lyghtningwither

Members
  • Posts

    38
  • Joined

  • Last visited

Recent Profile Visitors

1324 profile views

lyghtningwither's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Huh. I never even knew there was a tint thingy. I want to stick to the TESR, though, as I eventually want you to be able to apply custom textures and rotations and stuff like that. How would I update this on the client side?
  2. I am a precisionist. I must have everything colored the right way. So that's why I created the RGB block: for people like me who aren't satisfied with Minecraft's 14 or so default colors and want to be able to have all 4,294,967,296 possible RGBA colors. But I've run into a big problem. I can't figure out how to color it. It is, by default, black. I am using a TileEntitySpecialRenderer. I know my tile entity's R, G, B & A values are being set (I printed them out to the console). The way they are set is kind of like a sign, as when you place it a screen pops up prompting you to enter in the RGBA values. Then the TESR takes those values in, binds a white texture, renders the model, and calls GLStateManager.color, using the TileEntityRgb's R, G, B & A values divided by 255 (as they're 0-255), and then calls pop matrix and all that stuff. But for some reason, it's still only placing black. The lighting and everything is working, it just isn't setting the correct texture. Attached is a screenshot of a block that should've been a transparent, light blue. Here is my code for the TESR: private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.MOD_ID + ":textures/blocks/rgb.png"); private final ModelRgbBlock MODEL = new ModelRgbBlock(); @Override public void render(TileEntityRgb te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { GlStateManager.enableDepth(); GlStateManager.depthFunc(515); GlStateManager.depthMask(true); ModelRgbBlock model = MODEL; if (destroyStage >= 0) { this.bindTexture(DESTROY_STAGES[destroyStage]); GlStateManager.matrixMode(5890); GlStateManager.pushMatrix(); GlStateManager.scale(4.0F, 4.0F, 1.0F); GlStateManager.translate(0.0625F, 0.0625F, 0.0625F); GlStateManager.matrixMode(5888); } else this.bindTexture(TEXTURE); GlStateManager.pushMatrix(); GlStateManager.enableRescaleNormal(); GlStateManager.translate((float)x, (float)y + 1.0F, (float)z + 1.0F); GlStateManager.scale(1.0F, -1.0F, -1.0F); GlStateManager.translate(0.5F, 0.5F, 0.5F); GlStateManager.translate(-0.5F, -0.5F, -0.5F); model.renderAll(); GlStateManager.color(te.r / 255, te.g / 255, te.b / 255, te.a / 255); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); if (destroyStage >= 0) { GlStateManager.matrixMode(5890); GlStateManager.popMatrix(); GlStateManager.matrixMode(5888); By the way, renderAll() is just a function that renders without the need for entity variables and all that stuff that isn't needed just to render a cube. I don't know what's going on with this code, so please, if you could, point me in the right direction on what I need to do. Thanks in advance!
  3. I looked at a repository that had potion effects, and I was able to get it to work. Thanks, though!
  4. potion_effects.png is the file I use to store my potion effect textures. Just thought you'd like to know.
  5. By the way, here is my code: @Override @SideOnly(Side.CLIENT) public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) { this.render(x + 6, y + 7, 1); } @Override @SideOnly(Side.CLIENT) public void renderHUDEffect(int x, int y, PotionEffect effect, Minecraft mc, float alpha) { this.render(x + 3, y + 3, alpha); } @SideOnly(Side.CLIENT) private void render(int x, int y, float alpha) { Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID + ":textures/gui/potion_effects.png")); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder buf = tessellator.getBuffer(); buf.begin(7, DefaultVertexFormats.POSITION_TEX); GlStateManager.color(1.0F, 1.0F, 1.0F, alpha); int textureX = this.getStatusIconIndex() % 8 * 18; int textureY = 198 + this.getStatusIconIndex() / 8 * 18; buf.pos(x, y + 18, 0).tex(textureX * 0.00390625, (textureY + 18) * 0.00390625).endVertex(); buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * 0.00390625, (textureY + 18) * 0.00390625).endVertex(); buf.pos(x + 18, y, 0).tex((textureX + 18) * 0.00390625, textureY * 0.00390625).endVertex(); buf.pos(x, y, 0).tex(textureX * 0.00390625, textureY * 0.00390625).endVertex(); tessellator.draw(); }
  6. Okay, now I'm able to get the effects to work, but now the swiftness effect is overlaying my vision effect. How would I stop this? Thanks in advance.
  7. How would you do this? (Sorry, I don't know much about potions) I looked in the potion class and there was nothing there that had to do with rendering a potion image.
  8. I'm making some potion effects, and I'm trying to make an icon for them for when you have the effect on. Here is my code for getting the image from the file: public BasePotion(String name, boolean badPotion, int color, int iconIndexX, int iconindexY) { super(badPotion, color); setPotionName("effect." + name); setIconIndex(iconIndexX, iconindexY); setRegistryName(new ResourceLocation(Reference.MOD_ID + ":" + name)); } @Override public boolean hasStatusIcon() { Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation(Reference.MOD_ID + ":textures/gui/potion_effects.png")); return true; } (I basically copied the whole class, but I feeled like it was needed to see the constructor as well.) I have potions that create an instance of this class with the icon index at (0, 0), (1, 0), and so on and so forth. I know that the icons are 18*18, so I started at (0, 0) on the image, and then put the X value up by 18 [(18, 0), (36, 0), blah blah blah blah]. When it displays the effect image, it shows nothing, just an empty black rectangle. I don't know what's going on. Where should I put the Y value of these images? Please help, and thank you in advance.
  9. How would this work? Would I use the event bus? If so, then what event would you use? Or would the chest automatically do it when you open it?
  10. When I logged into Minecraft and showed the log, it didn't say anything about Yggdrasil or anything. It just said "LyghtningWither joined the game" and there was nothing after that.
  11. OK, so I got NBTExplorer to look at the hub.nbt and it said the chest was located at x 2, y 1, and z 3. So I created a BlockPos of pos.getX() + 2, pos.getY() + 1, pos.getZ() + 3 (see above post for the pos variable). Here is my code: IBlockState state = world.getBlockState(pos); world.notifyBlockUpdate(pos, state, state, 3); template.addBlocksToWorldChunk(world, pos, settings); BlockPos chestPos = new BlockPos(pos.getX() + 2, pos.getY() + 1, pos.getZ() + 3); TileEntity tileentity = world.getTileEntity(chestPos); if(tileentity == null) { Main.logger.info("There is no chest!!! Run away!!!"); return; } if(tileentity instanceof TileEntityChest) { TileEntityChest tileEntityChest = (TileEntityChest) tileentity; tileEntityChest.setLootTable(new ResourceLocation(Reference.MOD_ID + ":hub_chest.json"), new Random(world.getSeed()).nextLong()); tileEntityChest.fillWithLoot(null); } When I run the game, it says "There is no chest!!! Run away!!!" repeatedly. I don't know what's wrong. And by the way, I tried running the loop in loop in loop code and it didn't work. I clearly have the loot table correctly named, as you can see in the attached image. Yes, there is a chest in there. To prove it, I the second screenshot clearly shows a minecraft:chest in there. Please help, and thank you in advance.
  12. It said null and when I opened the chest it had nothing. It has given me no errors, no anything. I even used a custom loot table generator and it didn't work. Please help!!! Here's my code: public static void generateStructure(World world, BlockPos pos) { MinecraftServer mcServer = world.getMinecraftServer(); TemplateManager manager = worldServer.getStructureTemplateManager(); ResourceLocation location = new ResourceLocation(Reference.MOD_ID, structureName); Template template = manager.get(mcServer, location); if(template != null) { IBlockState state = world.getBlockState(pos); world.notifyBlockUpdate(pos, state, state, 3); template.addBlocksToWorldChunk(world, pos, settings); for(int x = 0; x <= template.getSize().getX(); x++) { for(int y = 0; y <= template.getSize().getY(); y++) { for(int z = 0; z <= template.getSize().getZ(); z++){ BlockPos tmp = new BlockPos(pos.getX() + x, pos.getY() + y, pos.getZ() + z); if(world.getTileEntity(tmp) != null){ if(world.getTileEntity(tmp) instanceof TileEntityChest){ TileEntityChest chest = (TileEntityChest) world.getTileEntity(tmp); chest.setLootTable(new ResourceLocation(Reference.MOD_ID + ":hub_chest.json"), new Random(chest.getWorld().getSeed()).nextLong()); chest.fillWithLoot(null); } } } } } } }
  13. For chest.fillWithLoot, what would you put as the "player" parameter?
×
×
  • Create New...

Important Information

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