Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Leaderboard

Popular Content

Showing content with the highest reputation on 12/18/17 in all areas

  1. This is some good stuff from diesieben07. @MSpace-Devto summarize, instead of looking 256 blocks in each direction you'll look 16 chunks in each direction (i.e. your main loop). For each chunk cooordinates (calculated by shifting the bits in their corner block's position as mentioned by diesieben07), you use the world's getChunkFromChunkCoordinates() method to get the chunk, and then use the getTileEntityMap() method on that chunk, then do whatever you need to with the tile entities in the map. By the way, if your code is still lagging after all this you can consider distributing the execution over several ticks. In most cases things don't have to all happen together in exactly the same tick, so for example you could process all chunks in one direction in one tick, all in in another direction in the next tick, etc. and then repeat. One other thing to consider is that 16 chunks away is a pretty big distance. There is a reason why Minecraft stops tracking entities at a distance, only loads chunks when needed, and basically limits the scope of what needs to be processed. While it is nice to consider mod features that process the "whole" world, there are practical considerations. Since the performance workload grows as the square of the radius. So just reducing the radius a bit will greatly improve performance. So you if you have problem at 16 chunks, try 15, 14, etc.
  2. I can't believe I didn't realise that. Thanks for explaining!
  3. You are iterating through all Blocks, to get their chunk... which contains 256*height blocks already, leading to getting the same chunk about as many times.... Get the BlockPos at whatever is looking for all of these tileentities (the blockpos of this scanner). Get the ChunkPos from that. Great you got the center chunk. Now you have the ChunkX & ChunkZ values. As Chunks are 16 blocks across, you need to do as Diesieben said and run 2 for-loops, from each counting from -8 to 8 (inclusive (128 blocks radius)). Then you add the first loops value to either chunk values, and the other loop-values to the other. Now you got all chunks in this 256^3 area. Stuff these different ChunkPos coordinates you just calculated in a collection, and loop throughChunk::getTileEntityMap as described again by Diesieben.
  4. In my case 'preview_OptiFine_1.12.2_HD_U_C8_pre' prior to 12-18-2017 was causing chests not to open. I DL'd the 12-18-2017 version that is compatible with forge 2577 and the chests open as before.
  5. My harvest swords can be repaired with the ToolMaterial's repair item in anvils and I don't override any repairing-related methods or subscribe to any anvil-related events to achieve this; it just works by default. It looks like ModTools.initRepairs isn't being called from anywhere, since it's private and not called in ModTools. This means that your ToolMaterials' repair items aren't being initialised; which would explain why your tools can't be repaired. What do you mean by "it won't register"? Did you try to use the ItemAxe(ToolMaterial) constructor with a non-Vanilla ToolMaterial only to find that it threw an ArrayIndexOutOfBoundsException? You need to use the ItemAxe(ToolMaterial, float, float) constructor for modded ToolMaterials; the ItemAxe(ToolMaterial) constructor uses the ToolMaterial's ordinal as an index for the ATTACK_DAMAGES and ATTACK_SPEEDS arrays, which only have values for the Vanilla ToolMaterials.
  6. Yeah, it took me a while to realize that a modder should pretty much always test with a dedicated server as the client run configuration hides all this sided stuff, so that makes sense while this was lurking while you got things well developed... So if it is only happening when running as server I guess it probably is related to sided class loading. In terms of debugging it, sometimes errors are thrown in a way that doesn't correctly identify the root cause. Like maybe the calling class has an issue. But I have some suggestions. First of all, it seems to be having trouble on the line where it instantiates a new NBTHelper. So why not try commenting out everything except the constructor in the NBTHelper class and see if it fixes the issue. If it does, then add the methods back one at a time until a problem occurs. If the issue isn't fixed by minimizing the code in the class, then that would be odd but you could try looking at class loader inspection. Others on this forum might be more familiar with the class loader, but generally you might be able to inspect it using standard techniques in Eclipse: https://help.eclipse.org/neon/index.jsp?topic=%2Forg.eclipse.mat.ui.help%2Ftasks%2Fanalyzingclassloader.html In general the error means that the class is not loaded (into memory) for the JVM (in this case the server JVM). I think you can also set the run configuration vm to be more verbose in the console and perhaps more class loading info might show up.
  7. Is this code yours originally, or are you contributing to someone else's code? I'm asking because the code is fairly complex and seems to be fully implemented, yet errors like this are sort of fundamental so it is surprising you're finding this out now. If this is your own code, then I just want to pass on advice to say that it is important when doing a big mod to test every bit at a time to make sure it is working well before continuing to add code, otherwise you end up with this sort of thing (where you have tons of code but weird, fundamental bugs). In particular, the NBT stuff is a bit convoluted. I understand sometimes it is nice to encapsulate things with helpers, but in this case it is instantiating a builder that gets associated to a compound and redirecting almost everything you might want to do with NBT through methods that access that compound. Not sure that complexity is really necessary or worth it. Anyway, it is true that there isn't anything obvious that would be related to sided issues. So maybe it is related to some other reason the class wouldn't be found. Like is there something wrong with the package or class path?
  8. Stuff that is client side annotated has no meaning on the server. You can use sided annotation on specific fields and methods in your class. So if you have methods that reference client-side stuff you can annotate that method. So just put sided annotation on your registerModels() method and anything that calls it.
  9. Okay, so after digging around for a bit, it is a bit tricky to intercept block gen after everything has been populated. The most efficient place is where the ChunkPrimer is directly accessible, but the replaceBiomeBlocks event is too early for many types of surface biome-based blocks -- the event seems to be intended for entirely replacing the generation. I think I'll file an issue and maybe a pull request to allow the ChunkPrimer be availabile in most gen events and also ensure there is an event that is fired just before the ChunkPrimer is copied into the Chunk thereby allowing editing after everything else is complete. In any case, it seems that the most consistent place where you have access to all the blocks after they are freshly created is the ChunkEvent.Load event which is called both after generation as well as actual loading. So the following example worked for me -- for fun I replaced all grass with slime blocks: public static Block fromBlock = Blocks.GRASS; // change this to suit your need public static Block toBlock = Blocks.SLIME_BLOCK; // change this to suit your need @SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true) public static void onEvent(ChunkEvent.Load event) { Chunk theChunk = event.getChunk(); // replace all blocks of a type with another block type for (int x = 0; x < 16; ++x) { for (int z = 0; z < 16; ++z) { for (int y = theChunk.getHeightValue(x, z)-20; y < theChunk.getHeightValue(x, z)+1; ++y) { if (theChunk.getBlockState(x, y, z).getBlock() == fromBlock) { theChunk.setBlockState(new BlockPos(x, y, z), toBlock.getDefaultState()); } } } } theChunk.markDirty(); } How deep you go from the top block is up to you. For replacing grass I just needed to find the surface blocks, but I found some cases where grass would be under a floating island or other overhang and so technically wasn't the top block. If you were replacing ores for example you'd want to go deeper and such. I didn't notice any lag, but I've got a decent computer. For very specific cases, there are other events that are better. But in the generic case it seems that currently the load event is best.
  10. Forge Version: 1.12.2-14.23.1.2554 Minecraft Version: 1.12.2 Downloads: Changelog (Direct) Windows Installer (AdLink) (Direct) Other Installer (AdLink) (Direct) MDK (AdLink) (Direct) Universal (AdLink) (Direct) Hello again everybody! Time for another recommended build for Forge! 1.12.2 has been stable for quite a while now. Mojang is now pushing out snapshots for 1.13 which is going to be a big change. However, nobody truly knows whats going to happen in it. So don't get freaked out. We'll see what happens when it happens. I figured it would be a good time to wrap all the cool bug fixes and changes we've added to Forge so we can start working on even more! Minecraft Forge 14.23.1 Changelog: ============================================================================ New: Added new /forge gen command to allow admins to generate large amounts of chunks. Added new /forge entity list command to list all entities in the current world. Added config option to fix various Vanilla world cascading issues. This changes some vanilla block placement so it's opt-in. But it fixes some vanilla world gen performance issues. Added EntityEntryBuilder, Modders should use this for building their entity registrations. Added hook to allow custom MapDecorations. Decreased memory size of Sprite based Item models. Added Capability support to Chunks. Added hook for ownership of sub-items. Added support for client or server only dependancies. Added hook for better block slipperiness control. Added hook to control dimension lighting. Changed Universal Bucket design, will now use vanilla texture if applicable with lower memory footprint. Changed Block Reach Distance to a player attribute instead of a shared constant. Added hook to allow custom entity selectors in commands. Changed ThrowableImpactEvent into a more generic format. Added method to allow custom recipes to be auto filled from the GuideBook. Added InputUpdateEvent to react to polling keyboard/mouse. Added a new cloud renderer that utilized your graphics card better. Increasing performance. Changed how recipes using wildcards are processed. Modders should considering explicitly defining all subtypes. Bug Fix: Fixed search tabs using wrong contents. Fixed ShapedOre recipes not laying out correctly with the guidebook. Fixed error handling related to OBJ model materials. Fixed chunk gen mobs not firing the CheckSpawn event. Fixed lighting not being correct in certain cases related to potions and time of day. Fixed splitting of large S->C custom payload packets. Fixed netty spam related to large packets. Fixed IngredientNBT comparing stackSize Fixed potential BlockPos leak. Fixed vanilla bug causing blank renamed books being useless. Fixed Shaped recipes that are larger then 3x3. Fixed dormant chunk cache loosing entity data. Fixed block and torch placement logic. Fixed being unable to see with night vision in certain conditions. Fixed Item Models with formats other then ITEM. Fixed items not blocking interaction when in off hand. Fixed performance issue related to S->C chunk data packets. Fixed performance issue in model building. Fixed some interactions with entities and modded Items. Fixed performance regression in FastTESR rendering Fixed bug in animation system with rotations. Fixed stacked item entities rendering incorrectly. Fixed vanilla bug where spider and chicken jockeys would not spawn. Fixed some performance issues in chunk rendering. Fixed some missing material changes. Fixed performance with default implementation of inputting items into an inventory. Fixed default fluid blocks not using fog color of their fluid. Fixed vanilla bug where combat tracker lost data when killing entity. Fixed vanilla bug where chunks would not properly know their max height until updated. Causing spawning/block tick issues. Fixed crash when modders remove all flowers from certain biomes. Fixed fake players accumulating advancements. Fixed performance issue related to collision checking. Fixed config properties loosing comments when being renamed. Fixed LivingDamageEvent not firing for some entities. Fixed broken vanilla Shapeless Recipe matching function causing some recipes to not work depending on the order of items in the crafting grid. Fixed fluid models not supporting tinted layers correctly. Fixed NPE when player tries to sleep without a bed. Fixed incorrect vanilla horizon lighting. Fixed incorrect lighting of item models. Fixed ItemModel transparency generation. Fixed graphics issue on some Mac systems with the Splash Screen. Fixed memory leak in networking. Fixed race condition causing an error when quickely closing a single player world and opening another. Fixed non-player entities being placed incorrectly when being teleported between dimensions. Fixed Universal Bucket not firing BucketUse event. Fixed CompoundIngredients not working properly in shapeless recipes. Fixed version icon response packet leaking memory. Fixed BufferBuilder not growing if used in specific ways.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.