Search in sources :

Example 1 with ISoldier

use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.

the class LayerGunpowder method doRenderLayer.

@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    if (!(creature instanceof ISoldier)) {
        return;
    }
    ISoldier soldier = (ISoldier) creature;
    if (soldier.hasUpgrade(Upgrades.MC_GUNPOWDER, EnumUpgradeType.MISC)) {
        this.renderer.bindSoldierTexture(Resources.ENTITY_WEARABLE_GUNPOWDER.resource);
        this.modelGunpwd.setModelAttributes(this.renderer.getSoldierModel());
        this.modelGunpwd.render(creature, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
    }
}
Also used : ISoldier(de.sanandrew.mods.claysoldiers.api.soldier.ISoldier)

Example 2 with ISoldier

use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.

the class LayerMagmaCreamCharge method doRenderLayer.

@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    if (!(creature instanceof ISoldier)) {
        return;
    }
    ISoldier soldier = (ISoldier) creature;
    if (soldier.hasEffect(Effects.TIME_BOMB)) {
        float durationPerc = soldier.getEffectDurationLeft(Effects.TIME_BOMB) / (float) UpgradeMagmaCream.MAX_TIME_DETONATION;
        boolean isInvisible = soldier.getEntity().isInvisible();
        float ticks = soldier.getEntity().ticksExisted + partialTicks;
        GlStateManager.depthMask(!isInvisible);
        this.renderer.bindSoldierTexture(Resources.LIGHTNING_OVERLAY.resource);
        GlStateManager.matrixMode(GL11.GL_TEXTURE);
        GlStateManager.loadIdentity();
        GlStateManager.translate(ticks * 0.01F, ticks * 0.01F, 0.0F);
        GlStateManager.matrixMode(GL11.GL_MODELVIEW);
        GlStateManager.enableBlend();
        GlStateManager.color(0.5F * (1.0F - durationPerc), 0.5F * durationPerc, 0.0F, 1.0F);
        GlStateManager.disableLighting();
        GlStateManager.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE);
        this.chargedModel.setModelAttributes(this.renderer.getSoldierModel());
        this.chargedModel.render(soldier.getEntity(), limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
        GlStateManager.matrixMode(GL11.GL_TEXTURE);
        GlStateManager.loadIdentity();
        GlStateManager.matrixMode(GL11.GL_MODELVIEW);
        GlStateManager.enableLighting();
        GlStateManager.disableBlend();
        GlStateManager.depthMask(isInvisible);
    }
}
Also used : ISoldier(de.sanandrew.mods.claysoldiers.api.soldier.ISoldier)

Example 3 with ISoldier

use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.

the class LayerCrown method doRenderLayer.

@Override
public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    if (!(creature instanceof ISoldier)) {
        return;
    }
    ISoldier soldier = (ISoldier) creature;
    boolean hasDiamond = soldier.hasUpgrade(Upgrades.MC_DIAMOND, EnumUpgradeType.MISC) || soldier.hasUpgrade(Upgrades.MC_DIAMONDBLOCK, EnumUpgradeType.MISC);
    if (hasDiamond || soldier.hasUpgrade(Upgrades.MC_GOLDNUGGET, EnumUpgradeType.MISC)) {
        GlStateManager.pushMatrix();
        this.renderer.getSoldierModel().bipedHead.postRender(scale);
        if (this.model.texture != null) {
            if (hasDiamond) {
                GlStateManager.color(0.0F, 0.9F, 1.0F);
            } else {
                GlStateManager.color(1.0F, 0.9F, 0.0F);
            }
            this.renderer.bindSoldierTexture(this.model.texture);
            this.model.render(scale);
            GlStateManager.color(1.0F, 1.0F, 1.0F);
        }
        GlStateManager.popMatrix();
    }
}
Also used : ISoldier(de.sanandrew.mods.claysoldiers.api.soldier.ISoldier)

Example 4 with ISoldier

use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.

the class LayerHeldItem method doRenderLayer.

public void doRenderLayer(EntityCreature creature, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) {
    if (!(creature instanceof ISoldier)) {
        return;
    }
    ISoldier soldier = (ISoldier) creature;
    renderHeldItem(soldier, EnumHandSide.RIGHT);
    renderHeldItem(soldier, EnumHandSide.LEFT);
    renderWornItem(soldier, EnumHandSide.RIGHT);
    renderWornItem(soldier, EnumHandSide.LEFT);
}
Also used : ISoldier(de.sanandrew.mods.claysoldiers.api.soldier.ISoldier)

Example 5 with ISoldier

use of de.sanandrew.mods.claysoldiers.api.soldier.ISoldier in project ClaySoldiersMod by SanAndreasP.

the class UpgradeIronIngot method onAttackSuccess.

@Override
public void onAttackSuccess(ISoldier<?> soldier, ISoldierUpgradeInst upgradeInst, Entity target) {
    if (target instanceof ISoldier) {
        ISoldier mark = (ISoldier) target;
        double xRatio = soldier.getEntity().posX - target.posX;
        double zRatio = soldier.getEntity().posZ - target.posZ;
        double prevMotionX = mark.getEntity().motionX;
        if (mark.hasUpgrade(Upgrades.CR_IRONINGOT, EnumUpgradeType.CORE)) {
            mark.getEntity().knockBack(soldier.getEntity(), 1.6F, xRatio, zRatio);
        } else {
            mark.getEntity().knockBack(soldier.getEntity(), 0.8F, xRatio, zRatio);
        }
        mark.getEntity().motionX = prevMotionX;
    }
}
Also used : ISoldier(de.sanandrew.mods.claysoldiers.api.soldier.ISoldier)

Aggregations

ISoldier (de.sanandrew.mods.claysoldiers.api.soldier.ISoldier)19 ISoldierUpgradeInst (de.sanandrew.mods.claysoldiers.api.soldier.upgrade.ISoldierUpgradeInst)7 EnumDyeColor (net.minecraft.item.EnumDyeColor)3 ItemStack (net.minecraft.item.ItemStack)3 EnumUpgradeType (de.sanandrew.mods.claysoldiers.api.soldier.upgrade.EnumUpgradeType)2 EntityCreature (net.minecraft.entity.EntityCreature)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 GameProfile (com.mojang.authlib.GameProfile)1 CsmConstants (de.sanandrew.mods.claysoldiers.api.CsmConstants)1 ISoldierRender (de.sanandrew.mods.claysoldiers.api.client.soldier.ISoldierRender)1 EnumUpgFunctions (de.sanandrew.mods.claysoldiers.api.soldier.upgrade.EnumUpgFunctions)1 ISoldierUpgrade (de.sanandrew.mods.claysoldiers.api.soldier.upgrade.ISoldierUpgrade)1 UpgradeFunctions (de.sanandrew.mods.claysoldiers.api.soldier.upgrade.UpgradeFunctions)1 ModelGoggleBand (de.sanandrew.mods.claysoldiers.client.model.accessory.ModelGoggleBand)1 Upgrades (de.sanandrew.mods.claysoldiers.registry.upgrade.Upgrades)1 ClaySoldiersMod (de.sanandrew.mods.claysoldiers.util.ClaySoldiersMod)1 EnumParticle (de.sanandrew.mods.claysoldiers.util.EnumParticle)1 ColorObj (de.sanandrew.mods.sanlib.lib.ColorObj)1 RenderUtils (de.sanandrew.mods.sanlib.lib.client.util.RenderUtils)1 MiscUtils (de.sanandrew.mods.sanlib.lib.util.MiscUtils)1