-
Posts
727 -
Joined
-
Last visited
Everything posted by Drachenbauer
-
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)?
-
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?
-
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>> ?
-
Now i have a huge stack of RegistryObjects in my blocks class. Every possible combination of plant-type (25 different plants) and pot-color (16 color) appears as it´s own registered block. The same for the method-calls for adding the plants to the pots and render them in cutout-style (the render-thing is not needed for the cactus) in their handler-classes. Is there any way to shorten the code, maybe with this for-loop: 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)); for (String color : colors) { //do stuff } But i don´t know how to create RegistryObjects in a for-loop...
-
While i collected the different plants, that can be placed in a flowerpot, i saw, that the model of the cactus is made a very complicated way. I think, to make it look like it looks ingame, just two model-boxes are needed: a 6x6x6 cube for the pot and a taller 4x4 base box for the cactus itself, And a dirt-texture is not needed here, because the cactus fills the whoole hole of the pot. Why did they make it so complicated? Now i made separeted handler-classes for the addPlant-lines and the cutout-rendering of the plant-textures. So the main-mod-class is short and clean. In the handler-classes i simply placed all theese method-calls in a method, that i now call in the main-class.
-
Now, with some more google, i found it. at first, i had the simpler constructor-call, so i wonder, why it used the correct variant of the potted sapling in this case. In my case, i think, it should look like this: BLACK_FLOWER_POT.get().addPlant(Blocks.ACACIA_SAPLING.getRegistryName(), BLACK_POTTED_ACACIA_SAPLING_SUPPLIER); but where in my mod should i place this line. Edit: Now i made it so: DeferredWorkQueue.runLater(() -> { ColoredFlowerPotsBlocks.BLACK_FLOWER_POT.get().addPlant(Blocks.ACACIA_SAPLING.getRegistryName(), ColoredFlowerPotsBlocks.BLACK_POTTED_ACACIA_SAPLING_SUPPLIER); } ); In the common setup like the biome-stuff in the tulips-mod. This works. Other things i tryed before, made "object not present" errors. Now i think, i should collect all theese calls for the different plants and pot-colors here.
-
Hello I decided to play around with colors for flowerpots. So i opened a new mod-project and added two new mlocks: black_flower_pot (an empty flowerpot with black concrete-texture and it´s BlockItem) black_potted_acacia_sapling (an acatia-sapling, placed in a black flowerpot) Than i made a testrun and i was surprised: If i place my modded black pot and then put the acacia-sapling, it correctly appears in the black pot. that means it uses my modded one here. How does the FlowerPotBlock-class know, that it has to place my modded acacia in the black pot here instead of the the vanilla one in the brown terracotta-pot? I want to add more flowerpot colors (to compleete the 16 minecraft colors). Does it still choose the plants in the matching colored pots then?
-
how do i add my custom tulips to a vanilla-biome?
Drachenbauer replied to Drachenbauer's topic in Modder Support
This is now my custom bonemeal class: How can i make the vanilla BoneMealItem-class use my custom methods and the custom added part of the applyBonemeal-method here after it´s normal rightclick-behavior? -
how do i add my custom tulips to a vanilla-biome?
Drachenbauer replied to Drachenbauer's topic in Modder Support
I already used that backtracing and found, what you say, but i cannot find, where DECORATED_FLOWER get´s the flowers from, and i found nothing there, where code in my own classes can access. so i now create my own bonemeal, that manually adds my tulips, if the clicked grass-block is in one of the three vanilla-biomes with tulips. I make it the way, how my bick blocks in the other mod add their invisible part-blocks to the world, if placed. At first i let it find random positions in a 9x9 square around the clicked grass-blocks and find te surface of the ground there and then it should place random tulips there, if a grassblock is below and the position, itself has just air or a plant (but not a tree or a tulip). It just needs a little bugfix and i think, i find the solution. Edit: I fixed it. My custom bonemeal now makes alot of colorful tulips grow. now i think, i can pack my mod. But i have one last question: How can i make the vanilla bonemeal use this behavior? -
Hello I have registered a Tileentity: public static final DeferredRegister<TileEntityType<?>> TILE_ENTITY_TYPES = new DeferredRegister<>(ForgeRegistries.TILE_ENTITIES, Reference.MOD_ID); public static final RegistryObject<TileEntityType<BlockColorsTileEntity>> BLOCK_COLORS = TILE_ENTITY_TYPES.register("block_colors", () -> TileEntityType.Builder.create(BlockColorsTileEntity::new, AngryBirdsBlocks.SLINGSHOT_BIRCH.get(), AngryBirdsBlocks.SLINGSHOT_BIRCH_2.get(), AngryBirdsBlocks.SLINGSHOT_BIRCH.get(), AngryBirdsBlocks.SLINGSHOT_BIRCH_2.get(), AngryBirdsBlocks.SLINGSHOT_DARK_OAK.get(), AngryBirdsBlocks.SLINGSHOT_DARK_OAK_2.get(), AngryBirdsBlocks.SLINGSHOT_JUNGLE.get(), AngryBirdsBlocks.SLINGSHOT_JUNGLE_2.get(), AngryBirdsBlocks.SLINGSHOT_OAK.get(), AngryBirdsBlocks.SLINGSHOT_OAK_2.get(), AngryBirdsBlocks.SLINGSHOT_SPRUCE.get(), AngryBirdsBlocks.SLINGSHOT_SPRUCE_2.get()).build(null)); Here is the class ot the TileEntity: package drachenbauer32.angrybirdsmod.entities.tile_entities; import drachenbauer32.angrybirdsmod.init.AngryBirdsTileEntities; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; public class BlockColorsTileEntity extends TileEntity { public BlockColorsTileEntity() { super(AngryBirdsTileEntities.BLOCK_COLORS.get()); } @Override public void read(CompoundNBT compound) { super.read(compound); } @Override public CompoundNBT write(CompoundNBT compound) { return super.write(compound); } } I also registered Blockcolors and ItemColors: @SubscribeEvent public static void registerBlockColors(final ColorHandlerEvent.Block event) { event.getBlockColors().register(blockColor, AngryBirdsBlocks.SLINGSHOT_BIRCH.get(), AngryBirdsBlocks.SLINGSHOT_BIRCH_2.get(), AngryBirdsBlocks.SLINGSHOT_BIRCH.get(), AngryBirdsBlocks.SLINGSHOT_BIRCH_2.get(), AngryBirdsBlocks.SLINGSHOT_DARK_OAK.get(), AngryBirdsBlocks.SLINGSHOT_DARK_OAK_2.get(), AngryBirdsBlocks.SLINGSHOT_JUNGLE.get(), AngryBirdsBlocks.SLINGSHOT_JUNGLE_2.get(), AngryBirdsBlocks.SLINGSHOT_OAK.get(), AngryBirdsBlocks.SLINGSHOT_OAK_2.get(), AngryBirdsBlocks.SLINGSHOT_SPRUCE.get(), AngryBirdsBlocks.SLINGSHOT_SPRUCE_2.get()); } @SubscribeEvent public static void registerItemColors(final ColorHandlerEvent.Item event) { event.getItemColors().register(itemColor, AngryBirdsItems.SLINGSHOT_BIRCH.get(), AngryBirdsItems.SLINGSHOT_BIRCH_2.get(), AngryBirdsItems.SLINGSHOT_BIRCH.get(), AngryBirdsItems.SLINGSHOT_BIRCH_2.get(), AngryBirdsItems.SLINGSHOT_DARK_OAK.get(), AngryBirdsItems.SLINGSHOT_DARK_OAK_2.get(), AngryBirdsItems.SLINGSHOT_JUNGLE.get(), AngryBirdsItems.SLINGSHOT_JUNGLE_2.get(), AngryBirdsItems.SLINGSHOT_OAK.get(), AngryBirdsItems.SLINGSHOT_OAK_2.get(), AngryBirdsItems.SLINGSHOT_SPRUCE.get(), AngryBirdsItems.SLINGSHOT_SPRUCE_2.get()); } And in the SlingshotBlock-class, connected the TileEntity: @Override public boolean hasTileEntity(BlockState state) { return true; } @Override public TileEntity createTileEntity(BlockState state, IBlockReader world) { return new BlockColorsTileEntity(); } How do i now store color-values in the TileEntity and how do i apply them to the textures of the Block and it´s BlockItem? The Item uses a 3d block-model and and not a simple flat item-model. How do i apply the color just to a part of the model (i use separate textures)
-
How do i make Bone meal able to spawn my tulips?
Drachenbauer replied to Drachenbauer's topic in Modder Support
Bump I still cannot find a solution -
I still don´t know, why it does not find the file... I tested to put a copy of the file into the folder, it tells about in the message, but i still get that message and the mod still does not load into the test-client. I also cannot find any mistakes in the file itself. It looks very similar to the ones of my other mods..
-
How do i register my own BlockStateProvider?
Drachenbauer replied to Drachenbauer's topic in Modder Support
I noticed, often, after a while using the same thread, i got no more answers there -
I found out the following: The GrassBlock tells, wich flowers can spawn. This is controlled bi the flowers-list in the Biome-class. Only instances of the DecoratedFlowerFeature are added to this list and the list is protected, that i cannot add stuff from somewhere else. Tulips are provided by the BlockClusterFeatureConfig PLAINS_FLOWER_CONFIG and the BlockClusterFeatureConfig FOREST_FLOWER_CONFIG. wich get their flowers via PlainFlowerBlockStateProvider and ForestFlowerBlockStateProvider, wich hold BlockState-lists with the tulips and other flowers. DecoratedFlowerFeature cannot use blockstates. How does DecoratedFlowerFeature get infos about the flowers?
-
Hello I noticed, that the PlainFlowerBlockStateProvider and the ForestFlowerBlockStateProvider add the vanilla-tulips to the biomes and make the bonemeal able to spawn them. I don´t know, how to add my tulips to the BlockState-lists in theese BlockStateProviders. So maybe I can create my own BlockStateProvider. Does anyone know, how i can add my tulips to the BlockState-lists of existing BlockStateProviders, or register a custom BlockStateProvider for them?
-
how do i add my custom tulips to a vanilla-biome?
Drachenbauer replied to Drachenbauer's topic in Modder Support
Is there any way to regiser a BlockStateProvider with DeferredRegister? -
As i now tested my mod, i saw this effect: The square-part of this block uses the official minecraft white concrete texture. Why it appears with this weird gradient effect? The block-class: and the properties in the registry-line: AngryBirdsBlocks.slingshot_birch_2 = new SlingshotBlock(Block.Properties.create( Material.WOOD, MaterialColor.ADOBE).notSolid().sound(SoundType.WOOD).lightValue(0). hardnessAndResistance(2.0f, 3.0f).variableOpacity()).setRegistryName("slingshot_birch_2"), Can anyone find out, why it get´s this effect?
-
[1.15.1] How to register a EntityType with the DeferredRegister
Drachenbauer replied to DragonITA's topic in Modder Support
My much slimmer code, that i posted above, can do that too. Ad cadiboo´s version: is there something about using spawneggs in a redstone-dispenser? I just wonder, about this part: public static void initUnaddedEggs() { final Map<EntityType<?>, SpawnEggItem> EGGS = ObfuscationReflectionHelper.getPrivateValue(SpawnEggItem.class, null, "field_195987_b"); DefaultDispenseItemBehavior defaultDispenseItemBehavior = new DefaultDispenseItemBehavior() { public ItemStack dispenseStack(IBlockSource source, ItemStack stack) { Direction direction = source.getBlockState().get(DispenserBlock.FACING); EntityType<?> entitytype = ((SpawnEggItem) stack.getItem()).getType(stack.getTag()); entitytype.spawn(source.getWorld(), stack, null, source.getBlockPos().offset(direction), SpawnReason.DISPENSER, direction != Direction.UP, false); stack.shrink(1); return stack; } }; for (final SpawnEggItem egg : UNADDED_EGGS) { EGGS.put(egg.getType(null), egg); DispenserBlock.registerDispenseBehavior(egg, defaultDispenseItemBehavior); // ItemColors for each spawn egg don't need to be registered because this method is called before ItemColors is created } UNADDED_EGGS.clear(); } I tested to put my egg into the dispenser, but only the egg came out. But this happens with all my mod-ones, also the ones, that still are registered the old way, too... Edit: Now i got the new one to work in a dispenser. Now i know, this method makes it able to spawn the entity out of the disbenser. And for the two constructors: When do you get an Entity type in a NonNullSupplier? With DeferredRegister, you put them always into a RegistryObject. And instead of using this thing called "Lazy", you also can put them into separate fields and use a boolean to choose one in the getType method. The boolean is set to true in one constructor and false in the other. Another question: Why do the creators of minecraft never change the order of register entity and item? Edit: Now i modifyed the constructors a bit: I removed the EntityType parameters from the constructor-headers and pass directly "null" to the superconstructor. So i could remove the "null" from my registry lines for the eggs. -
[1.15.1] How to register a EntityType with the DeferredRegister
Drachenbauer replied to DragonITA's topic in Modder Support
i´m not sure, what the additional code in yous does... What more than placing eitities by hand in creative should it do? -
[1.15.1] How to register a EntityType with the DeferredRegister
Drachenbauer replied to DragonITA's topic in Modder Support
I saw, that someone talked about this git, but i saw no links to it. -
[1.15.1] How to register a EntityType with the DeferredRegister
Drachenbauer replied to DragonITA's topic in Modder Support
If you still have problems with your SparnEgg, try this: public class SupplierSpawnEggItem extends SpawnEggItem { private RegistryObject<?> supplier; public SupplierSpawnEggItem(EntityType<?> typeIn, RegistryObject<?> supplierIn, int primaryColorIn, int secondaryColorIn, Properties builder) { super(typeIn, primaryColorIn, secondaryColorIn, builder); supplier = supplierIn; } @Override public EntityType<?> getType(CompoundNBT p_208076_1_) { return (EntityType<?>) supplier.get(); } } This custom SpawnEgg-class works fine for me. Textures and colors work too. -
public class SupplierSpawnEggItem extends SpawnEggItem { private RegistryObject<?> supplier; public SupplierSpawnEggItem(EntityType<?> typeIn, RegistryObject<?> supplierIn, int primaryColorIn, int secondaryColorIn, Properties builder) { super(typeIn, primaryColorIn, secondaryColorIn, builder); supplier = supplierIn; } @Override public EntityType<?> getType(CompoundNBT p_208076_1_) { return (EntityType<?>) supplier.get(); } } This works now. In my inventory i have a normal looking spawn-egg, and i can plce the entity in the world with it.