Night right yet but I want to move on with the items

This commit is contained in:
Michael Hillcox 2020-12-02 15:35:24 +00:00
parent b7735d4a14
commit f66cedc5b2
No known key found for this signature in database
GPG key ID: 971C5B254742488F
4 changed files with 24 additions and 18 deletions

View file

@ -1,5 +1,5 @@
308eb79ef3014c4cf1cc0453e827f43e0a9bcf5f assets/actuallyadditions/blockstates/advanced_item_laser_relay_block.json
0bc1a2d02d57a6b8ca85b8d3d286eafc727088e1 assets/actuallyadditions/blockstates/atomic_reconstructor_block.json
37e925d4aca37833f9f4ef8e863beed31deba62c assets/actuallyadditions/blockstates/atomic_reconstructor_block.json
6cc10cd01255886d05b71b898b05faa76e2ccc8a assets/actuallyadditions/blockstates/battery_box_block.json
b25315def4a9ff486d8a564449764cfb76b00d78 assets/actuallyadditions/blockstates/bio_reactor_block.json
eefccdcc7bb6e2e26af2195d266691148bb2c25b assets/actuallyadditions/blockstates/black_chiseled_quartz_slab_block.json

View file

@ -2,29 +2,26 @@
"variants": {
"facing=down": {
"model": "actuallyadditions:block/atomic_reconstructor_block",
"x": 180
"x": 90
},
"facing=up": {
"model": "actuallyadditions:block/atomic_reconstructor_block"
"model": "actuallyadditions:block/atomic_reconstructor_block",
"x": 270
},
"facing=north": {
"model": "actuallyadditions:block/atomic_reconstructor_block",
"x": 90
"y": 180
},
"facing=south": {
"model": "actuallyadditions:block/atomic_reconstructor_block",
"x": 90,
"y": 180
"model": "actuallyadditions:block/atomic_reconstructor_block"
},
"facing=west": {
"model": "actuallyadditions:block/atomic_reconstructor_block",
"x": 90,
"y": 270
"y": 90
},
"facing=east": {
"model": "actuallyadditions:block/atomic_reconstructor_block",
"x": 90,
"y": 90
"y": 270
}
}
}

View file

@ -22,7 +22,7 @@ public class FullyDirectionalBlock extends ActuallyBlock {
}
public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite());
}
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {

View file

@ -8,6 +8,7 @@ import net.minecraft.block.StairsBlock;
import net.minecraft.block.WallBlock;
import net.minecraft.data.DataGenerator;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.client.model.generators.ConfiguredModel;
@ -162,13 +163,21 @@ public class GeneratorBlockStates extends BlockStateProvider {
private void fullyDirectionalBlock(Supplier<Block> block) {
ResourceLocation name = block.get().getRegistryName();
// Todo: come back and fix this, it's still not right
assert name != null;
directionalBlock(block.get(), models().orientable(
name.toString(),
modLoc(String.format("block/%s", name.getPath())),
modLoc(String.format("block/%s_front", name.getPath())),
modLoc(String.format("block/%s_top", name.getPath()))
));
getVariantBuilder(block.get())
.forAllStates(state -> {
Direction dir = state.get(BlockStateProperties.FACING);
System.out.println(dir);
return ConfiguredModel.builder()
.modelFile(models().withExistingParent(name.toString(), "block/orientable")
.texture("side", modLoc(String.format("block/%s", name.getPath())))
.texture("front", modLoc(String.format("block/%s_front", name.getPath())))
.texture("top", modLoc(String.format("block/%s_top", name.getPath()))))
.rotationX(dir == Direction.DOWN ? 90 : (dir == Direction.UP ? 270 : 0))
.rotationY(dir.getAxis().isVertical() ? 0 : dir.getHorizontalIndex() * 90)
.build();
});
}
}