Jump to content

Sync Views

Members
  • Posts

    37
  • Joined

  • Last visited

Everything posted by Sync Views

  1. Use a debugger and put a break point on getServerGuiElement and getClientGuiElement. That will tell you exactly whats going on. e.g. confirm that both client AND server are creating there part of the GUI, and that the right thing is created each side. Also a literal value in a switch is almost always the wrong thing to do, as with a literal true/false in an if statement. The entire construct serves no purpose.
  2. Maybe make a dedicated recyling station or something. Then you could make the recipes for it work how you want.
  3. Why not look at the existing blocks that interact with redstone (wire, torch, door, etc.). IIRC there are some methods in World that look around for blocks providing a signal via isProvidingWeakPower and isProvidingStrongPower. Pretty sure there is nothing in there to check for entities, so I think you would need to put a core mod in those world methods to look for your entity (seems like a performance issue, maybe come up with a better way), then mark the blocks for update as your entity moves around so they recheck their redstone status.
  4. Or better yet, always use @Override when overriding any method, Minecraft or not. As well as telling you if you did the overload wrong (mispelt name, incorrect parameters etc.) it will help you if the base class/interface changes in an update.
  5. Be careful that if you read the NBT saved by one TileEntity into a different TileEntity you will change the position of it (TileEntity.writeToNBT and readFromNBT includes the xCoord,yCoord,zCoord), which will likely break things, so be sure to fix those coords once readFromNBT is complete, or have a custom read function entirely, or update the NBT with correct coords before read, etc.
  6. You really find command prompt easier than making use of the IDE's debugging, auto-completion and search capabilities? Sure for small projects, but I find that hard to believe when you have 100,000+ lines of code to deal with... You still have all the gradle stuff you can use from the command line (I think it has a separate target to recompile and to reobsucate giving you a deobsucated set of class files to test with if you really want to go the command line debugging route).
  7. Can you go lookup what 64bit means then? It has zero todo with dimensions like that... As for the sand problem. Why don't you try looking at the code for things like that? In short for certain blocks the texture name is ignored for whatever reason, so you would need a core mod for all those cases to load something differently immediately, or at least reflection to overwrite some private fields later. Not sure what you mean by biome colours. If you mean like grass and leaves being recoloured based on biome, again look through the code. Its either a method on the block or part of the renderer if they have a different render type to normal blocks that provides a multiplier. If you want to change that you might be able to set something in the biomes to get the colour you want, otherwise again you need to modify how that code path works.
  8. diesieben07's and other similar methods is the only way I know of if you have source dependencies where you want to import any type from the other mod, rather than just use a basic Block returned by GameRegistry or such. If that "do your stuff" depends on anything from the other mod, then you will get a NoClassDefFoundError as soon as Java tries to load your classes because it tries to fully resolve everything as soon as the class files are loaded, not waiting until the first reference is actually executed (the contents of your if statement). Just make a central class (ideally in its own package to keep things separate, say mymodpackage.othermod.Extension implementing an interface mymodpackage.IExtension) for the extension. And make sure that nothing else in your mod ever imports one of the classes from that package (likely to give you a NoClassDefFound if the other mod isn't present). If you detect the mod is present (be careful of load order, e.g. I think its possible for Loader.isModLoaded to return false for a mod that is present if you call it too early, possible preinit and certainly any static initialisers) then use "(IExtension)Class.forName("mymodpackage.othermod.Extension").newInstance()" to get an instance of that class without it ever being imported (Java will only attempt to load those class files at this point, avoiding the NoClassDefFound if the other mod is not present). You could also thus do a try/catch around the Class.forName(...).netInstancerather than check Loader.isModLoaded.
  9. Ive seen some mods with API's that provide access to their blocks etc. by reference, and dont require the full mod the be present. You could do something similar and would make it easier for anyone else that depends on your mod to deal with such things. Potential problem with this though. Say your mod is installed and the player has some of your items/blocks. Then installs some other mod without completely restarting their world. They will now be unable to correctly load that world because you essentially uninstalled content that the world already depended on. This might be alright if your mod significantly effects terrain generation, but even for just say some new ores (and especially if your mod or another already had a compatible ore) they may want to keep their world.
  10. 64bit? 65bit? Most textures in any game Ive come across recently are 24bit RGB or 32bit RGBA, so really not sure what you mean there. Also if you use a resource pack or put the textures in the jar, you still have to update them if MC changes something relevant (e.g. new blocks or reworks the texture system again). The only potential advantage I see of putting a texture pack in a mods jar would be to make it enabled by default, but there is possibly other ways to do that as well. Also using a different base graphics set creates a compatibility issue with basically every other mod.
  11. Think the Item ItemBlock and Block just use the Object version of equals which uses identity. Although I guess a mod might try to override it for their own types. Eclipse shows the referenced jars at the bottom of the package manager. You can see the classes and if available their sources there. Everything else, goto declaration, find references, etc works largely the same as for your own code in the project.
  12. A very quick look in my IDE showed my World.computeLightValue, which when computing for sky lighting immediately checks canBlockSeeTheSky... So if you actually want your block to behave like sky (so essentially light an infinite distance downwards through air) id mod that function to call a custom canBlockSeeTheSky type function that also returns true if when searching upwards it finds your block.
  13. Sun light doesnt exceed 15. It just all cells with direct view of the sky get this 15 value if i recsll correctly. If this is what you want you could find where in the lighting code this happens you can maybe make your block count as the sky. Pretty sure will need to be a core mod todo that.
  14. Well if the mod has compatibility with it its likely fine. e.g. I had some shortcomings i their API, so my stuff can interact with the major existing power nets, with some limitations, but if stuff from my mod is directly connected, it acts as a power and data channel (e.g. I integrated power demand and distribution, in a far simpler way for the player than trying to have say on demand buildcraft power using gates as long as all the generators and consumers are either capable, or at least have suitable estimated values)
  15. I am looking into making some large multiblock machines and storage, like say many of the machines and the iron tank from Railcraft. My idea is to have one main TileEntity that deals with all the logic, and I can make code when a block is placed or destroyed to see if the structure is complete. For smaller structures I could also encode the blocks relative position in the meta data (so can get the centre block / main TileEntity quickly without having to do a search). For larger structures I am not entirely sure. The problem though is in order for things like hoppers, Buildcraft pipes, etc. to work, I need a fully functional IInventory etc. TileEntity for each of the blocks that these things need to interact with. I can make the "proxy" TileEntity reference the main one, but what do I do if it is a chunk border and the main entity isn't loaded? I looked at TileEntityChest, but from what I can tell it relies on other entities like the hopper giving it special treatment. Also while the examples I can think of are from closed source mods, is there a standard way to do this? Perhaps an open source example?
  16. Id possibly have another look at the uniqueid thing again, and look closely in a debugger to see why it doesn't work as expected. I only just looked very quiickly in a 1.7.2 source, but the Entity class writeToNBT and readFromNBT do appear to be saving and loading the UUID entityUniqueID (which appears to be returned by getPersistentID AND getUniqueID, you will need to check the sources for whichever version of MC to see if this has changed).
  17. Not got a direct solution to this, but after both your tile entity and entity have been loaded, what is the contents of loadedEntityList? Can you locate the entity your looking for manually and see what is persisted that you can use?
  18. Use an IDE to step through the code in debug. The following line looks like it is intended to prevent this from happening, so maybe something is wrong there, like shootingEntity being assigned the wrong reference or it taking long enough to clear the player for the second condition to be true? if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5))
  19. GuiChest and ContainerChest themselves should be fine, since if I remember correctly they just work with a pair of IInventory instances. However the IInventory you are using there, InventoryEnderChest does depend on a tile entity, so guess the instance might not be valid where/how your using it.
  20. Are mods not meant to use the GameRegistry or at least GameData to register blocks and items in a manner that lets Minecract/Forge/FML worry about the id's? Also I think it might need to be in the FMLPreInitializationEvent event now, I am not sure if it works fully in the other 2 events?
  21. Exactly what bit of code? there is net.minecraft.block.BlockBeacon and net.minecraft.tileentity.TileEntityBeacon TileEntityBeacon.func_146003_y appears to be looking around for other blocks, checking Block.isBeaconBase. Not really looked through the files though, a lot hasn't been deobfuscated and no comments have been added so you will need to work it out from the code.
  22. Think I got a basic network working. Had some issues with a multiple block machine. I didn't want to allow machines to allow through traffic, or confusing connected to multiple unique networks at once (for now at least, perhaps later I'll let machines have multiple terminals) so the machine would often just connect to itself and reject the cable connection lol. Think I solved that with a "TileEntity INetworkProxy.getReal()" method and more complex getAdjacentNetworks. Didn't see any such things in your code, suspect when I test more tomorrow its going to give me lots of problems if the machine itself crosses a chunk boundary and is only partly loaded since I guess the proxy code (including for ISidedInventory) can fail giving me an object that claims to implement an interface but cant actually do anything with it...
  23. Not looked through all the code, but looks like you did what I suggested and made the cable blocks a tile entity. Then on an entities first update it will attempt to create, join or merge networks (so things like the card reader are also like a cable, it cant connect to two separate unrelated networks). Also as far as I can tell you never save the Network but just create it on demand (for both client and server?)? That was something I wanted to do so that the network can maintain state, although thinking about it I guess the devices etc. could store the relevant state for themselves in any situation I can think of. So if part of the network gets unloaded everything carries on but that bit doesn't send/get events?
  24. I was thinking about working on something that would require some fairly complex interactions between linked tileentities (so I guess kind of like LogisiticPipes, rather than normal Buildcraft pipes with the way it needs to know about everything to route stuff). Ideally Id like this to work by forming a network which has references to all the relevant TileEntity instances, and runs its logic once per tick. However not sure about some conceptual issues: [*]If I have a separate Network object, how do I handle loading and saving of this object? Its not part of any one TileEntity, they might not even be loaded and saved at the same time. Likewise it isn't really owned by any specific block, so cant be a TileEntity itself, and there needs to be a way for any loaded TileEntity in the network to find this object. [*]How do I handle if the Network spans multiple chunks? My current idea is to make it so in the networks update method, it checks all the chunks for connected devices and only updates if there all loaded (it needs to get the TileEntity for each of those x/y/z's anyway since unloading/reloading a chunk changes the TileEntity object references unless there is also some way around that). [*]When to recreate the network graph. Finding all connected devices provided all relevant chunks are loaded is easy, but when to update it. My best idea right now is to make every thing that might be part of the network, including blocks that are just acting as wires/connections be a TileEntity that just references the network (however 1. is solved). However won't such a large number of TileEntity instances that do nothing degrade performance? I know people complain about build craft pipes, logistic pipes, alternatives, paintings, item frames, etc. and blame them when the server lags, and I can think of many ways the simple presence of a number of TileEntity instances in the chunk might hurt performance, but I have no idea if this is truly a noticeable amount.
  25. I am sure I saw something a while back but can't find it now. Sometimes when implementing something I come across stuff that hasn't been deobfuscated, e.g. func_145828_a as well as member variables, and function parameters (although not sure what the default scheme is there, some use var0, var1, var2, etc, some suffix the data type e.g. par1EntityPlayer, and others are just like p_149657_1_), since it is generally a lot easier when coding against named stuff rather than trying to figure out what the 6 numbered int parameters mean each time. Also sometimes a better documentation comment would be useful (e.g. can something be null or not and if so what null means). I recall seeing somewhere there was a way to submit such things (and what about just editing locally? at the very least adding comments shouldn't break the mods compatibility with everyone else), but cant find it now.
×
×
  • Create New...

Important Information

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