Search in sources :

Example 1 with AlchemyArrayEffectArrowTurret

use of WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret in project BloodMagic by WayofTime.

the class TurretAlchemyCircleRenderer method renderAt.

@Override
public void renderAt(TileEntity tile, double x, double y, double z, float craftTime) {
    if (!(tile instanceof TileAlchemyArray)) {
        return;
    }
    // Not working
    float f = 0;
    TileAlchemyArray tileArray = (TileAlchemyArray) tile;
    AlchemyArrayEffect effect = tileArray.arrayEffect;
    double pitch = 0;
    double yaw = 0;
    int arrowTimer = -1;
    if (effect instanceof AlchemyArrayEffectArrowTurret) {
        AlchemyArrayEffectArrowTurret turretEffect = (AlchemyArrayEffectArrowTurret) effect;
        pitch = (turretEffect.getPitch() - turretEffect.getLastPitch()) * f + turretEffect.getLastPitch();
        yaw = (turretEffect.getYaw() - turretEffect.getLastYaw()) * f + turretEffect.getLastYaw();
        arrowTimer = turretEffect.arrowTimer;
    }
    double arrowAnimation = arrowTimer + f;
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder wr = tessellator.getBuffer();
    GlStateManager.pushMatrix();
    float rot = getRotation(craftTime);
    float size = 1.0F * getSizeModifier(craftTime);
    // Bind the texture to the circle
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.disableCull();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(770, 1);
    GlStateManager.translate(x, y, z);
    // Specify which face this "circle" is located on
    EnumFacing sideHit = EnumFacing.UP;
    EnumFacing rotation = tileArray.getRotation();
    GlStateManager.translate(sideHit.getFrontOffsetX() * offsetFromFace, sideHit.getFrontOffsetY() * offsetFromFace, sideHit.getFrontOffsetZ() * offsetFromFace);
    switch(sideHit) {
        case DOWN:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(-90.0f, 1, 0, 0);
            break;
        case EAST:
            GlStateManager.rotate(-90.0f, 0, 1, 0);
            GlStateManager.translate(0, 0, -1);
            break;
        case NORTH:
            break;
        case SOUTH:
            GlStateManager.rotate(180.0f, 0, 1, 0);
            GlStateManager.translate(-1, 0, -1);
            break;
        case UP:
            GlStateManager.translate(0, 1, 0);
            GlStateManager.rotate(90.0f, 1, 0, 0);
            break;
        case WEST:
            GlStateManager.translate(0, 0, 1);
            GlStateManager.rotate(90.0f, 0, 1, 0);
            break;
    }
    GlStateManager.pushMatrix();
    GlStateManager.translate(0.5f, 0.5f, getVerticalOffset(craftTime));
    // GlStateManager.rotate(rotation.getHorizontalAngle() + 180, 0, 0, 1);
    GlStateManager.pushMatrix();
    double topHeightOffset = getTopHeightOffset(craftTime, arrowAnimation);
    double middleHeightOffset = getMiddleHeightOffset(craftTime, arrowAnimation);
    double bottomHeightOffset = getBottomHeightOffset(craftTime, arrowAnimation);
    BlockPos pos = tileArray.getPos();
    World world = tileArray.getWorld();
    GlStateManager.rotate((float) (yaw + 360 * getStartupPitchYawRatio(craftTime)), 0, 0, 1);
    GlStateManager.rotate((float) ((pitch + 90) * getStartupPitchYawRatio(craftTime)), 1, 0, 0);
    GlStateManager.pushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(bottomArrayResource);
    GlStateManager.rotate(-rot, 0, 0, 1);
    GlStateManager.translate(0, 0, -bottomHeightOffset);
    renderStandardCircle(tessellator, wr, size / 2);
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(middleArrayResource);
    GlStateManager.rotate(0, 0, 0, 1);
    GlStateManager.translate(0, 0, -middleHeightOffset);
    renderStandardCircle(tessellator, wr, size);
    GlStateManager.popMatrix();
    GlStateManager.pushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(arrayResource);
    GlStateManager.rotate(rot, 0, 0, 1);
    GlStateManager.translate(0, 0, -topHeightOffset);
    renderStandardCircle(tessellator, wr, size);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
    // GlStateManager.depthMask(true);
    GlStateManager.disableBlend();
    GlStateManager.enableCull();
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GlStateManager.popMatrix();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) EnumFacing(net.minecraft.util.EnumFacing) AlchemyArrayEffect(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect) BlockPos(net.minecraft.util.math.BlockPos) TileAlchemyArray(WayofTime.bloodmagic.tile.TileAlchemyArray) World(net.minecraft.world.World) AlchemyArrayEffectArrowTurret(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret)

Example 2 with AlchemyArrayEffectArrowTurret

use of WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret in project BloodMagic by WayofTime.

the class ModRecipes method addAlchemyArrayRecipes.

public static void addAlchemyArrayRecipes() {
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.DIAMOND_SWORD), new AlchemyArrayEffectBinding("boundSword", Utils.setUnbreakable(new ItemStack(RegistrarBloodMagicItems.BOUND_SWORD))), new BindingAlchemyCircleRenderer());
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.DIAMOND_AXE), new AlchemyArrayEffectBinding("boundAxe", Utils.setUnbreakable(new ItemStack(RegistrarBloodMagicItems.BOUND_AXE))));
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.DIAMOND_PICKAXE), new AlchemyArrayEffectBinding("boundPickaxe", Utils.setUnbreakable(new ItemStack(RegistrarBloodMagicItems.BOUND_PICKAXE))));
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.DIAMOND_SHOVEL), new AlchemyArrayEffectBinding("boundShovel", Utils.setUnbreakable(new ItemStack(RegistrarBloodMagicItems.BOUND_SHOVEL))));
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.IRON_HELMET), new AlchemyArrayEffectBinding("livingHelmet", new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_HELMET)));
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.IRON_CHESTPLATE), new AlchemyArrayEffectBinding("livingChest", new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_CHEST)));
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.IRON_LEGGINGS), new AlchemyArrayEffectBinding("livingLegs", new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_LEGGINGS)));
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_BINDING.getStack(), new ItemStack(Items.IRON_BOOTS), new AlchemyArrayEffectBinding("livingBoots", new ItemStack(RegistrarBloodMagicItems.LIVING_ARMOUR_BOOTS)));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ROTTEN_FLESH), new ItemStack(Items.ROTTEN_FLESH), new AlchemyArrayEffectAttractor("attractor"), new AttractorAlchemyCircleRenderer());
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.FEATHER), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectMovement("movement"), new StaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/MovementArray.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.FEATHER), new ItemStack(Items.GLOWSTONE_DUST), new AlchemyArrayEffectUpdraft("updraft"), new AttractorAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/UpdraftArray.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.SLIME_BALL), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectBounce("bounce"), new SingleAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/BounceArray.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.COAL), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectFurnaceFuel("furnace"), new LowAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FurnaceArray.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ARROW), new ItemStack(Items.FEATHER), new AlchemyArrayEffectSkeletonTurret("skeletonTurret"), new DualAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png"), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret2.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.ENDER_PEARL), new ItemStack(Items.REDSTONE), new AlchemyArrayEffectTeleport("teleport"), new StaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/teleportation.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.BOW), new ItemStack(Items.ARROW), new AlchemyArrayEffectArrowTurret("turret"), new TurretAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/SkeletonTurret1.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Items.REDSTONE), new ItemStack(Blocks.LAPIS_BLOCK), new AlchemyArrayEffectLaputa("laputa"), new AttractorAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/shardoflaputa.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Items.IRON_INGOT), new AlchemyArrayEffectSpike("spike"), new LowStaticAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/spikearray.png")));
    AlchemyArrayRecipeRegistry.registerRecipe(ComponentTypes.REAGENT_FAST_MINER.getStack(), new ItemStack(Items.IRON_PICKAXE), new AlchemyArrayEffectSigil("fastMiner", (ISigil) RegistrarBloodMagicItems.SIGIL_FAST_MINER), new SingleAlchemyCircleRenderer(new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/FastMinerSigil.png")));
}
Also used : BindingAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.BindingAlchemyCircleRenderer) AlchemyArrayEffectTeleport(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectTeleport) AlchemyArrayEffectMovement(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectMovement) LowAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.LowAlchemyCircleRenderer) AlchemyArrayEffectSigil(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSigil) SingleAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.SingleAlchemyCircleRenderer) AlchemyArrayEffectSkeletonTurret(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSkeletonTurret) AlchemyArrayEffectBinding(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding) TurretAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.TurretAlchemyCircleRenderer) AlchemyArrayEffectAttractor(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor) ResourceLocation(net.minecraft.util.ResourceLocation) AlchemyArrayEffectUpdraft(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectUpdraft) AlchemyArrayEffectBounce(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBounce) AlchemyArrayEffectSpike(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSpike) LowStaticAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.LowStaticAlchemyCircleRenderer) ItemStack(net.minecraft.item.ItemStack) AttractorAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.AttractorAlchemyCircleRenderer) StaticAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.StaticAlchemyCircleRenderer) LowStaticAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.LowStaticAlchemyCircleRenderer) AlchemyArrayEffectFurnaceFuel(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectFurnaceFuel) AlchemyArrayEffectArrowTurret(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret) DualAlchemyCircleRenderer(WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer) AlchemyArrayEffectLaputa(WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectLaputa) ISigil(WayofTime.bloodmagic.iface.ISigil)

Aggregations

AlchemyArrayEffectArrowTurret (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectArrowTurret)2 AlchemyArrayEffect (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffect)1 AlchemyArrayEffectAttractor (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectAttractor)1 AlchemyArrayEffectBinding (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBinding)1 AlchemyArrayEffectBounce (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectBounce)1 AlchemyArrayEffectFurnaceFuel (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectFurnaceFuel)1 AlchemyArrayEffectLaputa (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectLaputa)1 AlchemyArrayEffectMovement (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectMovement)1 AlchemyArrayEffectSigil (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSigil)1 AlchemyArrayEffectSkeletonTurret (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSkeletonTurret)1 AlchemyArrayEffectSpike (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectSpike)1 AlchemyArrayEffectTeleport (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectTeleport)1 AlchemyArrayEffectUpdraft (WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectUpdraft)1 AttractorAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.AttractorAlchemyCircleRenderer)1 BindingAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.BindingAlchemyCircleRenderer)1 DualAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.DualAlchemyCircleRenderer)1 LowAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.LowAlchemyCircleRenderer)1 LowStaticAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.LowStaticAlchemyCircleRenderer)1 SingleAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.SingleAlchemyCircleRenderer)1 StaticAlchemyCircleRenderer (WayofTime.bloodmagic.client.render.alchemyArray.StaticAlchemyCircleRenderer)1