-
Posts
727 -
Joined
-
Last visited
Everything posted by Drachenbauer
-
Hello I want to add more blockstates and models to a button (for redstone) out of glazed terracotta. Now i want to add a key control to change the model between ones with the same shape-orientation and and different texture-rotations, to match all possible rotations of the glazed terracotta-block. I think, i van add a custom blockstate and expand the json files. i also know the line for changing the blockstate for another model. But how do i code a key-control for the block? It should do the stuff above, if i aim at it and press a given key on the peyboard (for sample "R" for rotation)
-
How can i make the player handle more blockstates?
Drachenbauer replied to Drachenbauer's topic in Modder Support
bump I still need help here Edit: maybe for the stairs i can make the texture rotation react on rightclick on the placed block. But how do i code this in the class for this block? And for the button: How can i make the targeted button block react to pressing a key on the keybord? Maybe using a letter, that is not already used in the actual game controls to switch between the models with the different rotated textures. -
[solved] Can i replace textures in a blockstate-json-file?
Drachenbauer replied to Drachenbauer's topic in Modder Support
So i have to put copies of theese model jsons into my mod, switch the textures there and apply them to the blockstates json for theese stairs? -
[solved] Can i replace textures in a blockstate-json-file?
Drachenbauer replied to Drachenbauer's topic in Modder Support
But i still don´t know, how to switch textures without creating a new model file? I want to use the existing sandstone stairs model, rotate it 180° for upside down and switch textures for top and bottom. for older versions, a forge blockstate json made it possible. But is it now possible witth the normal blockstate format, too? -
[solved] Can i replace textures in a blockstate-json-file?
Drachenbauer replied to Drachenbauer's topic in Modder Support
i mean in the forge read the docs thing, about an hour abo i got an error, if i thyed to open the blockstates page, but now surprisingly it works. -
[solved] Can i replace textures in a blockstate-json-file?
Drachenbauer replied to Drachenbauer's topic in Modder Support
Now i can open the page for vanilla blockstates. A while ago, it made an error. But there is nothing about changing textures. -
[solved] Can i replace textures in a blockstate-json-file?
Drachenbauer replied to Drachenbauer's topic in Modder Support
In the matching link in your page comes a page not found error. It seems like the blocstate.json-chapters in your linked site are not added yet. There are two links, but they end in errors. And i thaught, my link is the one about a previous version. -
Hello At testing around with stairs-blocks, i noticed, the sandstone-stairs (red and baige) have turned their different textures with them, if used upside down. the rough sandstone_bottom textures are now on top of the block and the smooth sandstone_top thextures are now at the bottom. Is there any way to switch theese textures in the blockstates-json, without creating extra upside down models? I found this forge blockstates page: Forge blockstates json But i´m not sure, if this also works in 1.15.2.
-
In my mods i work on increasing the number of different slabs, stairs, walls, buttons and pressureplates to match all solid 16 colors materials (concrete, wool, terracotta and glazed terracotta = 64 different textures) and most of the different stone-types (about 24 different textures). Now i have a question about stairs and buttons out of glazed terracotta (to reproduce the textures-behavior of the glazed terracotta blocks): They already use horizontal facing for their model-rotation. Maybe i can add a seccond similar blockstate (may named "texture_facing") and all needed model jsons and a blockstate-json, that provides all possible combinations of the two blockstate-sets. How can i make it possible to handle all theese states ingame at placing the block?
-
Hello I´m creating custom pressure plates from alot of stone-Types. One set is made out of the 16 glzed terracottas. Now i want to have them rotateable to fit with the different rotations of this block. But they are stuck in pressed state. My PressurePlateBlock-class: I needed to create it, because the constructor of the existing one is protected, so i cannot instantiate it for my custom pressureplates. And here is the class for the rotateable ones: What must i change here to make it work right? Edit: i had to put the facing and the powered state (set to false) into the setDefaultState-line in the consturctor ff the modifyed-class, not only the facing. After i rompved and replaced theese presureplates in my test-world, now they work correct.
-
I found a solution, bevore i saw your answer: I made my own wall-block, that extends the vanilla one and added theese functions: private boolean isWall(BlockState state, BlockState facingState, boolean isSolid, Direction direction) { Block block = state.getBlock(); Block facingBlock = facingState.getBlock(); boolean flag = (block.isIn(BlockTags.WALLS) && (block == facingBlock)) || (facingBlock instanceof FenceGateBlock && FenceGateBlock.isParallel(state, direction)); return !cannotAttach(block) && isSolid || flag; } @Override public BlockState getStateForPlacement(BlockItemUseContext context) { IWorldReader iworldreader = context.getWorld(); BlockPos blockpos = context.getPos(); BlockState blockstate = iworldreader.getBlockState(blockpos); IFluidState ifluidstate = context.getWorld().getFluidState(blockpos); BlockPos blockpos1 = blockpos.north(); BlockPos blockpos2 = blockpos.east(); BlockPos blockpos3 = blockpos.south(); BlockPos blockpos4 = blockpos.west(); BlockState blockstate1 = iworldreader.getBlockState(blockpos1); BlockState blockstate2 = iworldreader.getBlockState(blockpos2); BlockState blockstate3 = iworldreader.getBlockState(blockpos3); BlockState blockstate4 = iworldreader.getBlockState(blockpos4); boolean flag1 = this.isWall(blockstate, blockstate1, blockstate1.isSolidSide(iworldreader, blockpos1, Direction.SOUTH), Direction.SOUTH); boolean flag2 = this.isWall(blockstate, blockstate2, blockstate2.isSolidSide(iworldreader, blockpos2, Direction.WEST), Direction.WEST); boolean flag3 = this.isWall(blockstate, blockstate3, blockstate3.isSolidSide(iworldreader, blockpos3, Direction.NORTH), Direction.NORTH); boolean flag4 = this.isWall(blockstate, blockstate4, blockstate4.isSolidSide(iworldreader, blockpos4, Direction.EAST), Direction.EAST); boolean flag5 = (!flag1 || flag2 || !flag3 || flag4) && (flag1 || !flag2 || flag3 || !flag4); return this.getDefaultState().with(UP, Boolean.valueOf(flag5 || !iworldreader.isAirBlock(blockpos.up()))).with(NORTH, Boolean.valueOf(flag1)).with(EAST, Boolean.valueOf(flag2)).with(SOUTH, Boolean.valueOf(flag3)).with(WEST, Boolean.valueOf(flag4)).with(WATERLOGGED, Boolean.valueOf(ifluidstate.getFluid() == Fluids.WATER)); } @Override public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld world, BlockPos currentPos, BlockPos facingPos) { if (state.get(WATERLOGGED)) { world.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(world)); } if (facing == Direction.DOWN) { return super.updatePostPlacement(state, facing, facingState, world, currentPos, facingPos); } else { Direction direction = facing.getOpposite(); boolean flag1 = facing == Direction.NORTH ? this.isWall(state, facingState, facingState.isSolidSide(world, facingPos, direction), direction) : state.get(NORTH); boolean flag2 = facing == Direction.EAST ? this.isWall(state, facingState, facingState.isSolidSide(world, facingPos, direction), direction) : state.get(EAST); boolean flag3 = facing == Direction.SOUTH ? this.isWall(state, facingState, facingState.isSolidSide(world, facingPos, direction), direction) : state.get(SOUTH); boolean flag4 = facing == Direction.WEST ? this.isWall(state, facingState, facingState.isSolidSide(world, facingPos, direction), direction) : state.get(WEST); boolean flag5 = (!flag1 || flag2 || !flag3 || flag4) && (flag1 || !flag2 || flag3 || !flag4); return state.with(UP, Boolean.valueOf(flag5 || !world.isAirBlock(currentPos.up()))).with(NORTH, Boolean.valueOf(flag1)).with(EAST, Boolean.valueOf(flag2)).with(SOUTH, Boolean.valueOf(flag3)).with(WEST, Boolean.valueOf(flag4)); } } the first one bases on a function, that still has the SRC-name in the vanilla-class. It checfs for blocks in the walls-tag and fencegates. i made it compare the type of wall, too and renamed it more clear. so i also copyed and overrided the two functions, wich call it, too, and modifyed them to use my new function.
-
Hello I created some walls out of the colorful materials concrete, wool, terracotta and glazed terracotta. They now connect to all other wall-blocks, no matter, wich typr they are. How can i make them only connect to identical wall-pieces (for sample yellow concrete only to another yellow concrete wall) and solid blocks?
-
Hello I´m creating a slab out of glazed terracotta and want to make it show the following placing-behavior: it should show a horizontal rotated model matching to the player´s view-direction, combined with the common way to choose up or down or double-slab-variant. My blockstate-json is ready (It holds all possible combinations of direction and slab-type = 12 variants). But i have a problem with the new class, that extends SlabBlock. How must i setup the getStateForPlacement function for this? Edit: I founfd the solution: At fitst i applied the horizontal rotation, as i did it as the only blockstate in another mod. Now i found out, that i hat to copx the content of getStateForPlacement and added the rotation to the two blockstate-defiition-lines in there. Now it works. But now i have a question about stairs out of glazed terracotta: Is there any way for the player to choose model-rotation and texture rotation separate? It maybe able to add more model jsons to cover all combinations of shape and texture-rotation (24 models instead of 3) and apply them all to different blockstate-combinations in the blockstate-json. But i´m not sure, how the player can handle all theese variants ingame... Ani idea?
-
You don´t have to create your own StairsBlockClass. in 1.15.2 this works fine for a StairsBlock out of the vanilla yellow_concrete: public static final RegistryObject<Block> YELLOW_CONCRETE_STAIRS = BLOCKS.register("yellow_concrete_stairs", () -> new StairsBlock(YELLOW_CONCRETE, Block.Properties.create( Material.ROCK, MaterialColor.YELLOW).sound(SoundType.STONE).lightValue(0).hardnessAndResistance(1.8F))); It uses a seccond constructor in the vanilla StairsBlock-class, that wants a blockstate in a supplier as the first content.. So i created suppliers, wich contain the blockstates of the different vanilla concrete blocks. I only create a custom SlabBlock-class (that extends the vanilla one) for my glazed terracotta slabs to make them rotatable north, east, south and west (for texture-patterns). Maybe this is helpful for 1.14 too. edit: i noticed, the seccond constructor there is new in 1.15.
-
Hello i have seen a mod, that has a block, that rotates the gravitx direction towards it. It´s called a "gravity-core-block" If the player is near it´s side, the player-model rotates horizontal with the feet to the block and if not creative-mode-flying, the payer is pulled to the block by a gravity effect. If under the block, the same effect appears upside doen. Maybe the same happens with entities. How can i code this effect? An how can i make an option, that changes the strength of gravity (reduced gravity = jumping higher and falling slower, negative gravity = hovering up and hanging under the ceiling like a helium filled balloon)?
-
Where are the basic color values coded?
Drachenbauer replied to Drachenbauer's topic in Modder Support
Now i noticed, there seems to be a slightly different shader, if the color comes from a texture pnr or from a colorvalue-number in the code: The leather-armour is dyed with the new shade of pink, i gave with my mod-code. And in my skin png (Stella from Angry Birds) i used the same color value for the pink color. So i wonder, why it looks different on almost horizontal surfaces (like the character´s face, if looking upward, like in the upper picture or the top of the body-ModelBox) in this more vertical orientation, you can see, that the lighter pink in the middie of th helmet-front is exctly the same as at the face of the character. And directly below the head, you can see the different shading between body and armour again another sample: bed and banner In this bed-texture png i also used the same shade of pink and the banner get´s it´s color from my mod-code. both models are TileEntity models The same difference at the horizontal surfaces (the narrow top of the banner looks closer to white, than the top of the bed). Why it makes a difference there, if the color comes from the texture or from a value in the code? -
Where are the basic color values coded?
Drachenbauer replied to Drachenbauer's topic in Modder Support
Now i finally found the solution: i remembered, that there is a calculation for colorComponentValues. i placed it in a function in my main-class and passed the result of this function into another reflection-line for each color, that uses the field colorComponentValues. now the game-stuff appears in the new colors. -
Where are the basic color values coded?
Drachenbauer replied to Drachenbauer's topic in Modder Support
i decided to watch a video, how to use the debugger, than try this, and than tell more here. Like the guy in the video, i made a breakpoint at the first one of theese lines and clicked the debug-button, but it does not stop there. in other mods, other code, located in common-setup and client-registries is executed. So i´m wondering about this. -
Where are the basic color values coded?
Drachenbauer replied to Drachenbauer's topic in Modder Support
I see no exeptions in the console. -
Where are the basic color values coded?
Drachenbauer replied to Drachenbauer's topic in Modder Support
I made a test, but the banners, sheeps and other stuff still appear in old colors. I tried the code in common-setup and client-registries in my main-class, both the same. Now my lines look like this: ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.RED, 0xff0000, "field_193351_w"); //colorvalue ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.RED, 0xff0000, "field_196067_y"); //fireworkColor ObfuscationReflectionHelper.setPrivateValue(DyeColor.class, DyeColor.RED, 0xff0000, "field_218390_z"); //textColor Such a stack for each color. And for the material-color, i found out, that the colors there are such class-instances, zoo. So i was able to make this: ObfuscationReflectionHelper.setPrivateValue(MaterialColor.class, MaterialColor.RED, 0xff0000, "field_76291_p");//colorvalue also for all theese 16 colors and terracotta-colors. (there are some more values, but i don´t want to change them.) What do i miss, to get this stuff to work? -
Where are the basic color values coded?
Drachenbauer replied to Drachenbauer's topic in Modder Support
Now i have theese lines for all 15 colors. Is this all i need to show all this stuff in the new colors? Now i found the class MaterialColors, where i als want to change fields now. What must i put there as the class-instance? Edit: The colors of banners and stuff are not changed now. What else must i do, to make it work? -
Where are the basic color values coded?
Drachenbauer replied to Drachenbauer's topic in Modder Support
In my lines there i use the clear names DyeColor and WHITE. I taught, maybe i have to use the SRG-Names for theese things, too, in the positions for class and instance in the code-line... But maybe not, because it don´t want theese names as a string, like the fieldname. Another thing, yout discord-link stucks on connecting (a black page with a rotating discord-logo)...