Fully facing class added, data gen for fully facing added, Atomic textures fixed

This commit is contained in:
Michael Hillcox 2020-11-21 20:33:13 +00:00
parent 5fba4e9710
commit 915bec64c7
No known key found for this signature in database
GPG key ID: 971C5B254742488F
8 changed files with 99 additions and 23 deletions

View file

@ -1,5 +1,5 @@
308eb79ef3014c4cf1cc0453e827f43e0a9bcf5f assets/actuallyadditions/blockstates/advanced_item_laser_relay_block.json 308eb79ef3014c4cf1cc0453e827f43e0a9bcf5f assets/actuallyadditions/blockstates/advanced_item_laser_relay_block.json
a5e93227e5cf3956d4b4753dfca19878e5d3b0a9 assets/actuallyadditions/blockstates/atomic_reconstructor_block.json 0bc1a2d02d57a6b8ca85b8d3d286eafc727088e1 assets/actuallyadditions/blockstates/atomic_reconstructor_block.json
6cc10cd01255886d05b71b898b05faa76e2ccc8a assets/actuallyadditions/blockstates/battery_box_block.json 6cc10cd01255886d05b71b898b05faa76e2ccc8a assets/actuallyadditions/blockstates/battery_box_block.json
b25315def4a9ff486d8a564449764cfb76b00d78 assets/actuallyadditions/blockstates/bio_reactor_block.json b25315def4a9ff486d8a564449764cfb76b00d78 assets/actuallyadditions/blockstates/bio_reactor_block.json
eefccdcc7bb6e2e26af2195d266691148bb2c25b assets/actuallyadditions/blockstates/black_chiseled_quartz_slab_block.json eefccdcc7bb6e2e26af2195d266691148bb2c25b assets/actuallyadditions/blockstates/black_chiseled_quartz_slab_block.json
@ -124,7 +124,7 @@ e2c81adfe240117fa0ce2e3dfcfd04f4e1034153 assets/actuallyadditions/blockstates/wh
207adf3d139369e983100a6002f6f77d36d40916 assets/actuallyadditions/blockstates/xp_solidifier_block.json 207adf3d139369e983100a6002f6f77d36d40916 assets/actuallyadditions/blockstates/xp_solidifier_block.json
eebd14886a3c1958765f54a3b7a19d0e28813c5a assets/actuallyadditions/lang/en_us.json eebd14886a3c1958765f54a3b7a19d0e28813c5a assets/actuallyadditions/lang/en_us.json
8ce3f2af3288773fb581a3668c2cb90b64c9ee2f assets/actuallyadditions/models/block/advanced_item_laser_relay_block.json 8ce3f2af3288773fb581a3668c2cb90b64c9ee2f assets/actuallyadditions/models/block/advanced_item_laser_relay_block.json
cc4fcbe75d6f858567a944e45cdc49711ad4c2cc assets/actuallyadditions/models/block/atomic_reconstructor_block.json de74eda6290d47ef2b26961693e537d7b8795a06 assets/actuallyadditions/models/block/atomic_reconstructor_block.json
16a76926a07fc8fa10e4a3949d15ad2ca6920bb8 assets/actuallyadditions/models/block/battery_box_block.json 16a76926a07fc8fa10e4a3949d15ad2ca6920bb8 assets/actuallyadditions/models/block/battery_box_block.json
fb5b5a6492a2f7b43b2e799552814d565492efcc assets/actuallyadditions/models/block/bio_reactor_block.json fb5b5a6492a2f7b43b2e799552814d565492efcc assets/actuallyadditions/models/block/bio_reactor_block.json
3d2254e3badb613b7c58bad482c14097fffd64e0 assets/actuallyadditions/models/block/black_chiseled_quartz_slab_block.json 3d2254e3badb613b7c58bad482c14097fffd64e0 assets/actuallyadditions/models/block/black_chiseled_quartz_slab_block.json

View file

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

View file

@ -1,6 +1,8 @@
{ {
"parent": "minecraft:block/cube_all", "parent": "minecraft:block/orientable",
"textures": { "textures": {
"all": "actuallyadditions:block/atomic_reconstructor_block" "side": "actuallyadditions:block/atomic_reconstructor_block",
"front": "actuallyadditions:block/atomic_reconstructor_block_front",
"top": "actuallyadditions:block/atomic_reconstructor_block_top"
} }
} }

View file

@ -0,0 +1,32 @@
package de.ellpeck.actuallyadditions.common.blocks;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction;
public class FullyDirectionalBlock extends ActuallyBlock {
public static final DirectionProperty FACING = BlockStateProperties.FACING;
public FullyDirectionalBlock(Properties properties) {
super(properties);
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.NORTH));
}
public BlockState getBaseConstructorState() {
return this.stateContainer.getBaseState().with(FACING, Direction.NORTH);
}
public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.getDefaultState().with(FACING, context.getPlacementHorizontalFacing().getOpposite());
}
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
}

View file

@ -1,18 +1,15 @@
package de.ellpeck.actuallyadditions.common.blocks.building; package de.ellpeck.actuallyadditions.common.blocks.building;
import de.ellpeck.actuallyadditions.common.blocks.ActuallyBlock; import de.ellpeck.actuallyadditions.common.blocks.FullyDirectionalBlock;
import de.ellpeck.actuallyadditions.common.blocks.types.Crystals; import de.ellpeck.actuallyadditions.common.blocks.types.Crystals;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.DirectionProperty; import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
public class CrystalClusterBlock extends ActuallyBlock { public class CrystalClusterBlock extends FullyDirectionalBlock {
public static final DirectionProperty FACING = BlockStateProperties.FACING; public static final DirectionProperty FACING = BlockStateProperties.FACING;
public CrystalClusterBlock(Crystals crystal) { public CrystalClusterBlock(Crystals crystal) {
@ -20,16 +17,11 @@ public class CrystalClusterBlock extends ActuallyBlock {
.setLightLevel((e) -> 7) .setLightLevel((e) -> 7)
.sound(SoundType.GLASS) .sound(SoundType.GLASS)
.hardnessAndResistance(0.25f, 1.0f)); .hardnessAndResistance(0.25f, 1.0f));
this.setDefaultState(this.stateContainer.getBaseState().with(FACING, Direction.UP));
} }
public BlockState getStateForPlacement(BlockItemUseContext context) { @Override
return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite()); public BlockState getBaseConstructorState() {
} return this.stateContainer.getBaseState().with(FACING, Direction.UP);
protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
builder.add(FACING);
} }
@Override @Override

View file

@ -1,10 +1,20 @@
package de.ellpeck.actuallyadditions.common.blocks.functional; package de.ellpeck.actuallyadditions.common.blocks.functional;
import de.ellpeck.actuallyadditions.common.blocks.ActuallyBlock; import de.ellpeck.actuallyadditions.common.blocks.FullyDirectionalBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.state.DirectionProperty;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraftforge.common.ToolType;
public class AtomicReconstructorBlock extends FullyDirectionalBlock {
public static final DirectionProperty FACING = BlockStateProperties.FACING;
public class AtomicReconstructorBlock extends ActuallyBlock {
public AtomicReconstructorBlock() { public AtomicReconstructorBlock() {
super(Properties.create(Material.ROCK)); super(Properties.create(Material.ROCK)
.harvestTool(ToolType.PICKAXE)
.harvestLevel(0)
.hardnessAndResistance(10f, 80f)
.sound(SoundType.STONE));
} }
} }

View file

@ -2,7 +2,10 @@ package de.ellpeck.actuallyadditions.data;
import de.ellpeck.actuallyadditions.common.ActuallyAdditions; import de.ellpeck.actuallyadditions.common.ActuallyAdditions;
import de.ellpeck.actuallyadditions.common.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.common.blocks.ActuallyBlocks;
import net.minecraft.block.*; import net.minecraft.block.Block;
import net.minecraft.block.SlabBlock;
import net.minecraft.block.StairsBlock;
import net.minecraft.block.WallBlock;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -19,6 +22,8 @@ public class GeneratorBlockStates extends BlockStateProvider {
@Override @Override
protected void registerStatesAndModels() { protected void registerStatesAndModels() {
fullyDirectionalBlock(ActuallyBlocks.ATOMIC_RECONSTRUCTOR);
buildCubeAll(ActuallyBlocks.CRYSTAL_CLUSTER_RESTONIA); buildCubeAll(ActuallyBlocks.CRYSTAL_CLUSTER_RESTONIA);
buildCubeAll(ActuallyBlocks.CRYSTAL_CLUSTER_PALIS); buildCubeAll(ActuallyBlocks.CRYSTAL_CLUSTER_PALIS);
buildCubeAll(ActuallyBlocks.CRYSTAL_CLUSTER_DIAMATINE); buildCubeAll(ActuallyBlocks.CRYSTAL_CLUSTER_DIAMATINE);
@ -37,7 +42,6 @@ public class GeneratorBlockStates extends BlockStateProvider {
buildCubeAll(ActuallyBlocks.ITEM_INTERFACE); buildCubeAll(ActuallyBlocks.ITEM_INTERFACE);
buildCubeAll(ActuallyBlocks.FIREWORK_BOX); buildCubeAll(ActuallyBlocks.FIREWORK_BOX);
buildCubeAll(ActuallyBlocks.MINER); buildCubeAll(ActuallyBlocks.MINER);
buildCubeAll(ActuallyBlocks.ATOMIC_RECONSTRUCTOR);
buildCubeAll(ActuallyBlocks.CRYSTAL_RESTONIA); buildCubeAll(ActuallyBlocks.CRYSTAL_RESTONIA);
buildCubeAll(ActuallyBlocks.CRYSTAL_PALIS); buildCubeAll(ActuallyBlocks.CRYSTAL_PALIS);
buildCubeAll(ActuallyBlocks.CRYSTAL_DIAMATINE); buildCubeAll(ActuallyBlocks.CRYSTAL_DIAMATINE);
@ -160,4 +164,17 @@ public class GeneratorBlockStates extends BlockStateProvider {
.partialState().with(BlockStateProperties.LIT, true) .partialState().with(BlockStateProperties.LIT, true)
.addModels(ConfiguredModel.builder().modelFile(models().cubeAll(name.toString(), modLoc("block/" + name.getPath().replace("_block", "_on_block")))).build()); .addModels(ConfiguredModel.builder().modelFile(models().cubeAll(name.toString(), modLoc("block/" + name.getPath().replace("_block", "_on_block")))).build());
} }
private void fullyDirectionalBlock(Supplier<Block> block) {
ResourceLocation name = block.get().getRegistryName();
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()))
));
}
} }