mirror of
https://github.com/XevianLight/Aphelion.git
synced 2026-05-11 01:50:56 +01:00
Things n stuff
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
// 1.21.1 2026-01-28T08:47:15.3186366 Loot Tables
|
// 1.21.1 2026-02-04T21:03:31.3164337 Loot Tables
|
||||||
// 1.21.1 2026-01-26T19:04:46.4976369 Loot Tables
|
|
||||||
69d8318ddba171526d1fabb87d9d93548ed8598e data/aphelion/loot_table/blocks/arc_furnace_casing.json
|
69d8318ddba171526d1fabb87d9d93548ed8598e data/aphelion/loot_table/blocks/arc_furnace_casing.json
|
||||||
05f08985e601d30116f67e2f07b48b03b40cdca6 data/aphelion/loot_table/blocks/block_steel.json
|
05f08985e601d30116f67e2f07b48b03b40cdca6 data/aphelion/loot_table/blocks/block_steel.json
|
||||||
ff43a9c3741faf10b1e156a7a74d5cfb035cc118 data/aphelion/loot_table/blocks/dimension_changer.json
|
ff43a9c3741faf10b1e156a7a74d5cfb035cc118 data/aphelion/loot_table/blocks/dimension_changer.json
|
||||||
b63130d9c10485676303d729807b6fcaac080294 data/aphelion/loot_table/blocks/electric_arc_furnace.json
|
b63130d9c10485676303d729807b6fcaac080294 data/aphelion/loot_table/blocks/electric_arc_furnace.json
|
||||||
afb6519a03415b8e0d5bafc9fadb70905a398046 data/aphelion/loot_table/blocks/oxygen_test_block.json
|
|
||||||
b9cfe672ead8e2673a7b2f5c4cec831e7e8e7040 data/aphelion/loot_table/blocks/launch_pad.json
|
b9cfe672ead8e2673a7b2f5c4cec831e7e8e7040 data/aphelion/loot_table/blocks/launch_pad.json
|
||||||
|
afb6519a03415b8e0d5bafc9fadb70905a398046 data/aphelion/loot_table/blocks/oxygen_test_block.json
|
||||||
|
f3178154dadee30cc28f5ff23af45be98f2766cf data/aphelion/loot_table/blocks/rocket_assembler_block.json
|
||||||
1ab50c99e9f478840b9d003fd56ebdcab12fbbce data/aphelion/loot_table/blocks/test_block.json
|
1ab50c99e9f478840b9d003fd56ebdcab12fbbce data/aphelion/loot_table/blocks/test_block.json
|
||||||
7d8eeb99a1bc942a6e2cf292b21fd4534062b5ab data/aphelion/loot_table/blocks/vacuum_arc_furnace_controller.json
|
7d8eeb99a1bc942a6e2cf292b21fd4534062b5ab data/aphelion/loot_table/blocks/vacuum_arc_furnace_controller.json
|
||||||
797bf9839d79e08b4832c9eaf3cb303b0471ed0c data/aphelion/loot_table/blocks/vaf_dummy_block.json
|
797bf9839d79e08b4832c9eaf3cb303b0471ed0c data/aphelion/loot_table/blocks/vaf_dummy_block.json
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
// 1.21.1 2026-01-28T08:47:15.3176368 Block States: aphelion
|
// 1.21.1 2026-02-04T21:03:31.3154339 Block States: aphelion
|
||||||
// 1.21.1 2026-01-26T20:40:43.8251623 Block States: aphelion
|
|
||||||
851ff42f7b21dec86107c8e0cefb3934ae4ebc08 assets/aphelion/blockstates/block_steel.json
|
851ff42f7b21dec86107c8e0cefb3934ae4ebc08 assets/aphelion/blockstates/block_steel.json
|
||||||
30b9c0efd7aaadb5412d98e4568f98b3632adbb9 assets/aphelion/blockstates/dimension_changer.json
|
30b9c0efd7aaadb5412d98e4568f98b3632adbb9 assets/aphelion/blockstates/dimension_changer.json
|
||||||
cb4287104006c80c8396b290ab5258df65d62cef assets/aphelion/blockstates/electric_arc_furnace.json
|
cb4287104006c80c8396b290ab5258df65d62cef assets/aphelion/blockstates/electric_arc_furnace.json
|
||||||
28131a570d3666b7f323de4ad8a69e52ceec92e2 assets/aphelion/blockstates/oxygen_test_block.json
|
28131a570d3666b7f323de4ad8a69e52ceec92e2 assets/aphelion/blockstates/oxygen_test_block.json
|
||||||
|
85c7c0dab53d0219b315c822147a90ade9075844 assets/aphelion/blockstates/rocket_assembler_block.json
|
||||||
b86c50fddcf6c8c6c19cb748529239d5962a3ede assets/aphelion/blockstates/test_block.json
|
b86c50fddcf6c8c6c19cb748529239d5962a3ede assets/aphelion/blockstates/test_block.json
|
||||||
a810b97f4dace35d026f28d96cb9c47c93600d75 assets/aphelion/models/block/block_steel.json
|
a810b97f4dace35d026f28d96cb9c47c93600d75 assets/aphelion/models/block/block_steel.json
|
||||||
2d3592b7ab7132908709243e97540151e0fb762e assets/aphelion/models/block/dimension_changer.json
|
2d3592b7ab7132908709243e97540151e0fb762e assets/aphelion/models/block/dimension_changer.json
|
||||||
5f7e8674070f31a63875b5d6147153bfa0eef61a assets/aphelion/models/block/electric_arc_furnace.json
|
5f7e8674070f31a63875b5d6147153bfa0eef61a assets/aphelion/models/block/electric_arc_furnace.json
|
||||||
746f23f150a01524ad03cbd1eb822bfbb7cf453b assets/aphelion/models/block/oxygen_test_block.json
|
746f23f150a01524ad03cbd1eb822bfbb7cf453b assets/aphelion/models/block/oxygen_test_block.json
|
||||||
|
17eb7327e504f7a88028af804e046281d9719fdf assets/aphelion/models/block/rocket_assembler_block.json
|
||||||
e0971228b4a1c4bc9dbab58a7dacdc3ae6037e02 assets/aphelion/models/block/test_block.json
|
e0971228b4a1c4bc9dbab58a7dacdc3ae6037e02 assets/aphelion/models/block/test_block.json
|
||||||
cdc831b0f1c462be64825fd34bd446e5b95afac6 assets/aphelion/models/item/arc_furnace_casing.json
|
cdc831b0f1c462be64825fd34bd446e5b95afac6 assets/aphelion/models/item/arc_furnace_casing.json
|
||||||
3599f9037eb2f66de1765318b97ab564c3eae92f assets/aphelion/models/item/block_steel.json
|
3599f9037eb2f66de1765318b97ab564c3eae92f assets/aphelion/models/item/block_steel.json
|
||||||
db0ec473a016ce05c258cde18a217d47a9ea8324 assets/aphelion/models/item/dimension_changer.json
|
db0ec473a016ce05c258cde18a217d47a9ea8324 assets/aphelion/models/item/dimension_changer.json
|
||||||
279080c06ada87f54fd0a7b885b256dbe25a946a assets/aphelion/models/item/electric_arc_furnace.json
|
279080c06ada87f54fd0a7b885b256dbe25a946a assets/aphelion/models/item/electric_arc_furnace.json
|
||||||
24cf60e70f7d9450b0e70cf017662e80971bae17 assets/aphelion/models/item/oxygen_test_block.json
|
24cf60e70f7d9450b0e70cf017662e80971bae17 assets/aphelion/models/item/oxygen_test_block.json
|
||||||
|
dafa6e1a3cfd753e211ae94179a433c69e9d2a28 assets/aphelion/models/item/rocket_assembler_block.json
|
||||||
74418ef1cf678e72e7534924274688ef5a68af0e assets/aphelion/models/item/test_block.json
|
74418ef1cf678e72e7534924274688ef5a68af0e assets/aphelion/models/item/test_block.json
|
||||||
88ca3602517e99f7feaed57eddfc96965a25761c assets/aphelion/models/item/vacuum_arc_furnace_controller.json
|
88ca3602517e99f7feaed57eddfc96965a25761c assets/aphelion/models/item/vacuum_arc_furnace_controller.json
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
|||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.neoforged.neoforge.items.ItemStackHandler;
|
import net.neoforged.neoforge.items.ItemStackHandler;
|
||||||
|
import net.xevianlight.aphelion.block.custom.base.BasicEntityBlock;
|
||||||
|
import net.xevianlight.aphelion.block.custom.base.BasicHorizontalEntityBlock;
|
||||||
import net.xevianlight.aphelion.block.entity.custom.ElectricArcFurnaceEntity;
|
import net.xevianlight.aphelion.block.entity.custom.ElectricArcFurnaceEntity;
|
||||||
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
||||||
import net.xevianlight.aphelion.util.AphelionBlockStateProperties;
|
import net.xevianlight.aphelion.util.AphelionBlockStateProperties;
|
||||||
@@ -34,14 +36,14 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class ElectricArcFurnace extends BaseEntityBlock {
|
public class ElectricArcFurnace extends BasicHorizontalEntityBlock {
|
||||||
|
|
||||||
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||||
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
||||||
public static final BooleanProperty FORMED = AphelionBlockStateProperties.FORMED;
|
public static final BooleanProperty FORMED = AphelionBlockStateProperties.FORMED;
|
||||||
|
|
||||||
public ElectricArcFurnace(Properties properties) {
|
public ElectricArcFurnace(Properties properties) {
|
||||||
super(properties);
|
super(properties, true);
|
||||||
this.registerDefaultState(this.getStateDefinition().any()
|
this.registerDefaultState(this.getStateDefinition().any()
|
||||||
.setValue(FORMED, false));
|
.setValue(FORMED, false));
|
||||||
}
|
}
|
||||||
@@ -164,25 +166,6 @@ public class ElectricArcFurnace extends BaseEntityBlock {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
|
|
||||||
if (level.isClientSide) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return createTickerHelper(blockEntityType, ModBlockEntities.ELECTRIC_ARC_FURNACE_ENTITY.get(), (level1, blockPos, blockState, electricArcFurnaceEntity) -> electricArcFurnaceEntity.tick(level1, blockPos, blockState));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockState rotate(BlockState state, Rotation rotation) {
|
|
||||||
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockState mirror(BlockState state, Mirror mirror) {
|
|
||||||
return state.rotate(mirror.getRotation(state.getValue(FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockState getStateForPlacement(BlockPlaceContext context) {
|
public @Nullable BlockState getStateForPlacement(BlockPlaceContext context) {
|
||||||
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false).setValue(FORMED, false);
|
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false).setValue(FORMED, false);
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import net.minecraft.world.item.ItemStack;
|
|||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.*;
|
import net.minecraft.world.level.block.BaseEntityBlock;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.SoundType;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityTicker;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
import net.minecraft.world.level.block.state.StateDefinition;
|
import net.minecraft.world.level.block.state.StateDefinition;
|
||||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
@@ -25,25 +25,25 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
|||||||
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
import net.minecraft.world.level.block.state.properties.DirectionProperty;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import net.neoforged.neoforge.items.ItemStackHandler;
|
import net.neoforged.neoforge.items.ItemStackHandler;
|
||||||
import net.xevianlight.aphelion.block.entity.custom.ElectricArcFurnaceEntity;
|
import net.xevianlight.aphelion.block.custom.base.BasicHorizontalEntityBlock;
|
||||||
import net.xevianlight.aphelion.block.entity.custom.VacuumArcFurnaceControllerEntity;
|
import net.xevianlight.aphelion.block.entity.custom.VacuumArcFurnaceControllerEntity;
|
||||||
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
|
||||||
import net.xevianlight.aphelion.util.AphelionBlockStateProperties;
|
import net.xevianlight.aphelion.util.AphelionBlockStateProperties;
|
||||||
import net.xevianlight.aphelion.util.IMultiblockController;
|
import net.xevianlight.aphelion.util.IMultiblockController;
|
||||||
import net.xevianlight.aphelion.util.MultiblockHelper;
|
import net.xevianlight.aphelion.util.MultiblockHelper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class VacuumArcFurnaceController extends BaseEntityBlock {
|
public class VacuumArcFurnaceController extends BasicHorizontalEntityBlock {
|
||||||
|
|
||||||
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
|
||||||
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
public static final BooleanProperty LIT = BlockStateProperties.LIT;
|
||||||
public static final BooleanProperty FORMED = AphelionBlockStateProperties.FORMED;
|
public static final BooleanProperty FORMED = AphelionBlockStateProperties.FORMED;
|
||||||
|
|
||||||
public VacuumArcFurnaceController(Properties properties) {
|
public VacuumArcFurnaceController(Properties properties) {
|
||||||
super(properties);
|
super(properties, true);
|
||||||
this.registerDefaultState(this.getStateDefinition().any()
|
this.registerDefaultState(this.getStateDefinition().any()
|
||||||
.setValue(FACING, Direction.NORTH)
|
.setValue(FACING, Direction.NORTH)
|
||||||
.setValue(LIT, false)
|
.setValue(LIT, false)
|
||||||
@@ -77,7 +77,7 @@ public class VacuumArcFurnaceController extends BaseEntityBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InteractionResult useWithoutItem(BlockState state, Level level, BlockPos pos, Player player, BlockHitResult result) {
|
public @NotNull InteractionResult useWithoutItem(@NotNull BlockState state, Level level, @NotNull BlockPos pos, @NotNull Player player, @NotNull BlockHitResult result) {
|
||||||
if (!level.isClientSide && player instanceof ServerPlayer serverPlayer && level.getBlockEntity(pos) instanceof VacuumArcFurnaceControllerEntity vacuumArcFurnaceEntity) {
|
if (!level.isClientSide && player instanceof ServerPlayer serverPlayer && level.getBlockEntity(pos) instanceof VacuumArcFurnaceControllerEntity vacuumArcFurnaceEntity) {
|
||||||
if (vacuumArcFurnaceEntity.isFormed())
|
if (vacuumArcFurnaceEntity.isFormed())
|
||||||
serverPlayer.openMenu(new SimpleMenuProvider(vacuumArcFurnaceEntity, Component.literal("Vacuum Arc Furnace")), pos);
|
serverPlayer.openMenu(new SimpleMenuProvider(vacuumArcFurnaceEntity, Component.literal("Vacuum Arc Furnace")), pos);
|
||||||
@@ -88,21 +88,16 @@ public class VacuumArcFurnaceController extends BaseEntityBlock {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockEntity newBlockEntity(BlockPos blockPos, BlockState blockState) {
|
public @Nullable BlockEntity newBlockEntity(@NotNull BlockPos blockPos, @NotNull BlockState blockState) {
|
||||||
return new VacuumArcFurnaceControllerEntity(blockPos, blockState);
|
return new VacuumArcFurnaceControllerEntity(blockPos, blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderShape getRenderShape(BlockState pState) {
|
protected void onRemove(BlockState state, Level level, @NotNull BlockPos pos, BlockState newState, boolean movedByPiston) {
|
||||||
return RenderShape.MODEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean movedByPiston) {
|
|
||||||
if (!level.isClientSide && state.getBlock() != newState.getBlock()) {
|
if (!level.isClientSide && state.getBlock() != newState.getBlock()) {
|
||||||
BlockEntity blockEntity= level.getBlockEntity(pos);
|
BlockEntity blockEntity= level.getBlockEntity(pos);
|
||||||
if (blockEntity instanceof VacuumArcFurnaceControllerEntity vacuumArcFurnaceEntity) {
|
if (blockEntity instanceof VacuumArcFurnaceControllerEntity vacuumArcFurnaceEntity) {
|
||||||
if(state.getValue(FORMED)) MultiblockHelper.unformForRemoval(level, state, pos, vacuumArcFurnaceEntity.SHAPE, AphelionBlockStateProperties.FORMED);
|
if(state.getValue(FORMED)) MultiblockHelper.unformForRemoval(level, state, pos, VacuumArcFurnaceControllerEntity.SHAPE, AphelionBlockStateProperties.FORMED);
|
||||||
vacuumArcFurnaceEntity.drops();
|
vacuumArcFurnaceEntity.drops();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,7 +105,7 @@ public class VacuumArcFurnaceController extends BaseEntityBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) {
|
protected void onPlace(BlockState state, Level level, @NotNull BlockPos pos, @NotNull BlockState oldState, boolean movedByPiston) {
|
||||||
super.onPlace(state, level, pos, oldState, movedByPiston);
|
super.onPlace(state, level, pos, oldState, movedByPiston);
|
||||||
if (!level.isClientSide() && oldState.getBlock() != state.getBlock()) {
|
if (!level.isClientSide() && oldState.getBlock() != state.getBlock()) {
|
||||||
BlockEntity blockEntity= level.getBlockEntity(pos);
|
BlockEntity blockEntity= level.getBlockEntity(pos);
|
||||||
@@ -120,7 +115,7 @@ public class VacuumArcFurnaceController extends BaseEntityBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getRedstoneSignalFromItemHandler(@javax.annotation.Nullable ItemStackHandler itemStackHandler, List<Integer> slots) {
|
public static int getRedstoneSignalFromItemHandler(@Nullable ItemStackHandler itemStackHandler, List<Integer> slots) {
|
||||||
if (itemStackHandler == null) {
|
if (itemStackHandler == null) {
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -141,22 +136,22 @@ public class VacuumArcFurnaceController extends BaseEntityBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isSignalSource(BlockState state) {
|
protected boolean isSignalSource(@NotNull BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getSignal(BlockState state, BlockGetter level, BlockPos pos, Direction direction) {
|
protected int getSignal(@NotNull BlockState state, @NotNull BlockGetter level, @NotNull BlockPos pos, @NotNull Direction direction) {
|
||||||
return super.getSignal(state, level, pos, direction);
|
return super.getSignal(state, level, pos, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean hasAnalogOutputSignal(BlockState state) {
|
protected boolean hasAnalogOutputSignal(@NotNull BlockState state) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected int getAnalogOutputSignal(BlockState blockState, Level level, BlockPos pos) {
|
protected int getAnalogOutputSignal(@NotNull BlockState blockState, Level level, @NotNull BlockPos pos) {
|
||||||
List<Integer> slots = new ArrayList<>();
|
List<Integer> slots = new ArrayList<>();
|
||||||
slots.add(VacuumArcFurnaceControllerEntity.INPUT_SLOT);
|
slots.add(VacuumArcFurnaceControllerEntity.INPUT_SLOT);
|
||||||
slots.add(VacuumArcFurnaceControllerEntity.SECONDARY_INPUT_SLOT);
|
slots.add(VacuumArcFurnaceControllerEntity.SECONDARY_INPUT_SLOT);
|
||||||
@@ -169,25 +164,6 @@ public class VacuumArcFurnaceController extends BaseEntityBlock {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public @Nullable <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> blockEntityType) {
|
|
||||||
if (level.isClientSide) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return createTickerHelper(blockEntityType, ModBlockEntities.VACUUM_ARC_FURNACE_ENTITY.get(), (level1, blockPos, blockState, vacuumArcFurnaceEntity) -> vacuumArcFurnaceEntity.tick(level1, blockPos, blockState));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockState rotate(BlockState state, Rotation rotation) {
|
|
||||||
return state.setValue(FACING, rotation.rotate(state.getValue(FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockState mirror(BlockState state, Mirror mirror) {
|
|
||||||
return state.rotate(mirror.getRotation(state.getValue(FACING)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public @Nullable BlockState getStateForPlacement(BlockPlaceContext context) {
|
public @Nullable BlockState getStateForPlacement(BlockPlaceContext context) {
|
||||||
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false).setValue(FORMED, false);
|
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false).setValue(FORMED, false);
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import net.minecraft.world.level.Level;
|
|||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
public interface TickableBlockEntity {
|
public interface TickableBlockEntity {
|
||||||
void tick(Level entityLevel, long time, BlockState blockState, BlockPos pos);
|
|
||||||
|
|
||||||
void clientTick(ClientLevel level, long time, BlockState state, BlockPos pos);
|
void clientTick(ClientLevel level, long time, BlockState state, BlockPos pos);
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.xevianlight.aphelion.block.entity.custom;
|
package net.xevianlight.aphelion.block.entity.custom;
|
||||||
|
|
||||||
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
@@ -8,6 +9,7 @@ import net.minecraft.network.chat.Component;
|
|||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
import net.minecraft.world.MenuProvider;
|
import net.minecraft.world.MenuProvider;
|
||||||
import net.minecraft.world.SimpleContainer;
|
import net.minecraft.world.SimpleContainer;
|
||||||
@@ -25,6 +27,7 @@ import net.neoforged.neoforge.energy.IEnergyStorage;
|
|||||||
import net.neoforged.neoforge.items.IItemHandler;
|
import net.neoforged.neoforge.items.IItemHandler;
|
||||||
import net.neoforged.neoforge.items.ItemStackHandler;
|
import net.neoforged.neoforge.items.ItemStackHandler;
|
||||||
import net.xevianlight.aphelion.block.custom.ElectricArcFurnace;
|
import net.xevianlight.aphelion.block.custom.ElectricArcFurnace;
|
||||||
|
import net.xevianlight.aphelion.block.custom.base.TickableBlockEntity;
|
||||||
import net.xevianlight.aphelion.block.entity.energy.ModEnergyStorage;
|
import net.xevianlight.aphelion.block.entity.energy.ModEnergyStorage;
|
||||||
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
||||||
import net.xevianlight.aphelion.core.init.ModBlocks;
|
import net.xevianlight.aphelion.core.init.ModBlocks;
|
||||||
@@ -39,7 +42,7 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvider {
|
public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvider, TickableBlockEntity {
|
||||||
|
|
||||||
private final int SIZE = 4;
|
private final int SIZE = 4;
|
||||||
private int ENERGY_CAPACITY = 64000;
|
private int ENERGY_CAPACITY = 64000;
|
||||||
@@ -101,10 +104,8 @@ public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvide
|
|||||||
// }
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
public void tick(Level level, BlockPos pos, BlockState blockState) {
|
@Override
|
||||||
|
public void serverTick(ServerLevel level, long time, BlockState state, BlockPos pos) {
|
||||||
if (!blockState.getValue(AphelionBlockStateProperties.FORMED))
|
|
||||||
return;
|
|
||||||
|
|
||||||
chargeFromItem();
|
chargeFromItem();
|
||||||
|
|
||||||
@@ -114,8 +115,8 @@ public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvide
|
|||||||
// Recipe detected! We have enough energy to process
|
// Recipe detected! We have enough energy to process
|
||||||
progress++;
|
progress++;
|
||||||
useEnergy();
|
useEnergy();
|
||||||
level.setBlockAndUpdate(pos, blockState.setValue(ElectricArcFurnace.LIT, true));
|
level.setBlockAndUpdate(pos, state.setValue(ElectricArcFurnace.LIT, true));
|
||||||
setChanged(level, pos, blockState);
|
setChanged(level, pos, state);
|
||||||
|
|
||||||
if (hasCraftingFinished()) {
|
if (hasCraftingFinished()) {
|
||||||
outputBlastingResult(INPUT_SLOT, OUTPUT_SLOT);
|
outputBlastingResult(INPUT_SLOT, OUTPUT_SLOT);
|
||||||
@@ -123,14 +124,14 @@ public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvide
|
|||||||
}
|
}
|
||||||
} else if (hasFurnaceRecipe(INPUT_SLOT) && !hasEnoughEnergyToCraft(MACHINE_ENERGY_COST)) {
|
} else if (hasFurnaceRecipe(INPUT_SLOT) && !hasEnoughEnergyToCraft(MACHINE_ENERGY_COST)) {
|
||||||
// Recipe detected but we ran out of power
|
// Recipe detected but we ran out of power
|
||||||
level.setBlockAndUpdate(pos, blockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, state.setValue(ElectricArcFurnace.LIT, false));
|
||||||
setChanged(level, pos, blockState);
|
setChanged(level, pos, state);
|
||||||
progress = progress > 0 ? progress - 1 : 0;
|
progress = progress > 0 ? progress - 1 : 0;
|
||||||
} else {
|
} else {
|
||||||
// Invalid recipe
|
// Invalid recipe
|
||||||
resetProgress();
|
resetProgress();
|
||||||
level.setBlockAndUpdate(pos, blockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, state.setValue(ElectricArcFurnace.LIT, false));
|
||||||
setChanged(level, pos, blockState);
|
setChanged(level, pos, state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Secondary slot is NOT empty, try alloying recipes
|
// Secondary slot is NOT empty, try alloying recipes
|
||||||
@@ -139,8 +140,8 @@ public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvide
|
|||||||
// Alloy recipe detected! We have enough energy to process
|
// Alloy recipe detected! We have enough energy to process
|
||||||
progress++;
|
progress++;
|
||||||
useEnergy();
|
useEnergy();
|
||||||
level.setBlockAndUpdate(pos, blockState.setValue(ElectricArcFurnace.LIT, true));
|
level.setBlockAndUpdate(pos, state.setValue(ElectricArcFurnace.LIT, true));
|
||||||
setChanged(level, pos, blockState);
|
setChanged(level, pos, state);
|
||||||
|
|
||||||
if (hasCraftingFinished()) {
|
if (hasCraftingFinished()) {
|
||||||
outputAlloyingResult(INPUT_SLOT, SECONDARY_INPUT_SLOT, OUTPUT_SLOT);
|
outputAlloyingResult(INPUT_SLOT, SECONDARY_INPUT_SLOT, OUTPUT_SLOT);
|
||||||
@@ -148,19 +149,17 @@ public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvide
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Recipe detected but we ran out of power
|
// Recipe detected but we ran out of power
|
||||||
level.setBlockAndUpdate(pos, blockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, state.setValue(ElectricArcFurnace.LIT, false));
|
||||||
setChanged(level, pos, blockState);
|
setChanged(level, pos, state);
|
||||||
progress = progress > 0 ? progress - 1 : 0;
|
progress = progress > 0 ? progress - 1 : 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Invalid recipe
|
// Invalid recipe
|
||||||
resetProgress();
|
resetProgress();
|
||||||
level.setBlockAndUpdate(pos, blockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, state.setValue(ElectricArcFurnace.LIT, false));
|
||||||
setChanged(level, pos, blockState);
|
setChanged(level, pos, state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void chargeFromItem() {
|
private void chargeFromItem() {
|
||||||
@@ -408,4 +407,14 @@ public class ElectricArcFurnaceEntity extends BlockEntity implements MenuProvide
|
|||||||
new MultiblockHelper.ShapePart(new BlockPos(3,0,3), s -> s.is(ModBlocks.ARC_FURNACE_CASING_BLOCK)),
|
new MultiblockHelper.ShapePart(new BlockPos(3,0,3), s -> s.is(ModBlocks.ARC_FURNACE_CASING_BLOCK)),
|
||||||
// new MultiblockHelper.ShapePart(new BlockPos(-1,0,0), s -> s.is(Blocks.AMETHYST_BLOCK))
|
// new MultiblockHelper.ShapePart(new BlockPos(-1,0,0), s -> s.is(Blocks.AMETHYST_BLOCK))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientTick(ClientLevel level, long time, BlockState state, BlockPos pos) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void firstTick(Level level, BlockState state, BlockPos pos) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,23 @@ package net.xevianlight.aphelion.block.entity.custom;
|
|||||||
|
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.server.level.ServerLevel;
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntityType;
|
|
||||||
import net.minecraft.world.level.block.state.BlockState;
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||||
import net.xevianlight.aphelion.block.custom.base.TickableBlockEntity;
|
import net.xevianlight.aphelion.block.custom.base.TickableBlockEntity;
|
||||||
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
||||||
|
import net.xevianlight.aphelion.util.ModTags;
|
||||||
import net.xevianlight.aphelion.util.RocketStructure;
|
import net.xevianlight.aphelion.util.RocketStructure;
|
||||||
import org.apache.commons.lang3.NotImplementedException;
|
import org.apache.commons.lang3.NotImplementedException;
|
||||||
|
|
||||||
public class RocketAssemblerBlockEntity extends BlockEntity implements TickableBlockEntity {
|
public class RocketAssemblerBlockEntity extends BlockEntity implements TickableBlockEntity {
|
||||||
|
|
||||||
|
Direction facing;
|
||||||
|
BlockPos padScanStart = BlockPos.ZERO;
|
||||||
|
|
||||||
public boolean isInitialized;
|
public boolean isInitialized;
|
||||||
@Override
|
@Override
|
||||||
public boolean isInitialized() {
|
public boolean isInitialized() {
|
||||||
@@ -24,13 +29,45 @@ public class RocketAssemblerBlockEntity extends BlockEntity implements TickableB
|
|||||||
super(ModBlockEntities.ROCKET_ASSEMBLER_BLOCK_ENTITY.get(), pos, blockState);
|
super(ModBlockEntities.ROCKET_ASSEMBLER_BLOCK_ENTITY.get(), pos, blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick(Level level1, BlockPos blockPos, BlockState blockState) {
|
public record PadInfo(BlockPos min, BlockPos max, int size) {};
|
||||||
|
|
||||||
}
|
public PadInfo getPlatform() {
|
||||||
|
|
||||||
public boolean getPlatform() {
|
|
||||||
// TODO
|
// TODO
|
||||||
throw new NotImplementedException();
|
int y = this.padScanStart.getY();
|
||||||
|
BlockPos start = this.padScanStart;
|
||||||
|
|
||||||
|
if (level == null) return null;
|
||||||
|
if (!isPad(level.getBlockState(start))) return null;
|
||||||
|
|
||||||
|
int minX = start.getX();
|
||||||
|
while (isPad(level.getBlockState(new BlockPos(minX - 1, y, start.getZ())))) minX--;
|
||||||
|
|
||||||
|
// Find maxX by walking east
|
||||||
|
int maxX = start.getX();
|
||||||
|
while (isPad(level.getBlockState(new BlockPos(maxX + 1, y, start.getZ())))) maxX++;
|
||||||
|
|
||||||
|
// Find minZ by walking north
|
||||||
|
int minZ = start.getZ();
|
||||||
|
while (isPad(level.getBlockState(new BlockPos(start.getX(), y, minZ - 1)))) minZ--;
|
||||||
|
|
||||||
|
// Find maxZ by walking south
|
||||||
|
int maxZ = start.getZ();
|
||||||
|
while (isPad(level.getBlockState(new BlockPos(start.getX(), y, maxZ + 1)))) maxZ++;
|
||||||
|
|
||||||
|
int width = (maxX - minX) + 1;
|
||||||
|
int length = (maxZ - minZ) + 1;
|
||||||
|
|
||||||
|
// Must be square
|
||||||
|
if (width != length) return null;
|
||||||
|
|
||||||
|
// Verify the entire rectangle is filled with pad blocks
|
||||||
|
for (int x = minX; x <= maxX; x++) {
|
||||||
|
for (int z = minZ; z <= maxZ; z++) {
|
||||||
|
if (!isPad(level.getBlockState(new BlockPos(x, y, z)))) return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new PadInfo(new BlockPos(minX, y, minZ), new BlockPos(maxX, y, maxZ), width);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RocketStructure scan() {
|
public RocketStructure scan() {
|
||||||
@@ -38,11 +75,6 @@ public class RocketAssemblerBlockEntity extends BlockEntity implements TickableB
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tick(Level entityLevel, long time, BlockState blockState, BlockPos pos) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clientTick(ClientLevel level, long time, BlockState state, BlockPos pos) {
|
public void clientTick(ClientLevel level, long time, BlockState state, BlockPos pos) {
|
||||||
|
|
||||||
@@ -55,6 +87,13 @@ public class RocketAssemblerBlockEntity extends BlockEntity implements TickableB
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void firstTick(Level level, BlockState state, BlockPos pos) {
|
public void firstTick(Level level, BlockState state, BlockPos pos) {
|
||||||
|
facing = getBlockState().getValue(BlockStateProperties.HORIZONTAL_FACING);
|
||||||
|
padScanStart = getBlockPos().mutable().below().relative(facing.getOpposite());
|
||||||
this.isInitialized = true;
|
this.isInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isPad(BlockState s) {
|
||||||
|
return s.is(ModTags.Blocks.LAUNCH_PAD); // or s.getBlock() == ModBlocks.PAD.get()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package net.xevianlight.aphelion.block.entity.custom;
|
package net.xevianlight.aphelion.block.entity.custom;
|
||||||
|
|
||||||
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.HolderLookup;
|
import net.minecraft.core.HolderLookup;
|
||||||
@@ -8,6 +9,7 @@ import net.minecraft.network.chat.Component;
|
|||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||||
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
import net.minecraft.network.protocol.game.ClientboundBlockEntityDataPacket;
|
||||||
|
import net.minecraft.server.level.ServerLevel;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
import net.minecraft.world.MenuProvider;
|
import net.minecraft.world.MenuProvider;
|
||||||
import net.minecraft.world.SimpleContainer;
|
import net.minecraft.world.SimpleContainer;
|
||||||
@@ -28,14 +30,14 @@ import net.neoforged.neoforge.capabilities.Capabilities;
|
|||||||
import net.neoforged.neoforge.energy.IEnergyStorage;
|
import net.neoforged.neoforge.energy.IEnergyStorage;
|
||||||
import net.neoforged.neoforge.items.IItemHandler;
|
import net.neoforged.neoforge.items.IItemHandler;
|
||||||
import net.neoforged.neoforge.items.ItemStackHandler;
|
import net.neoforged.neoforge.items.ItemStackHandler;
|
||||||
import net.xevianlight.aphelion.block.custom.ElectricArcFurnace;
|
import net.xevianlight.aphelion.block.custom.VacuumArcFurnaceController;
|
||||||
|
import net.xevianlight.aphelion.block.custom.base.TickableBlockEntity;
|
||||||
import net.xevianlight.aphelion.block.entity.energy.ModEnergyStorage;
|
import net.xevianlight.aphelion.block.entity.energy.ModEnergyStorage;
|
||||||
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
import net.xevianlight.aphelion.core.init.ModBlockEntities;
|
||||||
import net.xevianlight.aphelion.core.init.ModBlocks;
|
import net.xevianlight.aphelion.core.init.ModBlocks;
|
||||||
import net.xevianlight.aphelion.recipe.ElectricArcFurnaceRecipe;
|
import net.xevianlight.aphelion.recipe.ElectricArcFurnaceRecipe;
|
||||||
import net.xevianlight.aphelion.recipe.ElectricArcFurnaceRecipeInput;
|
import net.xevianlight.aphelion.recipe.ElectricArcFurnaceRecipeInput;
|
||||||
import net.xevianlight.aphelion.recipe.ModRecipes;
|
import net.xevianlight.aphelion.recipe.ModRecipes;
|
||||||
import net.xevianlight.aphelion.screen.VacuumArcFurnaceMenu;
|
|
||||||
import net.xevianlight.aphelion.screen.ElectricArcFurnaceMenu;
|
import net.xevianlight.aphelion.screen.ElectricArcFurnaceMenu;
|
||||||
import net.xevianlight.aphelion.util.AphelionBlockStateProperties;
|
import net.xevianlight.aphelion.util.AphelionBlockStateProperties;
|
||||||
import net.xevianlight.aphelion.util.IMultiblockController;
|
import net.xevianlight.aphelion.util.IMultiblockController;
|
||||||
@@ -45,16 +47,16 @@ import org.jetbrains.annotations.Nullable;
|
|||||||
|
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
public class VacuumArcFurnaceControllerEntity extends BlockEntity implements MenuProvider, IMultiblockController {
|
public class VacuumArcFurnaceControllerEntity extends BlockEntity implements MenuProvider, IMultiblockController, TickableBlockEntity {
|
||||||
|
|
||||||
private final int SIZE = 4;
|
private final int SIZE = 4;
|
||||||
private int ENERGY_CAPACITY = 64000;
|
private final int ENERGY_CAPACITY = 64000;
|
||||||
private int MAX_TRANSFER = 320;
|
private final int MAX_TRANSFER = 320;
|
||||||
private int progress = 0;
|
private int progress = 0;
|
||||||
private int maxProgress = 100;
|
private int maxProgress = 100;
|
||||||
private final int DEFAULT_MAX_PROGRESS = 100;
|
private final int DEFAULT_MAX_PROGRESS = 100;
|
||||||
private final ContainerData data;
|
private final ContainerData data;
|
||||||
private int MACHINE_ENERGY_COST = 20;
|
private final int MACHINE_ENERGY_COST = 20;
|
||||||
|
|
||||||
public static final int INPUT_SLOT = 0;
|
public static final int INPUT_SLOT = 0;
|
||||||
public static final int SECONDARY_INPUT_SLOT = 1;
|
public static final int SECONDARY_INPUT_SLOT = 1;
|
||||||
@@ -99,7 +101,7 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
@Override
|
@Override
|
||||||
protected void onContentsChanged(int slot) {
|
protected void onContentsChanged(int slot) {
|
||||||
setChanged();
|
setChanged();
|
||||||
if(!level.isClientSide()) {
|
if (level != null && !level.isClientSide()) {
|
||||||
level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 3);
|
level.sendBlockUpdated(getBlockPos(), getBlockState(), getBlockState(), 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,7 +116,8 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
// }
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
public void tick(Level level, BlockPos pos, BlockState blockState) {
|
@Override
|
||||||
|
public void serverTick(ServerLevel level, long time, BlockState state, BlockPos pos) {
|
||||||
|
|
||||||
if (dirty) {
|
if (dirty) {
|
||||||
dirty = false;
|
dirty = false;
|
||||||
@@ -124,7 +127,7 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
|
|
||||||
BlockState newBlockState = level.getBlockState(pos);
|
BlockState newBlockState = level.getBlockState(pos);
|
||||||
|
|
||||||
if (!blockState.getValue(AphelionBlockStateProperties.FORMED))
|
if (!state.getValue(AphelionBlockStateProperties.FORMED))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
chargeFromItem();
|
chargeFromItem();
|
||||||
@@ -135,7 +138,7 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
// Recipe detected! We have enough energy to process
|
// Recipe detected! We have enough energy to process
|
||||||
progress++;
|
progress++;
|
||||||
useEnergy();
|
useEnergy();
|
||||||
level.setBlockAndUpdate(pos, newBlockState.setValue(ElectricArcFurnace.LIT, true));
|
level.setBlockAndUpdate(pos, newBlockState.setValue(VacuumArcFurnaceController.LIT, true));
|
||||||
setChanged(level, pos, newBlockState);
|
setChanged(level, pos, newBlockState);
|
||||||
|
|
||||||
if (hasCraftingFinished()) {
|
if (hasCraftingFinished()) {
|
||||||
@@ -144,13 +147,13 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
}
|
}
|
||||||
} else if (hasFurnaceRecipe(INPUT_SLOT) && !hasEnoughEnergyToCraft(MACHINE_ENERGY_COST)) {
|
} else if (hasFurnaceRecipe(INPUT_SLOT) && !hasEnoughEnergyToCraft(MACHINE_ENERGY_COST)) {
|
||||||
// Recipe detected but we ran out of power
|
// Recipe detected but we ran out of power
|
||||||
level.setBlockAndUpdate(pos, newBlockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, newBlockState.setValue(VacuumArcFurnaceController.LIT, false));
|
||||||
setChanged(level, pos, newBlockState);
|
setChanged(level, pos, newBlockState);
|
||||||
progress = progress > 0 ? progress - 1 : 0;
|
progress = progress > 0 ? progress - 1 : 0;
|
||||||
} else {
|
} else {
|
||||||
// Invalid recipe
|
// Invalid recipe
|
||||||
resetProgress();
|
resetProgress();
|
||||||
level.setBlockAndUpdate(pos, newBlockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, newBlockState.setValue(VacuumArcFurnaceController.LIT, false));
|
||||||
setChanged(level, pos, newBlockState);
|
setChanged(level, pos, newBlockState);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -160,7 +163,7 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
// Alloy recipe detected! We have enough energy to process
|
// Alloy recipe detected! We have enough energy to process
|
||||||
progress++;
|
progress++;
|
||||||
useEnergy();
|
useEnergy();
|
||||||
level.setBlockAndUpdate(pos, newBlockState.setValue(ElectricArcFurnace.LIT, true));
|
level.setBlockAndUpdate(pos, newBlockState.setValue(VacuumArcFurnaceController.LIT, true));
|
||||||
setChanged(level, pos, newBlockState);
|
setChanged(level, pos, newBlockState);
|
||||||
|
|
||||||
if (hasCraftingFinished()) {
|
if (hasCraftingFinished()) {
|
||||||
@@ -169,14 +172,14 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Recipe detected but we ran out of power
|
// Recipe detected but we ran out of power
|
||||||
level.setBlockAndUpdate(pos, newBlockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, newBlockState.setValue(VacuumArcFurnaceController.LIT, false));
|
||||||
setChanged(level, pos, newBlockState);
|
setChanged(level, pos, newBlockState);
|
||||||
progress = progress > 0 ? progress - 1 : 0;
|
progress = progress > 0 ? progress - 1 : 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Invalid recipe
|
// Invalid recipe
|
||||||
resetProgress();
|
resetProgress();
|
||||||
level.setBlockAndUpdate(pos, newBlockState.setValue(ElectricArcFurnace.LIT, false));
|
level.setBlockAndUpdate(pos, newBlockState.setValue(VacuumArcFurnaceController.LIT, false));
|
||||||
setChanged(level, pos, newBlockState);
|
setChanged(level, pos, newBlockState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,7 +414,7 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
@Override
|
@Override
|
||||||
public @Nullable AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) {
|
public @Nullable AbstractContainerMenu createMenu(int i, Inventory inventory, Player player) {
|
||||||
if (isFormed())
|
if (isFormed())
|
||||||
return new VacuumArcFurnaceMenu(i, inventory, this, this.data);
|
return new ElectricArcFurnaceMenu(i, inventory, this, this.data);
|
||||||
return new ElectricArcFurnaceMenu(i, inventory, this, this.data);
|
return new ElectricArcFurnaceMenu(i, inventory, this, this.data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -527,4 +530,14 @@ public class VacuumArcFurnaceControllerEntity extends BlockEntity implements Men
|
|||||||
public void markDirty() {
|
public void markDirty() {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void clientTick(ClientLevel level, long time, BlockState state, BlockPos pos) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void firstTick(Level level, BlockState state, BlockPos pos) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,5 +19,5 @@ public class ModBlocks {
|
|||||||
public static final DeferredBlock<Block> VACUUM_ARC_FURNACE_CONTROLLER = BLOCKS.register("vacuum_arc_furnace_controller", () -> new VacuumArcFurnaceController(VacuumArcFurnaceController.getProperties()));
|
public static final DeferredBlock<Block> VACUUM_ARC_FURNACE_CONTROLLER = BLOCKS.register("vacuum_arc_furnace_controller", () -> new VacuumArcFurnaceController(VacuumArcFurnaceController.getProperties()));
|
||||||
public static final DeferredBlock<Block> VAF_MULTIBLOCK_DUMMY_BLOCK = BLOCKS.register("vaf_dummy_block", () -> new VAFMultiblockDummyBlock(VAFMultiblockDummyBlock.getProperties()));
|
public static final DeferredBlock<Block> VAF_MULTIBLOCK_DUMMY_BLOCK = BLOCKS.register("vaf_dummy_block", () -> new VAFMultiblockDummyBlock(VAFMultiblockDummyBlock.getProperties()));
|
||||||
public static final DeferredBlock<Block> OXYGEN_TEST_BLOCK = BLOCKS.register("oxygen_test_block", () -> new OxygenTestBlock(OxygenTestBlock.getProperties()));
|
public static final DeferredBlock<Block> OXYGEN_TEST_BLOCK = BLOCKS.register("oxygen_test_block", () -> new OxygenTestBlock(OxygenTestBlock.getProperties()));
|
||||||
public static final DeferredBlock<Block> ROCKET_ASSEMBLER_BLOCK = BLOCKS.register("rocket_assemblerblock", () -> new RocketAssemblerBlock(RocketAssemblerBlock.getProperties()));
|
public static final DeferredBlock<Block> ROCKET_ASSEMBLER_BLOCK = BLOCKS.register("rocket_assembler_block", () -> new RocketAssemblerBlock(RocketAssemblerBlock.getProperties()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,5 +42,6 @@ public class ModCreativeTabs {
|
|||||||
output.accept(ModItems.ARC_FURNACE_CASING_BLOCK);
|
output.accept(ModItems.ARC_FURNACE_CASING_BLOCK);
|
||||||
output.accept(ModItems.VACUUM_ARC_FURNACE_CONTROLLER);
|
output.accept(ModItems.VACUUM_ARC_FURNACE_CONTROLLER);
|
||||||
output.accept(ModItems.LAUNCH_PAD);
|
output.accept(ModItems.LAUNCH_PAD);
|
||||||
|
output.accept(ModItems.ROCKET_ASSEMBLER_BLOCK);
|
||||||
}).build());
|
}).build());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,5 +37,6 @@ public static final DeferredItem<Item> MUSIC_DISC_BIT_SHIFT = ITEMS.register("mu
|
|||||||
public static final DeferredItem<BlockItem> VACUUM_ARC_FURNACE_CONTROLLER = ITEMS.register("vacuum_arc_furnace_controller", () -> new BlockItem(ModBlocks.VACUUM_ARC_FURNACE_CONTROLLER.get(), VacuumArcFurnaceController.getItemProperties()));
|
public static final DeferredItem<BlockItem> VACUUM_ARC_FURNACE_CONTROLLER = ITEMS.register("vacuum_arc_furnace_controller", () -> new BlockItem(ModBlocks.VACUUM_ARC_FURNACE_CONTROLLER.get(), VacuumArcFurnaceController.getItemProperties()));
|
||||||
public static final DeferredItem<BlockItem> OXYGEN_TEST_BLOCK = ITEMS.register("oxygen_test_block", () -> new BlockItem(ModBlocks.OXYGEN_TEST_BLOCK.get(), new Item.Properties()));
|
public static final DeferredItem<BlockItem> OXYGEN_TEST_BLOCK = ITEMS.register("oxygen_test_block", () -> new BlockItem(ModBlocks.OXYGEN_TEST_BLOCK.get(), new Item.Properties()));
|
||||||
public static final DeferredItem<BlockItem> LAUNCH_PAD = ITEMS.register("launch_pad", () -> new BlockItem(ModBlocks.LAUNCH_PAD.get(), LaunchPad.getItemProperties()));
|
public static final DeferredItem<BlockItem> LAUNCH_PAD = ITEMS.register("launch_pad", () -> new BlockItem(ModBlocks.LAUNCH_PAD.get(), LaunchPad.getItemProperties()));
|
||||||
|
public static final DeferredItem<BlockItem> ROCKET_ASSEMBLER_BLOCK = ITEMS.register("rocket_assembler_block", () -> new BlockItem(ModBlocks.ROCKET_ASSEMBLER_BLOCK.get(), RocketAssemblerBlock.getItemProperties()));
|
||||||
// public static final DeferredItem<BlockItem> VAF_MULTIBLOCK_DUMMY_BLOCK = ITEMS.register("vaf_multiblock_dummy_block", () -> new BlockItem(ModBlocks.VAF_MULTIBLOCK_DUMMY_BLOCK.get(), VAFMultiblockDummyBlock.getItemProperties()));
|
// public static final DeferredItem<BlockItem> VAF_MULTIBLOCK_DUMMY_BLOCK = ITEMS.register("vaf_multiblock_dummy_block", () -> new BlockItem(ModBlocks.VAF_MULTIBLOCK_DUMMY_BLOCK.get(), VAFMultiblockDummyBlock.getItemProperties()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ package net.xevianlight.aphelion.core.saveddata.types;
|
|||||||
// We never store GravityData for any reason other than to test its values or to pack it into an integer.
|
// We never store GravityData for any reason other than to test its values or to pack it into an integer.
|
||||||
public record GravityData (float gravity, float radius) {
|
public record GravityData (float gravity, float radius) {
|
||||||
|
|
||||||
public static final float DEFAULT_GRAVITY = 9.80665f; // 1G
|
public static final float DEFAULT_GRAVITY = 32.00f; // Vanilla acceleration
|
||||||
public static final float GRAVITY_PRECISION = 100.0f;
|
public static final float GRAVITY_PRECISION = 100.0f;
|
||||||
public static final float RADIUS_PRECISION = 100.0f;
|
public static final float RADIUS_PRECISION = 100.0f;
|
||||||
public static final float MAX_RADIUS = Short.MAX_VALUE / RADIUS_PRECISION;
|
public static final float MAX_RADIUS = Short.MAX_VALUE / RADIUS_PRECISION;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class ModBlockLootTableProvider extends BlockLootSubProvider {
|
|||||||
dropSelf(ModBlocks.OXYGEN_TEST_BLOCK.get());
|
dropSelf(ModBlocks.OXYGEN_TEST_BLOCK.get());
|
||||||
dropOther(ModBlocks.VAF_MULTIBLOCK_DUMMY_BLOCK.get(), ItemStack.EMPTY.getItem());
|
dropOther(ModBlocks.VAF_MULTIBLOCK_DUMMY_BLOCK.get(), ItemStack.EMPTY.getItem());
|
||||||
dropSelf(ModBlocks.LAUNCH_PAD.get());
|
dropSelf(ModBlocks.LAUNCH_PAD.get());
|
||||||
|
dropSelf(ModBlocks.ROCKET_ASSEMBLER_BLOCK.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ public class ModBlockStateProvider extends BlockStateProvider {
|
|||||||
blockItem(ModBlocks.ELECTRIC_ARC_FURNACE);
|
blockItem(ModBlocks.ELECTRIC_ARC_FURNACE);
|
||||||
blockItem(ModBlocks.VACUUM_ARC_FURNACE_CONTROLLER);
|
blockItem(ModBlocks.VACUUM_ARC_FURNACE_CONTROLLER);
|
||||||
|
|
||||||
|
horizontalBlock(ModBlocks.ROCKET_ASSEMBLER_BLOCK.get(), models().orientable("aphelion:rocket_assembler_block",
|
||||||
|
modLoc("block/test_block"),
|
||||||
|
mcLoc("block/furnace_front"),
|
||||||
|
modLoc("block/test_block")));
|
||||||
|
blockItem(ModBlocks.ROCKET_ASSEMBLER_BLOCK);
|
||||||
|
|
||||||
blockWithItem(ModBlocks.BLOCK_STEEL);
|
blockWithItem(ModBlocks.BLOCK_STEEL);
|
||||||
blockWithItem(ModBlocks.DIMENSION_CHANGER);
|
blockWithItem(ModBlocks.DIMENSION_CHANGER);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 247 B |
Reference in New Issue
Block a user