
McJty
Members-
Posts
129 -
Joined
-
Last visited
Everything posted by McJty
-
I have a weird problem. I have a TESR that used to work fine. i.e. if I have multiple blocks that all use that TESR then they would all render fine. However, today I upgraded my CoFH in the dev env to the latest. I was still using a very old CoFH. And now only one block shows. I already debugged stuff and it appears that the TESR render code is only called for one of my blocks. If I break that block then another block will be rendered. But always just one. I have no clue why this appears after updating CoFH as I don't see a relation with that. However, I was already having a similar issue with another TESR in my mod. In my dev env that used to work fine but I had already noticed that in my own custom modpack (which was already using a recent CoFH) it wasn't rendering properly either. i.e. again only one would render. So... I'm probably doing my TESR wrong but I have no clue what or how. Here is the relevant code: https://github.com/McJty/RFTools/tree/master/src/main/java/com/mcjty/rftools/blocks/screens The relevant TESR is ScreenRenderer.java and it is attached to the ScreenTileEntity class. Any hints as to what I'm doing wrong would help a lot as I'm out of idea. It is probably something stupid. Thanks!
-
Thanks for the reply. I already found out that disabling waila ('1' key) actually solves the issue.
-
Hi, I'm trying to render an ItemStack in my TESR. It works but the problem is that the lighting varies depending on how you look at it. Here you see two screenshots with the view slightly altered. Look at the lighting on the three item stacks: I have tried various things but I can't get this consistent. Here is the code of the TESR: https://github.com/McJty/RFTools/blob/master/src/main/java/com/mcjty/rftools/blocks/screens/ScreenRenderer.java and the code for the module that handles the itemstack rendering: https://github.com/McJty/RFTools/blob/master/src/main/java/com/mcjty/rftools/blocks/screens/modulesclient/ItemStackClientScreenModule.java Thanks for any assistance!
-
Ok, thanks for that information. For now my mod is still 1.7.10 only though.
-
Hi, when sending a packet over the network (using SimpleNetworkHandler) from server to client. Is there a maximum? I know TCP has a packet limit of 64K but does MC itself impose a smaller maximum? Thanks,
-
Mystery: One class of my mod cannot be found in some rare cases
McJty replied to McJty's topic in Modder Support
Well I have to give a class to registerTileEntity so I can't use that unfortunatelly. -
Hi, in my mod RFTools I have had two distinct reports that some people get a ClassNotFound exception for a class that is clearly a part of my mod. Here is one such reports: However, nearly everybody else (except for the two reports I got) has no problems with this at all. Also the report above was apparently fixed in a more recent version of my mod but the other person still has the problem. The problematic class is very simple: package com.mcjty.rftools.blocks.crafter; public class CrafterBlockTileEntity1 extends CrafterBlockTileEntity3 { public CrafterBlockTileEntity1() { super(); setSupportedRecipes(2); } } Code can be found here: https://github.com/McJty/RFTools/tree/master/src/main/java/com/mcjty/rftools/blocks/crafter I have absolutely no clue why this class cannot be found in some situations and as I cannot reproduce it myself I also have no idea how to solve this. It is as if the class is somehow removed from the class path. Anyone has any suggestions as to what could be wrong here? Thanks!
-
Hi, I'm trying to regenerate chunks from within Minecraft. I looked at ICBM source code for the rejuvenation bomb as well as the MCEdit mod which can regenerate chunks. Here is the adapted ICBM code: public static void refreshChunksBAD2(World world) { try { ChunkProviderServer chunkServer = (ChunkProviderServer) world.getChunkProvider(); List<ChunkCoordIntPair> toUnload = new ArrayList<ChunkCoordIntPair>(); for (Object obj : chunkServer.loadedChunks) { Chunk chunk = (Chunk) obj; toUnload.add(chunk.getChunkCoordIntPair()); } for (ChunkCoordIntPair pair : toUnload) { Chunk oldChunk = world.getChunkFromChunkCoords(pair.chunkXPos, pair.chunkZPos); WorldServer worldServer = (WorldServer) world; ChunkProviderServer chunkProviderServer = worldServer.theChunkProviderServer; // IChunkProvider chunkProviderGenerate = ObfuscationReflectionHelper.getPrivateValue(ChunkProviderServer.class, chunkProviderServer, "d", "field_73246_d"); IChunkProvider chunkProviderGenerate = chunkProviderServer.currentChunkProvider; Chunk newChunk = chunkProviderGenerate.provideChunk(oldChunk.xPosition, oldChunk.zPosition); for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { for (int y = 0; y < world.getHeight(); y++) { Block blockID = newChunk.getBlock(x, y, z); int metadata = newChunk.getBlockMetadata(x, y, z); worldServer.setBlock(x + oldChunk.xPosition * 16, y, z + oldChunk.zPosition * 16, blockID, metadata, 2); TileEntity tileEntity = newChunk.getTileEntityUnsafe(x, y, z); if (tileEntity != null) { worldServer.setTileEntity(x + oldChunk.xPosition * 16, y, z + oldChunk.zPosition * 16, tileEntity); } } } } oldChunk.isTerrainPopulated = false; chunkProviderGenerate.populate(chunkProviderGenerate, oldChunk.xPosition, oldChunk.zPosition); } } catch (Exception e) { RFTools.logError("Failed to regenerate chunks!"); e.printStackTrace(); } } and here is the adapted MCEdit code: public static void refreshChunksBad(World world) { try { ChunkProviderServer chunkServer = (ChunkProviderServer) world.getChunkProvider(); Field u; try { u = ChunkProviderServer.class.getDeclaredField("field_73248_b"); // chunksToUnload } catch(NoSuchFieldException e) { u = ChunkProviderServer.class.getDeclaredField("chunksToUnload"); } u.setAccessible(true); Set<?> unloadQueue = (Set<?>) u.get(chunkServer); Field m; try { m = ChunkProviderServer.class.getDeclaredField("field_73244_f"); // loadedChunkHashMap } catch(NoSuchFieldException e) { m = ChunkProviderServer.class.getDeclaredField("loadedChunkHashMap"); } m.setAccessible(true); LongHashMap loadedMap = (LongHashMap) m.get(chunkServer); Field lc; try { lc = ChunkProviderServer.class.getDeclaredField("field_73245_g"); // loadedChunkHashMap } catch(NoSuchFieldException e) { lc = ChunkProviderServer.class.getDeclaredField("loadedChunks"); } lc.setAccessible(true); @SuppressWarnings("unchecked") List<Chunk> loaded = (List<Chunk>) lc.get(chunkServer); Field p; try { p = ChunkProviderServer.class.getDeclaredField("field_73246_d"); // currentChunkProvider } catch(NoSuchFieldException e) { p = ChunkProviderServer.class.getDeclaredField("currentChunkProvider"); } p.setAccessible(true); IChunkProvider chunkProvider = (IChunkProvider) p.get(chunkServer); List<ChunkCoordIntPair> toUnload = new ArrayList<ChunkCoordIntPair>(); for (Object obj : chunkServer.loadedChunks) { Chunk chunk = (Chunk) obj; toUnload.add(chunk.getChunkCoordIntPair()); } for (ChunkCoordIntPair pair : toUnload) { int x = pair.chunkXPos; int z = pair.chunkZPos; long pos = ChunkCoordIntPair.chunkXZ2Int(x, z); Chunk chunk; if (chunkServer.chunkExists(x, z)) { chunk = chunkServer.loadChunk(x, z); chunk.onChunkUnload(); } unloadQueue.remove(pos); loadedMap.remove(pos); chunk = chunkProvider.provideChunk(x, z); loadedMap.add(pos, chunk); loaded.add(chunk); if (chunk != null) { chunk.onChunkLoad(); chunk.populateChunk(chunkProvider, chunkProvider, x, z); } } } catch (Exception e) { RFTools.logError("Failed to regenerate chunks!"); e.printStackTrace(); } } Both crash with exactly the same problem inside populateChunk() (showing the ICBM version crash log): Any idea how I can fix this? It says 'Already decorating!' which is a bit strange. It appears to recurse into the decorating stuff. If refreshing chunks like this fails I'm also happy with a method that simply cleans out the current dimension so that it gets regenerated again. I need this to test dimension changes faster. Thanks,
-
Thanks but what do the parameters of these function mean? boolean canCommandSenderUseCommand(int p_70003_1_, String p_70003_2_);
-
I'm currently using: MinecraftServer.getServer().getEntityWorld().getWorldInfo().areCommandsAllowed()) to test if a console command should be allowed. But apparently this doesn't return true on the server console. How can I also allow commands on the server console? Thanks
-
Problem: TE.updateEntity() stops getting called sometimes
McJty replied to McJty's topic in Modder Support
Some extra information. It is always ok right after loading the world and it is also ok if I pick up my block and put it back again. I haven't really found a pattern yet. It is probably (and likely) a logic error in my code but I can't see it and putting a 'printf' in the updateEntity() shows that the updateEntity() is not called for some reason. Edit: also I have only been able to reproduce this on SMP. In single player it always seems to work fine. -
Problem: TE.updateEntity() stops getting called sometimes
McJty replied to McJty's topic in Modder Support
BTW: Here is the link to the misbehaving TE: https://github.com/McJty/RFTools/blob/master/src/main/java/com/mcjty/rftools/blocks/teleporter/MatterTransmitterTileEntity.java To clarify. It is the checkStateServer() method that is sometimes not called. This method is called from a superclass (GenericTileEntity): @Override public void updateEntity() { if (worldObj.isRemote) { checkStateClient(); } else { checkStateServer(); } } -
Problem: TE.updateEntity() stops getting called sometimes
McJty replied to McJty's topic in Modder Support
Since I'm standing right next to the TE I would say yes :-) -
Hi, this is with 1.7.10. I have a problem with one of my TE's. For some reason (usually after entering the dimension containing the TE) the updateEntity() function is no longer called on it (both server/client side). The TE does return true for canUpdate(). What can I do to ensure my TE starts 'ticking' again after enter the dimension that contains it? Thanks,
-
How to handle recipes with multiple outputs (buckets)?
McJty replied to McJty's topic in Modder Support
Ok, but given that I have an IRecipe, how can I actually detect that there are multiple outputs? I'm uncertain how to go about fixing this properly. -
There are several recipes in minecraft and modded minecraft that use a filled bucket in some recipe and return an empty bucket and some item. How are these recipes handled? The IRecipe api only has methods for getting one result. I need this information for my auto-crafter block. Currently this block destroyes the buckets as it just replaces the input items with the output of the recipe. Thanks,
-
[1.7.10] Crash while trying to teleport to a dimension (only on server)
McJty replied to McJty's topic in Modder Support
Ok, thanks to the people at #minecraftforge I managed to get a solution by catching FMLNetworkEvent.ServerConnectionFromClientEvent on the server and then from there sending a message to the client to register all dimensions. Problem solved! -
[1.7.10] Crash while trying to teleport to a dimension (only on server)
McJty replied to McJty's topic in Modder Support
I'm making a mod similar to mystcraft (but then in a more technological fashion). This means the dimensions are dynamically created and associated with your world. So I don't know what dimensions there are at preInit time. The dimension information is stored in the mapStorage. (edited, I mean mapStorage of course) I just tried to do it with a PlayerEvent.PlayerLoggedInEvent. As soon as the player logs in it sends over a packet to the client with all the dimensions to register. However it comes too late. The client has already gone on and tried to load the player in my dimension which obviously not exists yet. So I think this is something that I have to do on the client somehow. Anyone? I know it is possible as Mystcraft achieves it. Just need to find out how. -
When I play SSP all is fine. I make a dimension and I can then teleport to it. However, when I do this on a server I get a crash at clientside: The code to create the dimension is (on the server side): DimensionManager.registerProviderType(id, GenericWorldProvider.class, false); DimensionManager.registerDimension(id, id); And to teleport to the dimension I do (on the server side): WorldServer worldServerForDimension = MinecraftServer.getServer().worldServerForDimension(message.dim); MinecraftServer.getServer().getConfigurationManager().transferPlayerToDimension((EntityPlayerMP) player, message.dim, new RfToolsTeleporter(worldServerForDimension, message.x, message.y+1, message.z)); Apparently this is not sufficient for the client. What do I have to do so that the client also gets to know the new dimension? Do I have to manually send a packet to the client and register the dimension there or is there some automatic way to do that? Edit: and related to this. I'm also using this code to register the dimensions when the server is started: @EventHandler public void serverStarted(FMLServerStartedEvent event) { ModDimensions.initDimensions(); } Where can I do the equivalent for client-side? Thanks,
-
I create my dimensions with: DimensionManager.registerProviderType(id, GenericWorldProvider.class, false); DimensionManager.registerDimension(id, id); In my own GenericWorldProvider I can change worldType in registerWorldChunkManager() but that seems not the right spot (or is it)? Basically where can I set the worldType to (for example) amplified or flat for a dimension I just created? I would like the dimension to have a different worldType then the overworld but I don't see where I can influence this during creation of the dimension. Thanks,
-
How to force load a dimension without teleporting to it
McJty replied to McJty's topic in Modder Support
Well most regular teleporters work by actually teleporting the player to the other dimension at which point everything is properly generated. I can't easily do that since the device in my mod that generates dimensions is separate from the teleportation system. With the teleportation system you can 'dial' matter transmitters to matter receivers that have been placed in the world. For that to work my matter receivers have to be registered to a datastructure that I keep with my game (World storage). This happens as soon as the matter receiver block is placed/generated. I made an iWorldGenerator implementation that generates this matter receiver and causes the registration of this so that my teleportation system knows about it. If I teleport into my dimension using some other means (I have a creative-only item in my mod that allows teleportation to any dimension) then the world generation will build my matter receiver and the registration will happen. At that point a dialing device can dial a matter transmitter to this new matter receiver. Previously I had custom code that let the dialing device also dial to dimensions for which no matter receiver was registered yet. But this was clumsy ad-hoc code and also had the problem of not knowing the exact y coordinate of the teleport destination since this wasn't generated yet. It also meant that the dialing device could not easily test if the destination had enough power (the matter receiver is a tile entity that has an RF buffer (prefilled at creation time of the dimension)). So all in all, a lot of clumsy code that was so easily avoided by just having that chunk generated. The solution I have now works fine though. After registering the new dimension I simply call loadChunk() and populate() on it and the matter receiver is properly created and registered. After that I don't need to do anything special and my teleportation system just works as it would normally. -
How to force load a dimension without teleporting to it
McJty replied to McJty's topic in Modder Support
Why exactly? I do want to do things the right way so I value feedback. -
How to force load a dimension without teleporting to it
McJty replied to McJty's topic in Modder Support
Actually the keepLoaded doesn't help since the spawn chunk isn't guaranteed to be at 0,0. I just tried to set it to true and the chunk at 0,0 (where my teleportation system is setup) is not loaded. Seems spawn point is a bit away from that. So I'm still stuck :-/ Ah. And keepLoaded doesn't even help at all since my IWorldGenerator implementation is *still* not called. Seems that IWorldGenerator is only called as soon as you actually teleport to a dimension? Seems weird... Aha, found something: WorldServer.populate(). This is the function that calls the IWorldGenerator stuff. Last edit: this solves my problem. Very nice! -
How to force load a dimension without teleporting to it
McJty replied to McJty's topic in Modder Support
Well when my dimension is created I need to configure my teleportation system for it. That means I need to set up a 'matter receiver' there (which is done by worldgen as it is a block) and that has to be registered. In my current code I have a special case for dimensions that I haven't teleported too yet because the matter receiver hasn't been created yet. That causes my code to be more complex and also has the additional problem that without the world being generated I actually don't know the y location of the teleporter yet. So it would be ideal if I could let worldgen do its job for that chunk so that the matter receiver gets registered to the teleportation system as usual. That way I can get rid of all special case code and also make sure that I now where the teleporter is going to be. I can't image this is not possible given that in Minecraft there must be code that actually fully creates the chunk. I was trying to trace through the code that is done when you do an actual teleportation but that is rather complex and I quickly got lost in it.