mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 20:11:35 +01:00
Scanning the Far Lands for Rails
- Fixed basins not continuing their processing when items are extracted by funnel #1416 - Basins now accept full stacks for items thrown into the top manually - Fixed Smart Chutes not dropping filter items - Fixed Smart Chutes not updating attached diagonal chutes properly when removed - Fixed Server-side crash when coupling two minecarts from a glitched self-colliding pile
This commit is contained in:
parent
2fc26f1112
commit
f9d48386ca
10 changed files with 57 additions and 15 deletions
|
@ -101,6 +101,8 @@ public class DeployerMovementBehaviour extends MovementBehaviour {
|
|||
if (!tag.getBoolean("Deployed"))
|
||||
return;
|
||||
SchematicWorld schematicWorld = SchematicInstances.get(world, filter);
|
||||
if (schematicWorld == null)
|
||||
return;
|
||||
if (!schematicWorld.getBounds()
|
||||
.isVecInside(pos.subtract(schematicWorld.anchor)))
|
||||
return;
|
||||
|
|
|
@ -93,7 +93,10 @@ public class CouplingPhysics {
|
|||
public static void softCollisionStep(World world, Couple<AbstractMinecartEntity> carts, double couplingLength) {
|
||||
Couple<Float> maxSpeed = carts.map(AbstractMinecartEntity::getMaxCartSpeedOnRail);
|
||||
Couple<Boolean> canAddmotion = carts.map(MinecartSim2020::canAddMotion);
|
||||
|
||||
// Assuming Minecarts will never move faster than 1 block/tick
|
||||
Couple<Vector3d> motions = carts.map(Entity::getMotion);
|
||||
motions.replaceWithParams(VecHelper::clamp, Couple.create(1f, 1f));
|
||||
Couple<Vector3d> nextPositions = carts.map(MinecartSim2020::predictNextPositionOf);
|
||||
|
||||
Couple<RailShape> shapes = carts.mapWithContext((cart, current) -> {
|
||||
|
|
|
@ -8,6 +8,7 @@ import com.google.common.collect.Maps;
|
|||
import com.mojang.datafixers.util.Pair;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.AbstractRailBlock;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -47,7 +48,7 @@ public class MinecartSim2020 {
|
|||
|
||||
public static Vector3d predictNextPositionOf(AbstractMinecartEntity cart) {
|
||||
Vector3d position = cart.getPositionVec();
|
||||
Vector3d motion = cart.getMotion();
|
||||
Vector3d motion = VecHelper.clamp(cart.getMotion(), 1f);
|
||||
return position.add(motion);
|
||||
}
|
||||
|
||||
|
|
|
@ -131,8 +131,13 @@ public class BasinBlock extends Block implements ITE<BasinTileEntity>, IWrenchab
|
|||
return;
|
||||
ItemEntity itemEntity = (ItemEntity) entityIn;
|
||||
withTileEntityDo(worldIn, entityIn.getBlockPos(), te -> {
|
||||
|
||||
// Tossed items bypass the quarter-stack limit
|
||||
te.inputInventory.withMaxStackSize(64);
|
||||
ItemStack insertItem = ItemHandlerHelper.insertItem(te.inputInventory, itemEntity.getItem()
|
||||
.copy(), false);
|
||||
te.inputInventory.withMaxStackSize(16);
|
||||
|
||||
if (insertItem.isEmpty()) {
|
||||
itemEntity.remove();
|
||||
if (!itemEntity.world.isRemote)
|
||||
|
|
|
@ -7,8 +7,11 @@ import net.minecraftforge.items.ItemHandlerHelper;
|
|||
|
||||
public class BasinInventory extends SmartInventory {
|
||||
|
||||
private BasinTileEntity te;
|
||||
|
||||
public BasinInventory(int slots, BasinTileEntity te) {
|
||||
super(slots, te, 16, true);
|
||||
this.te = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,4 +23,12 @@ public class BasinInventory extends SmartInventory {
|
|||
return super.insertItem(slot, stack, simulate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack extractItem(int slot, int amount, boolean simulate) {
|
||||
ItemStack extractItem = super.extractItem(slot, amount, simulate);
|
||||
if (!simulate && !extractItem.isEmpty())
|
||||
te.notifyChangeOfContents();
|
||||
return extractItem;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -96,7 +96,8 @@ public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInfor
|
|||
super(type);
|
||||
inputInventory = new BasinInventory(9, this);
|
||||
inputInventory.whenContentsChanged($ -> contentsChanged = true);
|
||||
outputInventory = new BasinInventory(9, this).forbidInsertion();
|
||||
outputInventory = new BasinInventory(9, this).forbidInsertion()
|
||||
.withMaxStackSize(64);
|
||||
areFluidsMoving = false;
|
||||
itemCapability = LazyOptional.of(() -> new CombinedInvWrapper(inputInventory, outputInventory));
|
||||
contentsChanged = true;
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
|||
import com.simibubi.create.foundation.block.ITE;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||
import com.simibubi.create.foundation.utility.BlockHelper;
|
||||
import com.simibubi.create.foundation.utility.Iterate;
|
||||
|
||||
|
@ -128,6 +129,7 @@ public abstract class AbstractChuteBlock extends Block implements IWrenchable, I
|
|||
public void onReplaced(BlockState state, World world, BlockPos pos, BlockState p_196243_4_, boolean p_196243_5_) {
|
||||
boolean differentBlock = state.getBlock() != p_196243_4_.getBlock();
|
||||
if (state.hasTileEntity() && (differentBlock || !p_196243_4_.hasTileEntity())) {
|
||||
TileEntityBehaviour.destroy(world, pos, FilteringBehaviour.TYPE);
|
||||
withTileEntityDo(world, pos, c -> c.onRemoved(state));
|
||||
world.removeTileEntity(pos);
|
||||
}
|
||||
|
@ -140,7 +142,10 @@ public abstract class AbstractChuteBlock extends Block implements IWrenchable, I
|
|||
BlockPos toUpdate = pos.up()
|
||||
.offset(direction);
|
||||
BlockState stateToUpdate = world.getBlockState(toUpdate);
|
||||
BlockState updated = updateChuteState(stateToUpdate, world.getBlockState(toUpdate.up()), world, toUpdate);
|
||||
if (!isChute(stateToUpdate))
|
||||
continue;
|
||||
BlockState updated = ((AbstractChuteBlock) stateToUpdate.getBlock()).updateChuteState(stateToUpdate,
|
||||
world.getBlockState(toUpdate.up()), world, toUpdate);
|
||||
if (stateToUpdate != updated && !world.isRemote)
|
||||
world.setBlockState(toUpdate, updated);
|
||||
}
|
||||
|
@ -157,9 +162,11 @@ public abstract class AbstractChuteBlock extends Block implements IWrenchable, I
|
|||
@Override
|
||||
public void neighborChanged(BlockState p_220069_1_, World world, BlockPos pos, Block p_220069_4_,
|
||||
BlockPos neighbourPos, boolean p_220069_6_) {
|
||||
if (pos.down().equals(neighbourPos))
|
||||
if (pos.down()
|
||||
.equals(neighbourPos))
|
||||
withTileEntityDo(world, pos, ChuteTileEntity::blockBelowChanged);
|
||||
else if (pos.up().equals(neighbourPos))
|
||||
else if (pos.up()
|
||||
.equals(neighbourPos))
|
||||
withTileEntityDo(world, pos, chute -> chute.capAbove = LazyOptional.empty());
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ package com.simibubi.create.content.logistics.block.chute;
|
|||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
|
|
|
@ -35,12 +35,14 @@ public class SchematicInstances {
|
|||
public static SchematicWorld get(World world, ItemStack schematic) {
|
||||
Cache<Integer, SchematicWorld> map = loadedSchematics.get(world);
|
||||
int hash = getHash(schematic);
|
||||
try {
|
||||
return map.get(hash, () -> loadWorld(world, schematic));
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
SchematicWorld ifPresent = map.getIfPresent(hash);
|
||||
if (ifPresent != null)
|
||||
return ifPresent;
|
||||
SchematicWorld loadWorld = loadWorld(world, schematic);
|
||||
if (loadWorld == null)
|
||||
return null;
|
||||
map.put(hash, loadWorld);
|
||||
return loadWorld;
|
||||
}
|
||||
|
||||
private static SchematicWorld loadWorld(World wrapped, ItemStack schematic) {
|
||||
|
|
|
@ -18,6 +18,7 @@ public class SmartInventory extends RecipeWrapper
|
|||
protected boolean extractionAllowed;
|
||||
protected boolean insertionAllowed;
|
||||
protected boolean stackNonStackables;
|
||||
protected SyncedStackHandler wrapped;
|
||||
protected int stackSize;
|
||||
|
||||
public SmartInventory(int slots, SyncedTileEntity te) {
|
||||
|
@ -30,6 +31,13 @@ public class SmartInventory extends RecipeWrapper
|
|||
insertionAllowed = true;
|
||||
extractionAllowed = true;
|
||||
this.stackSize = stackSize;
|
||||
wrapped = (SyncedStackHandler) inv;
|
||||
}
|
||||
|
||||
public SmartInventory withMaxStackSize(int maxStackSize) {
|
||||
stackSize = maxStackSize;
|
||||
wrapped.stackSize = maxStackSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SmartInventory whenContentsChanged(Consumer<Integer> updateCallback) {
|
||||
|
|
Loading…
Reference in a new issue