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::onInterModEnqueue);
modEventBus.addListener(Curios::onClientSetup); modEventBus.addListener(Curios::onClientSetup);
GogglesItem.addIsWearingPredicate(player -> player.getCapability(CuriosCapability.INVENTORY).map(handler -> { GogglesItem.addIsWearingPredicate(player -> player.getCapability(CuriosCapability.INVENTORY)
ICurioStacksHandler stacksHandler = handler.getCurios().get("head"); .map(handler -> {
if (stacksHandler != null) { ICurioStacksHandler stacksHandler = handler.getCurios()
return AllItems.GOGGLES.isIn(stacksHandler.getStacks().getStackInSlot(0)); .get("head");
} if (stacksHandler == null)
return false; return false;
}).orElse(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) { 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) { private static void onClientSetup(final FMLClientSetupEvent event) {

View file

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

View file

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

View file

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

View file

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

View file

@ -71,6 +71,8 @@ public class ItemVaultTileEntity extends SmartTileEntity implements IMultiTileCo
if (controllerTE == null) if (controllerTE == null)
return; return;
level.blockEntityChanged(controllerTE.worldPosition);
BlockPos pos = controllerTE.getBlockPos(); BlockPos pos = controllerTE.getBlockPos();
for (int y = 0; y < controllerTE.radius; y++) { for (int y = 0; y < controllerTE.radius; y++) {
for (int z = 0; z < (controllerTE.axis == Axis.X ? controllerTE.radius : controllerTE.length); z++) { 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; TrackNode initialNode2 = forward ? startingPoint.node2 : startingPoint.node1;
TrackEdge initialEdge = graph.getConnectionsFrom(initialNode1) TrackEdge initialEdge = graph.getConnectionsFrom(initialNode1)
.get(initialNode2); .get(initialNode2);
if (initialEdge == null)
return;
double distanceToNode2 = forward ? initialEdge.getLength() - startingPoint.position : startingPoint.position; double distanceToNode2 = forward ? initialEdge.getLength() - startingPoint.position : startingPoint.position;
frontier.add(new FrontierEntry(distanceToNode2, 0, initialNode1, initialNode2, initialEdge)); frontier.add(new FrontierEntry(distanceToNode2, 0, initialNode1, initialNode2, initialEdge));