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()); private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper());
public SteamEngineBlock(Properties p_53182_) { public SteamEngineBlock(Properties properties) {
super(p_53182_); super(properties);
registerDefaultState(stateDefinition.any().setValue(FACE, AttachFace.FLOOR).setValue(FACING, Direction.NORTH).setValue(WATERLOGGED, false));
} }
@Override @Override

View file

@ -175,7 +175,7 @@ public class ContraptionCollider {
Vec3 collisionPosition = intersect.getCollisionPosition(); Vec3 collisionPosition = intersect.getCollisionPosition();
if (!isTemporal) { if (!isTemporal) {
Vec3 separation = intersect.asSeparationVec(entity.maxUpStep); Vec3 separation = intersect.asSeparationVec(entity.getStepHeight());
if (separation != null && !separation.equals(Vec3.ZERO)) { if (separation != null && !separation.equals(Vec3.ZERO)) {
collisionResponse.setValue(currentResponse.add(separation)); collisionResponse.setValue(currentResponse.add(separation));
timeOfImpact = 0; timeOfImpact = 0;
@ -474,12 +474,12 @@ public class ContraptionCollider {
boolean flag1 = p_20273_.y != vec3.y; boolean flag1 = p_20273_.y != vec3.y;
boolean flag2 = p_20273_.z != vec3.z; boolean flag2 = p_20273_.z != vec3.z;
boolean flag3 = e.isOnGround() || flag1 && p_20273_.y < 0.0D; 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 = Vec3 vec31 =
collideBoundingBox(e, new Vec3(p_20273_.x, (double) e.maxUpStep, p_20273_.z), aabb, e.level, list); 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.maxUpStep, 0.0D), 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); 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 = Vec3 vec33 =
collideBoundingBox(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), aabb.move(vec32), e.level, list) collideBoundingBox(e, new Vec3(p_20273_.x, 0.0D, p_20273_.z), aabb.move(vec32), e.level, list)
.add(vec32); .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.MaterialManager;
import com.jozufozu.flywheel.api.instance.DynamicInstance; 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.TaskEngine;
import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager; import com.jozufozu.flywheel.backend.instancing.blockentity.BlockEntityInstanceManager;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; 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.instancing.instancing.InstancingEngine;
import com.jozufozu.flywheel.backend.model.ArrayModelRenderer; import com.jozufozu.flywheel.backend.model.ArrayModelRenderer;
import com.jozufozu.flywheel.core.model.Model; 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.model.WorldModelBuilder;
import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld; import com.jozufozu.flywheel.core.virtual.VirtualRenderWorld;
import com.jozufozu.flywheel.event.BeginFrameEvent; import com.jozufozu.flywheel.event.BeginFrameEvent;

View file

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

View file

@ -59,7 +59,7 @@ public class FluidListDisplaySource extends ValueListDisplaySource {
return fluids.entrySet() return fluids.entrySet()
.stream() .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) .limit(maxRows)
.map(entry -> IntAttached.with( .map(entry -> IntAttached.with(
entry.getValue(), entry.getValue(),

View file

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

View file

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

View file

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