major progress
This commit is contained in:
parent
7e6af7e71e
commit
bb8486a8eb
|
@ -17,10 +17,11 @@ public class Techia implements ModInitializer {
|
||||||
public void onInitialize(){
|
public void onInitialize(){
|
||||||
TechiaRegistry.register();
|
TechiaRegistry.register();
|
||||||
|
|
||||||
FabricItemGroupBuilder.create(new Identifier(MOD_ID, "items")).icon(() -> TechiaBlocks.LETIUM.asItem().getDefaultStack()).appendItems(stacks -> Registry.ITEM.forEach(item -> {
|
FabricItemGroupBuilder.create(new Identifier(MOD_ID, "items")).icon(() -> TechiaRegistry.LETIUM.getDefaultStack()).appendItems(stacks -> Registry.ITEM.forEach(item -> {
|
||||||
if(Registry.ITEM.getId(item).getNamespace().equals(MOD_ID)){
|
if(Registry.ITEM.getId(item).getNamespace().equals(MOD_ID)){
|
||||||
item.appendStacks(item.getGroup(), (DefaultedList<ItemStack>) stacks);
|
item.appendStacks(item.getGroup(), (DefaultedList<ItemStack>) stacks);
|
||||||
}
|
}
|
||||||
})).build();
|
})).build();
|
||||||
|
ItemGroup LETI = FabricItemGroupBuilder.create(new Identifier(MOD_ID, "leti")).icon(() -> TechiaRegistry.CONNECTOR.asItem().getDefaultStack()).build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ella.techia.block;
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import ella.techia.leti.LetiNetwork;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.entity.ai.pathing.NavigationType;
|
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -13,126 +14,31 @@ import net.minecraft.state.StateManager;
|
||||||
import net.minecraft.state.property.BooleanProperty;
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
import net.minecraft.state.property.DirectionProperty;
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
import net.minecraft.state.property.Properties;
|
import net.minecraft.state.property.Properties;
|
||||||
import net.minecraft.util.ActionResult;
|
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Direction;
|
import net.minecraft.util.math.Direction;
|
||||||
import net.minecraft.util.shape.VoxelShape;
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
import net.minecraft.world.BlockView;
|
import net.minecraft.world.BlockView;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldAccess;
|
import net.minecraft.world.WorldAccess;
|
||||||
import net.minecraft.world.WorldView;
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
public class Connector extends Block implements LetiBlock, Waterloggable {
|
public class Connector extends LetiConnectable /*implements LetiBlock, Waterloggable*/ {
|
||||||
|
|
||||||
static final VoxelShape BASE_SHAPE = createCuboidShape( 5d, 5d, 5d, 11d, 11d, 11d);
|
static final VoxelShape BASE_SHAPE = createCuboidShape( 5d, 5d, 5d, 11d, 11d, 11d);
|
||||||
static final VoxelShape NORTH_SHAPE = createCuboidShape( 6d, 6d, 0d, 10d, 10d, 5d);
|
static final VoxelShape NORTH_SHAPE = createCuboidShape( 6d, 6d, 0d, 10d, 10d, 5d);
|
||||||
static final VoxelShape SOUTH_SHAPE = createCuboidShape( 6d, 6d, 11d, 10d, 10d, 16d);
|
static final VoxelShape SOUTH_SHAPE = createCuboidShape( 6d, 6d, 11d, 10d, 10d, 16d);
|
||||||
static final VoxelShape EAST_SHAPE = createCuboidShape(11d, 6d, 6d, 16d, 10d, 10d);
|
static final VoxelShape EAST_SHAPE = createCuboidShape(11d, 6d, 6d, 16d, 10d, 10d);
|
||||||
static final VoxelShape WEST_SHAPE = createCuboidShape( 0d, 6d, 6d, 5d, 10d, 10d);
|
static final VoxelShape WEST_SHAPE = createCuboidShape( 0d, 6d, 6d, 5d, 10d, 10d);
|
||||||
static final VoxelShape UP_SHAPE = createCuboidShape( 6d, 6d, 6d, 10d, 16d, 10d);
|
static final VoxelShape UP_SHAPE = createCuboidShape( 6d, 11d, 6d, 10d, 16d, 10d);
|
||||||
static final VoxelShape DOWN_SHAPE = createCuboidShape( 6d, 0d, 6d, 10d, 5d, 10d);
|
static final VoxelShape DOWN_SHAPE = createCuboidShape( 6d, 0d, 6d, 10d, 5d, 10d);
|
||||||
|
|
||||||
public EllasModLampBlock(net.minecraft.block.AbstractBlock.Settings settings){
|
public Connector(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
super(settings);
|
super(settings);
|
||||||
this.setDefaultState(
|
|
||||||
this.stateManager.getDefaultState()
|
|
||||||
.with(Properties.WATERLOGGED, false)
|
|
||||||
.with(Properties.UP , false)
|
|
||||||
.with(Properties.DOWN , false)
|
|
||||||
.with(Properties.NORTH, false)
|
|
||||||
.with(Properties.SOUTH, false)
|
|
||||||
.with(Properties.EAST , false)
|
|
||||||
.with(Properties.WEST , false)
|
|
||||||
.with(Properties.POWERED, false));
|
|
||||||
}
|
|
||||||
|
|
||||||
//getShapeForState
|
|
||||||
@Override
|
|
||||||
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
|
|
||||||
super.appendProperties(builder);
|
|
||||||
builder.add(Properties.DOWN, Properties.EAST, Properties.FACING, Properties.NORTH, Properties.SOUTH, Properties.WATERLOGGED);
|
|
||||||
}
|
|
||||||
/*@Override
|
|
||||||
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
|
||||||
return ActionResult.SUCCESS;
|
|
||||||
}*/
|
|
||||||
@Override
|
|
||||||
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context){
|
|
||||||
VoxelShape shape = BASE_SHAPE;
|
|
||||||
if(((Boolean)state.get(Properties.NORTH)).booleanValue()){
|
|
||||||
shape = VoxelShapes.union(shape, NORTH_SHAPE);
|
|
||||||
}
|
|
||||||
if(((Boolean)state.get(Properties.SOUTH)).booleanValue()){
|
|
||||||
shape = VoxelShapes.union(shape, SOUTH_SHAPE);
|
|
||||||
}
|
|
||||||
if(((Boolean)state.get(Properties.EAST)).booleanValue()){
|
|
||||||
shape = VoxelShapes.union(shape, EAST_SHAPE);
|
|
||||||
}
|
|
||||||
if(((Boolean)state.get(Properties.WEST)).booleanValue()){
|
|
||||||
shape = VoxelShapes.union(shape, WEST_SHAPE);
|
|
||||||
}
|
|
||||||
if(((Boolean)state.get(Properties.UP)).booleanValue()){
|
|
||||||
shape = VoxelShapes.union(shape, UP_SHAPE);
|
|
||||||
}
|
|
||||||
if(((Boolean)state.get(Properties.DOWN)).booleanValue()){
|
|
||||||
shape = VoxelShapes.union(shape, DOWN_SHAPE);
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BlockState getPlacementState(ItemPlacementContext context){
|
public void onPlace(){
|
||||||
var world = context.getWorld();
|
LetiNetwork.new(pos);
|
||||||
var pos = context.getBlockPos();
|
|
||||||
return super.getPlacementState(context)
|
|
||||||
.with(Properties.WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER)
|
|
||||||
.with(Properties.NORTH, connects(world.getBlockState(pos.north()).getBlock()))
|
|
||||||
.with(Properties.SOUTH, connects(world.getBlockState(pos.south()).getBlock()))
|
|
||||||
.with(Properties.EAST , connects(world.getBlockState(pos.east() ).getBlock()))
|
|
||||||
.with(Properties.WEST , connects(world.getBlockState(pos.west() ).getBlock()))
|
|
||||||
.with(Properties.UP , connects(world.getBlockState(pos.up() ).getBlock()))
|
|
||||||
.with(Properties.DOWN , connects(world.getBlockState(pos.down() ).getBlock()))
|
|
||||||
.with(Properties.POWERED, /*powered(world.getBlockState(pos).getBlock())*/false);
|
|
||||||
}
|
}
|
||||||
public boolean connects(Block block){
|
|
||||||
if(block instanceof LetiBlock)
|
|
||||||
return (LetiBlock)block.connects;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
/*@Override
|
|
||||||
public boolean canPathfindThrough(BlockState state, BlockView world, BlockPos pos, NavigationType type){
|
|
||||||
return false;
|
|
||||||
}*/
|
|
||||||
@Override
|
|
||||||
public FluidState getFluidState(BlockState state){
|
|
||||||
if(state.get(Properties.WATERLOGGED)) return Fluids.WATER.getStill(false);
|
|
||||||
else return super.getFluidState(state);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public BlockState getStateForNeighborUpdate(
|
|
||||||
BlockState state,
|
|
||||||
Direction side,
|
|
||||||
BlockState neighborState,
|
|
||||||
WorldAccess world,
|
|
||||||
BlockPos pos,
|
|
||||||
BlockPos neighborPos
|
|
||||||
){
|
|
||||||
// can't be assed to only update one side
|
|
||||||
return state
|
|
||||||
.with(Properties.NORTH, connects(world.getBlockState(pos.north()).getBlock()))
|
|
||||||
.with(Properties.SOUTH, connects(world.getBlockState(pos.south()).getBlock()))
|
|
||||||
.with(Properties.EAST , connects(world.getBlockState(pos.east() ).getBlock()))
|
|
||||||
.with(Properties.WEST , connects(world.getBlockState(pos.west() ).getBlock()))
|
|
||||||
.with(Properties.UP , connects(world.getBlockState(pos.up() ).getBlock()))
|
|
||||||
.with(Properties.DOWN , connects(world.getBlockState(pos.down() ).getBlock()))
|
|
||||||
/*.with(Properties.POWERED, /*powered(world.getBlockState(pos).getBlock())* /false)*/;
|
|
||||||
}
|
|
||||||
/*@Override
|
|
||||||
rotate(BlockState state, BlockRotation rotation): BlockState {
|
|
||||||
|
|
||||||
|
|
||||||
return state;
|
|
||||||
}*/
|
|
||||||
}
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.IntProperty;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
|
public class Delayer extends FacingLeti /*implements LetiBlock, Waterloggable*/ {
|
||||||
|
public static final IntProperty DELAY = IntProperty.of("delay", 1, 6);
|
||||||
|
|
||||||
|
public Delayer(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
this.setDefaultState(
|
||||||
|
this.stateManager.getDefaultState()
|
||||||
|
.with(DELAY, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
|
||||||
|
super.appendProperties(builder);
|
||||||
|
builder.add(DELAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext context){
|
||||||
|
return super.getPlacementState(context).with(DELAY, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
||||||
|
world.setBlockState(pos, state.with(DELAY, (state.get(DELAY) - 1) % 6 + 2));
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
public class FacingLeti extends Block implements LetiBlock, Waterloggable {
|
||||||
|
|
||||||
|
static final VoxelShape BASE_SHAPE = createCuboidShape( 5d, 5d, 5d, 11d, 11d, 11d);
|
||||||
|
static final VoxelShape Z_SHAPE = VoxelShapes.union(
|
||||||
|
BASE_SHAPE, createCuboidShape( 6d, 6d, 0d, 10d, 10d, 16d));
|
||||||
|
static final VoxelShape X_SHAPE = VoxelShapes.union(
|
||||||
|
BASE_SHAPE, createCuboidShape( 0d, 6d, 6d, 16d, 10d, 10d));
|
||||||
|
static final VoxelShape Y_SHAPE = VoxelShapes.union(
|
||||||
|
BASE_SHAPE, createCuboidShape( 6d, 0d, 6d, 10d, 16d, 10d));
|
||||||
|
|
||||||
|
public FacingLeti(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
this.setDefaultState(
|
||||||
|
this.stateManager.getDefaultState()
|
||||||
|
.with(Properties.WATERLOGGED, false)
|
||||||
|
.with(Properties.FACING, Direction.UP)
|
||||||
|
.with(Properties.POWERED, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
|
||||||
|
super.appendProperties(builder);
|
||||||
|
builder.add(Properties.FACING, Properties.POWERED, Properties.WATERLOGGED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context){
|
||||||
|
switch((net.minecraft.util.math.Direction)state.get(Properties.FACING)){
|
||||||
|
case NORTH:
|
||||||
|
case SOUTH:
|
||||||
|
return Z_SHAPE;
|
||||||
|
case EAST:
|
||||||
|
case WEST:
|
||||||
|
return X_SHAPE;
|
||||||
|
case UP:
|
||||||
|
case DOWN:
|
||||||
|
default:
|
||||||
|
return Y_SHAPE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext context){
|
||||||
|
var world = context.getWorld();
|
||||||
|
var pos = context.getBlockPos();
|
||||||
|
return super.getPlacementState(context)
|
||||||
|
.with(Properties.WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER)
|
||||||
|
.with(Properties.FACING, context.getPlayerLookDirection());
|
||||||
|
.with(Properties.POWERED, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidState getFluidState(BlockState state){
|
||||||
|
if(state.get(Properties.WATERLOGGED)) return Fluids.WATER.getStill(false);
|
||||||
|
else return super.getFluidState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean connects(BlockState state, Direction direction){
|
||||||
|
return direction.equals(state.get(Properties.FACING)) || direction.equals(state.get(Properties.FACING).opposite());
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean output(/*ServerWorld world, BlockPos pos,*/ BlockState state, Direction direction){
|
||||||
|
return state.get(Properties.POWERED) && direction.equals(state.get(Properties.FACING));
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO update output of network in front after placing
|
||||||
|
/*@Override
|
||||||
|
BlockState rotate(BlockState state, BlockRotation rotation){
|
||||||
|
return state;
|
||||||
|
}*/
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.IntProperty;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class Inverter extends FacingLeti /*implements LetiBlock, Waterloggable*/ {
|
||||||
|
|
||||||
|
public Inverter(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext context){
|
||||||
|
return super.getPlacementState(context).with(DELAY, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick(){
|
||||||
|
// TODO update to what the output behind wasn't
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,11 @@
|
||||||
package ella.techia.block;
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.world.ServerWorld;
|
||||||
|
|
||||||
public interface LetiBlock {
|
public interface LetiBlock {
|
||||||
public boolean connects; // TODO maybe a method?
|
public boolean connects(BlockState state, Direction direction);
|
||||||
public boolean output();
|
public boolean output(/*ServerWorld world, BlockPos pos,*/ BlockState state, Direction direction);
|
||||||
}
|
}
|
|
@ -0,0 +1,134 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import ella.techia.leti.LetiNetwork;
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
public class LetiConnectable extends Block implements LetiBlock, Waterloggable {
|
||||||
|
|
||||||
|
static final VoxelShape BASE_SHAPE;
|
||||||
|
static final VoxelShape NORTH_SHAPE;
|
||||||
|
static final VoxelShape SOUTH_SHAPE;
|
||||||
|
static final VoxelShape EAST_SHAPE;
|
||||||
|
static final VoxelShape WEST_SHAPE;
|
||||||
|
static final VoxelShape UP_SHAPE;
|
||||||
|
static final VoxelShape DOWN_SHAPE;
|
||||||
|
|
||||||
|
public LetiToggle(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
this.setDefaultState(
|
||||||
|
this.stateManager.getDefaultState()
|
||||||
|
.with(Properties.WATERLOGGED, false)
|
||||||
|
.with(Properties.UP , false)
|
||||||
|
.with(Properties.DOWN , false)
|
||||||
|
.with(Properties.NORTH, false)
|
||||||
|
.with(Properties.SOUTH, false)
|
||||||
|
.with(Properties.EAST , false)
|
||||||
|
.with(Properties.WEST , false)
|
||||||
|
.with(Properties.POWERED, false));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void appendProperties(StateManager.Builder<Block, BlockState> builder){
|
||||||
|
super.appendProperties(builder);
|
||||||
|
builder.add(Properties.DOWN, Properties.EAST, Properties.NORTH, Properties.POWERED,
|
||||||
|
Properties.SOUTH, Properties.UP, Properties.WEST, Properties.WATERLOGGED);
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public VoxelShape getOutlineShape(BlockState state, BlockView world, BlockPos pos, ShapeContext context){
|
||||||
|
VoxelShape shape = BASE_SHAPE;
|
||||||
|
if(((Boolean)state.get(Properties.NORTH)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, NORTH_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.SOUTH)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, SOUTH_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.EAST)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, EAST_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.WEST)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, WEST_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.UP)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, UP_SHAPE);
|
||||||
|
}
|
||||||
|
if(((Boolean)state.get(Properties.DOWN)).booleanValue()){
|
||||||
|
shape = VoxelShapes.union(shape, DOWN_SHAPE);
|
||||||
|
}
|
||||||
|
return shape;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getPlacementState(ItemPlacementContext context){
|
||||||
|
var world = context.getWorld();
|
||||||
|
var pos = context.getBlockPos();
|
||||||
|
return super.getPlacementState(context)
|
||||||
|
.with(Properties.WATERLOGGED, world.getFluidState(pos).getFluid() == Fluids.WATER)
|
||||||
|
.with(Properties.NORTH, LetiNetwork.connects(world.getBlockState(pos.north()), Direction.SOUTH))
|
||||||
|
.with(Properties.SOUTH, LetiNetwork.connects(world.getBlockState(pos.south()), Direction.NORTH))
|
||||||
|
.with(Properties.EAST , LetiNetwork.connects(world.getBlockState(pos.east() ), Direction.WEST ))
|
||||||
|
.with(Properties.WEST , LetiNetwork.connects(world.getBlockState(pos.west() ), Direction.EAST ))
|
||||||
|
.with(Properties.UP , LetiNetwork.connects(world.getBlockState(pos.up() ), Direction.DOWN ))
|
||||||
|
.with(Properties.DOWN , LetiNetwork.connects(world.getBlockState(pos.down() ), Direction.UP ))
|
||||||
|
.with(Properties.POWERED, /*powered(world.getBlockState(pos))*/false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidState getFluidState(BlockState state){
|
||||||
|
if(state.get(Properties.WATERLOGGED)) return Fluids.WATER.getStill(false);
|
||||||
|
else return super.getFluidState(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getStateForNeighborUpdate(
|
||||||
|
BlockState state,
|
||||||
|
Direction side,
|
||||||
|
BlockState neighborState,
|
||||||
|
WorldAccess world,
|
||||||
|
BlockPos pos,
|
||||||
|
BlockPos neighborPos
|
||||||
|
){
|
||||||
|
// can't be assed to only update one side
|
||||||
|
// FIXME probably extremely laggy on medium to big networks
|
||||||
|
return state
|
||||||
|
.with(Properties.NORTH, LetiNetwork.connects(world.getBlockState(pos.north()), Direction.SOUTH))
|
||||||
|
.with(Properties.SOUTH, LetiNetwork.connects(world.getBlockState(pos.south()), Direction.NORTH))
|
||||||
|
.with(Properties.EAST , LetiNetwork.connects(world.getBlockState(pos.east() ), Direction.WEST ))
|
||||||
|
.with(Properties.WEST , LetiNetwork.connects(world.getBlockState(pos.west() ), Direction.EAST ))
|
||||||
|
.with(Properties.UP , LetiNetwork.connects(world.getBlockState(pos.up() ), Direction.DOWN ))
|
||||||
|
.with(Properties.DOWN , LetiNetwork.connects(world.getBlockState(pos.down() ), Direction.UP ))
|
||||||
|
/*.with(Properties.POWERED, /*powered(world.getBlockState(pos))* /false)*/;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean connects(BlockState state, Direction direction){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean output(/*ServerWorld world, BlockPos pos,*/ BlockState state, Direction direction){
|
||||||
|
return state.get(Properties.POWERED);
|
||||||
|
}
|
||||||
|
/*@Override
|
||||||
|
BlockState rotate(BlockState state, BlockRotation rotation){
|
||||||
|
return state;
|
||||||
|
}*/
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import ella.techia.leti.LetiNetwork;
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
import net.minecraft.entity.ai.pathing.NavigationType;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.fluid.FluidState;
|
||||||
|
import net.minecraft.fluid.Fluids;
|
||||||
|
import net.minecraft.item.ItemPlacementContext;
|
||||||
|
import net.minecraft.sound.BlockSoundGroup;
|
||||||
|
import net.minecraft.sound.SoundCategory;
|
||||||
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.state.StateManager;
|
||||||
|
import net.minecraft.state.property.BooleanProperty;
|
||||||
|
import net.minecraft.state.property.DirectionProperty;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.shape.VoxelShape;
|
||||||
|
import net.minecraft.util.shape.VoxelShapes;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.WorldAccess;
|
||||||
|
import net.minecraft.world.WorldView;
|
||||||
|
|
||||||
|
public class LetiToggle extends LetiConnectable /*implements LetiBlock, Waterloggable*/ {
|
||||||
|
|
||||||
|
static final VoxelShape BASE_SHAPE = createCuboidShape( 3d, 3d, 3d, 13d, 13d, 13d);
|
||||||
|
static final VoxelShape NORTH_SHAPE = createCuboidShape( 6d, 6d, 0d, 10d, 10d, 3d);
|
||||||
|
static final VoxelShape SOUTH_SHAPE = createCuboidShape( 6d, 6d, 13d, 10d, 10d, 16d);
|
||||||
|
static final VoxelShape EAST_SHAPE = createCuboidShape(13d, 6d, 6d, 16d, 10d, 10d);
|
||||||
|
static final VoxelShape WEST_SHAPE = createCuboidShape( 0d, 6d, 6d, 3d, 10d, 10d);
|
||||||
|
static final VoxelShape UP_SHAPE = createCuboidShape( 6d, 13d, 6d, 10d, 16d, 10d);
|
||||||
|
static final VoxelShape DOWN_SHAPE = createCuboidShape( 6d, 0d, 6d, 10d, 3d, 10d);
|
||||||
|
|
||||||
|
public LetiToggle(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit){
|
||||||
|
boolean pow = state.get(Properties.POWERED);
|
||||||
|
world.setBlockState(pos, state.with(Properties.POWERED, !pow));
|
||||||
|
// Will this play the sound for only the player? probably not what we want
|
||||||
|
world.playSound(player, pos, SoundEvents.BLOCK_LEVER_CLICK, SoundCategory.BLOCKS, 0.3f, pow? 0.5f: 0.6f);
|
||||||
|
//world.playSound(pos.x, pos.y, pos.z, SoundEvents.BLOCK_LEVER_CLICK, SoundCategory.BLOCKS, 0.3f, pow? 0.5f: 0.6f, true);
|
||||||
|
return ActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
package ella.techia.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.*;
|
||||||
|
|
||||||
|
public class Piston extends Block {
|
||||||
|
|
||||||
|
public Piston(net.minecraft.block.AbstractBlock.Settings settings){
|
||||||
|
super(settings);
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -0,0 +1,108 @@
|
||||||
|
package ella.techia.leti;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.ServerWorld;
|
||||||
|
|
||||||
|
public class LetiNetwork {
|
||||||
|
private static final Map<Entry<ServerWorld, BlockPos>, LetiNetwork> networks = Maps.newHashMap();
|
||||||
|
private ServerWorld world;
|
||||||
|
|
||||||
|
ArrayList<BlockPos> nodes;
|
||||||
|
public LetiNetwork(ServerWorld world, BlockPos pos){
|
||||||
|
this.world = world;
|
||||||
|
nodes = new ArrayList<>();
|
||||||
|
nodes.add(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void set(boolean powered){
|
||||||
|
for(BlockPos pos : nodes){
|
||||||
|
world.setBlockState(pos, world.getBlockState(pos).with(Properties.POWERED, powered));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// assumes that there is no node here already
|
||||||
|
public static void new(ServerWorld world, BlockPos pos){
|
||||||
|
if(!(world.getBlockState(pos).getBlock() instanceof Connector))
|
||||||
|
throw new IllegalArgumentException("Only connectors may be in a network");
|
||||||
|
// check adjacent positions for networks, if >1 join them together, if >0 join the network, if 0 create a network
|
||||||
|
LetiNetwork current = null;
|
||||||
|
for(BlockPos np : neighbors(pos)){
|
||||||
|
Entry<ServerWorld, BlockPos> key = new Entry<>(world, pos);
|
||||||
|
if(networks.containsKey(key)){
|
||||||
|
if(current == null){
|
||||||
|
current = networks.get(key);
|
||||||
|
current.add(pos);
|
||||||
|
}
|
||||||
|
else current.mergeWith(networks.get(key));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(current == null){
|
||||||
|
networks.set(new Entry<ServerWorld, BlockPos>(world, pos), new LetiNetwork(world, pos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void add(BlockPos pos){
|
||||||
|
nodes.add(pos);
|
||||||
|
networks.set(new Entry<ServerWorld, BlockPos>(world, pos), this);
|
||||||
|
}
|
||||||
|
private void remove(BlockPos pos){
|
||||||
|
nodes.remove(pos);
|
||||||
|
networks.remove(new Entry<ServerWorld, BlockPos>(world, pos));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void mergeWith(LetiNetwork network){
|
||||||
|
for(BlockPos pos : nodes){
|
||||||
|
Entry<ServerWorld, BlockPos> entry = new Entry<>(world, pos)
|
||||||
|
//networks.remove(entry); (not needed because we replace)
|
||||||
|
network.add(pos);
|
||||||
|
networks.set(entry, network);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean connects(BlockState state, Direction direction){
|
||||||
|
Block block = state.getBlock();
|
||||||
|
if(block instanceof LetiBlock)
|
||||||
|
return ((LetiBlock)block).connects(state, direction);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean output(BlockState state, Direction direction){
|
||||||
|
Block block = state.getBlock();
|
||||||
|
if(block instanceof LetiBlock)
|
||||||
|
return ((LetiBlock)block).output(state, direction);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// borrowed from yttr
|
||||||
|
public static Entry<BlockPos> neighbors(BlockPos pos){
|
||||||
|
BlockPos fpos = pos.toImmutable();
|
||||||
|
return new AbstractEntry<BlockPos>(){
|
||||||
|
@Override
|
||||||
|
public Iterator<BlockPos> iterator() {
|
||||||
|
return new AbstractIterator<BlockPos>(){
|
||||||
|
private final BlockPos.Mutable mut = new BlockPos.Mutable();
|
||||||
|
private final Iterator<Direction> dirIter = DIRECTIONS.iterator();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockPos computeNext(){
|
||||||
|
if (!dirIter.hasNext()) return endOfData();
|
||||||
|
return mut.set(fpos).move(dirIter.next());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean contains(Object o){
|
||||||
|
return o instanceof BlockPos && fpos.getManhattanDistance((BlockPos)o) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int size(){
|
||||||
|
return DIRECTIONS.size();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
|
@ -2,6 +2,7 @@ package ella.techia.registry;
|
||||||
|
|
||||||
import ella.techia.Techia;
|
import ella.techia.Techia;
|
||||||
import ella.techia.block.*;
|
import ella.techia.block.*;
|
||||||
|
import ella.techia.block.entity.*;
|
||||||
//import net.fabricmc.api.FabricLoader;
|
//import net.fabricmc.api.FabricLoader;
|
||||||
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||||
|
@ -29,73 +30,27 @@ public class TechiaRegistry {
|
||||||
new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)), ItemGroup.BUILDING_BLOCKS);
|
new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)), ItemGroup.BUILDING_BLOCKS);
|
||||||
public static final Item ASMITE_INGOT = addI("asmite_ingot", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
public static final Item ASMITE_INGOT = addI("asmite_ingot", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
public static final Item LETIUM = addI("letium", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
public static final Item LETIUM = addI("letium", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
public static final Block CONNECTOR = add("connector", new Connector(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
public static final Block CONNECTOR = add("connector", new Connector(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), Techia.LETI);
|
||||||
public static final Block INTERSECTOR = add("intersector", new Intersector(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
//public static final Block INTERSECTOR = add("intersector", new Intersector(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), Techia.LETI); NOPE
|
||||||
public static final Block INVERTER = add("inverter", new Inverter(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
public static final Block INVERTER = add("inverter", new Inverter(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), Techia.LETI);
|
||||||
public static final Block DELAYER = add("delayer", new Delayer(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), ItemGroup.MISC);
|
public static final Block DELAYER = add("delayer", new Delayer(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.1f).resistance(0f)), Techia.LETI);
|
||||||
|
public static final Block ASMITE_TOGGLE = add("asmite_toggle", new LetiToggle(FabricBlockSettings.copyOf(Blocks.IRON_BARS).hardness(0.2f).resistance(0.2f)), Techia.LETI);
|
||||||
|
|
||||||
|
public static final Block BOX_BLOCK = add("smelter", new Smelter(FabricBlockSettings.copyOf(Blocks.FURNACE)), ItemGroup.MISC);
|
||||||
|
public static BlockEntityType<SmelterEntity> SMELTER_ENTITY;
|
||||||
public static final Item BLOCK_SHAPE = addI("block_shape", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
public static final Item BLOCK_SHAPE = addI("block_shape", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
public static final Item INGOT_SHAPE = addI("ingot_shape", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
public static final Item INGOT_SHAPE = addI("ingot_shape", new Item(new Item.Settings().group(ItemGroup.MISC)));
|
||||||
|
|
||||||
/*public static final Block NONBINARY_BLOCK = add("nonbinary_block",
|
public static final Block BOX_BLOCK = add("box", new BoxBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).hardness(0.5f)), ItemGroup.MISC);
|
||||||
new EFacingBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(MapColor.WHITE)), ItemGroup.BUILDING_BLOCKS);
|
public static BlockEntityType<BoxBlockEntity> BOX_BLOCK_ENTITY;
|
||||||
|
public static final Block BOX_BLOCK = add("workbench", new WorkbenchBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).hardness(0.5f)), ItemGroup.MISC);
|
||||||
|
public static BlockEntityType<WorkbenchBlockEntity> WORKBENCH_BLOCK_ENTITY;
|
||||||
|
|
||||||
/*public static final Block SPARKWOOD_LADDER = add("sparkwood_ladder",
|
public static final Block PISTON = add("piston",
|
||||||
new SparkwoodLadderBlock(FabricBlockSettings.copyOf(Blocks.LADDER)), ItemGroup.DECORATIONS);*/
|
new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)), Techia.LETI);
|
||||||
/*public static final Block SPARKWOOD_FENCE = add("sparkwood_fence",
|
|
||||||
new FenceBlock(FabricBlockSettings.copyOf(Blocks.OAK_FENCE)), ItemGroup.DECORATIONS);*/
|
|
||||||
/*private static final Identifier SPARKWOOD_SIGN_TEXTURE = new Identifier(Techia.MOD_ID, "entity/signs/sparkwood");
|
|
||||||
public static final TerraformSignBlock SPARKWOOD_SIGN = add("sparkwood_sign",
|
|
||||||
new TerraformSignBlock(SPARKWOOD_SIGN_TEXTURE, FabricBlockSettings.copyOf(Blocks.OAK_SIGN)));
|
|
||||||
public static final Block SPARKWOOD_WALL_SIGN = add("sparkwood_wall_sign",
|
|
||||||
new TerraformWallSignBlock(SPARKWOOD_SIGN_TEXTURE, FabricBlockSettings.copyOf(Blocks.OAK_WALL_SIGN)));
|
|
||||||
public static final Item SPARKWOOD_SIGN_ITEM = add("sparkwood_sign",
|
|
||||||
new SignItem(new Item.Settings().maxCount(16).group(ItemGroup.DECORATIONS), SPARKWOOD_SIGN, SPARKWOOD_WALL_SIGN));* /
|
|
||||||
|
|
||||||
public static final Block STONE_BRICK_TILES = add("stone_brick_tiles",
|
public static final RecipeType<SmelterRecipe> WORKBENCH_RECIPE = RecipeType.register(new Identifier(Techia.MOD_ID, "smelting"));
|
||||||
new Block(FabricBlockSettings.copyOf(Blocks.STONE_BRICKS)), ItemGroup.BUILDING_BLOCKS);
|
public static final RecipeType<WorkbenchRecipe> WORKBENCH_RECIPE = RecipeType.register(new Identifier(Techia.MOD_ID, "workbench"));
|
||||||
|
|
||||||
public static final Block LARGE_OAK_TILE_SLAB = add("large_oak_tile_slab",
|
|
||||||
new SlabBlock(FabricBlockSettings.copyOf(Blocks.OAK_SLAB)), ItemGroup.DECORATIONS);
|
|
||||||
|
|
||||||
public static final Block LARGE_OAK_TILE_STAIRS = add("large_oak_tile_stairs",
|
|
||||||
new TerraformStairsBlock(LARGE_OAK_TILES, FabricBlockSettings.copyOf(Blocks.OAK_STAIRS)), ItemGroup.DECORATIONS);
|
|
||||||
|
|
||||||
public static final Block LAMP_BLOCK = add("lamp_block",
|
|
||||||
new Block(FabricBlockSettings.copyOf(Blocks.REDSTONE_LAMP).nonOpaque().luminance(15)), ItemGroup.DECORATIONS);
|
|
||||||
public static final Block CAGED_GLASS = add("clear_glass",
|
|
||||||
new GlassBlock(FabricBlockSettings.copyOf(Blocks.GLASS)), ItemGroup.BUILDING_BLOCKS);
|
|
||||||
public static final Block LAMP = add("lamp",
|
|
||||||
new TechiaLampBlock(FabricBlockSettings.copyOf(Blocks.END_ROD)
|
|
||||||
.luminance(state -> state.get(Properties.LIT)? 15: 0)
|
|
||||||
.sounds(BlockSoundGroup.LANTERN)
|
|
||||||
), ItemGroup.DECORATIONS);
|
|
||||||
public static final Block SMALL_LAMP = add("small_lamp",
|
|
||||||
new TechiaSmallLampBlock(FabricBlockSettings.copyOf(Blocks.END_ROD)
|
|
||||||
.luminance(state -> state.get(Properties.LIT)? 15: 0)
|
|
||||||
.sounds(BlockSoundGroup.LANTERN)
|
|
||||||
), ItemGroup.DECORATIONS);
|
|
||||||
public static final Block CAGE = add("cage",
|
|
||||||
new CageBlock(FabricBlockSettings.copyOf(Blocks.IRON_BARS)
|
|
||||||
//.luminance(state -> state.get(Properties.LIT)? 15: 0)
|
|
||||||
//.suffocates(TechiaBlocks::never)
|
|
||||||
//.blockVision(TechiaBlocks::never)
|
|
||||||
), ItemGroup.DECORATIONS);
|
|
||||||
|
|
||||||
/*public static final Block _PLATFORM = add("_platform",
|
|
||||||
new PlatformBlock(FabricBlockSettings.copyOf(Blocks.COBBLESTONE)), ItemGroup.BUILDING_BLOCKS);
|
|
||||||
|
|
||||||
public static final Block OAK_WALL_FENCE = add("oak_wall_fence",
|
|
||||||
new WallFenceBlock(FabricBlockSettings.copyOf(Blocks.OAK_FENCE)), ItemGroup.DECORATIONS);
|
|
||||||
|
|
||||||
public static final Block WINDOWED_IRON_DOOR = add("windowed_iron_door",
|
|
||||||
new TerraformDoorBlock(FabricBlockSettings.copyOf(Blocks.IRON_DOOR)), ItemGroup.REDSTONE);
|
|
||||||
public static final Block YELLOW_BRICK_STAIRS = add("yellow_brick_stairs",
|
|
||||||
new TerraformStairsBlock(YELLOW_BRICKS, FabricBlockSettings.copyOf(Blocks.BRICKS).mapColor(MapColor.PALE_YELLOW)), ItemGroup.BUILDING_BLOCKS);
|
|
||||||
public static final Block YELLOW_BRICK_SLAB = add("yellow_brick_slab",
|
|
||||||
new SlabBlock(FabricBlockSettings.copyOf(Blocks.BRICKS).mapColor(MapColor.PALE_YELLOW)), ItemGroup.BUILDING_BLOCKS);
|
|
||||||
public static final Block YELLOW_BRICK_WALL = add("yellow_brick_wall",
|
|
||||||
new EWallBlock(FabricBlockSettings.copyOf(Blocks.BRICKS).mapColor(MapColor.PALE_YELLOW)), ItemGroup.BUILDING_BLOCKS);*/
|
|
||||||
|
|
||||||
private static <B extends Block> B add(String name, B block, ItemGroup tab){
|
private static <B extends Block> B add(String name, B block, ItemGroup tab){
|
||||||
return add(name, block, new BlockItem(block, new Item.Settings().group(tab)));
|
return add(name, block, new BlockItem(block, new Item.Settings().group(tab)));
|
||||||
|
@ -131,30 +86,48 @@ public class TechiaRegistry {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
/*for(String id : ITEMS.keySet()){
|
/*for(String id : ITEMS.keySet()){
|
||||||
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, id), ITEMS.get(id));
|
register(id), ITEMS.get(id));
|
||||||
}
|
}
|
||||||
for(String id : BLOCKS.keySet()){
|
for(String id : BLOCKS.keySet()){
|
||||||
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, id), BLOCKS.get(id));
|
register(id), BLOCKS.get(id));
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
//FuelRegistry fuelRegistry = FuelRegistry.INSTANCE;
|
|
||||||
//fuelRegistry.add(, ticks);
|
|
||||||
|
|
||||||
//FlammableBlockRegistry flammableRegistry = FlammableBlockRegistry.getDefaultInstance();
|
//FlammableBlockRegistry flammableRegistry = FlammableBlockRegistry.getDefaultInstance();
|
||||||
|
|
||||||
// could be bad? maybe don't use hash maps?
|
// could be bad? maybe don't use hash maps?
|
||||||
//BLOCKS = null;
|
//BLOCKS = null;
|
||||||
//ITEMS = null;
|
//ITEMS = null;
|
||||||
|
|
||||||
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "asmite_block"), ASMITE_BLOCK);
|
register("asmite_block", ASMITE_BLOCK);
|
||||||
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "asmite_ingot"), ASMITE_INGOT);
|
register("asmite_ingot", ASMITE_INGOT);
|
||||||
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "letium"), LETIUM);
|
register("letium", LETIUM);
|
||||||
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "connector"), CONNECTOR);
|
register("connector", CONNECTOR);
|
||||||
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "intersector"), INTERSECTOR);
|
//register("intersector", INTERSECTOR); NOPE
|
||||||
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "inverter"), INVERTER);
|
register("inverter", INVERTER);
|
||||||
Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "delayer"), DELAYER);
|
register("delayer", DELAYER);
|
||||||
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "block_shape"), BLOCK_SHAPE);
|
//register("leti_source", LETI_SOURCE);
|
||||||
Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "ingot_shape"), INGOT_SHAPE);
|
//register("asmite_button", ASMITE_BUTTON);
|
||||||
|
register("asmite_toggle", ASMITE_TOGGLE);
|
||||||
|
//register("asmite_wall_button", ASMITE_WALL_BUTTON);
|
||||||
|
//register("asmite_wall_toggle", ASMITE_WALL_TOGGLE);
|
||||||
|
register("smelter", SMELTER);
|
||||||
|
SMELTER_ENTITY = register("smelter", FabricBlockEntityTypeBuilder.create(BoxBlockEntity::new, BOX_BLOCK).build(null));
|
||||||
|
register("block_shape", BLOCK_SHAPE);
|
||||||
|
register("ingot_shape", INGOT_SHAPE);
|
||||||
|
register("box", BOX_BLOCK);
|
||||||
|
BOX_BLOCK_ENTITY = register("box", FabricBlockEntityTypeBuilder.create(BoxBlockEntity::new, BOX_BLOCK).build(null));
|
||||||
|
register("workbench", WORKBENCH_BLOCK);
|
||||||
|
WORKBENCH_BLOCK_ENTITY = register("workbench", FabricBlockEntityTypeBuilder.create(BoxBlockEntity::new, WORKBENCH_BLOCK).build(null));
|
||||||
|
register("piston", PISTON);
|
||||||
|
}
|
||||||
|
public void register(String id, Block block){
|
||||||
|
register(id), block);
|
||||||
|
}
|
||||||
|
public void register(String id, Item item){
|
||||||
|
register(id), item);
|
||||||
|
}
|
||||||
|
public BlockEntityType register(String id, BlockEntityType entity){
|
||||||
|
Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(Techia.MOD_ID, id), entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public static boolean never(BlockState state, BlockView world, BlockPos pos) {
|
/*public static boolean never(BlockState state, BlockView world, BlockPos pos) {
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"block.techia.asmite_block":"Asmite Block",
|
||||||
|
"block.techia.asmite_button":"Asmite Button",
|
||||||
|
"block.techia.asmite_toggle":"Asmite Toggle",
|
||||||
|
"block.techia.asmite_wall_button":"Asmite Wall Button",
|
||||||
|
"block.techia.asmite_wall_toggle":"Asmite Wall Toggle",
|
||||||
|
"block.techia.box":"Box",
|
||||||
|
"block.techia.connector":"Connector",
|
||||||
|
"block.techia.delayer":"Delayer",
|
||||||
|
"block.techia.leti_source":"Leti Source",
|
||||||
|
"block.techia.intersector":"Intersector",
|
||||||
|
"block.techia.inverter":"Inverter",
|
||||||
|
"block.techia.piston":"Piston",
|
||||||
|
"block.techia.smelter":"Smelter",
|
||||||
|
"block.techia.workbench":"Workbench",
|
||||||
|
"item.techia.asmite_ingot":"Asmite Ingot",
|
||||||
|
"item.techia.block_shape":"Block Shape",
|
||||||
|
"item.techia.letium":"Letium",
|
||||||
|
"item.techia.ingot_shape":"Ingot Shape",
|
||||||
|
"itemGroup.ellas_mod.items":"Techia",
|
||||||
|
"itemGroup.ellas_mod.leti":"Leti"}
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"block.techia.asmite_block":"Asmitblock",
|
||||||
|
"block.techia.asmite_button":"Asmitknapp",
|
||||||
|
"block.techia.asmite_toggle":"Asmitflipp",
|
||||||
|
"block.techia.asmite_wall_button":"Asmitv\u00e4ggknapp",
|
||||||
|
"block.techia.asmite_wall_toggle":"Asmitv\u00e4ggflipp",
|
||||||
|
"block.techia.box":"L\u00e5da",
|
||||||
|
"block.techia.connector":"Kopplare",
|
||||||
|
"block.techia.delayer":"F\u00f6rdr\u00f6jare",
|
||||||
|
"block.techia.leti_source":"Letik\u00e4lla",
|
||||||
|
"block.techia.intersector":"Korsare",
|
||||||
|
"block.techia.inverter":"Inverterare",
|
||||||
|
"block.techia.piston":"Kolv",
|
||||||
|
"block.techia.smelter":"Sm\u00e4ltare",
|
||||||
|
"block.techia.workbench":"Arbetsb\u00e4nk",
|
||||||
|
"item.techia.asmite_ingot":"Asmittacka",
|
||||||
|
"item.techia.block_shape":"Blockform",
|
||||||
|
"item.techia.letium":"Letium",
|
||||||
|
"item.techia.ingot_shape":"Tackform",
|
||||||
|
"itemGroup.ellas_mod.items":"Techia",
|
||||||
|
"itemGroup.ellas_mod.leti":"Leti"}
|
Loading…
Reference in New Issue