mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-11 04:22:00 +01:00
Port recent changes to 1.16
This commit is contained in:
parent
f8fd6dbb66
commit
d3f03a57a9
6 changed files with 74 additions and 74 deletions
|
@ -20,10 +20,10 @@ import net.minecraft.block.material.PushReaction;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.IProjectile;
|
||||
import net.minecraft.entity.item.HangingEntity;
|
||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.IPacket;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
@ -35,7 +35,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -90,7 +90,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
|
||||
@Override
|
||||
protected void removePassenger(Entity passenger) {
|
||||
Vec3d transformedVector = getPassengerPosition(passenger, 1);
|
||||
Vector3d transformedVector = getPassengerPosition(passenger, 1);
|
||||
super.removePassenger(passenger);
|
||||
if (world.isRemote)
|
||||
return;
|
||||
|
@ -107,13 +107,13 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
public void updatePassengerPosition(Entity passenger, IMoveCallback callback) {
|
||||
if (!isPassenger(passenger))
|
||||
return;
|
||||
Vec3d transformedVector = getPassengerPosition(passenger, 1);
|
||||
Vector3d transformedVector = getPassengerPosition(passenger, 1);
|
||||
if (transformedVector == null)
|
||||
return;
|
||||
callback.accept(passenger, transformedVector.x, transformedVector.y, transformedVector.z);
|
||||
}
|
||||
|
||||
protected Vec3d getPassengerPosition(Entity passenger, float partialTicks) {
|
||||
protected Vector3d getPassengerPosition(Entity passenger, float partialTicks) {
|
||||
UUID id = passenger.getUniqueID();
|
||||
if (passenger instanceof OrientedContraptionEntity) {
|
||||
BlockPos localPos = contraption.getBearingPosOf(id);
|
||||
|
@ -128,8 +128,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
BlockPos seat = contraption.getSeatOf(id);
|
||||
if (seat == null)
|
||||
return null;
|
||||
Vec3d transformedVector =
|
||||
toGlobalVector(new Vec3d(seat).add(.5, passenger.getYOffset() + ySize - .15f, .5), partialTicks)
|
||||
Vector3d transformedVector =
|
||||
toGlobalVector(Vector3d.of(seat).add(.5, passenger.getYOffset() + ySize - .15f, .5), partialTicks)
|
||||
.add(VecHelper.getCenterOf(BlockPos.ZERO))
|
||||
.subtract(0.5, ySize, 0.5);
|
||||
return transformedVector;
|
||||
|
@ -168,7 +168,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
}
|
||||
|
||||
if (toDismount != null && !world.isRemote) {
|
||||
Vec3d transformedVector = getPassengerPosition(toDismount, 1);
|
||||
Vector3d transformedVector = getPassengerPosition(toDismount, 1);
|
||||
toDismount.stopRiding();
|
||||
if (transformedVector != null)
|
||||
toDismount.setPositionAndUpdate(transformedVector.x, transformedVector.y, transformedVector.z);
|
||||
|
@ -180,8 +180,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
return true;
|
||||
}
|
||||
|
||||
public Vec3d toGlobalVector(Vec3d localVec, float partialTicks) {
|
||||
Vec3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
public Vector3d toGlobalVector(Vector3d localVec, float partialTicks) {
|
||||
Vector3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
localVec = localVec.subtract(rotationOffset);
|
||||
localVec = applyRotation(localVec, partialTicks);
|
||||
localVec = localVec.add(rotationOffset)
|
||||
|
@ -189,8 +189,8 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
return localVec;
|
||||
}
|
||||
|
||||
public Vec3d toLocalVector(Vec3d globalVec, float partialTicks) {
|
||||
Vec3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
public Vector3d toLocalVector(Vector3d globalVec, float partialTicks) {
|
||||
Vector3d rotationOffset = VecHelper.getCenterOf(BlockPos.ZERO);
|
||||
globalVec = globalVec.subtract(getAnchorVec())
|
||||
.subtract(rotationOffset);
|
||||
globalVec = reverseRotation(globalVec, partialTicks);
|
||||
|
@ -218,9 +218,9 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
|
||||
protected abstract void tickContraption();
|
||||
|
||||
public abstract Vec3d applyRotation(Vec3d localPos, float partialTicks);
|
||||
public abstract Vector3d applyRotation(Vector3d localPos, float partialTicks);
|
||||
|
||||
public abstract Vec3d reverseRotation(Vec3d localPos, float partialTicks);
|
||||
public abstract Vector3d reverseRotation(Vector3d localPos, float partialTicks);
|
||||
|
||||
public void tickActors() {
|
||||
boolean stalledPreviously = contraption.stalled;
|
||||
|
@ -233,7 +233,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
BlockInfo blockInfo = pair.left;
|
||||
MovementBehaviour actor = AllMovementBehaviours.of(blockInfo.state);
|
||||
|
||||
Vec3d actorPosition = toGlobalVector(VecHelper.getCenterOf(blockInfo.pos)
|
||||
Vector3d actorPosition = toGlobalVector(VecHelper.getCenterOf(blockInfo.pos)
|
||||
.add(actor.getActiveAreaOffset(context)), 1);
|
||||
BlockPos gridPosition = new BlockPos(actorPosition);
|
||||
boolean newPosVisited =
|
||||
|
@ -242,7 +242,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
context.rotation = v -> applyRotation(v, 1);
|
||||
context.position = actorPosition;
|
||||
|
||||
Vec3d oldMotion = context.motion;
|
||||
Vector3d oldMotion = context.motion;
|
||||
if (!actor.isActive(context))
|
||||
continue;
|
||||
if (newPosVisited && !context.stall) {
|
||||
|
@ -283,13 +283,13 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
}
|
||||
|
||||
protected boolean shouldActorTrigger(MovementContext context, BlockInfo blockInfo, MovementBehaviour actor,
|
||||
Vec3d actorPosition, BlockPos gridPosition) {
|
||||
Vec3d previousPosition = context.position;
|
||||
Vector3d actorPosition, BlockPos gridPosition) {
|
||||
Vector3d previousPosition = context.position;
|
||||
if (previousPosition == null)
|
||||
return false;
|
||||
|
||||
context.motion = actorPosition.subtract(previousPosition);
|
||||
Vec3d relativeMotion = context.motion;
|
||||
Vector3d relativeMotion = context.motion;
|
||||
relativeMotion = reverseRotation(relativeMotion, 1);
|
||||
context.relativeMotion = relativeMotion;
|
||||
return !new BlockPos(previousPosition).equals(gridPosition)
|
||||
|
@ -300,7 +300,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
setPosition(getX() + x, getY() + y, getZ() + z);
|
||||
}
|
||||
|
||||
public Vec3d getAnchorVec() {
|
||||
public Vector3d getAnchorVec() {
|
||||
return getPositionVec();
|
||||
}
|
||||
|
||||
|
@ -316,15 +316,15 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
AxisAlignedBB cbox = contraption.bounds;
|
||||
if (cbox == null)
|
||||
return;
|
||||
Vec3d actualVec = getAnchorVec();
|
||||
Vector3d actualVec = getAnchorVec();
|
||||
setBoundingBox(cbox.offset(actualVec));
|
||||
}
|
||||
|
||||
public static float yawFromVector(Vec3d vec) {
|
||||
public static float yawFromVector(Vector3d vec) {
|
||||
return (float) ((3 * Math.PI / 2 + Math.atan2(vec.z, vec.x)) / Math.PI * 180);
|
||||
}
|
||||
|
||||
public static float pitchFromVector(Vec3d vec) {
|
||||
public static float pitchFromVector(Vector3d vec) {
|
||||
return (float) ((Math.acos(vec.y)) / Math.PI * 180);
|
||||
}
|
||||
|
||||
|
@ -398,11 +398,11 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
removePassengers();
|
||||
|
||||
for (Entity entity : collidingEntities) {
|
||||
Vec3d positionVec = getPositionVec();
|
||||
Vec3d localVec = entity.getPositionVec()
|
||||
Vector3d positionVec = getPositionVec();
|
||||
Vector3d localVec = entity.getPositionVec()
|
||||
.subtract(positionVec);
|
||||
localVec = reverseRotation(localVec, 1);
|
||||
Vec3d transformed = transform.apply(localVec);
|
||||
Vector3d transformed = transform.apply(localVec);
|
||||
entity.setPositionAndUpdate(transformed.x, transformed.y, transformed.z);
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public CompoundNBT writeWithoutTypeId(CompoundNBT nbt) {
|
||||
Vec3d vec = getPositionVec();
|
||||
Vector3d vec = getPositionVec();
|
||||
List<Entity> passengers = getPassengers();
|
||||
|
||||
for (Entity entity : passengers) {
|
||||
|
@ -464,7 +464,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
entity.removed = true;
|
||||
|
||||
// Gather passengers into same chunk when saving
|
||||
Vec3d prevVec = entity.getPositionVec();
|
||||
Vector3d prevVec = entity.getPositionVec();
|
||||
entity.setPos(vec.x, prevVec.y, vec.z);
|
||||
|
||||
// Super requires all passengers to not be removed in order to write them to the
|
||||
|
@ -478,14 +478,14 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
|
||||
@Override
|
||||
// Make sure nothing can move contraptions out of the way
|
||||
public void setMotion(Vec3d motionIn) {}
|
||||
public void setMotion(Vector3d motionIn) {}
|
||||
|
||||
@Override
|
||||
public PushReaction getPushReaction() {
|
||||
return PushReaction.IGNORE;
|
||||
}
|
||||
|
||||
public void setContraptionMotion(Vec3d vec) {
|
||||
public void setContraptionMotion(Vector3d vec) {
|
||||
super.setMotion(vec);
|
||||
}
|
||||
|
||||
|
@ -499,16 +499,16 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
return false;
|
||||
}
|
||||
|
||||
public Vec3d getPrevPositionVec() {
|
||||
return prevPosInvalid ? getPositionVec() : new Vec3d(prevPosX, prevPosY, prevPosZ);
|
||||
public Vector3d getPrevPositionVec() {
|
||||
return prevPosInvalid ? getPositionVec() : new Vector3d(prevPosX, prevPosY, prevPosZ);
|
||||
}
|
||||
|
||||
public abstract ContraptionRotationState getRotationState();
|
||||
|
||||
public Vec3d getContactPointMotion(Vec3d globalContactPoint) {
|
||||
public Vector3d getContactPointMotion(Vector3d globalContactPoint) {
|
||||
if (prevPosInvalid)
|
||||
return Vec3d.ZERO;
|
||||
Vec3d contactPoint = toGlobalVector(toLocalVector(globalContactPoint, 0), 1);
|
||||
return Vector3d.ZERO;
|
||||
Vector3d contactPoint = toGlobalVector(toLocalVector(globalContactPoint, 0), 1);
|
||||
return contactPoint.subtract(globalContactPoint)
|
||||
.add(getPositionVec().subtract(getPrevPositionVec()));
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ public abstract class AbstractContraptionEntity extends Entity implements IEntit
|
|||
return false;
|
||||
if (e instanceof SeatEntity)
|
||||
return false;
|
||||
if (e instanceof IProjectile)
|
||||
if (e instanceof ProjectileEntity)
|
||||
return false;
|
||||
if (e.getRidingEntity() != null)
|
||||
return false;
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.culling.ClippingHelperImpl;
|
||||
import net.minecraft.client.renderer.culling.ClippingHelper;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -24,7 +24,7 @@ public abstract class AbstractContraptionEntityRenderer<C extends AbstractContra
|
|||
protected abstract void transform(C contraptionEntity, float partialTicks, MatrixStack[] matrixStacks);
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(C entity, ClippingHelperImpl p_225626_2_, double p_225626_3_, double p_225626_5_,
|
||||
public boolean shouldRender(C entity, ClippingHelper p_225626_2_, double p_225626_3_, double p_225626_5_,
|
||||
double p_225626_7_) {
|
||||
if (!super.shouldRender(entity, p_225626_2_, p_225626_3_, p_225626_5_, p_225626_7_))
|
||||
return false;
|
||||
|
@ -34,7 +34,7 @@ public abstract class AbstractContraptionEntityRenderer<C extends AbstractContra
|
|||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void render(C entity, float yaw, float partialTicks, MatrixStack ms, IRenderTypeBuffer buffers,
|
||||
int overlay) {
|
||||
|
|
|
@ -549,7 +549,7 @@ public abstract class Contraption {
|
|||
|
||||
stabilizedSubContraptions.clear();
|
||||
NBTHelper.iterateCompoundList(nbt.getList("SubContraptions", NBT.TAG_COMPOUND), c -> stabilizedSubContraptions
|
||||
.put(NBTUtil.readUniqueId(c.getCompound("Id")), BlockFace.fromNBT(c.getCompound("Location"))));
|
||||
.put(c.getUniqueId("Id"), BlockFace.fromNBT(c.getCompound("Location"))));
|
||||
|
||||
storage.clear();
|
||||
NBTHelper.iterateCompoundList(nbt.getList("Storage", NBT.TAG_COMPOUND), c -> storage
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.tileentity.TileEntity;
|
|||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.template.Template.BlockInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -90,13 +90,13 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d applyRotation(Vec3d localPos, float partialTicks) {
|
||||
public Vector3d applyRotation(Vector3d localPos, float partialTicks) {
|
||||
localPos = VecHelper.rotate(localPos, getAngle(partialTicks), rotationAxis);
|
||||
return localPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3d reverseRotation(Vec3d localPos, float partialTicks) {
|
||||
public Vector3d reverseRotation(Vector3d localPos, float partialTicks) {
|
||||
localPos = VecHelper.rotate(localPos, -getAngle(partialTicks), rotationAxis);
|
||||
return localPos;
|
||||
}
|
||||
|
@ -143,9 +143,9 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
|
|||
setPosition(getX(), getY(), getZ());
|
||||
}
|
||||
|
||||
Vec3d motion = getMotion();
|
||||
Vector3d motion = getMotion();
|
||||
if (motion.length() < 1 / 4098f)
|
||||
setMotion(Vec3d.ZERO);
|
||||
setMotion(Vector3d.ZERO);
|
||||
move(motion.x, motion.y, motion.z);
|
||||
if (ContraptionCollider.collideBlocks(this))
|
||||
getController().collided();
|
||||
|
@ -153,7 +153,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
|
|||
|
||||
@Override
|
||||
protected boolean shouldActorTrigger(MovementContext context, BlockInfo blockInfo, MovementBehaviour actor,
|
||||
Vec3d actorPosition, BlockPos gridPosition) {
|
||||
Vector3d actorPosition, BlockPos gridPosition) {
|
||||
if (super.shouldActorTrigger(context, blockInfo, actor, actorPosition, gridPosition))
|
||||
return true;
|
||||
|
||||
|
@ -162,13 +162,13 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity {
|
|||
return false;
|
||||
BearingContraption bc = (BearingContraption) contraption;
|
||||
Direction facing = bc.getFacing();
|
||||
Vec3d activeAreaOffset = actor.getActiveAreaOffset(context);
|
||||
if (!activeAreaOffset.mul(VecHelper.axisAlingedPlaneOf(new Vec3d(facing.getDirectionVec())))
|
||||
.equals(Vec3d.ZERO))
|
||||
Vector3d activeAreaOffset = actor.getActiveAreaOffset(context);
|
||||
if (!activeAreaOffset.mul(VecHelper.axisAlingedPlaneOf(Vector3d.of(facing.getDirectionVec())))
|
||||
.equals(Vector3d.ZERO))
|
||||
return false;
|
||||
if (!VecHelper.onSameAxis(blockInfo.pos, BlockPos.ZERO, facing.getAxis()))
|
||||
return false;
|
||||
context.motion = new Vec3d(facing.getDirectionVec()).scale(angle - prevAngle);
|
||||
context.motion = Vector3d.of(facing.getDirectionVec()).scale(angle - prevAngle);
|
||||
context.relativeMotion = context.motion;
|
||||
int timer = context.data.getInt("StationaryTimer");
|
||||
if (timer > 0) {
|
||||
|
|
|
@ -39,7 +39,7 @@ import net.minecraft.util.Direction;
|
|||
import net.minecraft.util.Direction.Axis;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.LazyOptional;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
private static final DataParameter<Optional<Direction>> INITIAL_ORIENTATION =
|
||||
EntityDataManager.createKey(OrientedContraptionEntity.class, CreateDataSerializers.OPTIONAL_DIRECTION);
|
||||
|
||||
protected Vec3d motionBeforeStall;
|
||||
protected Vector3d motionBeforeStall;
|
||||
protected boolean forceAngle;
|
||||
private boolean isSerializingFurnaceCart;
|
||||
private boolean attachedExtraInventories;
|
||||
|
@ -75,7 +75,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
|
||||
public OrientedContraptionEntity(EntityType<?> type, World world) {
|
||||
super(type, world);
|
||||
motionBeforeStall = Vec3d.ZERO;
|
||||
motionBeforeStall = Vector3d.ZERO;
|
||||
attachedExtraInventories = false;
|
||||
isSerializingFurnaceCart = false;
|
||||
initialYawOffset = -1;
|
||||
|
@ -156,10 +156,10 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
|
||||
ListNBT vecNBT = compound.getList("CachedMotion", 6);
|
||||
if (!vecNBT.isEmpty()) {
|
||||
motionBeforeStall = new Vec3d(vecNBT.getDouble(0), vecNBT.getDouble(1), vecNBT.getDouble(2));
|
||||
if (!motionBeforeStall.equals(Vec3d.ZERO))
|
||||
motionBeforeStall = new Vector3d(vecNBT.getDouble(0), vecNBT.getDouble(1), vecNBT.getDouble(2));
|
||||
if (!motionBeforeStall.equals(Vector3d.ZERO))
|
||||
targetYaw = prevYaw = yaw += yawFromVector(motionBeforeStall);
|
||||
setMotion(Vec3d.ZERO);
|
||||
setMotion(Vector3d.ZERO);
|
||||
}
|
||||
|
||||
yaw = compound.getFloat("Yaw");
|
||||
|
@ -189,7 +189,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
compound.putFloat("Pitch", pitch);
|
||||
|
||||
if (getCouplingId() != null)
|
||||
compound.put("OnCoupling", NBTUtil.writeUniqueId(getCouplingId()));
|
||||
compound.putUniqueId("OnCoupling", getCouplingId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -210,7 +210,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d applyRotation(Vec3d localPos, float partialTicks) {
|
||||
public Vector3d applyRotation(Vector3d localPos, float partialTicks) {
|
||||
localPos = VecHelper.rotate(localPos, getInitialYaw(), Axis.Y);
|
||||
localPos = VecHelper.rotate(localPos, getPitch(partialTicks), Axis.Z);
|
||||
localPos = VecHelper.rotate(localPos, getYaw(partialTicks), Axis.Y);
|
||||
|
@ -218,7 +218,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d reverseRotation(Vec3d localPos, float partialTicks) {
|
||||
public Vector3d reverseRotation(Vector3d localPos, float partialTicks) {
|
||||
localPos = VecHelper.rotate(localPos, -getYaw(partialTicks), Axis.Y);
|
||||
localPos = VecHelper.rotate(localPos, -getPitch(partialTicks), Axis.Z);
|
||||
localPos = VecHelper.rotate(localPos, -getInitialYaw(), Axis.Y);
|
||||
|
@ -280,7 +280,7 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
}
|
||||
if (wasStalled && !isStalled) {
|
||||
riding.setMotion(motionBeforeStall);
|
||||
motionBeforeStall = Vec3d.ZERO;
|
||||
motionBeforeStall = Vector3d.ZERO;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -306,10 +306,10 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
if (coupledCarts == null)
|
||||
return false;
|
||||
|
||||
Vec3d positionVec = coupledCarts.getFirst()
|
||||
Vector3d positionVec = coupledCarts.getFirst()
|
||||
.cart()
|
||||
.getPositionVec();
|
||||
Vec3d coupledVec = coupledCarts.getSecond()
|
||||
Vector3d coupledVec = coupledCarts.getSecond()
|
||||
.cart()
|
||||
.getPositionVec();
|
||||
|
||||
|
@ -347,11 +347,11 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
return false;
|
||||
|
||||
boolean rotating = false;
|
||||
Vec3d movementVector = riding.getMotion();
|
||||
Vector3d movementVector = riding.getMotion();
|
||||
|
||||
if (!(riding instanceof AbstractMinecartEntity))
|
||||
movementVector = getPositionVec().subtract(prevPosX, prevPosY, prevPosZ);
|
||||
Vec3d motion = movementVector.normalize();
|
||||
Vector3d motion = movementVector.normalize();
|
||||
|
||||
if (!dataManager.get(INITIAL_ORIENTATION)
|
||||
.isPresent() && !world.isRemote) {
|
||||
|
@ -470,8 +470,8 @@ public class OrientedContraptionEntity extends AbstractContraptionEntity {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Vec3d getAnchorVec() {
|
||||
return new Vec3d(getX() - .5, getY(), getZ() - .5);
|
||||
public Vector3d getAnchorVec() {
|
||||
return new Vector3d(getX() - .5, getY(), getZ() - .5);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,12 +3,12 @@ package com.simibubi.create.content.contraptions.components.structureMovement;
|
|||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.simibubi.create.foundation.utility.MatrixStacker;
|
||||
|
||||
import net.minecraft.client.renderer.culling.ClippingHelperImpl;
|
||||
import net.minecraft.client.renderer.culling.ClippingHelper;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
|
||||
public class OrientedContraptionEntityRenderer extends AbstractContraptionEntityRenderer<OrientedContraptionEntity> {
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class OrientedContraptionEntityRenderer extends AbstractContraptionEntity
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(OrientedContraptionEntity entity, ClippingHelperImpl p_225626_2_, double p_225626_3_,
|
||||
public boolean shouldRender(OrientedContraptionEntity entity, ClippingHelper p_225626_2_, double p_225626_3_,
|
||||
double p_225626_5_, double p_225626_7_) {
|
||||
if (!super.shouldRender(entity, p_225626_2_, p_225626_3_, p_225626_5_, p_225626_7_))
|
||||
return false;
|
||||
|
@ -26,7 +26,7 @@ public class OrientedContraptionEntityRenderer extends AbstractContraptionEntity
|
|||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void transform(OrientedContraptionEntity entity, float partialTicks, MatrixStack[] matrixStacks) {
|
||||
float angleInitialYaw = entity.getInitialYaw();
|
||||
|
@ -59,7 +59,7 @@ public class OrientedContraptionEntityRenderer extends AbstractContraptionEntity
|
|||
private void repositionOnContraption(OrientedContraptionEntity entity, float partialTicks,
|
||||
MatrixStack[] matrixStacks, Entity ridingEntity) {
|
||||
AbstractContraptionEntity parent = (AbstractContraptionEntity) ridingEntity;
|
||||
Vec3d passengerPosition = parent.getPassengerPosition(entity, partialTicks);
|
||||
Vector3d passengerPosition = parent.getPassengerPosition(entity, partialTicks);
|
||||
double x = passengerPosition.x - MathHelper.lerp(partialTicks, entity.lastTickPosX, entity.getX());
|
||||
double y = passengerPosition.y - MathHelper.lerp(partialTicks, entity.lastTickPosY, entity.getY());
|
||||
double z = passengerPosition.z - MathHelper.lerp(partialTicks, entity.lastTickPosZ, entity.getZ());
|
||||
|
@ -74,11 +74,11 @@ public class OrientedContraptionEntityRenderer extends AbstractContraptionEntity
|
|||
double cartX = MathHelper.lerp(partialTicks, cart.lastTickPosX, cart.getX());
|
||||
double cartY = MathHelper.lerp(partialTicks, cart.lastTickPosY, cart.getY());
|
||||
double cartZ = MathHelper.lerp(partialTicks, cart.lastTickPosZ, cart.getZ());
|
||||
Vec3d cartPos = cart.getPos(cartX, cartY, cartZ);
|
||||
Vector3d cartPos = cart.getPos(cartX, cartY, cartZ);
|
||||
|
||||
if (cartPos != null) {
|
||||
Vec3d cartPosFront = cart.getPosOffset(cartX, cartY, cartZ, (double) 0.3F);
|
||||
Vec3d cartPosBack = cart.getPosOffset(cartX, cartY, cartZ, (double) -0.3F);
|
||||
Vector3d cartPosFront = cart.getPosOffset(cartX, cartY, cartZ, (double) 0.3F);
|
||||
Vector3d cartPosBack = cart.getPosOffset(cartX, cartY, cartZ, (double) -0.3F);
|
||||
if (cartPosFront == null)
|
||||
cartPosFront = cartPos;
|
||||
if (cartPosBack == null)
|
||||
|
|
Loading…
Reference in a new issue