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

Drachenbauer

Members
  • Posts

    724
  • Joined

  • Last visited

Everything posted by Drachenbauer

  1. But i don´t know any lambda expressions, that i can place at the initialization of an array Sometimes i get errors, even, if i try to access the id of one of theese registry-objects instead of the registry name of the block.... edit: now i noticed, this now happens only at trying to access the RegistryObjects of the full pots, wich are registered in a seccond, nested for-loop.
  2. I don´t know, where else i should place the for-loops in this case. I cannot place them directly inside the class-body. and if i create a method for them, i don´t know where to call this method. Is there any way to put them directly into the initialisation of the array or list?
  3. I´m not sure, if they are even registered if in lists or arrays. Edit: i noticed, Object not present errors appear, if i try to access the blocks inside a static { } in the class with the item-registries, but not inside public static final class-fields there. For a test I added this static thing to the item registry-class of a working mod and tried to access a block inside there by using it´s registryname as a console-output. This made an Object not present error. Edit: if i keep,the items as separate class-fields, but the blocks in an array or list, i get a NullPointerException at the method, that registers the full pots and plants to the empty pots. And if i comment out this methode for a test, i get this error:
  4. My repository again: https://github.com/Drachenbauer/ColoredFlowerPotsMod I noticed, if i register each block in it´s own public static final class-field of RegistryObject<FlowerpotBlock>, i can access their block-instances in the class with the item-registry at registering the BlockItems in similar fields of of RegistryObject<BlockItem> (look at commeted out parts of the code). But if i pack all block-registries for the enpty flowerpots into an array RegistryObject<FlowerpotBlock> or an ArrayList<RegistryObject<FlowerpotBlock>>, i get a NullPointerException, if i ty to access them at item-registry (the exeption points to the line, where i register the item). It also happens, if i write a getter for the RegistryObject in the blockregistry class. It seems like, if i use lists or arrays, the blocks are not registered as fast as in separate public static final class-fields I´m not sure, if they are even registered if in lists or arrays.
  5. Here is now my repository: https://github.com/Drachenbauer/ColoredFlowerPotsMod The mod works, if i use the commented out parts of code in all classes, instead of the stuff with the for-loops. If i get the for-loops to work, i delete the other stuff. How do i add a crashlog? Edit: This Page needs very long time to load stuff from facebook...
  6. I know, how to put a project on github, but not how to add an errorlog...
  7. i know, where it is, but i don´t know, what´s wrong with that line... I´m sure, it should get the id of the RegistryObject(that´s similar to the RegistryName of the block.) But i don´t know, why it finds no registryname to use...
  8. Code: public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Reference.MOD_ID); @SuppressWarnings("unchecked") public static final RegistryObject<BlockItem>[] EMPTY_FLOWER_POTS = new RegistryObject[ColoredFlowerPotsBlocks.COLORS.size() + 1]; private static int i; static { i = 0; for (RegistryObject<FlowerPotBlock> empty_pot_register : ColoredFlowerPotsBlocks.EMPTY_FLOWER_POTS) { String empty_pot = empty_pot_register.getId().getPath(); EMPTY_FLOWER_POTS[i] = ITEMS.register(empty_pot, () -> new BlockItem(empty_pot_register.get(), new Item.Properties().defaultMaxDamage(0).group(ColoredFlowerPots.COLORED_FLOWERPOTS).maxStackSize(64).rarity(Rarity.COMMON).setNoRepair())); i++; } } I tried to use Arrays instead of ArrayLists now. console: i don´t know, how to display the "30 more" lines at the end, if they include helpful infos
  9. If i try to use getId from the block-RegistryObject to generate the registryname for the blockitem-registry, i get a NullPointerException...
  10. But how do i fill the supplyer-thing for the full pots where the need to know their emptx pots? Edit: I noticed, i can put the RegistryObject of the empty pot there.
  11. as i registered my Blocks this way: public static final RegistryObject<FlowerPotBlock> BLACK_FLOWER_POT = BLOCKS.register("black_flower_pot", () -> new FlowerPotBlock( null, AIR_SUPPLIER,Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0f).notSolid())); i was able to register the blockitem this way: public static final RegistryObject<Item> BLACK_FLOWER_POT = ITEMS.register("black_flower_pot", () -> new BlockItem(ColoredFlowerPotsBlocks.BLACK_FLOWER_POT.get(), new Item.Properties().defaultMaxDamage(0).group(ColoredFlowerPots.COLORED_FLOWERPOTS).maxStackSize(64).rarity(Rarity.COMMON).setNoRepair())); Do you mean, that i try to access the block for generating the item-registryname at using the variant with list and for-loop? But once i also had the error, where i called the method addPlant of the FlowerPotBlock, and tried to access the blocks there-
  12. with the arraylist, i got this error too, as i tried to access the blocks at registering the blockitems.
  13. Now i have this: public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Reference.MOD_ID); private static final Supplier<Block> AIR_SUPPLIER = () -> Blocks.AIR; public static final ArrayList<Supplier<Block>> PLANT_SUPPLIERS = new ArrayList<Supplier<Block>>(Arrays.asList(() -> Blocks.ACACIA_SAPLING, () -> Blocks.ALLIUM, () -> Blocks.AZURE_BLUET, () -> Blocks.BAMBOO, () -> Blocks.BIRCH_SAPLING, () -> Blocks.BLUE_ORCHID, () -> Blocks.BROWN_MUSHROOM, () -> Blocks.CACTUS, () -> Blocks.CORNFLOWER, () -> Blocks.DANDELION, () -> Blocks.DARK_OAK_SAPLING, () -> Blocks.DEAD_BUSH, () -> Blocks.FERN, () -> Blocks.JUNGLE_SAPLING, () -> Blocks.LILY_OF_THE_VALLEY, () -> Blocks.OAK_SAPLING, () -> Blocks.ORANGE_TULIP, () -> Blocks.OXEYE_DAISY, () -> Blocks.PINK_TULIP, () -> Blocks.POPPY, () -> Blocks.RED_MUSHROOM, () -> Blocks.RED_TULIP, () -> Blocks.SPRUCE_SAPLING, () -> Blocks.WHITE_TULIP, () -> Blocks.WITHER_ROSE)); public static final ArrayList<String> COLORS = new ArrayList<String>(Arrays.asList("black", "blue", "brown", "cyan", "gray", "green", "light_blue", "light_gray", "lime", "magenta", "orange", "pink", "purple", "red", "white", "yellow")); public static final ArrayList<RegistryObject<FlowerPotBlock>> EMPTY_FLOWER_POT_REGISTRIES = new ArrayList<RegistryObject<FlowerPotBlock>>(); public static final ArrayList<Supplier<FlowerPotBlock>> EMPTY_FLOWER_POT_SUPPLIERS = new ArrayList<Supplier<FlowerPotBlock>>(); public static final ArrayList<FlowerPotBlock> EMPTY_FLOWER_POTS = new ArrayList<FlowerPotBlock>(); public static final ArrayList<RegistryObject<FlowerPotBlock>> FULL_FLOWER_POT_REGISTRIES = new ArrayList<RegistryObject<FlowerPotBlock>>(); public static final ArrayList<Supplier<FlowerPotBlock>> FULL_FLOWER_POT_SUPPLIERS = new ArrayList<Supplier<FlowerPotBlock>>(); public static final ArrayList<FlowerPotBlock> FULL_FLOWER_POTS = new ArrayList<FlowerPotBlock>(); private static int i; private static int j; static { i = 0; for(String color : COLORS) { EMPTY_FLOWER_POT_REGISTRIES.add(BLOCKS.register(color + "_flower_pot", () -> new FlowerPotBlock(null, AIR_SUPPLIER, Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0f).notSolid()))); EMPTY_FLOWER_POT_SUPPLIERS.add(() -> EMPTY_FLOWER_POT_REGISTRIES.get(i).get()); j = 0; for(Supplier<Block> plant_supplier : PLANT_SUPPLIERS) { String plant = plant_supplier.get().getRegistryName().getPath(); FULL_FLOWER_POT_REGISTRIES.add(BLOCKS.register(color + "_potted_" + plant, () -> new FlowerPotBlock(EMPTY_FLOWER_POT_SUPPLIERS.get(i), plant_supplier, Block.Properties.create(Material.MISCELLANEOUS).hardnessAndResistance(0f).notSolid()))); FULL_FLOWER_POT_SUPPLIERS.add(() -> FULL_FLOWER_POT_REGISTRIES.get(j).get()); j++; } i++; } } Why this makes a "RegistryObject not present" error, if i want to access the blocks anywhere in the code? Only the lines, wich fill the Supplier-Lists, don´t make the error. Why i cannot access theese blocks, or does the registry process not work at list-contents?
  14. I find nothing about the ItemGroup in that log-text-file... It really looks like there is any limit, that it can create only two pages on the creative-inventory and display only 5 modded tabs, basic inventory and search-function on the seccond page.
  15. i noticed, that i had a mistake in the registryname of the block in the class with the block registrys so it didn´t match the correct name in the json´s
  16. Now i made it possible, to run the test-client and enter the world, but the tulip in the pot appears as a black and purple bug-block... seems like using stuff from the two coremods as parent in the json files foes not work now...
  17. where do i find the log, if i run it in the actual game? In the test-client it works fine.
  18. The itemgroup-class: package drachenbauer32.coloredflowerpotsmod.util; import drachenbauer32.coloredflowerpotsmod.ColoredFlowerPots; import drachenbauer32.coloredflowerpotsmod.init.ColoredFlowerPotsItems; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; public class ColoredFlowerPotsItemGroup extends ItemGroup { public ColoredFlowerPotsItemGroup() { super("ColoredFlowerPots"); } @Override public ItemStack createIcon() { return new ItemStack(ColoredFlowerPotsItems.YELLOW_FLOWER_POT.get()); } @Override public void fill(NonNullList<ItemStack> itemStacks) { super.fill(itemStacks); itemStacks.sort(ColoredFlowerPots.itemSorter); } } I have no log. My other mods use an almodt identical ItemGroup-class. The only differences are the class-name, the name-string in the constructor and the item for the icon. The itemgroups of the other mods appear in the test-client and in the actual game.
  19. Hello Now i made a break in trying to reduce the code of the flowerpots mod and builded it in it´s last working state. But now i noticed, that i have the mod-itemgroup in the test-client, but not in the actual game. I can see the mod in the mods-options and ingame i find the flowerpots with the search function of the creative-inventory. I also can place the Flowerpots and fill them with plants. That means, the only thing here is, that the itemgroup does not appear. the rest of the mod works fine. Why this? In the actual game, i have some more mods. Actually I have 5 mod-itimgroups there (creative Inventory itemgroups page 2) and this one should be the 6.. It looks like only 5 ItemGroups (+ search-function) fit ontop of the creative inventory. How to make more itemgroups appear at the bottom of page 2 (or make a page 3 appear)?
  20. Hello I have the mod with the tulips and the one with the flowerpots. Now ai want to make a mod, that connects both and makes it able, to put the tulips nto the flowerpots. I made the mod-setup just like i made it for my other mods. than i placed the builded jars from the two finished mods into the mods-folder at "run" at the new mod and added them as referenced librarys. while writing the classes, i was able to import and reference stuff from the two mods, just like i did with official vanilla-stuff but if i now try to testrun the new one (with one combination of tulip and pot), i get this error: The two basic mods run without any problems in their own test-clients and in the actual game. What must i do to get it to work?
  21. Now i try to work with an Arraylist<RegistryObject<FlowerPotBlock>> instead of alot of single fields. Or an Arraylist<FlowerPotBlock>. But no matter, what i try, i get an Registry Object not present error. Does it matter, that i try to work in a static { } in the class, because i need to use for-loops to fill the list The last thing, i tried, is, that i tried to register a block in a variable inside the for-loop and than add the content of the RegistryObject into an Arraylist<FlowerPotBlock>. Why this also gives the error? Is public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Reference.MOD_ID); unable to handle things in the static thing or a for-loop If yes, how can i register stuff with code inside there? Or is it impossible to register blocks in an Arraylist<RegistryObject<FlowerPotBlock>> ?
×
×
  • Create New...

Important Information

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