Jump to content

lyghtningwither

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by lyghtningwither

  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?
  14. Only problem is, exactly how would I find the location of the chest?
  15. Hi, I am wondering how you do a loot table for your custom structure. I have tried looking through the Minecraft code and I have not found anything that helps me. Any help would be appreciated, and thanks in advance.
  16. So... exactly how would you do this? Would you set worldIn to playerIn.getEntityWorld() and then call setblockState()? Something like this? @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(!worldIn.isRemote) { if(playerIn.dimension != 2) { Teleport.TeleportToDimension(playerIn, 2, playerIn.posX, playerIn.posY, playerIn.posZ); worldIn = playerIn.getEntityWorld(); worldIn.setBlockState(new BlockPos(hitX, hitY - 1, hitZ), ModBlocks.ICE_PORTAL_BLOCK.getDefaultState()); } else if (playerIn.dimension == 2) { Teleport.TeleportToDimension(playerIn, 0, pos.getX(), pos.getY(), pos.getZ()); worldIn = playerIn.getEntityWorld(); worldIn.setBlockState(new BlockPos(hitX, hitY - 1, hitZ), ModBlocks.ICE_PORTAL_BLOCK.getDefaultState()); } } return true; }
  17. Hi, I am trying to make it so that when you take my ice age portal you teleport to that dimension and another ice age portal appears under your feet. But for some reason, it doesn't work. I spawn far from an island with no supports (aka the block that should've been placed). Here is my code: @Override public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if(!worldIn.isRemote) { if(playerIn.dimension != 2) { Teleport.TeleportToDimension(playerIn, 2, playerIn.posX, playerIn.posY, playerIn.posZ); worldIn.setBlockState(new BlockPos(hitX, hitY - 1, hitZ), ModBlocks.ICE_PORTAL_BLOCK.getDefaultState()); } else if (playerIn.dimension == 2) { Teleport.TeleportToDimension(playerIn, 0, pos.getX(), pos.getY(), pos.getZ()); worldIn.setBlockState(new BlockPos(hitX, hitY - 1, hitZ), ModBlocks.ICE_PORTAL_BLOCK.getDefaultState()); } } return true; } So I have two questions: 1. How do you decide what dimension the block is placed in, in setBlockState? 2. Why is this not working? I don't see any problem. I even tried to follow the end code for when it places the dragon egg on the top of the bedrock pillar. Any help would be appreciated, and thank you in advance.
  18. Yeah, I bet you edited the config (or maybe accidentally put a minus sign in there somewhere!). Copy in the config file so we can see it. EDIT: I definitely think you edited the config, either by accident or on purpose. The "height" variable on the default config (at least for me, but it would be crazy if the default config was different for you and me) was set to a number that wasn't out of bounds.
  19. It looks like the mod it trying to register ores outside of the world limits (y < 0, y > 255) and that is causing the error. (on top it says "invalid Y coordinates") I don't know how that is caused, but that is my best guess on why the error was caused.
  20. Thank you! Well, I think that my dimension is about finished. Thank you, everybody, for your help.
  21. You can also hold down "control" (or "command" on Mac) in order to get the declaration of a function.
  22. WorldProviderSurface has no calculateCelestialAngle. By default, it says in the world provider the code above, and WorldProviderSurvace does not override it, so it is the correct code. (I just found out how to access the whole Minecraft library, so I looked in it till I found WorldProvideSurface.) So when I wondered whether you had to just delete calculateCelestialAngle, I was right. But I was also right in the way that you had to change something. Weird!
  23. I looked in the super implementation code, and it's this: int i = (int)(worldTime % 24000L); float f = ((float)i + partialTicks) / 24000.0F - 0.25F; if (f < 0.0F) { ++f; } if (f > 1.0F) { --f; } float f1 = 1.0F - (float)((Math.cos((double)f * Math.PI) + 1.0D) / 2.0D); f = f + (f1 - f) / 3.0F; return f; Is this the correct code? Please respond quickly.
×
×
  • Create New...

Important Information

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