Search in sources :

Example 1 with CPacketSyncEntity

use of team.cqr.cqrepoured.network.client.packet.CPacketSyncEntity in project ChocolateQuestRepoured by TeamChocoQuest.

the class SPacketHandlerSyncEntity method execHandlePacket.

@Override
protected void execHandlePacket(CPacketSyncEntity packet, Supplier<Context> context, World world, PlayerEntity player) {
    if (player.isCreative()) {
        Entity entity = world.getEntity(packet.getEntityId());
        if (entity instanceof AbstractEntityCQR) {
            AbstractEntityCQR cqrentity = (AbstractEntityCQR) entity;
            cqrentity.setHealthScale(packet.getHealthScaling() / 100.0D);
            cqrentity.setDropChance(EquipmentSlotType.HEAD, packet.getDropChanceHelm() / 100.0F);
            cqrentity.setDropChance(EquipmentSlotType.CHEST, packet.getDropChanceChest() / 100.0F);
            cqrentity.setDropChance(EquipmentSlotType.LEGS, packet.getDropChanceLegs() / 100.0F);
            cqrentity.setDropChance(EquipmentSlotType.FEET, packet.getDropChanceFeet() / 100.0F);
            cqrentity.setDropChance(EquipmentSlotType.MAINHAND, packet.getDropChanceMainhand() / 100.0F);
            cqrentity.setDropChance(EquipmentSlotType.OFFHAND, packet.getDropChanceOffhand() / 100.0F);
            cqrentity.setSizeVariation(packet.getSizeScaling() / 100.0F);
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) PlayerEntity(net.minecraft.entity.player.PlayerEntity) CPacketSyncEntity(team.cqr.cqrepoured.network.client.packet.CPacketSyncEntity) AbstractEntityCQR(team.cqr.cqrepoured.entity.bases.AbstractEntityCQR)

Example 2 with CPacketSyncEntity

use of team.cqr.cqrepoured.network.client.packet.CPacketSyncEntity in project ChocolateQuestRepoured by TeamChocoQuest.

the class GuiCQREntity method onGuiClosed.

@Override
public void onGuiClosed() {
    super.onGuiClosed();
    int healthScaling = this.sliderHealthScaling.getValueInt();
    int dropChanceHelm = this.sliderDropChanceHelm.getValueInt();
    int dropChanceChest = this.sliderDropChanceChest.getValueInt();
    int dropChanceLegs = this.sliderDropChanceLegs.getValueInt();
    int dropChanceFeet = this.sliderDropChanceFeet.getValueInt();
    int dropChanceMainhand = this.sliderDropChanceMainhand.getValueInt();
    int dropChanceOffhand = this.sliderDropChanceOffhand.getValueInt();
    int sizeScaling = this.sliderSizeScaling.getValueInt();
    this.entity.setHealthScale(healthScaling / 100.0D);
    this.entity.setDropChance(EquipmentSlotType.HEAD, dropChanceHelm / 100.0F);
    this.entity.setDropChance(EquipmentSlotType.CHEST, dropChanceChest / 100.0F);
    this.entity.setDropChance(EquipmentSlotType.LEGS, dropChanceLegs / 100.0F);
    this.entity.setDropChance(EquipmentSlotType.FEET, dropChanceFeet / 100.0F);
    this.entity.setDropChance(EquipmentSlotType.MAINHAND, dropChanceMainhand / 100.0F);
    this.entity.setDropChance(EquipmentSlotType.OFFHAND, dropChanceOffhand / 100.0F);
    this.entity.setSizeVariation(sizeScaling / 100.0F);
    CQRMain.NETWORK.sendToServer(new CPacketSyncEntity(this.entity.getEntityId(), healthScaling, dropChanceHelm, dropChanceChest, dropChanceLegs, dropChanceFeet, dropChanceMainhand, dropChanceOffhand, sizeScaling));
}
Also used : CPacketSyncEntity(team.cqr.cqrepoured.network.client.packet.CPacketSyncEntity)

Aggregations

CPacketSyncEntity (team.cqr.cqrepoured.network.client.packet.CPacketSyncEntity)2 Entity (net.minecraft.entity.Entity)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 AbstractEntityCQR (team.cqr.cqrepoured.entity.bases.AbstractEntityCQR)1