Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Syric

Members
  • Posts

    34
  • Joined

  • Last visited

Recent Profile Visitors

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

Syric's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. I'm attempting to add a config file to one of my mods. Currently, the code appears to be referencing the configured variables just fine, but the problem is the file itself: it's not printing all the variables and comments, and what it is printing is out of order. My config is broken into three sections. Each has several 'groups', with each group governing one variable, and containing four copies of it: one for each of the four configurable items (basic, epic, legendary, and godly/mythic). For instance, in the "ping chance stats" section, there's a group for the "minPingChance" variable, with entries for basic_minPingChance, epic_minPingChance, and so on. Here's my config file: package syric.dragonseeker; import net.minecraftforge.common.ForgeConfigSpec; import org.apache.commons.lang3.tuple.Pair; public class DragonseekerConfig { public static class Common { //Basic Dragonseeker public final ForgeConfigSpec.ConfigValue<Integer> basic_optimalDistance; public final ForgeConfigSpec.ConfigValue<Integer> basic_maxDistance; public final ForgeConfigSpec.ConfigValue<Double> basic_minPingChance; public final ForgeConfigSpec.ConfigValue<Double> basic_maxPingChance; public final ForgeConfigSpec.ConfigValue<Integer> basic_pingCapRadius; public final ForgeConfigSpec.ConfigValue<Double> basic_sigPower; public final ForgeConfigSpec.ConfigValue<Double> basic_minVol; public final ForgeConfigSpec.ConfigValue<Double> basic_maxVol; public final ForgeConfigSpec.ConfigValue<Double> basic_minPitch; public final ForgeConfigSpec.ConfigValue<Double> basic_maxPitch; public final ForgeConfigSpec.ConfigValue<Boolean> basic_detectsCorpses; public final ForgeConfigSpec.ConfigValue<Boolean> basic_detectsTame; public final ForgeConfigSpec.ConfigValue<Integer> basic_durability; //Epic Dragonseeker public final ForgeConfigSpec.ConfigValue<Integer> epic_optimalDistance; public final ForgeConfigSpec.ConfigValue<Integer> epic_maxDistance; public final ForgeConfigSpec.ConfigValue<Double> epic_minPingChance; public final ForgeConfigSpec.ConfigValue<Double> epic_maxPingChance; public final ForgeConfigSpec.ConfigValue<Integer> epic_pingCapRadius; public final ForgeConfigSpec.ConfigValue<Double> epic_sigPower; public final ForgeConfigSpec.ConfigValue<Double> epic_minVol; public final ForgeConfigSpec.ConfigValue<Double> epic_maxVol; public final ForgeConfigSpec.ConfigValue<Double> epic_minPitch; public final ForgeConfigSpec.ConfigValue<Double> epic_maxPitch; public final ForgeConfigSpec.ConfigValue<Boolean> epic_detectsCorpses; public final ForgeConfigSpec.ConfigValue<Boolean> epic_detectsTame; public final ForgeConfigSpec.ConfigValue<Integer> epic_durability; //Legendary Dragonseeker public final ForgeConfigSpec.ConfigValue<Integer> legendary_optimalDistance; public final ForgeConfigSpec.ConfigValue<Integer> legendary_maxDistance; public final ForgeConfigSpec.ConfigValue<Double> legendary_minPingChance; public final ForgeConfigSpec.ConfigValue<Double> legendary_maxPingChance; public final ForgeConfigSpec.ConfigValue<Integer> legendary_pingCapRadius; public final ForgeConfigSpec.ConfigValue<Double> legendary_sigPower; public final ForgeConfigSpec.ConfigValue<Double> legendary_minVol; public final ForgeConfigSpec.ConfigValue<Double> legendary_maxVol; public final ForgeConfigSpec.ConfigValue<Double> legendary_minPitch; public final ForgeConfigSpec.ConfigValue<Double> legendary_maxPitch; public final ForgeConfigSpec.ConfigValue<Boolean> legendary_detectsCorpses; public final ForgeConfigSpec.ConfigValue<Boolean> legendary_detectsTame; public final ForgeConfigSpec.ConfigValue<Integer> legendary_durability; //Mythic Dragonseeker public final ForgeConfigSpec.ConfigValue<Integer> mythic_optimalDistance; public final ForgeConfigSpec.ConfigValue<Integer> mythic_maxDistance; public final ForgeConfigSpec.ConfigValue<Double> mythic_minPingChance; public final ForgeConfigSpec.ConfigValue<Double> mythic_maxPingChance; public final ForgeConfigSpec.ConfigValue<Integer> mythic_pingCapRadius; public final ForgeConfigSpec.ConfigValue<Double> mythic_sigPower; public final ForgeConfigSpec.ConfigValue<Double> mythic_minVol; public final ForgeConfigSpec.ConfigValue<Double> mythic_maxVol; public final ForgeConfigSpec.ConfigValue<Double> mythic_minPitch; public final ForgeConfigSpec.ConfigValue<Double> mythic_maxPitch; public final ForgeConfigSpec.ConfigValue<Boolean> mythic_detectsCorpses; public final ForgeConfigSpec.ConfigValue<Boolean> mythic_detectsTame; public final ForgeConfigSpec.ConfigValue<Integer> mythic_durability; public Common(ForgeConfigSpec.Builder builder){ builder.comment("Ping Chance Stats").push("ping_chance_stats"); builder.comment("Inside this distance, getting closer to the dragon will not increase the ping chance."); builder.comment("Defaults: 100, 150, 200, 500"); basic_optimalDistance = builder.defineInRange("basic", 100, 1, 500); epic_optimalDistance = builder.defineInRange("epic", 150, 1, 500); legendary_optimalDistance = builder.defineInRange("legendary", 200, 1, 500); mythic_optimalDistance = builder.defineInRange("godly", 500, 1, 500); builder.comment("Maximum distance at which a dragon will be detected. Should be larger than the optimalDistance, but not larger than your render distance."); builder.comment("Defaults: 200, 225, 250, 500"); basic_maxDistance = builder.defineInRange("basic", 200, 1, 500); epic_maxDistance = builder.defineInRange("epic", 225, 1, 500); legendary_maxDistance = builder.defineInRange("legendary", 250, 1, 500); mythic_maxDistance = builder.defineInRange("godly", 500, 1, 500); builder.comment("Minimum chance of a ping. This is the chance of a positive ping when no dragons are detected, i.e. the false positive rate."); builder.comment("Defaults: 0.12, 0.08, 0.04, 0"); basic_minPingChance = builder.defineInRange("basic", 0.12, 0, 1); epic_minPingChance = builder.defineInRange("epic", 0.08, 0, 1); legendary_minPingChance = builder.defineInRange("legendary", 0.04, 0, 1); mythic_minPingChance = builder.defineInRange("godly", 0D, 0, 1); builder.comment("Maximum chance of a ping. This is the chance of a positive ping when there is a dragon within the optimalDistance."); builder.comment("Defaults: 0.8, 0.9, 0.95, 1"); basic_maxPingChance =builder.defineInRange("basic", 0.8, 0, 1); epic_maxPingChance = builder.defineInRange("epic", 0.9, 0, 1); legendary_maxPingChance = builder.defineInRange("legendary", 0.95, 0, 1); mythic_maxPingChance = builder.defineInRange("godly", 1D, 0, 1); builder.pop(); builder.comment("Ping Property Stats").push("ping_property_stats"); builder.comment("Inside this radius, ping properties will not change. The smaller it is, the easier it will be to narrow down a dragon's location."); builder.comment("Defaults: 125, 125, 100, 0"); basic_pingCapRadius = builder.defineInRange("basic", 125, 1, 500); epic_pingCapRadius = builder.defineInRange("epic", 125, 1, 500); legendary_pingCapRadius = builder.defineInRange("legendary", 100, 1, 500); mythic_pingCapRadius = builder.defineInRange("godly", 0, 1, 500); builder.comment("Mathematical property governing the relationship between distance and ping properties. The higher this is, the easier it will be to narrow down a dragon's location."); builder.comment("Defaults: 1.5, 1.5, 2.5, 3.5"); basic_sigPower = builder.defineInRange("basic", 1.5, 1, 5); epic_sigPower = builder.defineInRange("epic", 1.5, 1, 5); legendary_sigPower = builder.defineInRange("legendary", 2.5, 1, 5); mythic_sigPower = builder.defineInRange("godly", 3.5, 1, 5); builder.comment("Minimum volume of a ping, for when there are no dragons in range."); builder.comment("Defaults: 0.05"); basic_minVol = builder.defineInRange("basic", 0.05, 0, 1); epic_minVol = builder.defineInRange("epic", 0.05, 0, 1); legendary_minVol = builder.defineInRange("legendary", 0.05, 0, 1); mythic_minVol = builder.defineInRange("godly", 0.05, 0, 1); builder.comment("Maximum volume of a ping, for when you're inside the ping cap radius."); builder.comment("Defaults: 0.05, 0.4, 0.7, 1"); basic_maxVol = builder.defineInRange("basic", 0.05, 0, 1); epic_maxVol = builder.defineInRange("epic", 0.4, 0, 1); legendary_maxVol = builder.defineInRange("legendary", 0.7, 0, 1); mythic_maxVol = builder.defineInRange("godly", 1D, 0, 1); builder.comment("Pitch of a negative result, i.e. no dragon detected."); builder.comment("Defaults: 0.5"); basic_minPitch = builder.defineInRange("basic", 0.5, 0, 1); epic_minPitch = builder.defineInRange("epic", 0.5, 0, 1); legendary_minPitch = builder.defineInRange("legendary", 0.5, 0, 1); mythic_minPitch = builder.defineInRange("godly", 0.5, 0, 1); builder.comment("Pitch of a positive result, i.e. there is a dragon detected."); builder.comment("Defaults: 0.8, 0.8, 0.8, 1"); basic_maxPitch = builder.defineInRange("basic", 0.8, 0, 1); epic_maxPitch = builder.defineInRange("epic", 0.8, 0, 1); legendary_maxPitch = builder.defineInRange("legendary", 0.8, 0, 1); mythic_maxPitch = builder.defineInRange("godly", 1D, 0, 1); builder.pop(); builder.comment("Other Stats").push("other_stats"); builder.comment("Whether or not the dragonseeker detects dead dragons."); builder.comment("Defaults: true, false, false, false"); basic_detectsCorpses = builder.define("basic", true); epic_detectsCorpses = builder.define("epic", false); legendary_detectsCorpses = builder.define("legendary", false); mythic_detectsCorpses = builder.define("godly", false); builder.comment("Whether or not the dragonseeker detects tame dragons."); builder.comment("Defaults: true, true, false, false"); basic_detectsTame = builder.define("basic", true); epic_detectsTame = builder.define("epic", true); legendary_detectsTame = builder.define("legendary", false); mythic_detectsTame = builder.define("godly", false); builder.comment("Durability of the item. Set to -1 to make it unbreakable."); builder.comment("Defaults: 128, 256, 512, -1"); basic_durability = builder.defineInRange("basic", 128, -1, 2048); epic_durability = builder.defineInRange("epic", 256, -1, 2048); legendary_durability = builder.defineInRange("legendary", 512, -1, 2048); mythic_durability = builder.defineInRange("godly", -1, -1, 2048); builder.pop(); } } public static final ForgeConfigSpec COMMON_SPEC; public static final Common COMMON; static { final Pair<Common, ForgeConfigSpec> commonSpecPair = new ForgeConfigSpec.Builder().configure(Common::new); COMMON_SPEC = commonSpecPair.getRight(); COMMON = commonSpecPair.getLeft(); } } And here's what currently happens in the .txt file: As you can see, only the last 'group' of variables in each of the three sections is printing, and they're doing it out of order. (It should be basic, epic, legendary, godly.) The Defaults comment prints in the middle of the group instead of before it, and the explanatory comment doesn't print at all. What am I doing wrong? Thanks for the help!
  2. Understood. I guess I'll just brush up on events in general. Thanks again!
  3. That helps, thank you! Where can I go to learn more about FMLCommonSetupEvent, and how to use it? (Edit: in addition to the readthedocs.io, I'm already there)
  4. I'm working on a system for brewing various items in cauldrons. As part of this, I have created the 'Substance' class, referring to various things one might put in a cauldron, and during initial modloading (immediately after calling the deferred registries to register my items, blocks, etc.) I am filling out a list of possible Substances. One such substance, 'crash_pad', is equivalent to a modded block, also called 'crash_pad'. When defining it as a Substance, I reference its item format, like so: (The problem line, #16, is marked with an asterisk.) public class SubstanceList { public static ArrayList<Substance> list = new ArrayList<Substance>(); public static Substance water = new Substance("water", new Ingredient[]{}, false, null); * public static Substance crash_pad = new Substance("crash_pad", new Ingredient[]{}, true, registerBlocks.CRASH_PAD.get().asItem()); //Substance constructor takes in (String, Ingredient[], boolean, Item). public SubstanceList() { initialize(); } public static void initialize() { list.add(water); list.add(crash_pad); } //For getting ingredients private static Ingredient get(Item item) { return IngredientsDict.get(item); } } When I try to launch the game, I get an error saying that the crash_pad registry object was not present. The full crash report is available here, the most relevant part (in my estimation) is quoted here: I'm not sure why the game is having trouble finding the registered item, given that I run the registers prior to calling SubstanceList.initialize(). This is the constructor from my main mod file: (The asterisked line is line 38, where the issue was thrown in the crash log above.) public AlchemyPlus() { registry.register(); IngredientsDict.initialize(); * SubstanceList.initialize(); RecipeList.initialize(); ... } I suspect the issue has something to do with me misunderstanding registries, because I'm still pretty iffy on the details of how they work. What exactly is going wrong? If more information or code is needed, don't hesitate to ask- I'm not confident enough to say that I've definitely provided all relevant code! Thanks for the help!
  5. What are you trying to do? Are you trying to make a mod? If so, what program are you using to write it?
  6. Understood, and I'll go check that out. Thank you so much!
  7. Okay, thanks for the help! A few questions. BLOCKS and ITEMS are in the same class as each other- it's called 'registry'. (forgot to capitalize, oops- I'll fix that momentarily.) What exactly shouldn't be in separate classes? Are you saying that my actual RegistryObjects (the individual blocks, items, etc.) should all be in the same class? Or that the DeferredRegisters should all be in the same class? Or that all the RegistryObject<Block>s should be in the same class as the DeferredRegister<Block>, and the RegistryObject<Item>s should be in the same class as the DeferredRegister<Item>, but those two classes don't necessarily have to be the same? What is @ObjectHolder, what does it do, and where can I go to learn more? (That is, assuming it's a Forge thing. If it's a Java thing I don't know, say so and I'll go research it elsewhere- I understand and respect that this forum isn't a place to look for Java help.)
  8. From my understanding, all of my blocks, items, and whatnot should be registered like this: public static final RegistryObject<Block> CRASH_PAD = registry.BLOCKS.register("crash_pad", () -> new CrashPadBlock(AbstractBlock.Properties.of(Material.CLAY, MaterialColor.GRASS).friction(0.8F).sound(SoundType.SLIME_BLOCK).noOcclusion())); public static final RegistryObject<Item> ALCHEMICAL_FLASK = registry.ITEMS.register("alchemical_flask", () -> new Item(new Item.Properties().tab(ItemGroup.TAB_MATERIALS))); If I then wished to refer to the crash_pad Block, or the alchemical_flask Item, do I have to refer to them as 'registry.CRASH_PAD.get()' and 'registry.ALCHEMICAL_FLASK.get()'? This seems a bit roundabout. Can I define the blocks as Blocks and the items as Items before creating and registering RegistryObject<T>s from them, or do I have to always get the blocks and items from their RegistryObjects?
  9. createBlockStateDefinition seems to have done the trick, at least for now- the game does not crash on startup! I'll have to investigate more to make sure things are actually working (and, y'know, actually do something with the blockstates) but I'm leaving that to tomorrow. Thank you all for the help!
  10. Every implementation of blockstates I've been able to find (including the one you just linked) does something along the lines of: this.setDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); but setDefaultState shows up red and IntelliJ claims it can't resolve the symbol. I assume the method's been renamed. Where can I find it? If it's registerDefaultState then I'm already using that, so that's not the solution (oh well). As for your suggestion of what is needed, adding that method did not change the outcome- in fact, it threw an error because it didn't actually override anything. My bad, you said you didn't know the Mojang mapping. Never mind. If anyone else has suggestions, my original problem is still present.
  11. Apologies for the repeat, then. Do you have any advice relating to my main problem?
  12. I'm currently trying to make a new cauldron-type block, and I'm having difficulty implementing blockstates. Here's the relevant part of the alchemical cauldron's code: public class AlchemicalCauldronBlock extends Block { public static final IntegerProperty LEVEL = IntegerProperty.create("level", 1, 3); private static final VoxelShape INSIDE = box(2.0D, 4.0D, 2.0D, 14.0D, 16.0D, 14.0D); protected static final VoxelShape SHAPE = VoxelShapes.join(VoxelShapes.block(), VoxelShapes.or(box(0.0D, 0.0D, 4.0D, 16.0D, 3.0D, 12.0D), box(4.0D, 0.0D, 0.0D, 12.0D, 3.0D, 16.0D), box(2.0D, 0.0D, 2.0D, 14.0D, 3.0D, 14.0D), INSIDE), IBooleanFunction.ONLY_FIRST); public AlchemicalCauldronBlock() { super(Properties.of(Material.METAL).sound(SoundType.METAL).harvestLevel(3).strength(2F,2F)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, 0)); // this.registerDefaultState(this.stateDefinition.any().setValue(LEVEL, Integer.valueOf(0))); } ... When I try to run this with either of the two attempts at registerDefaultState uncommented, I get this error: https://pastebin.com/vPf3UryC. For convenience, I believe this part is most relevant: How can I avoid this? My registry classes look like this, if it helps: public class registry { public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, AlchemyPlus.MODID); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, AlchemyPlus.MODID); public static void register() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); BLOCKS.register(modEventBus); ITEMS.register(modEventBus); registerItems.register(); registerBlocks.register(); } } public class registerBlocks { public static final RegistryObject<Block> ALCHEMICAL_CAULDRON = register("alchemical_cauldron", AlchemicalCauldronBlock::new); static void register() {} private static <T extends Block> RegistryObject<T> registerNoItem(String name, Supplier<T> block) { return registry.BLOCKS.register(name, block); } private static <T extends Block> RegistryObject<T> register(String name, Supplier<T> block) { RegistryObject<T> ret = registerNoItem(name, block); registry.ITEMS.register(name, () -> new BlockItem(ret.get(), new Item.Properties().tab(ItemGroup.TAB_BREWING))); return ret; } } Full GitHub repository available here. (Other minor problem(?): I copied the methods getShape and getInteractionShape from net.minecraft.block.CauldronBlock and I'm getting these weird warnings. What's up with that? Do I need to worry about it?)
  13. Sounds good. Jury-rigged constructor nonsense it is.
  14. In the mod I'm working on, I want to have several items which have the same function (searching for entities and making noise when they are found) but with different parameters (search radius, which entity to look for, what noise to make, etc.). In Forge, what is the best way to handle this? My first attempt simply involved copying the code over to each item, but the hassle of changing all of them every time I want to edit the code has grown enough that I'm looking for a more complicated way of approaching the problem. Should I make a 'SeekerGeneric' class containing all the relevant code and then have various specific items extend that class, each with different parameters? Or is there another way to do things?
  15. I'm very new to Minecraft modding, and one thing that's still causing me some confusion is the client/server dichotomy. From what I understand (via reading the Forge documentation), they're separate and it's very bad to do things on the wrong side. My questions are: How do I know which side to do something on? How do I know when it matters? Does every single statement need to be prefaced with something like if (world.isRemote()) {}? How can I check that I've done things correctly? There's a 'runServer' thing in IntelliJ, but it says I need to agree to the EULA somehow and I don't know how to do that. Where can I go to learn more? (I've already read the Forge documentation.)
×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.