Jump to content

Zetal

Members
  • Posts

    113
  • Joined

  • Last visited

Everything posted by Zetal

  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.
  16. That would kill the player. No. Ah, I misunderstood. Well, in that case, pretty much the only easy way I can think of is storing the towers created via command in a serverside array, then having some way for the player to reference that array when choosing which tower to delete. Another option is simply deleting the nearest tower to the commandsender, I guess. How to explain that to zlapped is another matter entirely, unfortunately.
  17. zlapped, just call this: "p_71515_1_.setDead();" Like replace all of the world, and set position, and new entitytower stuff, with just "p_71515_1_.setDead();"
  18. The nice thing here is that, if I'm remembering correctly, you should be able to just use Minecrafts built-in pathing via "this.theCreature.getNavigator().tryMoveToXYZ" within an EntityAI class. That will bring your Engineer as close as possible to the target block (which you know the position of) and when he arrives, you can check his distance. If the distance is too large, then you don't place the block. Otherwise, place the block and move on. Makes sense, hopefully?
  19. Well, wrap it up boys, it's been solved. Additional Google-fu led me to this extremely awkward link. Shortly afterwards, I removed the methods in GuiSpecRepair that were no longer useful, and the error has stopped occurring. Not sure of the technical causes behind the crash, but there it is. Have a good one, thanks for getting me there Edit: Choonster you pro, you nailed it as I was typing this. Nice work
  20. Good call, I was looking right over the bottom part of the stack trace. Full stack Trace: http://pastebin.com/1gxyDBfk So it would seem the error stems not from anything related to Sides, but to the fact that, apparently, my class isn't being compiled properly? Here is the GuiSpecRepair class: http://pastebin.com/inyWvFsw (I know it's a mess, I'm sorry. There's so much to do that I get lazy, and there are probably way better ways of doing it, but blergh.) A brief Google search of the error is related to Entities that implement IInventory, but GuiSpecRepair is neither an entity, nor does it implement IInventory, so I'm not sure.
  21. I have changed that for the sake of cleanliness, but the problem still remains. To reiterate the issue, I'm receiving a NoClassDefFoundError for a clientside class, from the client side. It's definitely a client side class (it's a GuiContainer) and it's definitely on the client side, since it's gated within the client proxy, and the eventhandler contains many other clientside classes as well that do not throw this error. What could be causing this??
  22. What do you mean? I've been using SidedProxy for several versions now- the code runs successfully, and is "sided" properly (since the server doesn't crash for rendering registration). http://www.minecraftforge.net/wiki/Proxies
  23. ...You sure that's a good idea? I'm pretty much 100% sure you don't want the whole event class. This project isn't exactly pretty, and the event class in question is about 1600 lines long, mostly filled with pointless garbage that doesn't affect anything for this particular issue. Anyways, I switched over to using a SidedProxy to call my method (which is now being called from within my SCMClientProxy, properly declared via @SidedProxy(clientSide = "bitevo.Zetal.LoMaS.Specializations.SCMClientProxy", serverSide = "bitevo.Zetal.LoMaS.Specializations.SCMCommonProxy") public static SCMCommonProxy proxy = new SCMCommonProxy(); I have discovered that within my event handler, whenever this: "event.gui = new GuiSpecRepair(player.inventory, player.worldObj);" is not commented out, the crash occurs. Not strange on its own, but what /is/ strange is that other GUI classes that are also clientside only can remain uncommented within the exact same method, and the crash doesn't occur.
  24. That doesn't really help my issue, unfortunately, though I appreciate the effort. While that is useful information (that I didn't realize was standard), it doesn't really apply to my current issue. @EventHandler public void load(FMLInitializationEvent event) { if (event.getSide() == Side.CLIENT) { MinecraftForge.EVENT_BUS.register(new SCMClientEventContainerClass()); } } As you can see, the code I'm trying to execute clientside is within the FMLInitializationEvent call, which has no way to refer to a world object. More importantly (and which I didn't even realize at the time) is that this doesn't reference SideOnly, and instead uses the event.getSide() method, which brings me back to the weirdness that is the class not being found despite definitely being clientside.
  25. I'm updating my 1.8 code to 1.8.9, and for some reason code that used to work is now giving a "ClassNotFoundException" for one of my GUI's. I register a clientside event handler within a SideOnly(Client) method, in the preInit event. The error is thrown within that eventhandler, so it's weirding me out a bit. I've dealt with the "ClassNotFoundException" error before, but it's always been fairly obvious what's going on behind the scenes, i.e. the server trying to access a clientside class or vice-versa, but in this case neither should be happening. Would appreciate any pointers, thanks. Update: To reiterate the issue, I'm receiving a NoClassDefFoundError for a clientside class, from the client side. It's definitely a client side class (it's a GuiContainer) and it's definitely on the client side, since it's gated within the client proxy, and the eventhandler contains many other clientside classes as well that do not throw this error.
×
×
  • Create New...

Important Information

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