Everything posted by shieldbug1
-
Instalation Problems
In Eclipse, you open the project, then click on 'Referenced Libraries', then at the top there should be the forgeSrc jar - if you open that you'll find all the packages used for minecraft, Minecraft Forge and ForgeModLoader - net.minecraft.*, net.minecraftforge.* and cpw.mods.fml.*(which is getting renamed in 1.. If you're asking about where the actual library is located on your computer as a file, I think it gets cached by Gradle, though I'm not actually sure.
-
[Solved][1.7.10]Creating a Custom Enchantment Table
Show us what you've tried so far.
-
Instalation Problems
All Minecraft and Forge code can be found under 'Referenced Libraries' under the name forgeSrc-[MC_VERSION]-[FORGE_VERSION].jar Also, did you run gradlew eclipse in the directory?
-
Forge profile won't load, no errors downloading
You have not removed Java 1.8, as the log states. To resolve this, you must update to the latest version of Forge (10.13.1.1217). All Forge version can be found here. There is already a solution to this posted on the EAQ, so please go check if your problem is listed there next time before starting a thread.
-
createNewTileEntity() Not being called?
As diesieben07 said, in Java it is impossible to extend more than one class - this is what interfaces are for. In this case, the ITileEntityProvider interface.
-
[1.7.10] Adding functions to vanilla blocks
BlockEvent.BreakEvent
-
Is this the right way to check if the item in an ItemStack is an Item or a Block
The top one for blocks is right. For items just use ItemStack#getItem directly.
-
[1.7.10 / 1180] ChunkIOExecutor.syncChunkLoad not caching chunks
From what you're describing, this seems like a problem itself with Forge - I suggest you make an Issue regarding this here.
-
[Solved][1.7.10] Server and client gets out of sync
The TileEntity and the Block code. Or at least the places you change the metadata, and how/where you sync your variables.
-
[Solved][1.7.10] Server and client gets out of sync
I need to see your code.
-
[Solved][1.7.10] Server and client gets out of sync
They'll just be out of sync. Generally, all processing should go on the server, unless it relates to rendering.
-
[Solved][1.7.10] Server and client gets out of sync
Well, I haven't seen your code, so I can't tell you. Whenever the client exits the world, all Client data relating to the tile entity is gone. It is then synced again through getDescriptionPacket, onDescriptionPacket and possibly readFromNBT (or is it loadFromNBT?). Only the Server actually saves the information.
-
[1.7.10] Changing textures in real-time
Are you talking about blocks? A way to change blocks is to use metadata. Create an array of IIcons, and fill it up in Block#registerBlockIcons. Then you can do something as simple as @Override @SideOnly(Side.CLIENT) // Overriding methods that are only on the client should be marked SideOnly public IIcon getIcon(int side, int meta) { return iiconArray[meta]; } I forget the actual method names, but I'm sure you'll find it in the Block class. Then instead of changing textures on interact, just change metadata. If you're already using metadata, I think you might have to use a TileEntity to store the block's texture. Just override canUpdate in the TileEntity and return false since it's just there for storing data.
-
[Solved][1.7.10] Server and client gets out of sync
You have two options: 1) Server contains all variables, and sends a 'syncing' packet whenever the value is either changed. This would involve overriding getDescriptionPacket (I'm assuming you're using a TileEntity) so that the client also gets the values whenever it loads the TileEntity. This is a great tutorial on Packet (or more correctly, IMessage?) handling. Some people prefer using the vanilla packet instead, I personally don't like that. Personal preference, really. To make sure you send update whenever the important values that need to be synced are changed, just make sure you create getters and setters, and send the packet from the setter. 2) Update the values that you need whenever the server recognises that the player needs them - for example if they're only needed to be displayed on a GUI, then only update the values before the GUI opening (and maybe during the GUI being open if the values are changed). Make sure that you only send the packets to players that are near the TileEntity. Basically the same thing happens to update variables from the Client to the Server. Send the server the value that needs to be changed, and what is should be changed to, have the server verify that the value is possible (to prevent 'cheating'), and after changing then send the variable to any players around the TileEntity again. Hope this helps~
-
Minecraft refuses to launch
Use the latest forge.
-
Getting saplings to only grow on a specific block?
int metadata = world.getBlockMetadata(x, y, z); // Metadata at current point. switch(metadata) { case 0: return EnumPlantType.WHATEVER; case 1: return EnumPlantType.SOMETHING; default return EnumPlantType.SOMETHING_ELSE; }
-
Changing the Session, is it possible?
First of all, I suggest using either the ReflectionHelper or ObfuscationReflectionHelper classes - they make cleaner code, and change this: try { Field field = SomeClass.class.getDeclaredField("someFieldName"); field.setAccessible(true); Object object = field.get(SOMECLASS_INSTANCE); //do stuff } catch (Exception e) { try { Field field = SomeClass.class.getDeclaredField("field_SRG_NAME"); field.setAccessible(true); Object object = field.get(SOMECLASS_INSTANCE); //do stuff } catch(Exception e2) { //Log exception } } into Object object = ReflectionHelper.getPrivateValue(SomeClass.class, SOMECLASS_INSTANCE, "someFieldName", "field_SRG_NAME"); Much cleaner. Example code Field sessionField = ReflectionHelper.findField(Minecraft.class, "session", "field_71449_j"); ReflectionHelper.setPrivateValue(Field.class, sessionField, sessionField.getModifiers() & ~Modifier.FINAL, "modifiers"); ReflectionHelper.setPrivateValue(Minecraft.class, Minecraft.getMinecraft(), YOUR_SESSION_INSTANCE, "session", "field_71449_j");
-
mob checking blocks
Overriding handleLavaMovement seems like a good place to start. The method name is misleading, sorry. After looking through Entity code, I think it'd be better to just put it in the onEntityUpdate method. E.g. public void onEntityUpdate() { if(this.handleLavaMovement()) { //DO STUFF } super.onEntityUpdate(); }
-
Waiting for Four Seconds
What do you mean it doesn't do anything? I use code like that all the time and it works fine. And don't delete code that doesn't work, post it here so that we can help you! We're not just going to give you copy-paste code, that's not how you learn.
-
Waiting for Four Seconds
You cache the time, and then compare it for the next twenty ticks. long cachedTime = 0L; boolean shouldRun = true; @SubscribeEvent public void someMethod(TickEvent.WorldTickEvent event) { if(event.side == Side.SERVER && event.phase == TickEvent.Phase.START) { if(shouldRun && event.world.getTotalWorldTime() >= cachedTime + 80) { cachedTime = event.world.getTotalWorldTime(); //DO WHATEVER if(someConditionThatMeansYouWantToStop) { shouldRun = false; } } if(someConditionThatMeansYouWantToStart) { shouldRun = true; } } } Another way to do this, if you want to run something every 4 seconds, instead of just waiting 4 seconds from a given time is using the modulo operator if(world.getTotalWorldTime() % 80 == 0) //runs every 80 ticks (given that the method gets called).
-
How to make an update checker
In your code you just need something like this: [READACTED] Looking at the code, it was pretty terrible. Removing so no one uses it.
-
Waiting for Four Seconds
While loops are a huge no-no in minecraft code. Ticks don't pass during the loop so they easily become infinite. And when you say huge stack trace I'm just going to guess you got a StackOverflow from some loop or another. You need to show us the code you used.
-
[Unsolved] How to get/set the NBT tag from a tile entity?
TileEntities, unlike ItemStacks don't have their own NBTTagCompounds, I believe. What are you trying to do? You're probably just thinking of thinking about the problem the wrong way.
-
[1.7.x]TileEntity/Block that can load chunks
From what I understand by reading through the class, you need to call ForgeChunkManager.setForcedChunkLoadingCallback(YOUR_MOD_INSTANCE, LoadingCallbackImplementation). The LoadingCallback implementation is used to reregister the chunks that need to be loaded, from what I understand, upon the world loading (through this method): @Override public void ticketsLoaded(List<Ticket> tickets, World world) { // Rereigster the chunks to be loaded here with a list of your mods' tickets. } Then you'd need to actually request a ticket using ForgeChunkManager.requestTicket(YOUR_MOD_INSTANCE, WORLD_INSTANCE, TICKET_TYPE); This is what actually allows you to force the chunk to load. To actually force the chunk to load you use ForgeChunkManager.forceChunk(TICKET, CHUNK); When you're done with a chunk you use ForgeChunkManager.unforceChunk(TICKET, CHUNK-COORDS), or alternatively if you are done completely with forcing chunks you can use ForgeChunkManager.releaseTicket(TICKET); I could be (and most likely am) wrong on some parts, but this should help you figure out the rest (I hope). c:
-
Waiting for Four Seconds
Sorry, my bad. World#getTotalWorldTime or World#getWorldTime.
IPS spam blocked by CleanTalk.