Jump to content

Drachenbauer

Members
  • Posts

    727
  • Joined

  • Last visited

Everything posted by Drachenbauer

  1. Now i have this: package drachenbauer32.angrybirdsmod.items; import drachenbauer32.angrybirdsmod.entities.RedEntity; import net.minecraft.entity.EntityType; import net.minecraft.item.SpawnEggItem; import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.fml.RegistryObject; public class SupplierSpawnEggItem extends SpawnEggItem { private RegistryObject<EntityType<?>> supplier; public SupplierSpawnEggItem(EntityType<?> typeIn, RegistryObject<EntityType<?>> supplierIn, int primaryColorIn, int secondaryColorIn, Properties builder) { super(typeIn, primaryColorIn, secondaryColorIn, builder); supplier = supplierIn; } @Override public EntityType<?> getType(CompoundNBT p_208076_1_) { return supplier.get(); } } But i still don´t know how to change the RegistryObject-thing in the constructor to be able to pass RegistryObjets like public static final RegistryObject<EntityType<RedEntity>> RED = ENTITY_TYPES.register("red", () -> EntityType.Builder.create(RedEntity::new, EntityClassification.AMBIENT).size(0.5F, 0.5F).build(null)); or public static final RegistryObject<EntityType<ChuckEntity>> RED = ENTITY_TYPES.register("chuck", () -> EntityType.Builder.create(ChuckEntity::new, EntityClassification.AMBIENT).size(0.5F, 0.5F).build(null)); Wich have a specific entity-class in the inner "<>" instead of a "?" ? They all have different Entity-classes there, and i need a solution, that allows them all to pass into this constructor.
  2. Iow i found out, that ForestFlowerBlockStateProvider and PlainFlowerBlockStateProvider use blockstate-lists, wich include the vanilla-tulips. Is there any way to pass my own list: private static final BlockState[] TULIPS_BLOCKSTATES = new BlockState[] { Blocks.RED_TULIP.getDefaultState(), Blocks.ORANGE_TULIP.getDefaultState(), Blocks.WHITE_TULIP.getDefaultState(), Blocks.PINK_TULIP.getDefaultState(), MoreTulipsBlocks.BLACK_TULIP.get().getDefaultState(), MoreTulipsBlocks.BLUE_TULIP.get().getDefaultState(), MoreTulipsBlocks.BROWN_TULIP.get().getDefaultState(), MoreTulipsBlocks.CYAN_TULIP.get().getDefaultState(), MoreTulipsBlocks.GRAY_TULIP.get().getDefaultState(), MoreTulipsBlocks.GREEN_TULIP.get().getDefaultState(), MoreTulipsBlocks.LIGHT_BLUE_TULIP.get().getDefaultState(), MoreTulipsBlocks.LIGHT_GRAY_TULIP.get().getDefaultState(), MoreTulipsBlocks.LIME_TULIP.get().getDefaultState(), MoreTulipsBlocks.MAGENTA_TULIP.get().getDefaultState(), MoreTulipsBlocks.PURPLE_TULIP.get().getDefaultState(), MoreTulipsBlocks.YELLOW_TULIP.get().getDefaultState(), }; into theese providers or should i register my own BlockStateProvider
  3. Hello Since someone told me, thar DeferredRegister is the best way to register mod-stuff, i want to register all my stuff tkis way. Now i have a problem with SpawnEggs for Entities. I registered an entity this way: public static final RegistryObject<EntityType<RedEntity>> RED = ENTITY_TYPES.register("red", () -> EntityType.Builder.create(RedEntity::new, EntityClassification.AMBIENT).size(0.5F, 0.5F).build(null)); Someone sayd, to register the SpawnEgg also this way, a custom spawnegg-class, that accepts a supplyer, is needed. I now tried it this way: package drachenbauer32.angrybirdsmod.items; import net.minecraft.entity.EntityType; import net.minecraft.item.SpawnEggItem; import net.minecraftforge.fml.RegistryObject; public class SupplierSpawnEggItem extends SpawnEggItem { public SupplierSpawnEggItem(RegistryObject<EntityType<?>> supplierIn, int primaryColorIn, int secondaryColorIn, Properties builder) { super(supplierIn.get(), primaryColorIn, secondaryColorIn, builder); } } But now i get a n error about the constructor, that says: I cannot remove the name of the Entity-class here: RegistryObject<EntityType<RedEntity>> in the entity registerer, because this will cause some more errors, if i put a "?" instead. How must i change the constructor, that it accepts theese suppliers, no matter, wich entity-class they contain?
  4. There is something about DecoratedFeatureConfig. It looks like, it get´s flowers to place, that came into the biome this way But i don´know, how to get my tulips with DecoratedFeatureConfig into the biomes... Actualy i use BlockClusterFeatureConfig.
  5. IGrowable is only used by plant-blocks with multiple grow-states. And not by the flowers.
  6. I looked into that item, but saw nothing about the flower-blocks there...
  7. Another question: how do i make bone meal spawn my tulips in theese biomes?
  8. You answered, while i edited my post: Now i found the solution: Theese lines: public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Reference.MOD_ID); and public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Reference.MOD_ID); needed to be in the separate classes, too. Now it works.
  9. Hello I have a problem with my inflateble entity: With a method, that i found a the enderdragon, imade him bounce me away in the moment of inflating. But if he is inflated, i can glitch through him... If i press F3+B i see his bigger bounding-box, if he is inflated. Here is my actual code for this behavior:: @Override public void livingTick() { if (timeUntilDeflating > 0) { timeUntilDeflating--; if (timeUntilDeflating == 0) { isInflated = false; AxisAlignedBB aabb = this.getBoundingBox(); this.setBoundingBox(new AxisAlignedBB(aabb.minX + 0.5d, aabb.minY, aabb.minZ + 0.5d, aabb.maxX - 0.5d, aabb.maxY - 1.0d, aabb.maxZ - 0.5d)); } } else { super.livingTick(); } } @Override public void onCollideWithPlayer(PlayerEntity entityIn) { if (timeUntilDeflating == 0) { timeUntilDeflating = 80; isInflated = true; AxisAlignedBB aabb = this.getBoundingBox(); this.setBoundingBox(new AxisAlignedBB(aabb.minX - 0.5d, aabb.minY, aabb.minZ - 0.5d, aabb.maxX + 0.5d, aabb.maxY + 1.0d, aabb.maxZ + 0.5d)); this.collideWithEntities(this.world.getEntitiesInAABBexcluding(this, this.getBoundingBox().grow(0.5D, 0.5D, 0.5D).offset(0.0D, 0.0D, 0.0D), null)); } } private void collideWithEntities(List<Entity> entities) { double d0 = (getBoundingBox().minX + getBoundingBox().maxX) / 2.0D; double d1 = (getBoundingBox().minZ + getBoundingBox().maxZ) / 2.0D; for(Entity entity : entities) { if (entity instanceof LivingEntity) { double d2 = entity.getPosX() - d0; double d3 = entity.getPosZ() - d1; double d4 = d2 * d2 + d3 * d3; entity.addVelocity(d2 / d4 * 4.0D, (double)0.2F, d3 / d4 * 4.0D); } } } } My idea now is, tha something in super.livingTicks makes the boundingbox work. How can i make him stay in his actual position and rotation, while inflates, but without stopping to use super.livingTicks? Another question: How nust i modify the last calculation here, that i bounce less far away from him (about the half distance is enough)?
  10. I also think, biomes in mods may have the tulips added a bit different to the vanila-ones. This can make it more difficult to check all biomes, that may appear in mods... I also have a new question: Can i have my block and item-registries separated into two init-classes? In the vanila-code has a class Items, where all items are initialized. And a class Blocks, where all blocks are initialized. I have similar classes in my mod, too. So i thaught, i can put the block-registrys into my blocks-class and the item-registrys in my items-class. But now i get an error: How can i make theese registrys work, if they are in separate classes? Edit: Now i found the solution: Theese lines: public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Reference.MOD_ID); needed to be in the separate classes, too.
  11. In a wiki i saw, there are only 3 biomes, wich contain tulips. If this is right, i think, i just can three times call my method and give theese biomes as arguments.
  12. Now i have this: DeferredWorkQueue.runLater(() -> { System.out.println("Blumenliste:"); for (Biome biome : Biome.BIOMES) { /*if (biome.getFlowers().contains(o)) { }*/ System.out.println(biome); System.out.println(biome.getFlowers()); } addModTulips(Biomes.FLOWER_FOREST); System.out.println("FLOWER_FOREST:"); System.out.println(Biomes.FLOWER_FOREST); System.out.println(Biomes.FLOWER_FOREST.getFlowers()); } ); and in the console i found this: This looks like Flower Forwst does not appear in the biomes-list... and i still don´t know, what i should place intead of the "flower" in this code: if (biome.getFlowers().contains(flower)) { } to check, if it for sample contains red tulips... Edit: in a Minecraft wiki, i saw, that tulips only appear in Plains, Sunflower Plains and Flower Forest. Is this right? If Yes, i simply can use 3 lines of my methode-call with theese biomes given as param.
  13. Now i try this to check for tulips: DeferredWorkQueue.runLater(() -> { for (Biome biome : Biome.BIOMES) { /*if (biome.getFlowers().contains(o)) { }*/ System.out.print(biome.getFlowers()); } addModTulips(Biomes.FLOWER_FOREST); } ); At first i want to use an output to see, how the content of the flower-list looks. But i find no result in the console... Do i just not know, where in the console output i have to find output from the common-setup? Or is there any reason, that this gives no output? In another mod i used this output-command in a model-class and found it´s output in the console.
  14. private static final BlockState DANDELION = Blocks.DANDELION.getDefaultState(); I mean code-lines like this for the tulips. This sample is the one for the dandelion and is located in the DefaultBiomeFeatures.. Or can i write my own into my code? Now i´fe written my own lines of this. How can i now make only my code generate tulips in the biomes? I want to use my code for all biomes with tulips. My idea is to use the set BIOMES in the class Biome and make a for-loop, that goes through the biomes: for (Biome biome : Biome.BIOMES) { } And inside therei want to check for tuips in the biomes and if yes, use my code.. For this i have a question How can i check, if a biome has tulips?
  15. Now it works. I created a new flower forest world and started directly in a patch of my own black tulips. Now i just have to register the other tulips to biome the same way. Edit: Now i modifyed my Config-line for the biome, that it makes patches with a mix of all my tulip-colors. Now i hace some more questions: Where are the Blockstates from the vanilla-tulips? I want to add them to my mixed tulip patches, too. How can i make, that only my code adds tulips to the biomes?
  16. Now i get an error: In the error i found a line, that says "Duplicate registration purple_tulip" I wonder where this registration is duplicated... This is now my main-class: Edit: i think i found it now, saw, that the yellow tulip at the blocks registry had the registry name "purple_tulip". fixed it now and test it
  17. Now i register my blocks and items like shown in the sample in the "DeferredRegister"-class. Can i remoce the integrated "RegistryEvents"-class from my main-class, if i finished the new way to register my stuff? Can i put the lines for the single blocks and items, like: public static final RegistryObject<Block> BLACK_TULIP_BLOCK = BLOCKS.register("black_tulip", () -> new FlowerBlock(Effects.WEAKNESS, 9, Block.Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0f).sound(SoundType.PLANT))); into my blocks- and items-classes, where i already had them listed?
  18. Do you mean the lines for making the tulips transparent should be in client? I thaught, you mean my biome-thing. where else should i initialize them?
  19. some posts above, an user told me to work in common. If i registered my blocks wrong, why i can place them in a world and plant the tulips in pots ?
  20. now i found, what i looked for. time for a test in a world with a flowerforest biome nearby. Edit: this is now my main-class: I made a method, that should ad my tulips to the flowerforest biome. For a first test, it only includes the black tulip now. But as i created a flower-forest-world, i cannot find any black tulips in there...
  21. Now i have this in my FMLCommonSetupEvent: DeferredWorkQueue.runLater(() -> { addModTulips(biomeIn); } ); But i´m not sure, how to put a specific biome into my method-call... I don´t know, where the methods are called, wich i found in DefaultBiomeFeatures... I must find this to see how a biome is given in there... should i do it as a new instance of the biome-class?
  22. I´m not sure, how to use DeferredWorkQueue Should i make a method like in DefaultBiomeFeatures and call it in the FMLCommonSetupEvent.
  23. Hello I have created my own tulips to compleete a 16 colors set. I can put them on the ground and into a flowerpot. But how do i add them to s vanilla-biome? I don´t know, where in that huge vanilla-code library i can find the matching code...
  24. as i searched on google, how to change the collision-box of my entity.
  25. Hello One mod, i´m working on, does not load into the test-client... In the console i found this line: It looks like it tries to find the mods.toml directly in the main-folder of the exploded resources and not in the META_INF-folder, that is located inside there. From where comes the info, where the test-run has to search this file?
×
×
  • Create New...

Important Information

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