Search in sources :

Example 1 with ClientChunkProvider

use of net.minecraft.client.multiplayer.ClientChunkProvider 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();
        }
    }
}
Also used : ClientChunkProvider(net.minecraft.client.multiplayer.ClientChunkProvider) ClientWorld(net.minecraft.client.world.ClientWorld) BalloonHolder(com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder) BolloomBalloonEntity(com.minecraftabnormals.endergetic.common.entities.bolloom.BolloomBalloonEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with ClientChunkProvider

use of net.minecraft.client.multiplayer.ClientChunkProvider 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();
        }
    }
}
Also used : ClientChunkProvider(net.minecraft.client.multiplayer.ClientChunkProvider) ClientWorld(net.minecraft.client.world.ClientWorld) BalloonHolder(com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder) BolloomBalloonEntity(com.minecraftabnormals.endergetic.common.entities.bolloom.BolloomBalloonEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

BolloomBalloonEntity (com.minecraftabnormals.endergetic.common.entities.bolloom.BolloomBalloonEntity)2 BalloonHolder (com.minecraftabnormals.endergetic.core.interfaces.BalloonHolder)2 ClientChunkProvider (net.minecraft.client.multiplayer.ClientChunkProvider)2 ClientWorld (net.minecraft.client.world.ClientWorld)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2