Jump to content

Caffeinated Pinkie

Members
  • Posts

    36
  • Joined

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Caffeinated Pinkie's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Is there a proper or correct way to check if a mod is running in a Forge development environment versus if it's running in an actual Minecraft client?
  2. Oh jeez, that was a stupid mistake. I should not have been writing late t night. Thank you.
  3. Alright. But that still doesn't help because none of the methods I tried work.
  4. Well, when I iterate through the BLOCKS entries, it shows two RegistryObjects in it. After running the command to create items as I did, there are two RegistryObjects in the items entries. They all have the correct names as well. It seems functionally identical to defining them as so: public Circuitry() { DeferredRegister<Item> items = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID); items.register("in_node", () -> new BlockItem(IN_NODE.get(), new Properties().group(ItemGroup.REDSTONE))); items.register("out_node", () -> new BlockItem(OUT_NODE.get(), new Properties().group(ItemGroup.REDSTONE))); IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.register(BLOCKS); bus.register(items); } and even doing this statically like so: public class Circuitry { private static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID); public static final RegistryObject<Block> IN_NODE = BLOCKS.register("in_node", InNodeBlock::new), OUT_NODE = BLOCKS.register("out_node", OutNodeBlock::new); static { ITEMS.register("in_node", () -> new BlockItem(IN_NODE.get(), new Properties().group(ItemGroup.REDSTONE))); ITEMS.register("out_node", () -> new BlockItem(OUT_NODE.get(), new Properties().group(ItemGroup.REDSTONE))); } public Circuitry() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.register(BLOCKS); bus.register(ITEMS); } } Even writing it identical to how the documentation does it doesn't help: public class Circuitry { private static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID); private static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID); public static final RegistryObject<Block> IN_NODE_BLOCK = BLOCKS.register("in_node", InNodeBlock::new), OUT_NODE_BLOCK = BLOCKS.register("out_node", OutNodeBlock::new); public static final RegistryObject<Item> IN_NODE_ITEM = ITEMS.register("in_node", () -> new BlockItem(IN_NODE_BLOCK.get(), new Properties().group(ItemGroup.REDSTONE))), OUT_NODE_ITEM = ITEMS.register("out_node", () -> new BlockItem(OUT_NODE_BLOCK.get(), new Properties().group(ItemGroup.REDSTONE))); public Circuitry() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.register(BLOCKS); bus.register(ITEMS); } }
  5. Here is most of my mod class: public class Circuitry { public static final String MODID = "circuitry"; private static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, MODID); public static final RegistryObject<Block> IN_NODE = BLOCKS.register("in_node", InNodeBlock::new), OUT_NODE = BLOCKS.register("out_node", OutNodeBlock::new); public Circuitry() { DeferredRegister<Item> items = new DeferredRegister<>(ForgeRegistries.ITEMS, MODID); BLOCKS.getEntries().forEach(block -> items.register(block.getId().getPath(), () -> new BlockItem(block.get(), new Properties().group(ItemGroup.REDSTONE)))); IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.register(BLOCKS); bus.register(items); } } I have the Item DeferredRegister and RegistryObjects in the constructor rather than statically declaring it because I never need to retrieve the Item objects anywhere else in my code. However, upon loading a world, I am unable to find any of the added Blocks in the Redstone tab of the creative menu. The following commands don't work either: /give Dev circuitry:in_node /give Dev circuitry:out_node Declaring the Item DeferredRegister and RegistryObjects statically doesn't seem to fix the problem either. Printing the Item DeferredRegistry shows two entries with the correct names. No error messages are thrown and I can't determine why this is occurring.
  6. Is there a preferred way to access a private class from Minecraft classes? I can use the regular Java Reflection to access it, but I don't believe that will work after it is obfuscated. For example, how can I access net.minecraft.client.gui.screen.FlatPresetsScreen.LayerItem given that it is not a public class?
  7. I need the Apache HttpClient Mime Apache to create multipart forms. However, nothing I try seems to allow me to load the mod with this library. Even copying the source files into the mod source doesn't work; I keep getting NoClassDefFoundErrors. Is it even possible to, from a Maven dependency (org.apache.httpcomponents:httpmime:jar:4.3.2), create a fat jar, shade the library, or in any way embed it? The documentation for ForgeGradle is not in date anymore regarding this topic and the guides in the Grade Docs don't work for Forge.
  8. In order to use multipart HTTP forms, I've had to import Apache HttpClient Mime. I've tried including it in my built jar like so: configurations { compile.extendsFrom(buildWith) } dependencies { minecraft 'net.minecraftforge:forge:1.15.2-31.2.0' buildWith 'org.apache.httpcomponents:httpmime:+' } jar.from { configurations.buildWith.collect { it.isDirectory() ? it : zipTree(it) } } This does add the files to the mod jar, but I still get errors when I try to use the library in game. It cannot find the class files that are being referenced. What am I missing here? How can I include external libraries in the mod or with the game?
  9. So, I'm trying out access transformers in one of my mods. I've previously used ObfuscationReflectionHelper instead, but I don't know what the advantages and disadvantages of each might be. Which is better to use for what situations and why?
  10. Well, is there a way to get the cross-sections of the VoxelShape? Or, at the very least, some documentation on how VoxelShapes work?
  11. I'm wondering what the most efficient way to calculate the volume of a block is. That is, if I have a BlockState in a World at a BlockPos, how can I most easily or efficiently calculate the volume? Do I have to just take the integral of the cross-sections of the VoxelShape? If that is the case, how do I get the cross-sections?
  12. Actually, that's definitely cleaner than overriding FireBlock. I already catch the lightning when it is added, so that shouldn't be hard. Thanks.
  13. Well, the problem is that I'm trying to prevent all lightning from spawning fire, including vanilla lightning.
  14. So, for a mod that I am making, I've been trying to find the simplest and cleanest way to prevent fire from spawning where lightning bolts strike. I have a few solutions already that work, the simplest of which is that I register a custom FireBlock over the vanilla one. It has a boolean in it that is set to true when EntityConstructing is called with lightning and false when it enters the world. While this value is true, fire cannot be spawned. The reason why this is difficult is that the constructor for LightningBoltEntity actually spawns fire before it even enters the world. Basically, I can intercept the lightning object when it calls the Entity constructor at the start of its constructor and after it is finished constructing, by which it is already too late. Do any of you have suggestions for a better method of doing this? I'm concerned about compatibility issues that may arise from overriding FireBlock.
  15. I'm currently looking for a way to remove the vanilla system of clearing lines of chat from memory when a certain amount are present. Basically, I'd like all chat messages to persist indefinitely for a given instance of the game. It's a little hard to decipher how vanilla does this as the source code for the chat GUI classes don't seem to currently be available. Edit: Actually, the NewChatGui class has its source code visible, so it shouldn't be too hard. My apologies for not searching harder first.
×
×
  • Create New...

Important Information

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