• Recently Browsing

    No registered users viewing this page.

  • Posts

    • Ah, I see. So unnecessary casting and assigning of variables via strings is the culprit of this bad practice? Does this contribute to inefficiency? From that site you posted, that seems to be the case.
    • So you are bypassing the nice typesystem that Java gives you, for... convenience. This is a pretty bad antipattern.   https://wiki.c2.com/?StringlyTyped
    • Because I wanted the ability to add custom values when setting them. For example, I wouldn't have to go into the capability and add a new variable, I can just say "Set the variable 'Working' to 'true'." And if its trying to get a variable that hasn't been set yet, it'll return 0 or "" depending on what kind of variable I set it as, (Notice the "string" argument.)   Its sort of mimicking the stuff you can do with getPersistentData() on an entity. TLDR; Convenience. ¯\_(ツ)_/¯
    • I cannot for the love of me figure out how the new objectregister system works. Been scratching my head at this for a week.   The above error hi-lites: JemPickaxe::new in the 3rd method.   public class JemPickaxes {     public static final JemRegistry<Item> PICKAXE = new JemRegistry<>(ForgeRegistries.ITEMS, JemCore.MOD_ID);          public static void init()     {         PICKAXE.register(FMLJavaModLoadingContext.get().getModEventBus());     }          public static RegistryObject<Item> OBSIDIAN = PICKAXE.register("obsidian_pickaxe", JemPickaxe::new);;      /**public static <OBSIDIAN extends PickaxeItem> OBSIDIAN PickaxeProperties(String item, IItemTier tier, int damage, float speed, Properties properties)     *{     *    PickaxeProperties("obsidian_pickaxe", ItemTier.NETHERITE, 1, -2.8F, new Item.Properties().group(JemPickaxe.TOOLS));     *     *    return JemPickaxes.OBSIDIAN = PickaxeProperties("obsidian_pickaxe", ItemTier.NETHERITE, 1, -2.8F, properties);     *}     *     *public static RegistryObject<Item> TEST()     *{     *    return PICKAXE.register("test_pickaxe", JemPickaxe::new);     *}     */ }   This is what my JemPickaxe class looks like: public class JemPickaxe extends PickaxeItem { public static final ItemGroup TOOLS = new ItemGroup("tools") { @Override public ItemStack createIcon() { return new ItemStack(JemPickaxes.OBSIDIAN.get()); } }; public JemPickaxe(IItemTier tier, int attackDamage, float attackSpeedIn) { super(tier, attackDamage, attackSpeedIn, new Item.Properties().group(TOOLS)); //JemPickaxe.PickaxeProperties(tier, attackDamage, attackSpeedIn, new Item.Properties().group(TOOLS)); } /**public static void PickaxeProperties(String string, ItemTier netherite, int i, float f, Properties group) { * *} * * * public static void OBSIDIAN(IItemTier tier, int attackDamage, float attackSpeedIn) { * super(ItemTier.NETHERITE, 1, -2.8F, new Item.Properties().group(TOOLS)); * JemPickaxe.PickaxeProperties(ItemTier.NETHERITE, 1, -2.8F, new Item.Properties().group(TOOLS)); * } */ }   The error only resolves when I remove the parameters from  public JemPickaxe(...) so that the brackets are empty and when I change the extend from "Pickaxeitem" to just "Item".   Am I completely wrong about how I'm going about this or am I just adding the parameters incorrectly to the new object (Obsidian pickaxe) itself?
    • Okay so it is a normal capability. Then why are you not just making normal fields in it that you put values in?
  • Topics

  • Who's Online (See full list)