fix item models

This commit is contained in:
Sen 2025-06-30 13:50:23 +02:00
parent b2d3f5a641
commit f4b83b8e01
Signed by: sen
GPG key ID: 3AC50A6F47D1B722
7 changed files with 86 additions and 71 deletions

View file

@ -193,7 +193,7 @@ public abstract class ModelBakery
else
{
bakedRegistry.put(entry, bakeModel(sprites, faceBakery, textureMap.getMissingSprite(),
modelblock1, ModelRotation.X0_Y0, false));
modelblock1, modelblock1.getRotation(), modelblock1.isUvLocked()));
}
}
else

View file

@ -149,8 +149,8 @@ public class ModelBlock extends Model {
this.primary = primary == null ? TextureMap.MISSING : primary;
this.parent = parent;
this.transform = transform;
this.uvLock = false;
this.rotation = ModelRotation.X0_Y0;
this.uvLock = parent != null && parent.isUvLocked();
this.rotation = parent != null ? parent.getRotation() : ModelRotation.X0_Y0;
this.layers = layers;
}

View file

@ -45,6 +45,9 @@ public class BlockSlab extends Block implements Directional {
this.setLightOpacity(255);
this.base = base;
this.baseState = base.getState();
this.setHardness(this.base.getRawHardness());
this.setResistance(this.base.getRawResistance() / 3.0F);
this.setStepSound(this.base.sound);
this.textureTop = top;
this.textureBottom = bottom;
SLABS.add(this);

View file

@ -38,29 +38,29 @@ public class BlockStairs extends Block implements Rotatable
public static final PropertyEnum<BlockStairs.EnumHalf> HALF = PropertyEnum.<BlockStairs.EnumHalf>create("half", BlockStairs.EnumHalf.class);
public static final PropertyEnum<BlockStairs.EnumShape> SHAPE = PropertyEnum.<BlockStairs.EnumShape>create("shape", BlockStairs.EnumShape.class);
private static final int[][] field_150150_a = new int[][] {{4, 5}, {5, 7}, {6, 7}, {4, 6}, {0, 1}, {1, 3}, {2, 3}, {0, 2}};
private final Block modelBlock;
private final State modelState;
private final Block base;
private final State baseState;
private final String downTex;
private final String upTex;
private boolean hasRaytraced;
private int rayTracePass;
public BlockStairs(State modelState)
public BlockStairs(Block base)
{
this(modelState, null, null);
this(base, null, null);
}
public BlockStairs(State modelState, String down, String up)
public BlockStairs(Block base, String down, String up)
{
super(modelState.getBlock().getMaterial());
super(base.getMaterial());
this.setDefaultState(this.getBaseState().withProperty(FACING, Facing.NORTH).withProperty(HALF, BlockStairs.EnumHalf.BOTTOM).withProperty(SHAPE, BlockStairs.EnumShape.STRAIGHT));
this.modelBlock = modelState.getBlock();
this.modelState = modelState;
this.setHardness(this.modelBlock.getRawHardness());
this.setResistance(this.modelBlock.getRawResistance() / 3.0F);
this.setStepSound(this.modelBlock.sound);
this.base = base;
this.baseState = base.getState();
this.setHardness(this.base.getRawHardness());
this.setResistance(this.base.getRawResistance() / 3.0F);
this.setStepSound(this.base.sound);
this.setLightOpacity(255);
this.setTab(modelState.getBlock().getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.BLOCKS);
this.setTab(base.getMaterial() == Material.WOOD ? CheatTab.WOOD : CheatTab.BLOCKS);
this.downTex = down;
this.upTex = up;
}
@ -563,12 +563,12 @@ public class BlockStairs extends Block implements Rotatable
public void randomDisplayTick(AWorldClient worldIn, BlockPos pos, State state, Random rand)
{
this.modelBlock.randomDisplayTick(worldIn, pos, state, rand);
this.base.randomDisplayTick(worldIn, pos, state, rand);
}
public void onBlockClicked(World worldIn, BlockPos pos, EntityNPC playerIn)
{
this.modelBlock.onBlockClicked(worldIn, pos, playerIn);
this.base.onBlockClicked(worldIn, pos, playerIn);
}
/**
@ -576,12 +576,12 @@ public class BlockStairs extends Block implements Rotatable
*/
public void onBlockDestroyedByPlayer(World worldIn, BlockPos pos, State state)
{
this.modelBlock.onBlockDestroyedByPlayer(worldIn, pos, state);
this.base.onBlockDestroyedByPlayer(worldIn, pos, state);
}
public int getMixedBrightnessForBlock(IWorldAccess worldIn, BlockPos pos)
{
return this.modelBlock.getMixedBrightnessForBlock(worldIn, pos);
return this.base.getMixedBrightnessForBlock(worldIn, pos);
}
/**
@ -589,12 +589,12 @@ public class BlockStairs extends Block implements Rotatable
*/
public float getExplosionResistance(Entity exploder)
{
return this.modelBlock.getExplosionResistance(exploder);
return this.base.getExplosionResistance(exploder);
}
public BlockLayer getBlockLayer()
{
return this.modelBlock.getBlockLayer();
return this.base.getBlockLayer();
}
/**
@ -602,17 +602,17 @@ public class BlockStairs extends Block implements Rotatable
*/
public int tickRate(World worldIn, BlockPos pos)
{
return this.modelBlock.tickRate(worldIn, pos);
return this.base.tickRate(worldIn, pos);
}
public BoundingBox getSelectedBoundingBox(World worldIn, BlockPos pos)
{
return this.modelBlock.getSelectedBoundingBox(worldIn, pos);
return this.base.getSelectedBoundingBox(worldIn, pos);
}
public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion)
{
return this.modelBlock.modifyAcceleration(worldIn, pos, entityIn, motion);
return this.base.modifyAcceleration(worldIn, pos, entityIn, motion);
}
/**
@ -620,28 +620,28 @@ public class BlockStairs extends Block implements Rotatable
*/
public boolean isCollidable()
{
return this.modelBlock.isCollidable();
return this.base.isCollidable();
}
public boolean canCollideCheck(State state, boolean liquid)
{
return this.modelBlock.canCollideCheck(state, liquid);
return this.base.canCollideCheck(state, liquid);
}
public boolean canPlaceBlockAt(World worldIn, BlockPos pos)
{
return this.modelBlock.canPlaceBlockAt(worldIn, pos);
return this.base.canPlaceBlockAt(worldIn, pos);
}
public void onBlockAdded(AWorldServer worldIn, BlockPos pos, State state)
{
this.onNeighborBlockChange(worldIn, pos, this.modelState, Blocks.air);
this.modelBlock.onBlockAdded(worldIn, pos, this.modelState);
this.onNeighborBlockChange(worldIn, pos, this.baseState, Blocks.air);
this.base.onBlockAdded(worldIn, pos, this.baseState);
}
public void onBlockRemoved(AWorldServer worldIn, BlockPos pos, State state)
{
this.modelBlock.onBlockRemoved(worldIn, pos, this.modelState);
this.base.onBlockRemoved(worldIn, pos, this.baseState);
}
/**
@ -649,17 +649,17 @@ public class BlockStairs extends Block implements Rotatable
*/
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, Entity entityIn)
{
this.modelBlock.onEntityCollidedWithBlock(worldIn, pos, entityIn);
this.base.onEntityCollidedWithBlock(worldIn, pos, entityIn);
}
public void updateTick(AWorldServer worldIn, BlockPos pos, State state, Random rand)
{
this.modelBlock.updateTick(worldIn, pos, state, rand);
this.base.updateTick(worldIn, pos, state, rand);
}
public boolean onBlockActivated(World worldIn, BlockPos pos, State state, EntityNPC playerIn, Facing side, float hitX, float hitY, float hitZ)
{
return this.modelBlock.onBlockActivated(worldIn, pos, this.modelState, playerIn, Facing.DOWN, 0.0F, 0.0F, 0.0F);
return this.base.onBlockActivated(worldIn, pos, this.baseState, playerIn, Facing.DOWN, 0.0F, 0.0F, 0.0F);
}
/**
@ -667,7 +667,7 @@ public class BlockStairs extends Block implements Rotatable
*/
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn, State prevState)
{
this.modelBlock.onBlockDestroyedByExplosion(worldIn, pos, explosionIn, prevState);
this.base.onBlockDestroyedByExplosion(worldIn, pos, explosionIn, prevState);
}
// /**
@ -788,7 +788,7 @@ public class BlockStairs extends Block implements Rotatable
}
public Model getModel(ModelProvider provider, String name, State state) {
String primary = this.modelBlock.getModel(provider, BlockRegistry.getName(this.modelBlock), this.modelState).getPrimary();
String primary = this.base.getModel(provider, BlockRegistry.getName(this.base), this.baseState).getPrimary();
return provider.getModel(primary)
.stairs(state.getValue(HALF) == EnumHalf.TOP, state.getValue(SHAPE) == EnumShape.INNER_RIGHT ||
state.getValue(SHAPE) == EnumShape.INNER_LEFT, state.getValue(SHAPE) == EnumShape.OUTER_RIGHT ||

View file

@ -495,19 +495,16 @@ public abstract class BlockRegistry {
register("stone_slab", (new BlockSlab(stone))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinstufe"));
register("stone_stairs", (new BlockStairs(stone.getState())).setDisplay("Steintreppe"));
register("stone_slab", (new BlockSlab(stone)).setDisplay("Steinstufe"));
register("stone_stairs", (new BlockStairs(stone)).setDisplay("Steintreppe"));
register("cobblestone_slab", (new BlockSlab(cobblestone))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Bruchsteinstufe"));
register("cobblestone_stairs", (new BlockStairs(cobblestone.getState())).setDisplay("Bruchsteintreppe"));
register("cobblestone_slab", (new BlockSlab(cobblestone)).setDisplay("Bruchsteinstufe"));
register("cobblestone_stairs", (new BlockStairs(cobblestone)).setDisplay("Bruchsteintreppe"));
register("cobblestone_wall", (new BlockWall(cobblestone, "cobblestone")).setDisplay("Bruchsteinmauer"));
register("mossy_cobblestone_wall", (new BlockWall(mossyCobblestone, "mossy_cobblestone")).setDisplay("Bemooste Bruchsteinmauer"));
register("sandstone_slab", (new BlockSlab(sandstone, "sandstone_bottom", "sandstone_all"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Sandsteinstufe"));
register("sandstone_stairs", (new BlockStairs(sandstone.getState(),
register("sandstone_slab", (new BlockSlab(sandstone, "sandstone_bottom", "sandstone_all")).setDisplay("Sandsteinstufe"));
register("sandstone_stairs", (new BlockStairs(sandstone,
"sandstone_bottom", "sandstone_all")) // fix type
.setDisplay("Sandsteintreppe"));
@ -515,9 +512,8 @@ public abstract class BlockRegistry {
register("quartz_block", quartz);
register("quartz_ornaments", (new BlockQuartz(false, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Gemeißelter Quarzblock"));
register("quartz_pillar", (new BlockQuartzPillar(false)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Quarzsäule"));
register("quartz_slab", (new BlockSlab(quartz, "quartz_block_bottom", "quartz_top"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Quarzstufe"));
register("quartz_stairs", (new BlockStairs(quartz.getState(),
register("quartz_slab", (new BlockSlab(quartz, "quartz_block_bottom", "quartz_top")).setDisplay("Quarzstufe"));
register("quartz_stairs", (new BlockStairs(quartz,
"quartz_block_bottom", "quartz_top"))
.setDisplay("Quarztreppe"));
@ -528,9 +524,8 @@ public abstract class BlockRegistry {
Block brick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Ziegelsteine").setTab(CheatTab.BLOCKS);
register("brick_block", brick);
register("brick_slab", (new BlockSlab(brick))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Ziegelstufe"));
register("brick_stairs", (new BlockStairs(brick.getState())).setDisplay("Ziegeltreppe"));
register("brick_slab", (new BlockSlab(brick)).setDisplay("Ziegelstufe"));
register("brick_stairs", (new BlockStairs(brick)).setDisplay("Ziegeltreppe"));
Block stonebrick = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Steinziegel").setTab(CheatTab.BLOCKS);
@ -541,28 +536,25 @@ public abstract class BlockRegistry {
.setDisplay("Rissige Steinziegel").setTab(CheatTab.BLOCKS));
register("carved_stonebrick", (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Gemeißelte Steinziegel").setTab(CheatTab.BLOCKS));
register("stonebrick_slab", (new BlockSlab(stonebrick))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Steinziegelstufe"));
register("stonebrick_stairs", (new BlockStairs(stonebrick.getState()))
register("stonebrick_slab", (new BlockSlab(stonebrick)).setDisplay("Steinziegelstufe"));
register("stonebrick_stairs", (new BlockStairs(stonebrick))
.setDisplay("Steinziegeltreppe"));
Block bloodBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Blutrote Ziegel").setTab(CheatTab.BLOCKS);
register("blood_brick", bloodBrick);
register("blood_brick_slab", (new BlockSlab(bloodBrick))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Blutrote Ziegelstufe"));
register("blood_brick_slab", (new BlockSlab(bloodBrick)).setDisplay("Blutrote Ziegelstufe"));
register("blood_brick_fence", (new BlockFence(Material.SOLID, "blood_brick")).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Blutroter Ziegelzaun"));
register("blood_brick_stairs", (new BlockStairs(bloodBrick.getState())).setDisplay("Blutrote Ziegeltreppe"));
register("blood_brick_stairs", (new BlockStairs(bloodBrick)).setDisplay("Blutrote Ziegeltreppe"));
Block blackBrick = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE)
.setDisplay("Schwarze Ziegel").setTab(CheatTab.BLOCKS);
register("black_brick", blackBrick);
register("black_brick_slab", (new BlockSlab(blackBrick))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarze Ziegelstufe"));
register("black_brick_stairs", (new BlockStairs(blackBrick.getState())).setDisplay("Schwarze Ziegeltreppe"));
register("black_brick_slab", (new BlockSlab(blackBrick)).setDisplay("Schwarze Ziegelstufe"));
register("black_brick_stairs", (new BlockStairs(blackBrick)).setDisplay("Schwarze Ziegeltreppe"));
register("black_brick_fence", (new BlockFence(Material.SOLID, "black_brick")).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay("Schwarzer Ziegelzaun"));
@ -570,21 +562,22 @@ public abstract class BlockRegistry {
register("black_quartz_block", bquartz);
register("black_quartz_ornaments", (new BlockQuartz(true, true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarzer gemeißelter Quarzblock"));
register("black_quartz_pillar", (new BlockQuartzPillar(true)).setStepSound(SoundType.STONE).setHardness(0.8F).setDisplay("Schwarze Quarzsäule"));
register("black_quartz_slab", (new BlockSlab(bquartz, "black_quartz_block_bottom", "black_quartz_top"))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Schwarze Quarzstufe"));
register("black_quartz_stairs", (new BlockStairs(bquartz.getState(),
register("black_quartz_slab", (new BlockSlab(bquartz, "black_quartz_block_bottom", "black_quartz_top")).setDisplay("Schwarze Quarzstufe"));
register("black_quartz_stairs", (new BlockStairs(bquartz,
"black_quartz_block_bottom", "black_quartz_top"))
.setDisplay("Schwarze Quarztreppe"));
Block concrete = (new Block(Material.SOLID)).setHardness(1.5F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Beton").setTab(CheatTab.BLOCKS);
Block concrete = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Beton").setTab(CheatTab.BLOCKS);
register("concrete", concrete);
register("concrete_slab", (new BlockSlab(concrete))
.setHardness(2.0F).setResistance(10.0F).setStepSound(SoundType.STONE).setDisplay("Betonstufe"));
register("concrete_stairs", (new BlockStairs(concrete.getState())).setDisplay("Betontreppe"));
register("concrete_slab", (new BlockSlab(concrete)).setDisplay("Betonstufe"));
register("concrete_stairs", (new BlockStairs(concrete)).setDisplay("Betontreppe"));
for(DecoType deco : DecoType.values()) {
register(deco.name, (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay(deco.display).setTab(CheatTab.BLOCKS));
Block block = (new Block(Material.SOLID)).setHardness(2.0F).setResistance(10.0F)
.setStepSound(SoundType.STONE).setDisplay(deco.display).setTab(CheatTab.BLOCKS);
register(deco.name, block);
register(deco.name + "_slab", (new BlockSlab(block)).setDisplay(deco.display + " - Stufe"));
register(deco.name + "_stairs", (new BlockStairs(block)).setDisplay(deco.display + " - Treppe"));
}
@ -595,10 +588,9 @@ public abstract class BlockRegistry {
Block planks = (new Block(Material.WOOD)).setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD)
.setDisplay(wood.getDisplay() + "holzbretter").setTab(CheatTab.WOOD).setFlammable(5, 20);
register(wood.getName() + "_planks", planks);
register(wood.getName() + "_stairs", (new BlockStairs(planks.getState()))
register(wood.getName() + "_stairs", (new BlockStairs(planks))
.setDisplay(wood.getDisplay() + "holztreppe").setFlammable(5, 20));
register(wood.getName() + "_slab", (new BlockSlab(planks))
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzstufe").setFlammable(5, 20));
register(wood.getName() + "_slab", (new BlockSlab(planks)).setDisplay(wood.getDisplay() + "holzstufe").setFlammable(5, 20));
register(wood.getName() + "_fence", (new BlockFence(Material.WOOD, wood.getName() + "_planks"))
.setHardness(2.0F).setResistance(5.0F).setStepSound(SoundType.WOOD).setDisplay(wood.getDisplay() + "holzzaun").setFlammable(5, 20));
register(wood.getName() + "_fence_gate", (new BlockFenceGate(wood)).setHardness(2.0F).setResistance(5.0F)

View file

@ -581,6 +581,16 @@ public abstract class Blocks {
public static final Block concrete = get("concrete");
public static final BlockSlab concrete_slab = get("concrete_slab");
public static final BlockStairs concrete_stairs = get("concrete_stairs");
public static final BlockSlab floor_tiles_black_slab = get("floor_tiles_black_slab");
public static final BlockStairs floor_tiles_black_stairs = get("floor_tiles_black_stairs");
public static final BlockSlab floor_tiles_red_slab = get("floor_tiles_red_slab");
public static final BlockStairs floor_tiles_red_stairs = get("floor_tiles_red_stairs");
public static final BlockSlab floor_tiles_slab = get("floor_tiles_slab");
public static final BlockStairs floor_tiles_stairs = get("floor_tiles_stairs");
public static final BlockSlab floor_tiles_white_slab = get("floor_tiles_white_slab");
public static final BlockStairs floor_tiles_white_stairs = get("floor_tiles_white_stairs");
public static final BlockSlab pentagram_slab = get("pentagram_slab");
public static final BlockStairs pentagram_stairs = get("pentagram_stairs");
private static <T extends Block> T get(String id) {
T block = (T)BlockRegistry.byNameExact(id);

View file

@ -960,6 +960,16 @@ public abstract class Items {
public static final ItemBlock concrete = get("concrete");
public static final ItemSlab concrete_slab = get("concrete_slab");
public static final ItemBlock concrete_stairs = get("concrete_stairs");
public static final ItemSlab floor_tiles_black_slab = get("floor_tiles_black_slab");
public static final ItemBlock floor_tiles_black_stairs = get("floor_tiles_black_stairs");
public static final ItemSlab floor_tiles_red_slab = get("floor_tiles_red_slab");
public static final ItemBlock floor_tiles_red_stairs = get("floor_tiles_red_stairs");
public static final ItemSlab floor_tiles_slab = get("floor_tiles_slab");
public static final ItemBlock floor_tiles_stairs = get("floor_tiles_stairs");
public static final ItemSlab floor_tiles_white_slab = get("floor_tiles_white_slab");
public static final ItemBlock floor_tiles_white_stairs = get("floor_tiles_white_stairs");
public static final ItemSlab pentagram_slab = get("pentagram_slab");
public static final ItemBlock pentagram_stairs = get("pentagram_stairs");
private static <T extends Item> T get(String id) {
T item = (T)ItemRegistry.byName(id);