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.

Anon10W1z

Forge Modder
  • Joined

  • Last visited

Everything posted by Anon10W1z

  1. Use reflection. Access transformers are useless.
  2. Your mod may be getting loaded after BuildCraft...try adding dependencies = "after:*" To your @Mod declaration. Replace the * with BuildCraft's mod id.
  3. Sorry but I couldn't help but notice your username. Reddit?
  4. I prefer to keep it on one line.
  5. Nope, I put the name of the new block and the object of the old block, just like it said in the Javadoc. BlockNewDirt extends BlockDirt.
  6. You can also use multiple items in one handler. return fuel.getItem() == YourMod.firstItem ? burnTime * 20 : (fuel.getItem() == YourMod.secondItem ? secondBurnTime * 20 : 0) : 0;
  7. public class MyFuelHandler implements IFuelHandler { public int getBurnTime(ItemStack fuel) { return fuel.getItem() == YourMod.yourItem ? burnTimeInSeconds * 20 : 0; } } Seriously, it's not that hard. I was in a good mood.
  8. do MinecraftForge.EVENT_BUS.register with your handlers as well
  9. A while ago I found this https://github.com/SlimeKnights/TinkersConstruct/blob/4a5757bf1fe23dc9b1e652db628417c6b6fe9317/src/tconstruct/modifiers/TActiveOmniMod.java See the second method.
  10. OK, I tried a reflection-hack method: System.out.println(replaceBlock(Blocks.dirt, falling_dirt)); public static boolean replaceBlock(Block toReplace, Block newBlock) { Field modifiersField; try { modifiersField = Field.class.getDeclaredField("modifiers"); modifiersField.setAccessible(true); for (Field field : Blocks.class.getDeclaredFields()) { if (Block.class.isAssignableFrom(field.getType())) { Block block = (Block) field.get(null); if (block == toReplace) { String registryName = Block.blockRegistry.getNameForObject(block).toString(); int id = Block.getIdFromBlock(block); ItemBlock item = (ItemBlock) Item.getItemFromBlock(block); System.out.println("Replacing block - " + id + "/" + registryName); FMLControlledNamespacedRegistry<Block> registry = GameData.getBlockRegistry(); registry.putObject(registryName, newBlock); Field map = RegistryNamespaced.class.getDeclaredFields()[0]; map.setAccessible(true); ((ObjectIntIdentityMap) map.get(registry)).put(newBlock, id); map = FMLControlledNamespacedRegistry.class.getDeclaredField("persistentSubstitutions"); map.setAccessible(true); ((BiMap) map.get(registry)).put(registryName, id); field.setAccessible(true); int modifiers = modifiersField.getInt(field); modifiers &= ~Modifier.FINAL; modifiersField.setInt(field, modifiers); field.set(null, newBlock); Field itemblock = ItemBlock.class.getDeclaredFields()[0]; itemblock.setAccessible(true); modifiers = modifiersField.getInt(itemblock); modifiers &= ~Modifier.FINAL; modifiersField.setInt(itemblock, modifiers); itemblock.set(item, newBlock); System.out.println("Check field: " + field.get(null).getClass()); System.out.println("Check registry: " + Block.blockRegistry.getObjectById(id).getClass()); System.out.println("Check item: " + ((ItemBlock) Item.getItemFromBlock(block)).block.getClass()); } } } } catch (Exception e) { e.printStackTrace(); return false; } return true; } This gives the output: [11:17:56] [Client thread/INFO] [sTDOUT]: [com.anon10w1z.craftPP.blocks.CppBlocks:replaceBlock:62]: Replacing block - 3/minecraft:dirt [11:17:56] [Client thread/WARN] [FML]: **************************************** [11:17:56] [Client thread/WARN] [FML]: * Ignoring putObject(minecraft:dirt, com.anon10w1z.craftPP.blocks.BlockFallingDirt@3efcf4dd), adding alias to craft++:falling_dirt instead [11:17:56] [Client thread/WARN] [FML]: * at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.putObject(FMLControlledNamespacedRegistry.java:158) [11:17:56] [Client thread/WARN] [FML]: * at com.anon10w1z.craftPP.blocks.CppBlocks.replaceBlock(CppBlocks.java:65) [11:17:56] [Client thread/WARN] [FML]: * at com.anon10w1z.craftPP.blocks.CppBlocks.registerBlocks(CppBlocks.java:45) [11:17:56] [Client thread/WARN] [FML]: * at com.anon10w1z.craftPP.main.CraftPlusPlus.onPreInit(CraftPlusPlus.java:87) [11:17:56] [Client thread/WARN] [FML]: * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [11:17:56] [Client thread/WARN] [FML]: * at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)... [11:17:56] [Client thread/WARN] [FML]: **************************************** [11:17:56] [Client thread/INFO] [sTDOUT]: [com.anon10w1z.craftPP.blocks.CppBlocks:replaceBlock:88]: Check field: class com.anon10w1z.craftPP.blocks.BlockFallingDirt [11:17:56] [Client thread/INFO] [sTDOUT]: [com.anon10w1z.craftPP.blocks.CppBlocks:replaceBlock:89]: Check registry: class com.anon10w1z.craftPP.blocks.BlockFallingDirt [11:17:56] [Client thread/INFO] [sTDOUT]: [com.anon10w1z.craftPP.blocks.CppBlocks:replaceBlock:90]: Check item: class com.anon10w1z.craftPP.blocks.BlockFallingDirt true [11:17:56] [Client thread/INFO] [craft++]: Pre-initialization completed successfully [11:17:56] [Client thread/INFO] [FML]: Applying holder lookups [11:17:56] [Client thread/INFO] [FML]: Holder lookups applied [11:17:57] [sound Library Loader/INFO]: Starting up SoundSystem... [11:17:57] [Thread-7/INFO]: Initializing LWJGL OpenAL [11:17:57] [Thread-7/INFO]: (The LWJGL binding of OpenAL. For more information, see http://www.lwjgl.org) [11:17:57] [Thread-7/INFO]: OpenAL initialized. [11:17:57] [sound Library Loader/INFO]: Sound engine started [11:17:58] [Client thread/WARN]: Unable to load definition craft++:falling_dirt#snowy=false,variant=dirt java.lang.RuntimeException: Encountered an exception when loading model definition of model craft++:blockstates/falling_dirt.json //no model exists currently [11:17:59] [Client thread/INFO]: Created: 512x512 textures-atlas [11:18:00] [Client thread/WARN]: Missing model for: craft++:item/falling_dirt [11:18:00] [Client thread/INFO] [craft++]: Registering the block inventory renderers [11:18:00] [Client thread/INFO] [craft++]: Registering the event handler [11:18:00] [Client thread/INFO] [craft++]: Registering the fuel handler [11:18:00] [Client thread/INFO] [craft++]: Registering the crafting/furnace recipes [11:18:00] [Client thread/INFO] [craft++]: Registering the dispenser behaviors [11:18:00] [Client thread/INFO] [craft++]: Registering dispenser behavior for Sand/Red Sand [11:18:00] [Client thread/INFO] [craft++]: Registering dispenser behavior for Gravel [11:18:00] [Client thread/INFO] [craft++]: Registering dispenser behavior for Block of Sugar [11:18:00] [Client thread/INFO] [craft++]: Registering default dispenser behavior for Flint and Steel [11:18:00] [Client thread/INFO] [craft++]: Initializing the vanilla properties changer [11:18:00] [Client thread/INFO] [craft++]: Initializing the crafting recipe remover [11:18:00] [Client thread/INFO] [craft++]: Replacing stone tool recipes [11:18:00] [Client thread/INFO] [craft++]: Replacing stairs recipes [11:18:00] [Client thread/INFO] [craft++]: Replacing vanilla button recipes [11:18:00] [Client thread/INFO] [craft++]: Removing tool repair recipes [11:18:00] [Client thread/INFO] [craft++]: Initialization completed successfully [11:18:00] [Client thread/INFO] [sTDOUT]: [net.minecraft.init.Bootstrap:printToSYSOUT:568]: ---- Minecraft Crash Report ---- // You're mean. Time: 2/16/15 11:18 AM Description: Initializing game java.lang.IllegalStateException: Registry entry for ItemBlock net.minecraft.item.ItemBlock@6e88c81e, id 201, is missing or uses the non-matching id 3. at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.validateContent(FMLControlledNamespacedRegistry.java:88)
  11. player.addChatMessage(new ChatComponentText("Learn Java."));
  12. I removed the GameRegistry.registerBlock call but now it crashes with: java.lang.NullPointerException: The replacement target is not present. This won't work at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addSubstitutionAlias(FMLControlledNamespacedRegistry.java:492) at net.minecraftforge.fml.common.registry.GameData.registerSubstitutionAlias(GameData.java:920) at net.minecraftforge.fml.common.registry.GameRegistry.addSubstitutionAlias(GameRegistry.java:161) at com.anon10w1z.craftPP.blocks.CppBlocks.registerBlocks(CppBlocks.java:38) at com.anon10w1z.craftPP.main.CraftPlusPlus.onPreInit(CraftPlusPlus.java:87) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606)
  13. No, but you can extend one and insert the duplicated necessary methods of the other. True, true...I guess I can. EDIT: Nope, I still get the error: [18:47:56] [Client thread/ERROR] [FML]: The substitute net.minecraft.block.BlockDirt for craft++:dirt (type com.anon10w1z.craftPP.blocks.BlockNewDirt) is type incompatible. This won't work [18:47:56] [Client thread/INFO] [FML]: Applying holder lookups [18:47:56] [Client thread/INFO] [FML]: Holder lookups applied [18:47:56] [Client thread/ERROR] [FML]: Fatal errors were detected during the transition from PREINITIALIZATION to INITIALIZATION. Loading cannot continue [18:47:56] [Client thread/ERROR] [FML]: mcp{9.05} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized FML{8.0.20.1290} [Forge Mod Loader] (forgeSrc-1.8-11.14.0.1290-1.8.jar) Unloaded->Constructed->Pre-initialized Forge{11.14.0.1290} [Minecraft Forge] (forgeSrc-1.8-11.14.0.1290-1.8.jar) Unloaded->Constructed->Pre-initialized craft++{2.1} [Craft++] (main) Unloaded->Constructed->Errored [18:47:56] [Client thread/ERROR] [FML]: The following problems were captured during this phase [18:47:56] [Client thread/ERROR] [FML]: Caught exception from craft++ net.minecraftforge.fml.common.registry.IncompatibleSubstitutionException at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addSubstitutionAlias(FMLControlledNamespacedRegistry.java:497) ~[forgeSrc-1.8-11.14.0.1290-1.8.jar:?] at net.minecraftforge.fml.common.registry.GameData.registerSubstitutionAlias(GameData.java:920) ~[forgeSrc-1.8-11.14.0.1290-1.8.jar:?] at net.minecraftforge.fml.common.registry.GameRegistry.addSubstitutionAlias(GameRegistry.java:161) ~[forgeSrc-1.8-11.14.0.1290-1.8.jar:?] at com.anon10w1z.craftPP.blocks.CppBlocks.registerBlocks(CppBlocks.java:34) ~[main/:?] at com.anon10w1z.craftPP.main.CraftPlusPlus.onPreInit(CraftPlusPlus.java:87) ~[main/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_55] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_55] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_55] at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_55]
  14. I would use it, however, they must be type compatible. I cannot extend both BlockDirt and BlockFalling ;(
  15. I am not quite sure there is a way to remove blocks from the block registry.
  16. Side note, you spelled Satellite wrong.
  17. Sadly, I believe this will require ASM, but I was wondering if I could use at worst reflection, which I am comfortable with, or some other method to replace the vanilla dirt block with my own? There is no way I could use events, right?
  18. MinecraftServer.getServer().getCommandManager().executeCommand(player, command);
  19. Is there the possibility of multiple objects in the array? If not, then that's fine.
  20. Thats a really good idea. It works. Thanks! No problem, glad I could help!

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.