Annotate?
This commit is contained in:
parent
27b721b22e
commit
e74ce49694
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
@ -22,7 +23,10 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockAndroidStation extends BlockMattery implements EntityBlock {
|
public class BlockAndroidStation extends BlockMattery implements EntityBlock {
|
||||||
private final VoxelShape SHAPE = BlockShapes.ANDROID_STATION.computeShape();
|
private final VoxelShape SHAPE = BlockShapes.ANDROID_STATION.computeShape();
|
||||||
|
|
||||||
@ -41,6 +45,7 @@ public class BlockAndroidStation extends BlockMattery implements EntityBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_151964_, BlockGetter p_151965_, BlockPos p_151966_, CollisionContext p_151967_) {
|
public VoxelShape getShape(BlockState p_151964_, BlockGetter p_151965_, BlockPos p_151966_, CollisionContext p_151967_) {
|
||||||
return SHAPE;
|
return SHAPE;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
@ -22,8 +23,11 @@ import ru.dbotthepony.mc.otm.block.entity.BlockEntityBatteryBank;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockBatteryBank extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockBatteryBank extends BlockMatteryRotatable implements EntityBlock {
|
||||||
public static final BooleanProperty[] BATTERY_SLOTS_PROPS = new BooleanProperty[] {
|
public static final BooleanProperty[] BATTERY_SLOTS_PROPS = new BooleanProperty[] {
|
||||||
BooleanProperty.create("battery_0"),
|
BooleanProperty.create("battery_0"),
|
||||||
@ -85,6 +89,7 @@ public class BlockBatteryBank extends BlockMatteryRotatable implements EntityBlo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@ -18,7 +19,10 @@ import ru.dbotthepony.mc.otm.block.entity.BlockEntityBlackHole;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockBlackHole extends Block implements EntityBlock {
|
public class BlockBlackHole extends Block implements EntityBlock {
|
||||||
public BlockBlackHole() {
|
public BlockBlackHole() {
|
||||||
super(Properties.of(
|
super(Properties.of(
|
||||||
@ -29,6 +33,7 @@ public class BlockBlackHole extends Block implements EntityBlock {
|
|||||||
public static final VoxelShape SHAPE = BlockShapes.BLACK_HOLE.computeShape();
|
public static final VoxelShape SHAPE = BlockShapes.BLACK_HOLE.computeShape();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPE;
|
return SHAPE;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.Containers;
|
import net.minecraft.world.Containers;
|
||||||
@ -14,7 +15,10 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityCargoCrate;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityCargoCrate;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockCargoCrate extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockCargoCrate extends BlockMatteryRotatable implements EntityBlock {
|
||||||
public static final BooleanProperty IS_OPEN = BooleanProperty.create("open");
|
public static final BooleanProperty IS_OPEN = BooleanProperty.create("open");
|
||||||
|
|
||||||
@ -37,6 +41,7 @@ public class BlockCargoCrate extends BlockMatteryRotatable implements EntityBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public void onRemove(BlockState old_block_state, Level level, BlockPos block_pos, BlockState new_block_state, boolean p_51542_) {
|
public void onRemove(BlockState old_block_state, Level level, BlockPos block_pos, BlockState new_block_state, boolean p_51542_) {
|
||||||
if (!old_block_state.is(new_block_state.getBlock())) {
|
if (!old_block_state.is(new_block_state.getBlock())) {
|
||||||
BlockEntity blockentity = level.getBlockEntity(block_pos);
|
BlockEntity blockentity = level.getBlockEntity(block_pos);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.block.EntityBlock;
|
import net.minecraft.world.level.block.EntityBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
@ -7,7 +8,10 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveRack;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveRack;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockDriveRack extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockDriveRack extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
@ -14,9 +15,12 @@ import ru.dbotthepony.mc.otm.Registry;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveViewer;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityDriveViewer;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import static ru.dbotthepony.mc.otm.block.entity.worker.WorkerState.SEMI_WORKER_STATE;
|
import static ru.dbotthepony.mc.otm.block.entity.worker.WorkerState.SEMI_WORKER_STATE;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockDriveViewer extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockDriveViewer extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.block.EntityBlock;
|
import net.minecraft.world.level.block.EntityBlock;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
@ -7,7 +8,10 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityItemMonitor;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityItemMonitor;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockItemMonitor extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockItemMonitor extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
@ -14,7 +15,10 @@ import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterBottler;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState;
|
import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockMatterBottler extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockMatterBottler extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
@ -22,8 +23,11 @@ import ru.dbotthepony.mc.otm.capability.matter.IMatterGridCell;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterCable;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterCable;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockMatterCable extends Block implements EntityBlock {
|
public class BlockMatterCable extends Block implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -157,6 +161,7 @@ public class BlockMatterCable extends Block implements EntityBlock {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
VoxelShape get = SHAPES.get(p_60555_);
|
VoxelShape get = SHAPES.get(p_60555_);
|
||||||
return get != null ? get : CORE_SHAPE;
|
return get != null ? get : CORE_SHAPE;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
@ -16,8 +17,11 @@ import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterCapacitorBank;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockMatterCapacitorBank extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockMatterCapacitorBank extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -58,6 +62,7 @@ public class BlockMatterCapacitorBank extends BlockMatteryRotatable implements E
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
@ -19,8 +20,11 @@ import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockMatterDecomposer extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockMatterDecomposer extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -56,6 +60,7 @@ public class BlockMatterDecomposer extends BlockMatteryRotatable implements Enti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
@ -17,7 +18,10 @@ import net.minecraft.world.phys.shapes.VoxelShape;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterPanel;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMatterPanel;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockMatterPanel extends BlockMattery implements EntityBlock {
|
public class BlockMatterPanel extends BlockMattery implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -97,6 +101,7 @@ public class BlockMatterPanel extends BlockMattery implements EntityBlock {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPES.get(p_60555_);
|
return SHAPES.get(p_60555_);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
@ -20,8 +21,11 @@ import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockMatterReplicator extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockMatterReplicator extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -57,6 +61,7 @@ public class BlockMatterReplicator extends BlockMatteryRotatable implements Enti
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.BlockGetter;
|
import net.minecraft.world.level.BlockGetter;
|
||||||
@ -20,8 +21,11 @@ import ru.dbotthepony.mc.otm.block.entity.worker.WorkerState;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockMatterScanner extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockMatterScanner extends BlockMatteryRotatable implements EntityBlock {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
@ -57,6 +61,7 @@ public class BlockMatterScanner extends BlockMatteryRotatable implements EntityB
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
@ -18,7 +19,10 @@ import net.minecraft.world.phys.BlockHitResult;
|
|||||||
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMattery;
|
import ru.dbotthepony.mc.otm.block.entity.BlockEntityMattery;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public abstract class BlockMattery extends Block {
|
public abstract class BlockMattery extends Block {
|
||||||
public BlockMattery(Properties p_49795_) {
|
public BlockMattery(Properties p_49795_) {
|
||||||
super(p_49795_);
|
super(p_49795_);
|
||||||
@ -38,6 +42,7 @@ public abstract class BlockMattery extends Block {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public InteractionResult use(BlockState p_60503_, Level level, BlockPos pos, Player ply, InteractionHand p_60507_, BlockHitResult p_60508_) {
|
public InteractionResult use(BlockState p_60503_, Level level, BlockPos pos, Player ply, InteractionHand p_60507_, BlockHitResult p_60508_) {
|
||||||
if (this instanceof EntityBlock && !level.isClientSide && level.getBlockEntity(pos) instanceof MenuProvider tile) {
|
if (this instanceof EntityBlock && !level.isClientSide && level.getBlockEntity(pos) instanceof MenuProvider tile) {
|
||||||
ply.openMenu(tile);
|
ply.openMenu(tile);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
@ -10,8 +11,11 @@ import org.apache.commons.lang3.ArrayUtils;
|
|||||||
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
|
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public abstract class BlockMatteryRotatable extends BlockMattery {
|
public abstract class BlockMatteryRotatable extends BlockMattery {
|
||||||
public static final EnumProperty<Direction> FACING = EnumProperty.create(
|
public static final EnumProperty<Direction> FACING = EnumProperty.create(
|
||||||
"facing",
|
"facing",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block;
|
package ru.dbotthepony.mc.otm.block;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||||
@ -16,8 +17,11 @@ import ru.dbotthepony.mc.otm.block.entity.BlockEntityPatternStorage;
|
|||||||
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
import ru.dbotthepony.mc.otm.shapes.BlockShapes;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockPatternStorage extends BlockMatteryRotatable implements EntityBlock {
|
public class BlockPatternStorage extends BlockMatteryRotatable implements EntityBlock {
|
||||||
public static final BooleanProperty[] PATTERN_STORAGE_DISKS_PROPS = new BooleanProperty[] {
|
public static final BooleanProperty[] PATTERN_STORAGE_DISKS_PROPS = new BooleanProperty[] {
|
||||||
BooleanProperty.create("disk_0"),
|
BooleanProperty.create("disk_0"),
|
||||||
@ -69,6 +73,7 @@ public class BlockPatternStorage extends BlockMatteryRotatable implements Entity
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
public VoxelShape getShape(BlockState p_60555_, BlockGetter p_60556_, BlockPos p_60557_, CollisionContext p_60558_) {
|
||||||
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
return SHAPES.get(p_60555_.getValue(FACING).ordinal());
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.network.chat.TranslatableComponent;
|
import net.minecraft.network.chat.TranslatableComponent;
|
||||||
@ -19,10 +20,13 @@ import ru.dbotthepony.mc.otm.capability.MatteryMachineEnergyStorage;
|
|||||||
import ru.dbotthepony.mc.otm.menu.AndroidStationMenu;
|
import ru.dbotthepony.mc.otm.menu.AndroidStationMenu;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityAndroidStation extends BlockEntityMatteryPowered implements MenuProvider {
|
public class BlockEntityAndroidStation extends BlockEntityMatteryPowered implements MenuProvider {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -29,9 +30,12 @@ import ru.dbotthepony.mc.otm.menu.BatteryBankMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityBatteryBank extends BlockEntityMattery {
|
public class BlockEntityBatteryBank extends BlockEntityMattery {
|
||||||
// 6 на 2
|
// 6 на 2
|
||||||
public final MatteryContainer battery_container = new MatteryContainer(this::setChanged, 6 * 2) {
|
public final MatteryContainer battery_container = new MatteryContainer(this::setChanged, 6 * 2) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -35,10 +36,13 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
|||||||
import ru.dbotthepony.mc.otm.matter.MatterRegistry;
|
import ru.dbotthepony.mc.otm.matter.MatterRegistry;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityBlackHole extends BlockEntity {
|
public class BlockEntityBlackHole extends BlockEntity {
|
||||||
public BlockEntityBlackHole(BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityBlackHole(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(Registry.BlockEntities.BLACK_HOLE, p_155229_, p_155230_);
|
super(Registry.BlockEntities.BLACK_HOLE, p_155229_, p_155230_);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@ -16,7 +17,10 @@ import ru.dbotthepony.mc.otm.container.MatteryContainer;
|
|||||||
import ru.dbotthepony.mc.otm.menu.CargoCrateMenu;
|
import ru.dbotthepony.mc.otm.menu.CargoCrateMenu;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityCargoCrate extends BlockEntityMattery {
|
public class BlockEntityCargoCrate extends BlockEntityMattery {
|
||||||
private static final TranslatableComponent NAME = new TranslatableComponent("block.overdrive_that_matters.cargo_crate");
|
private static final TranslatableComponent NAME = new TranslatableComponent("block.overdrive_that_matters.cargo_crate");
|
||||||
public int open_amount = 0;
|
public int open_amount = 0;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@ -23,8 +24,11 @@ import ru.dbotthepony.mc.otm.container.MatteryContainer;
|
|||||||
import ru.dbotthepony.mc.otm.menu.DriveViewerMenu;
|
import ru.dbotthepony.mc.otm.menu.DriveViewerMenu;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityDriveViewer extends BlockEntityMatteryPowered {
|
public class BlockEntityDriveViewer extends BlockEntityMatteryPowered {
|
||||||
public static final BigDecimal MTE_PER_OPERATION = new BigDecimal("3.125");
|
public static final BigDecimal MTE_PER_OPERATION = new BigDecimal("3.125");
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
@ -20,8 +21,11 @@ import ru.dbotthepony.mc.otm.menu.ItemMonitorMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityItemMonitor extends BlockEntityMatteryPowered {
|
public class BlockEntityItemMonitor extends BlockEntityMatteryPowered {
|
||||||
public BlockEntityItemMonitor(BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityItemMonitor(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(Registry.BlockEntities.ITEM_MONITOR, p_155229_, p_155230_);
|
super(Registry.BlockEntities.ITEM_MONITOR, p_155229_, p_155230_);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -29,8 +30,11 @@ import ru.dbotthepony.mc.otm.menu.MatterBottlerMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityMatterBottler extends BlockEntityMatteryPowered implements IMatterGridCell {
|
public class BlockEntityMatterBottler extends BlockEntityMatteryPowered implements IMatterGridCell {
|
||||||
public BlockEntityMatterBottler(BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityMatterBottler(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(Registry.BlockEntities.MATTER_BOTTLER, p_155229_, p_155230_);
|
super(Registry.BlockEntities.MATTER_BOTTLER, p_155229_, p_155230_);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
@ -18,7 +19,10 @@ import ru.dbotthepony.mc.otm.capability.matter.IPatternStorage;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityMatterCable extends BlockEntity implements IMatterGridCell {
|
public class BlockEntityMatterCable extends BlockEntity implements IMatterGridCell {
|
||||||
public BlockEntityMatterCable(BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityMatterCable(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(Registry.BlockEntities.MATTER_CABLE, p_155229_, p_155230_);
|
super(Registry.BlockEntities.MATTER_CABLE, p_155229_, p_155230_);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -26,9 +27,12 @@ import ru.dbotthepony.mc.otm.menu.MatterCapacitorBankMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityMatterCapacitorBank extends BlockEntityMattery implements IMatterGridCell {
|
public class BlockEntityMatterCapacitorBank extends BlockEntityMattery implements IMatterGridCell {
|
||||||
public final IMatterHandler matter = new IMatterHandler() {
|
public final IMatterHandler matter = new IMatterHandler() {
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -32,8 +33,11 @@ import ru.dbotthepony.mc.otm.menu.MatterDecomposerMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityMatterDecomposer extends BlockEntityMatteryWorker implements IMatterGridCell {
|
public class BlockEntityMatterDecomposer extends BlockEntityMatteryWorker implements IMatterGridCell {
|
||||||
private static final TranslatableComponent MACHINE_NAME = new TranslatableComponent("block.overdrive_that_matters.matter_decomposer");
|
private static final TranslatableComponent MACHINE_NAME = new TranslatableComponent("block.overdrive_that_matters.matter_decomposer");
|
||||||
private boolean valid = true;
|
private boolean valid = true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -22,9 +23,12 @@ import ru.dbotthepony.mc.otm.menu.MatterPanelMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityMatterPanel extends BlockEntityMattery implements IMatterGridCell, IMatterTaskProvider {
|
public class BlockEntityMatterPanel extends BlockEntityMattery implements IMatterGridCell, IMatterTaskProvider {
|
||||||
public BlockEntityMatterPanel(BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityMatterPanel(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(Registry.BlockEntities.MATTER_PANEL, p_155229_, p_155230_);
|
super(Registry.BlockEntities.MATTER_PANEL, p_155229_, p_155230_);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -29,8 +30,11 @@ import ru.dbotthepony.mc.otm.menu.MatterReplicatorMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityMatterReplicator extends BlockEntityMatteryWorker implements IMatterGridCell {
|
public class BlockEntityMatterReplicator extends BlockEntityMatteryWorker implements IMatterGridCell {
|
||||||
public BlockEntityMatterReplicator(BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityMatterReplicator(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(Registry.BlockEntities.MATTER_REPLICATOR, p_155229_, p_155230_);
|
super(Registry.BlockEntities.MATTER_REPLICATOR, p_155229_, p_155230_);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -28,10 +29,13 @@ import ru.dbotthepony.mc.otm.menu.MatterScannerMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityMatterScanner extends BlockEntityMatteryWorker implements IMatterGridCell {
|
public class BlockEntityMatterScanner extends BlockEntityMatteryWorker implements IMatterGridCell {
|
||||||
private static final TranslatableComponent NAME = new TranslatableComponent("block.overdrive_that_matters.matter_scanner");
|
private static final TranslatableComponent NAME = new TranslatableComponent("block.overdrive_that_matters.matter_scanner");
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
@ -16,8 +17,11 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
import net.minecraft.world.level.chunk.LevelChunk;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public abstract class BlockEntityMattery extends BlockEntity implements MenuProvider {
|
public abstract class BlockEntityMattery extends BlockEntity implements MenuProvider {
|
||||||
protected Component display_name;
|
protected Component display_name;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -17,9 +18,12 @@ import ru.dbotthepony.mc.otm.container.MatteryContainer;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
abstract public class BlockEntityMatteryPowered extends BlockEntityMattery {
|
abstract public class BlockEntityMatteryPowered extends BlockEntityMattery {
|
||||||
protected MatteryMachineEnergyStorage energy = null;
|
protected MatteryMachineEnergyStorage energy = null;
|
||||||
protected final LazyOptional<MatteryMachineEnergyStorage> energy_resolver = LazyOptional.of(() -> energy);;
|
protected final LazyOptional<MatteryMachineEnergyStorage> energy_resolver = LazyOptional.of(() -> energy);;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity;
|
package ru.dbotthepony.mc.otm.block.entity;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
@ -27,9 +28,12 @@ import ru.dbotthepony.mc.otm.menu.PatternStorageMenu;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class BlockEntityPatternStorage extends BlockEntityMattery implements IMatterGridCell, IPatternStorage {
|
public class BlockEntityPatternStorage extends BlockEntityMattery implements IMatterGridCell, IPatternStorage {
|
||||||
public BlockEntityPatternStorage(BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityPatternStorage(BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(Registry.BlockEntities.PATTERN_STORAGE, p_155229_, p_155230_);
|
super(Registry.BlockEntities.PATTERN_STORAGE, p_155229_, p_155230_);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity.worker;
|
package ru.dbotthepony.mc.otm.block.entity.worker;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.DoubleTag;
|
import net.minecraft.nbt.DoubleTag;
|
||||||
@ -13,17 +14,18 @@ import ru.dbotthepony.mc.otm.capability.MatteryCapability;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
abstract public class BlockEntityMatteryWorker extends BlockEntityMatteryPowered {
|
abstract public class BlockEntityMatteryWorker extends BlockEntityMatteryPowered {
|
||||||
public BlockEntityMatteryWorker(BlockEntityType<?> p_155228_, BlockPos p_155229_, BlockState p_155230_) {
|
public BlockEntityMatteryWorker(BlockEntityType<?> p_155228_, BlockPos p_155229_, BlockState p_155230_) {
|
||||||
super(p_155228_, p_155229_, p_155230_);
|
super(p_155228_, p_155229_, p_155230_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
protected abstract BigDecimal getBaseConsumption();
|
protected abstract BigDecimal getBaseConsumption();
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
protected BigDecimal consumptionPerWork() {
|
protected BigDecimal consumptionPerWork() {
|
||||||
return getBaseConsumption();
|
return getBaseConsumption();
|
||||||
}
|
}
|
||||||
@ -79,7 +81,6 @@ abstract public class BlockEntityMatteryWorker extends BlockEntityMatteryPowered
|
|||||||
* @return whenever machine can finish it's job. return false if machine for whatever reason can't finish it's job,
|
* @return whenever machine can finish it's job. return false if machine for whatever reason can't finish it's job,
|
||||||
* waiting on conditions to be met
|
* waiting on conditions to be met
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
|
||||||
abstract protected MachineJobStatus onJobFinish(MachineJob job);
|
abstract protected MachineJobStatus onJobFinish(MachineJob job);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity.worker;
|
package ru.dbotthepony.mc.otm.block.entity.worker;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.DoubleTag;
|
import net.minecraft.nbt.DoubleTag;
|
||||||
import net.minecraft.nbt.StringTag;
|
import net.minecraft.nbt.StringTag;
|
||||||
@ -7,8 +8,11 @@ import net.minecraft.nbt.Tag;
|
|||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public record MachineJob(ItemStack stack, double ticks_processing_time, BigDecimal power_consumption_multiplier,
|
public record MachineJob(ItemStack stack, double ticks_processing_time, BigDecimal power_consumption_multiplier,
|
||||||
CompoundTag data) {
|
CompoundTag data) {
|
||||||
public MachineJob(ItemStack stack, double ticks_processing_time, BigDecimal power_consumption_multiplier, CompoundTag data) {
|
public MachineJob(ItemStack stack, double ticks_processing_time, BigDecimal power_consumption_multiplier, CompoundTag data) {
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity.worker;
|
package ru.dbotthepony.mc.otm.block.entity.worker;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public record MachineJobStatus(boolean valid, int throttle) {
|
public record MachineJobStatus(boolean valid, int throttle) {
|
||||||
public MachineJobStatus() {
|
public MachineJobStatus() {
|
||||||
this(true, 0);
|
this(true, 0);
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity.worker;
|
package ru.dbotthepony.mc.otm.block.entity.worker;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public record WorkTickContext(MachineJob job, BigDecimal required_power, BigDecimal extracted_power,
|
public record WorkTickContext(MachineJob job, BigDecimal required_power, BigDecimal extracted_power,
|
||||||
BigDecimal work_speed) {
|
BigDecimal work_speed) {
|
||||||
|
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
package ru.dbotthepony.mc.otm.block.entity.worker;
|
package ru.dbotthepony.mc.otm.block.entity.worker;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.util.StringRepresentable;
|
import net.minecraft.util.StringRepresentable;
|
||||||
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
import net.minecraft.world.level.block.state.properties.EnumProperty;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public enum WorkerState implements StringRepresentable {
|
public enum WorkerState implements StringRepresentable {
|
||||||
IDLE,
|
IDLE,
|
||||||
WORKING,
|
WORKING,
|
||||||
|
@ -1,74 +1,64 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability;
|
package ru.dbotthepony.mc.otm.capability;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
// IEnergyStorage for direct compat with Forge Energy
|
// IEnergyStorage for direct compat with Forge Energy
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IMatteryEnergyStorage extends IEnergyStorage {
|
public interface IMatteryEnergyStorage extends IEnergyStorage {
|
||||||
// such as cables. This is something that would work only with energy storage
|
// such as cables. This is something that would work only with energy storage
|
||||||
@Nonnull
|
|
||||||
BigDecimal extractEnergyOuter(BigDecimal howMuch, boolean simulate);
|
BigDecimal extractEnergyOuter(BigDecimal howMuch, boolean simulate);
|
||||||
|
|
||||||
// for internal needs, e.g. for work
|
// for internal needs, e.g. for work
|
||||||
// CAN also be used by something that does evil
|
// CAN also be used by something that does evil
|
||||||
// e.g. sucking out energy anomaly should use this
|
// e.g. sucking out energy anomaly should use this
|
||||||
@Nonnull
|
|
||||||
BigDecimal extractEnergyInner(BigDecimal howMuch, boolean simulate);
|
BigDecimal extractEnergyInner(BigDecimal howMuch, boolean simulate);
|
||||||
|
|
||||||
// energy is received from outside, e.g. cables
|
// energy is received from outside, e.g. cables
|
||||||
@Nonnull
|
|
||||||
BigDecimal receiveEnergyOuter(BigDecimal howMuch, boolean simulate);
|
BigDecimal receiveEnergyOuter(BigDecimal howMuch, boolean simulate);
|
||||||
|
|
||||||
// energy is received from inside, e.g. generator generates power
|
// energy is received from inside, e.g. generator generates power
|
||||||
@Nonnull
|
|
||||||
BigDecimal receiveEnergyInner(BigDecimal howMuch, boolean simulate);
|
BigDecimal receiveEnergyInner(BigDecimal howMuch, boolean simulate);
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal extractEnergyOuter(long howMuch, boolean simulate) {
|
default BigDecimal extractEnergyOuter(long howMuch, boolean simulate) {
|
||||||
return extractEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return extractEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal extractEnergyOuter(int howMuch, boolean simulate) {
|
default BigDecimal extractEnergyOuter(int howMuch, boolean simulate) {
|
||||||
return extractEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return extractEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal receiveEnergyOuter(long howMuch, boolean simulate) {
|
default BigDecimal receiveEnergyOuter(long howMuch, boolean simulate) {
|
||||||
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal receiveEnergyOuter(int howMuch, boolean simulate) {
|
default BigDecimal receiveEnergyOuter(int howMuch, boolean simulate) {
|
||||||
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal extractEnergyInner(long howMuch, boolean simulate) {
|
default BigDecimal extractEnergyInner(long howMuch, boolean simulate) {
|
||||||
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal extractEnergyInner(int howMuch, boolean simulate) {
|
default BigDecimal extractEnergyInner(int howMuch, boolean simulate) {
|
||||||
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal receiveEnergyInner(long howMuch, boolean simulate) {
|
default BigDecimal receiveEnergyInner(long howMuch, boolean simulate) {
|
||||||
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal receiveEnergyInner(int howMuch, boolean simulate) {
|
default BigDecimal receiveEnergyInner(int howMuch, boolean simulate) {
|
||||||
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
return receiveEnergyOuter(new BigDecimal(howMuch, MatteryCapability.ROUND_RULES), simulate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
BigDecimal getBatteryLevel();
|
BigDecimal getBatteryLevel();
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
BigDecimal getMaxBatteryLevel();
|
BigDecimal getMaxBatteryLevel();
|
||||||
|
|
||||||
default BigDecimal getMissingPower() {
|
default BigDecimal getMissingPower() {
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability;
|
package ru.dbotthepony.mc.otm.capability;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import net.minecraftforge.common.util.INBTSerializable;
|
import net.minecraftforge.common.util.INBTSerializable;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class MatteryMachineEnergyStorage implements IMatteryEnergyStorage, INBTSerializable<CompoundTag> {
|
public class MatteryMachineEnergyStorage implements IMatteryEnergyStorage, INBTSerializable<CompoundTag> {
|
||||||
public enum MachineType {
|
public enum MachineType {
|
||||||
WORKER,
|
WORKER,
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.android;
|
package ru.dbotthepony.mc.otm.capability.android;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
@ -34,9 +35,12 @@ import ru.dbotthepony.mc.otm.network.android.AndroidFeaturePacket;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class AndroidCapability implements ICapabilityProvider, IAndroidCapability, INBTSerializable<CompoundTag> {
|
public class AndroidCapability implements ICapabilityProvider, IAndroidCapability, INBTSerializable<CompoundTag> {
|
||||||
protected final LivingEntity ent;
|
protected final LivingEntity ent;
|
||||||
protected BigDecimal energy_stored = new BigDecimal(0);
|
protected BigDecimal energy_stored = new BigDecimal(0);
|
||||||
@ -54,7 +58,7 @@ public class AndroidCapability implements ICapabilityProvider, IAndroidCapabilit
|
|||||||
|
|
||||||
protected boolean network_first = false;
|
protected boolean network_first = false;
|
||||||
|
|
||||||
protected boolean addFeature(@Nonnull AndroidFeature feature) {
|
protected boolean addFeature(AndroidFeature feature) {
|
||||||
if (features.containsKey(feature.type))
|
if (features.containsKey(feature.type))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -72,6 +76,7 @@ public class AndroidCapability implements ICapabilityProvider, IAndroidCapabilit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends AndroidFeature> T addFeature(@Nonnull AndroidFeatureType<T> feature) {
|
public <T extends AndroidFeature> T addFeature(@Nonnull AndroidFeatureType<T> feature) {
|
||||||
var get = features.get(feature);
|
var get = features.get(feature);
|
||||||
|
|
||||||
@ -128,6 +133,7 @@ public class AndroidCapability implements ICapabilityProvider, IAndroidCapabilit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends AndroidFeature> T getFeature(AndroidFeatureType<T> feature) {
|
public <T extends AndroidFeature> T getFeature(AndroidFeatureType<T> feature) {
|
||||||
return (T) features.get(feature);
|
return (T) features.get(feature);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.android;
|
package ru.dbotthepony.mc.otm.capability.android;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.ListTag;
|
import net.minecraft.nbt.ListTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
@ -18,10 +19,13 @@ import ru.dbotthepony.mc.otm.network.android.AndroidResearchPacket;
|
|||||||
import ru.dbotthepony.mc.otm.network.android.AndroidStatusPacket;
|
import ru.dbotthepony.mc.otm.network.android.AndroidStatusPacket;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class AndroidCapabilityPlayer extends AndroidCapability {
|
public class AndroidCapabilityPlayer extends AndroidCapability {
|
||||||
public boolean is_android = false;
|
public boolean is_android = false;
|
||||||
private boolean network_is_android = false;
|
private boolean network_is_android = false;
|
||||||
@ -112,6 +116,7 @@ public class AndroidCapabilityPlayer extends AndroidCapability {
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends AndroidResearch> T getResearch(AndroidResearchType<T> type) {
|
public <T extends AndroidResearch> T getResearch(AndroidResearchType<T> type) {
|
||||||
for (var instance : research_list) {
|
for (var instance : research_list) {
|
||||||
if (instance.type == type) {
|
if (instance.type == type) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.android;
|
package ru.dbotthepony.mc.otm.capability.android;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
@ -11,21 +12,24 @@ import ru.dbotthepony.mc.otm.capability.IMatteryEnergyStorage;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IAndroidCapability extends IMatteryEnergyStorage, INBTSerializable<CompoundTag> {
|
public interface IAndroidCapability extends IMatteryEnergyStorage, INBTSerializable<CompoundTag> {
|
||||||
void tick();
|
void tick();
|
||||||
void tickClient();
|
void tickClient();
|
||||||
LivingEntity getEntity();
|
LivingEntity getEntity();
|
||||||
|
|
||||||
<T extends AndroidFeature> T addFeature(@Nonnull AndroidFeatureType<T> feature);
|
<T extends AndroidFeature> T addFeature(AndroidFeatureType<T> feature);
|
||||||
boolean removeFeature(@Nonnull AndroidFeatureType<?> feature);
|
boolean removeFeature(AndroidFeatureType<?> feature);
|
||||||
boolean hasFeature(@Nullable AndroidFeatureType<?> feature);
|
boolean hasFeature(@Nullable AndroidFeatureType<?> feature);
|
||||||
boolean hasFeatureLevel(@Nullable AndroidFeatureType<?> feature, int level);
|
boolean hasFeatureLevel(@Nullable AndroidFeatureType<?> feature, int level);
|
||||||
|
@Nullable
|
||||||
<T extends AndroidFeature> T getFeature(AndroidFeatureType<T> feature);
|
<T extends AndroidFeature> T getFeature(AndroidFeatureType<T> feature);
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default <T extends AndroidFeature> Optional<T> getFeatureO(AndroidFeatureType<T> feature) {
|
default <T extends AndroidFeature> Optional<T> getFeatureO(AndroidFeatureType<T> feature) {
|
||||||
var get = getFeature(feature);
|
var get = getFeature(feature);
|
||||||
return get != null ? Optional.of(get) : Optional.empty();
|
return get != null ? Optional.of(get) : Optional.empty();
|
||||||
@ -36,9 +40,8 @@ public interface IAndroidCapability extends IMatteryEnergyStorage, INBTSerializa
|
|||||||
}
|
}
|
||||||
default void onHurt(LivingHurtEvent event) {}
|
default void onHurt(LivingHurtEvent event) {}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
ItemStack getBatteryItemStack();
|
ItemStack getBatteryItemStack();
|
||||||
void setBatteryItemStack(@Nonnull ItemStack stack);
|
void setBatteryItemStack(ItemStack stack);
|
||||||
|
|
||||||
void invalidateNetworkState(); // tell capability that player forgot everything, and everything needs to be re-networked
|
void invalidateNetworkState(); // tell capability that player forgot everything, and everything needs to be re-networked
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.drive;
|
package ru.dbotthepony.mc.otm.capability.drive;
|
||||||
|
|
||||||
import net.minecraft.CrashReport;
|
import net.minecraft.CrashReport;
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.ReportedException;
|
import net.minecraft.ReportedException;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.NbtIo;
|
import net.minecraft.nbt.NbtIo;
|
||||||
@ -14,6 +15,7 @@ import org.apache.logging.log4j.LogManager;
|
|||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -38,15 +40,17 @@ import java.util.function.Supplier;
|
|||||||
* 3. net.minecraft.world.level.saveddata.SaveData is for storing everything inside one dat file, which
|
* 3. net.minecraft.world.level.saveddata.SaveData is for storing everything inside one dat file, which
|
||||||
* is performance tanking, because we have to write *entire* NBT on each save, not the data of Drive which got changed
|
* is performance tanking, because we have to write *entire* NBT on each save, not the data of Drive which got changed
|
||||||
*/
|
*/
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class DrivePool {
|
public class DrivePool {
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
|
||||||
public static class Entry {
|
public static class Entry {
|
||||||
public final UUID id;
|
public final UUID id;
|
||||||
public final IMatteryDrive drive;
|
public final IMatteryDrive<?> drive;
|
||||||
public long last_access = System.currentTimeMillis();
|
public long last_access = System.currentTimeMillis();
|
||||||
|
|
||||||
Entry(UUID id, IMatteryDrive drive) {
|
Entry(UUID id, IMatteryDrive<?> drive) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.drive = drive;
|
this.drive = drive;
|
||||||
}
|
}
|
||||||
@ -63,7 +67,7 @@ public class DrivePool {
|
|||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IMatteryDrive access() {
|
public IMatteryDrive<?> access() {
|
||||||
last_access = System.currentTimeMillis();
|
last_access = System.currentTimeMillis();
|
||||||
return drive;
|
return drive;
|
||||||
}
|
}
|
||||||
@ -75,7 +79,7 @@ public class DrivePool {
|
|||||||
private static ReportedException exception;
|
private static ReportedException exception;
|
||||||
public static final String DATA_PATH = "data/otm_drives";
|
public static final String DATA_PATH = "data/otm_drives";
|
||||||
|
|
||||||
public static <T extends IMatteryDrive> T get(UUID id, Function<CompoundTag, T> factory_stored, Supplier<T> factory_empty) {
|
public static <T extends IMatteryDrive<?>> T get(UUID id, Function<CompoundTag, T> factory_stored, Supplier<T> factory_empty) {
|
||||||
var get = pool.get(id);
|
var get = pool.get(id);
|
||||||
|
|
||||||
if (get != null) {
|
if (get != null) {
|
||||||
@ -103,14 +107,14 @@ public class DrivePool {
|
|||||||
return factorize;
|
return factorize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void put(UUID id, IMatteryDrive drive) {
|
public static void put(UUID id, IMatteryDrive<?> drive) {
|
||||||
pool.put(id, new Entry(id, drive));
|
pool.put(id, new Entry(id, drive));
|
||||||
}
|
}
|
||||||
|
|
||||||
private record BacklogLine(UUID file, CompoundTag tag, IMatteryDrive drive) {
|
private record BacklogLine(UUID file, CompoundTag tag, IMatteryDrive<?> drive) {
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
return obj instanceof BacklogLine line && line.file.equals(file);
|
return obj instanceof BacklogLine line && line.file.equals(file) || obj instanceof UUID uuid && uuid.equals(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,16 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.drive;
|
package ru.dbotthepony.mc.otm.capability.drive;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import ru.dbotthepony.mc.otm.storage.IStorageTuple;
|
import ru.dbotthepony.mc.otm.storage.IStorageTuple;
|
||||||
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper;
|
import ru.dbotthepony.mc.otm.storage.ItemStackWrapper;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IItemMatteryDrive extends IMatteryDrive<ItemStackWrapper> {
|
public interface IItemMatteryDrive extends IMatteryDrive<ItemStackWrapper> {
|
||||||
/**
|
/**
|
||||||
* @param item
|
* @param item
|
||||||
|
@ -1,9 +1,13 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.drive;
|
package ru.dbotthepony.mc.otm.capability.drive;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IItemViewListener {
|
public interface IItemViewListener {
|
||||||
void addViewItem(ItemStack stack, UUID id_upstream);
|
void addViewItem(ItemStack stack, UUID id_upstream);
|
||||||
void changeViewItem(UUID id_upstream, int new_count);
|
void changeViewItem(UUID id_upstream, int new_count);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.Direction;
|
import net.minecraft.core.Direction;
|
||||||
import net.minecraft.core.SectionPos;
|
import net.minecraft.core.SectionPos;
|
||||||
@ -9,7 +10,10 @@ import net.minecraft.world.level.chunk.LevelChunk;
|
|||||||
import ru.dbotthepony.mc.otm.matter.MatterGrid;
|
import ru.dbotthepony.mc.otm.matter.MatterGrid;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IMatterGridCell extends IMatterGridListener {
|
public interface IMatterGridCell extends IMatterGridListener {
|
||||||
@Nullable
|
@Nullable
|
||||||
MatterGrid getMatterGrid();
|
MatterGrid getMatterGrid();
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IMatterGridListener {
|
public interface IMatterGridListener {
|
||||||
default void onPatternAdded(PatternState state) { }
|
default void onPatternAdded(PatternState state) { }
|
||||||
default void onPatternRemoved(PatternState state) { }
|
default void onPatternRemoved(PatternState state) { }
|
||||||
|
@ -1,8 +1,13 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IMatterHandler {
|
public interface IMatterHandler {
|
||||||
enum MatterDirection {
|
enum MatterDirection {
|
||||||
RECEIVE, // consumer
|
RECEIVE, // consumer
|
||||||
@ -10,25 +15,17 @@ public interface IMatterHandler {
|
|||||||
BIDIRECTIONAL // storage
|
BIDIRECTIONAL // storage
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
BigDecimal getStoredMatter();
|
BigDecimal getStoredMatter();
|
||||||
@Nonnull
|
|
||||||
BigDecimal getMaxStoredMatter();
|
BigDecimal getMaxStoredMatter();
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
BigDecimal receiveMatterOuter(BigDecimal howMuch, boolean simulate);
|
BigDecimal receiveMatterOuter(BigDecimal howMuch, boolean simulate);
|
||||||
@Nonnull
|
|
||||||
BigDecimal receiveMatterInner(BigDecimal howMuch, boolean simulate);
|
BigDecimal receiveMatterInner(BigDecimal howMuch, boolean simulate);
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
BigDecimal extractMatterOuter(BigDecimal howMuch, boolean simulate);
|
BigDecimal extractMatterOuter(BigDecimal howMuch, boolean simulate);
|
||||||
@Nonnull
|
|
||||||
BigDecimal extractMatterInner(BigDecimal howMuch, boolean simulate);
|
BigDecimal extractMatterInner(BigDecimal howMuch, boolean simulate);
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
MatterDirection getDirection();
|
MatterDirection getDirection();
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default BigDecimal getMissingMatter() {
|
default BigDecimal getMissingMatter() {
|
||||||
return getMaxStoredMatter().subtract(getStoredMatter());
|
return getMaxStoredMatter().subtract(getStoredMatter());
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,24 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IMatterTaskProvider {
|
public interface IMatterTaskProvider {
|
||||||
/**
|
/**
|
||||||
* @return immutable collection of tasks that can be allocated by a worker
|
* @return immutable collection of tasks that can be allocated by a worker
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
|
||||||
Collection<MatterTask> getTasks();
|
Collection<MatterTask> getTasks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return immutable collection of all stored tasks, even fully allocated by workers
|
* @return immutable collection of all stored tasks, even fully allocated by workers
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
|
||||||
Collection<MatterTask> getAllTasks();
|
Collection<MatterTask> getAllTasks();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,30 +1,30 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import ru.dbotthepony.mc.otm.capability.matter.PatternInsertStatus;
|
import ru.dbotthepony.mc.otm.capability.matter.PatternInsertStatus;
|
||||||
import ru.dbotthepony.mc.otm.capability.matter.PatternState;
|
import ru.dbotthepony.mc.otm.capability.matter.PatternState;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public interface IPatternStorage {
|
public interface IPatternStorage {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return unmodifiable collection of stored patterns
|
* @return unmodifiable collection of stored patterns
|
||||||
*/
|
*/
|
||||||
@Nonnull
|
|
||||||
Collection<PatternState> getStoredPatterns();
|
Collection<PatternState> getStoredPatterns();
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default Collection<PatternState> findPatterns(Item item) {
|
default Collection<PatternState> findPatterns(Item item) {
|
||||||
return findPatterns((item2) -> item.equals(item2.item()));
|
return findPatterns((item2) -> item.equals(item2.item()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nonnull
|
|
||||||
default Collection<PatternState> findPatterns(Predicate<PatternState> predicate) {
|
default Collection<PatternState> findPatterns(Predicate<PatternState> predicate) {
|
||||||
return getStoredPatterns().stream().filter(predicate).collect(Collectors.toList());
|
return getStoredPatterns().stream().filter(predicate).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ public interface IPatternStorage {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
default boolean hasPattern(@Nonnull PatternState state) {
|
default boolean hasPattern(PatternState state) {
|
||||||
return getPattern(state.id()) != null;
|
return getPattern(state.id()) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraftforge.common.util.INBTSerializable;
|
import net.minecraftforge.common.util.INBTSerializable;
|
||||||
import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler;
|
import ru.dbotthepony.mc.otm.capability.matter.IMatterHandler;
|
||||||
@ -7,8 +8,11 @@ import ru.dbotthepony.mc.otm.matter.MatterRegistry;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@MethodsReturnNonnullByDefault
|
||||||
|
@ParametersAreNonnullByDefault
|
||||||
public class MatterHandlerCapability implements IMatterHandler, INBTSerializable<CompoundTag> {
|
public class MatterHandlerCapability implements IMatterHandler, INBTSerializable<CompoundTag> {
|
||||||
protected final Runnable listener;
|
protected final Runnable listener;
|
||||||
protected BigDecimal stored = BigDecimal.ZERO;
|
protected BigDecimal stored = BigDecimal.ZERO;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.nbt.Tag;
|
import net.minecraft.nbt.Tag;
|
||||||
import net.minecraft.network.FriendlyByteBuf;
|
import net.minecraft.network.FriendlyByteBuf;
|
||||||
@ -12,11 +13,14 @@ import net.minecraftforge.registries.RegistryManager;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public record MatterTask(@Nonnull UUID id, @Nullable UUID pattern, @Nonnull Item item, int in_progress, int finished, int required) {
|
@MethodsReturnNonnullByDefault
|
||||||
public MatterTask(@Nonnull UUID id, @Nullable UUID pattern, @Nonnull Item item, int in_progress, int finished, int required) {
|
@ParametersAreNonnullByDefault
|
||||||
|
public record MatterTask(UUID id, @Nullable UUID pattern, Item item, int in_progress, int finished, int required) {
|
||||||
|
public MatterTask(UUID id, @Nullable UUID pattern, Item item, int in_progress, int finished, int required) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.pattern = pattern;
|
this.pattern = pattern;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
package ru.dbotthepony.mc.otm.capability.matter;
|
package ru.dbotthepony.mc.otm.capability.matter;
|
||||||
|
|
||||||
|
import net.minecraft.MethodsReturnNonnullByDefault;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* status: FAIL, UPDATED or INSERTED
|
* status: FAIL, UPDATED or INSERTED
|
||||||
|
@ -10,7 +10,7 @@ import java.util.Optional;
|
|||||||
* Interface implements all methods required for storage system functioning and interaction
|
* Interface implements all methods required for storage system functioning and interaction
|
||||||
* with your kind of items/objects/whatever.
|
* with your kind of items/objects/whatever.
|
||||||
*
|
*
|
||||||
* You can either implement this interface directly (hard dependency, discouraged, unless you do direct addon to this storage system)
|
* You can either implement this interface directly (hard dependency, discouraged, unless you do an addon to this storage system)
|
||||||
* or create a record class (preferred), which encapsulate your storage object.
|
* or create a record class (preferred), which encapsulate your storage object.
|
||||||
*/
|
*/
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
|
Loading…
Reference in New Issue
Block a user