From bb8486a8eba0ec5a6012eea5f609f9b71e7038d2 Mon Sep 17 00:00:00 2001 From: Ella Paws <> Date: Sat, 5 Feb 2022 08:52:47 +0100 Subject: [PATCH] major progress --- main/java/ella/techia/Techia.java | 3 +- main/java/ella/techia/block/Connector.java | 114 ++------------- main/java/ella/techia/block/Delayer.java | 39 +++++ main/java/ella/techia/block/FacingLeti.java | 96 +++++++++++++ main/java/ella/techia/block/Inverter.java | 25 ++++ main/java/ella/techia/block/LetiBlock.java | 11 +- .../ella/techia/block/LetiConnectable.java | 134 ++++++++++++++++++ main/java/ella/techia/block/LetiToggle.java | 49 +++++++ main/java/ella/techia/block/Piston.java | 10 ++ .../entity/.BoxBlockEntity.java.kate-swp | Bin 312 -> 1617 bytes main/java/ella/techia/leti/LetiNetwork.java | 108 ++++++++++++++ .../registry/.TechiaRegistry.java.kate-swp | Bin 10382 -> 0 bytes .../ella/techia/registry/TechiaRegistry.java | 123 +++++++--------- main/resources/assets/techia/lang/en_us.json | 21 +++ main/resources/assets/techia/lang/sv_se.json | 21 +++ 15 files changed, 571 insertions(+), 183 deletions(-) create mode 100644 main/java/ella/techia/block/Delayer.java create mode 100644 main/java/ella/techia/block/FacingLeti.java create mode 100644 main/java/ella/techia/block/Inverter.java create mode 100644 main/java/ella/techia/block/LetiConnectable.java create mode 100644 main/java/ella/techia/block/LetiToggle.java create mode 100644 main/java/ella/techia/block/Piston.java create mode 100644 main/java/ella/techia/leti/LetiNetwork.java delete mode 100644 main/java/ella/techia/registry/.TechiaRegistry.java.kate-swp create mode 100644 main/resources/assets/techia/lang/en_us.json create mode 100644 main/resources/assets/techia/lang/sv_se.json diff --git a/main/java/ella/techia/Techia.java b/main/java/ella/techia/Techia.java index f2ad302..e4b02d7 100644 --- a/main/java/ella/techia/Techia.java +++ b/main/java/ella/techia/Techia.java @@ -17,10 +17,11 @@ public class Techia implements ModInitializer { public void onInitialize(){ 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)){ item.appendStacks(item.getGroup(), (DefaultedList) stacks); } })).build(); + ItemGroup LETI = FabricItemGroupBuilder.create(new Identifier(MOD_ID, "leti")).icon(() -> TechiaRegistry.CONNECTOR.asItem().getDefaultStack()).build(); } } diff --git a/main/java/ella/techia/block/Connector.java b/main/java/ella/techia/block/Connector.java index bc0b7ff..5ccd9f9 100644 --- a/main/java/ella/techia/block/Connector.java +++ b/main/java/ella/techia/block/Connector.java @@ -1,5 +1,6 @@ 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; @@ -13,126 +14,31 @@ 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.ActionResult; -import net.minecraft.util.Hand; -import net.minecraft.util.hit.BlockHitResult; 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 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 NORTH_SHAPE = createCuboidShape( 6d, 6d, 0d, 10d, 10d, 5d); 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 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); - public EllasModLampBlock(net.minecraft.block.AbstractBlock.Settings settings){ + public Connector(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)); } - - //getShapeForState - @Override - protected void appendProperties(StateManager.Builder 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 - 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, 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; - }*/ -} \ No newline at end of file + @Override + public void onPlace(){ + LetiNetwork.new(pos); + } +} diff --git a/main/java/ella/techia/block/Delayer.java b/main/java/ella/techia/block/Delayer.java new file mode 100644 index 0000000..aba6051 --- /dev/null +++ b/main/java/ella/techia/block/Delayer.java @@ -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 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; + } +} diff --git a/main/java/ella/techia/block/FacingLeti.java b/main/java/ella/techia/block/FacingLeti.java new file mode 100644 index 0000000..7c3b364 --- /dev/null +++ b/main/java/ella/techia/block/FacingLeti.java @@ -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 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; + }*/ +} diff --git a/main/java/ella/techia/block/Inverter.java b/main/java/ella/techia/block/Inverter.java new file mode 100644 index 0000000..1d178a5 --- /dev/null +++ b/main/java/ella/techia/block/Inverter.java @@ -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 + } +} diff --git a/main/java/ella/techia/block/LetiBlock.java b/main/java/ella/techia/block/LetiBlock.java index a8db1f8..164dcdf 100644 --- a/main/java/ella/techia/block/LetiBlock.java +++ b/main/java/ella/techia/block/LetiBlock.java @@ -1,6 +1,11 @@ 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 boolean connects; // TODO maybe a method? - public boolean output(); -} \ No newline at end of file + public boolean connects(BlockState state, Direction direction); + public boolean output(/*ServerWorld world, BlockPos pos,*/ BlockState state, Direction direction); +} diff --git a/main/java/ella/techia/block/LetiConnectable.java b/main/java/ella/techia/block/LetiConnectable.java new file mode 100644 index 0000000..4998c9f --- /dev/null +++ b/main/java/ella/techia/block/LetiConnectable.java @@ -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 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; + }*/ +} diff --git a/main/java/ella/techia/block/LetiToggle.java b/main/java/ella/techia/block/LetiToggle.java new file mode 100644 index 0000000..6cbe5cd --- /dev/null +++ b/main/java/ella/techia/block/LetiToggle.java @@ -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; + } +} diff --git a/main/java/ella/techia/block/Piston.java b/main/java/ella/techia/block/Piston.java new file mode 100644 index 0000000..0e51ba1 --- /dev/null +++ b/main/java/ella/techia/block/Piston.java @@ -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); + } +} diff --git a/main/java/ella/techia/block/entity/.BoxBlockEntity.java.kate-swp b/main/java/ella/techia/block/entity/.BoxBlockEntity.java.kate-swp index 181fd7a1716b1941f1b5ff8f3dc5f05c3627fa3d..6cb5c3d107a6e69add84cbe52a467a298978303f 100644 GIT binary patch literal 1617 zcmb7^NlODk5QS%4&?K%g(YQx(!-I&2AgIR?q6p$BqTnHhL4%0|9To5XO#g%@uhy$f z`Pzkufj)exdatUhEAc!pyI+Z;V)#^P7I$m)sJOAV?s;CWbo%~s)baA#zu8#2Tt1)Q zE>+*cBZ+j#8IqF^KCvHP1z|af0{xIY0B(>6!4Vm5evLc~zN0-jOGNrGvsGOut6JQw z*Fb3AP6sIlUsF0IvL|Q1 zRTGHhy;e;_ztldw**+}lQ!$0x1>C#j;Nz!SWxzg8lZ=P9NgxjH{1%pLnjO6HikQ3E zby*PJJ0BK&l)^jWDiMZ`gz`r!yekzAKtI%Ly9|-?k6m(>*5= zUs|#&<-ymKgGc`i+j!w7{|RQM=3-{7=1#Fu6kB64@EFrI{7fE0y0Z%4LVLBd%BHqv z3UG7gIu4$r9e9GpHM~Qf_$HqOJ9|3?PW}P#F5qdpBYlc)s&+O{)z0Qj!_E2C%z$O{ uZ1B*}+RXsJZPEfnGH%OT1PA0L@Bw)le8?imUvb6V!NKA283n5lYy}^un3XmF delta 7 Ocmcb}vx8}a1tS0qCjx;0 diff --git a/main/java/ella/techia/leti/LetiNetwork.java b/main/java/ella/techia/leti/LetiNetwork.java new file mode 100644 index 0000000..0d42a4d --- /dev/null +++ b/main/java/ella/techia/leti/LetiNetwork.java @@ -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, LetiNetwork> networks = Maps.newHashMap(); + private ServerWorld world; + + ArrayList 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 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(world, pos), new LetiNetwork(world, pos)); + } + } + + private void add(BlockPos pos){ + nodes.add(pos); + networks.set(new Entry(world, pos), this); + } + private void remove(BlockPos pos){ + nodes.remove(pos); + networks.remove(new Entry(world, pos)); + } + + private void mergeWith(LetiNetwork network){ + for(BlockPos pos : nodes){ + Entry 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 neighbors(BlockPos pos){ + BlockPos fpos = pos.toImmutable(); + return new AbstractEntry(){ + @Override + public Iterator iterator() { + return new AbstractIterator(){ + private final BlockPos.Mutable mut = new BlockPos.Mutable(); + private final Iterator 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(); + } + }; + } +} diff --git a/main/java/ella/techia/registry/.TechiaRegistry.java.kate-swp b/main/java/ella/techia/registry/.TechiaRegistry.java.kate-swp deleted file mode 100644 index d31c65372ea0e4581af23fcaf22724db1cf9d51e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10382 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 diff --git a/main/java/ella/techia/registry/TechiaRegistry.java b/main/java/ella/techia/registry/TechiaRegistry.java index 0409657..e7f4c87 100644 --- a/main/java/ella/techia/registry/TechiaRegistry.java +++ b/main/java/ella/techia/registry/TechiaRegistry.java @@ -2,6 +2,7 @@ package ella.techia.registry; import ella.techia.Techia; import ella.techia.block.*; +import ella.techia.block.entity.*; //import net.fabricmc.api.FabricLoader; import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings; import net.fabricmc.fabric.api.registry.FlammableBlockRegistry; @@ -29,73 +30,27 @@ public class TechiaRegistry { 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 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 INTERSECTOR = add("intersector", new Intersector(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)), ItemGroup.MISC); - 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 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)), Techia.LETI); NOPE + 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)), 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 SMELTER_ENTITY; 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 Block NONBINARY_BLOCK = add("nonbinary_block", - new EFacingBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).mapColor(MapColor.WHITE)), ItemGroup.BUILDING_BLOCKS); + public static final Block BOX_BLOCK = add("box", new BoxBlock(FabricBlockSettings.copyOf(Blocks.OAK_PLANKS).hardness(0.5f)), ItemGroup.MISC); + public static BlockEntityType 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 WORKBENCH_BLOCK_ENTITY; - /*public static final Block SPARKWOOD_LADDER = add("sparkwood_ladder", - new SparkwoodLadderBlock(FabricBlockSettings.copyOf(Blocks.LADDER)), ItemGroup.DECORATIONS);*/ - /*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 PISTON = add("piston", + new Block(FabricBlockSettings.copyOf(Blocks.IRON_BLOCK)), Techia.LETI); - public static final Block STONE_BRICK_TILES = add("stone_brick_tiles", - new Block(FabricBlockSettings.copyOf(Blocks.STONE_BRICKS)), ItemGroup.BUILDING_BLOCKS); - - 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);*/ + public static final RecipeType WORKBENCH_RECIPE = RecipeType.register(new Identifier(Techia.MOD_ID, "smelting")); + public static final RecipeType WORKBENCH_RECIPE = RecipeType.register(new Identifier(Techia.MOD_ID, "workbench")); private static B add(String name, B block, ItemGroup 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()){ - Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, id), ITEMS.get(id)); + register(id), ITEMS.get(id)); } 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(); // could be bad? maybe don't use hash maps? //BLOCKS = null; //ITEMS = null; - Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "asmite_block"), ASMITE_BLOCK); - Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "asmite_ingot"), ASMITE_INGOT); - Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "letium"), LETIUM); - Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "connector"), CONNECTOR); - Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "intersector"), INTERSECTOR); - Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "inverter"), INVERTER); - Registry.register(Registry.BLOCK, new Identifier(Techia.MOD_ID, "delayer"), DELAYER); - Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "block_shape"), BLOCK_SHAPE); - Registry.register(Registry.ITEM, new Identifier(Techia.MOD_ID, "ingot_shape"), INGOT_SHAPE); + register("asmite_block", ASMITE_BLOCK); + register("asmite_ingot", ASMITE_INGOT); + register("letium", LETIUM); + register("connector", CONNECTOR); + //register("intersector", INTERSECTOR); NOPE + register("inverter", INVERTER); + register("delayer", DELAYER); + //register("leti_source", LETI_SOURCE); + //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) { diff --git a/main/resources/assets/techia/lang/en_us.json b/main/resources/assets/techia/lang/en_us.json new file mode 100644 index 0000000..199ad7a --- /dev/null +++ b/main/resources/assets/techia/lang/en_us.json @@ -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"} diff --git a/main/resources/assets/techia/lang/sv_se.json b/main/resources/assets/techia/lang/sv_se.json new file mode 100644 index 0000000..6d857ca --- /dev/null +++ b/main/resources/assets/techia/lang/sv_se.json @@ -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"}