Oops, Empty Vault

- Fixed crash when curios inventory is configured to have no slots #4174
- Clean up frontier list when hitting unloaded chunks with hose pulley, potentially helps #4225
- Fixed vaults not marking chunks dirty when its inventory changes #4279
- Fixed players kicked for flying when standing on contraptions with a mount
This commit is contained in:
simibubi 2023-01-14 22:05:43 +01:00
parent a60036433b
commit f07574bff1
7 changed files with 29 additions and 12 deletions

View file

@ -19,19 +19,26 @@ public class Curios {
modEventBus.addListener(Curios::onInterModEnqueue);
modEventBus.addListener(Curios::onClientSetup);
GogglesItem.addIsWearingPredicate(player -> player.getCapability(CuriosCapability.INVENTORY).map(handler -> {
ICurioStacksHandler stacksHandler = handler.getCurios().get("head");
if (stacksHandler != null) {
return AllItems.GOGGLES.isIn(stacksHandler.getStacks().getStackInSlot(0));
}
return false;
}).orElse(false));
GogglesItem.addIsWearingPredicate(player -> player.getCapability(CuriosCapability.INVENTORY)
.map(handler -> {
ICurioStacksHandler stacksHandler = handler.getCurios()
.get("head");
if (stacksHandler == null)
return false;
if (stacksHandler.getSlots() == 0)
return false;
return AllItems.GOGGLES.isIn(stacksHandler.getStacks()
.getStackInSlot(0));
})
.orElse(false));
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(CuriosRenderers::onLayerRegister));
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
() -> () -> modEventBus.addListener(CuriosRenderers::onLayerRegister));
}
private static void onInterModEnqueue(final InterModEnqueueEvent event) {
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.HEAD.getMessageBuilder().build());
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.HEAD.getMessageBuilder()
.build());
}
private static void onClientSetup(final FMLClientSetupEvent event) {

View file

@ -339,6 +339,9 @@ public class ContraptionCollider {
if (surfaceCollision.isTrue()) {
contraptionEntity.registerColliding(entity);
entity.fallDistance = 0;
for (Entity rider : entity.getIndirectPassengers())
if (rider instanceof ServerPlayer playerRider)
playerRider.connection.aboveGroundTickCount = 0;
boolean canWalk = bounce != 0 || slide == 0;
if (canWalk || !rotation.hasVerticalRotation()) {
if (canWalk)

View file

@ -269,12 +269,13 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour {
}, false);
} catch (ChunkNotLoadedException e) {
tileEntity.sendData();
frontier.clear();
visited.clear();
}
Level world = getWorld();
int maxBlocks = maxBlocks();
if (visited.size() > maxBlocks && canDrainInfinitely(fluid)) {
if (visited.size() > maxBlocks && canDrainInfinitely(fluid) && !queue.isEmpty()) {
infinite = true;
// Find first block with valid fluid
while (true) {
@ -306,6 +307,7 @@ public class FluidDrainingBehaviour extends FluidManipulationBehaviour {
search(fluid, validationFrontier, validationVisited, (e, d) -> newValidationSet.add(e), false);
} catch (ChunkNotLoadedException e) {
validationFrontier.clear();
validationVisited.clear();
setLongValidationTimer();
return;
}

View file

@ -76,6 +76,7 @@ public class FluidFillingBehaviour extends FluidManipulationBehaviour {
(p, d) -> infinityCheckFrontier.add(new BlockPosEntry(p, d)), true);
} catch (ChunkNotLoadedException e) {
infinityCheckFrontier.clear();
infinityCheckVisited.clear();
setLongValidationTimer();
return;
}

View file

@ -36,7 +36,6 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
public static final int MAX_HEAT_CAPACITY = 10000;
public static final int INSERTION_THRESHOLD = 500;
public static final int SPECIAL_INSERTION_THRESHOLD = 500;
protected FuelType activeFuel;
protected int remainingBurnTime;
@ -209,7 +208,7 @@ public class BlazeBurnerTileEntity extends SmartTileEntity {
return false;
if (newFuel == activeFuel) {
if (remainingBurnTime <= (activeFuel == FuelType.NORMAL ? INSERTION_THRESHOLD : SPECIAL_INSERTION_THRESHOLD)) {
if (remainingBurnTime <= INSERTION_THRESHOLD) {
newBurnTime += remainingBurnTime;
} else if (forceOverflow && newFuel == FuelType.NORMAL) {
if (remainingBurnTime < MAX_HEAT_CAPACITY) {

View file

@ -71,6 +71,8 @@ public class ItemVaultTileEntity extends SmartTileEntity implements IMultiTileCo
if (controllerTE == null)
return;
level.blockEntityChanged(controllerTE.worldPosition);
BlockPos pos = controllerTE.getBlockPos();
for (int y = 0; y < controllerTE.radius; y++) {
for (int z = 0; z < (controllerTE.axis == Axis.X ? controllerTE.radius : controllerTE.length); z++) {

View file

@ -577,6 +577,9 @@ public class Navigation {
TrackNode initialNode2 = forward ? startingPoint.node2 : startingPoint.node1;
TrackEdge initialEdge = graph.getConnectionsFrom(initialNode1)
.get(initialNode2);
if (initialEdge == null)
return;
double distanceToNode2 = forward ? initialEdge.getLength() - startingPoint.position : startingPoint.position;
frontier.add(new FrontierEntry(distanceToNode2, 0, initialNode1, initialNode2, initialEdge));