Jump to content

Drachenbauer

Members
  • Posts

    724
  • Joined

  • Last visited

Posts posted by Drachenbauer

  1. But i still see the old variant in the test world. the particles are still red.

     

    edit:

    I noticed, that i forgot the line in the main-class-constructor, that initializes the deferred registry for the blocks

     

    Now i get this error:

    Quote

    java.lang.ClassCastException: drachenbauer32.yellowredstonemod.particles.YellowRedstoneParticles cannot be cast to net.minecraft.particles.RedstoneParticleData

     

    if i now try to extend from RedstoneParticleData to create my own variant, i get a problem with the registry.

    It says

    Quote

    The constructor ParticleType<YellowRedstoneParticles>(boolean, IParticleData.IDeserializer<RedstoneParticleData>) is undefined

    As i had copyed and modifyed the class, the registration line was ok.

     

    Now i placed a copy of the whoole deserializer-part from the original class into my one and replaced the name every where in this code.

    Now it works.

     

    Yellow redstone wire with yellow dust particles

  2. I made such a class and registered it this way, but minecraft still uses the old one...

     

    Now i think, if i register my own varialts of the blockitems in the old registrynames and attach them to the new blocks, maybe i can place the new blocks, but the ond ones still will be there in the world, if placed before using the mod......

  3. This registers my particletype:

        public static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES = new DeferredRegister<>(ForgeRegistries.PARTICLE_TYPES, "minecraft");
        
        public static final RegistryObject<ParticleType<YellowRedstoneParticles>> DUST = PARTICLE_TYPES.register("dust", () -> new ParticleType<YellowRedstoneParticles>(false, YellowRedstoneParticles.DESERIALIZER));

     

    and the class for this is en exact copy of the vanilla RedstoneData class.

    just with another name and the "REDSTONE_DUST" -field with a changed value

  4. Edit:

    now i tried another type of calculation:

                int red;
                int green;
                
                if(power == 0)
                {
                    red = 127 * 256 * 256;
                    green = 111 * 256;
                }
                else
                {
                    red = ((8 * power) + 128) * 256 * 256;
                    green = ((7 * power) + 112) * 256;
                }
                
                return red + green;

    in the colormultiplyer function in my class and noticed, my stuff is already applyed to the redstone.

     

    I calculated the red and green channel of the color and put them together at the end.

    This makes now a bright warm yellow for the highest redstone power level.

    I have no "blue" value here, because at this yellow the blue channel is "0" for a bright yellow.

    So i don´t need stuff about the blue channel here.

     

    How do i now change the color of the redstone-particles (hovering over powered redstone stuff) to the same bright yellow?

    It should be the case for every block-type, that emmits theese redstone-particles (redstone-wire, redstone-torch, redstone-ore activated lever, maybe there are some more things)

  5. Now i found this in the RedstoneBlock-class:

       @OnlyIn(Dist.CLIENT)
       public static int colorMultiplier(int p_176337_0_) {
          float f = (float)p_176337_0_ / 15.0F;
          float f1 = f * 0.6F + 0.4F;
          if (p_176337_0_ == 0) {
             f1 = 0.3F;
          }
    
          float f2 = f * f * 0.7F - 0.5F;
          float f3 = f * f * 0.6F - 0.7F;
          if (f2 < 0.0F) {
             f2 = 0.0F;
          }
    
          if (f3 < 0.0F) {
             f3 = 0.0F;
          }
    
          int i = MathHelper.clamp((int)(f1 * 255.0F), 0, 255);
          int j = MathHelper.clamp((int)(f2 * 255.0F), 0, 255);
          int k = MathHelper.clamp((int)(f3 * 255.0F), 0, 255);
          return -16777216 | i << 16 | j << 8 | k;
       }

     

    how can i apply my own variant of this outside of the RedstoneBlock class?

     

    If i know it, i think, i just have to change this

          int i = MathHelper.clamp((int)(f1 * 255.0F), 0, 255);
          int j = MathHelper.clamp((int)(f2 * 255.0F), 0, 255);
          int k = MathHelper.clamp((int)(f3 * 255.0F), 0, 255);
          

    to this

          int i = MathHelper.clamp((int)(f1 * 255.0F), (f1 * 223.0F), 255);
          int j = MathHelper.clamp((int)(f2 * 255.0F), (f2 * 223.0F), 255);
          int k = MathHelper.clamp((int)(f3 * 255.0F), (f3 * 223.0F), 255);
          

    to turn it into a warm yellow.

  6. Now i have this:

        @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD)
        public static class RegistryEvents
        {
            public static IBlockColor blockColor;
            
            @SubscribeEvent
            public static void registerBlockColors(final ColorHandlerEvent.Block event)
            {
                event.getBlockColors().register(blockColor, Blocks.REDSTONE_WIRE);
            }
        }

    in my main-class,

    how do i now add the colors to it?

  7. If i register the items for the empty flowerpots as separate fields of type RegistryObject<BlockItem>,  everxthing works fine.

     

    But if i try to regiter them in an array RegistryObject<BlockItem>[] (actual state of my repository) something messes up:

     

    I noticed, after it has compleeted the arrays at registering the blocks, at first i got an IndexOutOfBoundsException, because it tried to do something using the int i, that i use to access the entries of the array, after this integer has reached the length of the array.

     

    So i added an if-block, that makes the integer not more raising, if it has reached the length of the array - 1

    Then the error did not appear any more.

     

    but if i now try to use an array for the items as well. the itemgroup is filled with yellow pots only and all different pots in my actual player-inventoty (bottom of the screen) are renamed to "Yellow Flowerpot"

     

    Then, for a test, in the class with the item-registry, i added an else block, that sets the integer back to 0 instead of only stopping it raising,

    Now all theese flowerpots are renamed to "Black Flowerpot" ingame.

     

    If i use commands to give me flowerpots in different colors, the tab command filler shows the correct registrynames, but the display-names, given by the language-file are all renamed like above.

     

    And if i place the pots on the ground, they appear in the color, what the display-name says, not in the one from the item-graphic.

     

    With the else-part in the irem registry, all flowerpots place black ones on the ground and without it, they all place yellow ones (and are renamed to that).

     

    but in both cases the itemgroup contains yellow pots (just renamed to black, if the else thing is active).

     

    It seems like it doesn´t matter, if i use the else part in the block registry or not.

     

    What exactly does it do, if the arrays are already filled, and how can i make it match items and blocks correctly, if i use arrays in both registry classes?

  8. Now in the flowerpots mod, i made bees accept potted flowers by placing them (in vanilla-pots and in my custom ones) into the small_flowers tag-file.

     

    At first i decided to create my own potted_flowers tag-file, in the directory "data/coloredflowerpotsmod/tags/blocks", that holds only blooming flowers in pots (only the flower-types from the small_flowers tag-file)

     

    But i don´t know, how to put a custom tag file from my mod-directory into a copy of an existing tag-file in the minecraft-directory.

    This always gives me an unknown-name-error.

     

    I don´t want to put the existing flower_pots tag-file into the flowers tag-file, because this will make bees go to empty pots and green-plants (cactus, bamboo, fern, saplimgs, mushrooms, death_bush) in pots. But they are no blooming flowers.

  9. i copyed now the one for the small flowers into my mod-resources, with starting the path with "minecraft" and added my tulips to the list inside.

     

    Now i think, the item-one of this is used for bee-reaction on a holded flower.

    so i added this too.

     

    Edit:

    now they go to the modded tulips and look at me, if i hold a modded tulip.

  10. Quote

    You should really fix that, it's like trying to run a race with a broken leg. . . .

    I´m pretty sure, this is an issue of the acrually used faily snapcshot.

    And in the bee-entity-class many functions still have weird names.

     

    i now placed a few vanilla tulips at one patch between my modded ones and spawned some more bees.

    Then i saw, all the bees came together at the vanilla-tulips-patch and no where else.

    So i´m pretty sure its about my own tulips.

    i also noticed, if i hold a vanilla flower, a bee will sit down in front of me and look at me.

    But if i hold one of my own tulips, the bees ignore me.

     

    And while writing the mod with the tulips, i wrote nothing related to the bees.

    I thaugt, it works automatic, because they are instances of the type FlowerBlock.

     

    I think anywhere flowers for bees must be listed, and i have to add mine to the list, too.

  11. In my actual game i placed a honey-farm behind my base (in a glasshouse to keep bees together).

    Inside there I placed alot of my modded tulips.

    Now i cannot see the bees any more.

    It looks like they are in their hive and don´t come out any more.

     

    Now i think, they only accept vanilla-flowers, but no modded ones.

     

    How can i fix this in my mod?

     

    And can i make them accept potted flowers, too?

     

    In this case it´s a bit tricky to search through the referenced librarys, because at the bee and at the flower-block, i get an "attached source not found" error, if i try to look inside.

    I can oken the java-classes from windows explorer, but in this case i cannot use the helpful functions of my coding-software, such like finding method-references and something like that.

  12. Now my brewing screen appears and i can place matching items into all the slots.

    And the model also shows bottles on the matching positions (view from south matches perfect with the slots on the brewing-window).

     

    But as i tested a brewing process, the fourth bottle disappeared at the finish.

     

    Edit:

    i had to increase some InventorySlot values in the TileEntity and the Container by 1.

    Now everything works fine.

     

    Edit again:

    As i used it in the actual game, i noticed, that at placing it, for a short moment a bottle appears on one of the filling arms.

    Seams like a boolean for one of them is true for a short moment after placing.

     

    Edit fixed:

    The constructor of the Block has aline, that sets the states for the filling arms in the model to false at first.

    It included only three of theese parts.

    So i added

    with(HAS_BOTTLE[3], Boolean.valueOf(false))

    as the fourth part into that line.

    I´m sure, that no more bottle will appear at placing the brewing stand now.

  13. Push

     

    I still don´t know, how to register an inventory-container with DeferredRegister.

     

    If i try to use IForgeContainerType like this:

    public static final RegistryObject<ContainerType<FourBottlesBrewingStandContainer>> FOUR_BOTTLES_BREWING_STAND = CONTAINER_TYPES.register("four_bottles_brewing_stand", () -> IForgeContainerType.create(FourBottlesBrewingStandContainer::new));

     

    i get theese three errors:

    Quote

    The method create(IContainerFactory<T>) in the type IForgeContainerType is not applicable for the arguments (FourBottlesBrewingStandContainer::new)


    The method register(String, Supplier<? extends I>) in the type DeferredRegister<ContainerType<?>> is not applicable for the arguments (String, () -> {})


    The type FourBottlesBrewingStandContainer does not define FourBottlesBrewingStandContainer(int, PlayerInventory, PacketBuffer) that is applicable here

     

    How do i add a PacketBuffer to the constructor of my container?

     

    Edit:

    Now i added "PacketBuffer buffer" to the constructor input.

    The errors disappeared, but no window opens, if i click on my brewingstand and an error appears in the console:

    Quote

    [m[33m[15:32:57] [Render thread/WARN] [minecraft/ScreenManager]: Failed to create screen for menu type: fourbottlesbrewingstandmod:four_bottles_brewing_stand

    Edit:

    Now i placed this in my client-setup:

    ScreenManager.registerFactory(FourBottlesBrewingStandContainers.FOUR_BOTTLES_BREWING_STAND.get(), FourBottlesBrewingStandScreen::new);

    And it works.

  14. How do i register the container with DeferredRegister?

     

    I have this in my main-calss constructor:

    FourBottlesBrewingStandContainers.CONTAINER_TYPES.register(FMLJavaModLoadingContext.get().getModEventBus());

     

    and this in my container-register-class:

    public static final DeferredRegister<ContainerType<?>> CONTAINER_TYPES = new DeferredRegister<>(ForgeRegistries.CONTAINERS, Reference.MOD_ID);

     

    But i cannot find a way to create the RegistryObject without any red errors in the code...

     

    In the vanilla ContainerType-class i found this:

    public static final ContainerType<BrewingStandContainer> BREWING_STAND = register("brewing_stand", BrewingStandContainer::new);

     

    at other stuff (blocks, items, entities,...), i was able to put the part behind the registryname into the RegistryObject behind the id-name.

    But here it is "BrewingStandContainer::new" and it does not work...

     

     This:

    public static final RegistryObject<ContainerType<FourBottlesBrewingStandContainer>> FOUR_BOTTLES_BREWING_STAND = CONTAINER_TYPES.register("four_bottles_brewing_stand", () -> FourBottlesBrewingStandContainer::new);

     

    gives two errors:

    Quote

    The target type of this expression must be a functional interface


    Type mismatch: cannot convert from RegistryObject<ContainerType<?>> to RegistryObject<ContainerType<FourBottlesBrewingStandContainer>>

     

    What else must i place behind the arrow-operator in that line to register a container?

  15. I mean, i don´t know, wich numbers instde theese blits are the position for displaying the graphics.

    Is the blaze input the little horizontal bar below the bubbles?

    If yes, i moved it together with the bubbles.

     

    And i wonder, why there is a longer spiral-wire at the right side of the graphic, where the overlays are?

  16. In the BrewingStandBloch i find "BlockStateProperties.HAS_BOTTLE_0" and the same with 1 and 2.

    It seems like BlockStateProperties is a vanilla-class

    How do i add one more for the fourth bottle?

     

    And for the TileEntity:

    I extend LockableTileEntity, because if i extend BrewingStandTileEntity, i cannot pass my TileEntityType to the constructor.

    So i copied the whoole code of BrewingStandTileEntity into my one.

    But i´m not sure, where i have to do some changes to add one more inventory-slot

     

    Edit

    I had to change the position of the bubbles and the arrow on the brewingstand-window a bit to fit four slots.

    Wich values on my screen-class (copy of the brewingstand´s screen-class) must i change to change the positions for the white overlays?

×
×
  • Create New...

Important Information

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