use of com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder in project endergetic by team-abnormals.
the class TrackedEntityMixin method updateBalloons.
@Inject(at = @At("HEAD"), method = "sendChanges")
private void updateBalloons(CallbackInfo info) {
List<BolloomBalloonEntity> currentBalloons = ((BalloonHolder) this.entity).getBalloons();
if (!currentBalloons.equals(this.prevBalloons)) {
this.prevBalloons = currentBalloons;
EndergeticExpansion.CHANNEL.send(PacketDistributor.TRACKING_ENTITY.with(() -> this.entity), new S2CUpdateBalloonsMessage(this.entity));
}
}
use of com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder in project endergetic by team-abnormals.
the class ServerWorldMixin method updateEntityRiddenBalloons.
@SuppressWarnings("deprecation")
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;rideTick()V", shift = At.Shift.AFTER), method = "tickPassenger")
private void updateEntityRiddenBalloons(Entity ridingEntity, Entity passenger, CallbackInfo info) {
BalloonHolder balloonHolder = (BalloonHolder) passenger;
ServerChunkProvider chunkProvider = ((ServerWorld) (Object) this).getChunkSource();
for (BolloomBalloonEntity balloon : balloonHolder.getBalloons()) {
if (!balloon.removed && balloon.getAttachedEntity() == passenger) {
if (chunkProvider.isEntityTickingChunk(balloon)) {
balloon.setPosAndOldPos(balloon.getX(), balloon.getY(), balloon.getZ());
balloon.yRotO = balloon.yRot;
balloon.xRotO = balloon.xRot;
if (balloon.inChunk) {
balloon.tickCount++;
balloon.updateAttachedPosition();
}
((ServerWorld) (Object) this).updateChunkPos(balloon);
}
} else {
balloon.detachFromEntity();
}
}
}
use of com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder in project endergetic by team-abnormals.
the class ClientWorldMixin method updateEntityRiddenBalloons.
@SuppressWarnings("deprecation")
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;rideTick()V", shift = At.Shift.AFTER), method = "tickPassenger")
private void updateEntityRiddenBalloons(Entity ridingEntity, Entity passenger, CallbackInfo info) {
BalloonHolder balloonHolder = (BalloonHolder) passenger;
ClientChunkProvider chunkProvider = ((ClientWorld) (Object) this).getChunkSource();
for (BolloomBalloonEntity balloon : balloonHolder.getBalloons()) {
if (!balloon.removed && balloon.getAttachedEntity() == passenger) {
if (chunkProvider.isEntityTickingChunk(balloon)) {
balloon.setPosAndOldPos(balloon.getX(), balloon.getY(), balloon.getZ());
balloon.yRotO = balloon.yRot;
balloon.xRotO = balloon.xRot;
if (balloon.inChunk) {
balloon.tickCount++;
balloon.updateAttachedPosition();
}
this.callUpdateChunkPos(balloon);
}
} else {
balloon.detachFromEntity();
}
}
}
use of com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder in project endergetic by team-abnormals.
the class ClientWorldMixin method updateBalloons.
@SuppressWarnings("deprecation")
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/entity/Entity;inChunk:Z", ordinal = 1, shift = At.Shift.AFTER), method = "tickNonPassenger")
private void updateBalloons(Entity entity, CallbackInfo info) {
BalloonHolder balloonHolder = (BalloonHolder) entity;
ClientChunkProvider chunkProvider = ((ClientWorld) (Object) this).getChunkSource();
for (BolloomBalloonEntity balloon : balloonHolder.getBalloons()) {
if (!balloon.removed && balloon.getAttachedEntity() == entity) {
if (chunkProvider.isEntityTickingChunk(balloon)) {
balloon.setPosAndOldPos(balloon.getX(), balloon.getY(), balloon.getZ());
balloon.yRotO = balloon.yRot;
balloon.xRotO = balloon.xRot;
if (balloon.inChunk) {
balloon.tickCount++;
balloon.updateAttachedPosition();
}
this.callUpdateChunkPos(balloon);
}
} else {
balloon.detachFromEntity();
}
}
}
use of com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder in project endergetic by team-abnormals.
the class ServerWorldMixin method updateBalloons.
@SuppressWarnings("deprecation")
@Inject(at = @At(value = "FIELD", target = "Lnet/minecraft/entity/Entity;inChunk:Z", ordinal = 1, shift = At.Shift.AFTER), method = "tickNonPassenger")
private void updateBalloons(Entity entity, CallbackInfo info) {
BalloonHolder balloonHolder = (BalloonHolder) entity;
ServerChunkProvider chunkProvider = ((ServerWorld) (Object) this).getChunkSource();
for (BolloomBalloonEntity balloon : balloonHolder.getBalloons()) {
if (!balloon.removed && balloon.getAttachedEntity() == entity) {
if (chunkProvider.isEntityTickingChunk(balloon)) {
balloon.setPosAndOldPos(balloon.getX(), balloon.getY(), balloon.getZ());
balloon.yRotO = balloon.yRot;
balloon.xRotO = balloon.xRot;
if (balloon.inChunk) {
balloon.tickCount++;
balloon.updateAttachedPosition();
}
((ServerWorld) (Object) this).updateChunkPos(balloon);
}
} else {
balloon.detachFromEntity();
}
}
}
Aggregations