Foggy fixes

- Use RenderFogEvent instead of FogDensity event
- Adjust density of chocolate and honey fog
- Fix SteamEngineBlock not setting a default state
- Fix miscellaneous deprecation warnings
This commit is contained in:
PepperCode1 2022-07-13 15:42:03 -07:00
parent 8b28c03699
commit 0161b876fa
10 changed files with 42 additions and 37 deletions

View File

@ -52,8 +52,9 @@ public class SteamEngineBlock extends FaceAttachedHorizontalDirectionalBlock
private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());
public SteamEngineBlock(Properties p_53182_) {
super(p_53182_);
public SteamEngineBlock(Properties properties) {
super(properties);
registerDefaultState(stateDefinition.any().setValue(FACE, AttachFace.FLOOR).setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false));
}
@Override

View File

@ -175,7 +175,7 @@ public class ContraptionCollider {
Vec3 collisionPosition = intersect.getCollisionPosition();
if (!isTemporal) {
Vec3 separation = intersect.asSeparationVec(entity.maxUpStep);
Vec3 separation = intersect.asSeparationVec(entity.getStepHeight());
if (separation != null && !separation.equals(Vec3.ZERO)) {
collisionResponse.setValue(currentResponse.add(separation));
timeOfImpact = 0;
@ -474,12 +474,12 @@ public class ContraptionCollider {
boolean flag1 = p_20273_.y != vec3.y;
boolean flag2 = p_20273_.z != vec3.z;
boolean flag3 = e.isOnGround() || flag1 && p_20273_.y < 0.0D;
if (e.maxUpStep > 0.0F && flag3 && (flag || flag2)) {
if (e.getStepHeight() > 0.0F && flag3 && (flag || flag2)) {
Vec3 vec31 =
collideBoundingBox(e, new Vec3(p_20273_.x, (double) e.maxUpStep, p_20273_.z), aabb, e.level, list);
Vec3 vec32 = collideBoundingBox(e, new Vec3(0.0D, (double) e.maxUpStep, 0.0D),
collideBoundingBox(e, new Vec3(p_20273_.x, (double) e.getStepHeight(), p_20273_.z), aabb, e.level, list);
Vec3 vec32 = collideBoundingBox(e, new Vec3(0.0D, (double) e.getStepHeight(), 0.0D),
aabb.expandTowards(p_20273_.x, 0.0D, p_20273_.z), e.level, list);
if (vec32.y < (double) e.maxUpStep) {
if (vec32.y < (double) e.getStepHeight()) {
Vec3 vec33 =
collideBoundingBox(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), aabb.move(vec32), e.level, list)
.add(vec32);

View File

@ -8,8 +8,6 @@ import org.apache.commons.lang3.tuple.Pair;
import com.jozufozu.flywheel.api.MaterialManager;
import com.jozufozu.flywheel.api.instance.DynamicInstance;
import com.jozufozu.flywheel.api.instance.TickableInstance;
import com.jozufozu.flywheel.backend.instancing.AbstractInstance;
import com.jozufozu.flywheel.backend.instancing.TaskEngine;
import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;

View File

@ -14,7 +14,6 @@ import com.jozufozu.flywheel.backend.instancing.batching.BatchingEngine;
import com.jozufozu.flywheel.backend.instancing.instancing.InstancingEngine;
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
import com.jozufozu.flywheel.core.model.Model;
import com.jozufozu.flywheel.core.model.WorldModel;
import com.jozufozu.flywheel.core.model.WorldModelBuilder;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.jozufozu.flywheel.event.BeginFrameEvent;

View File

@ -187,6 +187,8 @@ public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleI
sendData();
}
@SuppressWarnings("unchecked")
@Override
public FluidTankTileEntity getControllerTE() {
if (isController())
return this;

View File

@ -59,7 +59,7 @@ public class FluidListDisplaySource extends ValueListDisplaySource {
return fluids.entrySet()
.stream()
.sorted((Comparator.comparingInt(value -> ((Map.Entry<Fluid, Integer>) value).getValue()).reversed()))
.sorted(Comparator.<Map.Entry<Fluid, Integer>>comparingInt(value -> value.getValue()).reversed())
.limit(maxRows)
.map(entry -> IntAttached.with(
entry.getValue(),

View File

@ -112,6 +112,8 @@ public class ItemVaultTileEntity extends SmartTileEntity implements IMultiTileCo
lastKnownPos = worldPosition;
}
@SuppressWarnings("unchecked")
@Override
public ItemVaultTileEntity getControllerTE() {
if (isController())
return this;

View File

@ -314,33 +314,33 @@ public class ClientEvents {
}
@SubscribeEvent
public static void getFogDensity(EntityViewRenderEvent.FogDensity event) {
public static void getFogDensity(EntityViewRenderEvent.RenderFogEvent event) {
Camera info = event.getCamera();
Level level = Minecraft.getInstance().level;
BlockPos blockPos = info.getBlockPosition();
FluidState fluidstate = level.getFluidState(blockPos);
if (info.getPosition().y > blockPos.getY() + fluidstate.getHeight(level, blockPos))
FluidState fluidState = level.getFluidState(blockPos);
if (info.getPosition().y > blockPos.getY() + fluidState.getHeight(level, blockPos))
return;
Fluid fluid = fluidstate.getType();
Fluid fluid = fluidState.getType();
if (AllFluids.CHOCOLATE.get()
.isSame(fluid)) {
event.setDensity(5f);
event.scaleFarPlaneDistance(1f/32f);
event.setCanceled(true);
return;
}
if (AllFluids.HONEY.get()
.isSame(fluid)) {
event.setDensity(1.5f);
event.scaleFarPlaneDistance(1f/8f);
event.setCanceled(true);
return;
}
if (FluidHelper.isWater(fluid) && AllItems.DIVING_HELMET.get()
.isWornBy(Minecraft.getInstance().cameraEntity)) {
event.setDensity(300f);
event.scaleFarPlaneDistance(6.25f);
event.setCanceled(true);
return;
}
@ -351,24 +351,26 @@ public class ClientEvents {
Camera info = event.getCamera();
Level level = Minecraft.getInstance().level;
BlockPos blockPos = info.getBlockPosition();
FluidState fluidstate = level.getFluidState(blockPos);
if (info.getPosition().y > blockPos.getY() + fluidstate.getHeight(level, blockPos))
FluidState fluidState = level.getFluidState(blockPos);
if (info.getPosition().y > blockPos.getY() + fluidState.getHeight(level, blockPos))
return;
Fluid fluid = fluidstate.getType();
Fluid fluid = fluidState.getType();
if (AllFluids.CHOCOLATE.get()
.isSame(fluid)) {
event.setRed(98 / 256f);
event.setGreen(32 / 256f);
event.setBlue(32 / 256f);
event.setRed(98 / 255f);
event.setGreen(32 / 255f);
event.setBlue(32 / 255f);
return;
}
if (AllFluids.HONEY.get()
.isSame(fluid)) {
event.setRed(234 / 256f);
event.setGreen(174 / 256f);
event.setBlue(47 / 256f);
event.setRed(234 / 255f);
event.setGreen(174 / 255f);
event.setBlue(47 / 255f);
return;
}
}

View File

@ -49,16 +49,17 @@ public class FluidHelper {
return convertToStill(fluid) == Fluids.LAVA;
}
public static boolean isTag(Fluid fluid, TagKey<Fluid> pTag) {
return fluid.is(pTag);
@SuppressWarnings("deprecation")
public static boolean isTag(Fluid fluid, TagKey<Fluid> tag) {
return fluid.is(tag);
}
public static boolean isTag(FluidState fluid, TagKey<Fluid> pTag) {
return isTag(fluid.getType(), pTag);
public static boolean isTag(FluidState fluid, TagKey<Fluid> tag) {
return fluid.is(tag);
}
public static boolean isTag(FluidStack fluid, TagKey<Fluid> pTag) {
return isTag(fluid.getFluid(), pTag);
public static boolean isTag(FluidStack fluid, TagKey<Fluid> tag) {
return isTag(fluid.getFluid(), tag);
}
public static boolean hasBlockState(Fluid fluid) {