Merge branch 'mc1.20.1/0.5.1' into mc1.20.1/dev

This commit is contained in:
simibubi 2024-10-23 22:26:15 +02:00
commit 1935b790dd
13 changed files with 18 additions and 43 deletions

View file

@ -545,9 +545,12 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
relativeMotion = reverseRotation(relativeMotion, 1);
context.relativeMotion = relativeMotion;
return !BlockPos.containing(previousPosition).equals(gridPosition)
|| (context.relativeMotion.length() > 0 || context.contraption instanceof CarriageContraption)
&& context.firstMovement;
boolean ignoreMotionForFirstMovement =
context.contraption instanceof CarriageContraption || actor instanceof PortableStorageInterfaceMovement;
return !BlockPos.containing(previousPosition)
.equals(gridPosition)
|| (context.relativeMotion.length() > 0 || ignoreMotionForFirstMovement) && context.firstMovement;
}
public void move(double x, double y, double z) {

View file

@ -106,7 +106,7 @@ public class FluidTankBlock extends Block implements IWrenchable, IBE<FluidTankB
@Override
public int getLightEmission(BlockState state, BlockGetter world, BlockPos pos) {
FluidTankBlockEntity tankAt = ConnectivityHandler.partAt(getBlockEntityType(), world, pos);
if (tankAt == null)
if (tankAt == null || !tankAt.hasLevel())
return 0;
FluidTankBlockEntity controllerBE = tankAt.getControllerBE();
if (controllerBE == null || !controllerBE.window)

View file

@ -197,7 +197,7 @@ public class FluidTankBlockEntity extends SmartBlockEntity implements IHaveGoggl
@SuppressWarnings("unchecked")
@Override
public FluidTankBlockEntity getControllerBE() {
if (isController())
if (isController() || !hasLevel())
return this;
BlockEntity blockEntity = level.getBlockEntity(controller);
if (blockEntity instanceof FluidTankBlockEntity)

View file

@ -120,12 +120,6 @@ public class MechanicalCrafterBlockEntity extends KineticBlockEntity {
registerAwardables(behaviours, AllAdvancements.CRAFTER, AllAdvancements.CRAFTER_LAZY);
}
@Override
public void invalidateCaps() {
inserting.removeListener();
super.invalidateCaps();
}
@Override
public void onSpeedChanged(float previousSpeed) {
super.onSpeedChanged(previousSpeed);
@ -138,7 +132,6 @@ public class MechanicalCrafterBlockEntity extends KineticBlockEntity {
public void blockChanged() {
removeBehaviour(InvManipulationBehaviour.TYPE);
inserting.removeListener();
inserting = new InvManipulationBehaviour(this, this::getTargetFace);
attachBehaviourLate(inserting);
}

View file

@ -171,6 +171,8 @@ public class DeployerBlockEntity extends KineticBlockEntity {
}
if (level.isClientSide)
return;
if (player == null)
return;
ItemStack stack = player.getMainHandItem();
if (state == State.WAITING) {

View file

@ -273,12 +273,6 @@ public class FunnelBlockEntity extends SmartBlockEntity implements IHaveHovering
registerAwardables(behaviours, AllAdvancements.FUNNEL);
}
@Override
public void invalidateCaps() {
invManipulation.removeListener();
super.invalidateCaps();
}
private boolean supportsAmountOnFilter() {
BlockState blockState = getBlockState();
boolean beltFunnelsupportsAmount = false;

View file

@ -56,13 +56,6 @@ public class SmartObserverBlockEntity extends SmartBlockEntity {
behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
}
@Override
public void invalidateCaps() {
observedInventory.removeListener();
observedTank.removeListener();
super.invalidateCaps();
}
@Override
public void tick() {
super.tick();

View file

@ -233,13 +233,6 @@ public class ThresholdSwitchBlockEntity extends SmartBlockEntity {
behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
}
@Override
public void invalidateCaps() {
observedInventory.removeListener();
observedTank.removeListener();
super.invalidateCaps();
}
public float getLevelForDisplay() {
return currentLevel == -1 ? 0 : currentLevel;
}

View file

@ -799,6 +799,8 @@ public class Carriage {
}
private void createEntity(Level level, boolean loadPassengers) {
if (positionAnchor != null)
serialisedEntity.put("Pos", VecHelper.writeNBT(positionAnchor));
Entity entity = EntityType.create(serialisedEntity, level)
.orElse(null);

View file

@ -7,7 +7,6 @@ import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode;
import com.simibubi.create.foundation.utility.BlockFace;
import com.simibubi.create.foundation.utility.HashableNonNullConsumer;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.Level;
@ -80,10 +79,6 @@ public abstract class CapManipulationBehaviourBase<T, S extends CapManipulationB
targetCapability = LazyOptional.empty();
}
public void removeListener() {
targetCapability.removeListener(new HashableNonNullConsumer<>(this::onHandlerInvalidated, this));
}
@Override
public void lazyTick() {
super.lazyTick();
@ -132,8 +127,6 @@ public abstract class CapManipulationBehaviourBase<T, S extends CapManipulationB
Capability<T> capability = capability();
targetCapability =
bypassSided ? invBE.getCapability(capability) : invBE.getCapability(capability, targetBlockFace.getFace());
if (targetCapability.isPresent())
targetCapability.addListener(new HashableNonNullConsumer<>(this::onHandlerInvalidated, this));
}
@FunctionalInterface

View file

@ -53,11 +53,11 @@ public class FluidHelper {
public static boolean isLava(Fluid fluid) {
return convertToStill(fluid) == Fluids.LAVA;
}
public static boolean isSame(FluidStack fluidStack, FluidStack fluidStack2) {
return fluidStack.getFluid() == fluidStack2.getFluid();
}
public static boolean isSame(FluidStack fluidStack, Fluid fluid) {
return fluidStack.getFluid() == fluid;
}
@ -147,6 +147,8 @@ public class FluidHelper {
Fluid fluid = ForgeRegistries.FLUIDS.getValue(id);
if (fluid == null)
throw new JsonSyntaxException("Unknown fluid '" + id + "'");
if (fluid == Fluids.EMPTY)
throw new JsonSyntaxException("Invalid empty fluid '" + id + "'");
int amount = GsonHelper.getAsInt(json, "amount");
FluidStack stack = new FluidStack(fluid, amount);

View file

@ -124,7 +124,7 @@ public abstract class FluidIngredient implements Predicate<FluidStack> {
public static FluidIngredient deserialize(@Nullable JsonElement je) {
if (!isFluidIngredient(je))
throw new JsonSyntaxException("Invalid fluid ingredient: " + Objects.toString(je));
throw new JsonSyntaxException("Invalid fluid ingredient: " + je);
JsonObject json = je.getAsJsonObject();
FluidIngredient ingredient = json.has("fluidTag") ? new FluidTagIngredient() : new FluidStackIngredient();

View file

@ -19,7 +19,7 @@ Technology that empowers the player.'''
[[dependencies.create]]
modId="forge"
mandatory=true
versionRange="[47.1.43,)"
versionRange="[47.1.3,)"
ordering="NONE"
side="BOTH"