Jump to content

FredTargaryen

Members
  • Posts

    70
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am not new!

Recent Profile Visitors

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

FredTargaryen's Achievements

Stone Miner

Stone Miner (3/8)

2

Reputation

  1. Well I figured it out; maybe this is helpful for 1.14.4 and beyond too. Declare a Vec3d representing the offset in the world. This is how much the world will be translated around the camera. The following statements transform that world offset into screen coordinates, so that no matter where the player is looking the camera moves by the same offset in the world. Vec3d alignedToYaw = rotateAroundVector(offsetVec, new Vec3d(0, 1, 0), player.rotationYaw * Math.PI / 180); Vec3d alignedToPitch = rotateAroundVector(alignedToYaw, new Vec3d(1, 0, 0), player.rotationPitch * Math.PI / 180); //Put rotation first, so it comes out, then turns at the point it came out to GL11.glRotatef(prevRotationRoll + (rotationRoll - prevRotationRoll) * f, 0.0F, 0.0F, 1.0F); GL11.glTranslated(alignedToPitch.x, alignedToPitch.y, -alignedToPitch.z); If you swap the rotate and translate, this is effectively rotating your offset vector and you won't see a camera tilt. rotateAroundVector is a function that takes one vector and returns the rotated vector using another vector as the axis. You can implement your own or see an example implementation here.
  2. This might not help (sorry) but I have a TESR which draws long tracks which used to disappear when looked at from a certain angle, with the block off the screen. That was only fixed by overriding isGlobalRenderer, returning true. This might hurt performance if you plan to have a lot of these blocks but I didn't have any problems with about 50 of those blocks on the screen (didn't try any higher).
  3. Hi, This gif from a 1.7.10 mod shows the camera turning as the coaster turns. It feels like the camera is fixed onto the coaster. It accomplished this with a coremod that inserted a GL11.rotated call at the start of orientCamera. For some reason, trying the same thing in 1.12.2 produces this! The camera hovers above the coaster in the world regardless of its orientation. I've experimented with a lot of different GL translations to replicate the first effect but it's been difficult trying to find translations that work for all camera orientations - made more difficult by those translations being relative to the screen rather than the world, so knowing where the camera should be in the world relative to the coaster is not enough. Trying this using the CameraSetup event has the same effect as the second gif but the mouse no longer lines up with where the player is looking. So I am hoping that anyone out there knows any of: GL commands to move the camera along the world axes instead of the screen axes How to convert some world coordinates to screen coordinates, so that maybe I can move the camera that way (I thought about maybe using the modelview matrix but don't know the best way to get hold of that) A different method that accomplishes the original effect Why the effect of added roll has changed between 1.7.10 and 1.12.2 The obvious answer that I've probably missed because of massive tunnel vision Anything else that might help Thanks for reading.
  4. This was flagged up as an issue on the MinecraftForge GitHub but unfortunately it hasn't gone anywhere yet.
  5. Sorry, I screwed up. The TileEntityType was null because I had forgotten to make that variable an ObjectHolder. Thank you anyway!
  6. My mod is supposed to allow users to customise any tile entity's behaviour by entering its ResourceLocation string and other parameters in a text file. This text file is imported at runtime and used to add Capabilities. For a given TileEntity object , it should obtain the ResourceLocation and use that to search the data imported from the text file. In 1.12, I got that data for any given TileEntity by using the registry in the TileEntity class, which mapped between ResourceLocations and TileEntity Classes. In 1.13, it looks like that registry has been replaced with ForgeRegistries.TILE_ENTITIES, which maps between TileEntityTypes and ResourceLocations. However, when a Capability is constructed I can't get the TileEntityType because TileEntity variables are always null or 0 when Capabilities are being added. It seems that the Class is the only distinguishing information I can get from a TileEntity object when Capabilities are being attached. Is there a simple way around this that will let me keep using ResourceLocations, or will I need to ask users to enter the Class name instead of the ResourceLocation? Thanks for reading.
  7. Well like I say I didn't see MissingMappingsEvent fired for tile entities. GameData doesn't seem to call makeRegistry for tile entities either. I'll change the ResourceLocations; guessing because your way is harder to screw up and avoids an extra function call?
  8. Yep, I don't want to lose data from a world made before changing the ID. The TileEntity stores teleporter data, so on a world with lots of teleporters players would have to break and replace all their teleporters and that could be tedious with a lot of teleporters in the world. I also have another TileEntity which has an inventory, and I wouldn't want players' items to be destroyed. I can keep the IDs the way they are; I'd just like to be able to change the ID to make my code a bit more consistent.
  9. I want to change the line GameRegistry.registerTileEntity(TileEntityFireplace.class, new ResourceLocation(DataReference.MODID+":fireplaceTE")); to GameRegistry.registerTileEntity(TileEntityFireplace.class, new ResourceLocation(DataReference.MODID+":fireplace")); but if I run post-change Minecraft with a pre-change world I get the error [15:23:33] [Server thread/WARN] [minecraft/TileEntity]: Skipping BlockEntity with id ftfloocraft:fireplace and the TileEntity is gone, because there doesn't seem to be an opportunity to remap the pre-change TileEntity to the post-change ResourceLocation. MissingMappingsEvent didn't seem to fire for TileEntities. My only idea right now is to register the tile entity once with the old ResourceLocation and once with the old one, and then somehow migrate the NBT data over. Is there a better way? Thanks for reading.
  10. Do you happen to know why? It seems like a deliberate decision
  11. Something I'm working on right now needs to be able to rotate minecarts on the z axis before they render, so I wrote the whole thing thinking there would be some kind of RenderEntityEvent I could use. I've found RenderPlayerEvent and RenderLivingEvent but I can't find anything that fires for just any entity. My guess is it hasn't been implemented because it would fire a lot, which I sort of understand. I'd really appreciate one of these in a future Forge version, or at least the reason why it hasn't been implemented... or if it actually has been implemented can someone please tell me how to use it? I know one workaround involving overriding the handler in RenderingRegistry; as far as I can tell registering the new handler requires you to know the class of the entity to override, which is not great if you want to use Capabilities to work with mod entities as well. Thanks for reading.
  12. The log says the crash is because of line 26 of EntityKnowledge, in the constructor, but in your pasted EntityKnowledge code line 26 is just defining canBeRidden... is that definitely the same EntityKnowledge code that produced that crash log?
  13. Ah never mind, I messed up. Code from 1.7.10 does work after all. Oops?
×
×
  • Create New...

Important Information

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