mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-29 08:27:03 +01:00
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:
parent
dbd89199ac
commit
279504cccf
32 changed files with 218 additions and 256 deletions
|
@ -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.LinkedExtractorBlock;
|
||||
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.CreativeCrateBlock;
|
||||
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.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.NixieTubeBlock;
|
||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeGenerator;
|
||||
|
|
|
@ -28,8 +28,6 @@ public class AllShapes {
|
|||
CASING_11PX = shape(0, 0, 0, 16, 11, 16).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(),
|
||||
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)
|
||||
.withVerticalShapes(cuboid(4, 11, 4, 12, 17, 12)),
|
||||
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)
|
||||
.add(1, 1, 5, 7, 16, 11)
|
||||
.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(0, 10, 0, 16, 16, 16)
|
||||
.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(0, 10, 0, 16, 13, 16)
|
||||
.forDirectional(UP),
|
||||
|
|
|
@ -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.extractor.ExtractorTileEntity;
|
||||
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.CreativeCrateTileEntity;
|
||||
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.packager.PackagerRenderer;
|
||||
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.AnalogLeverTileEntity;
|
||||
import com.simibubi.create.content.logistics.block.redstone.NixieTubeRenderer;
|
||||
|
@ -227,8 +227,8 @@ public class AllTileEntities {
|
|||
|
||||
public static final TileEntityEntry<DepotTileEntity> DEPOT =
|
||||
register("depot", DepotTileEntity::new, AllBlocks.DEPOT);
|
||||
public static final TileEntityEntry<RealityFunnelTileEntity> REALITY_FUNNEL = register("reality_funnel",
|
||||
RealityFunnelTileEntity::new, AllBlocks.BRASS_FUNNEL, AllBlocks.BRASS_BELT_FUNNEL, AllBlocks.BRASS_CHUTE_FUNNEL,
|
||||
public static final TileEntityEntry<FunnelTileEntity> FUNNEL = register("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);
|
||||
public static final TileEntityEntry<PackagerTileEntity> PACKAGER =
|
||||
register("packager", PackagerTileEntity::new, AllBlocks.PACKAGER);
|
||||
|
@ -312,7 +312,7 @@ public class AllTileEntities {
|
|||
bind(LINKED_EXTRACTOR, SmartTileEntityRenderer::new);
|
||||
bind(TRANSPOSER, SmartTileEntityRenderer::new);
|
||||
bind(LINKED_TRANSPOSER, SmartTileEntityRenderer::new);
|
||||
bind(REALITY_FUNNEL, RealityFunnelRenderer::new);
|
||||
bind(FUNNEL, FunnelRenderer::new);
|
||||
bind(BELT_TUNNEL, BeltTunnelRenderer::new);
|
||||
bind(MECHANICAL_ARM, ArmRenderer::new);
|
||||
bind(BELT_OBSERVER, BeltObserverRenderer::new);
|
||||
|
|
|
@ -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.BeltMovementHandler;
|
||||
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.TransportedItemStack;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
|
@ -432,6 +433,9 @@ public class BeltTileEntity extends KineticTileEntity {
|
|||
transportedStack.insertedAt = index;
|
||||
transportedStack.insertedFrom = side;
|
||||
transportedStack.prevBeltPosition = transportedStack.beltPosition;
|
||||
|
||||
BeltTunnelInteractionHandler.flapTunnel(nextInventory, index, side.getOpposite(), true);
|
||||
|
||||
nextInventory.addItem(transportedStack);
|
||||
nextBeltController.markDirty();
|
||||
nextBeltController.sendData();
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.simibubi.create.content.contraptions.relays.belt.transport;
|
||||
|
||||
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.realityFunnel.RealityFunnelTileEntity;
|
||||
import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock;
|
||||
import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InsertingBehaviour;
|
||||
|
@ -45,10 +45,10 @@ public class BeltFunnelInteractionHandler {
|
|||
return true;
|
||||
|
||||
TileEntity te = world.getTileEntity(funnelPos);
|
||||
if (!(te instanceof RealityFunnelTileEntity))
|
||||
if (!(te instanceof FunnelTileEntity))
|
||||
return true;
|
||||
|
||||
RealityFunnelTileEntity funnelTE = (RealityFunnelTileEntity) te;
|
||||
FunnelTileEntity funnelTE = (FunnelTileEntity) te;
|
||||
InsertingBehaviour inserting = TileEntityBehaviour.get(funnelTE, InsertingBehaviour.TYPE);
|
||||
FilteringBehaviour filtering = TileEntityBehaviour.get(funnelTE, FilteringBehaviour.TYPE);
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
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.Slope;
|
||||
import com.simibubi.create.content.contraptions.relays.belt.BeltHelper;
|
||||
|
@ -46,40 +43,18 @@ public class BeltTunnelInteractionHandler {
|
|||
BeltTileEntity belt = beltInventory.belt;
|
||||
BlockPos pos = BeltHelper.getPositionForOffset(belt, offset)
|
||||
.up();
|
||||
if (!AllBlocks.BRASS_TUNNEL.has(belt.getWorld()
|
||||
.getBlockState(pos)))
|
||||
if (!(belt.getWorld()
|
||||
.getBlockState(pos)
|
||||
.getBlock() instanceof BeltTunnelBlock))
|
||||
return false;
|
||||
TileEntity te = belt.getWorld()
|
||||
.getTileEntity(pos);
|
||||
if (te == null || !(te instanceof BeltTunnelTileEntity))
|
||||
return false;
|
||||
|
||||
Direction flapFacing = movementDirection.getOpposite();
|
||||
// TODO: ask TE if item can be inserted
|
||||
|
||||
BeltTunnelTileEntity tunnel = (BeltTunnelTileEntity) te;
|
||||
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) {
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
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.AllTileEntities;
|
||||
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.wrench.IWrenchable;
|
||||
import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.utility.Lang;
|
||||
import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
|
||||
|
@ -71,13 +68,20 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
|
|||
|
||||
@Override
|
||||
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());
|
||||
if (!AllBlocks.BELT.has(blockState))
|
||||
return false;
|
||||
if (blockState.get(BeltBlock.SLOPE) != Slope.HORIZONTAL)
|
||||
return false;
|
||||
if (!blockState.get(BeltBlock.CASING))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -98,10 +102,12 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
|
|||
@Override
|
||||
public BlockState updatePostPlacement(BlockState state, Direction facing, BlockState facingState, IWorld worldIn,
|
||||
BlockPos currentPos, BlockPos facingPos) {
|
||||
if (facing.getAxis()
|
||||
.isVertical())
|
||||
return state;
|
||||
if (!(worldIn instanceof WrappedWorld))
|
||||
withTileEntityDo(worldIn, currentPos, BeltTunnelTileEntity::initFlaps);
|
||||
BlockState tunnelState = getTunnelState(worldIn, currentPos);
|
||||
|
||||
if (tunnelState.get(HORIZONTAL_AXIS) == state.get(HORIZONTAL_AXIS)) {
|
||||
if (hasWindow(tunnelState) == hasWindow(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) {
|
||||
BlockState state = getDefaultState();
|
||||
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);
|
||||
BlockState blockState1 = reader.getBlockState(pos.offset(fw));
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -185,10 +174,6 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
|
|||
@Override
|
||||
public ActionResultType onWrenched(BlockState state, ItemUseContext context) {
|
||||
|
||||
// Toggle sync
|
||||
if (toggleSync(context.getWorld(), context.getPos(), context.getFace()))
|
||||
return ActionResultType.SUCCESS;
|
||||
|
||||
// Toggle windows
|
||||
if (!hasWindow(state))
|
||||
return IWrenchable.super.onWrenched(state, context);
|
||||
|
@ -212,14 +197,6 @@ public class BeltTunnelBlock extends Block implements ITE<BeltTunnelTileEntity>,
|
|||
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
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||
boolean isMoving) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -4,11 +4,9 @@ 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.ColorHelper;
|
||||
import com.simibubi.create.foundation.utility.SuperByteBuffer;
|
||||
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.LightTexture;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
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,
|
||||
int light, int overlay) {
|
||||
SuperByteBuffer flapBuffer = AllBlockPartials.BELT_TUNNEL_FLAP.renderOn(te.getBlockState());
|
||||
SuperByteBuffer indicatorBuffer = AllBlockPartials.BELT_TUNNEL_INDICATOR.renderOn(te.getBlockState());
|
||||
BlockPos pos = te.getPos();
|
||||
World world = te.getWorld();
|
||||
|
||||
|
@ -56,21 +53,6 @@ public class BeltTunnelRenderer extends SafeTileEntityRenderer<BeltTunnelTileEnt
|
|||
flapAngle = (float) (flapAngle / 180 * Math.PI);
|
||||
|
||||
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.translate(-flapPivotX, -flapPivotY, -flapPivotZ)
|
||||
.rotate(Direction.SOUTH, flapAngle)
|
||||
|
|
|
@ -9,15 +9,14 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelBlock.Shape;
|
||||
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.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
|
@ -29,45 +28,18 @@ import net.minecraftforge.common.util.LazyOptional;
|
|||
import net.minecraftforge.items.CapabilityItemHandler;
|
||||
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, ItemStack> syncedFlaps;
|
||||
private LazyOptional<IItemHandler> cap = LazyOptional.empty();
|
||||
private boolean initialize;
|
||||
|
||||
private List<Pair<Direction, Boolean>> flapsToSend;
|
||||
|
||||
public BeltTunnelTileEntity(TileEntityType<? extends BeltTunnelTileEntity> type) {
|
||||
super(type);
|
||||
flaps = new HashMap<>();
|
||||
syncedFlaps = new HashMap<>();
|
||||
initialize = true;
|
||||
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
|
||||
public void remove() {
|
||||
super.remove();
|
||||
|
@ -76,40 +48,14 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
|
|||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
|
||||
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
|
||||
public CompoundNBT writeToClient(CompoundNBT tag) {
|
||||
CompoundNBT writeToClient = super.writeToClient(tag);
|
||||
|
@ -138,16 +84,14 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
|
|||
Direction side = Direction.byIndex(flap.getInt("Flap"));
|
||||
flap(side, flap.getBoolean("FlapInward"));
|
||||
}
|
||||
} else
|
||||
} else {
|
||||
initFlaps();
|
||||
}
|
||||
}
|
||||
|
||||
public void initFlaps() {
|
||||
if (!world.isRemote) {
|
||||
if (!world.isRemote)
|
||||
sendData();
|
||||
}
|
||||
|
||||
initialize = false;
|
||||
flaps.clear();
|
||||
BlockState tunnelState = getBlockState();
|
||||
for (Direction direction : Direction.values()) {
|
||||
|
@ -168,7 +112,8 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
|
|||
if (!positive && shape == Shape.T_RIGHT)
|
||||
continue;
|
||||
}
|
||||
flaps.put(direction, new InterpolatedChasingValue().target(0)
|
||||
flaps.put(direction, new InterpolatedChasingValue().start(.25f)
|
||||
.target(0)
|
||||
.withSpeed(.05f));
|
||||
}
|
||||
}
|
||||
|
@ -185,9 +130,14 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (initialize)
|
||||
public void initialize() {
|
||||
super.initialize();
|
||||
initFlaps();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
if (!world.isRemote) {
|
||||
if (!flapsToSend.isEmpty())
|
||||
sendData();
|
||||
|
@ -196,4 +146,28 @@ public class BeltTunnelTileEntity extends SyncedTileEntity implements ITickableT
|
|||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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.goggles.IHaveGoggleInformation;
|
||||
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.realityFunnel.ChuteFunnelBlock;
|
||||
import com.simibubi.create.content.logistics.block.realityFunnel.RealityFunnelBlock;
|
||||
import com.simibubi.create.content.logistics.block.funnel.BrassFunnelBlock;
|
||||
import com.simibubi.create.content.logistics.block.funnel.ChuteFunnelBlock;
|
||||
import com.simibubi.create.content.logistics.block.funnel.FunnelBlock;
|
||||
import com.simibubi.create.foundation.gui.widgets.InterpolatedValue;
|
||||
import com.simibubi.create.foundation.tileEntity.SmartTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
|
@ -152,7 +152,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
return false;
|
||||
if (stateBelow.get(BrassFunnelBlock.FACING) != Direction.UP)
|
||||
return false;
|
||||
ItemStack remainder = RealityFunnelBlock.tryInsert(world, pos.down(), item, simulate);
|
||||
ItemStack remainder = FunnelBlock.tryInsert(world, pos.down(), item, simulate);
|
||||
if (!simulate)
|
||||
setItem(remainder);
|
||||
return remainder.isEmpty();
|
||||
|
@ -190,7 +190,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
if (AllBlocks.BRASS_FUNNEL.has(stateAbove)) {
|
||||
if (!stateAbove.get(BrassFunnelBlock.POWERED)
|
||||
&& 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 (!simulate)
|
||||
setItem(remainder);
|
||||
|
@ -250,7 +250,7 @@ public class ChuteTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
continue;
|
||||
if (funnelState.get(ChuteFunnelBlock.PUSHING))
|
||||
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)
|
||||
setItem(remainder);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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 net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
|
||||
public class AndesiteFunnelBlock extends RealityFunnelBlock {
|
||||
public class AndesiteFunnelBlock extends FunnelBlock {
|
||||
|
||||
public AndesiteFunnelBlock(Properties p_i48415_1_) {
|
||||
super(p_i48415_1_);
|
|
@ -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.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_);
|
||||
setDefaultState(getDefaultState().with(SHAPE, Shape.RETRACTED));
|
||||
}
|
|
@ -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.tterrag.registrate.providers.DataGenContext;
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
|
@ -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;
|
||||
|
||||
|
@ -12,7 +12,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BrassFunnelBlock extends RealityFunnelBlock {
|
||||
public class BrassFunnelBlock extends FunnelBlock {
|
||||
|
||||
public static final BooleanProperty POWERED = BlockStateProperties.POWERED;
|
||||
|
|
@ -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.content.logistics.block.chute.ChuteBlock;
|
||||
|
@ -14,7 +14,7 @@ import net.minecraft.world.IWorldReader;
|
|||
|
||||
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_);
|
||||
}
|
||||
|
|
@ -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.tterrag.registrate.providers.DataGenContext;
|
|
@ -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 com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
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.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_);
|
||||
}
|
||||
|
||||
|
@ -59,13 +60,15 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
|
|||
public ActionResultType onUse(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn,
|
||||
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)
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
ItemStack heldItem = player.getHeldItem(handIn)
|
||||
.copy();
|
||||
ItemStack remainder = tryInsert(worldIn, pos, heldItem, false);
|
||||
if (!ItemStack.areItemStacksEqual(remainder, heldItem))
|
||||
ItemStack toInsert = heldItem.copy();
|
||||
ItemStack remainder = tryInsert(worldIn, pos, toInsert, false);
|
||||
if (!ItemStack.areItemStacksEqual(remainder, toInsert))
|
||||
player.setHeldItem(handIn, remainder);
|
||||
});
|
||||
return ActionResultType.SUCCESS;
|
||||
|
@ -119,18 +122,18 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
|
|||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return AllTileEntities.REALITY_FUNNEL.create();
|
||||
return AllTileEntities.FUNNEL.create();
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
public VoxelShape getCollisionShape(BlockState state, IBlockReader world, BlockPos pos, ISelectionContext context) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -168,7 +171,7 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
|
|||
Block block = world.getBlockState(pos.offset(state.get(FACING)
|
||||
.getOpposite()))
|
||||
.getBlock();
|
||||
return !(block instanceof RealityFunnelBlock) && !(block instanceof HorizontalInteractionFunnelBlock);
|
||||
return !(block instanceof FunnelBlock) && !(block instanceof HorizontalInteractionFunnelBlock);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -195,13 +198,12 @@ public abstract class RealityFunnelBlock extends ProperDirectionalBlock implemen
|
|||
|
||||
@Nullable
|
||||
public static boolean isFunnel(BlockState state) {
|
||||
return state.getBlock() instanceof RealityFunnelBlock
|
||||
|| state.getBlock() instanceof HorizontalInteractionFunnelBlock;
|
||||
return state.getBlock() instanceof FunnelBlock || state.getBlock() instanceof HorizontalInteractionFunnelBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<RealityFunnelTileEntity> getTileEntityClass() {
|
||||
return RealityFunnelTileEntity.class;
|
||||
public Class<FunnelTileEntity> getTileEntityClass() {
|
||||
return FunnelTileEntity.class;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.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.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.DirectionHelper;
|
||||
|
@ -43,7 +43,7 @@ public class FunnelFilterSlotPositioning extends ValueBoxTransform.Sided {
|
|||
|
||||
@Override
|
||||
protected void rotate(BlockState state, MatrixStack ms) {
|
||||
Direction facing = RealityFunnelBlock.getFunnelFacing(state);
|
||||
Direction facing = FunnelBlock.getFunnelFacing(state);
|
||||
|
||||
if (!facing.getAxis()
|
||||
.isVertical()
|
||||
|
@ -76,7 +76,7 @@ public class FunnelFilterSlotPositioning extends ValueBoxTransform.Sided {
|
|||
|
||||
@Override
|
||||
protected boolean isSideActive(BlockState state, Direction direction) {
|
||||
Direction facing = RealityFunnelBlock.getFunnelFacing(state);
|
||||
Direction facing = FunnelBlock.getFunnelFacing(state);
|
||||
|
||||
if (facing == null)
|
||||
return false;
|
|
@ -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.BlockState;
|
||||
|
@ -32,14 +32,14 @@ public class FunnelItem extends BlockItem {
|
|||
BlockState state = super.getStateForPlacement(ctx);
|
||||
if (state == null)
|
||||
return state;
|
||||
if (!(state.getBlock() instanceof RealityFunnelBlock))
|
||||
if (!(state.getBlock() instanceof FunnelBlock))
|
||||
return state;
|
||||
Direction direction = state.get(RealityFunnelBlock.FACING);
|
||||
Direction direction = state.get(FunnelBlock.FACING);
|
||||
if (!direction.getAxis()
|
||||
.isHorizontal())
|
||||
return state;
|
||||
|
||||
RealityFunnelBlock block = (RealityFunnelBlock) getBlock();
|
||||
FunnelBlock block = (FunnelBlock) getBlock();
|
||||
Block beltFunnelBlock = block.getEquivalentBeltFunnel(state)
|
||||
.getBlock();
|
||||
Block chuteFunnelBlock = block.getEquivalentChuteFunnel(state)
|
|
@ -1,4 +1,4 @@
|
|||
package com.simibubi.create.content.logistics.block.realityFunnel;
|
||||
package com.simibubi.create.content.logistics.block.funnel;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -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.vertex.IVertexBuilder;
|
||||
|
@ -15,14 +15,14 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
|||
import net.minecraft.util.math.MathHelper;
|
||||
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);
|
||||
}
|
||||
|
||||
@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) {
|
||||
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);
|
||||
MatrixStacker msr = MatrixStacker.of(ms);
|
||||
|
||||
float horizontalAngle = AngleHelper.horizontalAngle(RealityFunnelBlock.getFunnelFacing(te.getBlockState())
|
||||
float horizontalAngle = AngleHelper.horizontalAngle(FunnelBlock.getFunnelFacing(te.getBlockState())
|
||||
.getOpposite());
|
||||
float f = te.flap.get(partialTicks);
|
||||
|
|
@ -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.List;
|
||||
|
@ -9,7 +9,7 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import com.simibubi.create.AllBlocks;
|
||||
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.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.tileEntity.SmartTileEntity;
|
||||
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.math.BlockPos;
|
||||
|
||||
public class RealityFunnelTileEntity extends SmartTileEntity {
|
||||
public class FunnelTileEntity extends SmartTileEntity {
|
||||
|
||||
private FilteringBehaviour filtering;
|
||||
private InsertingBehaviour inserting;
|
||||
|
@ -42,7 +42,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
|
|||
INVALID, PAUSED, COLLECT, BELT, CHUTE_SIDE, CHUTE_END
|
||||
}
|
||||
|
||||
public RealityFunnelTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||
public FunnelTileEntity(TileEntityType<?> tileEntityTypeIn) {
|
||||
super(tileEntityTypeIn);
|
||||
flap = new InterpolatedChasingValue().start(.25f)
|
||||
.target(0)
|
||||
|
@ -51,7 +51,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
|
|||
|
||||
public Mode determineCurrentMode() {
|
||||
BlockState state = getBlockState();
|
||||
if (!RealityFunnelBlock.isFunnel(state))
|
||||
if (!FunnelBlock.isFunnel(state))
|
||||
return Mode.INVALID;
|
||||
if (state.has(BlockStateProperties.POWERED) && state.get(BlockStateProperties.POWERED))
|
||||
return Mode.PAUSED;
|
||||
|
@ -60,7 +60,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
|
|||
if (state.getBlock() instanceof ChuteFunnelBlock)
|
||||
return Mode.CHUTE_SIDE;
|
||||
|
||||
Direction facing = RealityFunnelBlock.getFunnelFacing(state);
|
||||
Direction facing = FunnelBlock.getFunnelFacing(state);
|
||||
BlockState input = world.getBlockState(pos.offset(facing));
|
||||
|
||||
if (AllBlocks.CHUTE.has(input))
|
||||
|
@ -85,7 +85,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
|
|||
public void tickAsHorizontalChuteFunnel() {
|
||||
if (!getBlockState().get(ChuteFunnelBlock.PUSHING))
|
||||
return;
|
||||
BlockPos chutePos = pos.offset(RealityFunnelBlock.getFunnelFacing(getBlockState()));
|
||||
BlockPos chutePos = pos.offset(FunnelBlock.getFunnelFacing(getBlockState()));
|
||||
TileEntity te = world.getTileEntity(chutePos);
|
||||
if (!(te instanceof ChuteTileEntity))
|
||||
return;
|
||||
|
@ -97,7 +97,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
|
|||
}
|
||||
|
||||
public void tickAsVerticalChuteFunnel() {
|
||||
Direction funnelFacing = RealityFunnelBlock.getFunnelFacing(getBlockState());
|
||||
Direction funnelFacing = FunnelBlock.getFunnelFacing(getBlockState());
|
||||
BlockPos chutePos = pos.offset(funnelFacing);
|
||||
TileEntity te = world.getTileEntity(chutePos);
|
||||
if (!(te instanceof ChuteTileEntity))
|
||||
|
@ -167,7 +167,7 @@ public class RealityFunnelTileEntity extends SmartTileEntity {
|
|||
@Override
|
||||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
||||
Supplier<List<Pair<BlockPos, Direction>>> direction =
|
||||
Attachments.toward(() -> RealityFunnelBlock.getFunnelFacing(getBlockState())
|
||||
Attachments.toward(() -> FunnelBlock.getFunnelFacing(getBlockState())
|
||||
.getOpposite());
|
||||
|
||||
inserting = new InsertingBehaviour(this, direction);
|
|
@ -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.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 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_);
|
||||
this.parent = parent;
|
||||
BlockState defaultState = getDefaultState().with(PUSHING, true);
|
||||
|
@ -48,7 +48,7 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i
|
|||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return AllTileEntities.REALITY_FUNNEL.create();
|
||||
return AllTileEntities.FUNNEL.create();
|
||||
}
|
||||
|
||||
@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_,
|
||||
boolean p_196243_5_) {
|
||||
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_2_.removeTileEntity(p_196243_3_);
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public abstract class HorizontalInteractionFunnelBlock extends HorizontalBlock i
|
|||
BlockPos pos, BlockPos p_196271_6_) {
|
||||
if (!canStillInteract(state, world, pos))
|
||||
return parent.getDefaultState()
|
||||
.with(RealityFunnelBlock.FACING, state.get(HORIZONTAL_FACING));
|
||||
.with(FunnelBlock.FACING, state.get(HORIZONTAL_FACING));
|
||||
return state;
|
||||
}
|
||||
|
|
@ -5,7 +5,8 @@ import javax.annotation.Nullable;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.AllBlockPartials;
|
||||
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.behaviour.filtering.FilteringBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InsertingBehaviour;
|
||||
|
@ -69,7 +70,7 @@ public abstract class ArmInteractionPoint {
|
|||
|
||||
static boolean isInteractable(BlockState 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) {
|
||||
|
@ -121,11 +122,12 @@ public abstract class ArmInteractionPoint {
|
|||
|
||||
if (AllBlocks.DEPOT.has(state))
|
||||
point = new Depot();
|
||||
if (AllBlocks.BELT.has(state))
|
||||
if (AllBlocks.BELT.has(state) && !(world.getBlockState(pos.up())
|
||||
.getBlock() instanceof BeltTunnelBlock))
|
||||
point = new Belt();
|
||||
if (AllBlocks.CHUTE.has(state))
|
||||
point = new Chute();
|
||||
if (state.getBlock() instanceof RealityFunnelBlock)
|
||||
if (state.getBlock() instanceof FunnelBlock)
|
||||
point = new Funnel();
|
||||
|
||||
if (point != null) {
|
||||
|
@ -193,7 +195,7 @@ public abstract class ArmInteractionPoint {
|
|||
@Override
|
||||
Vec3d getInteractionPositionVector() {
|
||||
return VecHelper.getCenterOf(pos)
|
||||
.add(new Vec3d(RealityFunnelBlock.getFunnelFacing(state)
|
||||
.add(new Vec3d(FunnelBlock.getFunnelFacing(state)
|
||||
.getDirectionVec()).scale(.5f));
|
||||
}
|
||||
|
||||
|
@ -209,7 +211,7 @@ public abstract class ArmInteractionPoint {
|
|||
|
||||
@Override
|
||||
Direction getInteractionDirection() {
|
||||
return RealityFunnelBlock.getFunnelFacing(state)
|
||||
return FunnelBlock.getFunnelFacing(state)
|
||||
.getOpposite();
|
||||
}
|
||||
|
||||
|
@ -226,7 +228,7 @@ public abstract class ArmInteractionPoint {
|
|||
|
||||
@Override
|
||||
boolean isValid(BlockState state) {
|
||||
return state.getBlock() instanceof RealityFunnelBlock;
|
||||
return state.getBlock() instanceof FunnelBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.simibubi.create.content.logistics.block.redstone;
|
|||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
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.ProperDirectionalBlock;
|
||||
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)
|
||||
.getOpposite());
|
||||
BlockState neighbour = worldIn.getBlockState(neighbourPos);
|
||||
if (RealityFunnelBlock.isFunnel(neighbour))
|
||||
if (FunnelBlock.isFunnel(neighbour))
|
||||
return true;
|
||||
return Block.hasSolidSide(neighbour, worldIn, neighbourPos, state.get(FACING));
|
||||
}
|
||||
|
|
|
@ -10,9 +10,10 @@ import com.simibubi.create.Create;
|
|||
import com.simibubi.create.content.contraptions.base.CasingBlock;
|
||||
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.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.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.StandardCTBehaviour;
|
||||
import com.simibubi.create.foundation.config.StressConfigDefaults;
|
||||
|
@ -50,7 +51,7 @@ public class BuilderTransformers {
|
|||
.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) {
|
||||
return b -> {
|
||||
return b.blockstate((c, p) -> {
|
||||
|
@ -95,7 +96,7 @@ public class BuilderTransformers {
|
|||
.rotationY(state.get(BeltTunnelBlock.HORIZONTAL_AXIS) == Axis.X ? 0 : 90)
|
||||
.build();
|
||||
}))
|
||||
.item()
|
||||
.item(BeltTunnelItem::new)
|
||||
.model((c, p) -> {
|
||||
String id = type + "_tunnel";
|
||||
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 |
Loading…
Reference in a new issue