Where are the issues?

- Seats are bouncy again
- Seats can be mounted again
- Fixed increased water fog while wearing Diving helmet
This commit is contained in:
simibubi 2021-11-07 18:37:12 +01:00
parent 55c95b347b
commit 1f0b428e58
4 changed files with 32 additions and 14 deletions

View file

@ -52,7 +52,7 @@ public class AllEntityTypes {
MobCategory.MISC, 4, 20, true, false, PotatoProjectileEntity::build).register();
public static final EntityEntry<SeatEntity> SEAT = register("seat", SeatEntity::new, () -> SeatEntity.Render::new,
MobCategory.MISC, 0, Integer.MAX_VALUE, false, true, SeatEntity::build).register();
MobCategory.MISC, 5, Integer.MAX_VALUE, false, true, SeatEntity::build).register();
//

View file

@ -29,6 +29,7 @@ import net.minecraft.world.level.pathfinder.BlockPathTypes;
import net.minecraft.world.level.pathfinder.PathComputationType;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
@ -60,10 +61,21 @@ public class SeatBlock extends Block {
@Override
public void updateEntityAfterFallOn(BlockGetter reader, Entity entity) {
BlockPos pos = entity.blockPosition();
if (entity instanceof Player || !(entity instanceof LivingEntity) || !canBePickedUp(entity) || isSeatOccupied(entity.level, pos)) {
if (entity instanceof Player || !(entity instanceof LivingEntity) || !canBePickedUp(entity)
|| isSeatOccupied(entity.level, pos)) {
if (entity.isSuppressingBounce()) {
super.updateEntityAfterFallOn(reader, entity);
return;
}
Vec3 vec3 = entity.getDeltaMovement();
if (vec3.y < 0.0D) {
double d0 = entity instanceof LivingEntity ? 1.0D : 0.8D;
entity.setDeltaMovement(vec3.x, -vec3.y * (double) 0.66F * d0, vec3.z);
}
return;
}
if (reader.getBlockState(pos)
.getBlock() != this)
return;
@ -71,8 +83,7 @@ public class SeatBlock extends Block {
}
@Override
public BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter world, BlockPos pos,
@Nullable Mob entity) {
public BlockPathTypes getAiPathNodeType(BlockState state, BlockGetter world, BlockPos pos, @Nullable Mob entity) {
return BlockPathTypes.RAIL;
}
@ -99,7 +110,8 @@ public class SeatBlock extends Block {
if (color != null && color != this.color) {
if (world.isClientSide)
return InteractionResult.SUCCESS;
BlockState newState = BlockHelper.copyProperties(state, AllBlocks.SEATS.get(color).getDefaultState());
BlockState newState = BlockHelper.copyProperties(state, AllBlocks.SEATS.get(color)
.getDefaultState());
world.setBlockAndUpdate(pos, newState);
return InteractionResult.sidedSuccess(world.isClientSide);
}
@ -136,7 +148,7 @@ public class SeatBlock extends Block {
if (world.isClientSide)
return;
SeatEntity seat = new SeatEntity(world, pos);
seat.setPosRaw(pos.getX() + .5f, pos.getY(), pos.getZ() + .5f);
seat.setPos(pos.getX() + .5f, pos.getY(), pos.getZ() + .5f);
world.addFreshEntity(seat);
entity.startRiding(seat, true);
}

View file

@ -12,6 +12,7 @@ import net.minecraft.network.protocol.Packet;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
@ -60,15 +61,19 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
@Override
protected boolean canRide(Entity entity) {
// Fake Players (tested with deployers) have a BUNCH of weird issues, don't let them ride seats
// Fake Players (tested with deployers) have a BUNCH of weird issues, don't let
// them ride seats
return !(entity instanceof FakePlayer);
}
@Override
protected void removePassenger(Entity entity) {
super.removePassenger(entity);
Vec3 pos = entity.position();
entity.setPos(pos.x, pos.y + 0.85f, pos.z);
}
@Override
public Vec3 getDismountLocationForPassenger(LivingEntity pLivingEntity) {
return super.getDismountLocationForPassenger(pLivingEntity).add(0, 0.5f, 0);
}
@Override
@ -92,7 +97,8 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
}
@Override
public boolean shouldRender(SeatEntity p_225626_1_, Frustum p_225626_2_, double p_225626_3_, double p_225626_5_, double p_225626_7_) {
public boolean shouldRender(SeatEntity p_225626_1_, Frustum p_225626_2_, double p_225626_3_, double p_225626_5_,
double p_225626_7_) {
return false;
}

View file

@ -303,7 +303,7 @@ public class ClientEvents {
if (FluidHelper.isWater(fluid) && AllItems.DIVING_HELMET.get()
.isWornBy(Minecraft.getInstance().cameraEntity)) {
event.setDensity(0.010f);
event.setDensity(300f);
event.setCanceled(true);
return;
}