mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-28 16:06:48 +01:00
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:
parent
55c95b347b
commit
1f0b428e58
4 changed files with 32 additions and 14 deletions
|
@ -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();
|
||||
|
||||
//
|
||||
|
||||
|
|
|
@ -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,8 +61,19 @@ 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)) {
|
||||
super.updateEntityAfterFallOn(reader, entity);
|
||||
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)
|
||||
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -35,7 +36,7 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
|
|||
EntityType.Builder<SeatEntity> entityBuilder = (EntityType.Builder<SeatEntity>) builder;
|
||||
return entityBuilder.sized(0.25f, 0.35f);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setPos(double x, double y, double z) {
|
||||
super.setPos(x, y, z);
|
||||
|
@ -49,7 +50,7 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData {
|
|||
|
||||
@Override
|
||||
public void tick() {
|
||||
if (level.isClientSide)
|
||||
if (level.isClientSide)
|
||||
return;
|
||||
boolean blockPresent = level.getBlockState(blockPosition())
|
||||
.getBlock() instanceof SeatBlock;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue