Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Zetal

Members
  • Posts

    113
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    Making a Modpack

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Zetal's Achievements

Creeper Killer

Creeper Killer (4/8)

2

Reputation

  1. Got it working. I couldn't use the RenderWorldLastEvent, since that was happening after the water was rendered. Instead, I used the next closest event that occurred before water rendering while still being after the RenderSystem.clear(16640) call.. which, strangely enough, was the EntityViewRenderEvent.FogDensity event. @SubscribeEvent public static void onRenderTick(EntityViewRenderEvent.FogDensity event) { ClientWorld clientWorld = Minecraft.getInstance().world; // checks if the world exists, and checks the fogtype just so we don't do the rendering twice unnecessarily if (clientWorld != null && event.getType() == FogType.FOG_TERRAIN) { TileWrapperWorldData worldData = clientWorld.getCapability(CapabilityWorldTileWrapper.TILE_WRAPPER_CAPABILITY).orElseGet(null); if (worldData != null) { // creates and rotates the matrixstack to match tileentity rendering MatrixStack matrixStack = new MatrixStack(); event.getInfo().setAnglesInternal(event.getInfo().getYaw(), event.getInfo().getPitch()); matrixStack.rotate(Vector3f.ZP.rotationDegrees(0)); matrixStack.rotate(Vector3f.XP.rotationDegrees(event.getInfo().getPitch())); matrixStack.rotate(Vector3f.YP.rotationDegrees(event.getInfo().getYaw() + 180.0F)); // fixes the lighting to match tileentity rendering if (clientWorld.func_239132_a_().func_239217_c_()) { RenderHelper.func_237533_a_(matrixStack.getLast().getMatrix()); } else { RenderHelper.setupLevelDiffuseLighting(matrixStack.getLast().getMatrix()); } // normal rendering Vector3d projectedView = event.getInfo().getProjectedView(); Impl renderTypeBuffer = IRenderTypeBuffer.getImpl(Tessellator.getInstance().getBuffer()); int i = OverlayTexture.NO_OVERLAY; double d0 = projectedView.getX(); double d1 = projectedView.getY(); double d2 = projectedView.getZ(); for (TileWrapperContainer wrapper : worldData.loadedTileWrapperList.values()) { BlockPos pos = wrapper.getPos().up(); BellTileEntity test = TileEntityType.BELL.create(); test.setWorldAndPos(clientWorld, pos); matrixStack.push(); matrixStack.translate((double) pos.getX() - d0, (double) pos.getY() - d1, (double) pos.getZ() - d2); TileEntityRendererDispatcher.instance.renderItem(test, matrixStack, renderTypeBuffer, WorldRenderer.getCombinedLight(clientWorld, test.getPos()), i); matrixStack.pop(); } renderTypeBuffer.finish(); } } } Note that I had to do a bit of extra preparatory work to make it behave as expected, but it's working nicely, so that's that.
  2. Hey! So after a long break, I'm working on mods again. I'm trying to manually render a TileEntity using the RenderWorldLastEvent for testing purposes (going to be rendering something else entirely once I verify it's working) but I'm down to one last issue that I can't seem to figure out. @SubscribeEvent public static void onRenderTick(RenderWorldLastEvent event) { World clientWorld = Minecraft.getInstance().world; if (clientWorld != null) { TileWrapperWorldData worldData = clientWorld.getCapability(CapabilityWorldTileWrapper.TILE_WRAPPER_CAPABILITY).orElseGet(null); if (worldData != null) { GameRenderer gameRenderer = Minecraft.getInstance().gameRenderer; ActiveRenderInfo activeRenderInfo = gameRenderer.getActiveRenderInfo(); Vector3d projectedView = activeRenderInfo.getProjectedView(); Impl renderTypeBuffer = IRenderTypeBuffer.getImpl(Tessellator.getInstance().getBuffer()); int i = OverlayTexture.NO_OVERLAY; double d0 = projectedView.getX(); double d1 = projectedView.getY(); double d2 = projectedView.getZ(); MatrixStack matrixStack = event.getMatrixStack(); for (TileWrapperContainer wrapper : worldData.loadedTileWrapperList.values()) { BlockPos pos = wrapper.getPos().up(); BellTileEntity test = TileEntityType.BELL.create(); test.setWorldAndPos(clientWorld, pos); matrixStack.push(); matrixStack.translate((double) pos.getX() - d0, (double) pos.getY() - d1, (double) pos.getZ() - d2); TileEntityRendererDispatcher.instance.renderItem(test, matrixStack, renderTypeBuffer, WorldRenderer.getCombinedLight(clientWorld, test.getPos()), i); matrixStack.pop(); } renderTypeBuffer.finish(); } } } Here's the render code. Normally, this is how it looks. This is what I expect it to look like, so that's good. All three bells accounted for! However, when I go under water... It's sorta hard to tell from the picture, but none of the bells are visible anymore. I've tested using other transparent things like Glass, Sugar Cane, Web, Fences, etc. but the bells are visible through all of them except water. I've tried adding all sorts of RenderSystem changes before the rendering of my bells, but it didn't seem to do much except make the bells themselves see-through. Does anybody know what I'm missing so I can finally see my bells through the water? Kind of going crazy atm. Thanks!
  3. I did indeed do that, Draco- unfortunately (as the caveat in that exact answer you linked points out) primitive types that are final are not properly updated via reflection. I'm assuming this is why my implementation doesn't work, but I could be mistaken. Perhaps there is some other behind-the-scenes shenanigans causing it?
  4. Hi! Thanks for the advice I tried the first method, as best as I could anyway, by using Reflection to loop through all of the fields in the 'replacement chunk' and set the equivalent fields appropriately, but unfortunately a lot of the fields inside of the Chunk class are 'final'. I can use Reflection to ignore that modifier, but the JVM won't recognize the values as having changed. I'm beginning to think perhaps this is a bit more complicated than a quick and easy fun project would suggest...
  5. Hello there! As a bit of a fun little project, I've been working on a mod that will 'loop' a Minecraft world within a configurable rectangular area, by chunk. While I have the events in place to teleport a player to the other end of the world when they reach the 'edge', I was hoping to also be able to substitute the chunks beyond the border with the chunks on the other side of the world, making the teleport as seamless as possible (since the chunks that the player is walking into are, after all, already loaded ). However, I see in the documentation that the ChunkEvent.Load event is NOT cancellable. I was wondering if anyone knew a good work-around for this? Thank you!
  6. Hey there! Here to bother you. EntityPlayerMP emp = (EntityPlayerMP) player; double reach = emp.interactionManager.getBlockReachDistance(); reach += 500.0D; emp.interactionManager.setBlockReachDistance(reach); This (basically) does nothing. While it does change the value, the value itself has no effect on the game due to the fact that the client uses PlayerControllerMP to determine blockreach distance, which takes priority. I would like some guidance on how to pursue arbitrary changes to player reach distance. Thank you.
  7. Try using Minecraft.getMinecraft().renderGlobal.spawnParticle() instead of Minecraft.getMinecraft().effectRenderer.addEffect()
  8. Players in my mod can level up and improve their ability to craft tools, armor, and weapons. Improving their ability increases the durability of the items, giving them a higher 'max damage'. Right now, I'm doing this by creating classes that extend the vanilla ItemArmor, ItemSword, etc. classes and override getMaxDamage(ItemStack stack) with my own method. @Override public int getMaxDamage(ItemStack stack) { return SpecializationsMod.getMaxDamage(stack); } By doing this I can store the quality of an ItemStack in the NBT, and use it with the vanilla durability systems. However, this method is bad for compatibility with other mods, and it's tedious to replace every vanilla tool/armor/weapon in the game with my own. What options are available to me that would be cleaner? Thanks.
  9. It thinks your item is an 'ItemBlock' for some reason, I believe. Try setting the unlocalized name to something other than 'test'. and don't do this: fireskill.getUnlocalizedName().substring(5)) Just change that to 'fireskill' and change the 'test' up above to 'fireskill' too.
  10. I suppose I figured that would be the answer, but it's still a shame there isn't another way since TileEntity's tend to be kinda bloated. Well, whatever. Thanks.
  11. So, in general, it's best to limit the metadata of your block to 16 values. However, what do I do when my block has, for example, 21 values that need to be stored? I have a custom cake block- the cake has seven different values depending on how 'eaten' it is. The cake also has a 'quality' - Poor, Decent, or Superb. How can I store these values in the block metadata without going over 16?
  12. Ah, that is a mess. What's this "NextTickListEntry" thing though?
  13. I see there's a lot of discussion about the performance issues with such a thing... why don't they just add a forge hook for modifying the array of blocks to be ticked once per tick before it goes into the for loop, instead of once per block per tick after it's in the loop? Wouldn't that serve the same purpose, and save performance time? Or am I misunderstanding?
  14. Are there any plans to add an event for this? If not I guess it's back to the drawing board. Maybe I can optimize what I have enough...
  15. What's the best way to prevent the spawning/spread of Fire in a specific area? I know Firespread can be disabled globally using vanilla settings, but I only want to disable it in a set location. Right now the mod I have does so by doing chunk scans on chunk tick and checking to see if there is fire in a protected zone, but it's rather performance intensive and I'm looking for a better way to do this.
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.