Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/1.18.2' into 1.19.x
Browse files Browse the repository at this point in the history
  • Loading branch information
Thutmose committed Nov 16, 2022
2 parents 8c717dc + 9b77e09 commit e7aa04b
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 173 deletions.
16 changes: 12 additions & 4 deletions src/main/java/thut/api/entity/blockentity/BlockEntityBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,20 @@ public static class BlockEntityType<T extends BlockEntityBase> extends EntityTyp
public BlockEntityType(final EntityType.EntityFactory<T> factory)
{
super(factory, MobCategory.MISC, true, false, true, true, ImmutableSet.of(),
new EntityDimensions(1, 1, true), 64, 1);
new EntityDimensions(1, 1, true), 64, 1, e -> true, e -> 64, e -> 1, null);
}

@Override
public T customClientSpawn(final SpawnEntity packet, final Level world)
{
return this.create(world);
}

@Override
public boolean isBlockDangerous(BlockState p_20631_)
{
return false;
}
}

public static void setup()
Expand Down Expand Up @@ -155,7 +161,7 @@ public BlockPos getOriginalPos()

public Vec3 getV()
{
return v;
return this.getDeltaMovement();
}

public Vec3 getA()
Expand Down Expand Up @@ -272,7 +278,7 @@ public void checkCollision()

var tileV = this.getV();
var usBounds = this.getBoundingBox().inflate(Math.abs(tileV.x()), Math.abs(tileV.y()), Math.abs(tileV.z()));
usBounds = usBounds.expandTowards(0, this.getSpeedUp(), 0);
usBounds = usBounds.inflate(0, this.getSpeedUp(), 0);

for (var entry : this.recentCollides.entrySet())
{
Expand All @@ -298,7 +304,8 @@ public void checkCollision()

var entityR = this.position().add(pos.x(), pos.y(), pos.z());

if (newVy > 0) entityR = entityR.add(0, 0, 0);
double dvy = newVy > 0 ? newVy : 0;
entityR = entityR.add(0, dvy, 0);

var entityO = this.position().subtract(xo, yo, zo);
double x = entity.getX();
Expand Down Expand Up @@ -398,6 +405,7 @@ protected void setV(final Vec3 vec)
v = vec;
a = F.normalize().scalarMult(this.getAccel()).toVec3d();
this.dataSync.set(POS, Optional.of(r.add(v).add(a)));
this.setDeltaMovement(v);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public void render(final T entity, final float entityYaw, final float partialTic
final IBlockEntity blockEntity = entity;

var v = entity.getV();
mat.translate(v.x(), v.y(), v.z());
if (v.y() > 0) mat.translate(v.x(), v.y(), v.z());

final int xMin = Mth.floor(blockEntity.getMin().getX());
final int xMax = Mth.floor(blockEntity.getMax().getX());
Expand Down
Loading

0 comments on commit e7aa04b

Please sign in to comment.