Jump to content


  • Posts

  • Joined

  • Last visited

Everything posted by Drachenbauer

  1. At searching for "change fields with reflection" i found this: Class<?> clazz = Class.forName("Child"); Object cc = clazz.newInstance(); Field f1 = cc.getClass().getField("a_field"); f1.set(cc, "reflecting on life"); But if i try to use DyeColors in there, it says things about IllegalAcessExeption. i hat to put theese exeptionhandlings to the header of the function, i placed this in. another question: A color-field holds alot of content; WHITE(0, "white", 16777215, MaterialColor.SNOW, 16777215, 16777215), how do i put all this into the setter of this reflection-stuff?
  2. This method want´s to return an object of the type Dyecolor. And i noticed, that i cannot make a custom instance of it, because this is not possible with an enum. Why don´t you just tell me, how to use the int field colorValue, where it wants to return DyeColor?
  3. Yes. I know about theese fields. Must i extend and override the sheep to replace the stuff, shown above, with such custom colorvalues? I don´t know, how to put stuff with custom values in theese fields, behind the "return" in this mthod there?
  4. The sheep has this: public static DyeColor getRandomSheepColor(Random random) { int i = random.nextInt(100); if (i < 5) { return DyeColor.BLACK; } else if (i < 10) { return DyeColor.GRAY; } else if (i < 15) { return DyeColor.LIGHT_GRAY; } else if (i < 18) { return DyeColor.BROWN; } else if (random.nextInt(500) == 0) { return DyeColor.PINK; } else { return DyeColor.WHITE; } }
  5. Must i extend and override all classes, that uses Dyecolor to do this? I saw some of them diectly using the prepared Colors on top of the enum
  6. I´m not sure, how. if i any where create own DyeColor-values, how can i apply them to the things in the game, wich use this enum?
  7. I really want to change the colorvalues for the things, i listed in the startpost. The other stuff, with textures, is already done. There must be a solution. Optifine did it, too.
  8. theese are textcolors, not the colors, i mean. I found out, that, what i mean, is in DyeColor. What is the best way to get my own colorvalues in there?
  9. Hello Is there any way to change the 16 basic color values (for banners, shields, sheep-wool, wolf-collars, ...) with a mod? Where in minecraft´s code are they stored?
  10. i thaught in that editor´s font, it looks like this, if it´s lowercase. I was so sure, that i didn´t use shift to type it... now they look right in all four directions.
  11. In my codesample, you see, that i already try this, but the given y-rotation is not applyed.
  12. Hello I´m working on a mod, that makes the pumpkin and melon blocks laying on the side, as long as they are attached to their stems. I noticed, that the stem goes to the middle of the vertical side of the block, but the texture with the "stem-dot" in the center is ontop of the model. That looks not very realistic The java-stuff is ready. i made extra block classes for the attached melon and pumpkin, to have blockstates (unable to add them to the vanilla-ones for overriding them) But now i have a problem with their blockstates: If they grow to the north or south, they look fine, with rotating the existing melon and pumpkin models around x (the stem goes exact to the rght spot). But, if they grow to the east or west, i find no way to rotate the model in theese directions (rotate z does not exist). I tried rotating x and y, but they appear only x rotated (identical to the north and south ones). How can i rotate the east and west variants in the blockstates correctly? I don´t want to make a new model extra fot this. My actual blockstate-json: { "variants": { "facing=north": { "model": "block/melon", "x": 270 }, "facing=east": { "model": "block/melon", "x": 270, "Y" : 90 }, "facing=south": { "model": "block/melon", "x": 90 }, "facing=west": { "model": "block/melon", "x": 90, "Y" : 90 } } } For the pumpkin the same, just with "pumpkin" instead of "melon" in the four lines.
  13. in the actual game i have alot of mods with itemgroups, now one at the bottom, too, but the one for the flowerpots is not there. The mod is loaded, it´s in the mod-list, and with the search-function i have access to the pots, and can use them mormal.
  14. I have this instance in my main-class for all my mods. And in the test-client, it shows the itemgroup. Only, if i pack the mod (gradlew build) and run it in the actual game, the itemgroup does not appear. The itmgroup-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); } } Itemgroup-class of another mod, that works in tha actual game, too: package drachenbauer32.moretulipsmod.util; import drachenbauer32.moretulipsmod.MoreTulips; import drachenbauer32.moretulipsmod.init.MoreTulipsItems; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; public class MoreTulipsItemGroup extends ItemGroup { public MoreTulipsItemGroup() { super("MoreTulips"); } @Override public ItemStack createIcon() { return new ItemStack(MoreTulipsItems.YELLOW_TULIP.get()); } @Override public void fill(NonNullList<ItemStack> itemStacks) { super.fill(itemStacks); itemStacks.sort(MoreTulips.itemSorter); } } For both mods, i have the initializer-field for the itemgroup and also the itemsorter in the main-class, at exact the same positions. I´m pretty sure, the only difference here are the names of the itemgroups and the names of the itemstacks for the icon. And in the log from the actual game, nothing appears about this itemgroup.
  15. bump Still didn´t find a way to solve the things in the previous post... can anyone please help me?
  16. Entities stop, if their collision-box touch the one of a block. As a player you notice it at walking against a wall. I wonder, where this is coded. Maybe i can hook my code there for switching the RedstoneOre on at walking against it or jumping or flying under it until automatic stopping. And still: Why the RedstoneOre does not switch on, if i leftclick it with a weapon (sword, trident) or hit its top with an arrow or thrown trident?
  17. For the repeater i have got a little problem: I can set the particle position by direction. But using the BlockState DELAY for moving the particle position with the torch does not work. My code for this: package drachenbauer32.yellowredstonemod.blocks; import java.util.Random; import drachenbauer32.yellowredstonemod.util.Reference; import net.minecraft.block.BlockState; import net.minecraft.block.RepeaterBlock; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class YellowRepeaterBlock extends RepeaterBlock { private double ParticleX_1; private double ParticleX_2; private double ParticleZ_1; private double ParticleZ_2; public YellowRepeaterBlock(Properties properties) { super(properties); } @Override public int getLightValue(BlockState state) { if(state.get(POWERED)) { return 15; } else { return 0; } } private void setParticlePositions(BlockState state) { double delay = (double)state.get(DELAY) / 8; if (state.get(HORIZONTAL_FACING) == Direction.NORTH) { ParticleX_1 = 0.5; ParticleX_2 = 0.5; ParticleZ_1 = 0.8125; ParticleZ_2 = 0.6875 - delay; } else if (state.get(HORIZONTAL_FACING) == Direction.EAST) { ParticleX_1 = 0.1875; ParticleX_2 = 0.3125 + delay; ParticleZ_1 = 0.5; ParticleZ_2 = 0.5; } else if (state.get(HORIZONTAL_FACING) == Direction.SOUTH) { ParticleX_1 = 0.5; ParticleX_2 = 0.5; ParticleZ_1 = 0.1875; ParticleZ_2 = 0.3125 + delay; } else if (state.get(HORIZONTAL_FACING) == Direction.WEST) { ParticleX_1 = 0.8125; ParticleX_2 = 0.6875 - delay; ParticleZ_1 = 0.5; ParticleZ_2 = 0.5; } } @Override public void animateTick(BlockState state, World world, BlockPos pos, Random rand) { setParticlePositions(state); if (state.get(POWERED)) { double d0 = (double)pos.getX() + ParticleX_1 + (rand.nextDouble() - 0.5D) * 0.2D; double d1 = (double)pos.getY() + 0.375 + (rand.nextDouble() - 0.5D) * 0.2D; double d2 = (double)pos.getZ() + ParticleZ_1 + (rand.nextDouble() - 0.5D) * 0.2D; world.addParticle(Reference.REDSTONE_DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D); if (!(state.get(LOCKED))) { double d3 = (double)pos.getX() + ParticleX_2 + (rand.nextDouble() - 0.5D) * 0.2D; double d4 = (double)pos.getY() + 0.375 + (rand.nextDouble() - 0.5D) * 0.2D; double d5 = (double)pos.getZ() + ParticleZ_2 + (rand.nextDouble() - 0.5D) * 0.2D; world.addParticle(Reference.REDSTONE_DUST, d3, d4, d5, 0.0D, 0.0D, 0.0D); } } } } Edit: Fixed: I forgot a "(double)" in the division at the top of the setParticlePositions method. So it gave an int, and that was "0" Now you can see it in the code here. Now it works.
  18. push More questions in last post Edit: Now i added this: @SubscribeEvent public static void onParticleFactoryRegistration(ParticleFactoryRegisterEvent event) { Minecraft.getInstance().particles.registerFactory(ParticleTypes.DUST, YellowRedstoneParticle.Factory::new); } To the registries-area in my main-class. Now it shows bright yellow particles on all my redstone-components. There are Redstone-Torches on the comperator and the repeater. But in the vanilla-blocks, they don´t glow a bright, as the single redstone-torch. So i decided to fit their look exactly to the single one. Now i make particles appear on theese torches, just like the single redstone torches do. And if minimum one torch on theese components is on, i made them emmit light, just like the single one does, too. This is how my comperators look now. (in the middle a single Redstone.-Torch as reference) I like this new look.
  19. I could not extend RedstoneParticle because it´s constructor is pivate. So i copyed it´s whoole code and extend SpriteTexturedParticle, like the vanilla one does. I made my constructor public, removed the random values from the color-calculations and changed the variant of getRenderType How do i now override the vanilla RedstoneParticle with my variant? Do i need to use registerFactory from ParticleManager ? Do i need to create my own version of RedstoneParticleData to access my particle at the Bottom of that code and register it umder the original vanilla registryname?
  20. Hello Is there any way to display particles without any shading? To make them "glow" in exact the choosen color?
  21. Now i created a collision-shape (applyed in getCollisionShape), that i slightly inside the block at the sides and botom. Now the thing with the collision works. Arrows at vertical side and from below work correctly, too. but the arrows, sticking in the side or bottom of the block, turn black, if the block switches off. And i cannot more place objects like torches and redstone wire at the block. It seems like it has not more all required properties of a solid block now. How can i keep it as a solid block and have onEntityCollision work? And i still wonder why leftclick with a sword and arrows, wich hit the top of the block, do not activate it.
  22. About the cactus, do you mean, that the getShape and the getCollisionShape are slightly different cuboidshape values?
  • Create New...

Important Information

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