Tunnel clean-up & QOL

- Removed synchronization behaviour of belt tunnels
- Belt tunnels can now be placed on non-reinforced belt segments, and will apply the missing casing automatically
- Bunch more renames
- Small tweaks to the andesite tunnel texture
- Mechanical arms can no longer take from belts covered by a tunnel
- Belt tunnels can now create a window when directly next to a funnel
- Fixed tunnel flaps not being triggered when inserting into a covered belt
This commit is contained in:
simibubi 2020-07-08 13:41:55 +02:00
parent dbd89199ac
commit 279504cccf
32 changed files with 218 additions and 256 deletions

View file

@ -93,19 +93,19 @@ import com.simibubi.create.content.logistics.block.diodes.ToggleLatchGenerator;
import com.simibubi.create.content.logistics.block.extractor.ExtractorBlock; import com.simibubi.create.content.logistics.block.extractor.ExtractorBlock;
import com.simibubi.create.content.logistics.block.extractor.LinkedExtractorBlock; import com.simibubi.create.content.logistics.block.extractor.LinkedExtractorBlock;
import com.simibubi.create.content.logistics.block.extractor.VerticalExtractorGenerator; import com.simibubi.create.content.logistics.block.extractor.VerticalExtractorGenerator;
import com.simibubi.create.content.logistics.block.funnel.AndesiteBeltFunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.AndesiteChuteFunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.AndesiteFunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.BeltFunnelGenerator;
import com.simibubi.create.content.logistics.block.funnel.BrassBeltFunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.BrassChuteFunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.BrassFunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.ChuteFunnelGenerator;
import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateBlock;
import com.simibubi.create.content.logistics.block.inventories.CreativeCrateBlock; import com.simibubi.create.content.logistics.block.inventories.CreativeCrateBlock;
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmBlock; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmBlock;
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmItem; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmItem;
import com.simibubi.create.content.logistics.block.packager.PackagerBlock; import com.simibubi.create.content.logistics.block.packager.PackagerBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.AndesiteBeltFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.AndesiteChuteFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.AndesiteFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.BeltFunnelGenerator;
import com.simibubi.create.content.logistics.block.realityFunnel.BrassBeltFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.BrassChuteFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.BrassFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.ChuteFunnelGenerator;
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverBlock; import com.simibubi.create.content.logistics.block.redstone.AnalogLeverBlock;
import com.simibubi.create.content.logistics.block.redstone.NixieTubeBlock; import com.simibubi.create.content.logistics.block.redstone.NixieTubeBlock;
import com.simibubi.create.content.logistics.block.redstone.NixieTubeGenerator; import com.simibubi.create.content.logistics.block.redstone.NixieTubeGenerator;

View file

@ -28,8 +28,6 @@ public class AllShapes {
CASING_11PX = shape(0, 0, 0, 16, 11, 16).forDirectional(), CASING_11PX = shape(0, 0, 0, 16, 11, 16).forDirectional(),
MOTOR_BLOCK = shape(3, 0, 3, 13, 14, 13).forDirectional(), MOTOR_BLOCK = shape(3, 0, 3, 13, 14, 13).forDirectional(),
FOUR_VOXEL_POLE = shape(6, 0, 6, 10, 16, 10).forAxis(), SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(), FOUR_VOXEL_POLE = shape(6, 0, 6, 10, 16, 10).forAxis(), SIX_VOXEL_POLE = shape(5, 0, 5, 11, 16, 11).forAxis(),
BELT_FUNNEL = shape(3, -4, 11, 13, 8, 17).forHorizontal(SOUTH),
FUNNEL = shape(1, 1, 13, 15, 15, 17).forDirectional(SOUTH),
EXTRACTOR = shape(4, 2, 11, 12, 10, 17).forDirectional(SOUTH) EXTRACTOR = shape(4, 2, 11, 12, 10, 17).forDirectional(SOUTH)
.withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)), .withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)),
TRANSPOSER = shape(4, 4, -1, 12, 12, 1).add(5, 5, 0, 11, 11, 16) TRANSPOSER = shape(4, 4, -1, 12, 12, 1).add(5, 5, 0, 11, 11, 16)
@ -65,11 +63,11 @@ public class AllShapes {
NIXIE_TUBE_CEILING = shape(0, 12, 0, 16, 16, 16).add(9, 1, 5, 15, 16, 11) NIXIE_TUBE_CEILING = shape(0, 12, 0, 16, 16, 16).add(9, 1, 5, 15, 16, 11)
.add(1, 1, 5, 7, 16, 11) .add(1, 1, 5, 7, 16, 11)
.forHorizontalAxis(), .forHorizontalAxis(),
REALITY_FUNNEL = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14) FUNNEL = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14)
.add(1, 6, 1, 15, 10, 15) .add(1, 6, 1, 15, 10, 15)
.add(0, 10, 0, 16, 16, 16) .add(0, 10, 0, 16, 16, 16)
.forDirectional(UP), .forDirectional(UP),
REALITY_FUNNEL_COLLISION = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14) FUNNEL_COLLISION = shape(3, -2, 3, 13, 2, 13).add(2, 2, 2, 14, 6, 14)
.add(1, 6, 1, 15, 10, 15) .add(1, 6, 1, 15, 10, 15)
.add(0, 10, 0, 16, 13, 16) .add(0, 10, 0, 16, 13, 16)
.forDirectional(UP), .forDirectional(UP),

View file

@ -81,14 +81,14 @@ import com.simibubi.create.content.logistics.block.diodes.AdjustableRepeaterRend
import com.simibubi.create.content.logistics.block.diodes.AdjustableRepeaterTileEntity; import com.simibubi.create.content.logistics.block.diodes.AdjustableRepeaterTileEntity;
import com.simibubi.create.content.logistics.block.extractor.ExtractorTileEntity; import com.simibubi.create.content.logistics.block.extractor.ExtractorTileEntity;
import com.simibubi.create.content.logistics.block.extractor.LinkedExtractorTileEntity; import com.simibubi.create.content.logistics.block.extractor.LinkedExtractorTileEntity;
import com.simibubi.create.content.logistics.block.funnel.FunnelRenderer;
import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity;
import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateTileEntity; import com.simibubi.create.content.logistics.block.inventories.AdjustableCrateTileEntity;
import com.simibubi.create.content.logistics.block.inventories.CreativeCrateTileEntity; import com.simibubi.create.content.logistics.block.inventories.CreativeCrateTileEntity;
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmRenderer; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmRenderer;
import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity;
import com.simibubi.create.content.logistics.block.packager.PackagerRenderer; import com.simibubi.create.content.logistics.block.packager.PackagerRenderer;
import com.simibubi.create.content.logistics.block.packager.PackagerTileEntity; import com.simibubi.create.content.logistics.block.packager.PackagerTileEntity;
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelRenderer;
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelTileEntity;
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverRenderer; import com.simibubi.create.content.logistics.block.redstone.AnalogLeverRenderer;
import com.simibubi.create.content.logistics.block.redstone.AnalogLeverTileEntity; import com.simibubi.create.content.logistics.block.redstone.AnalogLeverTileEntity;
import com.simibubi.create.content.logistics.block.redstone.NixieTubeRenderer; import com.simibubi.create.content.logistics.block.redstone.NixieTubeRenderer;
@ -227,8 +227,8 @@ public class AllTileEntities {
public static final TileEntityEntry<DepotTileEntity> DEPOT = public static final TileEntityEntry<DepotTileEntity> DEPOT =
register("depot", DepotTileEntity::new, AllBlocks.DEPOT); register("depot", DepotTileEntity::new, AllBlocks.DEPOT);
public static final TileEntityEntry<RealityFunnelTileEntity> REALITY_FUNNEL = register("reality_funnel", public static final TileEntityEntry<FunnelTileEntity> FUNNEL = register("funnel",
RealityFunnelTileEntity::new, AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL, FunnelTileEntity::new, AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL,
AllBlocks.ANDESITE_FUNNEL, AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL); AllBlocks.ANDESITE_FUNNEL, AllBlocks.ANDESITE_BELT_FUNNEL, AllBlocks.ANDESITE_CHUTE_FUNNEL);
public static final TileEntityEntry<PackagerTileEntity> PACKAGER = public static final TileEntityEntry<PackagerTileEntity> PACKAGER =
register("packager", PackagerTileEntity::new, AllBlocks.PACKAGER); register("packager", PackagerTileEntity::new, AllBlocks.PACKAGER);
@ -312,7 +312,7 @@ public class AllTileEntities {
bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new); bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new);
bind(TRANSPOSER, SmartTileEntityRenderer::new); bind(TRANSPOSER, SmartTileEntityRenderer::new);
bind(LINKED_TRANSPOSER, SmartTileEntityRenderer::new); bind(LINKED_TRANSPOSER, SmartTileEntityRenderer::new);
bind(REALITY_FUNNEL, RealityFunnelRenderer::new); bind(FUNNEL, FunnelRenderer::new);
bind(BELT_TUNNEL, BeltTunnelRenderer::new); bind(BELT_TUNNEL, BeltTunnelRenderer::new);
bind(MECHANICAL_ARM, ArmRenderer::new); bind(MECHANICAL_ARM, ArmRenderer::new);
bind(BELT_OBSERVER, BeltObserverRenderer::new); bind(BELT_OBSERVER, BeltObserverRenderer::new);

View file

@ -21,6 +21,7 @@ import com.simibubi.create.content.contraptions.relays.belt.BeltBlock.Slope;
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltInventory; import com.simibubi.create.content.contraptions.relays.belt.transport.BeltInventory;
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler; import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler;
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler.TransportedEntityInfo; import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler.TransportedEntityInfo;
import com.simibubi.create.content.contraptions.relays.belt.transport.BeltTunnelInteractionHandler;
import com.simibubi.create.content.contraptions.relays.belt.transport.ItemHandlerBeltSegment; import com.simibubi.create.content.contraptions.relays.belt.transport.ItemHandlerBeltSegment;
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
@ -432,6 +433,9 @@ public class BeltTileEntity extends KineticTileEntity {
transportedStack.insertedAt = index; transportedStack.insertedAt = index;
transportedStack.insertedFrom = side; transportedStack.insertedFrom = side;
transportedStack.prevBeltPosition = transportedStack.beltPosition; transportedStack.prevBeltPosition = transportedStack.beltPosition;
BeltTunnelInteractionHandler.flapTunnel(nextInventory, index, side.getOpposite(), true);
nextInventory.addItem(transportedStack); nextInventory.addItem(transportedStack);
nextBeltController.markDirty(); nextBeltController.markDirty();
nextBeltController.sendData(); nextBeltController.sendData();

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.contraptions.relays.belt.transport; package com.simibubi.create.content.contraptions.relays.belt.transport;
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
import com.simibubi.create.content.logistics.block.realityFunnel.BeltFunnelBlock; import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelTileEntity; import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InsertingBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InsertingBehaviour;
@ -45,10 +45,10 @@ public class BeltFunnelInteractionHandler {
return true; return true;
TileEntity te = world.getTileEntity(funnelPos); TileEntity te = world.getTileEntity(funnelPos);
if (!(te instanceof RealityFunnelTileEntity)) if (!(te instanceof FunnelTileEntity))
return true; return true;
RealityFunnelTileEntity funnelTE = (RealityFunnelTileEntity) te; FunnelTileEntity funnelTE = (FunnelTileEntity) te;
InsertingBehaviour inserting = TileEntityBehaviour.get(funnelTE, InsertingBehaviour.TYPE); InsertingBehaviour inserting = TileEntityBehaviour.get(funnelTE, InsertingBehaviour.TYPE);
FilteringBehaviour filtering = TileEntityBehaviour.get(funnelTE, FilteringBehaviour.TYPE); FilteringBehaviour filtering = TileEntityBehaviour.get(funnelTE, FilteringBehaviour.TYPE);

View file

@ -1,8 +1,5 @@
package com.simibubi.create.content.contraptions.relays.belt.transport; package com.simibubi.create.content.contraptions.relays.belt.transport;
import java.util.List;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock.Slope; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock.Slope;
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
@ -46,40 +43,18 @@ public class BeltTunnelInteractionHandler {
BeltTileEntity belt = beltInventory.belt; BeltTileEntity belt = beltInventory.belt;
BlockPos pos = BeltHelper.getPositionForOffset(belt, offset) BlockPos pos = BeltHelper.getPositionForOffset(belt, offset)
.up(); .up();
if (!AllBlocks.BRASS_TUNNEL.has(belt.getWorld() if (!(belt.getWorld()
.getBlockState(pos))) .getBlockState(pos)
.getBlock() instanceof BeltTunnelBlock))
return false; return false;
TileEntity te = belt.getWorld() TileEntity te = belt.getWorld()
.getTileEntity(pos); .getTileEntity(pos);
if (te == null || !(te instanceof BeltTunnelTileEntity)) if (te == null || !(te instanceof BeltTunnelTileEntity))
return false; return false;
Direction flapFacing = movementDirection.getOpposite(); // TODO: ask TE if item can be inserted
BeltTunnelTileEntity tunnel = (BeltTunnelTileEntity) te; return false;
if (!tunnel.flaps.containsKey(flapFacing))
return false;
if (!tunnel.syncedFlaps.containsKey(flapFacing))
return false;
ItemStack heldItem = tunnel.syncedFlaps.get(flapFacing);
if (heldItem == null) {
tunnel.syncedFlaps.put(flapFacing, ItemStack.EMPTY);
belt.sendData();
return false;
}
if (heldItem == ItemStack.EMPTY) {
tunnel.syncedFlaps.put(flapFacing, stack);
return true;
}
List<BeltTunnelTileEntity> group = BeltTunnelBlock.getSynchronizedGroup(belt.getWorld(), pos, flapFacing);
for (BeltTunnelTileEntity otherTunnel : group)
if (otherTunnel.syncedFlaps.get(flapFacing) == ItemStack.EMPTY)
return true;
for (BeltTunnelTileEntity otherTunnel : group)
otherTunnel.syncedFlaps.put(flapFacing, null);
return true;
} }
public static void flapTunnel(BeltInventory beltInventory, int offset, Direction side, boolean inward) { public static void flapTunnel(BeltInventory beltInventory, int offset, Direction side, boolean inward) {

View file

@ -1,14 +1,11 @@
package com.simibubi.create.content.logistics.block.belts.tunnel; package com.simibubi.create.content.logistics.block.belts.tunnel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock.Slope; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock.Slope;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
@ -71,13 +68,20 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
@Override @Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
BlockState blockState = worldIn.getBlockState(pos.down());
if (!isValidPositionForPlacement(state, worldIn, pos))
return false;
if (!blockState.get(BeltBlock.CASING))
return false;
return true;
}
public boolean isValidPositionForPlacement(BlockState state, IWorldReader worldIn, BlockPos pos) {
BlockState blockState = worldIn.getBlockState(pos.down()); BlockState blockState = worldIn.getBlockState(pos.down());
if (!AllBlocks.BELT.has(blockState)) if (!AllBlocks.BELT.has(blockState))
return false; return false;
if (blockState.get(BeltBlock.SLOPE) != Slope.HORIZONTAL) if (blockState.get(BeltBlock.SLOPE) != Slope.HORIZONTAL)
return false; return false;
if (!blockState.get(BeltBlock.CASING))
return false;
return true; return true;
} }
@ -98,10 +102,12 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
@Override @Override
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn, public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn,
BlockPos currentPos, BlockPos facingPos) { BlockPos currentPos, BlockPos facingPos) {
if (facing.getAxis()
.isVertical())
return state;
if (!(worldIn instanceof WrappedWorld)) if (!(worldIn instanceof WrappedWorld))
withTileEntityDo(worldIn, currentPos, BeltTunnelTileEntity::initFlaps); withTileEntityDo(worldIn, currentPos, BeltTunnelTileEntity::initFlaps);
BlockState tunnelState = getTunnelState(worldIn, currentPos); BlockState tunnelState = getTunnelState(worldIn, currentPos);
if (tunnelState.get(HORIZONTAL_AXIS) == state.get(HORIZONTAL_AXIS)) { if (tunnelState.get(HORIZONTAL_AXIS) == state.get(HORIZONTAL_AXIS)) {
if (hasWindow(tunnelState) == hasWindow(state)) if (hasWindow(tunnelState) == hasWindow(state))
return state; return state;
@ -121,29 +127,6 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
} }
} }
public static List<BeltTunnelTileEntity> getSynchronizedGroup(World world, BlockPos pos, Direction flapFacing) {
List<BeltTunnelTileEntity> group = new ArrayList<>();
Direction searchDirection = flapFacing.rotateY();
for (Direction d : Arrays.asList(searchDirection, searchDirection.getOpposite())) {
BlockPos currentPos = pos;
while (true) {
if (!world.isBlockPresent(currentPos))
break;
TileEntity te = world.getTileEntity(currentPos);
if (te == null || !(te instanceof BeltTunnelTileEntity))
break;
BeltTunnelTileEntity tunnel = (BeltTunnelTileEntity) te;
if (!tunnel.syncedFlaps.containsKey(flapFacing))
break;
group.add(tunnel);
currentPos = currentPos.offset(d);
}
}
return group;
}
private BlockState getTunnelState(IBlockReader reader, BlockPos pos) { private BlockState getTunnelState(IBlockReader reader, BlockPos pos) {
BlockState state = getDefaultState(); BlockState state = getDefaultState();
BlockState belt = reader.getBlockState(pos.down()); BlockState belt = reader.getBlockState(pos.down());
@ -175,7 +158,13 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
Direction fw = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis); Direction fw = Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis);
BlockState blockState1 = reader.getBlockState(pos.offset(fw)); BlockState blockState1 = reader.getBlockState(pos.offset(fw));
BlockState blockState2 = reader.getBlockState(pos.offset(fw.getOpposite())); BlockState blockState2 = reader.getBlockState(pos.offset(fw.getOpposite()));
if (blockState1.getBlock() instanceof BeltTunnelBlock && blockState2.getBlock() instanceof BeltTunnelBlock) boolean valid1 =
blockState1.getBlock() instanceof BeltTunnelBlock || blockState1.getBlock() instanceof BeltFunnelBlock
&& blockState1.get(BeltFunnelBlock.HORIZONTAL_FACING) == fw.getOpposite();
boolean valid2 =
blockState2.getBlock() instanceof BeltTunnelBlock || blockState2.getBlock() instanceof BeltFunnelBlock
&& blockState2.get(BeltFunnelBlock.HORIZONTAL_FACING) == fw;
if (valid1 && valid2)
state = state.with(SHAPE, Shape.WINDOW); state = state.with(SHAPE, Shape.WINDOW);
} }
@ -185,10 +174,6 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
@Override @Override
public ActionResultType onWrenched(BlockState state, ItemUseContext context) { public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
// Toggle sync
if (toggleSync(context.getWorld(), context.getPos(), context.getFace()))
return ActionResultType.SUCCESS;
// Toggle windows // Toggle windows
if (!hasWindow(state)) if (!hasWindow(state))
return IWrenchable.super.onWrenched(state, context); return IWrenchable.super.onWrenched(state, context);
@ -212,14 +197,6 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
} }
private boolean toggleSync(World world, BlockPos pos, Direction face) {
TileEntity te = world.getTileEntity(pos);
if (te == null || !(te instanceof BeltTunnelTileEntity))
return false;
BeltTunnelTileEntity tunnel = (BeltTunnelTileEntity) te;
return tunnel.toggleSyncForFlap(face);
}
@Override @Override
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos, public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) { boolean isMoving) {

View file

@ -0,0 +1,47 @@
package com.simibubi.create.content.logistics.block.belts.tunnel;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity;
import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity.CasingType;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.world.World;
public class BeltTunnelItem extends BlockItem {
public BeltTunnelItem(Block p_i48527_1_, Properties p_i48527_2_) {
super(p_i48527_1_, p_i48527_2_);
}
@Override
protected boolean canPlace(BlockItemUseContext ctx, BlockState state) {
PlayerEntity playerentity = ctx.getPlayer();
ISelectionContext iselectioncontext =
playerentity == null ? ISelectionContext.dummy() : ISelectionContext.forEntity(playerentity);
World world = ctx.getWorld();
BlockPos pos = ctx.getPos();
return (!this.checkPosition() || AllBlocks.ANDESITE_TUNNEL.get()
.isValidPositionForPlacement(state, world, pos)) && world.canPlace(state, pos, iselectioncontext);
}
@Override
protected boolean onBlockPlaced(BlockPos pos, World world, PlayerEntity p_195943_3_, ItemStack p_195943_4_,
BlockState state) {
boolean flag = super.onBlockPlaced(pos, world, p_195943_3_, p_195943_4_, state);
if (!world.isRemote) {
BeltTileEntity belt = BeltHelper.getSegmentTE(world, pos.down());
if (belt != null && belt.casing == CasingType.NONE)
belt.setCasingType(AllBlocks.ANDESITE_TUNNEL.has(state) ? CasingType.ANDESITE : CasingType.BRASS);
}
return flag;
}
}

View file

@ -4,11 +4,9 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.SuperByteBuffer; import com.simibubi.create.foundation.utility.SuperByteBuffer;
import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
@ -28,7 +26,6 @@ public class BeltTunnelRenderer extends SafeTileEntityRenderer<BeltTunnelTileEnt
protected void renderSafe(BeltTunnelTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderSafe(BeltTunnelTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) { int light, int overlay) {
SuperByteBuffer flapBuffer = AllBlockPartials.BELT_TUNNEL_FLAP.renderOn(te.getBlockState()); SuperByteBuffer flapBuffer = AllBlockPartials.BELT_TUNNEL_FLAP.renderOn(te.getBlockState());
SuperByteBuffer indicatorBuffer = AllBlockPartials.BELT_TUNNEL_INDICATOR.renderOn(te.getBlockState());
BlockPos pos = te.getPos(); BlockPos pos = te.getPos();
World world = te.getWorld(); World world = te.getWorld();
@ -56,21 +53,6 @@ public class BeltTunnelRenderer extends SafeTileEntityRenderer<BeltTunnelTileEnt
flapAngle = (float) (flapAngle / 180 * Math.PI); flapAngle = (float) (flapAngle / 180 * Math.PI);
IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid()); IVertexBuilder vb = buffer.getBuffer(RenderType.getSolid());
if (te.syncedFlaps.containsKey(direction)) {
float lightIntensity = abs * abs * abs;
int indicatorLight = WorldRenderer.getLightmapCoordinates(world, pos);
int indicatorBlockLight = LightTexture.getBlockLightCoordinates(indicatorLight);
int indicatorSkyLight = LightTexture.getSkyLightCoordinates(indicatorLight);
indicatorBlockLight = Math.max(indicatorBlockLight, (int) (12 * lightIntensity));
indicatorLight = LightTexture.pack(indicatorBlockLight, indicatorSkyLight);
int color = ColorHelper.mixColors(0x808080, 0xFFFFFF, lightIntensity);
indicatorBuffer.rotateCentered(Direction.UP, (float) ((horizontalAngle + 90) / 180f * Math.PI))
.color(color)
.light(indicatorLight)
.renderInto(ms, vb);
}
flapBuffer.rotateCentered(Direction.UP, (float) (horizontalAngle / 180f * Math.PI)); flapBuffer.rotateCentered(Direction.UP, (float) (horizontalAngle / 180f * Math.PI));
flapBuffer.translate(-flapPivotX, -flapPivotY, -flapPivotZ) flapBuffer.translate(-flapPivotX, -flapPivotY, -flapPivotZ)
.rotate(Direction.SOUTH, flapAngle) .rotate(Direction.SOUTH, flapAngle)

View file

@ -9,15 +9,14 @@ import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape;
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT; import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType; import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -29,45 +28,18 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableTileEntity { public class BeltTunnelTileEntity extends SmartTileEntity {
public HashMap<Direction, InterpolatedChasingValue> flaps; public HashMap<Direction, InterpolatedChasingValue> flaps;
public HashMap<Direction, ItemStack> syncedFlaps;
private LazyOptional<IItemHandler> cap = LazyOptional.empty(); private LazyOptional<IItemHandler> cap = LazyOptional.empty();
private boolean initialize;
private List<Pair<Direction, Boolean>> flapsToSend; private List<Pair<Direction, Boolean>> flapsToSend;
public BeltTunnelTileEntity(TileEntityType<? extends BeltTunnelTileEntity> type) { public BeltTunnelTileEntity(TileEntityType<? extends BeltTunnelTileEntity> type) {
super(type); super(type);
flaps = new HashMap<>(); flaps = new HashMap<>();
syncedFlaps = new HashMap<>();
initialize = true;
flapsToSend = new LinkedList<>(); flapsToSend = new LinkedList<>();
} }
@Override
public <T> LazyOptional<T> getCapability(Capability<T> capability, Direction side) {
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
if (!this.cap.isPresent()) {
if (AllBlocks.BELT.has(world.getBlockState(pos.down()))) {
TileEntity teBelow = world.getTileEntity(pos.down());
if (teBelow != null) {
T capBelow = teBelow.getCapability(capability, Direction.UP)
.orElse(null);
if (capBelow != null) {
cap = LazyOptional.of(() -> capBelow)
.cast();
}
}
}
}
return this.cap.cast();
}
return super.getCapability(capability, side);
}
@Override @Override
public void remove() { public void remove() {
super.remove(); super.remove();
@ -76,40 +48,14 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
@Override @Override
public CompoundNBT write(CompoundNBT compound) { public CompoundNBT write(CompoundNBT compound) {
CompoundNBT dyedFlapsNBT = new CompoundNBT();
syncedFlaps.forEach((direction, pair) -> {
dyedFlapsNBT.putBoolean(direction.name(), true);
});
compound.put("syncedFlaps", dyedFlapsNBT);
return super.write(compound); return super.write(compound);
} }
@Override @Override
public void read(CompoundNBT compound) { public void read(CompoundNBT compound) {
if (compound.contains("syncedFlaps")) {
syncedFlaps.clear();
CompoundNBT dyedFlapsNBT = compound.getCompound("syncedFlaps");
for (Direction direction : Direction.values()) {
if (dyedFlapsNBT.contains(direction.name()))
syncedFlaps.put(direction, ItemStack.EMPTY);
}
}
super.read(compound); super.read(compound);
} }
public boolean toggleSyncForFlap(Direction face) {
if (!flaps.containsKey(face))
return false;
if (syncedFlaps.containsKey(face))
syncedFlaps.remove(face);
else
syncedFlaps.put(face, ItemStack.EMPTY);
markDirty();
sendData();
return true;
}
@Override @Override
public CompoundNBT writeToClient(CompoundNBT tag) { public CompoundNBT writeToClient(CompoundNBT tag) {
CompoundNBT writeToClient = super.writeToClient(tag); CompoundNBT writeToClient = super.writeToClient(tag);
@ -138,16 +84,14 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
Direction side = Direction.byIndex(flap.getInt("Flap")); Direction side = Direction.byIndex(flap.getInt("Flap"));
flap(side, flap.getBoolean("FlapInward")); flap(side, flap.getBoolean("FlapInward"));
} }
} else } else {
initFlaps(); initFlaps();
}
} }
public void initFlaps() { public void initFlaps() {
if (!world.isRemote) { if (!world.isRemote)
sendData(); sendData();
}
initialize = false;
flaps.clear(); flaps.clear();
BlockState tunnelState = getBlockState(); BlockState tunnelState = getBlockState();
for (Direction direction : Direction.values()) { for (Direction direction : Direction.values()) {
@ -168,7 +112,8 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
if (!positive && shape == Shape.T_RIGHT) if (!positive && shape == Shape.T_RIGHT)
continue; continue;
} }
flaps.put(direction, new InterpolatedChasingValue().target(0) flaps.put(direction, new InterpolatedChasingValue().start(.25f)
.target(0)
.withSpeed(.05f)); .withSpeed(.05f));
} }
} }
@ -184,10 +129,15 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
flapsToSend.add(Pair.of(side, inward)); flapsToSend.add(Pair.of(side, inward));
} }
@Override
public void initialize() {
super.initialize();
initFlaps();
}
@Override @Override
public void tick() { public void tick() {
if (initialize) super.tick();
initFlaps();
if (!world.isRemote) { if (!world.isRemote) {
if (!flapsToSend.isEmpty()) if (!flapsToSend.isEmpty())
sendData(); sendData();
@ -196,4 +146,28 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
flaps.forEach((d, value) -> value.tick()); flaps.forEach((d, value) -> value.tick());
} }
@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
@Override
public <T> LazyOptional<T> getCapability(Capability<T> capability, Direction side) {
if (capability != CapabilityItemHandler.ITEM_HANDLER_CAPABILITY)
return super.getCapability(capability, side);
if (!this.cap.isPresent()) {
if (AllBlocks.BELT.has(world.getBlockState(pos.down()))) {
TileEntity teBelow = world.getTileEntity(pos.down());
if (teBelow != null) {
T capBelow = teBelow.getCapability(capability, Direction.UP)
.orElse(null);
if (capBelow != null) {
cap = LazyOptional.of(() -> capBelow)
.cast();
}
}
}
}
return this.cap.cast();
}
} }

View file

@ -10,9 +10,9 @@ import com.simibubi.create.content.contraptions.components.fan.EncasedFanBlock;
import com.simibubi.create.content.contraptions.components.fan.EncasedFanTileEntity; import com.simibubi.create.content.contraptions.components.fan.EncasedFanTileEntity;
import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation;
import com.simibubi.create.content.logistics.block.chute.ChuteBlock.Shape; import com.simibubi.create.content.logistics.block.chute.ChuteBlock.Shape;
import com.simibubi.create.content.logistics.block.realityFunnel.BrassFunnelBlock; import com.simibubi.create.content.logistics.block.funnel.BrassFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.ChuteFunnelBlock; import com.simibubi.create.content.logistics.block.funnel.ChuteFunnelBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelBlock; import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
import com.simibubi.create.foundation.gui.widgets.InterpolatedValue; import com.simibubi.create.foundation.gui.widgets.InterpolatedValue;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
@ -152,7 +152,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
return false; return false;
if (stateBelow.get(BrassFunnelBlock.FACING) != Direction.UP) if (stateBelow.get(BrassFunnelBlock.FACING) != Direction.UP)
return false; return false;
ItemStack remainder = RealityFunnelBlock.tryInsert(world, pos.down(), item, simulate); ItemStack remainder = FunnelBlock.tryInsert(world, pos.down(), item, simulate);
if (!simulate) if (!simulate)
setItem(remainder); setItem(remainder);
return remainder.isEmpty(); return remainder.isEmpty();
@ -190,7 +190,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
if (AllBlocks.BRASS_FUNNEL.has(stateAbove)) { if (AllBlocks.BRASS_FUNNEL.has(stateAbove)) {
if (!stateAbove.get(BrassFunnelBlock.POWERED) if (!stateAbove.get(BrassFunnelBlock.POWERED)
&& stateAbove.get(BrassFunnelBlock.FACING) == Direction.DOWN) { && stateAbove.get(BrassFunnelBlock.FACING) == Direction.DOWN) {
ItemStack remainder = RealityFunnelBlock.tryInsert(world, pos.up(), item, simulate); ItemStack remainder = FunnelBlock.tryInsert(world, pos.up(), item, simulate);
if (remainder.isEmpty()) { if (remainder.isEmpty()) {
if (!simulate) if (!simulate)
setItem(remainder); setItem(remainder);
@ -250,7 +250,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
continue; continue;
if (funnelState.get(ChuteFunnelBlock.PUSHING)) if (funnelState.get(ChuteFunnelBlock.PUSHING))
continue; continue;
ItemStack remainder = RealityFunnelBlock.tryInsert(world, funnelPos, item.copy(), world.isRemote); ItemStack remainder = FunnelBlock.tryInsert(world, funnelPos, item.copy(), world.isRemote);
if (remainder.getCount() != item.getCount() && !world.isRemote) if (remainder.getCount() != item.getCount() && !world.isRemote)
setItem(remainder); setItem(remainder);
} }

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;

View file

@ -1,11 +1,11 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
public class AndesiteFunnelBlock extends RealityFunnelBlock { public class AndesiteFunnelBlock extends FunnelBlock {
public AndesiteFunnelBlock(Properties p_i48415_1_) { public AndesiteFunnelBlock(Properties p_i48415_1_) {
super(p_i48415_1_); super(p_i48415_1_);

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
@ -47,7 +47,7 @@ public abstract class BeltFunnelBlock extends HorizontalInteractionFunnelBlock {
} }
} }
public BeltFunnelBlock(BlockEntry<? extends RealityFunnelBlock> parent, Properties p_i48377_1_) { public BeltFunnelBlock(BlockEntry<? extends FunnelBlock> parent, Properties p_i48377_1_) {
super(parent, p_i48377_1_); super(parent, p_i48377_1_);
setDefaultState(getDefaultState().with(SHAPE, Shape.RETRACTED)); setDefaultState(getDefaultState().with(SHAPE, Shape.RETRACTED));
} }

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.foundation.data.SpecialBlockStateGen; import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.DataGenContext;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
@ -12,7 +12,7 @@ import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BrassFunnelBlock extends RealityFunnelBlock { public class BrassFunnelBlock extends FunnelBlock {
public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty POWERED = BlockStateProperties.POWERED;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.content.logistics.block.chute.ChuteBlock; import com.simibubi.create.content.logistics.block.chute.ChuteBlock;
@ -14,7 +14,7 @@ import net.minecraft.world.IWorldReader;
public abstract class ChuteFunnelBlock extends HorizontalInteractionFunnelBlock { public abstract class ChuteFunnelBlock extends HorizontalInteractionFunnelBlock {
public ChuteFunnelBlock(BlockEntry<? extends RealityFunnelBlock> parent, Properties p_i48377_1_) { public ChuteFunnelBlock(BlockEntry<? extends FunnelBlock> parent, Properties p_i48377_1_) {
super(parent, p_i48377_1_); super(parent, p_i48377_1_);
} }

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.foundation.data.SpecialBlockStateGen; import com.simibubi.create.foundation.data.SpecialBlockStateGen;
import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.DataGenContext;

View file

@ -1,7 +1,8 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.logistics.block.chute.ChuteBlock; import com.simibubi.create.content.logistics.block.chute.ChuteBlock;
@ -35,9 +36,9 @@ import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader; import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
public abstract class RealityFunnelBlock extends ProperDirectionalBlock implements ITE<RealityFunnelTileEntity> { public abstract class FunnelBlock extends ProperDirectionalBlock implements ITE<FunnelTileEntity> {
public RealityFunnelBlock(Properties p_i48415_1_) { public FunnelBlock(Properties p_i48415_1_) {
super(p_i48415_1_); super(p_i48415_1_);
} }
@ -59,13 +60,15 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
BlockRayTraceResult hit) { BlockRayTraceResult hit) {
if (hit.getFace() == getFunnelFacing(state)) { ItemStack heldItem = player.getHeldItem(handIn);
boolean shouldntInsertItem = AllBlocks.MECHANICAL_ARM.isIn(heldItem);
if (hit.getFace() == getFunnelFacing(state) && !shouldntInsertItem) {
if (!worldIn.isRemote) if (!worldIn.isRemote)
withTileEntityDo(worldIn, pos, te -> { withTileEntityDo(worldIn, pos, te -> {
ItemStack heldItem = player.getHeldItem(handIn) ItemStack toInsert = heldItem.copy();
.copy(); ItemStack remainder = tryInsert(worldIn, pos, toInsert, false);
ItemStack remainder = tryInsert(worldIn, pos, heldItem, false); if (!ItemStack.areItemStacksEqual(remainder, toInsert))
if (!ItemStack.areItemStacksEqual(remainder, heldItem))
player.setHeldItem(handIn, remainder); player.setHeldItem(handIn, remainder);
}); });
return ActionResultType.SUCCESS; return ActionResultType.SUCCESS;
@ -119,18 +122,18 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.REALITY_FUNNEL.create(); return AllTileEntities.FUNNEL.create();
} }
@Override @Override
public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) { public VoxelShape getShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) {
return AllShapes.REALITY_FUNNEL.get(state.get(FACING)); return AllShapes.FUNNEL.get(state.get(FACING));
} }
@Override @Override
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) { public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) {
if (context.getEntity() instanceof ItemEntity) if (context.getEntity() instanceof ItemEntity)
return AllShapes.REALITY_FUNNEL_COLLISION.get(state.get(FACING)); return AllShapes.FUNNEL_COLLISION.get(state.get(FACING));
return getShape(state, world, pos, context); return getShape(state, world, pos, context);
} }
@ -168,7 +171,7 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
Block block = world.getBlockState(pos.offset(state.get(FACING) Block block = world.getBlockState(pos.offset(state.get(FACING)
.getOpposite())) .getOpposite()))
.getBlock(); .getBlock();
return !(block instanceof RealityFunnelBlock) && !(block instanceof HorizontalInteractionFunnelBlock); return !(block instanceof FunnelBlock) && !(block instanceof HorizontalInteractionFunnelBlock);
} }
@Nullable @Nullable
@ -195,13 +198,12 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
@Nullable @Nullable
public static boolean isFunnel(BlockState state) { public static boolean isFunnel(BlockState state) {
return state.getBlock() instanceof RealityFunnelBlock return state.getBlock() instanceof FunnelBlock || state.getBlock() instanceof HorizontalInteractionFunnelBlock;
|| state.getBlock() instanceof HorizontalInteractionFunnelBlock;
} }
@Override @Override
public Class<RealityFunnelTileEntity> getTileEntityClass() { public Class<FunnelTileEntity> getTileEntityClass() {
return RealityFunnelTileEntity.class; return FunnelTileEntity.class;
} }
} }

View file

@ -1,8 +1,8 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.logistics.block.realityFunnel.BeltFunnelBlock.Shape; import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform;
import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.DirectionHelper; import com.simibubi.create.foundation.utility.DirectionHelper;
@ -43,7 +43,7 @@ public class FunnelFilterSlotPositioning extends ValueBoxTransform.Sided {
@Override @Override
protected void rotate(BlockState state, MatrixStack ms) { protected void rotate(BlockState state, MatrixStack ms) {
Direction facing = RealityFunnelBlock.getFunnelFacing(state); Direction facing = FunnelBlock.getFunnelFacing(state);
if (!facing.getAxis() if (!facing.getAxis()
.isVertical() .isVertical()
@ -76,7 +76,7 @@ public class FunnelFilterSlotPositioning extends ValueBoxTransform.Sided {
@Override @Override
protected boolean isSideActive(BlockState state, Direction direction) { protected boolean isSideActive(BlockState state, Direction direction) {
Direction facing = RealityFunnelBlock.getFunnelFacing(state); Direction facing = FunnelBlock.getFunnelFacing(state);
if (facing == null) if (facing == null)
return false; return false;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -32,14 +32,14 @@ public class FunnelItem extends BlockItem {
BlockState state = super.getStateForPlacement(ctx); BlockState state = super.getStateForPlacement(ctx);
if (state == null) if (state == null)
return state; return state;
if (!(state.getBlock() instanceof RealityFunnelBlock)) if (!(state.getBlock() instanceof FunnelBlock))
return state; return state;
Direction direction = state.get(RealityFunnelBlock.FACING); Direction direction = state.get(FunnelBlock.FACING);
if (!direction.getAxis() if (!direction.getAxis()
.isHorizontal()) .isHorizontal())
return state; return state;
RealityFunnelBlock block = (RealityFunnelBlock) getBlock(); FunnelBlock block = (FunnelBlock) getBlock();
Block beltFunnelBlock = block.getEquivalentBeltFunnel(state) Block beltFunnelBlock = block.getEquivalentBeltFunnel(state)
.getBlock(); .getBlock();
Block chuteFunnelBlock = block.getEquivalentChuteFunnel(state) Block chuteFunnelBlock = block.getEquivalentChuteFunnel(state)

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import java.util.List; import java.util.List;

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder; import com.mojang.blaze3d.vertex.IVertexBuilder;
@ -15,14 +15,14 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
public class RealityFunnelRenderer extends SmartTileEntityRenderer<RealityFunnelTileEntity> { public class FunnelRenderer extends SmartTileEntityRenderer<FunnelTileEntity> {
public RealityFunnelRenderer(TileEntityRendererDispatcher dispatcher) { public FunnelRenderer(TileEntityRendererDispatcher dispatcher) {
super(dispatcher); super(dispatcher);
} }
@Override @Override
protected void renderSafe(RealityFunnelTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer, protected void renderSafe(FunnelTileEntity te, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffer,
int light, int overlay) { int light, int overlay) {
super.renderSafe(te, partialTicks, ms, buffer, light, overlay); super.renderSafe(te, partialTicks, ms, buffer, light, overlay);
@ -34,7 +34,7 @@ public class RealityFunnelRenderer extends SmartTileEntityRenderer<RealityFunnel
Vec3d pivot = VecHelper.voxelSpace(0, 10, 9.5f); Vec3d pivot = VecHelper.voxelSpace(0, 10, 9.5f);
MatrixStacker msr = MatrixStacker.of(ms); MatrixStacker msr = MatrixStacker.of(ms);
float horizontalAngle = AngleHelper.horizontalAngle(RealityFunnelBlock.getFunnelFacing(te.getBlockState()) float horizontalAngle = AngleHelper.horizontalAngle(FunnelBlock.getFunnelFacing(te.getBlockState())
.getOpposite()); .getOpposite());
float f = te.flap.get(partialTicks); float f = te.flap.get(partialTicks);

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -9,7 +9,7 @@ import org.apache.commons.lang3.tuple.Pair;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack;
import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity; import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity;
import com.simibubi.create.content.logistics.block.realityFunnel.BeltFunnelBlock.Shape; import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape;
import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue;
import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
@ -29,7 +29,7 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
public class RealityFunnelTileEntity extends SmartTileEntity { public class FunnelTileEntity extends SmartTileEntity {
private FilteringBehaviour filtering; private FilteringBehaviour filtering;
private InsertingBehaviour inserting; private InsertingBehaviour inserting;
@ -42,7 +42,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
INVALID, PAUSED, COLLECT, BELT, CHUTE_SIDE, CHUTE_END INVALID, PAUSED, COLLECT, BELT, CHUTE_SIDE, CHUTE_END
} }
public RealityFunnelTileEntity(TileEntityType<?> tileEntityTypeIn) { public FunnelTileEntity(TileEntityType<?> tileEntityTypeIn) {
super(tileEntityTypeIn); super(tileEntityTypeIn);
flap = new InterpolatedChasingValue().start(.25f) flap = new InterpolatedChasingValue().start(.25f)
.target(0) .target(0)
@ -51,7 +51,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
public Mode determineCurrentMode() { public Mode determineCurrentMode() {
BlockState state = getBlockState(); BlockState state = getBlockState();
if (!RealityFunnelBlock.isFunnel(state)) if (!FunnelBlock.isFunnel(state))
return Mode.INVALID; return Mode.INVALID;
if (state.has(BlockStateProperties.POWERED) && state.get(BlockStateProperties.POWERED)) if (state.has(BlockStateProperties.POWERED) && state.get(BlockStateProperties.POWERED))
return Mode.PAUSED; return Mode.PAUSED;
@ -60,7 +60,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
if (state.getBlock() instanceof ChuteFunnelBlock) if (state.getBlock() instanceof ChuteFunnelBlock)
return Mode.CHUTE_SIDE; return Mode.CHUTE_SIDE;
Direction facing = RealityFunnelBlock.getFunnelFacing(state); Direction facing = FunnelBlock.getFunnelFacing(state);
BlockState input = world.getBlockState(pos.offset(facing)); BlockState input = world.getBlockState(pos.offset(facing));
if (AllBlocks.CHUTE.has(input)) if (AllBlocks.CHUTE.has(input))
@ -85,7 +85,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
public void tickAsHorizontalChuteFunnel() { public void tickAsHorizontalChuteFunnel() {
if (!getBlockState().get(ChuteFunnelBlock.PUSHING)) if (!getBlockState().get(ChuteFunnelBlock.PUSHING))
return; return;
BlockPos chutePos = pos.offset(RealityFunnelBlock.getFunnelFacing(getBlockState())); BlockPos chutePos = pos.offset(FunnelBlock.getFunnelFacing(getBlockState()));
TileEntity te = world.getTileEntity(chutePos); TileEntity te = world.getTileEntity(chutePos);
if (!(te instanceof ChuteTileEntity)) if (!(te instanceof ChuteTileEntity))
return; return;
@ -97,7 +97,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
} }
public void tickAsVerticalChuteFunnel() { public void tickAsVerticalChuteFunnel() {
Direction funnelFacing = RealityFunnelBlock.getFunnelFacing(getBlockState()); Direction funnelFacing = FunnelBlock.getFunnelFacing(getBlockState());
BlockPos chutePos = pos.offset(funnelFacing); BlockPos chutePos = pos.offset(funnelFacing);
TileEntity te = world.getTileEntity(chutePos); TileEntity te = world.getTileEntity(chutePos);
if (!(te instanceof ChuteTileEntity)) if (!(te instanceof ChuteTileEntity))
@ -167,7 +167,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
@Override @Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) { public void addBehaviours(List<TileEntityBehaviour> behaviours) {
Supplier<List<Pair<BlockPos, Direction>>> direction = Supplier<List<Pair<BlockPos, Direction>>> direction =
Attachments.toward(() -> RealityFunnelBlock.getFunnelFacing(getBlockState()) Attachments.toward(() -> FunnelBlock.getFunnelFacing(getBlockState())
.getOpposite()); .getOpposite());
inserting = new InsertingBehaviour(this, direction); inserting = new InsertingBehaviour(this, direction);

View file

@ -1,4 +1,4 @@
package com.simibubi.create.content.logistics.block.realityFunnel; package com.simibubi.create.content.logistics.block.funnel;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;
@ -28,9 +28,9 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i
public static final BooleanProperty POWERED = BlockStateProperties.POWERED; public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
public static final BooleanProperty PUSHING = BooleanProperty.create("pushing"); public static final BooleanProperty PUSHING = BooleanProperty.create("pushing");
private BlockEntry<? extends RealityFunnelBlock> parent; private BlockEntry<? extends FunnelBlock> parent;
public HorizontalInteractionFunnelBlock(BlockEntry<? extends RealityFunnelBlock> parent, Properties p_i48377_1_) { public HorizontalInteractionFunnelBlock(BlockEntry<? extends FunnelBlock> parent, Properties p_i48377_1_) {
super(p_i48377_1_); super(p_i48377_1_);
this.parent = parent; this.parent = parent;
BlockState defaultState = getDefaultState().with(PUSHING, true); BlockState defaultState = getDefaultState().with(PUSHING, true);
@ -48,7 +48,7 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return AllTileEntities.REALITY_FUNNEL.create(); return AllTileEntities.FUNNEL.create();
} }
@Override @Override
@ -71,7 +71,7 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i
public void onReplaced(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_, public void onReplaced(BlockState p_196243_1_, World p_196243_2_, BlockPos p_196243_3_, BlockState p_196243_4_,
boolean p_196243_5_) { boolean p_196243_5_) {
if (p_196243_1_.hasTileEntity() if (p_196243_1_.hasTileEntity()
&& (p_196243_1_.getBlock() != p_196243_4_.getBlock() && !RealityFunnelBlock.isFunnel(p_196243_4_) && (p_196243_1_.getBlock() != p_196243_4_.getBlock() && !FunnelBlock.isFunnel(p_196243_4_)
|| !p_196243_4_.hasTileEntity())) { || !p_196243_4_.hasTileEntity())) {
p_196243_2_.removeTileEntity(p_196243_3_); p_196243_2_.removeTileEntity(p_196243_3_);
} }
@ -88,7 +88,7 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i
BlockPos pos, BlockPos p_196271_6_) { BlockPos pos, BlockPos p_196271_6_) {
if (!canStillInteract(state, world, pos)) if (!canStillInteract(state, world, pos))
return parent.getDefaultState() return parent.getDefaultState()
.with(RealityFunnelBlock.FACING, state.get(HORIZONTAL_FACING)); .with(FunnelBlock.FACING, state.get(HORIZONTAL_FACING));
return state; return state;
} }

View file

@ -5,7 +5,8 @@ import javax.annotation.Nullable;
import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.AllBlocks; import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelBlock; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InsertingBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InsertingBehaviour;
@ -69,7 +70,7 @@ public abstract class ArmInteractionPoint {
static boolean isInteractable(BlockState state) { static boolean isInteractable(BlockState state) {
return AllBlocks.DEPOT.has(state) || AllBlocks.BELT.has(state) || AllBlocks.CHUTE.has(state) return AllBlocks.DEPOT.has(state) || AllBlocks.BELT.has(state) || AllBlocks.CHUTE.has(state)
|| state.getBlock() instanceof RealityFunnelBlock; || state.getBlock() instanceof FunnelBlock;
} }
ArmAngleTarget getTargetAngles(BlockPos armPos) { ArmAngleTarget getTargetAngles(BlockPos armPos) {
@ -121,11 +122,12 @@ public abstract class ArmInteractionPoint {
if (AllBlocks.DEPOT.has(state)) if (AllBlocks.DEPOT.has(state))
point = new Depot(); point = new Depot();
if (AllBlocks.BELT.has(state)) if (AllBlocks.BELT.has(state) && !(world.getBlockState(pos.up())
.getBlock() instanceof BeltTunnelBlock))
point = new Belt(); point = new Belt();
if (AllBlocks.CHUTE.has(state)) if (AllBlocks.CHUTE.has(state))
point = new Chute(); point = new Chute();
if (state.getBlock() instanceof RealityFunnelBlock) if (state.getBlock() instanceof FunnelBlock)
point = new Funnel(); point = new Funnel();
if (point != null) { if (point != null) {
@ -193,7 +195,7 @@ public abstract class ArmInteractionPoint {
@Override @Override
Vec3d getInteractionPositionVector() { Vec3d getInteractionPositionVector() {
return VecHelper.getCenterOf(pos) return VecHelper.getCenterOf(pos)
.add(new Vec3d(RealityFunnelBlock.getFunnelFacing(state) .add(new Vec3d(FunnelBlock.getFunnelFacing(state)
.getDirectionVec()).scale(.5f)); .getDirectionVec()).scale(.5f));
} }
@ -209,7 +211,7 @@ public abstract class ArmInteractionPoint {
@Override @Override
Direction getInteractionDirection() { Direction getInteractionDirection() {
return RealityFunnelBlock.getFunnelFacing(state) return FunnelBlock.getFunnelFacing(state)
.getOpposite(); .getOpposite();
} }
@ -226,7 +228,7 @@ public abstract class ArmInteractionPoint {
@Override @Override
boolean isValid(BlockState state) { boolean isValid(BlockState state) {
return state.getBlock() instanceof RealityFunnelBlock; return state.getBlock() instanceof FunnelBlock;
} }
@Override @Override

View file

@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.block.redstone;
import com.simibubi.create.AllShapes; import com.simibubi.create.AllShapes;
import com.simibubi.create.AllTileEntities; import com.simibubi.create.AllTileEntities;
import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.content.contraptions.wrench.IWrenchable;
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelBlock; import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ITE;
import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.block.ProperDirectionalBlock;
import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Iterate;
@ -165,7 +165,7 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE<Red
BlockPos neighbourPos = pos.offset(state.get(FACING) BlockPos neighbourPos = pos.offset(state.get(FACING)
.getOpposite()); .getOpposite());
BlockState neighbour = worldIn.getBlockState(neighbourPos); BlockState neighbour = worldIn.getBlockState(neighbourPos);
if (RealityFunnelBlock.isFunnel(neighbour)) if (FunnelBlock.isFunnel(neighbour))
return true; return true;
return Block.hasSolidSide(neighbour, worldIn, neighbourPos, state.get(FACING)); return Block.hasSolidSide(neighbour, worldIn, neighbourPos, state.get(FACING));
} }

View file

@ -10,9 +10,10 @@ import com.simibubi.create.Create;
import com.simibubi.create.content.contraptions.base.CasingBlock; import com.simibubi.create.content.contraptions.base.CasingBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonGenerator; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonGenerator;
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock; import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock;
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelItem;
import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
import com.simibubi.create.content.logistics.block.funnel.FunnelItem;
import com.simibubi.create.content.logistics.block.inventories.CrateBlock; import com.simibubi.create.content.logistics.block.inventories.CrateBlock;
import com.simibubi.create.content.logistics.block.realityFunnel.FunnelItem;
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelBlock;
import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry; import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry;
import com.simibubi.create.foundation.block.connected.StandardCTBehaviour; import com.simibubi.create.foundation.block.connected.StandardCTBehaviour;
import com.simibubi.create.foundation.config.StressConfigDefaults; import com.simibubi.create.foundation.config.StressConfigDefaults;
@ -50,7 +51,7 @@ public class BuilderTransformers {
.simpleItem(); .simpleItem();
} }
public static <B extends RealityFunnelBlock> NonNullUnaryOperator<BlockBuilder<B, CreateRegistrate>> funnel( public static <B extends FunnelBlock> NonNullUnaryOperator<BlockBuilder<B, CreateRegistrate>> funnel(
String type, ResourceLocation particleTexture) { String type, ResourceLocation particleTexture) {
return b -> { return b -> {
return b.blockstate((c, p) -> { return b.blockstate((c, p) -> {
@ -95,7 +96,7 @@ public class BuilderTransformers {
.rotationY(state.get(BeltTunnelBlock.HORIZONTAL_AXIS) == Axis.X ? 0 : 90) .rotationY(state.get(BeltTunnelBlock.HORIZONTAL_AXIS) == Axis.X ? 0 : 90)
.build(); .build();
})) }))
.item() .item(BeltTunnelItem::new)
.model((c, p) -> { .model((c, p) -> {
String id = type + "_tunnel"; String id = type + "_tunnel";
p.withExistingParent("item/" + id, p.modLoc("block/belt_tunnel/item")) p.withExistingParent("item/" + id, p.modLoc("block/belt_tunnel/item"))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB