Workstation transfer, Part I

- Intermediate changes, probably doesn't even compile
This commit is contained in:
simibubi 2020-09-24 13:39:12 +02:00
parent aef451e3bf
commit d9d5e60606
22 changed files with 1051 additions and 414 deletions

View file

@ -291,7 +291,7 @@ c8467d55bc22d2e2256b8b732c06c9fdc64d336f assets/create/blockstates/polished_weat
5d811eab3c5e8411f98e2ea98d93d35955ce18fc assets/create/blockstates/polished_weathered_limestone_slab.json
acec6cdebe772ca72de94a85d98199e827495acb assets/create/blockstates/polished_weathered_limestone_stairs.json
f42ad32aefcfa7ccc6287f57ee1a5f092b65126f assets/create/blockstates/polished_weathered_limestone_wall.json
b7829c2ef2c47188713f8cab21b2c9bc7f9c5b79 assets/create/blockstates/portable_storage_interface.json
1b70b4e5792dccd2110b84e209016ac258005e28 assets/create/blockstates/portable_storage_interface.json
8296d43d5f1c2113012d127038fb319af83aaee4 assets/create/blockstates/powered_latch.json
e8b0a401c10d1ba67ed71ba31bd5f9bc28571b65 assets/create/blockstates/powered_toggle_latch.json
3a739f9d4276828d83f2d2750bf3227c87bcd438 assets/create/blockstates/pulley_magnet.json
@ -1306,7 +1306,7 @@ e95125318055b8557afd7d108488cf0bdd81fe49 assets/create/models/item/polished_scor
68fb04f7a89c8117bb641e347df9bfc1f1248335 assets/create/models/item/polished_weathered_limestone_slab.json
6d92ee7112aa20e8a1adfe73d8933031c299bed1 assets/create/models/item/polished_weathered_limestone_stairs.json
b4995fb4799f33508cd6bf2ded80c0b3e866ad43 assets/create/models/item/polished_weathered_limestone_wall.json
ef2c9dcd5f6385a0f0cdc2e9120c984827863100 assets/create/models/item/portable_storage_interface.json
3bc60b0d9884c2ee0f1dd530e90fceb699eea737 assets/create/models/item/portable_storage_interface.json
d3cfc1a1137c4bc98848947d425d2972df144c95 assets/create/models/item/powdered_obsidian.json
1e501c1f2e9250aaaadcf17db62646d08177d4e1 assets/create/models/item/powered_latch.json
3a6dfc7f36e31ebfcd650c3144a7f2210e8a4f9f assets/create/models/item/powered_toggle_latch.json

View file

@ -1,28 +1,28 @@
{
"variants": {
"facing=down": {
"model": "create:block/portable_storage_interface",
"model": "create:block/portable_storage_interface/block",
"x": 180
},
"facing=up": {
"model": "create:block/portable_storage_interface"
"model": "create:block/portable_storage_interface/block"
},
"facing=north": {
"model": "create:block/portable_storage_interface",
"model": "create:block/portable_storage_interface/block",
"x": 90
},
"facing=south": {
"model": "create:block/portable_storage_interface",
"model": "create:block/portable_storage_interface/block",
"x": 90,
"y": 180
},
"facing=west": {
"model": "create:block/portable_storage_interface",
"model": "create:block/portable_storage_interface/block",
"x": 90,
"y": 270
},
"facing=east": {
"model": "create:block/portable_storage_interface",
"model": "create:block/portable_storage_interface/block",
"x": 90,
"y": 90
}

View file

@ -1,3 +1,3 @@
{
"parent": "create:block/portable_storage_interface"
"parent": "create:block/portable_storage_interface/item"
}

View file

@ -69,6 +69,10 @@ public class AllBlockPartials {
SYMMETRY_PLANE = get("symmetry_effect/plane"), SYMMETRY_CROSSPLANE = get("symmetry_effect/crossplane"),
SYMMETRY_TRIPLEPLANE = get("symmetry_effect/tripleplane"),
PORTABLE_STORAGE_INTERFACE_MIDDLE = get("portable_storage_interface/block_middle"),
PORTABLE_STORAGE_INTERFACE_MIDDLE_POWERED = get("portable_storage_interface/block_middle_powered"),
PORTABLE_STORAGE_INTERFACE_TOP = get("portable_storage_interface/block_top"),
ARM_COG = get("mechanical_arm/cog"), ARM_BASE = get("mechanical_arm/base"),
ARM_LOWER_BODY = get("mechanical_arm/lower_body"), ARM_UPPER_BODY = get("mechanical_arm/upper_body"),
ARM_HEAD = get("mechanical_arm/head"), ARM_CLAW_BASE = get("mechanical_arm/claw_base"),

View file

@ -20,6 +20,7 @@ import com.simibubi.create.content.contraptions.components.actors.HarvesterMovem
import com.simibubi.create.content.contraptions.components.actors.PloughBlock;
import com.simibubi.create.content.contraptions.components.actors.PloughMovementBehaviour;
import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceBlock;
import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceMovement;
import com.simibubi.create.content.contraptions.components.actors.SawMovementBehaviour;
import com.simibubi.create.content.contraptions.components.actors.SeatBlock;
import com.simibubi.create.content.contraptions.components.actors.SeatMovementBehaviour;
@ -667,9 +668,10 @@ public class AllBlocks {
public static final BlockEntry<PortableStorageInterfaceBlock> PORTABLE_STORAGE_INTERFACE =
REGISTRATE.block("portable_storage_interface", PortableStorageInterfaceBlock::new)
.initialProperties(SharedProperties::stone)
// .onRegister(addMovementBehaviour(new StorageInterfaceMovement()))
.blockstate(BlockStateGen.directionalBlockProvider(false))
.simpleItem()
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.partialBaseModel(c, p)))
.onRegister(addMovementBehaviour(new PortableStorageInterfaceMovement()))
.item()
.transform(customItemModel())
.register();
public static final BlockEntry<HarvesterBlock> MECHANICAL_HARVESTER =

View file

@ -32,8 +32,7 @@ public class AllShapes {
EIGHT_VOXEL_POLE = shape(4, 0, 4, 12, 16, 12).forAxis(),
FURNACE_ENGINE = shape(1, 1, 0, 15, 15, 16).add(0, 0, 9, 16, 16, 14)
.forHorizontal(Direction.SOUTH),
PORTABLE_STORAGE_INTERFACE = shape(0, 0, 0, 16, 12, 16).add(3, 12, 3, 13, 16, 13)
.forDirectional(),
PORTABLE_STORAGE_INTERFACE = shape(0, 0, 0, 16, 14, 16).forDirectional(),
PULLEY = shape(0, 0, 0, 16, 16, 2).add(1, 1, 2, 15, 15, 14)
.add(0, 0, 14, 16, 16, 16)
.forHorizontalAxis(),

View file

@ -5,6 +5,8 @@ import com.simibubi.create.content.contraptions.components.actors.DrillRenderer;
import com.simibubi.create.content.contraptions.components.actors.DrillTileEntity;
import com.simibubi.create.content.contraptions.components.actors.HarvesterRenderer;
import com.simibubi.create.content.contraptions.components.actors.HarvesterTileEntity;
import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceRenderer;
import com.simibubi.create.content.contraptions.components.actors.PortableStorageInterfaceTileEntity;
import com.simibubi.create.content.contraptions.components.clock.CuckooClockRenderer;
import com.simibubi.create.content.contraptions.components.clock.CuckooClockTileEntity;
import com.simibubi.create.content.contraptions.components.crafter.MechanicalCrafterRenderer;
@ -302,6 +304,13 @@ public class AllTileEntities {
.renderer(() -> HarvesterRenderer::new)
.register();
public static final TileEntityEntry<PortableStorageInterfaceTileEntity> PORTABLE_STORAGE_INTERFACE =
Create.registrate()
.tileEntity("portable_storage_interface", PortableStorageInterfaceTileEntity::new)
.validBlocks(AllBlocks.PORTABLE_STORAGE_INTERFACE)
.renderer(() -> PortableStorageInterfaceRenderer::new)
.register();
public static final TileEntityEntry<FlywheelTileEntity> FLYWHEEL = Create.registrate()
.tileEntity("flywheel", FlywheelTileEntity::new)
.validBlocks(AllBlocks.FLYWHEEL)
@ -326,7 +335,8 @@ public class AllTileEntities {
.renderer(() -> KineticTileEntityRenderer::new)
.register();
public static final TileEntityEntry<CrushingWheelControllerTileEntity> CRUSHING_WHEEL_CONTROLLER = Create.registrate()
public static final TileEntityEntry<CrushingWheelControllerTileEntity> CRUSHING_WHEEL_CONTROLLER =
Create.registrate()
.tileEntity("crushing_wheel_controller", CrushingWheelControllerTileEntity::new)
.validBlocks(AllBlocks.CRUSHING_WHEEL_CONTROLLER)
// .renderer(() -> renderer)
@ -449,7 +459,8 @@ public class AllTileEntities {
public static final TileEntityEntry<FunnelTileEntity> FUNNEL = Create.registrate()
.tileEntity("funnel", FunnelTileEntity::new)
.validBlocks(AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.ANDESITE_FUNNEL, AllBlocks.ANDESITE_BELT_FUNNEL)
.validBlocks(AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.ANDESITE_FUNNEL,
AllBlocks.ANDESITE_BELT_FUNNEL)
.renderer(() -> FunnelRenderer::new)
.register();
@ -465,12 +476,12 @@ public class AllTileEntities {
.renderer(() -> AdjustableRepeaterRenderer::new)
.register();
public static final TileEntityEntry<AdjustablePulseRepeaterTileEntity> ADJUSTABLE_PULSE_REPEATER = Create.registrate()
public static final TileEntityEntry<AdjustablePulseRepeaterTileEntity> ADJUSTABLE_PULSE_REPEATER =
Create.registrate()
.tileEntity("adjustable_pulse_repeater", AdjustablePulseRepeaterTileEntity::new)
.validBlocks(AllBlocks.ADJUSTABLE_PULSE_REPEATER)
.renderer(() -> AdjustableRepeaterRenderer::new)
.register();
public static void register() {
}
public static void register() {}
}

View file

@ -1,19 +1,20 @@
package com.simibubi.create.content.contraptions.components.actors;
import javax.annotation.ParametersAreNonnullByDefault;
import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities;
import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import mcp.MethodsReturnNonnullByDefault;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import javax.annotation.ParametersAreNonnullByDefault;
import mcp.MethodsReturnNonnullByDefault;
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public class PortableStorageInterfaceBlock extends ProperDirectionalBlock {
@ -22,6 +23,16 @@ public class PortableStorageInterfaceBlock extends ProperDirectionalBlock {
super(p_i48415_1_);
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.PORTABLE_STORAGE_INTERFACE.create();
}
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return getDefaultState().with(FACING, context.getNearestLookingDirection()

View file

@ -0,0 +1,167 @@
package com.simibubi.create.content.contraptions.components.actors;
import java.util.function.Predicate;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.item.ItemHelper;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.SingleTargetAutoExtractingBehaviour;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.Axis;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemHandlerHelper;
public class PortableStorageInterfaceMovement extends MovementBehaviour {
private static final String _exporting_ = "Exporting";
private static final String _delay_ = "Delay";
private static final String _workingPos_ = "WorkingPos";
@Override
public Vec3d getActiveAreaOffset(MovementContext context) {
return new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING)
.getDirectionVec()).scale(.85f);
}
@Override
public void visitNewPosition(MovementContext context, BlockPos pos) {
Direction currentFacing = getCurrentFacing(context);
PortableStorageInterfaceTileEntity psi =
getValidStationaryInterface(context.world, pos, currentFacing.getAxis());
if (psi == null)
return;
if (psi.isTransferring())
return;
context.data.put(_workingPos_, NBTUtil.writeBlockPos(pos));
context.stall = true;
}
@Override
public void tick(MovementContext context) {
if (!context.data.contains(_workingPos_))
return;
if (context.world.isRemote)
return;
BlockPos pos = NBTUtil.readBlockPos(context.data.getCompound(_workingPos_));
PortableStorageInterfaceTileEntity stationaryInterface =
getValidStationaryInterface(context.world, pos, getCurrentFacing(context).getAxis());
if (stationaryInterface == null) {
reset(context);
return;
}
int nextExtract = context.data.getInt(_delay_);
if (nextExtract > 0) {
nextExtract--;
context.data.putInt(_delay_, nextExtract);
return;
}
boolean extract = context.data.getBoolean(_exporting_);
boolean success = false;
IItemHandlerModifiable inv = context.contraption.inventory;
SingleTargetAutoExtractingBehaviour extracting =
TileEntityBehaviour.get(stationaryInterface, SingleTargetAutoExtractingBehaviour.TYPE);
FilteringBehaviour filtering = TileEntityBehaviour.get(stationaryInterface, FilteringBehaviour.TYPE);
if (extract) {
// Export from Contraption
Predicate<ItemStack> test = extracting.getFilterTest();
int exactAmount = extracting.getAmountFromFilter();
ItemStack itemExtracted = ItemStack.EMPTY;
if (exactAmount != -1)
itemExtracted = ItemHelper.extract(inv, test, exactAmount, false);
else
itemExtracted = ItemHelper.extract(inv, test, stationaryInterface::amountToExtract, false);
if (!itemExtracted.isEmpty()) {
stationaryInterface.onExtract(itemExtracted);
success = exactAmount == -1;
}
} else {
// Import to Contraption
if (extracting != null) {
extracting.setSynchronized(false);
extracting.withAdditionalFilter(stack -> {
if (filtering.anyAmount())
return true;
return ItemHandlerHelper.insertItemStacked(inv, stack, true)
.isEmpty();
});
extracting.withAmountThreshold(stack -> {
ItemStack tester = stack.copy();
tester.setCount(tester.getMaxStackSize());
return stack.getCount() - ItemHandlerHelper.insertItemStacked(inv, stack, true)
.getCount();
});
extracting.setCallback(stack -> {
ItemHandlerHelper.insertItemStacked(inv, stack, false);
});
success = extracting.extract() && filtering.anyAmount();
extracting.setSynchronized(true);
stationaryInterface.applyFilteringCallbacks();
extracting.setCallback(stationaryInterface::onExtract);
}
}
if (!success) {
reset(context);
return;
}
context.data.putInt(_delay_, AllConfigs.SERVER.logistics.defaultExtractionTimer.get());
}
@Override
public void stopMoving(MovementContext context) {
reset(context);
}
public void reset(MovementContext context) {
context.data.remove(_workingPos_);
context.data.remove(_delay_);
context.data.remove(_exporting_);
context.stall = false;
}
private PortableStorageInterfaceTileEntity getValidStationaryInterface(World world, BlockPos pos, Axis validAxis) {
TileEntity te = world.getTileEntity(pos);
if (!(te instanceof PortableStorageInterfaceTileEntity))
return null;
BlockState blockState = world.getBlockState(pos);
if (!AllBlocks.PORTABLE_STORAGE_INTERFACE.has(blockState))
return null;
if (blockState.get(PortableStorageInterfaceBlock.FACING)
.getAxis() != validAxis)
return null;
if (world.isBlockPowered(pos))
return null;
return (PortableStorageInterfaceTileEntity) te;
}
private Direction getCurrentFacing(MovementContext context) {
Vec3d directionVec = new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING)
.getDirectionVec());
directionVec = VecHelper.rotate(directionVec, context.rotation.x, context.rotation.y, context.rotation.z);
return Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z);
}
}

View file

@ -0,0 +1,64 @@
package com.simibubi.create.content.contraptions.components.actors;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.foundation.utility.MatrixStacker;
import com.simibubi.create.foundation.utility.SuperByteBuffer;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.Direction;
import net.minecraft.util.math.MathHelper;
public class PortableStorageInterfaceRenderer extends SafeTileEntityRenderer<PortableStorageInterfaceTileEntity> {
public PortableStorageInterfaceRenderer(TileEntityRendererDispatcher dispatcher) {
super(dispatcher);
}
@Override
protected void renderSafe(PortableStorageInterfaceTileEntity te, float partialTicks, MatrixStack ms,
IRenderTypeBuffer buffer, int light, int overlay) {
BlockState blockState = te.getBlockState();
SuperByteBuffer middle = AllBlockPartials.PORTABLE_STORAGE_INTERFACE_MIDDLE.renderOn(blockState);
SuperByteBuffer top = AllBlockPartials.PORTABLE_STORAGE_INTERFACE_TOP.renderOn(blockState);
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
ms.push();
Direction facing = blockState.get(PortableStorageInterfaceBlock.FACING);
MatrixStacker.of(ms)
.centre()
.rotateY(AngleHelper.horizontalAngle(facing))
.rotateX(facing == Direction.UP ? 0 : facing == Direction.DOWN ? 180 : 90)
.unCentre();
float progress = (float) ((AnimationTickHolder.getRenderTick() * .25f) % (Math.PI * 2));
float bounce = (MathHelper.sin(progress) + 1) / 4f;
if (bounce > 7/16f) {
middle = AllBlockPartials.PORTABLE_STORAGE_INTERFACE_MIDDLE_POWERED.renderOn(blockState);
}
ms.translate(0, bounce, 0);
ms.push();
ms.translate(0, 6/16f, 0);
middle.renderInto(ms, vb);
ms.pop();
ms.translate(0, bounce, 0);
top.renderInto(ms, vb);
ms.pop();
}
}

View file

@ -0,0 +1,56 @@
package com.simibubi.create.content.contraptions.components.actors;
import java.util.List;
import com.simibubi.create.content.contraptions.components.structureMovement.Contraption;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.wrapper.CombinedInvWrapper;
public class PortableStorageInterfaceTileEntity extends SmartTileEntity {
protected int transferTimeout;
protected LazyOptional<IItemHandlerModifiable> capability;
public PortableStorageInterfaceTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn);
transferTimeout = 0;
capability = LazyOptional.empty();
}
public void startTransferringTo(Contraption contraption) {
CombinedInvWrapper inventory = contraption.inventory;
capability.invalidate();
capability = LazyOptional.of(() -> inventory);
}
@Override
public void tick() {
super.tick();
}
public boolean isTransferring() {
return transferTimeout != 0;
}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) {
return super.getCapability(cap, side);
}
public void resetTimer() {
}
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
}

View file

@ -1,157 +0,0 @@
//package com.simibubi.create.content.contraptions.components.actors;
//
//import java.util.function.Predicate;
//
//import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour;
//import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext;
//import com.simibubi.create.content.logistics.block.transposer.TransposerBlock;
//import com.simibubi.create.content.logistics.block.transposer.TransposerTileEntity;
//import com.simibubi.create.foundation.config.AllConfigs;
//import com.simibubi.create.foundation.item.ItemHelper;
//import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
//import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
//import com.simibubi.create.foundation.tileEntity.behaviour.inventory.SingleTargetAutoExtractingBehaviour;
//import com.simibubi.create.foundation.utility.VecHelper;
//
//import net.minecraft.item.ItemStack;
//import net.minecraft.nbt.NBTUtil;
//import net.minecraft.tileentity.TileEntity;
//import net.minecraft.util.Direction;
//import net.minecraft.util.Direction.Axis;
//import net.minecraft.util.math.BlockPos;
//import net.minecraft.util.math.Vec3d;
//import net.minecraft.world.World;
//import net.minecraftforge.items.IItemHandlerModifiable;
//import net.minecraftforge.items.ItemHandlerHelper;
//
//public class StorageInterfaceMovement extends MovementBehaviour {
//
// private static final String _exporting_ = "Exporting";
// private static final String _delay_ = "Delay";
// private static final String _workingPos_ = "WorkingPos";
//
// @Override
// public Vec3d getActiveAreaOffset(MovementContext context) {
// return new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec()).scale(.85f);
// }
//
// @Override
// public void visitNewPosition(MovementContext context, BlockPos pos) {
// Direction currentFacing = getCurrentFacing(context);
// TransposerTileEntity transposer = getValidTransposer(context.world, pos, currentFacing.getAxis());
// if (transposer == null)
// return;
// context.data.put(_workingPos_, NBTUtil.writeBlockPos(pos));
// context.data.putBoolean(_exporting_,
// TransposerBlock.getBlockFacing(transposer.getBlockState()) != currentFacing);
// context.stall = true;
// }
//
// @Override
// public void tick(MovementContext context) {
// if (!context.data.contains(_workingPos_))
// return;
// if (context.world.isRemote)
// return;
//
// BlockPos pos = NBTUtil.readBlockPos(context.data.getCompound(_workingPos_));
// TransposerTileEntity transposer = getValidTransposer(context.world, pos, getCurrentFacing(context).getAxis());
// if (transposer == null) {
// reset(context);
// return;
// }
//
// int nextExtract = context.data.getInt(_delay_);
// if (nextExtract > 0) {
// nextExtract--;
// context.data.putInt(_delay_, nextExtract);
// return;
// }
//
// boolean extract = context.data.getBoolean(_exporting_);
// boolean success = false;
// IItemHandlerModifiable inv = context.contraption.inventory;
// SingleTargetAutoExtractingBehaviour extracting =
// TileEntityBehaviour.get(transposer, SingleTargetAutoExtractingBehaviour.TYPE);
// FilteringBehaviour filtering = TileEntityBehaviour.get(transposer, FilteringBehaviour.TYPE);
//
// if (extract) {
// // Export from Contraption
// Predicate<ItemStack> test = extracting.getFilterTest();
// int exactAmount = extracting.getAmountFromFilter();
// ItemStack itemExtracted = ItemStack.EMPTY;
// if (exactAmount != -1)
// itemExtracted = ItemHelper.extract(inv, test, exactAmount, false);
// else
// itemExtracted = ItemHelper.extract(inv, test, transposer::amountToExtract, false);
//
// if (!itemExtracted.isEmpty()) {
// transposer.onExtract(itemExtracted);
// success = exactAmount == -1;
// }
//
// } else {
// // Import to Contraption
// if (extracting != null) {
// extracting.setSynchronized(false);
// extracting.withAdditionalFilter(stack -> {
// if (filtering.anyAmount())
// return true;
// return ItemHandlerHelper.insertItemStacked(inv, stack, true).isEmpty();
// });
//
// extracting.withAmountThreshold(stack -> {
// ItemStack tester = stack.copy();
// tester.setCount(tester.getMaxStackSize());
// return stack.getCount() - ItemHandlerHelper.insertItemStacked(inv, stack, true).getCount();
// });
//
// extracting.setCallback(stack -> {
// ItemHandlerHelper.insertItemStacked(inv, stack, false);
// });
//
// success = extracting.extract() && filtering.anyAmount();
// extracting.setSynchronized(true);
// transposer.applyFilteringCallbacks();
// extracting.setCallback(transposer::onExtract);
// }
// }
//
// if (!success) {
// reset(context);
// return;
// }
//
// context.data.putInt(_delay_, AllConfigs.SERVER.logistics.extractorDelay.get());
// }
//
// @Override
// public void stopMoving(MovementContext context) {
// reset(context);
// }
//
// public void reset(MovementContext context) {
// context.data.remove(_workingPos_);
// context.data.remove(_delay_);
// context.data.remove(_exporting_);
// context.stall = false;
// }
//
// private TransposerTileEntity getValidTransposer(World world, BlockPos pos, Axis validAxis) {
// TileEntity te = world.getTileEntity(pos);
// if (!(te instanceof TransposerTileEntity))
// return null;
// if (TransposerBlock.getBlockFacing(world.getBlockState(pos)).getAxis() != validAxis)
// return null;
// if (world.isBlockPowered(pos))
// return null;
// return (TransposerTileEntity) te;
// }
//
// private Direction getCurrentFacing(MovementContext context) {
// Vec3d directionVec = new Vec3d(context.state.get(PortableStorageInterfaceBlock.FACING).getDirectionVec());
// directionVec = VecHelper.rotate(directionVec, context.rotation.x, context.rotation.y, context.rotation.z);
// return Direction.getFacingFromVector(directionVec.x, directionVec.y, directionVec.z);
// }
//
//}

View file

@ -4,6 +4,7 @@ public class CLogistics extends ConfigBase {
public ConfigInt defaultExtractionLimit = i(64, 1, 64, "defaultExtractionLimit", Comments.defaultExtractionLimit);
public ConfigInt defaultExtractionTimer = i(8, 1, "defaultExtractionTimer", Comments.defaultExtractionTimer);
public ConfigInt psiTimeout = i(20, 1, "psiTimeout", Comments.psiTimeout);
public ConfigInt mechanicalArmRange = i(5, 1, "mechanicalArmRange", Comments.mechanicalArmRange);
public ConfigInt linkRange = i(128, 1, "linkRange", Comments.linkRange);
@ -18,6 +19,7 @@ public class CLogistics extends ConfigBase {
static String defaultExtractionTimer =
"The amount of ticks a funnel waits between item transferrals, when it is not re-activated by redstone.";
static String linkRange = "Maximum possible range in blocks of redstone link connections.";
static String psiTimeout = "The amount of ticks a portable storage interface waits for transfers until letting contraptions move along.";
static String mechanicalArmRange = "Maximum distance in blocks a Mechanical Arm can reach across.";
}

View file

@ -0,0 +1,63 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/portable_storage_interface",
"1": "create:block/brass_casing",
"particle": "create:block/brass_casing"
},
"elements": [
{
"from": [0, 0, 0],
"to": [16, 12, 16],
"faces": {
"north": {"uv": [0, 10, 8, 16], "texture": "#0"},
"east": {"uv": [0, 10, 8, 16], "texture": "#0"},
"south": {"uv": [0, 10, 8, 16], "texture": "#0"},
"west": {"uv": [0, 10, 8, 16], "texture": "#0"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
},
{
"from": [0, 12, 1.9],
"to": [2, 14.1, 14.1],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 20, 10]},
"faces": {
"north": {"uv": [7, 10, 8, 11], "texture": "#0"},
"south": {"uv": [0, 10, 1, 11], "texture": "#0"},
"west": {"uv": [1, 9, 7, 10], "texture": "#0"},
"up": {"uv": [0, 2, 2, 14], "texture": "#1"}
}
},
{
"from": [14, 12, 2],
"to": [16, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 20, 6]},
"faces": {
"north": {"uv": [0, 10, 1, 11], "texture": "#0"},
"east": {"uv": [1, 9, 7, 10], "texture": "#0"},
"south": {"uv": [7, 10, 8, 11], "texture": "#0"},
"up": {"uv": [0, 2, 2, 14], "rotation": 180, "texture": "#1"}
}
},
{
"from": [2, 12, 0],
"to": [14, 14, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 20, 8]},
"faces": {
"north": {"uv": [1, 9, 7, 10], "texture": "#0"},
"east": {"uv": [0, 10, 8, 11], "texture": "#0"},
"south": {"uv": [1, 9, 7, 10], "texture": "#0"},
"west": {"uv": [0, 10, 8, 11], "texture": "#0"},
"up": {"uv": [2, 0, 14, 16], "texture": "#1"}
}
}
],
"groups": [
{
"name": "Base",
"origin": [10, 20, 8],
"children": [0, 1, 2, 3]
}
]
}

View file

@ -0,0 +1,28 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/portable_storage_interface",
"particle": "create:block/portable_storage_interface"
},
"elements": [
{
"from": [2, 0, 2],
"to": [14, 9, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 10]},
"faces": {
"north": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"east": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"south": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"west": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"up": {"uv": [1.5, 3.5, 2, 4], "texture": "#0"}
}
}
],
"groups": [
{
"name": "Middle",
"origin": [10, 22, 10],
"children": [0]
}
]
}

View file

@ -0,0 +1,28 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/portable_storage_interface",
"particle": "create:block/portable_storage_interface"
},
"elements": [
{
"from": [2, 0, 2],
"to": [14, 9, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 8, 10]},
"faces": {
"north": {"uv": [9, 3.5, 15, 8], "texture": "#0"},
"east": {"uv": [9, 3.5, 15, 8], "texture": "#0"},
"south": {"uv": [9, 3.5, 15, 8], "texture": "#0"},
"west": {"uv": [9, 3.5, 15, 8], "texture": "#0"},
"up": {"uv": [1.5, 3.5, 2, 4], "texture": "#0"}
}
}
],
"groups": [
{
"name": "Middle",
"origin": [10, 22, 10],
"children": [0]
}
]
}

View file

@ -0,0 +1,120 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/portable_storage_interface",
"particle": "create:block/portable_storage_interface"
},
"elements": [
{
"from": [3, 7, 3],
"to": [13, 14.1, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 15, 11]},
"faces": {
"north": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"},
"east": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"},
"south": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"},
"west": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"}
}
},
{
"from": [1, 14, 1],
"to": [15, 16, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 15, 8]},
"faces": {
"north": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"east": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"south": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"west": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"up": {"uv": [8.5, 8, 15.5, 15], "texture": "#0"},
"down": {"uv": [8.5, 8, 15.5, 15], "texture": "#0"}
}
},
{
"from": [4, 13.1, 13],
"to": [6, 15.1, 14],
"rotation": {"angle": 45, "axis": "x", "origin": [8, 14, 13]},
"faces": {
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [10, 15, 11, 16], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [10, 13.1, 2],
"to": [12, 15.1, 3],
"rotation": {"angle": -45, "axis": "x", "origin": [8, 14, 3]},
"faces": {
"north": {"uv": [10, 15, 11, 16], "texture": "#0"},
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [2, 13.1, 4],
"to": [3, 15.1, 6],
"rotation": {"angle": 45, "axis": "z", "origin": [3, 14, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [10, 15, 11, 16], "texture": "#0"}
}
},
{
"from": [13, 13.1, 10],
"to": [14, 15.1, 12],
"rotation": {"angle": -45, "axis": "z", "origin": [13, 14, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"east": {"uv": [10, 15, 11, 16], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [10, 13.1, 13],
"to": [12, 15.1, 14],
"rotation": {"angle": 45, "axis": "x", "origin": [8, 14, 13]},
"faces": {
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [13, 15, 14, 16], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [4, 13.1, 2],
"to": [6, 15.1, 3],
"rotation": {"angle": -45, "axis": "x", "origin": [8, 14, 3]},
"faces": {
"north": {"uv": [13, 15, 14, 16], "texture": "#0"},
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [2, 13.1, 10],
"to": [3, 15.1, 12],
"rotation": {"angle": 45, "axis": "z", "origin": [3, 14, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [13, 15, 14, 16], "texture": "#0"}
}
},
{
"from": [13, 13.1, 4],
"to": [14, 15.1, 6],
"rotation": {"angle": -45, "axis": "z", "origin": [13, 14, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"east": {"uv": [13, 15, 14, 16], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
}
],
"groups": [
{
"name": "Top",
"origin": [10, 22, 10],
"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 432 B

View file

@ -0,0 +1,238 @@
{
"credit": "Made with Blockbench",
"textures": {
"0": "create:block/portable_storage_interface",
"1": "create:block/brass_casing",
"particle": "create:block/portable_storage_interface"
},
"elements": [
{
"from": [2, 10, 2],
"to": [14, 19, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 18, 10]},
"faces": {
"north": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"east": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"south": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"west": {"uv": [1, 3.5, 7, 8], "texture": "#0"},
"up": {"uv": [1.5, 3.5, 2, 4], "texture": "#0"}
}
},
{
"from": [0, 0, 0],
"to": [16, 12, 16],
"faces": {
"north": {"uv": [0, 10, 8, 16], "texture": "#0"},
"east": {"uv": [0, 10, 8, 16], "texture": "#0"},
"south": {"uv": [0, 10, 8, 16], "texture": "#0"},
"west": {"uv": [0, 10, 8, 16], "texture": "#0"},
"up": {"uv": [0, 0, 16, 16], "texture": "#1"},
"down": {"uv": [0, 0, 16, 16], "texture": "#1"}
}
},
{
"from": [0, 12, 1.9],
"to": [2, 14.1, 14.1],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 20, 10]},
"faces": {
"north": {"uv": [7, 10, 8, 11], "texture": "#0"},
"south": {"uv": [0, 10, 1, 11], "texture": "#0"},
"west": {"uv": [1, 9, 7, 10], "texture": "#0"},
"up": {"uv": [0, 2, 2, 14], "texture": "#1"}
}
},
{
"from": [14, 12, 2],
"to": [16, 14, 14],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 20, 6]},
"faces": {
"north": {"uv": [0, 10, 1, 11], "texture": "#0"},
"east": {"uv": [1, 9, 7, 10], "texture": "#0"},
"south": {"uv": [7, 10, 8, 11], "texture": "#0"},
"up": {"uv": [0, 2, 2, 14], "rotation": 180, "texture": "#1"}
}
},
{
"from": [2, 12, 0],
"to": [14, 14, 16],
"rotation": {"angle": 0, "axis": "y", "origin": [10, 20, 8]},
"faces": {
"north": {"uv": [1, 9, 7, 10], "texture": "#0"},
"east": {"uv": [0, 10, 8, 11], "texture": "#0"},
"south": {"uv": [1, 9, 7, 10], "texture": "#0"},
"west": {"uv": [0, 10, 8, 11], "texture": "#0"},
"up": {"uv": [2, 0, 14, 16], "texture": "#1"}
}
},
{
"from": [3, 16, 3],
"to": [13, 23.1, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [11, 24, 11]},
"faces": {
"north": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"},
"east": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"},
"south": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"},
"west": {"uv": [1.5, 0, 6.5, 3.5], "texture": "#0"}
}
},
{
"from": [1, 23, 1],
"to": [15, 25, 15],
"rotation": {"angle": 0, "axis": "y", "origin": [8, 24, 8]},
"faces": {
"north": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"east": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"south": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"west": {"uv": [8.5, 15, 15.5, 16], "texture": "#0"},
"up": {"uv": [8.5, 8, 15.5, 15], "texture": "#0"},
"down": {"uv": [8.5, 8, 15.5, 15], "texture": "#0"}
}
},
{
"from": [4, 22.1, 13],
"to": [6, 24.1, 14],
"rotation": {"angle": 45, "axis": "x", "origin": [8, 23, 13]},
"faces": {
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [10, 15, 11, 16], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [10, 22.1, 2],
"to": [12, 24.1, 3],
"rotation": {"angle": -45, "axis": "x", "origin": [8, 23, 3]},
"faces": {
"north": {"uv": [10, 15, 11, 16], "texture": "#0"},
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [2, 22.1, 4],
"to": [3, 24.1, 6],
"rotation": {"angle": 45, "axis": "z", "origin": [3, 23, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [10, 15, 11, 16], "texture": "#0"}
}
},
{
"from": [13, 22.1, 10],
"to": [14, 24.1, 12],
"rotation": {"angle": -45, "axis": "z", "origin": [13, 23, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"east": {"uv": [10, 15, 11, 16], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [10, 22.1, 13],
"to": [12, 24.1, 14],
"rotation": {"angle": 45, "axis": "x", "origin": [8, 23, 13]},
"faces": {
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [13, 15, 14, 16], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [4, 22.1, 2],
"to": [6, 24.1, 3],
"rotation": {"angle": -45, "axis": "x", "origin": [8, 23, 3]},
"faces": {
"north": {"uv": [13, 15, 14, 16], "texture": "#0"},
"east": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
},
{
"from": [2, 22.1, 10],
"to": [3, 24.1, 12],
"rotation": {"angle": 45, "axis": "z", "origin": [3, 23, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"west": {"uv": [13, 15, 14, 16], "texture": "#0"}
}
},
{
"from": [13, 22.1, 4],
"to": [14, 24.1, 6],
"rotation": {"angle": -45, "axis": "z", "origin": [13, 23, 8]},
"faces": {
"north": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"},
"east": {"uv": [13, 15, 14, 16], "texture": "#0"},
"south": {"uv": [7.5, 10, 8, 10.5], "texture": "#0"}
}
}
],
"display": {
"thirdperson_righthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"thirdperson_lefthand": {
"rotation": [75, 45, 0],
"translation": [0, 2.5, 0],
"scale": [0.375, 0.375, 0.375]
},
"firstperson_righthand": {
"rotation": [0, 45, 0],
"scale": [0.4, 0.4, 0.4]
},
"firstperson_lefthand": {
"rotation": [0, 225, 0],
"scale": [0.4, 0.4, 0.4]
},
"ground": {
"translation": [0, 3, 0],
"scale": [0.25, 0.25, 0.25]
},
"gui": {
"rotation": [30, 225, 0],
"translation": [0, -1.75, 0],
"scale": [0.45, 0.45, 0.45]
},
"head": {
"rotation": [-180, 0, 0],
"translation": [0, 22.25, 0]
},
"fixed": {
"translation": [0, -1.25, 0],
"scale": [0.5, 0.5, 0.5]
}
},
"groups": [
{
"name": "Middle",
"origin": [10, 22, 10],
"children": [0]
},
{
"name": "block",
"origin": [8, 8, 8],
"children": [
{
"name": "Base",
"origin": [10, 20, 8],
"children": [1, 2, 3, 4]
}
]
},
{
"name": "block_top",
"origin": [8, 8, 8],
"children": [
{
"name": "Top",
"origin": [10, 22, 10],
"children": [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
}
]
}
]
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4 KiB