Replace branch with old 1.7.10 code and assets

This commit is contained in:
Electroblob
2018-06-07 11:58:24 +01:00
parent 78b61cf573
commit 09f858af20
573 changed files with 28574 additions and 26017 deletions
@@ -5,25 +5,32 @@ import java.util.HashMap;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.client.config.GuiConfigEntries.NumberSliderEntry;
import cpw.mods.fml.client.registry.ClientRegistry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import electroblob.wizardry.CommonProxy;
import electroblob.wizardry.EnumParticleType;
import electroblob.wizardry.ExtendedPlayer;
import electroblob.wizardry.SpellGlyphData;
import electroblob.wizardry.WizardData;
import electroblob.wizardry.WandHelper;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.WizardryRegistry;
import electroblob.wizardry.WizardryUtilities;
import electroblob.wizardry.client.model.ModelSpiritHorse;
import electroblob.wizardry.client.model.ModelSpiritWolf;
import electroblob.wizardry.client.model.ModelWizardArmour;
import electroblob.wizardry.client.particle.ParticleBlizzard;
import electroblob.wizardry.client.particle.ParticleDarkMagic;
import electroblob.wizardry.client.particle.ParticleDust;
import electroblob.wizardry.client.particle.ParticleGiantBubble;
import electroblob.wizardry.client.particle.ParticleIce;
import electroblob.wizardry.client.particle.ParticleLeaf;
import electroblob.wizardry.client.particle.ParticleMagicFlame;
import electroblob.wizardry.client.particle.ParticlePath;
import electroblob.wizardry.client.particle.ParticleRotatingSparkle;
import electroblob.wizardry.client.particle.ParticleSnow;
import electroblob.wizardry.client.particle.ParticleSpark;
import electroblob.wizardry.client.particle.ParticleSparkle;
import electroblob.wizardry.client.particle.ParticleTornado;
import electroblob.wizardry.client.renderer.LayerStone;
import electroblob.wizardry.client.particle.EntityBlizzardFX;
import electroblob.wizardry.client.particle.EntityDarkMagicFX;
import electroblob.wizardry.client.particle.EntityDustFX;
import electroblob.wizardry.client.particle.EntityIceFX;
import electroblob.wizardry.client.particle.EntityLeafFX;
import electroblob.wizardry.client.particle.EntityMagicBubbleFX;
import electroblob.wizardry.client.particle.EntityMagicFireFX;
import electroblob.wizardry.client.particle.EntityPathFX;
import electroblob.wizardry.client.particle.EntitySnowFX;
import electroblob.wizardry.client.particle.EntitySparkFX;
import electroblob.wizardry.client.particle.EntitySparkleFX;
import electroblob.wizardry.client.particle.EntityTornadoFX;
import electroblob.wizardry.client.renderer.RenderArc;
import electroblob.wizardry.client.renderer.RenderArcaneWorkbench;
import electroblob.wizardry.client.renderer.RenderBlackHole;
@@ -32,6 +39,7 @@ import electroblob.wizardry.client.renderer.RenderBubble;
import electroblob.wizardry.client.renderer.RenderDecay;
import electroblob.wizardry.client.renderer.RenderDecoy;
import electroblob.wizardry.client.renderer.RenderEvilWizard;
import electroblob.wizardry.client.renderer.RenderFallingGrass;
import electroblob.wizardry.client.renderer.RenderFireRing;
import electroblob.wizardry.client.renderer.RenderForceArrow;
import electroblob.wizardry.client.renderer.RenderHammer;
@@ -41,14 +49,25 @@ import electroblob.wizardry.client.renderer.RenderLightningDisc;
import electroblob.wizardry.client.renderer.RenderLightningPulse;
import electroblob.wizardry.client.renderer.RenderMagicArrow;
import electroblob.wizardry.client.renderer.RenderMagicLight;
import electroblob.wizardry.client.renderer.RenderMagicSlime;
import electroblob.wizardry.client.renderer.RenderMeteor;
import electroblob.wizardry.client.renderer.RenderPhoenix;
import electroblob.wizardry.client.renderer.RenderProjectile;
import electroblob.wizardry.client.renderer.RenderSigil;
import electroblob.wizardry.client.renderer.RenderSilverfishMinion;
import electroblob.wizardry.client.renderer.RenderSkeletonMinion;
import electroblob.wizardry.client.renderer.RenderSpiderMinion;
import electroblob.wizardry.client.renderer.RenderSpiritHorse;
import electroblob.wizardry.client.renderer.RenderSpiritWolf;
import electroblob.wizardry.client.renderer.RenderStatue;
import electroblob.wizardry.client.renderer.RenderTranslucentItem;
import electroblob.wizardry.client.renderer.RenderWizard;
import electroblob.wizardry.client.renderer.RenderWraithMinion;
import electroblob.wizardry.client.renderer.RenderZombieMinion;
import electroblob.wizardry.entity.EntityArc;
import electroblob.wizardry.entity.EntityFallingGrass;
import electroblob.wizardry.entity.EntityMagicSlime;
import electroblob.wizardry.entity.EntityMeteor;
import electroblob.wizardry.entity.EntityShield;
import electroblob.wizardry.entity.construct.EntityArrowRain;
import electroblob.wizardry.entity.construct.EntityBlackHole;
@@ -67,6 +86,7 @@ import electroblob.wizardry.entity.construct.EntityIceSpike;
import electroblob.wizardry.entity.construct.EntityLightningPulse;
import electroblob.wizardry.entity.construct.EntityLightningSigil;
import electroblob.wizardry.entity.construct.EntityTornado;
import electroblob.wizardry.entity.living.EntityBlazeMinion;
import electroblob.wizardry.entity.living.EntityDecoy;
import electroblob.wizardry.entity.living.EntityEvilWizard;
import electroblob.wizardry.entity.living.EntityIceGiant;
@@ -74,12 +94,15 @@ import electroblob.wizardry.entity.living.EntityIceWraith;
import electroblob.wizardry.entity.living.EntityLightningWraith;
import electroblob.wizardry.entity.living.EntityPhoenix;
import electroblob.wizardry.entity.living.EntityShadowWraith;
import electroblob.wizardry.entity.living.EntitySilverfishMinion;
import electroblob.wizardry.entity.living.EntitySkeletonMinion;
import electroblob.wizardry.entity.living.EntitySpiderMinion;
import electroblob.wizardry.entity.living.EntitySpiritHorse;
import electroblob.wizardry.entity.living.EntitySpiritWolf;
import electroblob.wizardry.entity.living.EntityStormElemental;
import electroblob.wizardry.entity.living.EntitySummonedCreature;
import electroblob.wizardry.entity.living.EntityWizard;
import electroblob.wizardry.entity.living.ISpellCaster;
import electroblob.wizardry.entity.living.ISummonedCreature;
import electroblob.wizardry.entity.living.EntityZombieMinion;
import electroblob.wizardry.entity.projectile.EntityDarknessOrb;
import electroblob.wizardry.entity.projectile.EntityDart;
import electroblob.wizardry.entity.projectile.EntityFirebolt;
@@ -97,81 +120,86 @@ import electroblob.wizardry.entity.projectile.EntitySmokeBomb;
import electroblob.wizardry.entity.projectile.EntitySpark;
import electroblob.wizardry.entity.projectile.EntitySparkBomb;
import electroblob.wizardry.entity.projectile.EntityThunderbolt;
import electroblob.wizardry.event.SpellCastEvent;
import electroblob.wizardry.event.SpellCastEvent.Source;
import electroblob.wizardry.item.ItemFlamingAxe;
import electroblob.wizardry.item.ItemFrostAxe;
import electroblob.wizardry.item.ItemScroll;
import electroblob.wizardry.item.ItemSpectralArmour;
import electroblob.wizardry.item.ItemSpectralBow;
import electroblob.wizardry.item.ItemSpectralPickaxe;
import electroblob.wizardry.item.ItemSpectralSword;
import electroblob.wizardry.item.ItemSpellBook;
import electroblob.wizardry.item.ItemWand;
import electroblob.wizardry.packet.PacketCastContinuousSpell;
import electroblob.wizardry.packet.PacketCastSpell;
import electroblob.wizardry.packet.PacketNPCCastSpell;
import electroblob.wizardry.packet.PacketPlayerSync.Message;
import electroblob.wizardry.packet.PacketTransportation;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.spell.Clairvoyance;
import electroblob.wizardry.spell.None;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
import electroblob.wizardry.tileentity.TileEntityMagicLight;
import electroblob.wizardry.tileentity.TileEntityStatue;
import electroblob.wizardry.util.WandHelper;
import electroblob.wizardry.util.WizardryParticleType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.RenderBlaze;
import net.minecraft.client.model.ModelSlime;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
import net.minecraftforge.fml.client.config.GuiConfigEntries.NumberSliderEntry;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
/**
* The client proxy for wizardry.
* @author Electroblob
* @since Wizardry 1.0
*/
public class ClientProxy extends CommonProxy {
/** Static instance of the mixed font renderer */
public static MixedFontRenderer mixedFontRenderer;
// Key Bindings
public static final KeyBinding NEXT_SPELL = new KeyBinding("key.wizardry.next_spell", Keyboard.KEY_N, "key.categories.wizardry");
public static final KeyBinding PREVIOUS_SPELL = new KeyBinding("key.wizardry.previous_spell", Keyboard.KEY_B, "key.categories.wizardry");
public static final KeyBinding nextSpell = new KeyBinding("key.next_spell", Keyboard.KEY_N, "key.categories.wizardry");
public static final KeyBinding previousSpell = new KeyBinding("key.previous_spell", Keyboard.KEY_B, "key.categories.wizardry");
// Armour Model
public static final ModelBiped WIZARD_ARMOUR_MODEL = new ModelWizardArmour(0.75f);
// SECTION Registry
// ===============================================================================================================
public static ModelBiped wizardArmourModel = new ModelWizardArmour(0.75f);
@Override
public ModelBiped getWizardArmourModel(){
return WIZARD_ARMOUR_MODEL;
return wizardArmourModel;
}
@Override
public double getPlayerEyesPos(EntityPlayer player){
return Minecraft.getMinecraft().thePlayer == player ? player.posY : player.posY + player.eyeHeight;
}
@Override
public Vec3 getWandTipPosition(EntityLivingBase entity){
// Behaves differently in first person
if(Minecraft.getMinecraft().thePlayer == entity && Minecraft.getMinecraft().gameSettings.thirdPersonView == 0){
return Vec3.createVectorHelper(entity.posX, entity.boundingBox.minY + 1.2, entity.posZ);
}else{
return super.getWandTipPosition(entity);
}
}
@Override
public void registerKeyBindings(){
ClientRegistry.registerKeyBinding(NEXT_SPELL);
ClientRegistry.registerKeyBinding(PREVIOUS_SPELL);
ClientRegistry.registerKeyBinding(nextSpell);
ClientRegistry.registerKeyBinding(previousSpell);
}
@Override
public void registerEventHandlers(){
super.registerEventHandlers();
MinecraftForge.EVENT_BUS.register(new WizardryClientEventHandler());
}
@Override
@@ -179,37 +207,15 @@ public class ClientProxy extends CommonProxy {
MinecraftForge.EVENT_BUS.register(new GuiSpellDisplay(Minecraft.getMinecraft()));
}
@Override
public void initMixedFontRenderer(){
mixedFontRenderer = new MixedFontRenderer(Minecraft.getMinecraft().gameSettings,
new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false);
}
// SECTION Misc
// ===============================================================================================================
@Override
public void setToNumberSliderEntry(Property property) {
property.setConfigEntryClass(NumberSliderEntry.class);
}
@Override
public World getTheWorld() {
return Minecraft.getMinecraft().theWorld;
}
@Override
public void playMovingSound(Entity entity, SoundEvent sound, float volume, float pitch, boolean repeat){
Minecraft.getMinecraft().getSoundHandler().playSound(new MovingSoundEntity(entity, sound, volume, pitch, repeat));
}
// SECTION Items
// ===============================================================================================================
@Override
public FontRenderer getFontRenderer(ItemStack stack){
Spell spell = Spells.none;
Spell spell = WizardryRegistry.none;
if(stack.getItem() instanceof ItemWand){
spell = WandHelper.getCurrentSpell(stack);
@@ -217,10 +223,8 @@ public class ClientProxy extends CommonProxy {
spell = Spell.get(stack.getItemDamage());
}
if(Minecraft.getMinecraft().thePlayer != null && Wizardry.settings.discoveryMode
&& WizardData.get(Minecraft.getMinecraft().thePlayer) != null
&& !Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode
&& !WizardData.get(Minecraft.getMinecraft().thePlayer).hasSpellBeenDiscovered(spell)){
if(Wizardry.discoveryMode && ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer) != null && !Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode
&& !ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer).hasSpellBeenDiscovered(spell)){
return mixedFontRenderer;
}
@@ -232,184 +236,111 @@ public class ClientProxy extends CommonProxy {
// Displays [Empty slot] if spell is continuous.
Spell spell = Spell.get(scroll.getItemDamage());
if(spell.isContinuous) spell = Spells.none;
if(spell.isContinuous) spell = WizardryRegistry.none;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
boolean discovered = true;
// It seems that this method is called when the world is loading, before thePlayer has been initialised.
// If the player is null, the spell is assumed to be discovered.
if(player != null && Wizardry.settings.discoveryMode && !player.capabilities.isCreativeMode
&& WizardData.get(player) != null && !WizardData.get(player).hasSpellBeenDiscovered(spell)){
if(player != null && Wizardry.discoveryMode && !player.capabilities.isCreativeMode
&& ExtendedPlayer.get(player) != null && !ExtendedPlayer.get(player).hasSpellBeenDiscovered(spell)){
discovered = false;
}
if(discovered){
return I18n.format("item.wizardry:scroll.name", spell.getDisplayName()).trim();
return I18n.format("item.scroll.name", spell.getDisplayName()).trim();
}else{
return I18n.format("item.wizardry:scroll.undiscovered.name", "#" + SpellGlyphData.getGlyphName(spell, player.worldObj) + "#").trim();
return I18n.format("item.scroll.undiscovered.name", "#" + SpellGlyphData.getGlyphName(spell, player.worldObj) + "#").trim();
}
}
@Override
public double getConjuredBowDurability(ItemStack stack){
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(player.getActiveItemStack() == stack){
return (double)(stack.getItemDamage() + (player.getItemInUseMaxCount()) ) / (double)stack.getMaxDamage();
}
return super.getConjuredBowDurability(stack);
}
// SECTION Particles
// ===============================================================================================================
@Override
public void spawnParticle(WizardryParticleType type, World world, double x, double y, double z, double velX, double velY, double velZ, int maxAge, float r, float g, float b, boolean doGravity, double radius){
public void spawnParticle(EnumParticleType type, World world, double x, double y, double z, double velX, double velY, double velZ, int maxAge, float r, float g, float b, boolean doGravity, double radius){
// Colour values are now automatically clamped to between 0 and 1, as values outside this range seem to
// cause strange effects in 1.10 (or more specifically, particles that are bright pink!)
// TODO: This is a terrible dirty fix, but it'll do for now. Find a nicer way in future.
if(type != WizardryParticleType.MAGIC_FIRE) r = MathHelper.clamp_float(r, 0, 1);
g = MathHelper.clamp_float(g, 0, 1);
b = MathHelper.clamp_float(b, 0, 1);
switch(type){
case BLIZZARD:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleBlizzard(world, maxAge, x, z, radius, y));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityBlizzardFX(world, r, g, b, maxAge, x, z, radius, y));
break;
case BRIGHT_DUST:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDust(world, x, y, z, velX, velY, velZ, r, g, b, false));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityDustFX(world, x, y, z, velX, velY, velZ, r, g, b, false));
break;
case DARK_MAGIC:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDarkMagic(world, x, y, z, velX, velY, velZ, r, g, b));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityDarkMagicFX(world, x, y, z, velX, velY, velZ, r, g, b));
break;
case DUST:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleDust(world, x, y, z, velX, velY, velZ, r, g, b, true));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityDustFX(world, x, y, z, velX, velY, velZ, r, g, b, true));
break;
case ICE:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleIce(world, x, y, z, velX, velY, velZ, maxAge));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityIceFX(world, x, y, z, velX, velY, velZ, maxAge));
break;
case LEAF:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleLeaf(world, x, y, z, velX, velY, velZ, maxAge));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityLeafFX(world, x, y, z, velX, velY, velZ, maxAge));
break;
case MAGIC_BUBBLE:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleGiantBubble(world, x, y, z, velX, velY, velZ));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityMagicBubbleFX(world, x, y, z, velX, velY, velZ));
break;
case MAGIC_FIRE:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleMagicFlame(world, x, y, z, velX, velY, velZ, maxAge, r == 0 ? 1 + world.rand.nextFloat() : r));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityMagicFireFX(world, x, y, z, velX, velY, velZ, maxAge, r == 0 ? 1 + world.rand.nextFloat() : r));
break;
case PATH:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticlePath(world, x, y, z, velX, velY, velZ, r, g, b, maxAge));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityPathFX(world, x, y, z, velX, velY, velZ, r, g, b, maxAge));
break;
case SNOW:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSnow(world, x, y, z, velX, velY, velZ));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySnowFX(world, x, y, z, velX, velY, velZ));
break;
case SPARK:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSpark(world, x, y, z, velX, velY, velZ));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySparkFX(world, x, y, z, velX, velY, velZ));
break;
case SPARKLE:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSparkle(world, x, y, z, velX, velY, velZ, r, g, b, maxAge, doGravity));
break;
case SPARKLE_ROTATING:
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleRotatingSparkle(world, maxAge, x, z, radius, y, r, g, b));
break;
default:
Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySparkleFX(world, x, y, z, velX, velY, velZ, r, g, b, maxAge, doGravity));
break;
}
}
@Override
public void spawnTornadoParticle(World world, double x, double y, double z, double velX, double velZ, double radius, int maxAge, IBlockState block, BlockPos pos){
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleTornado(world, maxAge, x, z, radius, y, velX, velZ, block).setBlockPos(pos));//, world.rand.nextInt(6)));
public void spawnDigParticle(World world, double x, double y, double z, double velX, double velY, double velZ, Block block){
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityDiggingFX(world, x, y, z, velX, velY, velZ, block, 0));
}
// SECTION Packet Handlers
// ===============================================================================================================
@Override
public void spawnTornadoParticle(World world, double x, double y, double z, double velX, double velZ, double radius, int maxAge, Block block, int metadata){
Minecraft.getMinecraft().effectRenderer.addEffect(new EntityTornadoFX(world, maxAge, x, z, radius, y, velX, velZ, block, metadata, world.rand.nextInt(6)));
}
@Override
public void playMovingSound(Entity entity, String soundName, float volume, float pitch, boolean repeat){
Minecraft.getMinecraft().getSoundHandler().playSound(new MovingSoundEntity(entity, soundName, volume, pitch, repeat));
}
@Override
public void handleCastSpellPacket(PacketCastSpell.Message message){
World world = Minecraft.getMinecraft().theWorld;
Entity caster = world.getEntityByID(message.casterID);
Entity target = world.getEntityByID(message.targetID);
Spell spell = Spell.get(message.spellID);
// Should always be true
if(caster instanceof EntityPlayer){
((EntityPlayer)caster).setActiveHand(message.hand);
ItemStack stack = ((EntityPlayer)caster).getHeldItem();
if(stack != null) ((EntityPlayer)caster).setItemInUse(stack, stack.getMaxItemUseDuration());
// Duration isn't needed because it only ever affects things server-side, and anything that is
// seen client-side gets synced elsewhere.
spell.cast(world, (EntityPlayer)caster, message.hand, 0, message.modifiers);
Source source = Source.OTHER;
if(((EntityPlayer)caster).getHeldItem(message.hand) != null){
Item item = ((EntityPlayer)caster).getHeldItem(message.hand).getItem();
if(item instanceof ItemWand){
source = Source.WAND;
}else if(item instanceof ItemScroll){
source = Source.SCROLL;
}
}
// No need to check if the spell succeeded, because the packet is only ever sent when it succeeds.
// The handler for this event now deals with discovery.
MinecraftForge.EVENT_BUS.post(new SpellCastEvent.Post((EntityPlayer)caster, spell, message.modifiers, source));
}else{
Wizardry.logger.warn("Recieved a PacketCastSpell, but the caster ID was not the ID of a player");
}
}
@Override
public void handleCastContinuousSpellPacket(PacketCastContinuousSpell.Message message){
spell.cast(world, (EntityPlayer)caster, 0, message.damageMultiplier, message.rangeMultiplier, 1, message.blastMultiplier);
World world = Minecraft.getMinecraft().theWorld;
Entity caster = world.getEntityByID(message.casterID);
Spell spell = Spell.get(message.spellID);
// Should always be true
if(caster instanceof EntityPlayer){
// Updates the spell discovery data client-side. Could be done by calling sync(), but that means sending
// another packet unnecessarily.
if(ExtendedPlayer.get((EntityPlayer)caster) != null){
ExtendedPlayer.get((EntityPlayer)caster).discoverSpell(spell);
}
WizardData data = WizardData.get((EntityPlayer)caster);
if(data != null){
if(data.isCasting()){
WizardData.get((EntityPlayer)caster).stopCastingContinuousSpell();
}else{
WizardData.get((EntityPlayer)caster).startCastingContinuousSpell(spell, message.modifiers);
}
}
}else{
Wizardry.logger.warn("Recieved a PacketCastContinuousSpell, but the caster ID was not the ID of a player");
}
}
@Override
public void handleNPCCastSpellPacket(PacketNPCCastSpell.Message message){
World world = Minecraft.getMinecraft().theWorld;
Entity caster = world.getEntityByID(message.casterID);
Entity target = message.targetID == -1 ? null : world.getEntityByID(message.targetID);
Spell spell = Spell.get(message.spellID);
// Should always be true
if(caster instanceof EntityLiving){
if(target instanceof EntityLivingBase){
spell.cast(world, (EntityLiving)caster, message.hand, 0, (EntityLivingBase)target, message.modifiers);
// Again, no need to check if the spell succeeded, because the packet is only ever sent when it succeeds.
MinecraftForge.EVENT_BUS.post(new SpellCastEvent.Post((EntityLiving)caster, spell, message.modifiers, Source.NPC));
}
if(caster instanceof ISpellCaster){
if(spell.isContinuous || spell instanceof None){
((ISpellCaster)caster).setContinuousSpell(spell);
((EntityLiving)caster).setAttackTarget((EntityLivingBase)target);
}
}
}else{
Wizardry.logger.warn("Recieved a PacketNPCCastSpell, but the caster ID was not the ID of an EntityLiving");
else if(caster instanceof EntityLiving && target instanceof EntityLivingBase){
spell.cast(world, (EntityLiving)caster, (EntityLivingBase)target, message.damageMultiplier, message.rangeMultiplier, 1, message.blastMultiplier);
}
}
@@ -418,39 +349,37 @@ public class ClientProxy extends CommonProxy {
World world = Minecraft.getMinecraft().theWorld;
Entity caster = world.getEntityByID(message.casterID);
// Moved from when the packet is sent to when it is received; fixes the sound not playing in first person.
caster.playSound(SoundEvents.BLOCK_PORTAL_TRAVEL, 1, 1);
for(int i=0; i<20; i++){
double radius = 1;
double angle = world.rand.nextDouble()*Math.PI*2;
double x = caster.posX + radius*Math.cos(angle);
double y = caster.getEntityBoundingBox().minY + world.rand.nextDouble()*2;
double y = WizardryUtilities.getEntityFeetPos(caster) + world.rand.nextDouble()*2;
double z = caster.posZ + radius*Math.sin(angle);
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSparkle(world, x, y, z, 0, 0.02, 0, 0.6f, 1.0f, 0.6f, 80 + world.rand.nextInt(10)));
Minecraft.getMinecraft().effectRenderer.addEffect(new EntitySparkleFX(world, x, y, z, 0, 0.02, 0, 0.6f, 1.0f, 0.6f, 80 + world.rand.nextInt(10)));
}
for(int i=0; i<20; i++){
double radius = 1;
double angle = world.rand.nextDouble()*Math.PI*2;
double x = caster.posX + radius*Math.cos(angle);
double y = caster.getEntityBoundingBox().minY + world.rand.nextDouble()*2;
double y = WizardryUtilities.getEntityFeetPos(caster) + world.rand.nextDouble()*2;
double z = caster.posZ + radius*Math.sin(angle);
world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, x, y, z, 0, 0.02, 0);
world.spawnParticle("happyVillager", x, y, z, 0, 0.02, 0);
}
for(int i=0; i<20; i++){
double radius = 1;
double angle = world.rand.nextDouble()*Math.PI*2;
double x = caster.posX + radius*Math.cos(angle);
double y = caster.getEntityBoundingBox().minY + world.rand.nextDouble()*2;
double y = WizardryUtilities.getEntityFeetPos(caster) + world.rand.nextDouble()*2;
double z = caster.posZ + radius*Math.sin(angle);
world.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, x, y, z, 0, 0.02, 0);
world.spawnParticle("enchantmenttable", x, y, z, 0, 0.02, 0);
}
}
@Override
public void handlePlayerSyncPacket(Message message){
WizardData properties = WizardData.get(Minecraft.getMinecraft().thePlayer);
ExtendedPlayer properties = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
if(properties != null){
@@ -461,8 +390,8 @@ public class ClientProxy extends CommonProxy {
}else{
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.selectedMinionID);
if(entity instanceof ISummonedCreature){
properties.selectedMinion = new WeakReference<ISummonedCreature>((ISummonedCreature)entity);
if(entity instanceof EntitySummonedCreature){
properties.selectedMinion = new WeakReference(entity);
}else{
properties.selectedMinion = null;
}
@@ -472,7 +401,7 @@ public class ClientProxy extends CommonProxy {
@Override
public void handleGlyphDataPacket(electroblob.wizardry.packet.PacketGlyphData.Message message){
SpellGlyphData data = SpellGlyphData.get(Minecraft.getMinecraft().theWorld);
data.randomNames = new HashMap<Spell, String>();
@@ -485,109 +414,165 @@ public class ClientProxy extends CommonProxy {
}
}
@Override
public void handleCastContinuousSpellPacket(PacketCastContinuousSpell.Message message){
World world = Minecraft.getMinecraft().theWorld;
Entity caster = world.getEntityByID(message.casterID);
Spell spell = Spell.get(message.spellID);
// This should always be true
if(caster instanceof EntityPlayer){
ExtendedPlayer properties = ExtendedPlayer.get((EntityPlayer)caster);
if(properties != null){
if(properties.isCasting()){
ExtendedPlayer.get((EntityPlayer)caster).stopCastingContinuousSpell();
}else{
ExtendedPlayer.get((EntityPlayer)caster).startCastingContinuousSpell(spell, message.damageMultiplier, message.rangeMultiplier, 1, message.blastMultiplier);
}
}
}
}
@Override
public void handleClairvoyancePacket(electroblob.wizardry.packet.PacketClairvoyance.Message message) {
Clairvoyance.spawnPathPaticles(Minecraft.getMinecraft().theWorld, message.path, message.durationMultiplier);
}
// SECTION Rendering
// ===============================================================================================================
private static final ResourceLocation ICE_WRAITH_TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/entity/ice_wraith.png");
private static final ResourceLocation LIGHTNING_WRAITH_TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/entity/lightning_wraith.png");
/** Static instance of the statue renderer, used to access the block breaking texture. */
public static RenderStatue renderStatue;
@Override
public void initialiseLayers(){
LayerStone.initialiseLayers();
public double getWandDisplayDamage(ItemStack stack){
ExtendedPlayer properties = ExtendedPlayer.get(net.minecraft.client.Minecraft.getMinecraft().thePlayer);
// If the player is creative or this wand is not the wand being used, the arbitrary placeholder damage is not displayed.
if(net.minecraft.client.Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode || net.minecraft.client.Minecraft.getMinecraft().thePlayer.getHeldItem() != stack){
return (double)stack.getItemDamageForDisplay() / (double)stack.getMaxDamage();
}else{
return (double)(stack.getItemDamageForDisplay() + properties.damageToApply) / (double)stack.getMaxDamage();
}
}
@Override
public void registerRenderers(){
public int getConjuredItemDisplayDamage(ItemStack stack){
if(stack.getItem() instanceof ItemSpectralSword){
ExtendedPlayer properties = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
return stack.getItemDamage() + properties.conjuredSwordDuration;
}else if(stack.getItem() instanceof ItemSpectralPickaxe){
ExtendedPlayer properties = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
return stack.getItemDamage() + properties.conjuredPickaxeDuration;
}else if(stack.getItem() instanceof ItemSpectralBow){
ExtendedPlayer properties = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
return stack.getItemDamage() + properties.conjuredBowDuration;
}else if(stack.getItem() instanceof ItemSpectralArmour){
ExtendedPlayer properties = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
return stack.getItemDamage() + properties.conjuredArmourDuration;
}else if(stack.getItem() instanceof ItemFlamingAxe){
ExtendedPlayer properties = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
return stack.getItemDamage() + properties.flamingAxeDuration;
}else if(stack.getItem() instanceof ItemFrostAxe){
ExtendedPlayer properties = ExtendedPlayer.get(Minecraft.getMinecraft().thePlayer);
return stack.getItemDamage() + properties.frostAxeDuration;
}
return 0;
}
@Override
public void registerRenderers() {
mixedFontRenderer = new MixedFontRenderer(Minecraft.getMinecraft().gameSettings,
new ResourceLocation("textures/font/ascii.png"), Minecraft.getMinecraft().renderEngine, false);
// Minions
// Yet another advantage to the new system: turns out you don't even need to register the renderer if you
// just want the vanilla one for the mob you're extending.
// An anonymous class in a lambda expression! No point writing a separate class really, is there?
RenderingRegistry.registerEntityRenderingHandler(EntityLightningWraith.class, manager -> new RenderBlaze(manager){
@Override
protected ResourceLocation getEntityTexture(EntityBlaze entity){
return LIGHTNING_WRAITH_TEXTURE;
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityIceWraith.class, manager -> new RenderBlaze(manager){
@Override
protected ResourceLocation getEntityTexture(EntityBlaze entity){
return ICE_WRAITH_TEXTURE;
}
});
RenderingRegistry.registerEntityRenderingHandler(EntityIceGiant.class, RenderIceGiant::new);
RenderingRegistry.registerEntityRenderingHandler(EntityPhoenix.class, RenderPhoenix::new);
RenderingRegistry.registerEntityRenderingHandler(EntityZombieMinion.class, new RenderZombieMinion());
RenderingRegistry.registerEntityRenderingHandler(EntitySkeletonMinion.class, new RenderSkeletonMinion());
RenderingRegistry.registerEntityRenderingHandler(EntitySpiderMinion.class, new RenderSpiderMinion());
RenderingRegistry.registerEntityRenderingHandler(EntityBlazeMinion.class, new RenderWraithMinion(new ResourceLocation("textures/entity/blaze.png")));
RenderingRegistry.registerEntityRenderingHandler(EntityIceWraith.class, new RenderWraithMinion(new ResourceLocation("wizardry:textures/entity/ice_wraith.png")));
RenderingRegistry.registerEntityRenderingHandler(EntityLightningWraith.class, new RenderWraithMinion(new ResourceLocation("wizardry:textures/entity/lightning_wraith.png")));
RenderingRegistry.registerEntityRenderingHandler(EntityMagicSlime.class, new RenderMagicSlime(new ModelSlime(16), new ModelSlime(0), 0.25F));
RenderingRegistry.registerEntityRenderingHandler(EntityIceGiant.class, new RenderIceGiant());
RenderingRegistry.registerEntityRenderingHandler(EntityPhoenix.class, new RenderPhoenix());
RenderingRegistry.registerEntityRenderingHandler(EntitySilverfishMinion.class, new RenderSilverfishMinion());
// Projectiles
RenderingRegistry.registerEntityRenderingHandler(EntityMagicMissile.class, manager -> new RenderMagicArrow(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/magic_missile.png"), false, 8.0, 4.0, 16, 9, false));
RenderingRegistry.registerEntityRenderingHandler(EntityIceShard.class, manager -> new RenderMagicArrow(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/ice_shard.png"), false, 8.0, 2.0, 16, 5, false));
RenderingRegistry.registerEntityRenderingHandler(EntityLightningArrow.class, manager -> new RenderMagicArrow(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/lightning_arrow.png"), true, 8.0, 2.0, 16, 5, false));
RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, manager -> new RenderMagicArrow(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/dart.png"), false, 8.0, 2.0, 16, 5, true));
RenderingRegistry.registerEntityRenderingHandler(EntityIceLance.class, manager -> new RenderMagicArrow(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/ice_lance.png"), false, 16.0, 3.0, 22, 5, true));
RenderingRegistry.registerEntityRenderingHandler(EntityMagicMissile.class, new RenderMagicArrow(new ResourceLocation("wizardry:textures/entity/magic_missile.png"), false, 8.0, 4.0, 16, 9, false));
RenderingRegistry.registerEntityRenderingHandler(EntityIceShard.class, new RenderMagicArrow(new ResourceLocation("wizardry:textures/entity/ice_shard.png"), false, 8.0, 2.0, 16, 5, false));
RenderingRegistry.registerEntityRenderingHandler(EntityLightningArrow.class, new RenderMagicArrow(new ResourceLocation("wizardry:textures/entity/lightning_arrow.png"), true, 8.0, 2.0, 16, 5, false));
RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderMagicArrow(new ResourceLocation("wizardry:textures/entity/dart.png"), false, 8.0, 2.0, 16, 5, true));
RenderingRegistry.registerEntityRenderingHandler(EntityIceLance.class, new RenderMagicArrow(new ResourceLocation("wizardry:textures/entity/ice_lance.png"), false, 16.0, 3.0, 22, 5, true));
RenderingRegistry.registerEntityRenderingHandler(EntityForceArrow.class, RenderForceArrow::new);
RenderingRegistry.registerEntityRenderingHandler(EntityForceArrow.class, new RenderForceArrow());
// Creatures
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritWolf.class, manager -> new RenderSpiritWolf(manager, 0.5f));
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritHorse.class, manager -> new RenderSpiritHorse(manager, 0.5f));
RenderingRegistry.registerEntityRenderingHandler(EntityWizard.class, RenderWizard::new);
RenderingRegistry.registerEntityRenderingHandler(EntityEvilWizard.class, RenderEvilWizard::new);
RenderingRegistry.registerEntityRenderingHandler(EntityDecoy.class, RenderDecoy::new);
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritWolf.class, new RenderSpiritWolf(new ModelSpiritWolf(), new ModelSpiritWolf(), 0.5f));
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritHorse.class, new RenderSpiritHorse(new ModelSpiritHorse(), 0.5f));
RenderingRegistry.registerEntityRenderingHandler(EntityWizard.class, new RenderWizard());
RenderingRegistry.registerEntityRenderingHandler(EntityEvilWizard.class, new RenderEvilWizard());
RenderingRegistry.registerEntityRenderingHandler(EntityDecoy.class, new RenderDecoy());
// Throwables
RenderingRegistry.registerEntityRenderingHandler(EntitySparkBomb.class, manager -> new RenderProjectile(manager, 0.6f, new ResourceLocation(Wizardry.MODID, "textures/entity/spark_bomb.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityFirebomb.class, manager -> new RenderProjectile(manager, 0.6f, new ResourceLocation(Wizardry.MODID, "textures/items/firebomb.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityPoisonBomb.class, manager -> new RenderProjectile(manager, 0.6f, new ResourceLocation(Wizardry.MODID, "textures/items/poison_bomb.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityIceCharge.class, manager -> new RenderProjectile(manager, 0.6f, new ResourceLocation(Wizardry.MODID, "textures/entity/ice_charge.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityForceOrb.class, manager -> new RenderProjectile(manager, 0.7f, new ResourceLocation(Wizardry.MODID, "textures/entity/force_orb.png"), true));
RenderingRegistry.registerEntityRenderingHandler(EntitySpark.class, manager -> new RenderProjectile(manager, 0.4f, new ResourceLocation(Wizardry.MODID, "textures/entity/spark.png"), true));
RenderingRegistry.registerEntityRenderingHandler(EntityDarknessOrb.class, manager -> new RenderProjectile(manager, 0.6f, new ResourceLocation(Wizardry.MODID, "textures/entity/darkness_orb.png"), true));
RenderingRegistry.registerEntityRenderingHandler(EntityFirebolt.class, manager -> new RenderProjectile(manager, 0.2f, new ResourceLocation(Wizardry.MODID, "textures/entity/firebolt.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityLightningDisc.class, manager -> new RenderLightningDisc(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/lightning_sigil.png"), 2.0f));
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeBomb.class, manager -> new RenderProjectile(manager, 0.6f, new ResourceLocation(Wizardry.MODID, "textures/items/smoke_bomb.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntitySparkBomb.class, new RenderProjectile(0.6f, new ResourceLocation("wizardry:textures/entity/spark_bomb.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityFirebomb.class, new RenderProjectile(0.6f, new ResourceLocation("wizardry:textures/items/firebomb.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityPoisonBomb.class, new RenderProjectile(0.6f, new ResourceLocation("wizardry:textures/items/poison_bomb.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityIceCharge.class, new RenderProjectile(0.6f, new ResourceLocation("wizardry:textures/entity/ice_charge.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityForceOrb.class, new RenderProjectile(0.7f, new ResourceLocation("wizardry:textures/entity/force_orb.png"), true));
RenderingRegistry.registerEntityRenderingHandler(EntitySpark.class, new RenderProjectile(0.4f, new ResourceLocation("wizardry:textures/entity/spark.png"), true));
RenderingRegistry.registerEntityRenderingHandler(EntityDarknessOrb.class, new RenderProjectile(0.6f, new ResourceLocation("wizardry:textures/entity/darkness_orb.png"), true));
RenderingRegistry.registerEntityRenderingHandler(EntityFirebolt.class, new RenderProjectile(0.2f, new ResourceLocation("wizardry:textures/entity/firebolt.png"), false));
RenderingRegistry.registerEntityRenderingHandler(EntityLightningDisc.class, new RenderLightningDisc(new ResourceLocation("wizardry:textures/entity/lightning_sigil.png"), 2.0f));
RenderingRegistry.registerEntityRenderingHandler(EntitySmokeBomb.class, new RenderProjectile(0.6f, new ResourceLocation("wizardry:textures/items/smoke_bomb.png"), false));
// Effects and constructs
RenderingRegistry.registerEntityRenderingHandler(EntityArc.class, RenderArc::new);
RenderingRegistry.registerEntityRenderingHandler(EntityBlackHole.class, RenderBlackHole::new);
RenderingRegistry.registerEntityRenderingHandler(EntityShield.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityBubble.class, RenderBubble::new);
RenderingRegistry.registerEntityRenderingHandler(EntityHammer.class, RenderHammer::new);
RenderingRegistry.registerEntityRenderingHandler(EntityIceSpike.class, RenderIceSpike::new);
RenderingRegistry.registerEntityRenderingHandler(EntityArc.class, new RenderArc());
RenderingRegistry.registerEntityRenderingHandler(EntityBlackHole.class, new RenderBlackHole());
RenderingRegistry.registerEntityRenderingHandler(EntityShield.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityMeteor.class, new RenderMeteor());
RenderingRegistry.registerEntityRenderingHandler(EntityBubble.class, new RenderBubble());
RenderingRegistry.registerEntityRenderingHandler(EntityHammer.class, new RenderHammer());
RenderingRegistry.registerEntityRenderingHandler(EntityFallingGrass.class, new RenderFallingGrass());
RenderingRegistry.registerEntityRenderingHandler(EntityIceSpike.class, new RenderIceSpike());
// Stuff that doesn't render
RenderingRegistry.registerEntityRenderingHandler(EntityBlizzard.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityTornado.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityArrowRain.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityShadowWraith.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityForcefield.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityThunderbolt.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityStormElemental.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityEarthquake.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityHailstorm.class, RenderBlank::new);
RenderingRegistry.registerEntityRenderingHandler(EntityBlizzard.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityTornado.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityArrowRain.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityShadowWraith.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityForcefield.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityThunderbolt.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityStormElemental.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityEarthquake.class, new RenderBlank());
RenderingRegistry.registerEntityRenderingHandler(EntityHailstorm.class, new RenderBlank());
// Runes on ground
RenderingRegistry.registerEntityRenderingHandler(EntityHealAura.class, manager -> new RenderSigil(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/healing_aura.png"), 5.0f, false));
RenderingRegistry.registerEntityRenderingHandler(EntityFireSigil.class, manager -> new RenderSigil(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/fire_sigil.png"), 2.0f, true));
RenderingRegistry.registerEntityRenderingHandler(EntityFrostSigil.class, manager -> new RenderSigil(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/frost_sigil.png"), 2.0f, true));
RenderingRegistry.registerEntityRenderingHandler(EntityLightningSigil.class, manager -> new RenderSigil(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/lightning_sigil.png"), 2.0f, true));
RenderingRegistry.registerEntityRenderingHandler(EntityFireRing.class, manager -> new RenderFireRing(manager, new ResourceLocation(Wizardry.MODID, "textures/entity/ring_of_fire.png"), 5.0f));
RenderingRegistry.registerEntityRenderingHandler(EntityDecay.class, RenderDecay::new);
RenderingRegistry.registerEntityRenderingHandler(EntityLightningPulse.class, manager -> new RenderLightningPulse(manager, 8.0f));
RenderingRegistry.registerEntityRenderingHandler(EntityHealAura.class, new RenderSigil(new ResourceLocation("wizardry:textures/entity/healing_aura.png"), 5.0f, false));
RenderingRegistry.registerEntityRenderingHandler(EntityFireSigil.class, new RenderSigil(new ResourceLocation("wizardry:textures/entity/fire_sigil.png"), 2.0f, true));
RenderingRegistry.registerEntityRenderingHandler(EntityFrostSigil.class, new RenderSigil(new ResourceLocation("wizardry:textures/entity/frost_sigil.png"), 2.0f, true));
RenderingRegistry.registerEntityRenderingHandler(EntityLightningSigil.class, new RenderSigil(new ResourceLocation("wizardry:textures/entity/lightning_sigil.png"), 2.0f, true));
RenderingRegistry.registerEntityRenderingHandler(EntityFireRing.class, new RenderFireRing(new ResourceLocation("wizardry:textures/entity/ring_of_fire.png"), 5.0f));
RenderingRegistry.registerEntityRenderingHandler(EntityDecay.class, new RenderDecay());
RenderingRegistry.registerEntityRenderingHandler(EntityLightningPulse.class, new RenderLightningPulse(8.0f));
//RenderingRegistry.registerBlockHandler(new RenderSigilBlock());
// TESRs
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArcaneWorkbench.class, new RenderArcaneWorkbench());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStatue.class, renderStatue = new RenderStatue());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityStatue.class, new RenderStatue());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMagicLight.class, new RenderMagicLight());
// Items
MinecraftForgeClient.registerItemRenderer(Wizardry.spectralSword, new RenderTranslucentItem());
MinecraftForgeClient.registerItemRenderer(Wizardry.spectralPickaxe, new RenderTranslucentItem());
MinecraftForgeClient.registerItemRenderer(Wizardry.spectralBow, new RenderTranslucentItem());
MinecraftForgeClient.registerItemRenderer(Wizardry.spectralHelmet, new RenderTranslucentItem());
MinecraftForgeClient.registerItemRenderer(Wizardry.spectralChestplate, new RenderTranslucentItem());
MinecraftForgeClient.registerItemRenderer(Wizardry.spectralLeggings, new RenderTranslucentItem());
MinecraftForgeClient.registerItemRenderer(Wizardry.spectralBoots, new RenderTranslucentItem());
}
}
@@ -1,20 +1,17 @@
package electroblob.wizardry.client;
import java.util.HashMap;
import java.util.Map;
import cpw.mods.fml.client.config.GuiButtonExt;
import cpw.mods.fml.client.config.GuiEditArray;
import cpw.mods.fml.client.config.GuiEditArrayEntries;
import cpw.mods.fml.client.config.GuiSelectString;
import cpw.mods.fml.client.config.GuiUtils;
import cpw.mods.fml.client.config.GuiEditArrayEntries.StringEntry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.EntityList;
import net.minecraftforge.fml.client.config.GuiButtonExt;
import net.minecraftforge.fml.client.config.GuiEditArray;
import net.minecraftforge.fml.client.config.GuiEditArrayEntries;
import net.minecraftforge.fml.client.config.GuiEditArrayEntries.StringEntry;
import net.minecraftforge.fml.client.config.GuiSelectString;
import net.minecraftforge.fml.client.config.IConfigElement;
import cpw.mods.fml.client.config.IConfigElement;
/** [NYI] Intended as a way of choosing entities by name from all those currently registered, within the config file, so
* that users don't have to look up the entity IDs. I can't get this to work correctly at the moment. */
public class EntityNameEntry extends StringEntry {
protected final GuiButtonExt btnValue;
@@ -26,9 +23,9 @@ public class EntityNameEntry extends StringEntry {
this.btnValue = new GuiButtonExt(0, 0, 0, owningEntryList.controlWidth, 18, I18n.format(this.textFieldValue.getText()));
//this.btnValue.enabled = owningScreen.enabled;
}
@Override
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY, boolean isSelected)
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, Tessellator tessellator, int mouseX, int mouseY, boolean isSelected)
{
//super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected);
this.btnValue.xPosition = listWidth / 4;
@@ -41,18 +38,19 @@ public class EntityNameEntry extends StringEntry {
this.btnValue.displayString = this.textFieldValue.getText();
//btnValue.packedFGColour = value ? GuiUtils.getColorCode('2', true) : GuiUtils.getColorCode('4', true);
this.btnValue.drawButton(owningEntryList.getMC(), mouseX, mouseY);
this.btnValue.drawButton(owningEntryList.mc, mouseX, mouseY);
}
/**
* Returns true if the mouse has been pressed on this control.
*/
@Override
public boolean mousePressed(int index, int x, int y, int mouseEvent, int relativeX, int relativeY)
{
if (this.btnValue.mousePressed(owningEntryList.getMC(), x, y))
if (this.btnValue.mousePressed(owningEntryList.mc, x, y))
{
btnValue.playPressSound(owningEntryList.getMC().getSoundHandler());
// Some sort of type incompatiblity meant that I had to do this first.
Map<Object, String> map = new HashMap<Object, String>(EntityList.CLASS_TO_NAME);
Minecraft.getMinecraft().displayGuiScreen(new GuiSelectString(this.owningScreen, configElement, index, map, this.getValue(), true));
btnValue.func_146113_a(owningEntryList.mc.getSoundHandler());
Minecraft.getMinecraft().displayGuiScreen(new GuiSelectString(this.owningScreen, configElement, index, EntityList.classToStringMapping, this.getValue(), true));
owningEntryList.recalculateState();
return true;
}
@@ -60,6 +58,9 @@ public class EntityNameEntry extends StringEntry {
return super.mousePressed(index, x, y, mouseEvent, relativeX, relativeY);
}
/**
* Fired when the mouse button is released. Arguments: index, x, y, mouseEvent, relativeX, relativeY
*/
@Override
public void mouseReleased(int index, int x, int y, int mouseEvent, int relativeX, int relativeY)
{
@@ -1,31 +1,44 @@
package electroblob.wizardry.client;
import org.lwjgl.input.Keyboard;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import electroblob.wizardry.ExtendedPlayer;
import electroblob.wizardry.SpellGlyphData;
import electroblob.wizardry.WizardData;
import electroblob.wizardry.WandHelper;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Element;
import electroblob.wizardry.WizardryGuiHandler;
import electroblob.wizardry.item.ItemWand;
import electroblob.wizardry.packet.PacketControlInput;
import electroblob.wizardry.packet.WizardryPacketHandler;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.tileentity.ContainerArcaneWorkbench;
import electroblob.wizardry.tileentity.SlotWizardry;
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
import electroblob.wizardry.util.WandHelper;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraft.util.StatCollector;
public class GuiArcaneWorkbench extends GuiContainer {
@@ -66,12 +79,69 @@ public class GuiArcaneWorkbench extends GuiContainer {
super.drawScreen(p_73863_1_, p_73863_2_, p_73863_3_);
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY){
this.fontRendererObj.drawString(this.arcaneWorkbenchInventory.hasCustomInventoryName() ? this.arcaneWorkbenchInventory.getInventoryName() : I18n.format(this.arcaneWorkbenchInventory.getInventoryName()), 8, 6, 4210752);
this.fontRendererObj.drawString(this.playerInventory.hasCustomInventoryName() ? this.playerInventory.getInventoryName() : I18n.format(this.playerInventory.getInventoryName()), 8, this.ySize - 96 + 2, 4210752);
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack();
this.fontRendererObj.drawStringWithShadow("\u00A7f" + wand.getDisplayName(), xSize + 6, 6, 0);
this.fontRendererObj.drawStringWithShadow("\u00A77" + StatCollector.translateToLocal("container.arcaneWorkbench.mana") + " " + (wand.getMaxDamage() - wand.getItemDamage()) + "/" + wand.getMaxDamage(), xSize + 6, 20, 0);
Spell[] spells = WandHelper.getSpells(wand);
int y = 34;
for(Spell spell : spells){
boolean discovered = true;
if(!this.mc.thePlayer.capabilities.isCreativeMode && ExtendedPlayer.get(this.mc.thePlayer) != null){
discovered = ExtendedPlayer.get(this.mc.thePlayer).hasSpellBeenDiscovered(spell);
}
if(discovered){
this.fontRendererObj.drawStringWithShadow(spell.getDisplayNameWithFormatting(), xSize + 16, y, 0);
}else{
this.mc.standardGalacticFontRenderer.drawStringWithShadow("\u00A79" + SpellGlyphData.getGlyphName(spell, this.mc.theWorld), xSize + 16, y, 0);
}
y += 10;
}
if(WandHelper.getTotalUpgrades(wand) > 0){
this.fontRendererObj.drawStringWithShadow("\u00A7f" + StatCollector.translateToLocal("container.arcaneWorkbench.upgrades"), xSize + 6, y + 6, 0);
int x = 0;
y = guiTop + 50 + spells.length*10;
// Wand upgrade tooltips
for(Item item : WandHelper.getSpecialUpgrades()){
int level = WandHelper.getUpgradeLevel(wand, item);
if(level > 0){
// No idea why this is -16 instead of +6, but it works!
if(isPointInRegion(xSize -16 + x, y, 16, 16, mouseX + guiLeft, mouseY + guiTop)){
ItemStack stack = new ItemStack(item, level);
this.drawItemStackTooltip(stack, mouseX - guiLeft, mouseY - guiTop);
}
x += 18;
}
}
}
}
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
GlStateManager.pushAttrib();
GlStateManager.color(1F, 1F, 1F, 1F);
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
// Main inventory
@@ -82,7 +152,7 @@ public class GuiArcaneWorkbench extends GuiContainer {
Slot slot = this.inventorySlots.getSlot(i);
if(slot.xDisplayPosition >=0 && slot.yDisplayPosition >= 0)
this.drawTexturedModalRect(guiLeft + slot.xDisplayPosition - 10, guiTop + slot.yDisplayPosition - 10,
0, 220, 36, 36);
64, 220, 36, 36);
}
// Tooltip only drawn if there is a wand
@@ -103,15 +173,12 @@ public class GuiArcaneWorkbench extends GuiContainer {
boolean discovered = true;
if(!this.mc.thePlayer.capabilities.isCreativeMode && WizardData.get(this.mc.thePlayer) != null){
discovered = WizardData.get(this.mc.thePlayer).hasSpellBeenDiscovered(spell);
if(!this.mc.thePlayer.capabilities.isCreativeMode && ExtendedPlayer.get(this.mc.thePlayer) != null){
discovered = ExtendedPlayer.get(this.mc.thePlayer).hasSpellBeenDiscovered(spell);
}
// As of Wizardry 1.2, the icons have been split off into their own texture files to allow for add-on
// mods to add their own.
Minecraft.getMinecraft().renderEngine.bindTexture(discovered ? spell.element.getIcon() : Element.MAGIC.getIcon());
// Renders the little element icon
WizardryUtilities.drawTexturedRect(guiLeft + xSize + 5, guiTop + 34 + 10*i++, 8, 8);
// Renders the little element icon if there is an element
this.drawTexturedModalRect(guiLeft + xSize + 5, guiTop + 34 + 10*i++, discovered ? spell.element.ordinal()*8 : 0, 220, 8, 8);
}
int x = 0;
@@ -124,84 +191,39 @@ public class GuiArcaneWorkbench extends GuiContainer {
if(level > 0){
ItemStack stack = new ItemStack(item, level);
GlStateManager.enableDepth();
this.itemRender.renderItemAndEffectIntoGUI(stack, guiLeft + xSize + 6 + x, y);
this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, stack, guiLeft + xSize + 6 + x, y, null);
this.itemRender.renderItemAndEffectIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, guiLeft + xSize + 6 + x, y);
this.itemRender.renderItemOverlayIntoGUI(this.fontRendererObj, this.mc.getTextureManager(), stack, guiLeft + xSize + 6 + x, y);
x += 18;
GlStateManager.disableDepth();
}
}
}
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
// Fixes the bug that caused the slot hightlight to render opaque. I don't know why it works, it just works!
GlStateManager.disableBlend();
GlStateManager.enableAlpha();
GlStateManager.popAttrib();
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY){
for(Object object : this.inventorySlots.inventorySlots){
if(object instanceof Slot){
this.fontRendererObj.drawString(this.arcaneWorkbenchInventory.hasCustomName() ? this.arcaneWorkbenchInventory.getName() : I18n.format(this.arcaneWorkbenchInventory.getName()), 8, 6, 4210752);
this.fontRendererObj.drawString(this.playerInventory.hasCustomName() ? this.playerInventory.getName() : I18n.format(this.playerInventory.getName()), 8, this.ySize - 96 + 2, 4210752);
Slot slot = (Slot)object;
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack();
this.fontRendererObj.drawStringWithShadow("\u00A7f" + wand.getDisplayName(), xSize + 6, 6, 0);
this.fontRendererObj.drawStringWithShadow("\u00A77" + I18n.format("container.wizardry:arcane_workbench.mana") + " " + (wand.getMaxDamage() - wand.getItemDamage()) + "/" + wand.getMaxDamage(), xSize + 6, 20, 0);
Spell[] spells = WandHelper.getSpells(wand);
int y = 34;
for(Spell spell : spells){
boolean discovered = true;
if(!this.mc.thePlayer.capabilities.isCreativeMode && WizardData.get(this.mc.thePlayer) != null){
discovered = WizardData.get(this.mc.thePlayer).hasSpellBeenDiscovered(spell);
}
if(discovered){
this.fontRendererObj.drawStringWithShadow(spell.getDisplayNameWithFormatting(), xSize + 16, y, 0);
}else{
this.mc.standardGalacticFontRenderer.drawStringWithShadow("\u00A79" + SpellGlyphData.getGlyphName(spell, this.mc.theWorld), xSize + 16, y, 0);
}
y += 10;
}
if(WandHelper.getTotalUpgrades(wand) > 0){
this.fontRendererObj.drawStringWithShadow("\u00A7f" + I18n.format("container.wizardry:arcane_workbench.upgrades"), xSize + 6, y + 6, 0);
int x = 0;
y = 50 + spells.length*10;
// Wand upgrade tooltips
for(Item item : WandHelper.getSpecialUpgrades()){
int level = WandHelper.getUpgradeLevel(wand, item);
if(level > 0){
// The javadoc for isPointInRegion is ambiguous; what it means is that the REGION is
// relative to the GUI but the POINT isn't.
if(isPointInRegion(xSize + 6 + x, y, 16, 16, mouseX, mouseY)){
ItemStack stack = new ItemStack(item, level);
this.renderToolTip(stack, mouseX - guiLeft, mouseY - guiTop);
}
x += 18;
}
// Tests whether I have added a background texture and if so actually renders it
if(!slot.getHasStack() && slot instanceof SlotWizardry && ((SlotWizardry)slot).backgroundIndex > -1){
// Taken directly from GuiContainer#func_146977_a, with a few changes.
this.zLevel = 100.0F;
itemRender.zLevel = 100.0F;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
this.drawTexturedModalRect(guiLeft + slot.xDisplayPosition, guiTop + slot.yDisplayPosition, ((SlotWizardry)slot).backgroundIndex*16, 240, 16, 16);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
itemRender.zLevel = 0.0F;
this.zLevel = 0.0F;
}
}
}
}
@Override
public void initGui(){
public void initGui()
{
this.mc.thePlayer.openContainer = this.inventorySlots;
this.guiLeft = (this.width - this.xSize) / 2;
this.guiTop = (this.height - this.ySize) / 2;
@@ -210,21 +232,133 @@ public class GuiArcaneWorkbench extends GuiContainer {
this.buttonList.add(this.applyBtn = new GuiButtonApply(0, this.width/2 + 48, this.height/2 + 3));
}
@Override
public void onGuiClosed(){
public void onGuiClosed()
{
super.onGuiClosed();
Keyboard.enableRepeatEvents(false);
}
@Override
protected void actionPerformed(GuiButton button){
if(button.enabled){
if(button.id == 0){
/**
* Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
*/
protected void actionPerformed(GuiButton par1GuiButton)
{
if (par1GuiButton.enabled)
{
if (par1GuiButton.id == 0)
{
// Packet building
IMessage msg = new PacketControlInput.Message(PacketControlInput.ControlType.APPLY_BUTTON);
IMessage msg = new PacketControlInput.Message(0);
WizardryPacketHandler.net.sendToServer(msg);
}
}
}
protected boolean isPointInRegion(int par1, int par2, int par3, int par4, int par5, int par6)
{
int k1 = this.width/2 - xSize/2;
int l1 = this.height/2 - this.ySize/2;
par5 -= k1;
par6 -= l1;
return par5 >= par1 - 1 && par5 < par1 + par3 + 1 && par6 >= par2 - 1 && par6 < par2 + par4 + 1;
}
protected void drawItemStackTooltip(ItemStack par1ItemStack, int par2, int par3)
{
List list = par1ItemStack.getTooltip(this.mc.thePlayer, this.mc.gameSettings.advancedItemTooltips);
for (int k = 0; k < list.size(); ++k)
{
if (k == 0)
{
list.set(k, par1ItemStack.getRarity().rarityColor + (String)list.get(k));
}
else
{
list.set(k, EnumChatFormatting.GRAY + (String)list.get(k));
}
}
FontRenderer font = par1ItemStack.getItem().getFontRenderer(par1ItemStack);
drawHoveringText(list, par2, par3, (font == null ? fontRendererObj : font));
}
protected void drawHoveringText(List par1List, int par2, int par3, FontRenderer font)
{
if (!par1List.isEmpty())
{
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
int k = 0;
Iterator iterator = par1List.iterator();
while (iterator.hasNext())
{
String s = (String)iterator.next();
int l = font.getStringWidth(s);
if (l > k)
{
k = l;
}
}
int i1 = par2 + 12;
int j1 = par3 - 12;
int k1 = 8;
if (par1List.size() > 1)
{
k1 += 2 + (par1List.size() - 1) * 10;
}
if (i1 + k > this.width)
{
i1 -= 28 + k;
}
if (j1 + k1 + 6 > this.height)
{
j1 = this.height - k1 - 6;
}
this.zLevel = 300.0F;
itemRender.zLevel = 300.0F;
int l1 = -267386864;
this.drawGradientRect(i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1);
this.drawGradientRect(i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1);
this.drawGradientRect(i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1);
int i2 = 1347420415;
int j2 = (i2 & 16711422) >> 1 | i2 & -16777216;
this.drawGradientRect(i1 - 3, j1 - 3 + 1, i1 - 3 + 1, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 + k + 2, j1 - 3 + 1, i1 + k + 3, j1 + k1 + 3 - 1, i2, j2);
this.drawGradientRect(i1 - 3, j1 - 3, i1 + k + 3, j1 - 3 + 1, i2, i2);
this.drawGradientRect(i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2);
for(int k2 = 0; k2 < par1List.size(); ++k2){
String s1 = (String)par1List.get(k2);
font.drawStringWithShadow(s1, i1, j1, -1);
if(k2 == 0){
j1 += 2;
}
j1 += 10;
}
this.zLevel = 0.0F;
itemRender.zLevel = 0.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
RenderHelper.enableStandardItemLighting();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
}
}
}
}
@@ -1,32 +1,39 @@
package electroblob.wizardry.client;
import electroblob.wizardry.util.WizardryUtilities;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.resources.I18n;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
class GuiButtonApply extends GuiButton {
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/gui/handbook.png");
public GuiButtonApply(int id, int x, int y){
super(id, x, y, 32, 16, I18n.format("container.wizardry:arcane_workbench.apply"));
super(id, x, y, 32, 16, StatCollector.translateToLocal("container.arcaneWorkbench.apply"));
}
@Override
public void drawButton(Minecraft minecraft, int mouseX, int mouseY){
/**
* Draws this button to the screen.
*/
public void drawButton(Minecraft minecraft, int par2, int par3){
// Whether the button is highlighted
this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
int k = 36;
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
int k = 100;
int l = 220;
int colour = 14737632;
if(this.enabled){
if(this.hovered){
if(this.field_146123_n){
k += this.width*2;
colour = 16777120;
}
@@ -35,7 +42,32 @@ class GuiButtonApply extends GuiButton {
colour = 10526880;
}
WizardryUtilities.drawTexturedRect(this.xPosition, this.yPosition, k, l, this.width, this.height, 256, 256);
this.drawCenteredString(minecraft.fontRendererObj, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, colour);
this.drawTexturedRect(this.xPosition, this.yPosition, k, l, this.width, this.height, 256, 256);
this.drawCenteredString(minecraft.fontRenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, colour);
}
}
/**
* Draws a textured rectangle, taking the size of the image and the bit needed into account.
* @param x The x position of the rectangle
* @param y The y position of the rectangle
* @param u The x position of the top left corner of the section of the image wanted
* @param v The y position of the top left corner of the section of the image wanted
* @param width The width of the section
* @param height The height of the section
* @param textureWidth The width of the actual image.
* @param textureHeight The height of the actual image.
*/
public void drawTexturedRect(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight)
{
float f = 1F / (float)textureWidth;
float f1 = 1F / (float)textureHeight;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(x), (double)(y + height), 0, (double)((float)(u) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y + height), 0, (double)((float)(u + width) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y), 0, (double)((float)(u + width) * f), (double)((float)(v) * f1));
tessellator.addVertexWithUV((double)(x), (double)(y), 0, (double)((float)(u) * f), (double)((float)(v) * f1));
tessellator.draw();
}
}
@@ -1,9 +1,13 @@
package electroblob.wizardry.client;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
class GuiButtonInvisible extends GuiButton {
@@ -17,7 +21,7 @@ class GuiButtonInvisible extends GuiButton {
* Draws this button to the screen.
*/
public void drawButton(Minecraft par1Minecraft, int par2, int par3){
this.hovered = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
this.field_146123_n = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
}
}
@@ -0,0 +1,78 @@
package electroblob.wizardry.client;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
class GuiButtonNextPage extends GuiButton
{
/**
* True for pointing right (next page), false for pointing left (previous page).
*/
private final boolean nextPage;
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/gui/handbook.png");
public GuiButtonNextPage(int id, int x, int y, boolean par4)
{
super(id, x, y, 23, 13, "");
this.nextPage = par4;
}
/**
* Draws this button to the screen.
*/
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
{
if (this.visible)
{
boolean flag = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
par1Minecraft.getTextureManager().bindTexture(texture);
int k = 0;
int l = 192;
if (flag)
{
k += 23;
}
if (!this.nextPage)
{
l += 13;
}
this.drawTexturedRect(this.xPosition, this.yPosition, k, l, 23, 13, 288, 256);
}
}
/**
* Draws a textured rectangle, taking the size of the image and the bit needed into account.
* @param x The x position of the rectangle
* @param y The y position of the rectangle
* @param u The x position of the top left corner of the section of the image wanted
* @param v The y position of the top left corner of the section of the image wanted
* @param width The width of the section
* @param height The height of the section
* @param textureWidth The width of the actual image.
* @param textureHeight The height of the actual image.
*/
public void drawTexturedRect(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight)
{
float f = 1F / (float)textureWidth;
float f1 = 1F / (float)textureHeight;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(x), (double)(y + height), 0, (double)((float)(u) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y + height), 0, (double)((float)(u + width) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y), 0, (double)((float)(u + width) * f), (double)((float)(v) * f1));
tessellator.addVertexWithUV((double)(x), (double)(y), 0, (double)((float)(u) * f), (double)((float)(v) * f1));
tessellator.draw();
}
}
@@ -1,52 +0,0 @@
package electroblob.wizardry.client;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
class GuiButtonTurnPage extends GuiButton {
/** True for pointing right (next page), false for pointing left (previous page). */
private final boolean nextPage;
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook.png");
public GuiButtonTurnPage(int id, int x, int y, boolean isNextPage)
{
super(id, x, y, 23, 13, "");
this.nextPage = isNextPage;
}
/**
* Draws this button to the screen.
*/
public void drawButton(Minecraft par1Minecraft, int par2, int par3)
{
if (this.visible)
{
boolean flag = par2 >= this.xPosition && par3 >= this.yPosition && par2 < this.xPosition + this.width && par3 < this.yPosition + this.height;
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
par1Minecraft.getTextureManager().bindTexture(texture);
int k = 0;
int l = 192;
if (flag)
{
k += 23;
}
if (!this.nextPage)
{
l += 13;
}
WizardryUtilities.drawTexturedRect(this.xPosition, this.yPosition, k, l, 23, 13, 288, 256);
}
}
}
@@ -3,30 +3,30 @@ package electroblob.wizardry.client;
import java.util.ArrayList;
import java.util.List;
import electroblob.wizardry.Settings;
import cpw.mods.fml.client.config.DummyConfigElement.DummyCategoryElement;
import cpw.mods.fml.client.config.GuiConfig;
import cpw.mods.fml.client.config.GuiConfigEntries;
import cpw.mods.fml.client.config.GuiConfigEntries.CategoryEntry;
import cpw.mods.fml.client.config.IConfigElement;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.config.DummyConfigElement.DummyCategoryElement;
import net.minecraftforge.fml.client.config.GuiConfig;
import net.minecraftforge.fml.client.config.GuiConfigEntries;
import net.minecraftforge.fml.client.config.GuiConfigEntries.CategoryEntry;
import net.minecraftforge.fml.client.config.IConfigElement;
public class GuiConfigWizardry extends GuiConfig {
public GuiConfigWizardry(GuiScreen parent){
super(parent, getConfigEntries(), Wizardry.MODID, false, false, Wizardry.NAME + " - " + I18n.format("config.wizardry.title.general"));
super(parent, getConfigEntries(), Wizardry.MODID, false, false, Wizardry.NAME + " - " + StatCollector.translateToLocal("config.title.general"));
//this.titleLine2 = "File location: " + Wizardry.config.getConfigFile().getAbsolutePath();
}
private static List<IConfigElement> getConfigEntries(){
List<IConfigElement> configList = new ArrayList<IConfigElement>(1);
configList.add(new DummyCategoryElement("spellsConfig", "config.wizardry.category." + Settings.SPELLS_CATEGORY, SpellsCategory.class));
configList.add(new DummyCategoryElement("resistancesConfig", "config.wizardry.category." + Settings.RESISTANCES_CATEGORY, ResistancesCategory.class));
configList.addAll(new ConfigElement(Wizardry.settings.getConfigCategory(Configuration.CATEGORY_GENERAL)).getChildElements());
configList.add(new DummyCategoryElement("spellsConfig", "config.category.spells", SpellsCategory.class));
configList.add(new DummyCategoryElement("resistancesConfig", "config.category.resistances", ResistancesCategory.class));
configList.add(new DummyCategoryElement("idsConfig", "config.category.ids", IDsCategory.class));
configList.addAll(new ConfigElement(Wizardry.config.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements());
return configList;
}
@@ -44,11 +44,11 @@ public class GuiConfigWizardry extends GuiConfig {
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed.
// The parent GuiConfig object's entryList will also be refreshed to reflect the changes.
GuiConfig spellsMenu = new GuiConfig(this.owningScreen,
(new ConfigElement(Wizardry.settings.getConfigCategory(Settings.SPELLS_CATEGORY))).getChildElements(),
this.owningScreen.modID, Settings.SPELLS_CATEGORY, false, false,
Wizardry.NAME + " - " + I18n.format("config.wizardry.title." + Settings.SPELLS_CATEGORY));
(new ConfigElement(Wizardry.config.getCategory(Wizardry.SPELLS_CATEGORY))).getChildElements(),
this.owningScreen.modID, Wizardry.SPELLS_CATEGORY, false, false,
Wizardry.NAME + " - " + StatCollector.translateToLocal("config.title.spells"));
spellsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.SPELLS_CATEGORY);
spellsMenu.titleLine2 = StatCollector.translateToLocal("config.subtitle.spells");
return spellsMenu;
}
@@ -68,11 +68,35 @@ public class GuiConfigWizardry extends GuiConfig {
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed.
// The parent GuiConfig object's entryList will also be refreshed to reflect the changes.
GuiConfig idsMenu = new GuiConfig(this.owningScreen,
(new ConfigElement(Wizardry.settings.getConfigCategory(Settings.RESISTANCES_CATEGORY))).getChildElements(),
this.owningScreen.modID, Settings.RESISTANCES_CATEGORY, false, false,
Wizardry.NAME + " - " + I18n.format("config.wizardry.title." + Settings.RESISTANCES_CATEGORY));
(new ConfigElement(Wizardry.config.getCategory(Wizardry.RESISTANCES_CATEGORY))).getChildElements(),
this.owningScreen.modID, Wizardry.RESISTANCES_CATEGORY, false, false,
Wizardry.NAME + " - " + StatCollector.translateToLocal("config.title.resistances"));
idsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.RESISTANCES_CATEGORY);
idsMenu.titleLine2 = StatCollector.translateToLocal("config.subtitle.resistances");
return idsMenu;
}
}
/** IDs category of the config gui. */
public static class IDsCategory extends CategoryEntry
{
public IDsCategory(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement prop)
{
super(owningScreen, owningEntryList, prop);
}
@Override
protected GuiScreen buildChildScreen()
{
// This GuiConfig object specifies the configID of the object and as such will force-save when it is closed.
// The parent GuiConfig object's entryList will also be refreshed to reflect the changes.
GuiConfig idsMenu = new GuiConfig(this.owningScreen,
(new ConfigElement(Wizardry.config.getCategory(Wizardry.IDS_CATEGORY))).getChildElements(),
this.owningScreen.modID, Wizardry.IDS_CATEGORY, false, false,
Wizardry.NAME + " - " + StatCollector.translateToLocal("config.title.ids"));
idsMenu.titleLine2 = StatCollector.translateToLocal("config.subtitle.ids");
return idsMenu;
}
@@ -1,12 +1,13 @@
package electroblob.wizardry.client;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.WizardryGuiHandler;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ContainerWorkbench;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/** Crafting table GUI that doesn't require a crafting table container object. */
@@ -14,9 +15,9 @@ public class GuiPortableCrafting extends GuiContainer {
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation("textures/gui/container/crafting_table.png");
public GuiPortableCrafting(InventoryPlayer p_i1084_1_, World p_i1084_2_, BlockPos pos)
public GuiPortableCrafting(InventoryPlayer p_i1084_1_, World p_i1084_2_, int p_i1084_3_, int p_i1084_4_, int p_i1084_5_)
{
super(new ContainerWorkbench(p_i1084_1_, p_i1084_2_, pos));
super(new ContainerWorkbench(p_i1084_1_, p_i1084_2_, p_i1084_3_, p_i1084_4_, p_i1084_5_));
}
/**
@@ -30,7 +31,7 @@ public class GuiPortableCrafting extends GuiContainer {
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
int k = (this.width - this.xSize) / 2;
int l = (this.height - this.ySize) / 2;
@@ -2,16 +2,18 @@ package electroblob.wizardry.client;
import org.lwjgl.input.Keyboard;
import electroblob.wizardry.EnumTier;
import electroblob.wizardry.ExtendedPlayer;
import electroblob.wizardry.SpellGlyphData;
import electroblob.wizardry.WizardData;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Tier;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.WizardryGuiHandler;
import electroblob.wizardry.WizardryRegistry;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
public class GuiSpellBook extends GuiScreen {
@@ -39,17 +41,17 @@ public class GuiSpellBook extends GuiScreen {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
boolean discovered = true;
if(Wizardry.settings.discoveryMode && !player.capabilities.isCreativeMode && WizardData.get(player) != null
&& !WizardData.get(player).hasSpellBeenDiscovered(spell)){
if(Wizardry.discoveryMode && !player.capabilities.isCreativeMode && ExtendedPlayer.get(player) != null
&& !ExtendedPlayer.get(player).hasSpellBeenDiscovered(spell)){
discovered = false;
}
// Draws spell illustration on opposite page, underneath the book so it shows through the hole.
Minecraft.getMinecraft().renderEngine.bindTexture(discovered ? spell.getIcon() : Spells.none.getIcon());
WizardryUtilities.drawTexturedRect(xPos + 145, yPos + 20, 0, 0, 128, 128, 128, 128);
Minecraft.getMinecraft().renderEngine.bindTexture(discovered ? spell.icon : WizardryRegistry.none.icon);
this.drawTexturedRect(xPos + 145, yPos + 20, 0, 0, 128, 128, 128, 128);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
WizardryUtilities.drawTexturedRect(xPos, yPos, 0, 0, xSize, ySize, xSize, 256);
this.drawTexturedRect(xPos, yPos, 0, 0, xSize, ySize, xSize, 256);
super.drawScreen(par1, par2, par3);
@@ -63,14 +65,14 @@ public class GuiSpellBook extends GuiScreen {
this.fontRendererObj.drawString("-------------------", xPos+17, yPos+34, 0);
if(spell.tier == Tier.BASIC){
if(spell.tier == EnumTier.BASIC){
// Basic is usually white but this doesn't show up.
this.fontRendererObj.drawString("Tier: \u00A77" + Tier.BASIC.getDisplayName(), xPos+17, yPos+44, 0);
this.fontRendererObj.drawString("Tier: \u00A77" + EnumTier.BASIC.getDisplayName(), xPos+17, yPos+44, 0);
}else{
this.fontRendererObj.drawString("Tier: " + spell.tier.getDisplayNameWithFormatting(), xPos+17, yPos+44, 0);
}
String element = "Element: " + spell.element.getFormattingCode() + spell.element.getDisplayName();
String element = "Element: " + spell.element.colour + spell.element.getDisplayName();
if(!discovered) element = "Element: ?";
this.fontRendererObj.drawString(element, xPos+17, yPos+56, 0);
@@ -123,5 +125,29 @@ public class GuiSpellBook extends GuiScreen {
super.onGuiClosed();
Keyboard.enableRepeatEvents(false);
}
/**
* Draws a textured rectangle, taking the size of the image and the bit needed into account. Client side only, of course.
* @param x The x position of the rectangle
* @param y The y position of the rectangle
* @param u The x position of the top left corner of the section of the image wanted
* @param v The y position of the top left corner of the section of the image wanted
* @param width The width of the section
* @param height The height of the section
* @param textureWidth The width of the actual image.
* @param textureHeight The height of the actual image.
*/
public static void drawTexturedRect(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight)
{
float f = 1F / (float)textureWidth;
float f1 = 1F / (float)textureHeight;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(x), (double)(y + height), 0, (double)((float)(u) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y + height), 0, (double)((float)(u + width) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y), 0, (double)((float)(u + width) * f), (double)((float)(v) * f1));
tessellator.addVertexWithUV((double)(x), (double)(y), 0, (double)((float)(u) * f), (double)((float)(v) * f1));
tessellator.draw();
}
}
@@ -2,29 +2,26 @@ package electroblob.wizardry.client;
import java.util.List;
import electroblob.wizardry.Settings.GuiPosition;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import electroblob.wizardry.ExtendedPlayer;
import electroblob.wizardry.SpellGlyphData;
import electroblob.wizardry.WizardData;
import electroblob.wizardry.WandHelper;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.constants.Constants;
import electroblob.wizardry.WizardryRegistry;
import electroblob.wizardry.item.ItemWand;
import electroblob.wizardry.registry.Spells;
import electroblob.wizardry.registry.WizardryItems;
import electroblob.wizardry.registry.WizardryPotions;
import electroblob.wizardry.spell.None;
import electroblob.wizardry.spell.Spell;
import electroblob.wizardry.util.WandHelper;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class GuiSpellDisplay extends Gui {
@@ -42,114 +39,131 @@ public class GuiSpellDisplay extends Gui {
EntityPlayer player = this.mc.thePlayer;
// If the player has a wand in each hand, only displays for the one in the main hand.
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemWand){
ItemStack wand = player.getHeldItemMainhand();
int width = event.resolution.getScaledWidth();
int height = event.resolution.getScaledHeight();
if(wand == null || !(wand.getItem() instanceof ItemWand)){
wand = player.getHeldItemOffhand();
// If the player isn't holding a wand, then nothing else needs to be done.
if(wand == null || !(wand.getItem() instanceof ItemWand)) return;
}
Spell spell = WandHelper.getCurrentSpell(player.getHeldItem());
int cooldown = WandHelper.getCurrentCooldown(player.getHeldItem());
int width = event.getResolution().getScaledWidth();
int height = event.getResolution().getScaledHeight();
float cooldownMultiplier = 1.0f - WandHelper.getUpgradeLevel(player.getHeldItem(), Wizardry.cooldownUpgrade)*Wizardry.COOLDOWN_REDUCTION_PER_LEVEL;
Spell spell = WandHelper.getCurrentSpell(wand);
int cooldown = WandHelper.getCurrentCooldown(wand);
if(player.isPotionActive(Wizardry.fontOfMana)){
// Dividing by this rather than setting it takes upgrades and font of mana into account simultaneously
cooldownMultiplier /= 2 + player.getActivePotionEffect(Wizardry.fontOfMana).getAmplifier();
}
float cooldownMultiplier = 1.0f - WandHelper.getUpgradeLevel(wand, WizardryItems.cooldown_upgrade)*Constants.COOLDOWN_REDUCTION_PER_LEVEL;
// Coordinates of the top left corner of the HUD.
int left = 0;
int top = 0;
boolean mirror = false;
if(player.isPotionActive(WizardryPotions.font_of_mana)){
// Dividing by this rather than setting it takes upgrades and font of mana into account simultaneously
cooldownMultiplier /= 2 + player.getActivePotionEffect(WizardryPotions.font_of_mana).getAmplifier();
}
if(Wizardry.spellHUDPosition.equals("Bottom left")){
left = 0;
top = height-36;
}else if(Wizardry.spellHUDPosition.equals("Top left")){
left = 0;
top = 0;
}else if(Wizardry.spellHUDPosition.equals("Top right")){
left = width-128;
top = 0;
mirror = true;
}else if(Wizardry.spellHUDPosition.equals("Bottom right")){
left = width-128;
top = height-36;
mirror = true;
}
// Coordinates of the top left corner of the HUD.
int left = 0;
int top = 0;
boolean mirror = false;
boolean discovered = true;
if(Wizardry.settings.spellHUDPosition == GuiPosition.BOTTOM_LEFT){
left = 0;
top = height-36;
}else if(Wizardry.settings.spellHUDPosition == GuiPosition.TOP_LEFT){
left = 0;
top = 0;
}else if(Wizardry.settings.spellHUDPosition == GuiPosition.TOP_RIGHT){
left = width-128;
top = 0;
mirror = true;
}else if(Wizardry.settings.spellHUDPosition == GuiPosition.BOTTOM_RIGHT){
left = width-128;
top = height-36;
mirror = true;
}
if(!player.capabilities.isCreativeMode && ExtendedPlayer.get(player) != null){
discovered = ExtendedPlayer.get(player).hasSpellBeenDiscovered(spell);
}
boolean discovered = true;
if(event.type == RenderGameOverlayEvent.ElementType.TEXT){
if(!player.capabilities.isCreativeMode && WizardData.get(player) != null){
discovered = WizardData.get(player).hasSpellBeenDiscovered(spell);
}
// Makes spells greyed out if they are in cooldown or if the player has the arcane jammer effect
String colour = cooldown > 0 || player.isPotionActive(Wizardry.arcaneJammer) ? "\u00A78" : spell.element.colour;
if(!discovered) colour = "\u00A79";
String spellName = discovered ? spell.getDisplayName() : SpellGlyphData.getGlyphName(spell, player.worldObj);
FontRenderer font = discovered ? this.mc.fontRenderer : this.mc.standardGalacticFontRenderer;
if(event.getType() == RenderGameOverlayEvent.ElementType.TEXT){
int maxWidth = 90;
// Makes spells greyed out if they are in cooldown or if the player has the arcane jammer effect
String colour = cooldown > 0 || player.isPotionActive(WizardryPotions.arcane_jammer) ? "\u00A78" : spell.element.getFormattingCode();
if(!discovered) colour = "\u00A79";
String spellName = discovered ? spell.getDisplayName() : SpellGlyphData.getGlyphName(spell, player.worldObj);
FontRenderer font = discovered ? this.mc.fontRendererObj : this.mc.standardGalacticFontRenderer;
if(font.getStringWidth(spellName) <= maxWidth){
// Single line is rendered more centrally
font.drawStringWithShadow(colour + spellName, mirror ? left+5 : left+41, top+13, 0xffffffff);
int maxWidth = 90;
}else{
if(font.getStringWidth(spellName) <= maxWidth){
// Single line is rendered more centrally
font.drawStringWithShadow(colour + spellName, mirror ? left+5 : left+41, top+13, 0xffffffff);
int lineNumber = 0;
}else{
List lines = font.listFormattedStringToWidth(spellName, maxWidth);
int lineNumber = 0;
List<String> lines = font.listFormattedStringToWidth(spellName, maxWidth);
for(Object line : lines){
if(line instanceof String){
font.drawStringWithShadow(colour + (String)line, mirror ? left+5 : left+41, top+6 + 11*lineNumber, 0xffffffff);
for(Object line : lines){
if(line instanceof String){
font.drawStringWithShadow(colour + (String)line, mirror ? left+5 : left+41, top+6 + 11*lineNumber, 0xffffffff);
}
lineNumber++;
}
lineNumber++;
}
}else if(event.type == RenderGameOverlayEvent.ElementType.HOTBAR){
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor3f(1.0f, 1.0f, 1.0f);
this.mc.renderEngine.bindTexture(hudTexture);
// Background of spell hud
this.drawTexturedModalRect(left, top, 0, mirror ? 36 : 0, 128, 36);
// Cooldown bar
if(cooldown > 0){
this.drawTexturedModalRect(mirror ? left+5 : left+41, height-8, 128, 6, 82, 6);
int l = (int)(((double)(spell.cooldown * cooldownMultiplier - cooldown)
/ (double)(spell.cooldown * cooldownMultiplier)) * 82);
this.drawTexturedModalRect(mirror ? left+5 : left+41, height-8, 128, 0, l, 6);
}
// Spell illustration
this.mc.renderEngine.bindTexture(discovered ? spell.icon : WizardryRegistry.none.icon);
this.drawTexturedRect(mirror ? left+94 : left+2, top+2, 0, 0, 32, 32, 32, 32);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}else if(event.getType() == RenderGameOverlayEvent.ElementType.HOTBAR){
GlStateManager.pushAttrib();
GlStateManager.enableBlend();
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
GlStateManager.color(1, 1, 1);
this.mc.renderEngine.bindTexture(hudTexture);
// Background of spell hud
this.drawTexturedModalRect(left, top, 0, mirror ? 36 : 0, 128, 36);
// Cooldown bar
if(cooldown > 0){
this.drawTexturedModalRect(mirror ? left+5 : left+41, height-8, 128, 6, 82, 6);
int l = (int)(((double)(spell.cooldown * cooldownMultiplier - cooldown)
/ (double)(spell.cooldown * cooldownMultiplier)) * 82);
this.drawTexturedModalRect(mirror ? left+5 : left+41, height-8, 128, 0, l, 6);
}
// Spell illustration
this.mc.renderEngine.bindTexture(discovered ? spell.getIcon() : Spells.none.getIcon());
WizardryUtilities.drawTexturedRect(mirror ? left+94 : left+2, top+2, 0, 0, 32, 32, 32, 32);
GlStateManager.popAttrib();
}
}
/**
* Draws a textured rectangle, taking the size of the image and the bit needed into account. Client side only, of course.
* @param x The x position of the rectangle
* @param y The y position of the rectangle
* @param u The x position of the top left corner of the section of the image wanted
* @param v The y position of the top left corner of the section of the image wanted
* @param width The width of the section
* @param height The height of the section
* @param textureWidth The width of the actual image.
* @param textureHeight The height of the actual image.
*/
public static void drawTexturedRect(int x, int y, int u, int v, int width, int height, int textureWidth, int textureHeight)
{
float f = 1F / (float)textureWidth;
float f1 = 1F / (float)textureHeight;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(x), (double)(y + height), 0, (double)((float)(u) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y + height), 0, (double)((float)(u + width) * f), (double)((float)(v + height) * f1));
tessellator.addVertexWithUV((double)(x + width), (double)(y), 0, (double)((float)(u + width) * f), (double)((float)(v) * f1));
tessellator.addVertexWithUV((double)(x), (double)(y), 0, (double)((float)(u) * f), (double)((float)(v) * f1));
tessellator.draw();
}
}
File diff suppressed because it is too large Load Diff
@@ -1,12 +1,15 @@
package electroblob.wizardry.client;
import java.util.ArrayList;
import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/** Font renderer that renders parts of strings surrounded by '#' (without quotes) in the SGA instead of normal text.
* @since Wizardry 1.1 */
@@ -19,7 +22,7 @@ public class MixedFontRenderer extends FontRenderer {
}
@Override
public int drawString(String string, float x, float y, int colour, boolean shadow){
public int drawString(String string, int x, int y, int colour, boolean shadow){
int l = 0;
@@ -33,8 +36,8 @@ public class MixedFontRenderer extends FontRenderer {
l += Minecraft.getMinecraft().standardGalacticFontRenderer.drawString(section, x, y, colour, shadow);
x += Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(section);
}else{
l += Minecraft.getMinecraft().fontRendererObj.drawString(section, x, y, colour, shadow);
x += Minecraft.getMinecraft().fontRendererObj.getStringWidth(section);
l += Minecraft.getMinecraft().fontRenderer.drawString(section, x, y, colour, shadow);
x += Minecraft.getMinecraft().fontRenderer.getStringWidth(section);
}
string = string.substring(string.indexOf('#') + 1);
@@ -44,7 +47,7 @@ public class MixedFontRenderer extends FontRenderer {
if(sga){
l += Minecraft.getMinecraft().standardGalacticFontRenderer.drawString(string, x, y, colour, shadow);
}else{
l += Minecraft.getMinecraft().fontRendererObj.drawString(string, x, y, colour, shadow);
l += Minecraft.getMinecraft().fontRenderer.drawString(string, x, y, colour, shadow);
}
return l;
@@ -64,7 +67,7 @@ public class MixedFontRenderer extends FontRenderer {
if(sga){
l += Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(section);
}else{
l += Minecraft.getMinecraft().fontRendererObj.getStringWidth(section);
l += Minecraft.getMinecraft().fontRenderer.getStringWidth(section);
}
string = string.substring(string.indexOf('#') + 1);
@@ -74,7 +77,7 @@ public class MixedFontRenderer extends FontRenderer {
if(sga){
l += Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(string);
}else{
l += Minecraft.getMinecraft().fontRendererObj.getStringWidth(string);
l += Minecraft.getMinecraft().fontRenderer.getStringWidth(string);
}
return l;
@@ -87,7 +90,7 @@ public class MixedFontRenderer extends FontRenderer {
if(string.contains("#")){
Minecraft.getMinecraft().standardGalacticFontRenderer.drawSplitString(string.substring(1), x, y, width, colour);
}else{
Minecraft.getMinecraft().fontRendererObj.drawSplitString(string, x, y, width, colour);
Minecraft.getMinecraft().fontRenderer.drawSplitString(string, x, y, width, colour);
}
}
@@ -1,35 +1,31 @@
package electroblob.wizardry.client;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.audio.MovingSound;
import net.minecraft.entity.Entity;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
// Copied from MovingSoundMinecart; if it ever breaks between updates take a look at that.
@SideOnly(Side.CLIENT)
public class MovingSoundEntity extends MovingSound
{
private final Entity source;
private float distance = 0.0F;
private float pitch = 0.0F;
public MovingSoundEntity(Entity entity, SoundEvent sound, float volume, float pitch, boolean repeat)
public MovingSoundEntity(Entity entity, String soundName, float volume, float pitch, boolean repeat)
{
// Uses BLOCKS because that's the closest thing to inanimate entities. Could use NEUTRAL like MovingSoundMinecart.
super(sound, SoundCategory.BLOCKS);
super(new ResourceLocation(soundName));
this.source = entity;
this.repeat = repeat;
this.volume = volume;
this.pitch = pitch;
this.repeatDelay = 0;
this.field_147663_c = pitch;
this.field_147665_h = 0;
}
/**
* Updates the JList with a new model.
*/
@Override
public void update()
{
if (this.source.isDead && repeat)
@@ -46,7 +42,7 @@ public class MovingSoundEntity extends MovingSound
// Is this something to do with the Doppler effect?
if ((double)f >= 0.01D)
{
this.distance = MathHelper.clamp_float(this.distance + 0.0025F, 0.0F, 1.0F);
this.pitch = MathHelper.clamp_float(this.pitch + 0.0025F, 0.0F, 1.0F);
this.volume = 0.0F + MathHelper.clamp_float(f, 0.0F, 0.5F) * 0.7F;
}
else
File diff suppressed because it is too large Load Diff
@@ -3,14 +3,14 @@ package electroblob.wizardry.client.model;
import javax.vecmath.Matrix4f;
import javax.vecmath.Vector3f;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntityIceGiant;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.util.MathHelper;
@SideOnly(Side.CLIENT)
public class ModelIceGiant extends ModelBase
@@ -3,7 +3,7 @@ package electroblob.wizardry.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.MathHelper;
public class ModelPhoenix extends ModelBase {
@@ -109,7 +109,7 @@ public class ModelPhoenix extends ModelBase {
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
//float f6 = (180F / (float)Math.PI);
float f6 = (180F / (float)Math.PI);
this.neck.rotateAngleX = f4 / (180F / (float)Math.PI);
this.neck.rotateAngleY = f3 / (180F / (float)Math.PI);
this.neck.rotateAngleZ = 0.0F;
@@ -0,0 +1,58 @@
package electroblob.wizardry.client.model;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntitySkeletonMinion;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySkeleton;
@SideOnly(Side.CLIENT)
public class ModelSkeletonMinion extends ModelZombie
{
public ModelSkeletonMinion()
{
this(0.0F);
}
public ModelSkeletonMinion(float par1)
{
super(par1, 0.0F, 64, 32);
this.bipedRightArm = new ModelRenderer(this, 40, 16);
this.bipedRightArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, par1);
this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
this.bipedLeftArm = new ModelRenderer(this, 40, 16);
this.bipedLeftArm.mirror = true;
this.bipedLeftArm.addBox(-1.0F, -2.0F, -1.0F, 2, 12, 2, par1);
this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
this.bipedRightLeg = new ModelRenderer(this, 0, 16);
this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, par1);
this.bipedRightLeg.setRotationPoint(-2.0F, 12.0F, 0.0F);
this.bipedLeftLeg = new ModelRenderer(this, 0, 16);
this.bipedLeftLeg.mirror = true;
this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 12, 2, par1);
this.bipedLeftLeg.setRotationPoint(2.0F, 12.0F, 0.0F);
}
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
this.aimedBow = ((EntitySkeletonMinion)par1EntityLivingBase).getSkeletonType() == 1;
super.setLivingAnimations(par1EntityLivingBase, par2, par3, par4);
}
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
}
}
@@ -0,0 +1,559 @@
package electroblob.wizardry.client.model;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntitySpiritHorse;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
@SideOnly(Side.CLIENT)
public class ModelSpiritHorse extends ModelBase
{
private ModelRenderer head;
private ModelRenderer mouthTop;
private ModelRenderer mouthBottom;
private ModelRenderer horseLeftEar;
private ModelRenderer horseRightEar;
private ModelRenderer field_110703_f;
private ModelRenderer field_110704_g;
private ModelRenderer neck;
private ModelRenderer field_110717_i;
private ModelRenderer mane;
private ModelRenderer body;
private ModelRenderer tailBase;
private ModelRenderer tailMiddle;
private ModelRenderer tailTip;
private ModelRenderer backLeftLeg;
private ModelRenderer backLeftShin;
private ModelRenderer backLeftHoof;
private ModelRenderer backRightLeg;
private ModelRenderer backRightShin;
private ModelRenderer backRightHoof;
private ModelRenderer frontRightLeg;
private ModelRenderer frontLeftShin;
private ModelRenderer frontLeftHoof;
private ModelRenderer field_110684_D;
private ModelRenderer frontRightShin;
private ModelRenderer frontRightHoof;
private ModelRenderer field_110687_G;
private ModelRenderer field_110695_H;
private ModelRenderer field_110696_I;
private ModelRenderer field_110697_J;
private ModelRenderer field_110698_K;
private ModelRenderer field_110691_L;
private ModelRenderer field_110692_M;
private ModelRenderer field_110693_N;
private ModelRenderer field_110694_O;
private ModelRenderer field_110700_P;
private ModelRenderer field_110699_Q;
private ModelRenderer field_110702_R;
private ModelRenderer field_110701_S;
public ModelSpiritHorse()
{
this.textureWidth = 128;
this.textureHeight = 128;
this.body = new ModelRenderer(this, 0, 34);
this.body.addBox(-5.0F, -8.0F, -19.0F, 10, 10, 24);
this.body.setRotationPoint(0.0F, 11.0F, 9.0F);
this.tailBase = new ModelRenderer(this, 44, 0);
this.tailBase.addBox(-1.0F, -1.0F, 0.0F, 2, 2, 3);
this.tailBase.setRotationPoint(0.0F, 3.0F, 14.0F);
this.func_110682_a(this.tailBase, -1.134464F, 0.0F, 0.0F);
this.tailMiddle = new ModelRenderer(this, 38, 7);
this.tailMiddle.addBox(-1.5F, -2.0F, 3.0F, 3, 4, 7);
this.tailMiddle.setRotationPoint(0.0F, 3.0F, 14.0F);
this.func_110682_a(this.tailMiddle, -1.134464F, 0.0F, 0.0F);
this.tailTip = new ModelRenderer(this, 24, 3);
this.tailTip.addBox(-1.5F, -4.5F, 9.0F, 3, 4, 7);
this.tailTip.setRotationPoint(0.0F, 3.0F, 14.0F);
this.func_110682_a(this.tailTip, -1.40215F, 0.0F, 0.0F);
this.backLeftLeg = new ModelRenderer(this, 78, 29);
this.backLeftLeg.addBox(-2.5F, -2.0F, -2.5F, 4, 9, 5);
this.backLeftLeg.setRotationPoint(4.0F, 9.0F, 11.0F);
this.backLeftShin = new ModelRenderer(this, 78, 43);
this.backLeftShin.addBox(-2.0F, 0.0F, -1.5F, 3, 5, 3);
this.backLeftShin.setRotationPoint(4.0F, 16.0F, 11.0F);
this.backLeftHoof = new ModelRenderer(this, 78, 51);
this.backLeftHoof.addBox(-2.5F, 5.1F, -2.0F, 4, 3, 4);
this.backLeftHoof.setRotationPoint(4.0F, 16.0F, 11.0F);
this.backRightLeg = new ModelRenderer(this, 96, 29);
this.backRightLeg.addBox(-1.5F, -2.0F, -2.5F, 4, 9, 5);
this.backRightLeg.setRotationPoint(-4.0F, 9.0F, 11.0F);
this.backRightShin = new ModelRenderer(this, 96, 43);
this.backRightShin.addBox(-1.0F, 0.0F, -1.5F, 3, 5, 3);
this.backRightShin.setRotationPoint(-4.0F, 16.0F, 11.0F);
this.backRightHoof = new ModelRenderer(this, 96, 51);
this.backRightHoof.addBox(-1.5F, 5.1F, -2.0F, 4, 3, 4);
this.backRightHoof.setRotationPoint(-4.0F, 16.0F, 11.0F);
this.frontRightLeg = new ModelRenderer(this, 44, 29);
this.frontRightLeg.addBox(-1.9F, -1.0F, -2.1F, 3, 8, 4);
this.frontRightLeg.setRotationPoint(4.0F, 9.0F, -8.0F);
this.frontLeftShin = new ModelRenderer(this, 44, 41);
this.frontLeftShin.addBox(-1.9F, 0.0F, -1.6F, 3, 5, 3);
this.frontLeftShin.setRotationPoint(4.0F, 16.0F, -8.0F);
this.frontLeftHoof = new ModelRenderer(this, 44, 51);
this.frontLeftHoof.addBox(-2.4F, 5.1F, -2.1F, 4, 3, 4);
this.frontLeftHoof.setRotationPoint(4.0F, 16.0F, -8.0F);
this.field_110684_D = new ModelRenderer(this, 60, 29);
this.field_110684_D.addBox(-1.1F, -1.0F, -2.1F, 3, 8, 4);
this.field_110684_D.setRotationPoint(-4.0F, 9.0F, -8.0F);
this.frontRightShin = new ModelRenderer(this, 60, 41);
this.frontRightShin.addBox(-1.1F, 0.0F, -1.6F, 3, 5, 3);
this.frontRightShin.setRotationPoint(-4.0F, 16.0F, -8.0F);
this.frontRightHoof = new ModelRenderer(this, 60, 51);
this.frontRightHoof.addBox(-1.6F, 5.1F, -2.1F, 4, 3, 4);
this.frontRightHoof.setRotationPoint(-4.0F, 16.0F, -8.0F);
this.head = new ModelRenderer(this, 0, 0);
this.head.addBox(-2.5F, -10.0F, -1.5F, 5, 5, 7);
this.head.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.head, 0.5235988F, 0.0F, 0.0F);
this.mouthTop = new ModelRenderer(this, 24, 18);
this.mouthTop.addBox(-2.0F, -10.0F, -7.0F, 4, 3, 6);
this.mouthTop.setRotationPoint(0.0F, 3.95F, -10.0F);
this.func_110682_a(this.mouthTop, 0.5235988F, 0.0F, 0.0F);
this.mouthBottom = new ModelRenderer(this, 24, 27);
this.mouthBottom.addBox(-2.0F, -7.0F, -6.5F, 4, 2, 5);
this.mouthBottom.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.mouthBottom, 0.5235988F, 0.0F, 0.0F);
this.head.addChild(this.mouthTop);
this.head.addChild(this.mouthBottom);
this.horseLeftEar = new ModelRenderer(this, 0, 0);
this.horseLeftEar.addBox(0.45F, -12.0F, 4.0F, 2, 3, 1);
this.horseLeftEar.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.horseLeftEar, 0.5235988F, 0.0F, 0.0F);
this.horseRightEar = new ModelRenderer(this, 0, 0);
this.horseRightEar.addBox(-2.45F, -12.0F, 4.0F, 2, 3, 1);
this.horseRightEar.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.horseRightEar, 0.5235988F, 0.0F, 0.0F);
this.field_110703_f = new ModelRenderer(this, 0, 12);
this.field_110703_f.addBox(-2.0F, -16.0F, 4.0F, 2, 7, 1);
this.field_110703_f.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.field_110703_f, 0.5235988F, 0.0F, 0.2617994F);
this.field_110704_g = new ModelRenderer(this, 0, 12);
this.field_110704_g.addBox(0.0F, -16.0F, 4.0F, 2, 7, 1);
this.field_110704_g.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.field_110704_g, 0.5235988F, 0.0F, -0.2617994F);
this.neck = new ModelRenderer(this, 0, 12);
this.neck.addBox(-2.05F, -9.8F, -2.0F, 4, 14, 8);
this.neck.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.neck, 0.5235988F, 0.0F, 0.0F);
this.field_110687_G = new ModelRenderer(this, 0, 34);
this.field_110687_G.addBox(-3.0F, 0.0F, 0.0F, 8, 8, 3);
this.field_110687_G.setRotationPoint(-7.5F, 3.0F, 10.0F);
this.func_110682_a(this.field_110687_G, 0.0F, ((float)Math.PI / 2F), 0.0F);
this.field_110695_H = new ModelRenderer(this, 0, 47);
this.field_110695_H.addBox(-3.0F, 0.0F, 0.0F, 8, 8, 3);
this.field_110695_H.setRotationPoint(4.5F, 3.0F, 10.0F);
this.func_110682_a(this.field_110695_H, 0.0F, ((float)Math.PI / 2F), 0.0F);
this.field_110696_I = new ModelRenderer(this, 80, 0);
this.field_110696_I.addBox(-5.0F, 0.0F, -3.0F, 10, 1, 8);
this.field_110696_I.setRotationPoint(0.0F, 2.0F, 2.0F);
this.field_110697_J = new ModelRenderer(this, 106, 9);
this.field_110697_J.addBox(-1.5F, -1.0F, -3.0F, 3, 1, 2);
this.field_110697_J.setRotationPoint(0.0F, 2.0F, 2.0F);
this.field_110698_K = new ModelRenderer(this, 80, 9);
this.field_110698_K.addBox(-4.0F, -1.0F, 3.0F, 8, 1, 2);
this.field_110698_K.setRotationPoint(0.0F, 2.0F, 2.0F);
this.field_110692_M = new ModelRenderer(this, 74, 0);
this.field_110692_M.addBox(-0.5F, 6.0F, -1.0F, 1, 2, 2);
this.field_110692_M.setRotationPoint(5.0F, 3.0F, 2.0F);
this.field_110691_L = new ModelRenderer(this, 70, 0);
this.field_110691_L.addBox(-0.5F, 0.0F, -0.5F, 1, 6, 1);
this.field_110691_L.setRotationPoint(5.0F, 3.0F, 2.0F);
this.field_110694_O = new ModelRenderer(this, 74, 4);
this.field_110694_O.addBox(-0.5F, 6.0F, -1.0F, 1, 2, 2);
this.field_110694_O.setRotationPoint(-5.0F, 3.0F, 2.0F);
this.field_110693_N = new ModelRenderer(this, 80, 0);
this.field_110693_N.addBox(-0.5F, 0.0F, -0.5F, 1, 6, 1);
this.field_110693_N.setRotationPoint(-5.0F, 3.0F, 2.0F);
this.field_110700_P = new ModelRenderer(this, 74, 13);
this.field_110700_P.addBox(1.5F, -8.0F, -4.0F, 1, 2, 2);
this.field_110700_P.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.field_110700_P, 0.5235988F, 0.0F, 0.0F);
this.field_110699_Q = new ModelRenderer(this, 74, 13);
this.field_110699_Q.addBox(-2.5F, -8.0F, -4.0F, 1, 2, 2);
this.field_110699_Q.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.field_110699_Q, 0.5235988F, 0.0F, 0.0F);
this.field_110702_R = new ModelRenderer(this, 44, 10);
this.field_110702_R.addBox(2.6F, -6.0F, -6.0F, 0, 3, 16);
this.field_110702_R.setRotationPoint(0.0F, 4.0F, -10.0F);
this.field_110701_S = new ModelRenderer(this, 44, 5);
this.field_110701_S.addBox(-2.6F, -6.0F, -6.0F, 0, 3, 16);
this.field_110701_S.setRotationPoint(0.0F, 4.0F, -10.0F);
this.mane = new ModelRenderer(this, 58, 0);
this.mane.addBox(-1.0F, -11.5F, 5.0F, 2, 16, 4);
this.mane.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.mane, 0.5235988F, 0.0F, 0.0F);
this.field_110717_i = new ModelRenderer(this, 80, 12);
this.field_110717_i.addBox(-2.5F, -10.1F, -7.0F, 5, 5, 12, 0.2F);
this.field_110717_i.setRotationPoint(0.0F, 4.0F, -10.0F);
this.func_110682_a(this.field_110717_i, 0.5235988F, 0.0F, 0.0F);
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
EntitySpiritHorse entityhorse = (EntitySpiritHorse)par1Entity;
int i = entityhorse.getHorseType();
float f6 = entityhorse.getGrassEatingAmount(0.0F);
boolean flag = entityhorse.isAdultHorse();
boolean flag1 = flag && entityhorse.isHorseSaddled();
boolean flag2 = flag && entityhorse.isChested();
boolean flag3 = i == 1 || i == 2;
float f7 = entityhorse.getHorseSize();
boolean flag4 = entityhorse.riddenByEntity != null;
if (flag1)
{
this.field_110717_i.render(par7);
this.field_110696_I.render(par7);
this.field_110697_J.render(par7);
this.field_110698_K.render(par7);
this.field_110691_L.render(par7);
this.field_110692_M.render(par7);
this.field_110693_N.render(par7);
this.field_110694_O.render(par7);
this.field_110700_P.render(par7);
this.field_110699_Q.render(par7);
if (flag4)
{
this.field_110702_R.render(par7);
this.field_110701_S.render(par7);
}
}
if (!flag)
{
GL11.glPushMatrix();
GL11.glScalef(f7, 0.5F + f7 * 0.5F, f7);
GL11.glTranslatef(0.0F, 0.95F * (1.0F - f7), 0.0F);
}
this.backLeftLeg.render(par7);
this.backLeftShin.render(par7);
this.backLeftHoof.render(par7);
this.backRightLeg.render(par7);
this.backRightShin.render(par7);
this.backRightHoof.render(par7);
this.frontRightLeg.render(par7);
this.frontLeftShin.render(par7);
this.frontLeftHoof.render(par7);
this.field_110684_D.render(par7);
this.frontRightShin.render(par7);
this.frontRightHoof.render(par7);
if (!flag)
{
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f7, f7, f7);
GL11.glTranslatef(0.0F, 1.35F * (1.0F - f7), 0.0F);
}
this.body.render(par7);
this.tailBase.render(par7);
this.tailMiddle.render(par7);
this.tailTip.render(par7);
this.neck.render(par7);
this.mane.render(par7);
if (!flag)
{
GL11.glPopMatrix();
GL11.glPushMatrix();
float f8 = 0.5F + f7 * f7 * 0.5F;
GL11.glScalef(f8, f8, f8);
if (f6 <= 0.0F)
{
GL11.glTranslatef(0.0F, 1.35F * (1.0F - f7), 0.0F);
}
else
{
GL11.glTranslatef(0.0F, 0.9F * (1.0F - f7) * f6 + 1.35F * (1.0F - f7) * (1.0F - f6), 0.15F * (1.0F - f7) * f6);
}
}
if (flag3)
{
this.field_110703_f.render(par7);
this.field_110704_g.render(par7);
}
else
{
this.horseLeftEar.render(par7);
this.horseRightEar.render(par7);
}
this.head.render(par7);
if (!flag)
{
GL11.glPopMatrix();
}
if (flag2)
{
this.field_110687_G.render(par7);
this.field_110695_H.render(par7);
}
}
private void func_110682_a(ModelRenderer par1ModelRenderer, float par2, float par3, float par4)
{
par1ModelRenderer.rotateAngleX = par2;
par1ModelRenderer.rotateAngleY = par3;
par1ModelRenderer.rotateAngleZ = par4;
}
private float func_110683_a(float par1, float par2, float par3)
{
float f3;
for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F)
{
;
}
while (f3 >= 180.0F)
{
f3 -= 360.0F;
}
return par1 + par3 * f3;
}
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
super.setLivingAnimations(par1EntityLivingBase, par2, par3, par4);
float f3 = this.func_110683_a(par1EntityLivingBase.prevRenderYawOffset, par1EntityLivingBase.renderYawOffset, par4);
float f4 = this.func_110683_a(par1EntityLivingBase.prevRotationYawHead, par1EntityLivingBase.rotationYawHead, par4);
float f5 = par1EntityLivingBase.prevRotationPitch + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch) * par4;
float f6 = f4 - f3;
float f7 = f5 / (180F / (float)Math.PI);
if (f6 > 20.0F)
{
f6 = 20.0F;
}
if (f6 < -20.0F)
{
f6 = -20.0F;
}
if (par3 > 0.2F)
{
f7 += MathHelper.cos(par2 * 0.4F) * 0.15F * par3;
}
EntitySpiritHorse entityhorse = (EntitySpiritHorse)par1EntityLivingBase;
float f8 = entityhorse.getGrassEatingAmount(par4);
float f9 = entityhorse.getRearingAmount(par4);
float f10 = 1.0F - f9;
float f11 = entityhorse.func_110201_q(par4);
boolean flag = entityhorse.field_110278_bp != 0;
boolean flag1 = entityhorse.isHorseSaddled();
boolean flag2 = entityhorse.riddenByEntity != null;
float f12 = (float)par1EntityLivingBase.ticksExisted + par4;
float f13 = MathHelper.cos(par2 * 0.6662F + (float)Math.PI);
float f14 = f13 * 0.8F * par3;
this.head.rotationPointY = 4.0F;
this.head.rotationPointZ = -10.0F;
this.tailBase.rotationPointY = 3.0F;
this.tailMiddle.rotationPointZ = 14.0F;
this.field_110695_H.rotationPointY = 3.0F;
this.field_110695_H.rotationPointZ = 10.0F;
this.body.rotateAngleX = 0.0F;
this.head.rotateAngleX = 0.5235988F + f7;
this.head.rotateAngleY = f6 / (180F / (float)Math.PI);
this.head.rotateAngleX = f9 * (0.2617994F + f7) + f8 * 2.18166F + (1.0F - Math.max(f9, f8)) * this.head.rotateAngleX;
this.head.rotateAngleY = f9 * (f6 / (180F / (float)Math.PI)) + (1.0F - Math.max(f9, f8)) * this.head.rotateAngleY;
this.head.rotationPointY = f9 * -6.0F + f8 * 11.0F + (1.0F - Math.max(f9, f8)) * this.head.rotationPointY;
this.head.rotationPointZ = f9 * -1.0F + f8 * -10.0F + (1.0F - Math.max(f9, f8)) * this.head.rotationPointZ;
this.tailBase.rotationPointY = f9 * 9.0F + f10 * this.tailBase.rotationPointY;
this.tailMiddle.rotationPointZ = f9 * 18.0F + f10 * this.tailMiddle.rotationPointZ;
this.field_110695_H.rotationPointY = f9 * 5.5F + f10 * this.field_110695_H.rotationPointY;
this.field_110695_H.rotationPointZ = f9 * 15.0F + f10 * this.field_110695_H.rotationPointZ;
this.body.rotateAngleX = f9 * -((float)Math.PI / 4F) + f10 * this.body.rotateAngleX;
this.horseLeftEar.rotationPointY = this.head.rotationPointY;
this.horseRightEar.rotationPointY = this.head.rotationPointY;
this.field_110703_f.rotationPointY = this.head.rotationPointY;
this.field_110704_g.rotationPointY = this.head.rotationPointY;
this.neck.rotationPointY = this.head.rotationPointY;
this.mouthTop.rotationPointY = 0.02F;
this.mouthBottom.rotationPointY = 0.0F;
this.mane.rotationPointY = this.head.rotationPointY;
this.horseLeftEar.rotationPointZ = this.head.rotationPointZ;
this.horseRightEar.rotationPointZ = this.head.rotationPointZ;
this.field_110703_f.rotationPointZ = this.head.rotationPointZ;
this.field_110704_g.rotationPointZ = this.head.rotationPointZ;
this.neck.rotationPointZ = this.head.rotationPointZ;
this.mouthTop.rotationPointZ = 0.02F - f11 * 1.0F;
this.mouthBottom.rotationPointZ = 0.0F + f11 * 1.0F;
this.mane.rotationPointZ = this.head.rotationPointZ;
this.horseLeftEar.rotateAngleX = this.head.rotateAngleX;
this.horseRightEar.rotateAngleX = this.head.rotateAngleX;
this.field_110703_f.rotateAngleX = this.head.rotateAngleX;
this.field_110704_g.rotateAngleX = this.head.rotateAngleX;
this.neck.rotateAngleX = this.head.rotateAngleX;
this.mouthTop.rotateAngleX = 0.0F - 0.09424778F * f11;
this.mouthBottom.rotateAngleX = 0.0F + 0.15707964F * f11;
this.mane.rotateAngleX = this.head.rotateAngleX;
this.horseLeftEar.rotateAngleY = this.head.rotateAngleY;
this.horseRightEar.rotateAngleY = this.head.rotateAngleY;
this.field_110703_f.rotateAngleY = this.head.rotateAngleY;
this.field_110704_g.rotateAngleY = this.head.rotateAngleY;
this.neck.rotateAngleY = this.head.rotateAngleY;
this.mouthTop.rotateAngleY = 0.0F;
this.mouthBottom.rotateAngleY = 0.0F;
this.mane.rotateAngleY = this.head.rotateAngleY;
this.field_110687_G.rotateAngleX = f14 / 5.0F;
this.field_110695_H.rotateAngleX = -f14 / 5.0F;
float f15 = ((float)Math.PI / 2F);
float f16 = ((float)Math.PI * 3F / 2F);
float f17 = -1.0471976F;
float f18 = 0.2617994F * f9;
float f19 = MathHelper.cos(f12 * 0.6F + (float)Math.PI);
this.frontRightLeg.rotationPointY = -2.0F * f9 + 9.0F * f10;
this.frontRightLeg.rotationPointZ = -2.0F * f9 + -8.0F * f10;
this.field_110684_D.rotationPointY = this.frontRightLeg.rotationPointY;
this.field_110684_D.rotationPointZ = this.frontRightLeg.rotationPointZ;
this.backLeftShin.rotationPointY = this.backLeftLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f18 + f10 * -f13 * 0.5F * par3) * 7.0F;
this.backLeftShin.rotationPointZ = this.backLeftLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f18 + f10 * -f13 * 0.5F * par3) * 7.0F;
this.backRightShin.rotationPointY = this.backRightLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f18 + f10 * f13 * 0.5F * par3) * 7.0F;
this.backRightShin.rotationPointZ = this.backRightLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f18 + f10 * f13 * 0.5F * par3) * 7.0F;
float f20 = (-1.0471976F + f19) * f9 + f14 * f10;
float f21 = (-1.0471976F + -f19) * f9 + -f14 * f10;
this.frontLeftShin.rotationPointY = this.frontRightLeg.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f20) * 7.0F;
this.frontLeftShin.rotationPointZ = this.frontRightLeg.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f20) * 7.0F;
this.frontRightShin.rotationPointY = this.field_110684_D.rotationPointY + MathHelper.sin(((float)Math.PI / 2F) + f21) * 7.0F;
this.frontRightShin.rotationPointZ = this.field_110684_D.rotationPointZ + MathHelper.cos(((float)Math.PI * 3F / 2F) + f21) * 7.0F;
this.backLeftLeg.rotateAngleX = f18 + -f13 * 0.5F * par3 * f10;
this.backLeftShin.rotateAngleX = -0.08726646F * f9 + (-f13 * 0.5F * par3 - Math.max(0.0F, f13 * 0.5F * par3)) * f10;
this.backLeftHoof.rotateAngleX = this.backLeftShin.rotateAngleX;
this.backRightLeg.rotateAngleX = f18 + f13 * 0.5F * par3 * f10;
this.backRightShin.rotateAngleX = -0.08726646F * f9 + (f13 * 0.5F * par3 - Math.max(0.0F, -f13 * 0.5F * par3)) * f10;
this.backRightHoof.rotateAngleX = this.backRightShin.rotateAngleX;
this.frontRightLeg.rotateAngleX = f20;
this.frontLeftShin.rotateAngleX = (this.frontRightLeg.rotateAngleX + (float)Math.PI * Math.max(0.0F, 0.2F + f19 * 0.2F)) * f9 + (f14 + Math.max(0.0F, f13 * 0.5F * par3)) * f10;
this.frontLeftHoof.rotateAngleX = this.frontLeftShin.rotateAngleX;
this.field_110684_D.rotateAngleX = f21;
this.frontRightShin.rotateAngleX = (this.field_110684_D.rotateAngleX + (float)Math.PI * Math.max(0.0F, 0.2F - f19 * 0.2F)) * f9 + (-f14 + Math.max(0.0F, -f13 * 0.5F * par3)) * f10;
this.frontRightHoof.rotateAngleX = this.frontRightShin.rotateAngleX;
this.backLeftHoof.rotationPointY = this.backLeftShin.rotationPointY;
this.backLeftHoof.rotationPointZ = this.backLeftShin.rotationPointZ;
this.backRightHoof.rotationPointY = this.backRightShin.rotationPointY;
this.backRightHoof.rotationPointZ = this.backRightShin.rotationPointZ;
this.frontLeftHoof.rotationPointY = this.frontLeftShin.rotationPointY;
this.frontLeftHoof.rotationPointZ = this.frontLeftShin.rotationPointZ;
this.frontRightHoof.rotationPointY = this.frontRightShin.rotationPointY;
this.frontRightHoof.rotationPointZ = this.frontRightShin.rotationPointZ;
if (flag1)
{
this.field_110696_I.rotationPointY = f9 * 0.5F + f10 * 2.0F;
this.field_110696_I.rotationPointZ = f9 * 11.0F + f10 * 2.0F;
this.field_110697_J.rotationPointY = this.field_110696_I.rotationPointY;
this.field_110698_K.rotationPointY = this.field_110696_I.rotationPointY;
this.field_110691_L.rotationPointY = this.field_110696_I.rotationPointY;
this.field_110693_N.rotationPointY = this.field_110696_I.rotationPointY;
this.field_110692_M.rotationPointY = this.field_110696_I.rotationPointY;
this.field_110694_O.rotationPointY = this.field_110696_I.rotationPointY;
this.field_110687_G.rotationPointY = this.field_110695_H.rotationPointY;
this.field_110697_J.rotationPointZ = this.field_110696_I.rotationPointZ;
this.field_110698_K.rotationPointZ = this.field_110696_I.rotationPointZ;
this.field_110691_L.rotationPointZ = this.field_110696_I.rotationPointZ;
this.field_110693_N.rotationPointZ = this.field_110696_I.rotationPointZ;
this.field_110692_M.rotationPointZ = this.field_110696_I.rotationPointZ;
this.field_110694_O.rotationPointZ = this.field_110696_I.rotationPointZ;
this.field_110687_G.rotationPointZ = this.field_110695_H.rotationPointZ;
this.field_110696_I.rotateAngleX = this.body.rotateAngleX;
this.field_110697_J.rotateAngleX = this.body.rotateAngleX;
this.field_110698_K.rotateAngleX = this.body.rotateAngleX;
this.field_110702_R.rotationPointY = this.head.rotationPointY;
this.field_110701_S.rotationPointY = this.head.rotationPointY;
this.field_110717_i.rotationPointY = this.head.rotationPointY;
this.field_110700_P.rotationPointY = this.head.rotationPointY;
this.field_110699_Q.rotationPointY = this.head.rotationPointY;
this.field_110702_R.rotationPointZ = this.head.rotationPointZ;
this.field_110701_S.rotationPointZ = this.head.rotationPointZ;
this.field_110717_i.rotationPointZ = this.head.rotationPointZ;
this.field_110700_P.rotationPointZ = this.head.rotationPointZ;
this.field_110699_Q.rotationPointZ = this.head.rotationPointZ;
this.field_110702_R.rotateAngleX = f7;
this.field_110701_S.rotateAngleX = f7;
this.field_110717_i.rotateAngleX = this.head.rotateAngleX;
this.field_110700_P.rotateAngleX = this.head.rotateAngleX;
this.field_110699_Q.rotateAngleX = this.head.rotateAngleX;
this.field_110717_i.rotateAngleY = this.head.rotateAngleY;
this.field_110700_P.rotateAngleY = this.head.rotateAngleY;
this.field_110702_R.rotateAngleY = this.head.rotateAngleY;
this.field_110699_Q.rotateAngleY = this.head.rotateAngleY;
this.field_110701_S.rotateAngleY = this.head.rotateAngleY;
if (flag2)
{
this.field_110691_L.rotateAngleX = -1.0471976F;
this.field_110692_M.rotateAngleX = -1.0471976F;
this.field_110693_N.rotateAngleX = -1.0471976F;
this.field_110694_O.rotateAngleX = -1.0471976F;
this.field_110691_L.rotateAngleZ = 0.0F;
this.field_110692_M.rotateAngleZ = 0.0F;
this.field_110693_N.rotateAngleZ = 0.0F;
this.field_110694_O.rotateAngleZ = 0.0F;
}
else
{
this.field_110691_L.rotateAngleX = f14 / 3.0F;
this.field_110692_M.rotateAngleX = f14 / 3.0F;
this.field_110693_N.rotateAngleX = f14 / 3.0F;
this.field_110694_O.rotateAngleX = f14 / 3.0F;
this.field_110691_L.rotateAngleZ = f14 / 5.0F;
this.field_110692_M.rotateAngleZ = f14 / 5.0F;
this.field_110693_N.rotateAngleZ = -f14 / 5.0F;
this.field_110694_O.rotateAngleZ = -f14 / 5.0F;
}
}
f15 = -1.3089F + par3 * 1.5F;
if (f15 > 0.0F)
{
f15 = 0.0F;
}
if (flag)
{
this.tailBase.rotateAngleY = MathHelper.cos(f12 * 0.7F);
f15 = 0.0F;
}
else
{
this.tailBase.rotateAngleY = 0.0F;
}
this.tailMiddle.rotateAngleY = this.tailBase.rotateAngleY;
this.tailTip.rotateAngleY = this.tailBase.rotateAngleY;
this.tailMiddle.rotationPointY = this.tailBase.rotationPointY;
this.tailTip.rotationPointY = this.tailBase.rotationPointY;
this.tailMiddle.rotationPointZ = this.tailBase.rotationPointZ;
this.tailTip.rotationPointZ = this.tailBase.rotationPointZ;
this.tailBase.rotateAngleX = f15;
this.tailMiddle.rotateAngleX = f15;
this.tailTip.rotateAngleX = -0.2618F + f15;
}
}
@@ -0,0 +1,190 @@
package electroblob.wizardry.client.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntitySpiritWolf;
@SideOnly(Side.CLIENT)
public class ModelSpiritWolf extends ModelBase
{
/** main box for the wolf head */
public ModelRenderer wolfHeadMain;
/** The wolf's body */
public ModelRenderer wolfBody;
/** Wolf'se first leg */
public ModelRenderer wolfLeg1;
/** Wolf's second leg */
public ModelRenderer wolfLeg2;
/** Wolf's third leg */
public ModelRenderer wolfLeg3;
/** Wolf's fourth leg */
public ModelRenderer wolfLeg4;
/** The wolf's tail */
ModelRenderer wolfTail;
/** The wolf's mane */
ModelRenderer wolfMane;
public ModelSpiritWolf()
{
float f = 0.0F;
float f1 = 13.5F;
this.wolfHeadMain = new ModelRenderer(this, 0, 0);
this.wolfHeadMain.addBox(-3.0F, -3.0F, -2.0F, 6, 6, 4, f);
this.wolfHeadMain.setRotationPoint(-1.0F, f1, -7.0F);
this.wolfBody = new ModelRenderer(this, 18, 14);
this.wolfBody.addBox(-4.0F, -2.0F, -3.0F, 6, 9, 6, f);
this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F);
this.wolfMane = new ModelRenderer(this, 21, 0);
this.wolfMane.addBox(-4.0F, -3.0F, -3.0F, 8, 6, 7, f);
this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F);
this.wolfLeg1 = new ModelRenderer(this, 0, 18);
this.wolfLeg1.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F);
this.wolfLeg2 = new ModelRenderer(this, 0, 18);
this.wolfLeg2.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F);
this.wolfLeg3 = new ModelRenderer(this, 0, 18);
this.wolfLeg3.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F);
this.wolfLeg4 = new ModelRenderer(this, 0, 18);
this.wolfLeg4.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F);
this.wolfTail = new ModelRenderer(this, 9, 18);
this.wolfTail.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F);
this.wolfHeadMain.setTextureOffset(16, 14).addBox(-3.0F, -5.0F, 0.0F, 2, 2, 1, f);
this.wolfHeadMain.setTextureOffset(16, 14).addBox(1.0F, -5.0F, 0.0F, 2, 2, 1, f);
this.wolfHeadMain.setTextureOffset(0, 10).addBox(-1.5F, 0.0F, -5.0F, 3, 3, 4, f);
}
/**
* Sets the models various rotation angles then renders the model.
*/
public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7)
{
super.render(par1Entity, par2, par3, par4, par5, par6, par7);
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
if (this.isChild)
{
float f6 = 2.0F;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glTranslatef(0.0F, 5.0F * par7, 2.0F * par7);
this.wolfHeadMain.renderWithRotation(par7);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glScalef(1.0F / f6, 1.0F / f6, 1.0F / f6);
GL11.glTranslatef(0.0F, 24.0F * par7, 0.0F);
this.wolfBody.render(par7);
this.wolfLeg1.render(par7);
this.wolfLeg2.render(par7);
this.wolfLeg3.render(par7);
this.wolfLeg4.render(par7);
this.wolfTail.renderWithRotation(par7);
this.wolfMane.render(par7);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
else
{
this.wolfHeadMain.renderWithRotation(par7);
this.wolfBody.render(par7);
this.wolfLeg1.render(par7);
this.wolfLeg2.render(par7);
this.wolfLeg3.render(par7);
this.wolfLeg4.render(par7);
this.wolfTail.renderWithRotation(par7);
this.wolfMane.render(par7);
}
}
/**
* Used for easily adding entity-dependent animations. The second and third float params here are the same second
* and third as in the setRotationAngles method.
*/
public void setLivingAnimations(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
EntitySpiritWolf EntitySpiritWolf = (EntitySpiritWolf)par1EntityLivingBase;
if (EntitySpiritWolf.isAngry())
{
this.wolfTail.rotateAngleY = 0.0F;
}
else
{
this.wolfTail.rotateAngleY = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
}
if (EntitySpiritWolf.isSitting())
{
this.wolfMane.setRotationPoint(-1.0F, 16.0F, -3.0F);
this.wolfMane.rotateAngleX = ((float)Math.PI * 2F / 5F);
this.wolfMane.rotateAngleY = 0.0F;
this.wolfBody.setRotationPoint(0.0F, 18.0F, 0.0F);
this.wolfBody.rotateAngleX = ((float)Math.PI / 4F);
this.wolfTail.setRotationPoint(-1.0F, 21.0F, 6.0F);
this.wolfLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F);
this.wolfLeg1.rotateAngleX = ((float)Math.PI * 3F / 2F);
this.wolfLeg2.setRotationPoint(0.5F, 22.0F, 2.0F);
this.wolfLeg2.rotateAngleX = ((float)Math.PI * 3F / 2F);
this.wolfLeg3.rotateAngleX = 5.811947F;
this.wolfLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F);
this.wolfLeg4.rotateAngleX = 5.811947F;
this.wolfLeg4.setRotationPoint(0.51F, 17.0F, -4.0F);
}
else
{
this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F);
this.wolfBody.rotateAngleX = ((float)Math.PI / 2F);
this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F);
this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX;
this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F);
this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F);
this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F);
this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F);
this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F);
this.wolfLeg1.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
this.wolfLeg2.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
this.wolfLeg3.rotateAngleX = MathHelper.cos(par2 * 0.6662F + (float)Math.PI) * 1.4F * par3;
this.wolfLeg4.rotateAngleX = MathHelper.cos(par2 * 0.6662F) * 1.4F * par3;
}
this.wolfHeadMain.rotateAngleZ = EntitySpiritWolf.getInterestedAngle(par4) + EntitySpiritWolf.getShakeAngle(par4, 0.0F);
this.wolfMane.rotateAngleZ = EntitySpiritWolf.getShakeAngle(par4, -0.08F);
this.wolfBody.rotateAngleZ = EntitySpiritWolf.getShakeAngle(par4, -0.16F);
this.wolfTail.rotateAngleZ = EntitySpiritWolf.getShakeAngle(par4, -0.2F);
}
/**
* Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
* and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
* "far" arms and legs can swing at most.
*/
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)
{
super.setRotationAngles(par1, par2, par3, par4, par5, par6, par7Entity);
this.wolfHeadMain.rotateAngleX = par5 / (180F / (float)Math.PI);
this.wolfHeadMain.rotateAngleY = par4 / (180F / (float)Math.PI);
this.wolfTail.rotateAngleX = par3;
}
}
@@ -2,6 +2,7 @@ package electroblob.wizardry.client.model;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
public class ModelWizard extends ModelBiped
{
@@ -6,106 +6,108 @@ import net.minecraft.entity.Entity;
public class ModelWizardArmour extends ModelBiped
{
ModelRenderer Shape1;
ModelRenderer Shape2;
ModelRenderer Shape3;
ModelRenderer Shape4;
ModelRenderer Shape5;
ModelRenderer Shape6;
ModelRenderer Shape7;
ModelRenderer robe;
public ModelWizardArmour(float scale){
super(scale, 0, 64, 64);
// This is necessary to stop the head from scaling.
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.1f);
this.bipedHead.setRotationPoint(0.0F, 0.0F + 0, 0.0F);
Shape1 = new ModelRenderer(this, -16, 32);
Shape1.addBox(-8F, -7F, -8F, 16, 0, 16);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 0, 48);
Shape2.addBox(0F, 0F, 0F, 6, 2, 6);
Shape2.setRotationPoint(-3F, -10F, -3F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, -0.1396263F, 0F, 0F);
Shape3 = new ModelRenderer(this, 0, 56);
Shape3.addBox(0F, 0F, 0F, 5, 2, 5);
Shape3.setRotationPoint(-2.5F, -11.53333F, -2F);
Shape3.setTextureSize(64, 64);
Shape3.mirror = true;
setRotation(Shape3, -0.2443461F, 0F, 0F);
Shape4 = new ModelRenderer(this, 24, 48);
Shape4.addBox(0F, 0F, 0F, 4, 2, 4);
Shape4.setRotationPoint(-2F, -13F, -1F);
Shape4.setTextureSize(64, 64);
Shape4.mirror = true;
setRotation(Shape4, -0.4014257F, 0F, 0F);
Shape5 = new ModelRenderer(this, 24, 54);
Shape5.addBox(0F, 0F, 0F, 3, 2, 3);
Shape5.setRotationPoint(-1.5F, -14F, 0F);
Shape5.setTextureSize(64, 64);
Shape5.mirror = true;
setRotation(Shape5, -0.5759587F, 0F, 0F);
Shape6 = new ModelRenderer(this, 20, 59);
Shape6.addBox(0F, 0F, 0F, 2, 2, 2);
Shape6.setRotationPoint(-1F, -14F, 0F);
Shape6.setTextureSize(64, 64);
Shape6.mirror = true;
setRotation(Shape6, 0.3316126F, 0F, 0F);
Shape7 = new ModelRenderer(this, 28, 59);
Shape7.addBox(0F, 0F, 0F, 1, 1, 3);
Shape7.setRotationPoint(-0.5F, -14.5F, 2F);
Shape7.setTextureSize(64, 64);
Shape7.mirror = true;
setRotation(Shape7, -0.5585054F, 0F, 0F);
// The robe is now the body
bipedBody = new ModelRenderer(this, 40, 42);
bipedBody.addBox(-4F, 0F, -2F, 8, 18, 4, scale);
bipedBody.setRotationPoint(0F, 0F, 0F);
bipedBody.setTextureSize(64, 64);
bipedBody.mirror = true;
setRotation(bipedBody, 0F, 0F, 0F);
// Makes the hat rotate with the head.
bipedHead.addChild(Shape1);
bipedHead.addChild(Shape2);
bipedHead.addChild(Shape3);
bipedHead.addChild(Shape4);
bipedHead.addChild(Shape5);
bipedHead.addChild(Shape6);
bipedHead.addChild(Shape7);
// Makes the robe move with the body
//bipedBody.addChild(robe);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5){
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
private void setRotation(ModelRenderer model, float x, float y, float z){
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity){
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
ModelRenderer Shape1;
ModelRenderer Shape2;
ModelRenderer Shape3;
ModelRenderer Shape4;
ModelRenderer Shape5;
ModelRenderer Shape6;
ModelRenderer Shape7;
ModelRenderer robe;
public ModelWizardArmour(float scale){
super(scale, 0, 64, 64);
// This is necessary to stop the head from scaling.
this.bipedHead = new ModelRenderer(this, 0, 0);
this.bipedHead.addBox(-4.0F, -8.0F, -4.0F, 8, 8, 8, 0.1f);
this.bipedHead.setRotationPoint(0.0F, 0.0F + 0, 0.0F);
Shape1 = new ModelRenderer(this, -16, 32);
Shape1.addBox(-8F, -7F, -8F, 16, 0, 16);
Shape1.setRotationPoint(0F, 0F, 0F);
Shape1.setTextureSize(64, 64);
Shape1.mirror = true;
setRotation(Shape1, 0F, 0F, 0F);
Shape2 = new ModelRenderer(this, 0, 48);
Shape2.addBox(0F, 0F, 0F, 6, 2, 6);
Shape2.setRotationPoint(-3F, -10F, -3F);
Shape2.setTextureSize(64, 64);
Shape2.mirror = true;
setRotation(Shape2, -0.1396263F, 0F, 0F);
Shape3 = new ModelRenderer(this, 0, 56);
Shape3.addBox(0F, 0F, 0F, 5, 2, 5);
Shape3.setRotationPoint(-2.5F, -11.53333F, -2F);
Shape3.setTextureSize(64, 64);
Shape3.mirror = true;
setRotation(Shape3, -0.2443461F, 0F, 0F);
Shape4 = new ModelRenderer(this, 24, 48);
Shape4.addBox(0F, 0F, 0F, 4, 2, 4);
Shape4.setRotationPoint(-2F, -13F, -1F);
Shape4.setTextureSize(64, 64);
Shape4.mirror = true;
setRotation(Shape4, -0.4014257F, 0F, 0F);
Shape5 = new ModelRenderer(this, 24, 54);
Shape5.addBox(0F, 0F, 0F, 3, 2, 3);
Shape5.setRotationPoint(-1.5F, -14F, 0F);
Shape5.setTextureSize(64, 64);
Shape5.mirror = true;
setRotation(Shape5, -0.5759587F, 0F, 0F);
Shape6 = new ModelRenderer(this, 20, 59);
Shape6.addBox(0F, 0F, 0F, 2, 2, 2);
Shape6.setRotationPoint(-1F, -14F, 0F);
Shape6.setTextureSize(64, 64);
Shape6.mirror = true;
setRotation(Shape6, 0.3316126F, 0F, 0F);
Shape7 = new ModelRenderer(this, 28, 59);
Shape7.addBox(0F, 0F, 0F, 1, 1, 3);
Shape7.setRotationPoint(-0.5F, -14.5F, 2F);
Shape7.setTextureSize(64, 64);
Shape7.mirror = true;
setRotation(Shape7, -0.5585054F, 0F, 0F);
robe = new ModelRenderer(this, 40, 42);
robe.addBox(-4F, 0F, -2F, 8, 18, 4, scale);
robe.setRotationPoint(0F, 0F, 0F);
robe.setTextureSize(64, 64);
robe.mirror = true;
setRotation(robe, 0F, 0F, 0F);
// Makes the hat rotate with the head.
bipedHead.addChild(Shape1);
bipedHead.addChild(Shape2);
bipedHead.addChild(Shape3);
bipedHead.addChild(Shape4);
bipedHead.addChild(Shape5);
bipedHead.addChild(Shape6);
bipedHead.addChild(Shape7);
// Makes the robe move with the body
bipedBody.addChild(robe);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
}
}
@@ -1,192 +0,0 @@
package electroblob.wizardry.client.model;
import java.util.ArrayList;
import java.util.List;
import electroblob.wizardry.registry.WizardryBlocks;
import electroblob.wizardry.registry.WizardryItems;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.oredict.OreDictionary;
/**
* Class responsible for registering all of wizardry's item (and itemblock) models.
* @author Electroblob
* @since Wizardry 2.1
*/
@SideOnly(Side.CLIENT)
@Mod.EventBusSubscriber(Side.CLIENT)
public final class WizardryItemModels {
@SubscribeEvent
public static void register(ModelRegistryEvent event){
// ItemBlocks
registerItemModel(Item.getItemFromBlock(WizardryBlocks.arcane_workbench));
registerItemModel(Item.getItemFromBlock(WizardryBlocks.crystal_ore));
registerItemModel(Item.getItemFromBlock(WizardryBlocks.crystal_flower));
registerItemModel(Item.getItemFromBlock(WizardryBlocks.transportation_stone));
registerItemModel(Item.getItemFromBlock(WizardryBlocks.crystal_block));
// Items
registerItemModel(WizardryItems.magic_crystal);
registerItemModel(WizardryItems.magic_wand);
registerItemModel(WizardryItems.apprentice_wand);
registerItemModel(WizardryItems.advanced_wand);
registerItemModel(WizardryItems.master_wand);
registerItemModel(WizardryItems.spell_book);
// Wildcard registered for wizard trades.
registerItemModel(WizardryItems.spell_book, OreDictionary.WILDCARD_VALUE, "normal");
registerItemModel(WizardryItems.arcane_tome);
registerItemModel(WizardryItems.wizard_handbook);
registerItemModel(WizardryItems.basic_fire_wand);
registerItemModel(WizardryItems.basic_ice_wand);
registerItemModel(WizardryItems.basic_lightning_wand);
registerItemModel(WizardryItems.basic_necromancy_wand);
registerItemModel(WizardryItems.basic_earth_wand);
registerItemModel(WizardryItems.basic_sorcery_wand);
registerItemModel(WizardryItems.basic_healing_wand);
registerItemModel(WizardryItems.apprentice_fire_wand);
registerItemModel(WizardryItems.apprentice_ice_wand);
registerItemModel(WizardryItems.apprentice_lightning_wand);
registerItemModel(WizardryItems.apprentice_necromancy_wand);
registerItemModel(WizardryItems.apprentice_earth_wand);
registerItemModel(WizardryItems.apprentice_sorcery_wand);
registerItemModel(WizardryItems.apprentice_healing_wand);
registerItemModel(WizardryItems.advanced_fire_wand);
registerItemModel(WizardryItems.advanced_ice_wand);
registerItemModel(WizardryItems.advanced_lightning_wand);
registerItemModel(WizardryItems.advanced_necromancy_wand);
registerItemModel(WizardryItems.advanced_earth_wand);
registerItemModel(WizardryItems.advanced_sorcery_wand);
registerItemModel(WizardryItems.advanced_healing_wand);
registerItemModel(WizardryItems.master_fire_wand);
registerItemModel(WizardryItems.master_ice_wand);
registerItemModel(WizardryItems.master_lightning_wand);
registerItemModel(WizardryItems.master_necromancy_wand);
registerItemModel(WizardryItems.master_earth_wand);
registerItemModel(WizardryItems.master_sorcery_wand);
registerItemModel(WizardryItems.master_healing_wand);
registerItemModel(WizardryItems.spectral_sword);
registerItemModel(WizardryItems.spectral_pickaxe);
registerItemModel(WizardryItems.spectral_bow);
registerItemModel(WizardryItems.mana_flask);
registerItemModel(WizardryItems.storage_upgrade);
registerItemModel(WizardryItems.siphon_upgrade);
registerItemModel(WizardryItems.condenser_upgrade);
registerItemModel(WizardryItems.range_upgrade);
registerItemModel(WizardryItems.duration_upgrade);
registerItemModel(WizardryItems.cooldown_upgrade);
registerItemModel(WizardryItems.blast_upgrade);
registerItemModel(WizardryItems.attunement_upgrade);
registerItemModel(WizardryItems.flaming_axe);
registerItemModel(WizardryItems.frost_axe);
registerItemModel(WizardryItems.firebomb);
registerItemModel(WizardryItems.poison_bomb);
registerItemModel(WizardryItems.blank_scroll);
registerItemModel(WizardryItems.scroll);
registerItemModel(WizardryItems.armour_upgrade);
registerItemModel(WizardryItems.magic_silk);
registerItemModel(WizardryItems.wizard_hat);
registerItemModel(WizardryItems.wizard_robe);
registerItemModel(WizardryItems.wizard_leggings);
registerItemModel(WizardryItems.wizard_boots);
registerItemModel(WizardryItems.wizard_hat_fire);
registerItemModel(WizardryItems.wizard_robe_fire);
registerItemModel(WizardryItems.wizard_leggings_fire);
registerItemModel(WizardryItems.wizard_boots_fire);
registerItemModel(WizardryItems.wizard_hat_ice);
registerItemModel(WizardryItems.wizard_robe_ice);
registerItemModel(WizardryItems.wizard_leggings_ice);
registerItemModel(WizardryItems.wizard_boots_ice);
registerItemModel(WizardryItems.wizard_hat_lightning);
registerItemModel(WizardryItems.wizard_robe_lightning);
registerItemModel(WizardryItems.wizard_leggings_lightning);
registerItemModel(WizardryItems.wizard_boots_lightning);
registerItemModel(WizardryItems.wizard_hat_necromancy);
registerItemModel(WizardryItems.wizard_robe_necromancy);
registerItemModel(WizardryItems.wizard_leggings_necromancy);
registerItemModel(WizardryItems.wizard_boots_necromancy);
registerItemModel(WizardryItems.wizard_hat_earth);
registerItemModel(WizardryItems.wizard_robe_earth);
registerItemModel(WizardryItems.wizard_leggings_earth);
registerItemModel(WizardryItems.wizard_boots_earth);
registerItemModel(WizardryItems.wizard_hat_sorcery);
registerItemModel(WizardryItems.wizard_robe_sorcery);
registerItemModel(WizardryItems.wizard_leggings_sorcery);
registerItemModel(WizardryItems.wizard_boots_sorcery);
registerItemModel(WizardryItems.wizard_hat_healing);
registerItemModel(WizardryItems.wizard_robe_healing);
registerItemModel(WizardryItems.wizard_leggings_healing);
registerItemModel(WizardryItems.wizard_boots_healing);
registerItemModel(WizardryItems.spectral_helmet);
registerItemModel(WizardryItems.spectral_chestplate);
registerItemModel(WizardryItems.spectral_leggings);
registerItemModel(WizardryItems.spectral_boots);
registerItemModel(WizardryItems.smoke_bomb);
registerItemModel(WizardryItems.identification_scroll);
}
// Moved from the proxies
/** Registers an item model, using the item's registry name as the model name (this
* convention makes it easier to keep track of everything). Variant defaults to "normal". Registers the model
* for metadata 0 automatically, plus all the other metadata values that the item can take, as defined in
* {@link Item#getSubItems(Item, net.minecraft.creativetab.CreativeTabs, java.util.List)}. The passed in item
* <b>must</b> allow null to be passed in for the creative tab parameter in the aforementioned method, or a
* {@link NullPointerException} will result. */
private static void registerItemModel(Item item){
if(item.getHasSubtypes()){
List<ItemStack> items = new ArrayList<ItemStack>();
item.getSubItems(item, null, items); // Client-only method, but we're client-side so this is OK.
for(ItemStack stack : items){
ModelLoader.setCustomModelResourceLocation(item, stack.getMetadata(), new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
}
// Changing the last parameter from null to "inventory" fixed the item/block model weirdness. No idea why!
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
/** Registers an item model for the given metadata, using the item's registry name as the model name (this
* convention makes it easier to keep track of everything). This is intended for registering additional metadata
* values which aren't displayed in the creative menu, for example the wildcard spell book used in wizard trades. */
private static void registerItemModel(Item item, int metadata, String variant) {
ModelLoader.setCustomModelResourceLocation(item, metadata, new ModelResourceLocation(item.getRegistryName(), variant));
}
}
@@ -0,0 +1,139 @@
package electroblob.wizardry.client.particle;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntityBlizzardFX extends EntitySnowFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "blizzard";
private boolean gravity = false;
private double angle;
private double radius;
private double speed;
public EntityBlizzardFX(World world, float red, float green, float blue, int maxAge, double originX, double originZ, double radius, double yPos)
{
super(world, 0, 0, 0, 0, 0, 0, maxAge);
this.angle = this.rand.nextDouble() * Math.PI * 2;
double x = originX - Math.cos(angle)*radius;
double z = originZ + radius*Math.sin(angle);
this.radius = radius;
this.setPosition(x, yPos, z);
//this.particleScale *= 0.75F;
this.noClip = true;
particleRed = red;
particleGreen = green;
particleBlue = blue;
if(rand.nextBoolean()){
speed = rand.nextDouble()*2 + 1;
}else{
speed = rand.nextDouble()*-2 - 1;
}
}
public EntityBlizzardFX(World world, double x, double y, double z, double vx, double vy, double vz, float red, float green, float blue)
{
super(world, x, y, z, vx, vy, vz);
//this.particleScale *= 0.75F;
this.particleMaxAge = 48 + this.rand.nextInt(12);
this.noClip = true;
particleRed = red;
particleGreen = green;
particleBlue = blue;
}
public void setColour(int par1)
{
float f = (float)((par1 & 16711680) >> 16) / 255.0F;
float f1 = (float)((par1 & 65280) >> 8) / 255.0F;
float f2 = (float)((par1 & 255) >> 0) / 255.0F;
float f3 = 1.0F;
this.setRBGColorF(f * f3, f1 * f3, f2 * f3);
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
// This is in radians per tick...
double omega = (Math.PI*2)/20 - speed/(20*radius);
if(speed < 0){
omega = -(Math.PI*2)/20 + speed/(20*radius);
}
// v = r times omega; therefore the normalised velocity vector needs to be r times the angle increment / 2 pi.
this.angle += omega;
this.motionZ = radius * omega * Math.cos(angle);
this.motionX = radius * omega * Math.sin(angle);
this.moveEntity(motionX, motionY, motionZ);
if(this.gravity){
this.motionY -= 0.05d;
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
}
}
/*
@Override
public int getBrightnessForRender(float par1)
{
return 15728880;
}
@Override
public float getBrightness(float par1)
{
return 1.0F;
}
*/
}
@@ -1,19 +1,23 @@
package electroblob.wizardry.client.particle;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleDarkMagic extends Particle {
public class EntityDarkMagicFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "darkmagic";
/** Base spell texture index */
private int baseSpellTextureIndex = 128;
public ParticleDarkMagic(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float r, float g, float b)
public EntityDarkMagicFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float r, float g, float b)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.motionY *= 0.20000000298023224D;
@@ -24,13 +28,12 @@ public class ParticleDarkMagic extends Particle {
this.particleScale *= 0.75F;
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
this.canCollide = true;
this.noClip = true;
}
@Override
public void renderParticle(VertexBuffer buffer, Entity entity, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float f6 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge * 32.0F;
float f6 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F;
if (f6 < 0.0F)
{
@@ -42,7 +45,7 @@ public class ParticleDarkMagic extends Particle {
f6 = 1.0F;
}
super.renderParticle(buffer, entity, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
/**
@@ -56,7 +59,7 @@ public class ParticleDarkMagic extends Particle {
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
this.setDead();
}
this.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
@@ -73,7 +76,7 @@ public class ParticleDarkMagic extends Particle {
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.isCollided)
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
@@ -1,16 +1,27 @@
package electroblob.wizardry.client.particle;
import net.minecraft.client.particle.Particle;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleDust extends Particle {
public class EntityDustFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "dust";
private final boolean shaded;
public ParticleDust(World par1World, double x, double y, double z, double par8, double par10, double par12, float r, float g, float b, boolean shaded)
public EntityDustFX(World par1World, double x, double y, double z, double par8, double par10, double par12, float r, float g, float b, boolean shaded)
{
super(par1World, x, y, z, par8, par10, par12);
this.particleRed = r;
@@ -38,7 +49,7 @@ public class ParticleDust extends Particle {
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
this.setDead();
}
}
@@ -47,11 +58,10 @@ public class ParticleDust extends Particle {
{
return shaded ? super.getBrightnessForRender(par1) : 15728880;
}
/*
@Override
public float getBrightness(float par1)
{
return shaded ? super.getBrightness(par1) : 1.0F;
}
*/
}
@@ -0,0 +1,199 @@
package electroblob.wizardry.client.particle;
import java.lang.reflect.Field;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntityIceFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "ice";
private static final ResourceLocation iceTextures = new ResourceLocation("wizardry:textures/particle/ice_particles.png");
public EntityIceFX(World world, double x, double y, double z, double vx, double vy, double vz)
{
super(world, x, y, z, vx, vy, vz);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(rand.nextInt(8));
this.setSize(0.02F, 0.02F);
this.particleScale *= 0.75f;
this.motionX = vx;
this.motionY = vy;
this.motionZ = vz;
this.particleMaxAge = 40 + rand.nextInt(10);
this.noClip = true;
}
public EntityIceFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int maxAge){
this(par1World, par2, par4, par6, par8, par10, par12);
this.particleMaxAge = maxAge;
this.noClip = true;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate(){
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
// Gravity
this.motionY -= 0.05d;
}
/* There are 4 layers of particles, specified as 0-3 by the method below.
* - Layer 0 causes the normal particles.png to be bound to the render engine for normal particles.
* - Layer 1 causes the block textures to be bound to the render engine for digging fx and falling fx.
* - Layer 2 causes the item textures to be bound to the render engine for tool breaking fx, snowballpoofs, slime particles, etc.
* - Layer 3 is not used in vanilla minecraft and was presumably added by forge for exactly this reason.
* This means no texture is bound by vanilla minecraft, meaning you are free to do as you wish without possibly
* overwriting vanilla particles. Mod particles won't be overwritten anyway since they bind their own textures.
* It is of course important to bind the texture every time you render a custom particle, but I don't see how
* you could do it any other way, since you don't have access to EffectRenderer.
*/
@Override
public int getFXLayer() {
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
return 3;
}
@Override
public void setParticleTextureIndex(int par1)
{
this.particleTextureIndexX = par1 % 4;
this.particleTextureIndexY = par1 / 4;
}
// Overwitten from entityfx to bind the new texture.
@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7)
{
// Resets the tessellator and binds the new texture. Used to check if tessellator is drawing, but that field
// is no longer visible. If this results in an IllegalStateException (tessellator not drawing), look into this.
// Perhaps I could use reflection (ooooooh) to access it? Like this:
/*
Field f = null;
boolean isDrawing = false;
try {
f = tessellator.getClass().getDeclaredField("isDrawing");
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
if(f != null){
f.setAccessible(true);
try {
isDrawing = (Boolean)f.get(tessellator);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
if(isDrawing)*/
//tessellator.draw();
GL11.glPushMatrix();
// This stuff does the shading. The parameter does nothing apparently.
int j = this.getBrightnessForRender(0);
int k = j % 65536;
int l = j / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().renderEngine.bindTexture(iceTextures);
tessellator.startDrawingQuads();
float f6 = (float)this.particleTextureIndexX / 4.0F;
float f7 = f6 + 0.0624375F*4;
float f8 = (float)this.particleTextureIndexY / 4.0F;
float f9 = f8 + 0.0624375F*4;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
// Fix which gets proper values for interpPos so the particles don't appear to move.
Entity player = Minecraft.getMinecraft().thePlayer;
this.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
this.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
this.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
float f14 = 1.0F;
tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
tessellator.draw();
GL11.glPopMatrix();
// Re-binds the normal particles so that the mod texture isn't on all of them
//Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
//tessellator.startDrawingQuads();
}
public int getBrightnessForRender(float par1)
{
return 15728880;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1)
{
return 1.0F;
}
}
@@ -0,0 +1,180 @@
package electroblob.wizardry.client.particle;
import java.lang.reflect.Field;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntityLeafFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "leaf";
private static final ResourceLocation leafTextures = new ResourceLocation("wizardry:textures/particle/leaf_particles.png");
public EntityLeafFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(rand.nextInt(16));
this.setSize(0.02F, 0.02F);
this.particleScale *= 1.4f;
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
this.particleMaxAge = 40 + rand.nextInt(10);
}
public EntityLeafFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int maxAge){
this(par1World, par2, par4, par6, par8, par10, par12);
this.particleMaxAge = maxAge;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
/* There are 4 layers of particles, specified as 0-3 by the method below.
* - Layer 0 causes the normal particles.png to be bound to the render engine for normal particles.
* - Layer 1 causes the block textures to be bound to the render engine for digging fx and falling fx.
* - Layer 2 causes the item textures to be bound to the render engine for tool breaking fx, snowballpoofs, slime particles, etc.
* - Layer 3 is not used in vanilla minecraft and was presumably added by forge for exactly this reason.
* This means no texture is bound by vanilla minecraft, meaning you are free to do as you wish without possibly
* overwriting vanilla particles. Mod particles won't be overwritten anyway since they bind their own textures.
* It is of course important to bind the texture every time you render a custom particle, but I don't see how
* you could do it any other way, since you don't have access to EffectRenderer.
*/
@Override
public int getFXLayer() {
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
return 3;
}
/**
* Public method to set private field particleTextureIndex.
*/
public void setParticleTextureIndex(int par1)
{
this.particleTextureIndexX = par1 % 4;
this.particleTextureIndexY = par1 / 4;
}
// Overwitten from entityfx to bind the new texture.
@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7)
{
// Resets the tessellator and binds the new texture. Used to check if tessellator is drawing, but that field
// is no longer visible. If this results in an IllegalStateException (tessellator not drawing), look into this.
// Perhaps I could use reflection (ooooooh) to access it? Like this:
/*
Field f = null;
boolean isDrawing = false;
try {
f = tessellator.getClass().getDeclaredField("isDrawing");
} catch (NoSuchFieldException e) {
e.printStackTrace();
} catch (SecurityException e) {
e.printStackTrace();
}
if(f != null){
f.setAccessible(true);
try {
isDrawing = (Boolean)f.get(tessellator);
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
if(isDrawing)*/
//tessellator.draw();
GL11.glPushMatrix();
// This stuff does the shading. The parameter does nothing apparently.
int j = this.getBrightnessForRender(0);
int k = j % 65536;
int l = j / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().renderEngine.bindTexture(leafTextures);
tessellator.startDrawingQuads();
float f6 = (float)this.particleTextureIndexX / 4.0F;
float f7 = f6 + 0.0624375F*4;
float f8 = (float)this.particleTextureIndexY / 4.0F;
float f9 = f8 + 0.0624375F*4;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
// Fix which gets proper values for interpPos so the particles don't appear to move.
Entity player = Minecraft.getMinecraft().thePlayer;
this.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
this.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
this.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
float f14 = 1.0F;
tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
tessellator.draw();
GL11.glPopMatrix();
// Re-binds the normal particles so that the mod texture isn't on all of them
//Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation("textures/particle/particles.png"));
//tessellator.startDrawingQuads();
}
}
@@ -1,19 +1,21 @@
package electroblob.wizardry.client.particle;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.particle.Particle;
import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleGiantBubble extends Particle
public class EntityMagicBubbleFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "magicbubble";
public ParticleGiantBubble(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
public EntityMagicBubbleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.particleRed = 1.0F;
@@ -44,7 +46,7 @@ public class ParticleGiantBubble extends Particle
if (this.particleMaxAge-- <= 0)
{
this.setExpired();
this.setDead();
}
}
}
@@ -0,0 +1,108 @@
package electroblob.wizardry.client.particle;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntityMagicFireFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "magicfire";
/** the scale of the flame FX */
private float flameScale;
public EntityMagicFireFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int maxAge, float scale)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.motionX = this.motionX * 0.009999999776482582D + par8;
this.motionY = this.motionY * 0.009999999776482582D + par10;
this.motionZ = this.motionZ * 0.009999999776482582D + par12;
double d6 = par2 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
d6 = par4 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
d6 = par6 + (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.05F);
this.flameScale = scale;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
if(maxAge == 0){
this.particleMaxAge = (int)(2.0D / (Math.random() * 0.8D + 0.2D));
}else{
this.particleMaxAge = maxAge;
}
this.noClip = true;
this.setParticleTextureIndex(48);
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float f6 = ((float)this.particleAge + par2) / (float)this.particleMaxAge;
this.particleScale = this.flameScale * (1.0F - f6 * f6 * 0.5F);
super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
public int getBrightnessForRender(float par1)
{
float f1 = ((float)this.particleAge + par1) / (float)this.particleMaxAge;
if (f1 < 0.0F)
{
f1 = 0.0F;
}
if (f1 > 1.0F)
{
f1 = 1.0F;
}
int i = super.getBrightnessForRender(par1);
int j = i & 255;
int k = i >> 16 & 255;
j += (int)(f1 * 15.0F * 16.0F);
if (j > 240)
{
j = 240;
}
//return j | k << 16;
return 256;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1)
{
return 1.0f;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9599999785423279D;
this.motionY *= 0.9599999785423279D;
this.motionZ *= 0.9599999785423279D;
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
}
@@ -0,0 +1,181 @@
package electroblob.wizardry.client.particle;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.spell.Clairvoyance;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntityPathFX extends EntityFX
{
/** The name used to identify this particle, without gravity. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "path";
private static final ResourceLocation pathTextures = new ResourceLocation("wizardry:textures/particle/path_particles.png");
private final double originX, originY, originZ;
public EntityPathFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float red, float green, float blue, int maxAge)
{
super(par1World, par2, par4, par6);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
// Set to a constant to remove the randomness from EntityFX.
this.particleScale = 1.25F;
this.particleMaxAge = maxAge;
this.noClip = true;
particleRed = red;
particleGreen = green;
particleBlue = blue;
this.originX = par2;
this.originY = par4;
this.originZ = par6;
}
public EntityPathFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float red, float green, float blue)
{
super(par1World, par2, par4, par6);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
// Set to a constant to remove the randomness from EntityFX.
this.particleScale = 1.25F;
this.particleMaxAge = 48 + this.rand.nextInt(12);
this.noClip = true;
particleRed = red;
particleGreen = green;
particleBlue = blue;
this.originX = par2;
this.originY = par4;
this.originZ = par6;
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - 2 * (((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge));
}
if(this.particleAge % Clairvoyance.PARTICLE_MOVEMENT_INTERVAL == 0){
this.setPosition(this.originX, this.originY, this.originZ);
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
}
}
/* There are 4 layers of particles, specified as 0-3 by the method below.
* - Layer 0 causes the normal particles.png to be bound to the render engine for normal particles.
* - Layer 1 causes the block textures to be bound to the render engine for digging fx and falling fx.
* - Layer 2 causes the item textures to be bound to the render engine for tool breaking fx, snowballpoofs, slime particles, etc.
* - Layer 3 is not used in vanilla minecraft and was presumably added by forge for exactly this reason.
* This means no texture is bound by vanilla minecraft, meaning you are free to do as you wish without possibly
* overwriting vanilla particles. Mod particles won't be overwritten anyway since they bind their own textures.
* It is of course important to bind the texture every time you render a custom particle, but I don't see how
* you could do it any other way, since you don't have access to EffectRenderer.
*/
@Override
public int getFXLayer() {
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
return 3;
}
@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7){
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().renderEngine.bindTexture(pathTextures);
tessellator.startDrawingQuads();
float f10 = 0.1F * this.particleScale;
// Fix which gets proper values for interpPos so the particles don't appear to move.
Entity player = Minecraft.getMinecraft().thePlayer;
this.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
this.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
this.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
float f14 = 1.0F;
tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), 1, 1);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), 1, 0);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), 0, 0);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), 0, 1);
tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@Override
public int getBrightnessForRender(float par1)
{
return 15728880;
}
@Override
public float getBrightness(float par1)
{
return 1.0F;
}
}
@@ -0,0 +1,131 @@
package electroblob.wizardry.client.particle;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntitySnowFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "snow";
private static final ResourceLocation snowTextures = new ResourceLocation("wizardry:textures/particle/snow_particles.png");
public EntitySnowFX(World world, double x, double y, double z, double velX, double velY, double velZ)
{
super(world, x, y, z, velX, velY, velZ);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(rand.nextInt(8));
this.setSize(0.02F, 0.02F);
this.particleScale *= 0.6f;
this.motionX = velX;
this.motionY = velY;
this.motionZ = velZ;
this.particleMaxAge = 40 + rand.nextInt(10);
}
public EntitySnowFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int maxAge){
this(par1World, par2, par4, par6, par8, par10, par12);
this.particleMaxAge = maxAge;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
if (this.particleMaxAge-- <= 0)
{
this.setDead();
}
}
/**
* Public method to set private field particleTextureIndex.
*/
public void setParticleTextureIndex(int par1)
{
this.particleTextureIndexX = par1 % 4;
this.particleTextureIndexY = par1 / 4;
}
@Override
public int getFXLayer() {
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
return 3;
}
// Overwitten from entityfx to bind the new texture.
@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7)
{
GL11.glPushMatrix();
// This stuff does the shading. The parameter does nothing apparently.
int j = this.getBrightnessForRender(0);
int k = j % 65536;
int l = j / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().renderEngine.bindTexture(snowTextures);
tessellator.startDrawingQuads();
float f6 = (float)this.particleTextureIndexX / 4.0F;
float f7 = f6 + 0.0624375F*4;
float f8 = (float)this.particleTextureIndexY / 4.0F;
float f9 = f8 + 0.0624375F*4;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
// Fix which gets proper values for interpPos so the particles don't appear to move.
Entity player = Minecraft.getMinecraft().thePlayer;
this.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
this.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
this.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
float f14 = 1.0F;
tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
tessellator.draw();
GL11.glPopMatrix();
}
}
@@ -0,0 +1,117 @@
package electroblob.wizardry.client.particle;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntitySparkFX extends EntityFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "spark";
private static final ResourceLocation sparkTextures = new ResourceLocation("wizardry:textures/particle/lightning_particles.png");
public EntitySparkFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.particleRed = 1.0F;
this.particleGreen = 1.0F;
this.particleBlue = 1.0F;
this.setParticleTextureIndex(rand.nextInt(8));
this.setSize(0.02F, 0.02F);
this.particleScale *= 1.4f;
this.motionX = par8 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F);
this.motionY = par10 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F);
this.motionZ = par12 * 0.20000000298023224D + (double)((float)(Math.random() * 2.0D - 1.0D) * 0.02F);
this.particleMaxAge = 3;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
}
/**
* Public method to set private field particleTextureIndex.
*/
public void setParticleTextureIndex(int par1)
{
this.particleTextureIndexY = par1;
}
@Override
public int getFXLayer() {
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
return 3;
}
// Overwitten from entityfx to bind the new texture.
@Override
public void renderParticle(Tessellator par1Tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7)
{
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().renderEngine.bindTexture(sparkTextures);
par1Tessellator.startDrawingQuads();
// Particles are now animated using a strip of 4 from left to right.
float f6 = (float)this.particleAge / 4.0F;
float f7 = f6 + 0.0624375F*4;
float f8 = (float)this.particleTextureIndexY / 8.0f;
float f9 = f8 + 0.0624375F*2;
float f10 = 0.1F * this.particleScale;
// Fix which gets proper values for interpPos so the particles don't appear to move.
Entity player = Minecraft.getMinecraft().thePlayer;
this.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
this.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
this.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
float f14 = 1.0F;
par1Tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
par1Tessellator.draw();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
@@ -0,0 +1,203 @@
package electroblob.wizardry.client.particle;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntitySparkleFX extends EntityFX
{
/** The name used to identify this particle, without gravity. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "sparkle";
/** The name used to identify this particle, with gravity. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME_GRAVITY = Wizardry.MODID + "sparkleGravity";
private static final ResourceLocation sparkleTextures = new ResourceLocation("wizardry:textures/particle/sparkle_particles.png");
private boolean gravity = false;
public EntitySparkleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float red, float green, float blue, int maxAge)
{
super(par1World, par2, par4, par6);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
this.particleScale *= 0.75F;
this.particleMaxAge = maxAge;
this.noClip = true;
particleRed = red;
particleGreen = green;
particleBlue = blue;
}
public EntitySparkleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float red, float green, float blue)
{
super(par1World, par2, par4, par6);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
this.particleScale *= 0.75F;
this.particleMaxAge = 48 + this.rand.nextInt(12);
this.noClip = true;
particleRed = red;
particleGreen = green;
particleBlue = blue;
}
public EntitySparkleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float red, float green, float blue, boolean doGravity){
this(par1World, par2, par4, par6, par8, par10, par12, red, green, blue);
this.gravity = doGravity;
}
public EntitySparkleFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, float red, float green, float blue, int maxAge, boolean doGravity){
this(par1World, par2, par4, par6, par8, par10, par12, red, green, blue, maxAge);
this.gravity = doGravity;
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
@Override
public void setParticleTextureIndex(int par1)
{
this.particleTextureIndexX = par1 % 4;
this.particleTextureIndexY = par1 / 4;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if(this.gravity){
this.motionY -= 0.05d;
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
}
this.setParticleTextureIndex((this.particleAge * 11)/this.particleMaxAge);
}
/* There are 4 layers of particles, specified as 0-3 by the method below.
* - Layer 0 causes the normal particles.png to be bound to the render engine for normal particles.
* - Layer 1 causes the block textures to be bound to the render engine for digging fx and falling fx.
* - Layer 2 causes the item textures to be bound to the render engine for tool breaking fx, snowballpoofs, slime particles, etc.
* - Layer 3 is not used in vanilla minecraft and was presumably added by forge for exactly this reason.
* This means no texture is bound by vanilla minecraft, meaning you are free to do as you wish without possibly
* overwriting vanilla particles. Mod particles won't be overwritten anyway since they bind their own textures.
* It is of course important to bind the texture every time you render a custom particle, but I don't see how
* you could do it any other way, since you don't have access to EffectRenderer.
*/
@Override
public int getFXLayer() {
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
return 3;
}
@Override
public void renderParticle(Tessellator tessellator, float partialTicks, float par3, float par4, float par5, float par6, float par7){
GL11.glPushMatrix();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().renderEngine.bindTexture(sparkleTextures);
tessellator.startDrawingQuads();
float f6 = (float)this.particleTextureIndexX / 4.0F;
float f7 = f6 + 0.0624375F*4;
float f8 = (float)this.particleTextureIndexY / 4.0F;
float f9 = f8 + 0.0624375F*4;
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null)
{
f6 = this.particleIcon.getMinU();
f7 = this.particleIcon.getMaxU();
f8 = this.particleIcon.getMinV();
f9 = this.particleIcon.getMaxV();
}
// Fix which gets proper values for interpPos so the particles don't appear to move.
Entity player = Minecraft.getMinecraft().thePlayer;
this.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)partialTicks;
this.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)partialTicks;
this.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double)partialTicks;
float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
float f14 = 1.0F;
tessellator.setColorRGBA_F(this.particleRed * f14, this.particleGreen * f14, this.particleBlue * f14, this.particleAlpha);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
tessellator.draw();
GL11.glPopMatrix();
}
@Override
public int getBrightnessForRender(float par1)
{
return 15728880;
}
@Override
public float getBrightness(float par1)
{
return 1.0F;
}
}
@@ -0,0 +1,135 @@
package electroblob.wizardry.client.particle;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import net.minecraft.block.Block;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class EntityTornadoFX extends EntityDiggingFX
{
/** The name used to identify this particle. Uses the mod id to avoid any possible conflicts (Not that there would
* be any, but I may as well.) */
public static final String NAME = Wizardry.MODID + "tornado";
private boolean gravity = false;
private double angle;
private double radius;
private double speed;
private double velX, velZ;
private boolean fullBrightness = false;
public EntityTornadoFX(World world, int maxAge, double originX, double originZ, double radius, double yPos, double velX, double velZ, Block block, int metadata, int side)
{
super(world, 0, 0, 0, 0, 0, 0, block, metadata, side);
this.angle = this.rand.nextDouble() * Math.PI * 2;
double x = originX - Math.cos(angle)*radius;
double z = originZ + radius*Math.sin(angle);
this.radius = radius;
this.setPosition(x, yPos, z);
//this.particleScale *= 0.75F;
this.particleMaxAge = maxAge;
this.noClip = true;
// Grass has special treatment, since it has a colourised top but the rest is normal.
if(block != Blocks.grass || side == 1) this.setColour(block.getRenderColor(side));
if(block.getLightValue() == 0){
this.particleRed *= 0.75;
this.particleGreen *= 0.75;
this.particleBlue *= 0.75;
}else{
this.fullBrightness = true;
}
speed = rand.nextDouble()*2 + 1;
this.velX = velX;
this.velZ = velZ;
}
public EntityTornadoFX(World world, double x, double y, double z, double vx, double vy, double vz, float red, float green, float blue)
{
super(world, x, y, z, vx, vy, vz, Blocks.dirt, 0);
//this.particleScale *= 0.75F;
this.particleMaxAge = 48 + this.rand.nextInt(12);
this.noClip = true;
particleRed = red;
particleGreen = green;
particleBlue = blue;
}
public void setColour(int par1)
{
float f = (float)((par1 & 16711680) >> 16) / 255.0F;
float f1 = (float)((par1 & 65280) >> 8) / 255.0F;
float f2 = (float)((par1 & 255) >> 0) / 255.0F;
float f3 = 1.0F;
this.setRBGColorF(f * f3, f1 * f3, f2 * f3);
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
@Override
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
// This is in radians per tick...
double omega = Math.signum(speed) * ((Math.PI*2)/20 - speed/(20*radius));
// v = r times omega; therefore the normalised velocity vector needs to be r times the angle increment / 2 pi.
this.angle += omega;
this.motionZ = radius * omega * Math.cos(angle);
this.motionX = radius * omega * Math.sin(angle);
this.moveEntity(motionX + velX, 0, motionZ + velZ);
if(this.gravity){
this.motionY -= 0.05d;
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
}
}
@Override
public int getBrightnessForRender(float par1)
{
return fullBrightness ? 15728880 : super.getBrightnessForRender(par1);
}
@Override
public float getBrightness(float par1)
{
return fullBrightness ? 1.0F : super.getBrightness(par1);
}
}
@@ -1,72 +0,0 @@
package electroblob.wizardry.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleBlizzard extends ParticleSnow {
private double angle;
private double radius;
private double speed;
public ParticleBlizzard(World world, int maxAge, double originX, double originZ, double radius, double yPos){
super(world, 0, 0, 0, 0, 0, 0, maxAge);
this.angle = this.rand.nextDouble() * Math.PI * 2;
double x = originX - Math.cos(angle)*radius;
double z = originZ + radius*Math.sin(angle);
this.radius = radius;
this.setPosition(x, yPos, z);
this.prevPosX = x;
this.prevPosY = yPos;
this.prevPosZ = z;
if(rand.nextBoolean()){
speed = rand.nextDouble()*2 + 1;
}else{
speed = rand.nextDouble()*-2 - 1;
}
this.multipleParticleScaleBy(1.5f);
}
@Override
public void init(){
super.init();
this.fullBrightness = true;
}
// @Override
// public void renderParticle(VertexBuffer buffer, Entity entity, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ){
// if(this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0){
// super.renderParticle(buffer, entity, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
// }
// }
@Override
public void onUpdate(){
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(this.particleAge++ >= this.particleMaxAge){
this.setExpired();
}
// This is in radians per tick...
double omega = Math.signum(speed) * ((Math.PI*2)/20 - speed/(20*radius));
// v = r times omega; therefore the normalised velocity vector needs to be r times the angle increment / 2 pi.
this.angle += omega;
this.motionY -= 0.04D * (double)this.particleGravity;
this.motionZ = radius * omega * Math.cos(angle);
this.motionX = radius * omega * Math.sin(angle);
this.moveEntity(motionX, motionY, motionZ);
if(this.particleAge > this.particleMaxAge / 2){
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
}
}
}
@@ -1,195 +0,0 @@
package electroblob.wizardry.client.particle;
import java.util.List;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
/**
* Abstract superclass for all particles that use custom textures. This is intended to centralise as much code as
* possible; all subclasses need to do is to define the texture to use, how the frames are arranged (and which to
* choose), and any properties like gravity and collisions.
* @author Electroblob
* @since Wizardry 1.2
*/
@SideOnly(Side.CLIENT)
public abstract class ParticleCustomTexture extends Particle {
/** True if the particle always renders at full brightness. Defaults to false. */
protected boolean fullBrightness = false;
public ParticleCustomTexture(World world, double x, double y, double z, double vx, double vy, double vz){
super(world, x, y, z, vx, vy, vz);
this.motionX = vx;
this.motionY = vy;
this.motionZ = vz;
this.init();
}
public ParticleCustomTexture(World world, double x, double y, double z, double vx, double vy, double vz, int maxAge){
this(world, x, y, z, vx, vy, vz);
this.particleMaxAge = maxAge;
}
/** Called from both constructors to set constants, avoiding duplicate code. Common fields to set here
* include: particleScale, particleGravity, canCollide, fullBrightness and setting the texture index. */
public abstract void init();
/** Returns a ResourceLocation for the particle's texture sheet. Do not create a new ResourceLocation in this
* method, only return a constant. */
public abstract ResourceLocation getTexture();
/** Returns how many 'frames' there are in the x direction on the texture. */
protected abstract int getXFrames();
/** Returns how many 'frames' there are in the y direction on the texture. */
protected abstract int getYFrames();
/* There are 4 layers of particles, specified as 0-3 by the method below.
* - Layer 0 causes the normal particles.png to be bound to the render engine for normal particles.
* - Layer 1 causes the block textures to be bound to the render engine for digging fx and falling fx.
* - Layer 2 causes the item textures to be bound to the render engine for tool breaking fx, snowballpoofs, slime particles, etc.
* - Layer 3 is not used in vanilla minecraft and was presumably added by forge for exactly this reason.
* This means no texture is bound by vanilla minecraft, meaning you are free to do as you wish without possibly
* overwriting vanilla particles. Mod particles won't be overwritten anyway since they bind their own textures.
* It is of course important to bind the texture every time you render a custom particle, but I don't see how
* you could do it any other way, since you don't have access to EffectRenderer. */
@Override
public int getFXLayer() {
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
return 3;
}
@Override
public void setParticleTextureIndex(int index){
this.particleTextureIndexX = index % getXFrames();
this.particleTextureIndexY = index / getYFrames();
}
// Overridden to fix the bug with vanilla that makes particles frictionless. (y != y... seriously, Mojang?)
@Override
public void moveEntity(double x, double y, double z){
double d0 = y;
if (this.canCollide)
{
List<AxisAlignedBB> list = this.worldObj.getCollisionBoxes((Entity)null, this.getEntityBoundingBox().addCoord(x, y, z));
for (AxisAlignedBB axisalignedbb : list)
{
y = axisalignedbb.calculateYOffset(this.getEntityBoundingBox(), y);
}
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(0.0D, y, 0.0D));
for (AxisAlignedBB axisalignedbb1 : list)
{
x = axisalignedbb1.calculateXOffset(this.getEntityBoundingBox(), x);
}
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, 0.0D, 0.0D));
for (AxisAlignedBB axisalignedbb2 : list)
{
z = axisalignedbb2.calculateZOffset(this.getEntityBoundingBox(), z);
}
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(0.0D, 0.0D, z));
}
else
{
this.setEntityBoundingBox(this.getEntityBoundingBox().offset(x, y, z));
}
this.resetPositionToBB();
this.isCollided = d0 != y && d0 < 0.0D;
/* Can never be true! - But this doesn't seem to make any difference anyway.
if (x != x)
{
this.motionX = 0.0D;
}
if (z != z)
{
this.motionZ = 0.0D;
}
*/
}
// Overridden to bind the new texture. I think this can be done with TextureAtlasSprite, but this works as it is
// so I'm not changing it for the time being.
@Override
public void renderParticle(VertexBuffer buffer, Entity viewer, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ){
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
this.applyGLStateChanges();
// This stuff does the shading. It vanilla does this later on for each point, but this also seems to work.
int brightness = this.getBrightnessForRender(partialTicks);
int lightmapX = brightness % 65536;
int lightmapY = brightness / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lightmapX / 1.0F, (float)lightmapY / 1.0F);
RenderHelper.disableStandardItemLighting();
Minecraft.getMinecraft().getTextureManager().bindTexture(getTexture());
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
float u1 = (float)this.particleTextureIndexX / (float)getXFrames();
float u2 = u1 + 1.0f/getXFrames();
float v1 = (float)this.particleTextureIndexY / (float)getYFrames();
float v2 = v1 + 1.0f/getYFrames();
float scale = 0.1F * this.particleScale;
// I'm pretty sure these were always static.
Particle.interpPosX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * (double)partialTicks;
Particle.interpPosY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * (double)partialTicks;
Particle.interpPosZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * (double)partialTicks;
float x = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float y = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float z = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
buffer.pos((double)(x - rotationX * scale - rotationXY * scale), (double)(y - rotationZ * scale), (double)(z - rotationYZ * scale - rotationXZ * scale)).tex(u2, v2).color(particleRed, particleGreen, particleBlue, particleAlpha).endVertex();
buffer.pos((double)(x - rotationX * scale + rotationXY * scale), (double)(y + rotationZ * scale), (double)(z - rotationYZ * scale + rotationXZ * scale)).tex(u2, v1).color(particleRed, particleGreen, particleBlue, particleAlpha).endVertex();
buffer.pos((double)(x + rotationX * scale + rotationXY * scale), (double)(y + rotationZ * scale), (double)(z + rotationYZ * scale + rotationXZ * scale)).tex(u1, v1).color(particleRed, particleGreen, particleBlue, particleAlpha).endVertex();
buffer.pos((double)(x + rotationX * scale - rotationXY * scale), (double)(y - rotationZ * scale), (double)(z + rotationYZ * scale - rotationXZ * scale)).tex(u1, v2).color(particleRed, particleGreen, particleBlue, particleAlpha).endVertex();;
Tessellator.getInstance().draw();
this.undoGLStateChanges();
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}
/** Override to add any GL state changes, like blending. Does nothing by default. <b>State changes should be
* done using GLStateManager, not using GL11 directly</b> (as is the case with all rendering code now). */
public void applyGLStateChanges(){}
/** Override to undo any GL state changes, like blending. Does nothing by default. <b>State changes should be
* done using GLStateManager, not using GL11 directly</b> (as is the case with all rendering code now). */
public void undoGLStateChanges(){}
@Override
public int getBrightnessForRender(float partialTick){
return fullBrightness ? 15728880 : super.getBrightnessForRender(partialTick);
}
}
@@ -1,34 +0,0 @@
package electroblob.wizardry.client.particle;
import electroblob.wizardry.Wizardry;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleIce extends ParticleCustomTexture {
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/particle/ice_particles.png");
public ParticleIce(World world, double x, double y, double z, double vx, double vy, double vz){
super(world, x, y, z, vx, vy, vz);
}
public ParticleIce(World world, double x, double y, double z, double vx, double vy, double vz, int maxAge){
super(world, x, y, z, vx, vy, vz, maxAge);
}
@Override
public void init(){
this.setParticleTextureIndex(rand.nextInt(8));
this.particleScale *= 0.75f;
this.particleGravity = 1;
this.canCollide = true;
this.fullBrightness = true;
}
@Override public ResourceLocation getTexture(){ return TEXTURE; }
@Override protected int getXFrames(){ return 4; }
@Override protected int getYFrames(){ return 4; }
}
@@ -1,33 +0,0 @@
package electroblob.wizardry.client.particle;
import electroblob.wizardry.Wizardry;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleLeaf extends ParticleCustomTexture {
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/particle/leaf_particles.png");
public ParticleLeaf(World world, double x, double y, double z, double vx, double vy, double vz){
super(world, x, y, z, vx, vy, vz);
}
public ParticleLeaf(World world, double x, double y, double z, double vx, double vy, double vz, int maxAge){
super(world, x, y, z, vx, vy, vz, maxAge);
}
@Override
public void init() {
this.setParticleTextureIndex(rand.nextInt(16));
this.particleScale *= 1.4f;
this.particleGravity = 0;
this.canCollide = true;
}
@Override public ResourceLocation getTexture(){ return TEXTURE; }
@Override protected int getXFrames(){ return 4; }
@Override protected int getYFrames(){ return 4; }
}
@@ -1,47 +0,0 @@
package electroblob.wizardry.client.particle;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleMagicFlame extends Particle {
/** The scale of the flame particle */
private float flameScale;
public ParticleMagicFlame(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, int maxAge, float scale)
{
super(par1World, par2, par4, par6, par8, par10, par12);
this.motionX = this.motionX * 0.009999999776482582D + par8;
this.motionY = this.motionY * 0.009999999776482582D + par10;
this.motionZ = this.motionZ * 0.009999999776482582D + par12;
this.flameScale = scale;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
if(maxAge == 0){
this.particleMaxAge = (int)(2.0D / (Math.random() * 0.8D + 0.2D));
}else{
this.particleMaxAge = maxAge;
}
// IDEA: Make the particles for ray spells collide properly and not spawn on the other side of stuff.
this.canCollide = false;
this.setParticleTextureIndex(48);
}
@Override
public void renderParticle(VertexBuffer buffer, Entity entity, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
float f6 = ((float)this.particleAge + partialTicks) / (float)this.particleMaxAge;
this.particleScale = this.flameScale * (1.0F - f6 * f6 * 0.5F);
super.renderParticle(buffer, entity, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
@Override
public int getBrightnessForRender(float par1)
{
return 256;
}
}
@@ -1,93 +0,0 @@
package electroblob.wizardry.client.particle;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.spell.Clairvoyance;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticlePath extends ParticleCustomTexture {
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/particle/path_particles.png");
private final double originX, originY, originZ;
public ParticlePath(World world, double x, double y, double z, double vx, double vy, double vz, float r, float g, float b){
super(world, x, y, z, vx, vy, vz);
this.setRBGColorF(r, g, b);
this.originX = x;
this.originY = y;
this.originZ = z;
}
public ParticlePath(World world, double x, double y, double z, double vx, double vy, double vz, float r, float g, float b, int maxAge){
super(world, x, y, z, vx, vy, vz, maxAge);
this.setRBGColorF(r, g, b);
this.originX = x;
this.originY = y;
this.originZ = z;
}
@Override
public void init(){
this.setParticleTextureIndex(0);
// Set to a constant to remove the randomness from Particle.
this.particleScale = 1.25f;
this.particleGravity = 0;
this.fullBrightness = true;
this.canCollide = false;
}
@Override public ResourceLocation getTexture(){ return TEXTURE; }
@Override protected int getXFrames(){ return 1; }
@Override protected int getYFrames(){ return 1; }
@Override
public void onUpdate(){
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setExpired();
}
this.moveEntity(this.motionX, this.motionY, this.motionZ);
// Fading
if(this.particleAge > this.particleMaxAge / 2){
this.setAlphaF(1.0F - 2 * (((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge));
}
if(this.particleAge % Clairvoyance.PARTICLE_MOVEMENT_INTERVAL == 0){
this.setPosition(this.originX, this.originY, this.originZ);
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
}
}
@Override
public void applyGLStateChanges(){
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// TESTME: Are these two actually necessary?
GlStateManager.disableLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
}
@Override
public void undoGLStateChanges(){
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}
}
@@ -1,59 +0,0 @@
package electroblob.wizardry.client.particle;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleRotatingSparkle extends ParticleSparkle {
private double angle;
private double radius;
private double speed;
public ParticleRotatingSparkle(World world, int maxAge, double originX, double originZ, double radius, double yPos, float r, float g , float b){
super(world, 0, 0, 0, 0, 0, 0, r, g, b, maxAge);
this.angle = this.rand.nextDouble() * Math.PI * 2;
double x = originX - Math.cos(angle)*radius;
double z = originZ + radius*Math.sin(angle);
this.radius = radius;
this.setPosition(x, yPos, z);
this.prevPosX = x;
this.prevPosY = yPos;
this.prevPosZ = z;
if(rand.nextBoolean()){
speed = rand.nextDouble()*2 + 1;
}else{
speed = rand.nextDouble()*-2 - 1;
}
this.multipleParticleScaleBy(1.5f);
}
@Override
public void onUpdate(){
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(this.particleAge++ >= this.particleMaxAge){
this.setExpired();
}
// This is in radians per tick...
double omega = Math.signum(speed) * ((Math.PI*2)/20 - speed/(20*radius));
// v = r times omega; therefore the normalised velocity vector needs to be r times the angle increment / 2 pi.
this.angle += omega;
this.motionY -= 0.04D * (double)this.particleGravity;
this.motionZ = radius * omega * Math.cos(angle);
this.motionX = radius * omega * Math.sin(angle);
this.moveEntity(motionX, motionY, motionZ);
if(this.particleAge > this.particleMaxAge / 2){
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
}
}
}
@@ -1,33 +0,0 @@
package electroblob.wizardry.client.particle;
import electroblob.wizardry.Wizardry;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSnow extends ParticleCustomTexture {
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/particle/snow_particles.png");
public ParticleSnow(World world, double x, double y, double z, double vx, double vy, double vz){
super(world, x, y, z, vx, vy, vz);
}
public ParticleSnow(World world, double x, double y, double z, double vx, double vy, double vz, int maxAge){
super(world, x, y, z, vx, vy, vz, maxAge);
}
@Override
public void init(){
this.setParticleTextureIndex(rand.nextInt(8));
this.particleScale *= 0.6f;
this.particleGravity = 0;
this.canCollide = true;
}
@Override public ResourceLocation getTexture(){ return TEXTURE; }
@Override protected int getXFrames(){ return 4; }
@Override protected int getYFrames(){ return 4; }
}
@@ -1,58 +0,0 @@
package electroblob.wizardry.client.particle;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSpark extends ParticleCustomTexture {
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/particle/lightning_particles.png");
public ParticleSpark(World world, double x, double y, double z, double vx, double vy, double vz){
// Max age is always 3.
super(world, x, y, z, vx, vy, vz, 3);
}
@Override
public void init(){
// Multiplied by 4 because the index works slightly differently for spark particles.
this.setParticleTextureIndex(rand.nextInt(8)*4);
this.particleScale *= 1.4f;
this.fullBrightness = true;
this.canCollide = false;
}
@Override
public void onUpdate(){
super.onUpdate();
// Well this is handy! Looks like vanilla uses the texture index like this too.
this.nextTextureIndexX();
}
@Override public ResourceLocation getTexture(){ return TEXTURE; }
@Override protected int getXFrames(){ return 4; }
@Override protected int getYFrames(){ return 8; }
@Override
public void applyGLStateChanges(){
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// TESTME: Are these two actually necessary?
GlStateManager.disableLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
}
@Override
public void undoGLStateChanges(){
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}
}
@@ -1,96 +0,0 @@
package electroblob.wizardry.client.particle;
import electroblob.wizardry.Wizardry;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleSparkle extends ParticleCustomTexture {
/* I have now figured out what particle factories are for: they separate out the individual uses of the varargs
* parameter in spawnParticle so they are kept with the particle class. For my purposes, it would be easier to do
* that in the particle spawning method itself. */
private static final ResourceLocation TEXTURE = new ResourceLocation(Wizardry.MODID, "textures/particle/sparkle_particles.png");
// NOTE: Uncomment once 2.1.0 is released
//private final float initialRed;
//private final float initialGreen;
//private final float initialBlue;
// TODO: Assign these via the constructors, as part of the refactoring for particle parameters.
// NOTE: Uncomment once 2.1.0 is released
// private final float fadeRed = 1;
// private final float fadeGreen = 1;
// private final float fadeBlue = 0;
public ParticleSparkle(World world, double x, double y, double z, double vx, double vy, double vz, float r, float g, float b){
super(world, x, y, z, vx, vy, vz);
this.setRBGColorF(r, g, b);
// NOTE: Uncomment once 2.1.0 is released
//initialRed = r;
//initialGreen = g;
//initialBlue = b;
this.particleMaxAge = 48 + this.rand.nextInt(12);
}
public ParticleSparkle(World world, double x, double y, double z, double vx, double vy, double vz, float r, float g, float b, int maxAge){
super(world, x, y, z, vx, vy, vz, maxAge);
this.setRBGColorF(r, g, b);
// NOTE: Uncomment once 2.1.0 is released
//initialRed = r;
//initialGreen = g;
//initialBlue = b;
}
public ParticleSparkle(World world, double x, double y, double z, double vx, double vy, double vz, float r, float g, float b, boolean doGravity){
this(world, x, y, z, vx, vy, vz, r, g, b);
this.particleGravity = doGravity ? 1 : 0;
}
public ParticleSparkle(World world, double x, double y, double z, double vx, double vy, double vz, float r, float g, float b, int maxAge, boolean doGravity){
this(world, x, y, z, vx, vy, vz, r, g, b, maxAge);
this.particleGravity = doGravity ? 1 : 0;
}
@Override
public void init(){
this.setParticleTextureIndex(rand.nextInt(16));
this.particleScale *= 0.75f;
this.particleGravity = 0;
this.canCollide = false;
this.fullBrightness = true;
}
@Override public ResourceLocation getTexture(){ return TEXTURE; }
@Override protected int getXFrames(){ return 4; }
@Override protected int getYFrames(){ return 4; }
@Override
public void onUpdate(){
super.onUpdate();
// Fading
if(this.particleAge > this.particleMaxAge / 2){
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
}
// Colour fading TODO Uncomment once 2.1.0 is released
// float ageFraction = (float)this.particleAge / (float)this.particleMaxAge;
// this.setRBGColorF(this.initialRed + (this.fadeRed - this.initialRed)*ageFraction,
// this.initialGreen + (this.fadeGreen - this.initialGreen)*ageFraction,
// this.initialBlue + (this.fadeBlue - this.initialBlue)*ageFraction);
this.setParticleTextureIndex((this.particleAge * 11)/this.particleMaxAge);
}
/*
* As a side note, I see a lot of magic mods with fancy-looking particle effects that really seem to 'glow'. It's
* actually not that hard - you simply create a reasonably high-res texture with translucency and then set the
* OpenGL blend function to something like SRC_ALPHA, SRC_ALPHA or ONE, ONE. The thing is... they're not very
* Minecraft-y. I still maintain that part of wizardry's appeal is that it stays true to the game's pixelated charm,
* rather than trying to make it something it's not. Still, the newer textures are much better than the defaults I
* used to use.
*/
}
@@ -1,83 +0,0 @@
package electroblob.wizardry.client.particle;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.ParticleDigging;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleTornado extends ParticleDigging {
private double angle;
private double radius;
private double speed;
/** Velocity of the tornado itself; in other words the velocity of the point the particle circles around. */
private double velX, velZ;
private boolean fullBrightness = false;
public ParticleTornado(World world, int maxAge, double originX, double originZ, double radius, double yPos, double velX, double velZ, IBlockState block){
super(world, 0, 0, 0, 0, 0, 0, block);
this.angle = this.rand.nextDouble() * Math.PI * 2;
double x = originX - Math.cos(angle)*radius;
double z = originZ + radius*Math.sin(angle);
this.radius = radius;
this.setPosition(x, yPos, z);
this.prevPosX = x;
this.prevPosY = yPos;
this.prevPosZ = z;
//this.particleScale *= 0.75F;
this.particleMaxAge = maxAge;
this.canCollide = false;
// Grass has special treatment, since it has a colourised top but the rest is normal.
// Commented out for now since vanilla does something about this now, but I'm not sure what exactly
//if(block.getBlock() != Blocks.GRASS || side == 1) this.setColour(block.getRenderColor(side));
// Blocks that emit light are rendered with full brightness.
if(block.getLightValue(world, new BlockPos(this.posX, this.posY, this.posZ)) == 0){
this.particleRed *= 0.75;
this.particleGreen *= 0.75;
this.particleBlue *= 0.75;
}else{
this.fullBrightness = true;
}
speed = rand.nextDouble()*2 + 1;
this.velX = velX;
this.velZ = velZ;
}
@Override
public void onUpdate(){
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if(this.particleAge++ >= this.particleMaxAge){
this.setExpired();
}
// This is in radians per tick...
double omega = Math.signum(speed) * ((Math.PI*2)/20 - speed/(20*radius));
// v = r times omega; therefore the normalised velocity vector needs to be r times the angle increment / 2 pi.
this.angle += omega;
this.motionZ = radius * omega * Math.cos(angle);
this.motionX = radius * omega * Math.sin(angle);
this.moveEntity(motionX + velX, 0, motionZ + velZ);
if(this.particleAge > this.particleMaxAge / 2){
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
}
}
@Override
public int getBrightnessForRender(float partialTicks){
return fullBrightness ? 15728880 : super.getBrightnessForRender(partialTicks);
}
}
@@ -1,191 +0,0 @@
package electroblob.wizardry.client.renderer;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import java.util.Map.Entry;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.client.ClientProxy;
import electroblob.wizardry.spell.Petrify;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderLivingBase;
import net.minecraft.client.renderer.entity.RenderZombie;
import net.minecraft.client.renderer.entity.layers.LayerRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
/**
* Layer used to render the stone texture on a petrified creature. Handles dynamic tiling of the stone texture and
* reflective access for classes that don't play nicely (looking at you, {@link RenderZombie}).
* @author Electroblob
* @since Wizardry 1.2
*/
public class LayerStone implements LayerRenderer<EntityLivingBase> {
protected ModelBase model;
private final RenderLivingBase<?> renderer;
private static final ResourceLocation texture = new ResourceLocation("textures/blocks/stone.png");
private static final Field zombieLayers = ReflectionHelper.findField(RenderZombie.class, "defaultLayers", "field_177122_o");
private static final Field zombieVillagerLayers = ReflectionHelper.findField(RenderZombie.class, "villagerLayers", "field_177121_n");
private static final Method swapZombieModel = ReflectionHelper.findMethod(RenderZombie.class, null,
new String[]{"swapArmor", "func_82427_a"}, EntityZombie.class); // Second parameter (null) is unused
@SuppressWarnings("unchecked") // The compiler is being annoying and I know that what I'm doing is type-safe.
public static void initialiseLayers(){
for(Entry<Class<? extends Entity>, Render<? extends Entity>> entry : Minecraft.getMinecraft().getRenderManager().entityRenderMap.entrySet()){
// Zombies don't play nicely because they have their own, private lists of layers for the regular zombie
// and the zombie villager, which are assigned within the constructor for RenderZombie and swapped out
// as necessary. However, Mojang, in their infinite wisdom, haven't bothered to override addLayer to
// modify those internal lists, so that method is useless.
if(entry.getValue() instanceof RenderZombie){
try {
Object layers = zombieLayers.get(entry.getValue());
if(layers instanceof List<?>){
// Nice as the layer renderer system is, it doesn't lend itself to reflective access.
// I KNOW that 'layers' (which was obtained using reflection) is of the type
// List<LayerRenderer<EntityZombie>>, because that's what it's declared as. However, if I cast
// 'layers' to List<LayerRenderer<EntityZombie>>, I can't add a LayerStone because it's only a
// LayerRenderer<EntityLivingBase>, not a LayerRenderer<EntityZombie>.
((List<LayerRenderer<EntityLivingBase>>)layers).add(new LayerStone((RenderLivingBase<?>)entry.getValue()));
}
layers = zombieVillagerLayers.get(entry.getValue());
if(layers instanceof List<?>){
((List<LayerRenderer<EntityLivingBase>>)layers).add(new LayerStone((RenderLivingBase<?>)entry.getValue()));
}
} catch (IllegalArgumentException | IllegalAccessException e){
Wizardry.logger.error("Error while reflectively accessing zombie render layers");
e.printStackTrace();
}
}else if(entry.getValue() instanceof RenderLivingBase){
// Adds a stone layer to all the living entity renderers in the game. Whether it is actually rendered
// is decided in doRenderLayer below on a per-entity basis.
((RenderLivingBase<?>)entry.getValue()).addLayer(new LayerStone((RenderLivingBase<?>)entry.getValue()));
}
// NOTE: May have to do some special stuff for players if they are to be added; see Minecraft.getMinecraft().getRenderManager().getSkinMap()
}
}
public LayerStone(RenderLivingBase<?> renderer){
this.renderer = renderer;
this.model = renderer.getMainModel();
}
@Override
public void doRenderLayer(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale){
if(entity.getEntityData().getBoolean(Petrify.NBT_KEY)){
GlStateManager.enableLighting();
int i = this.getBlockBrightnessForEntity(entity, partialTicks);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
ResourceLocation breakingTexture = ClientProxy.renderStatue.getBlockBreakingTexture();
if(breakingTexture != null){
// Block breaking animation
// TODO: Spider eyes and enderman eyes (any others?) show through the stone when the block is being broken...
GlStateManager.enableBlend();
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
this.renderer.bindTexture(breakingTexture);
this.renderEntityModel(entity, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
GlStateManager.disableBlend();
}else{
// Stone texture
this.renderer.bindTexture(texture);
this.renderEntityModel(entity, limbSwing, limbSwingAmount, partialTicks, ageInTicks, netHeadYaw, headPitch, scale);
}
}
}
private int getBlockBrightnessForEntity(Entity entity, float partialTicks){
BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(MathHelper.floor_double(entity.posX), 0, MathHelper.floor_double(entity.posZ));
if(entity.worldObj.isBlockLoaded(pos)){
pos.setY(MathHelper.floor_double(entity.posY + (double)entity.getEyeHeight()));
return entity.worldObj.getCombinedLight(pos, 0);
}else{
return 0;
}
}
private void renderEntityModel(EntityLivingBase entity, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale){
GlStateManager.pushMatrix();
// Enables tiling (Also used for guardian beam, beacon beam and ender crystal beam)
// TODO: Backport this improvement
GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_REPEAT);
GlStateManager.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_REPEAT);
GlStateManager.depthMask(true); // Some entities set depth mask to false (i.e. no sorting of faces by depth)
// In particular, LayerSpiderEyes sets it to false when the spider is invisible, for some reason.
// Changes the scale at which the texture is applied to the model. See LayerCreeper for a similar example,
// but with translation instead of scaling.
GlStateManager.matrixMode(GL11.GL_TEXTURE);
GlStateManager.loadIdentity();
double scaleX = 1, scaleY = 1;
// It's more logical to use the model's texture size, but some classes don't bother setting it properly
// (e.g. ModelVillager), so to get the correct dimensions I'm getting them from the first box instead.
if(model.boxList != null && model.boxList.get(0) != null){
scaleX = (double)model.boxList.get(0).textureWidth/16d;
scaleY = (double)model.boxList.get(0).textureHeight/16d;
}else{ // Fallback to model fields; should never be needed
scaleX = (double)model.textureWidth/16d;
scaleY = (double)model.textureHeight/16d;
}
GlStateManager.scale(scaleX, scaleY, 1);
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
// Lets RenderZombie do its (stupid and inflexible) model switching thing
if(this.renderer instanceof RenderZombie && entity instanceof EntityZombie){
try {
swapZombieModel.invoke(this.renderer, entity);
this.model = this.renderer.getMainModel();
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
Wizardry.logger.error("Error while reflectively calling RenderZombie#swapArmor");
e.printStackTrace();
}
}
// Hides the hat layer for bipeds
if(this.model instanceof ModelBiped) ((ModelBiped) this.model).bipedHeadwear.isHidden = true;
this.model.setLivingAnimations(entity, limbSwing, limbSwingAmount, partialTicks);
this.model.render(entity, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
if(this.model instanceof ModelBiped) ((ModelBiped) this.model).bipedHeadwear.isHidden = false;
// Undoes the texture scaling
GlStateManager.matrixMode(GL11.GL_TEXTURE);
GlStateManager.loadIdentity();
GlStateManager.matrixMode(GL11.GL_MODELVIEW);
GlStateManager.popMatrix();
}
@Override
public boolean shouldCombineTextures(){
return false;
}
}
@@ -1,129 +1,136 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import java.util.Random;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.EntityArc;
import net.minecraft.client.renderer.GlStateManager;
import electroblob.wizardry.entity.projectile.EntityMagicMissile;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityClientPlayerMP;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
public class RenderArc extends Render<EntityArc> {
public class RenderArc extends Render {
private static final ResourceLocation[] textures = new ResourceLocation[16];
public RenderArc(RenderManager renderManager){
super(renderManager);
public RenderArc(){
for(int i=0;i<16;i++){
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/arc_" + i + ".png");
textures[i] = new ResourceLocation("wizardry:textures/entity/arc_" + i + ".png");
}
}
@Override
public void doRender(EntityArc arc, double d0, double d1, double d2,
public void doRender(Entity entity, double d0, double d1, double d2,
float fa, float fb) {
GlStateManager.pushMatrix();
GlStateManager.translate((float)d0, (float)d1, (float)d2);
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //This line fixes the weird brightness bug.
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
GL11.glPushMatrix();
GL11.glTranslatef((float)d0, (float)d1, (float)d2);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //This line fixes the weird brightness bug.
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
//System.out.println("Entity coords: " + entity.posX + ", " + entity.posY + ", " + entity.posZ);
//System.out.println("doRender parameters: " + d0 + ", " + d1 + ", " + d2 + ", " + fa + ", " + fb);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
bindTexture(textures[arc.textureIndex]); // This MUST be after the tessellator declaration and the gl stuff
/**
* Note: A lot of the maths here works on similar triangles and the ratios between them, avoiding too much
* pythagoras and eliminating the need for any trig. Ratios are used for the positioning of the arc endpoints.
* Ratios are usually used swapping x and z because the triangles are rotated through 90 degrees.
*/
double dx = -d0;
double dy = -d1;
double dz = -d2;
if(arc.x1 != 0){
dx = arc.x1 - arc.posX;// - d2/lengthOffsetRatio;
dy = arc.y1 - arc.posY + 0.3;
dz = arc.z1 - arc.posZ;// + d0/lengthOffsetRatio;
//The distance from caster to target
double arcLength = Math.sqrt(dz*dz+dx*dx);
//The ratio between the length of the arc and the offset of the start point from the player's centre (which is always 0.3).
//double lengthOffsetRatio = arcLength/0.3;
//EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
//double xViewDist = player.posX - d0;
//double yViewDist = player.posY + player.eyeHeight - d1;
//double zViewDist = player.posZ - d2;
//double xzViewDist = Math.sqrt(xViewDist * xViewDist + zViewDist * zViewDist);
//The angle above the horizontal that this particular player is viewing the arc from
//double viewAngle = Math.atan(yViewDist/xzViewDist);
//Half the width of the arc
double arcWidth = 0.3d;
//Right hand side of vertical plane
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
//Target end
buffer.pos(0, -0.5, 0).tex(1, 1).endVertex();
buffer.pos(0, 0.5, 0).tex(1, 0).endVertex();
//Caster end
buffer.pos(dx, dy, dz).tex(0, 0).endVertex();
buffer.pos(dx, dy-1, dz).tex(0, 1).endVertex();
tessellator.draw();
//Left
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
//Target end
buffer.pos(0, -0.5, 0).tex(1, 1).endVertex();
//Caster end
buffer.pos(dx, dy-1, dz).tex(0, 1).endVertex();
buffer.pos(dx, dy, dz).tex(0, 0).endVertex();
//Target end
buffer.pos(0, 0.5, 0).tex(1, 0).endVertex();
tessellator.draw();
//Bottom of horizontal plane
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
buffer.pos((arcWidth/arcLength)*dz, 0, (-arcWidth/arcLength)*dx).tex(1, 1).endVertex();
buffer.pos(dx + (arcWidth/arcLength)*dz, dy-0.5, dz - (arcWidth/arcLength)*dx).tex(0, 1).endVertex();
buffer.pos(dx - (arcWidth/arcLength)*dz, dy-0.5, dz + (arcWidth/arcLength)*dx).tex(0, 0).endVertex();
buffer.pos((-arcWidth/arcLength)*dz, 0, (arcWidth/arcLength)*dx).tex(1, 0).endVertex();
tessellator.draw();
//Top
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
buffer.pos((arcWidth/arcLength)*dz, 0, (-arcWidth/arcLength)*dx).tex(1, 1).endVertex();
buffer.pos((-arcWidth/arcLength)*dz, 0, (arcWidth/arcLength)*dx).tex(1, 0).endVertex();
buffer.pos(dx - (arcWidth/arcLength)*dz, dy-0.5, dz + (arcWidth/arcLength)*dx).tex(0, 0).endVertex();
buffer.pos(dx + (arcWidth/arcLength)*dz, dy-0.5, dz - (arcWidth/arcLength)*dx).tex(0, 1).endVertex();
tessellator.draw();
}
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
Tessellator tessellator = Tessellator.instance;
if(entity instanceof EntityArc){
EntityArc arc = (EntityArc)entity;
bindTexture(textures[arc.textureIndex]); // This MUST be after the tessellator declaration and the gl stuff
/**
* Note: A lot of the maths here works on similar triangles and the ratios between them, avoiding too much
* pythagoras and eliminating the need for any trig. Ratios are used for the positioning of the arc endpoints.
* Ratios are usually used swapping x and z because the triangles are rotated through 90 degrees.
*/
double dx = -d0;
double dy = -d1;
double dz = -d2;
if(arc.x1 != 0){
dx = arc.x1 - arc.posX;// - d2/lengthOffsetRatio;
dy = arc.y1 - arc.posY + 0.3;
dz = arc.z1 - arc.posZ;// + d0/lengthOffsetRatio;
//The distance from caster to target
double arcLength = Math.sqrt(dz*dz+dx*dx);
//The ratio between the length of the arc and the offset of the start point from the player's centre (which is always 0.3).
double lengthOffsetRatio = arcLength/0.3;
//EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
//double xViewDist = player.posX - d0;
//double yViewDist = player.posY + player.eyeHeight - d1;
//double zViewDist = player.posZ - d2;
//double xzViewDist = Math.sqrt(xViewDist * xViewDist + zViewDist * zViewDist);
//The angle above the horizontal that this particular player is viewing the arc from
//double viewAngle = Math.atan(yViewDist/xzViewDist);
//Half the width of the arc
double arcWidth = 0.3d;
//Right hand side of vertical plane
tessellator.startDrawingQuads();
//Target end
tessellator.addVertexWithUV(0, -0.5, 0, 1, 1);
tessellator.addVertexWithUV(0, 0.5, 0, 1, 0);
//Caster end
tessellator.addVertexWithUV(dx, dy, dz, 0, 0);
tessellator.addVertexWithUV(dx, dy-1, dz, 0, 1);
tessellator.draw();
//Left
tessellator.startDrawingQuads();
//Target end
tessellator.addVertexWithUV(0, -0.5, 0, 1, 1);
//Caster end
tessellator.addVertexWithUV(dx, dy-1, dz, 0, 1);
tessellator.addVertexWithUV(dx, dy, dz, 0, 0);
//Target end
tessellator.addVertexWithUV(0, 0.5, 0, 1, 0);
tessellator.draw();
//Bottom of horizontal plane
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((arcWidth/arcLength)*dz, 0, (-arcWidth/arcLength)*dx, 1, 1);
tessellator.addVertexWithUV(dx + (arcWidth/arcLength)*dz, dy-0.5, dz - (arcWidth/arcLength)*dx, 0, 1);
tessellator.addVertexWithUV(dx - (arcWidth/arcLength)*dz, dy-0.5, dz + (arcWidth/arcLength)*dx, 0, 0);
tessellator.addVertexWithUV((-arcWidth/arcLength)*dz, 0, (arcWidth/arcLength)*dx, 1, 0);
tessellator.draw();
//Top
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((arcWidth/arcLength)*dz, 0, (-arcWidth/arcLength)*dx, 1, 1);
tessellator.addVertexWithUV((-arcWidth/arcLength)*dz, 0, (arcWidth/arcLength)*dx, 1, 0);
tessellator.addVertexWithUV(dx - (arcWidth/arcLength)*dz, dy-0.5, dz + (arcWidth/arcLength)*dx, 0, 0);
tessellator.addVertexWithUV(dx + (arcWidth/arcLength)*dz, dy-0.5, dz - (arcWidth/arcLength)*dx, 0, 1);
tessellator.draw();
}
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityArc entity) {
return textures[entity.textureIndex];
protected ResourceLocation getEntityTexture(Entity entity) {
if(entity instanceof EntityArc){
return textures[((EntityArc)entity).textureIndex];
}
return null;
}
}
@@ -1,45 +1,48 @@
package electroblob.wizardry.client.renderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.tileentity.ContainerArcaneWorkbench;
import electroblob.wizardry.tileentity.TileEntityArcaneWorkbench;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
public class RenderArcaneWorkbench extends TileEntitySpecialRenderer<TileEntityArcaneWorkbench> {
private static final ResourceLocation runeTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/rune.png");
public class RenderArcaneWorkbench extends TileEntitySpecialRenderer
{
private final RenderBlocks renderBlocksInstance = new RenderBlocks();
private static final ResourceLocation runeTexture = new ResourceLocation("wizardry:textures/entity/rune.png");
public RenderArcaneWorkbench(){}
public RenderArcaneWorkbench(){
}
@Override
public void renderTileEntityAt(TileEntityArcaneWorkbench tileentity, double x, double y, double z, float partialTicks, int destroyStage) {
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float f) {
GlStateManager.pushMatrix();
// This line makes stuff render in the same place relative to the world wherever the player is.
GlStateManager.translate((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GlStateManager.rotate(180, 0F, 0F, 1F);
GlStateManager.pushMatrix();
GL11.glPushMatrix();
// It seems that these next two lines make stuff render in the same place relative to the world wherever
// the player is.
GL11.glTranslatef((float)x + 0.5F, (float)y +1.5F, (float)z + 0.5F);
GL11.glRotatef(180, 0F, 0F, 1F);
GL11.glPushMatrix();
double angle = 0.0d;
if(x < -0.5){
angle = Math.toDegrees(Math.atan((z+0.5)/(x+0.5))) + 180;
}else{
angle = Math.toDegrees(Math.atan((z+0.5)/(x+0.5)));
}
this.renderEffect(tileentity);
this.renderWand(tileentity, angle);
GlStateManager.popMatrix();
GlStateManager.popMatrix();
this.renderEffect((TileEntityArcaneWorkbench)tileentity);
this.renderWand((TileEntityArcaneWorkbench)tileentity, angle);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
private void renderEffect(TileEntityArcaneWorkbench tileentity) {
@@ -47,27 +50,26 @@ public class RenderArcaneWorkbench extends TileEntitySpecialRenderer<TileEntityA
ItemStack itemstack = tileentity.getStackInSlot(ContainerArcaneWorkbench.WAND_SLOT);
if(itemstack != null){
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //This line fixes the weird brightness bug.
GlStateManager.rotate(tileentity.timer, 0.0f, 1.0f, 0.0f);
GlStateManager.translate(0.0f, 0.65f, 0.0f);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //This line fixes the weird brightness bug.
GL11.glRotatef(tileentity.timer, 0.0f, 1.0f, 0.0f);
GL11.glTranslatef(0.0f, 0.65f, 0.0f);
Tessellator tessellator = Tessellator.instance;
bindTexture(runeTexture);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-0.5f, 0, -0.5f).tex(0, 0).endVertex();
buffer.pos(0.5f, 0, -0.5f).tex(1, 0).endVertex();
buffer.pos(0.5f, 0, 0.5f).tex(1, 1).endVertex();
buffer.pos(-0.5f, 0, 0.5f).tex(0, 1).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-0.5f, 0, -0.5f, 0, 0);
tessellator.addVertexWithUV(0.5f, 0, -0.5f, 1, 0);
tessellator.addVertexWithUV(0.5f, 0, 0.5f, 1, 1);
tessellator.addVertexWithUV(-0.5f, 0, 0.5f, 0, 1);
tessellator.draw();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
@@ -75,25 +77,29 @@ public class RenderArcaneWorkbench extends TileEntitySpecialRenderer<TileEntityA
* Renders the wand on the workbench as 3D on the model. Currently doesn't do much on 'fast' graphics!
* @param tileentity The instance of the workbench tile entity
*/
private void renderWand(TileEntityArcaneWorkbench tileentity, double viewAngle)
{
ItemStack stack = tileentity.getStackInSlot(ContainerArcaneWorkbench.WAND_SLOT);
ItemStack itemstack = tileentity.getStackInSlot(ContainerArcaneWorkbench.WAND_SLOT);
if(stack != null){
GlStateManager.pushMatrix();
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
if (itemstack != null)
{
EntityItem entityitem = new EntityItem(tileentity.getWorldObj(), 0.0d, 0.0d, 0.0d, itemstack);
entityitem.hoverStart = 0.0F;
GL11.glPushMatrix();
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.rotate(180, 0, 1, 0);
GL11.glRotated(180, 0, 1, 0);
// View angle is negated because of the 180 flip.
GlStateManager.rotate((float)(-viewAngle-90f), 0, 0, 1);
GL11.glRotated(-viewAngle-90, 0, 0, 1);
// Does the floaty thing
GlStateManager.translate(0.0F, 0.0F, (float)tileentity.yOffset/5000.0F - 0.55f);
GlStateManager.scale(0.75F, 0.75F, 0.75F);
// This is what the item frame uses so it's definitely what we want.
Minecraft.getMinecraft().getRenderItem().renderItem(stack, TransformType.FIXED);
GlStateManager.popMatrix();
GL11.glTranslatef(0.0F, -0.25F, (float)tileentity.yOffset/5000.0F - 0.55f);
GL11.glScalef(1.5F, 1.5F, 1.5F);
RenderItem.renderInFrame = true; // Not too sure what this is
RenderManager.instance.renderEntityWithPosYaw(entityitem, 0.0d, 0.0d, 0.0d, 0.0F, 0.0F);
RenderItem.renderInFrame = false;
GL11.glPopMatrix();
}
}
}
@@ -1,179 +1,181 @@
package electroblob.wizardry.client.renderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import java.util.ArrayList;
import java.util.Collections;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.EntityBlackHole;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.ResourceLocation;
public class RenderBlackHole extends Render<EntityBlackHole> {
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/dark_ray.png");
private static final ResourceLocation texture2 = new ResourceLocation(Wizardry.MODID, "textures/entity/black_hole.png");
public RenderBlackHole(RenderManager renderManager) {
super(renderManager);
}
public class RenderBlackHole extends Render{
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/entity/dark_ray.png");
private static final ResourceLocation texture2 = new ResourceLocation("wizardry:textures/entity/black_hole.png");
@Override
public void doRender(EntityBlackHole blackhole, double x, double y, double z, float fa, float fb) {
public void doRender(Entity entity, double x, double y, double z,
float fa, float fb) {
GlStateManager.pushMatrix();
GL11.glPushMatrix();
GlStateManager.disableCull();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.disableLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
RenderHelper.disableStandardItemLighting();
GlStateManager.translate(x, y, z);
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
RenderHelper.disableStandardItemLighting();
GL11.glTranslated(x, y, z);
//float pitch = (float) Math.toDegrees(Math.atan(y/(x*x+z*z)));
//float yaw = (float) Math.toDegrees(Math.atan(x/z));
Tessellator tessellator = Tessellator.instance;
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Renders the rays
if(entity instanceof EntityBlackHole){
EntityBlackHole blackhole = (EntityBlackHole)entity;
if(blackhole.ticksExisted < 10){
GL11.glScalef((float)blackhole.ticksExisted/10, (float)blackhole.ticksExisted/10, (float)blackhole.ticksExisted/10);
}
if(blackhole.ticksExisted > blackhole.lifetime - 10){
GL11.glScalef((float)(blackhole.lifetime-blackhole.ticksExisted)/10, (float)(blackhole.lifetime-blackhole.ticksExisted)/10, (float)(blackhole.lifetime-blackhole.ticksExisted)/10);
}
this.bindTexture(texture);
// In theory this stuff should sort the rays into the correct render order based on the distance from
// the 'camera' (i.e. the player's viewpoint)
// In the end it was easier to do away with the openGL rotation because for some reason it produced
// coordinates which were inconsistent with my calculated ones. Since I know those will give the desired
// effect anyway, I just used them directly instead.
ArrayList<RayHelper> rays = new ArrayList<RayHelper>(1);
for(int j=0; j<30; j++){
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if(blackhole.ticksExisted < 10){
GlStateManager.scale((float)blackhole.ticksExisted/10, (float)blackhole.ticksExisted/10, (float)blackhole.ticksExisted/10);
}
if(blackhole.ticksExisted > blackhole.lifetime - 10){
GlStateManager.scale((float)(blackhole.lifetime-blackhole.ticksExisted)/10, (float)(blackhole.lifetime-blackhole.ticksExisted)/10, (float)(blackhole.lifetime-blackhole.ticksExisted)/10);
}
this.bindTexture(texture);
// In theory this stuff should sort the rays into the correct render order based on the distance from
// the 'camera' (i.e. the player's viewpoint)
// In the end it was easier to do away with the openGL rotation because for some reason it produced
// coordinates which were inconsistent with my calculated ones. Since I know those will give the desired
// effect anyway, I just used them directly instead.
ArrayList<RayHelper> rays = new ArrayList<RayHelper>(1);
for(int j=0; j<30; j++){
float scale = 3.0f;
int a = blackhole.randomiser[j];
int b = blackhole.randomiser2[j];
int sliceAngle = 20 + a;
double x1 = scale*Math.sin((blackhole.ticksExisted + 40*j)*(Math.PI/180));
//double y1 = 0.7*Math.cos((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
double z1 = scale*Math.cos((blackhole.ticksExisted + 40*j)*(Math.PI/180));
double x2 = scale*Math.sin((blackhole.ticksExisted + 40*j - sliceAngle)*(Math.PI/180));
//double y2 = 0.7*Math.sin((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
double z2 = scale*Math.cos((blackhole.ticksExisted + 40*j - sliceAngle)*(Math.PI/180));
double absoluteX = x1*Math.cos(31*b);
double absoluteY = z1*Math.sin(31*a) + x1*Math.cos(31*a)*Math.sin(31*b);
double absoluteZ = z1*Math.cos(31*a);
double absoluteX2 = x2*Math.cos(31*b);
double absoluteY2 = z2*Math.sin(31*a) + x2*Math.cos(31*a)*Math.sin(31*b);
double absoluteZ2 = z2*Math.cos(31*a);
/*
buffer.begin(0, DefaultVertexFormats.POSITION_TEX);
float scale = 3.0f;
int a = blackhole.randomiser[j];
int b = blackhole.randomiser2[j];
int sliceAngle = 20 + a;
double x1 = scale*Math.sin((blackhole.ticksExisted + 40*j)*(Math.PI/180));
//double y1 = 0.7*Math.cos((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
double z1 = scale*Math.cos((blackhole.ticksExisted + 40*j)*(Math.PI/180));
double x2 = scale*Math.sin((blackhole.ticksExisted + 40*j - sliceAngle)*(Math.PI/180));
//double y2 = 0.7*Math.sin((blackhole.timer - 40*j)*(Math.PI/180))*j/10;
double z2 = scale*Math.cos((blackhole.ticksExisted + 40*j - sliceAngle)*(Math.PI/180));
double absoluteX = x1*Math.cos(31*b);
double absoluteY = z1*Math.sin(31*a) + x1*Math.cos(31*a)*Math.sin(31*b);
double absoluteZ = z1*Math.cos(31*a);
double absoluteX2 = x2*Math.cos(31*b);
double absoluteY2 = z2*Math.sin(31*a) + x2*Math.cos(31*a)*Math.sin(31*b);
double absoluteZ2 = z2*Math.cos(31*a);
/*
tessellator.startDrawing(0);
tessellator.setColorOpaque(255, 255, 255);
GL11.glPointSize(5);
tessellator.addVertex(absoluteX-x, 0, 0);
tessellator.addVertex(0, absoluteY-y, 0);
tessellator.addVertex(0, 0, absoluteZ-z);
tessellator.draw();
*/
rays.add(new RayHelper(j, absoluteX, absoluteY, absoluteZ, absoluteX2, absoluteY2, absoluteZ2, x, y, z));
*/
rays.add(new RayHelper(j, absoluteX, absoluteY, absoluteZ, absoluteX2, absoluteY2, absoluteZ2, x, y, z));
}
Collections.sort(rays);
for(RayHelper ray : rays){
GL11.glPushMatrix();
//GL11.glRotatef(31*blackhole.randomiser[ray.ordinal], 1, 0, 0);
//GL11.glRotatef(31*blackhole.randomiser2[ray.ordinal], 0, 0, 1);
tessellator.startDrawing(5);
//tessellator.setColorRGBA(255, 255, 255, 0);
tessellator.addVertexWithUV(0, 0, 0, 0, 0);
tessellator.addVertexWithUV(0, 0, 0, 0, 1);
//tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(ray.x1, ray.y1, ray.z1, 1, 0);
tessellator.addVertexWithUV(ray.x2, ray.y2, ray.z2, 1, 1);
tessellator.draw();
GL11.glPopMatrix();
}
}
Collections.sort(rays);
for(RayHelper ray : rays){
GlStateManager.pushMatrix();
//GlStateManager.rotate(31*blackhole.randomiser[ray.ordinal], 1, 0, 0);
//GlStateManager.rotate(31*blackhole.randomiser2[ray.ordinal], 0, 0, 1);
buffer.begin(5, DefaultVertexFormats.POSITION_TEX);
//tessellator.setColorRGBA(255, 255, 255, 0);
buffer.pos(0, 0, 0).tex(0, 0).endVertex();
buffer.pos(0, 0, 0).tex(0, 1).endVertex();
//tessellator.setColorRGBA(0, 0, 0, 255);
buffer.pos(ray.x1, ray.y1, ray.z1).tex(1, 0).endVertex();
buffer.pos(ray.x2, ray.y2, ray.z2).tex(1, 1).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
}
GlStateManager.pushMatrix();
/* Deprecated in favour of particle style method.
GlStateManager.rotate(yaw, 0, 1, 0);
GL11.glPushMatrix();
/* Deprecated in favour of particle style method.
GL11.glRotatef(yaw, 0, 1, 0);
// GL transformations are relative, hence only x rotation
if(z < 0){
GlStateManager.rotate(pitch, 1, 0, 0);
GL11.glRotatef(pitch, 1, 0, 0);
}else{
GlStateManager.rotate(-1*pitch, 1, 0, 0);
GL11.glRotatef(-1*pitch, 1, 0, 0);
}
*/
*/
// Renders the aura effect
// This counteracts the reverse rotation behaviour when in front f5 view. Vanilla now has this fix too.
float yaw = Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? this.renderManager.playerViewX : -this.renderManager.playerViewX;
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(yaw, 1.0F, 0.0F, 0.0F);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
// Renders the aura effect
// This counteracts the reverse rotation behaviour when in front f5 view.
// Fun fact: this is a bug with vanilla too! Look at a snowball in front f5 view, for example.
float yaw = Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? this.renderManager.playerViewX : -this.renderManager.playerViewX;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(yaw, 1.0F, 0.0F, 0.0F);
tessellator.startDrawingQuads();
this.bindTexture(texture2);
buffer.pos(-0.4, 0.4, 0).tex(0, 0).endVertex();
buffer.pos(0.4, 0.4, 0).tex(1, 0).endVertex();
buffer.pos(0.4, -0.4, 0).tex(1, 1).endVertex();
buffer.pos(-0.4, -0.4, 0).tex(0, 1).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
tessellator.addVertexWithUV(-0.4, 0.4, 0, 0, 0);
tessellator.addVertexWithUV(0.4, 0.4, 0, 1, 0);
tessellator.addVertexWithUV(0.4, -0.4, 0, 1, 1);
tessellator.addVertexWithUV(-0.4, -0.4, 0, 0, 1);
tessellator.draw();
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityBlackHole entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return texture;
}
@@ -1,24 +1,21 @@
package electroblob.wizardry.client.renderer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderBlank extends Render<Entity> {
public RenderBlank(RenderManager renderManager) {
super(renderManager);
}
public class RenderBlank extends Render {
@Override
public void doRender(Entity entity, double d0, double d1, double d2,
float f, float f1) {
// TODO Auto-generated method stub
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
// TODO Auto-generated method stub
return null;
}
@@ -1,103 +1,101 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.EntityBubble;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
public class RenderBubble extends Render<EntityBubble> {
public class RenderBubble extends Render {
private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png");
private static final ResourceLocation darkOrbTexture = new ResourceLocation("wizardry:textures/entity/dark_orb.png");
private static final ResourceLocation particleTextures = new ResourceLocation("textures/particle/particles.png");
private static final ResourceLocation darkOrbTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/dark_orb.png");
public RenderBubble(RenderManager renderManager) {
super(renderManager);
public RenderBubble() {
}
@Override
public void doRender(EntityBubble entity, double par2, double par4, double par6, float par8, float par9){
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float yOffset = 0;
if(WizardryUtilities.getRider(entity) != null){
yOffset = WizardryUtilities.getRider(entity).height/2;
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9)
{
if(entity instanceof EntityBubble){
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float yOffset = 0;
if(entity.riddenByEntity != null){
yOffset = entity.riddenByEntity.height/2;
}
GL11.glTranslatef((float)par2, (float)par4 + yOffset, (float)par6);
this.bindTexture(((EntityBubble)entity).isDarkOrb ? darkOrbTexture : particleTextures);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
if(((EntityBubble)entity).isDarkOrb){
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
}else{
int j = entity.getBrightnessForRender(par9);
int k = j % 65536;
int l = j / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// This counteracts the reverse rotation behaviour when in front f5 view.
// Fun fact: this is a bug with vanilla too! Look at a snowball in front f5 view, for example.
float yaw = Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? this.renderManager.playerViewX : -this.renderManager.playerViewX;
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(yaw, 1.0F, 0.0F, 0.0F);
float f11 = 3.0F;
GL11.glScalef(f11, f11, f11);
double pixelwidth = (1.0d/128);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
//tessellator.setColorRGBA_I(k1, 128);
tessellator.setNormal(0.0F, 1.0F, 0.0F);
if(((EntityBubble)entity).isDarkOrb){
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, 0, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, 1, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, 1, 0);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, 0, 0);
}else{
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.0D, pixelwidth, pixelwidth * 24);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.0D, pixelwidth*8, pixelwidth * 24);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.0D, pixelwidth*8, pixelwidth * 17);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.0D, pixelwidth, pixelwidth * 17);
}
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
if(((EntityBubble)entity).isDarkOrb){
GL11.glEnable(GL11.GL_LIGHTING);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
GlStateManager.translate((float)par2, (float)par4 + yOffset, (float)par6);
this.bindTexture(((EntityBubble)entity).isDarkOrb ? darkOrbTexture : particleTextures);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
if(((EntityBubble)entity).isDarkOrb){
GlStateManager.disableLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
}else{
int j = entity.getBrightnessForRender(par9);
int k = j % 65536;
int l = j / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
}
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
// This counteracts the reverse rotation behaviour when in front f5 view.
// Fun fact: this is a bug with vanilla too! Look at a snowball in front f5 view, for example.
float yaw = Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? this.renderManager.playerViewX : -this.renderManager.playerViewX;
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(yaw, 1.0F, 0.0F, 0.0F);
float f11 = 3.0F;
GlStateManager.scale(f11, f11, f11);
double pixelwidth = (1.0d/128);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
//tessellator.setColorRGBA_I(k1, 128);
//buffer.normal(0.0F, 1.0F, 0.0F);
if(((EntityBubble)entity).isDarkOrb){
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.0D).tex(0, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.0D).tex(1, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.0D).tex(1, 0).endVertex();
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.0D).tex(0, 0).endVertex();
}else{
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.0D).tex(pixelwidth, pixelwidth * 24).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.0D).tex(pixelwidth*8, pixelwidth * 24).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.0D).tex(pixelwidth*8, pixelwidth * 17).endVertex();
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.0D).tex(pixelwidth, pixelwidth * 17).endVertex();
}
tessellator.draw();
GlStateManager.disableBlend();
if(((EntityBubble)entity).isDarkOrb){
GlStateManager.enableLighting();
}
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
}
}
@Override
protected ResourceLocation getEntityTexture(EntityBubble entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
@@ -1,73 +1,73 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.EntityDecay;
import net.minecraft.client.renderer.GlStateManager;
import electroblob.wizardry.entity.construct.EntityHealAura;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderDecay extends Render<EntityDecay> {
public class RenderDecay extends Render {
private static final ResourceLocation[] textures = new ResourceLocation[10];
public RenderDecay(RenderManager renderManager){
super(renderManager);
public RenderDecay(){
for(int i=0;i<10;i++){
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/decay_" + i + ".png");
textures[i] = new ResourceLocation("wizardry:textures/entity/decay_" + i + ".png");
}
}
@Override
public void doRender(EntityDecay entity, double par2, double par4, double par6, float par8, float par9){
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9){
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float yOffset = 0;
GlStateManager.translate((float)par2, (float)par4 + yOffset, (float)par6);
if(entity.riddenByEntity != null){
yOffset = entity.riddenByEntity.height/2;
}
GL11.glTranslatef((float)par2, (float)par4 + yOffset, (float)par6);
this.bindTexture(textures[((EntityDecay)entity).textureIndex]);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GlStateManager.rotate(-90, 1, 0, 0);
GL11.glRotatef(-90, 1, 0, 0);
float scale = 2*Math.min(1, (float)(EntityDecay.LIFETIME - entity.ticksExisted)/50f);
GlStateManager.scale(scale, scale, scale);
GL11.glScalef(scale, scale, scale);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
//tessellator.setColorRGBA_I(k1, 128);
//buffer.normal(0.0F, 1.0F, 0.0F);
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.01).tex(1, 0).endVertex();
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.01).tex(0, 0).endVertex();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.draw();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityDecay entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
@@ -1,108 +1,498 @@
package electroblob.wizardry.client.renderer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.UUID;
import electroblob.wizardry.Wizardry;
import org.lwjgl.opengl.GL11;
import com.mojang.authlib.GameProfile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.client.model.ModelWizard;
import electroblob.wizardry.entity.living.EntityDecoy;
import electroblob.wizardry.entity.living.EntityEvilWizard;
import electroblob.wizardry.entity.living.EntityWizard;
import net.minecraft.block.Block;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.util.StringUtils;
// TODO: Backport the rewrite of this entire class.
@SideOnly(Side.CLIENT)
public class RenderDecoy extends RenderBiped<EntityDecoy> {
private static final ResourceLocation steveTextures = new ResourceLocation("textures/entity/steve.png");
private static final Method getEntityTexture = ReflectionHelper.findMethod(Render.class, null,
new String[]{"getEntityTexture", "func_110775_a"}, Entity.class); // Generic parameter T is erased to Entity at runtime.
public RenderDecoy(RenderManager manager){
super(manager, new ModelBiped(0.0f), 0.5f);
}
@Override
public void doRender(EntityDecoy entity, double x, double y, double z, float entityYaw, float partialTicks) {
if(entity.getCaster() != null){
this.renderName(entity, x, y, z);
// Save relevant animation fields from the caster to local variables
float pitch = entity.getCaster().rotationPitch;
float prevPitch = entity.getCaster().prevRotationPitch;
float swing = entity.getCaster().swingProgress;
float prevSwing = entity.getCaster().prevSwingProgress;
float yawOffset = entity.getCaster().renderYawOffset;
float prevYawOffset = entity.getCaster().prevRenderYawOffset;
float yaw = entity.getCaster().rotationYawHead;
float prevYaw = entity.getCaster().prevRotationYawHead;
float limbSwing = entity.getCaster().limbSwing;
float limbSwingAmount = entity.getCaster().limbSwingAmount;
float prevLimbSwingAmount = entity.getCaster().prevLimbSwingAmount;
int hurtTime = entity.getCaster().hurtTime;
boolean sneak = entity.getCaster().isSneaking();
Entity mount = entity.getCaster().getRidingEntity();
// Assign decoy's animation fields to the caster
entity.getCaster().rotationPitch = entity.rotationPitch;
entity.getCaster().prevRotationPitch = entity.prevRotationPitch;
entity.getCaster().swingProgress = entity.swingProgress;
entity.getCaster().prevSwingProgress = entity.prevSwingProgress;
entity.getCaster().renderYawOffset = entity.renderYawOffset;
entity.getCaster().prevRenderYawOffset = entity.prevRenderYawOffset;
entity.getCaster().rotationYawHead = entity.rotationYawHead;
entity.getCaster().prevRotationYawHead = entity.prevRotationYawHead;
entity.getCaster().limbSwing = entity.limbSwing;
entity.getCaster().limbSwingAmount = entity.limbSwingAmount;
entity.getCaster().prevLimbSwingAmount = entity.prevLimbSwingAmount;
entity.getCaster().hurtTime = entity.hurtTime;
entity.getCaster().setSneaking(false); // Decoys can't sneak FIXME Not working!
entity.getCaster().dismountRidingEntity(); // Decoys can't ride anything
// Do the rendering
renderManager.getEntityRenderObject(entity.getCaster()).doRender(entity.getCaster(), x, y, z, entityYaw, partialTicks);
// Reset caster's animation fields to their original values
entity.getCaster().rotationPitch = pitch;
entity.getCaster().prevRotationPitch = prevPitch;
entity.getCaster().swingProgress = swing;
entity.getCaster().prevSwingProgress = prevSwing;
entity.getCaster().renderYawOffset = yawOffset;
entity.getCaster().prevRenderYawOffset = prevYawOffset;
entity.getCaster().rotationYawHead = yaw;
entity.getCaster().prevRotationYawHead = prevYaw;
entity.getCaster().limbSwing = limbSwing;
entity.getCaster().limbSwingAmount = limbSwingAmount;
entity.getCaster().prevLimbSwingAmount = prevLimbSwingAmount;
entity.getCaster().hurtTime = hurtTime;
entity.getCaster().setSneaking(sneak);
if(mount != null) entity.getCaster().startRiding(mount);
}else{
super.doRender(entity, x, y, z, entityYaw, partialTicks);
}
}
@Override
protected ResourceLocation getEntityTexture(EntityDecoy entity){
if(entity.getCaster() != null){
try {
return (ResourceLocation)getEntityTexture.invoke(renderManager.getEntityRenderObject(entity.getCaster()));
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | ClassCastException e){
Wizardry.logger.error("Error while reflectively calling Render#getEntityTexture as part of decoy rendering");
e.printStackTrace();
}
}
// Fallback to steve textures
return steveTextures;
}
public class RenderDecoy extends RenderBiped
{
private static final ResourceLocation steveTextures = new ResourceLocation("textures/entity/steve.png");
public ModelBiped modelBipedMain;
public ModelBiped modelArmorChestplate;
public ModelBiped modelArmor;
public ModelWizard modelWizard;
public RenderDecoy()
{
super(new ModelBiped(0.0F), 0.5F);
this.modelBipedMain = (ModelBiped)this.mainModel;
this.modelArmorChestplate = new ModelBiped(1.0F);
this.modelArmor = new ModelBiped(0.5F);
this.modelWizard = new ModelWizard();
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityDecoy decoy, int pass, float partialTickTime)
{
if(decoy.getCaster() instanceof EntityPlayer){
ItemStack itemstack = ((AbstractClientPlayer)decoy.getCaster()).inventory.armorItemInSlot(3 - pass);
if (itemstack != null)
{
Item item = itemstack.getItem();
if (item instanceof ItemArmor)
{
ItemArmor itemarmor = (ItemArmor)item;
this.bindTexture(RenderBiped.getArmorResource(decoy, itemstack, pass, null));
ModelBiped modelbiped = pass == 2 ? this.modelArmor : this.modelArmorChestplate;
modelbiped.bipedHead.showModel = pass == 0;
modelbiped.bipedHeadwear.showModel = pass == 0;
modelbiped.bipedBody.showModel = pass == 1 || pass == 2;
modelbiped.bipedRightArm.showModel = pass == 1;
modelbiped.bipedLeftArm.showModel = pass == 1;
modelbiped.bipedRightLeg.showModel = pass == 2 || pass == 3;
modelbiped.bipedLeftLeg.showModel = pass == 2 || pass == 3;
modelbiped = net.minecraftforge.client.ForgeHooksClient.getArmorModel(decoy, itemstack, pass, modelbiped);
this.setRenderPassModel(modelbiped);
modelbiped.onGround = this.mainModel.onGround;
modelbiped.isRiding = this.mainModel.isRiding;
modelbiped.isChild = this.mainModel.isChild;
//Move outside if to allow for more then just CLOTH
int j = itemarmor.getColor(itemstack);
if (j != -1)
{
float f1 = (float)(j >> 16 & 255) / 255.0F;
float f2 = (float)(j >> 8 & 255) / 255.0F;
float f3 = (float)(j & 255) / 255.0F;
GL11.glColor3f(f1, f2, f3);
if (itemstack.isItemEnchanted())
{
return 31;
}
return 16;
}
GL11.glColor3f(1.0F, 1.0F, 1.0F);
if (itemstack.isItemEnchanted())
{
return 15;
}
return 1;
}
}
}else{
return super.shouldRenderPass(decoy.getCaster(), pass, partialTickTime);
}
return -1;
}
protected void func_82408_c(EntityDecoy decoy, int p_82408_2_, float p_82408_3_)
{
ItemStack itemstack = ((AbstractClientPlayer)decoy.getCaster()).inventory.armorItemInSlot(3 - p_82408_2_);
if (itemstack != null)
{
Item item = itemstack.getItem();
if (item instanceof ItemArmor)
{
this.bindTexture(RenderBiped.getArmorResource(decoy, itemstack, p_82408_2_, "overlay"));
GL11.glColor3f(1.0F, 1.0F, 1.0F);
}
}
}
public void doRender(EntityDecoy decoy, double x, double y, double z, float yaw, float pitch)
{
if(decoy.getCaster() instanceof EntityPlayer){
this.mainModel = this.modelBipedMain;
GL11.glColor3f(1.0F, 1.0F, 1.0F);
ItemStack itemstack = ((AbstractClientPlayer)decoy.getCaster()).inventory.getCurrentItem();
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = itemstack != null ? 1 : 0;
if (itemstack != null && ((AbstractClientPlayer)decoy.getCaster()).getItemInUseCount() > 0)
{
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.block)
{
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 3;
}
else if (enumaction == EnumAction.bow)
{
this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = true;
}
}
this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = decoy.isSneaking();
double d3 = y - (double)decoy.yOffset;
super.doRender((EntityLivingBase)decoy, x, d3, z, yaw, pitch);
this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false;
this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false;
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0;
}else{
this.mainModel = this.modelWizard;
// Since wizards always have a wand, I don't see any point in checking
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 1;
super.doRender(decoy, x, y, z, yaw, pitch);
}
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntityDecoy decoy)
{
//System.out.println(decoy.getCaster());
if(decoy.getCaster() instanceof EntityWizard){
return RenderWizard.textures[((EntityWizard)decoy.getCaster()).textureIndex];
}else if(decoy.getCaster() instanceof EntityEvilWizard){
return RenderEvilWizard.textures[((EntityEvilWizard)decoy.getCaster()).textureIndex];
}else if(decoy.getCaster() instanceof EntityPlayer){
return ((AbstractClientPlayer) decoy.getCaster()).getLocationSkin();
}else{
return steveTextures;
}
}
protected void renderEquippedItems(EntityDecoy decoy, float p_77029_2_)
{
if(decoy.getCaster() instanceof EntityPlayer){
GL11.glColor3f(1.0F, 1.0F, 1.0F);
super.renderEquippedItems(decoy, p_77029_2_);
super.renderArrowsStuckInEntity(decoy, p_77029_2_);
ItemStack itemstack = ((AbstractClientPlayer)decoy.getCaster()).inventory.armorItemInSlot(3);
if (itemstack != null)
{
GL11.glPushMatrix();
this.modelBipedMain.bipedHead.postRender(0.0625F);
float f1;
if (itemstack.getItem() instanceof ItemBlock)
{
net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));
if (is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType()))
{
f1 = 0.625F;
GL11.glTranslatef(0.0F, -0.25F, 0.0F);
GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f1, -f1, -f1);
}
this.renderManager.itemRenderer.renderItem(decoy, itemstack, 0);
}
else if (itemstack.getItem() == Items.skull)
{
f1 = 1.0625F;
GL11.glScalef(f1, -f1, -f1);
GameProfile gameprofile = null;
if (itemstack.hasTagCompound())
{
NBTTagCompound nbttagcompound = itemstack.getTagCompound();
if (nbttagcompound.hasKey("SkullOwner", 10))
{
gameprofile = NBTUtil.func_152459_a(nbttagcompound.getCompoundTag("SkullOwner"));
}
else if (nbttagcompound.hasKey("SkullOwner", 8) && !StringUtils.isNullOrEmpty(nbttagcompound.getString("SkullOwner")))
{
gameprofile = new GameProfile((UUID)null, nbttagcompound.getString("SkullOwner"));
}
}
TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, 0.0F, -0.5F, 1, 180.0F, itemstack.getItemDamage(), gameprofile);
}
GL11.glPopMatrix();
}
float f2;
if (decoy.getCommandSenderName().equals("deadmau5") && ((AbstractClientPlayer)decoy.getCaster()).func_152123_o())
{
this.bindTexture(((AbstractClientPlayer)decoy.getCaster()).getLocationSkin());
for (int j = 0; j < 2; ++j)
{
float f9 = decoy.prevRotationYaw + (decoy.rotationYaw - decoy.prevRotationYaw) * p_77029_2_ - (decoy.prevRenderYawOffset + (decoy.renderYawOffset - decoy.prevRenderYawOffset) * p_77029_2_);
float f10 = decoy.prevRotationPitch + (decoy.rotationPitch - decoy.prevRotationPitch) * p_77029_2_;
GL11.glPushMatrix();
GL11.glRotatef(f9, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(f10, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.375F * (float)(j * 2 - 1), 0.0F, 0.0F);
GL11.glTranslatef(0.0F, -0.375F, 0.0F);
GL11.glRotatef(-f10, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-f9, 0.0F, 1.0F, 0.0F);
f2 = 1.3333334F;
GL11.glScalef(f2, f2, f2);
this.modelBipedMain.renderEars(0.0625F);
GL11.glPopMatrix();
}
}
boolean flag = ((AbstractClientPlayer)decoy.getCaster()).func_152122_n();
float f4;
if (flag && !decoy.isInvisible() && !((AbstractClientPlayer)decoy.getCaster()).getHideCape())
{
this.bindTexture(((AbstractClientPlayer)decoy.getCaster()).getLocationCape());
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 0.0F, 0.125F);
double d3 = ((AbstractClientPlayer)decoy.getCaster()).field_71091_bM + (((AbstractClientPlayer)decoy.getCaster()).field_71094_bP - ((AbstractClientPlayer)decoy.getCaster()).field_71091_bM) * (double)p_77029_2_ - (decoy.prevPosX + (decoy.posX - decoy.prevPosX) * (double)p_77029_2_);
double d4 = ((AbstractClientPlayer)decoy.getCaster()).field_71096_bN + (((AbstractClientPlayer)decoy.getCaster()).field_71095_bQ - ((AbstractClientPlayer)decoy.getCaster()).field_71096_bN) * (double)p_77029_2_ - (decoy.prevPosY + (decoy.posY - decoy.prevPosY) * (double)p_77029_2_);
double d0 = ((AbstractClientPlayer)decoy.getCaster()).field_71097_bO + (((AbstractClientPlayer)decoy.getCaster()).field_71085_bR - ((AbstractClientPlayer)decoy.getCaster()).field_71097_bO) * (double)p_77029_2_ - (decoy.prevPosZ + (decoy.posZ - decoy.prevPosZ) * (double)p_77029_2_);
f4 = decoy.prevRenderYawOffset + (decoy.renderYawOffset - decoy.prevRenderYawOffset) * p_77029_2_;
double d1 = (double)MathHelper.sin(f4 * (float)Math.PI / 180.0F);
double d2 = (double)(-MathHelper.cos(f4 * (float)Math.PI / 180.0F));
float f5 = (float)d4 * 10.0F;
if (f5 < -6.0F)
{
f5 = -6.0F;
}
if (f5 > 32.0F)
{
f5 = 32.0F;
}
float f6 = (float)(d3 * d1 + d0 * d2) * 100.0F;
float f7 = (float)(d3 * d2 - d0 * d1) * 100.0F;
if (f6 < 0.0F)
{
f6 = 0.0F;
}
float f8 = ((AbstractClientPlayer)decoy.getCaster()).prevCameraYaw + (((AbstractClientPlayer)decoy.getCaster()).cameraYaw - ((AbstractClientPlayer)decoy.getCaster()).prevCameraYaw) * p_77029_2_;
f5 += MathHelper.sin((decoy.prevDistanceWalkedModified + (decoy.distanceWalkedModified - decoy.prevDistanceWalkedModified) * p_77029_2_) * 6.0F) * 32.0F * f8;
if (decoy.isSneaking())
{
f5 += 25.0F;
}
GL11.glRotatef(6.0F + f6 / 2.0F + f5, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(f7 / 2.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-f7 / 2.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
this.modelBipedMain.renderCloak(0.0625F);
GL11.glPopMatrix();
}
ItemStack itemstack1 = ((AbstractClientPlayer)decoy.getCaster()).inventory.getCurrentItem();
if (itemstack1 != null)
{
GL11.glPushMatrix();
this.modelBipedMain.bipedRightArm.postRender(0.0625F);
GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
EnumAction enumaction = null;
if (((AbstractClientPlayer)decoy.getCaster()).getItemInUseCount() > 0)
{
enumaction = itemstack1.getItemUseAction();
}
net.minecraftforge.client.IItemRenderer customRenderer = net.minecraftforge.client.MinecraftForgeClient.getItemRenderer(itemstack1, net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED, itemstack1, net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D));
if (is3D || itemstack1.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack1.getItem()).getRenderType()))
{
f2 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
f2 *= 0.75F;
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-f2, -f2, f2);
}
else if (itemstack1.getItem() == Items.bow)
{
f2 = 0.625F;
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else if (itemstack1.getItem().isFull3D())
{
f2 = 0.625F;
if (itemstack1.getItem().shouldRotateAroundWhenRendering())
{
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
}
if (((AbstractClientPlayer)decoy.getCaster()).getItemInUseCount() > 0 && enumaction == EnumAction.block)
{
GL11.glTranslatef(0.05F, 0.0F, -0.1F);
GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-10.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-60.0F, 0.0F, 0.0F, 1.0F);
}
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
GL11.glScalef(f2, -f2, f2);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else
{
f2 = 0.375F;
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
GL11.glScalef(f2, f2, f2);
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
}
float f3;
int k;
float f12;
if (itemstack1.getItem().requiresMultipleRenderPasses())
{
for (k = 0; k < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k)
{
int i = itemstack1.getItem().getColorFromItemStack(itemstack1, k);
f12 = (float)(i >> 16 & 255) / 255.0F;
f3 = (float)(i >> 8 & 255) / 255.0F;
f4 = (float)(i & 255) / 255.0F;
GL11.glColor4f(f12, f3, f4, 1.0F);
this.renderManager.itemRenderer.renderItem(decoy, itemstack1, k);
}
}
else
{
k = itemstack1.getItem().getColorFromItemStack(itemstack1, 0);
float f11 = (float)(k >> 16 & 255) / 255.0F;
f12 = (float)(k >> 8 & 255) / 255.0F;
f3 = (float)(k & 255) / 255.0F;
GL11.glColor4f(f11, f12, f3, 1.0F);
this.renderManager.itemRenderer.renderItem(decoy, itemstack1, 0);
}
GL11.glPopMatrix();
}
}else{
super.renderEquippedItems(decoy, p_77029_2_);
}
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityDecoy p_77041_1_, float p_77041_2_)
{
float f1 = 0.9375F;
GL11.glScalef(f1, f1, f1);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase p_77041_1_, float p_77041_2_)
{
this.preRenderCallback((EntityDecoy)p_77041_1_, p_77041_2_);
}
protected void func_82408_c(EntityLivingBase p_82408_1_, int p_82408_2_, float p_82408_3_)
{
this.func_82408_c((EntityDecoy)p_82408_1_, p_82408_2_, p_82408_3_);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_)
{
return this.shouldRenderPass((EntityDecoy)p_77032_1_, p_77032_2_, p_77032_3_);
}
protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_)
{
this.renderEquippedItems((EntityDecoy)p_77029_1_, p_77029_2_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityDecoy)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntityDecoy)p_110775_1_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityDecoy)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}
@@ -1,34 +1,115 @@
package electroblob.wizardry.client.renderer;
import electroblob.wizardry.Wizardry;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.client.model.ModelWizard;
import electroblob.wizardry.entity.living.EntityEvilWizard;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderEvilWizard extends RenderBiped<EntityEvilWizard>
public class RenderEvilWizard extends RenderBiped
{
static final ResourceLocation[] textures = new ResourceLocation[6];
public RenderEvilWizard(RenderManager renderManager){
super(renderManager, new ModelWizard(), 0.5F);
/** Model of the EvilWizard. */
protected ModelWizard villagerModel;
public RenderEvilWizard()
{
super(new ModelWizard(), 0.5F);
this.villagerModel = (ModelWizard)this.mainModel;
for(int i=0;i<6;i++){
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/evil_wizard_" + i + ".png");
textures[i] = new ResourceLocation("wizardry:textures/entity/evil_wizard_" + i + ".png");
}
// Just using the default without overriding models, since the armour sets its own model anyway.
this.addLayer(new LayerBipedArmor(this));
}
@Override
protected ResourceLocation getEntityTexture(EntityEvilWizard wizard) {
return textures[wizard.textureIndex];
}
/**
* Determines wether Villager Render pass or not.
*/
protected int shouldVillagerRenderPass(EntityEvilWizard par1EntityEvilWizard, int par2, float par3)
{
return -1;
}
public void renderVillager(EntityEvilWizard par1EntityEvilWizard, double par2, double par4, double par6, float par8, float par9)
{
super.doRender(par1EntityEvilWizard, par2, par4, par6, par8, par9);
}
protected ResourceLocation func_110902_a(EntityEvilWizard par1EntityEvilWizard)
{
return textures[par1EntityEvilWizard.textureIndex];
}
protected void renderVillagerEquipedItems(EntityEvilWizard par1EntityEvilWizard, float par2)
{
super.renderEquippedItems(par1EntityEvilWizard, par2);
}
protected void preRenderVillager(EntityEvilWizard par1EntityEvilWizard, float par2)
{
float f1 = 0.9375F;
this.shadowSize = 0.5F;
GL11.glScalef(f1, f1, f1);
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.renderVillager((EntityEvilWizard)par1EntityLiving, par2, par4, par6, par8, par9);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.preRenderVillager((EntityEvilWizard)par1EntityLivingBase, par2);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3)
{
// TODO: Is this the right method name now? There are several with correct parameters. This one may end up being recursive!
return this.shouldRenderPass((EntityLiving)par1EntityLivingBase, par2, par3);
//return this.shouldVillagerRenderPass((EntityEvilWizard)par1EntityLivingBase, par2, par3);
}
protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2)
{
this.renderVillagerEquipedItems((EntityEvilWizard)par1EntityLivingBase, par2);
}
public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
this.renderVillager((EntityEvilWizard)par1EntityLivingBase, par2, par4, par6, par8, par9);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.func_110902_a((EntityEvilWizard)par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderVillager((EntityEvilWizard)par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -0,0 +1,74 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAnvil;
import net.minecraft.block.BlockDragonEgg;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderFallingBlock;
import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.init.Blocks;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
public class RenderFallingGrass extends RenderFallingBlock {
private RenderBlocks renderBlocks = new RenderBlocks();
@Override
public void doRender(EntityFallingBlock p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
World world = p_76986_1_.func_145807_e();
Block block = Blocks.grass;
int i = MathHelper.floor_double(p_76986_1_.posX);
int j = MathHelper.floor_double(p_76986_1_.posY);
int k = MathHelper.floor_double(p_76986_1_.posZ);
if (block != null && block != world.getBlock(i, j, k))
{
GL11.glPushMatrix();
GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
this.bindEntityTexture(p_76986_1_);
GL11.glDisable(GL11.GL_LIGHTING);
this.renderBlocks.setRenderBoundsFromBlock(block);
this.renderBlockSandFalling(block, world, i, j, k, p_76986_1_.field_145814_a);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}
private void renderBlockSandFalling(Block block, World world, int x, int y, int z, int metadata)
{
float f = 0.5F;
float f1 = 1.0F;
float f2 = 0.8F;
float f3 = 0.6F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z));
tessellator.setColorOpaque_F(f, f, f);
this.renderBlocks.renderFaceYNeg(block, -0.5D, -0.5D, -0.5D, this.renderBlocks.getBlockIconFromSideAndMetadata(block, 0, metadata));
int colour = world.getBiomeGenForCoords(x, z).getBiomeGrassColor(x, y, z);
float r = (float)(colour >> 16 & 255) / 255.0F;
float g = (float)(colour >> 8 & 255) / 255.0F;
float b = (float)(colour & 255) / 255.0F;
tessellator.setColorOpaque_F(f1*r, f1*g, f1*b);
this.renderBlocks.renderFaceYPos(block, -0.5D, -0.5D, -0.5D, this.renderBlocks.getBlockIconFromSideAndMetadata(block, 1, metadata));
tessellator.setColorOpaque_F(f2, f2, f2);
this.renderBlocks.renderFaceZNeg(block, -0.5D, -0.5D, -0.5D, this.renderBlocks.getBlockIconFromSideAndMetadata(block, 2, metadata));
tessellator.setColorOpaque_F(f2, f2, f2);
this.renderBlocks.renderFaceZPos(block, -0.5D, -0.5D, -0.5D, this.renderBlocks.getBlockIconFromSideAndMetadata(block, 3, metadata));
tessellator.setColorOpaque_F(f3, f3, f3);
this.renderBlocks.renderFaceXNeg(block, -0.5D, -0.5D, -0.5D, this.renderBlocks.getBlockIconFromSideAndMetadata(block, 4, metadata));
tessellator.setColorOpaque_F(f3, f3, f3);
this.renderBlocks.renderFaceXPos(block, -0.5D, -0.5D, -0.5D, this.renderBlocks.getBlockIconFromSideAndMetadata(block, 5, metadata));
tessellator.draw();
}
}
@@ -1,102 +1,109 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import javax.swing.Icon;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.entity.construct.EntityFireRing;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
public class RenderFireRing extends Render<EntityFireRing> {
public class RenderFireRing extends Render {
private final ResourceLocation texture;
private float scale = 1.0f;
public RenderFireRing(RenderManager renderManager, ResourceLocation texture, float scale) {
super(renderManager);
public RenderFireRing(ResourceLocation texture, float scale) {
this.texture = texture;
this.scale = scale;
}
@Override
public void doRender(EntityFireRing entity, double par2, double par4, double par6, float par8, float par9){
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9){
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float yOffset = 0;
GlStateManager.translate((float)par2, (float)par4 + yOffset, (float)par6);
if(entity.riddenByEntity != null){
yOffset = entity.riddenByEntity.height/2;
}
GL11.glTranslatef((float)par2, (float)par4 + yOffset, (float)par6);
this.bindTexture(texture);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GlStateManager.rotate(-90, 1, 0, 0);
GL11.glRotatef(-90, 1, 0, 0);
GlStateManager.scale(scale, scale, scale);
GL11.glScalef(scale, scale, scale);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.01).tex(1, 0).endVertex();
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.01).tex(0, 0).endVertex();
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
//tessellator.setColorRGBA_I(k1, 128);
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.draw();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
// Fire
GlStateManager.disableLighting();
TextureAtlasSprite icon = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(Blocks.FIRE.getDefaultState()).getParticleTexture();
GL11.glDisable(GL11.GL_LIGHTING);
IIcon icon = Blocks.fire.getFireIcon(0);
IIcon icon1 = Blocks.fire.getFireIcon(1);
int sides = 16;
float height = 1.0f;
for(int k=0; k<sides; k++){
GlStateManager.pushMatrix();
GlStateManager.translate((float)par2, (float)par4 + 0.05f, (float)par6);
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4 + 0.05f, (float)par6);
float f1 = 1.0f;
GlStateManager.scale(f1, f1, f1);
GL11.glScalef(f1, f1, f1);
float f2 = 0.5F;
float f3 = 0.0F;
float f4 = 0.2f;
float f5 = (float)(entity.posY - entity.getEntityBoundingBox().minY);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float f5 = (float)(entity.posY - entity.boundingBox.minY);
//GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
//GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)f4) * 0.02F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f61 = 0.0F;
int i = 0;
GlStateManager.rotate((360f/(float)sides)*k, 0, 1, 0);
GlStateManager.translate(0, 0, -2.3f);
GL11.glRotatef((360f/(float)sides)*k, 0, 1, 0);
GL11.glTranslatef(0, 0, -2.3f);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.startDrawingQuads();
while (f4 > 0.0F){
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float f71 = icon.getMinU();
float f81 = icon.getMinV();
float f9 = icon.getMaxU();
float f10 = icon.getMaxV();
while (f4 > 0.0F)
{
IIcon icon2 = i % 2 == 0 ? icon : icon1;
this.bindTexture(TextureMap.locationBlocksTexture);
float f71 = icon2.getMinU();
float f81 = icon2.getMinV();
float f9 = icon2.getMaxU();
float f10 = icon2.getMaxV();
if (i / 2 % 2 == 0)
{
@@ -105,10 +112,10 @@ public class RenderFireRing extends Render<EntityFireRing> {
f71 = f11;
}
buffer.pos((double)(f2 - f3), (double)(0.0F - f5), (double)f61).tex((double)f9, (double)f10).endVertex();
buffer.pos((double)(-f2 - f3), (double)(0.0F - f5), (double)f61).tex((double)f71, (double)f10).endVertex();
buffer.pos((double)(-f2 - f3), (double)(height - f5), (double)f61).tex((double)f71, (double)f81).endVertex();
buffer.pos((double)(f2 - f3), (double)(height - f5), (double)f61).tex((double)f9, (double)f81).endVertex();
tessellator.addVertexWithUV((double)(f2 - f3), (double)(0.0F - f5), (double)f61, (double)f9, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(0.0F - f5), (double)f61, (double)f71, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(height - f5), (double)f61, (double)f71, (double)f81);
tessellator.addVertexWithUV((double)(f2 - f3), (double)(height - f5), (double)f61, (double)f9, (double)f81);
f4 -= 0.45F;
f5 -= 0.45F;
f2 *= 0.9F;
@@ -117,35 +124,38 @@ public class RenderFireRing extends Render<EntityFireRing> {
}
tessellator.draw();
GlStateManager.popMatrix();
GL11.glPopMatrix();
}
for(int k=0; k<sides; k++){
GlStateManager.pushMatrix();
GlStateManager.translate((float)par2, (float)par4 + 0.05f, (float)par6);
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4 + 0.05f, (float)par6);
float f1 = 1.0f;
GlStateManager.scale(f1, f1, f1);
GL11.glScalef(f1, f1, f1);
float f2 = 0.5F;
float f3 = 0.0F;
float f4 = 0.2f;
float f5 = (float)(entity.posY - entity.getEntityBoundingBox().minY);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float f5 = (float)(entity.posY - entity.boundingBox.minY);
//GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
//GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)f4) * 0.02F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f61 = 0.0F;
int i = 0;
GlStateManager.rotate((360f/(float)sides)*k, 0, 1, 0);
GlStateManager.translate(0, 0, 2.3f);
GL11.glRotatef((360f/(float)sides)*k, 0, 1, 0);
GL11.glTranslatef(0, 0, 2.3f);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
tessellator.startDrawingQuads();
while (f4 > 0.0F){
this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
float f71 = icon.getMinU();
float f81 = icon.getMinV();
float f9 = icon.getMaxU();
float f10 = icon.getMaxV();
while (f4 > 0.0F)
{
IIcon icon2 = i % 2 == 0 ? icon : icon1;
this.bindTexture(TextureMap.locationBlocksTexture);
float f71 = icon2.getMinU();
float f81 = icon2.getMinV();
float f9 = icon2.getMaxU();
float f10 = icon2.getMaxV();
if (i / 2 % 2 == 0)
{
@@ -154,10 +164,10 @@ public class RenderFireRing extends Render<EntityFireRing> {
f71 = f11;
}
buffer.pos((double)(f2 - f3), (double)(0.0F - f5), (double)f61).tex((double)f9, (double)f10).endVertex();
buffer.pos((double)(-f2 - f3), (double)(0.0F - f5), (double)f61).tex((double)f71, (double)f10).endVertex();
buffer.pos((double)(-f2 - f3), (double)(height - f5), (double)f61).tex((double)f71, (double)f81).endVertex();
buffer.pos((double)(f2 - f3), (double)(height - f5), (double)f61).tex((double)f9, (double)f81).endVertex();
tessellator.addVertexWithUV((double)(f2 - f3), (double)(0.0F - f5), (double)f61, (double)f9, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(0.0F - f5), (double)f61, (double)f71, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(height - f5), (double)f61, (double)f71, (double)f81);
tessellator.addVertexWithUV((double)(f2 - f3), (double)(height - f5), (double)f61, (double)f9, (double)f81);
f4 -= 0.45F;
f5 -= 0.45F;
f2 *= 0.9F;
@@ -166,14 +176,14 @@ public class RenderFireRing extends Render<EntityFireRing> {
}
tessellator.draw();
GlStateManager.popMatrix();
GL11.glPopMatrix();
}
GlStateManager.enableLighting();
GL11.glEnable(GL11.GL_LIGHTING);
}
@Override
protected ResourceLocation getEntityTexture(EntityFireRing entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
@@ -0,0 +1,205 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
public class RenderFirestorm extends Render {
private final ResourceLocation texture;
private float scale = 1.0f;
public RenderFirestorm(ResourceLocation texture, float scale) {
this.texture = texture;
this.scale = scale;
}
@Override
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9){
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(-entity.rotationYaw, 0, 1, 0);
GL11.glRotatef(entity.rotationPitch, 1, 0, 0);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.bindTexture(texture);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
//GL11.glRotatef(-90, 1, 0, 0);
GL11.glScalef(scale, scale, scale);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.draw();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
//GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
// Fire
GL11.glDisable(GL11.GL_LIGHTING);
IIcon icon = Blocks.fire.getFireIcon(0);
IIcon icon1 = Blocks.fire.getFireIcon(1);
int sides = 16;
float height = 2.0f;
for(int k=0; k<sides; k++){
GL11.glPushMatrix();
//GL11.glTranslatef((float)par2, (float)par4 + 0.05f, (float)par6);
GL11.glScalef(0.6f, 0.6f, 0.6f);
GL11.glRotatef(-90, 1, 0, 0);
float f2 = 0.5F;
float f3 = 0.0F;
float f4 = 0.2f;
float f5 = (float)(entity.posY - entity.boundingBox.minY);
//GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
//GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)f4) * 0.02F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f61 = 0.0F;
int i = 0;
GL11.glRotatef((360f/(float)sides)*k, 0, 1, 0);
GL11.glTranslatef(0, 0, -2.3f);
tessellator.startDrawingQuads();
while (f4 > 0.0F)
{
IIcon icon2 = i % 2 == 0 ? icon : icon1;
this.bindTexture(TextureMap.locationBlocksTexture);
float f71 = icon2.getMinU();
float f81 = icon2.getMinV();
float f9 = icon2.getMaxU();
float f10 = icon2.getMaxV();
if (i / 2 % 2 == 0)
{
float f11 = f9;
f9 = f71;
f71 = f11;
}
tessellator.addVertexWithUV((double)(f2 - f3), (double)(0.0F - f5), (double)f61, (double)f9, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(0.0F - f5), (double)f61, (double)f71, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(height - f5), (double)f61, (double)f71, (double)f81);
tessellator.addVertexWithUV((double)(f2 - f3), (double)(height - f5), (double)f61, (double)f9, (double)f81);
f4 -= 0.45F;
f5 -= 0.45F;
f2 *= 0.9F;
f61 += 0.03F;
++i;
}
tessellator.draw();
GL11.glPopMatrix();
}
for(int k=0; k<sides; k++){
GL11.glPushMatrix();
//GL11.glTranslatef((float)par2, (float)par4 + 0.05f, (float)par6);
GL11.glScalef(0.6f, 0.6f, 0.6f);
GL11.glRotatef(-90, 1, 0, 0);
float f2 = 0.5F;
float f3 = 0.0F;
float f4 = 0.2f;
float f5 = (float)(entity.posY - entity.boundingBox.minY);
//GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
//GL11.glTranslatef(0.0F, 0.0F, -0.3F + (float)((int)f4) * 0.02F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f61 = 0.0F;
int i = 0;
GL11.glRotatef((360f/(float)sides)*k, 0, 1, 0);
GL11.glTranslatef(0, 0, 2.3f);
tessellator.startDrawingQuads();
while (f4 > 0.0F)
{
IIcon icon2 = i % 2 == 0 ? icon : icon1;
this.bindTexture(TextureMap.locationBlocksTexture);
float f71 = icon2.getMinU();
float f81 = icon2.getMinV();
float f9 = icon2.getMaxU();
float f10 = icon2.getMaxV();
if (i / 2 % 2 == 0)
{
float f11 = f9;
f9 = f71;
f71 = f11;
}
tessellator.addVertexWithUV((double)(f2 - f3), (double)(0.0F - f5), (double)f61, (double)f9, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(0.0F - f5), (double)f61, (double)f71, (double)f10);
tessellator.addVertexWithUV((double)(-f2 - f3), (double)(height - f5), (double)f61, (double)f71, (double)f81);
tessellator.addVertexWithUV((double)(f2 - f3), (double)(height - f5), (double)f61, (double)f9, (double)f81);
f4 -= 0.45F;
f5 -= 0.45F;
f2 *= 0.9F;
f61 += 0.03F;
++i;
}
tessellator.draw();
GL11.glPopMatrix();
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
}
@@ -1,47 +1,44 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.projectile.EntityForceArrow;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.projectile.EntityMagicMissile;
@SideOnly(Side.CLIENT)
public class RenderForceArrow extends Render<EntityForceArrow>{
public class RenderForceArrow extends Render
{
private static final ResourceLocation arrowTextures = new ResourceLocation("wizardry:textures/entity/force_arrow.png");
private static final ResourceLocation arrowTextures = new ResourceLocation(Wizardry.MODID, "textures/entity/force_arrow.png");
public RenderForceArrow(RenderManager renderManager){
super(renderManager);
public RenderForceArrow(){
}
@Override
public void doRender(EntityForceArrow arrow, double par2, double par4, double par6, float par8, float par9){
this.bindEntityTexture(arrow);
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
public void renderArrow(Entity par1EntityArrow, double par2, double par4, double par6, float par8, float par9)
{
this.bindEntityTexture(par1EntityArrow);
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.translate((float)par2, (float)par4, (float)par6);
GlStateManager.rotate(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
GlStateManager.rotate(180, 0, 1, 0);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(180, 0, 1, 0);
Tessellator tessellator = Tessellator.instance;
float pixel = 1.0f/32.0f;
float u1 = 0.0f;
float u2 = pixel*14;
@@ -57,71 +54,89 @@ public class RenderForceArrow extends Render<EntityForceArrow>{
float v6 = 1.0f;
float scale = 0.05625F;
float f11 = 0.0f;
GlStateManager.enableRescaleNormal();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
//f11 = (float)par1EntityArrow.arrowShake - par9;
if (f11 > 0.0F)
{
float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
GlStateManager.rotate(f12, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
}
scale*=0.8f;
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(scale, scale, scale);
GlStateManager.translate(-4.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(scale, scale, scale);
GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-5, 3.5, -3.5).tex((double)u5, (double)v5).endVertex();
buffer.pos(-5, 3.5, 3.5).tex((double)u6, (double)v5).endVertex();
buffer.pos(-5, -3.5, 3.5).tex((double)u6, (double)v6).endVertex();
buffer.pos(-5, -3.5, -3.5).tex((double)u5, (double)v6);
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-5, 3.5, -3.5, (double)u5, (double)v5);
tessellator.addVertexWithUV(-5, 3.5, 3.5, (double)u6, (double)v5);
tessellator.addVertexWithUV(-5, -3.5, 3.5, (double)u6, (double)v6);
tessellator.addVertexWithUV(-5, -3.5, -3.5, (double)u5, (double)v6);
tessellator.draw();
for(int i=0; i<5; i++){
GlStateManager.color(1, 1, 1, 1 - i*0.2f);
double j = i + ((double)arrow.ticksExisted%3)/3;
GL11.glColor4f(1, 1, 1, 1 - i*0.2f);
double j = i + ((double)par1EntityArrow.ticksExisted%3)/3;
double width = 2.0d + (Math.sqrt(j*2)-0.6)*2;
GL11.glNormal3f(scale, 0.0F, 0.0F);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-10 + j*4, -width, -width).tex((double)u3, (double)v3).endVertex();
buffer.pos(-10 + j*4, -width, width).tex((double)u4, (double)v3).endVertex();
buffer.pos(-10 + j*4, width, width).tex((double)u4, (double)v4).endVertex();
buffer.pos(-10 + j*4, width, -width).tex((double)u3, (double)v4).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-10 + j*4, -width, -width, (double)u3, (double)v3);
tessellator.addVertexWithUV(-10 + j*4, -width, width, (double)u4, (double)v3);
tessellator.addVertexWithUV(-10 + j*4, width, width, (double)u4, (double)v4);
tessellator.addVertexWithUV(-10 + j*4, width, -width, (double)u3, (double)v4);
tessellator.draw();
GL11.glNormal3f(-scale, 0.0F, 0.0F);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-10 + j*4, width, -width).tex((double)u3, (double)v3).endVertex();
buffer.pos(-10 + j*4, width, width).tex((double)u4, (double)v3).endVertex();
buffer.pos(-10 + j*4, -width, width).tex((double)u4, (double)v4).endVertex();
buffer.pos(-10 + j*4, -width, -width).tex((double)u3, (double)v4).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-10 + j*4, width, -width, (double)u3, (double)v3);
tessellator.addVertexWithUV(-10 + j*4, width, width, (double)u4, (double)v3);
tessellator.addVertexWithUV(-10 + j*4, -width, width, (double)u4, (double)v4);
tessellator.addVertexWithUV(-10 + j*4, -width, -width, (double)u3, (double)v4);
tessellator.draw();
}
GlStateManager.color(1, 1, 1, 1);
GL11.glColor4f(1, 1, 1, 1);
for (int i = 0; i < 4; ++i)
{
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, scale);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-10.0D, -4.0D, 0.0D).tex((double)u1, (double)v1).endVertex();
buffer.pos(10.0D, -4.0D, 0.0D).tex((double)u2, (double)v1).endVertex();
buffer.pos(10.0D, 4.0D, 0.0D).tex((double)u2, (double)v2).endVertex();
buffer.pos(-10.0D, 4.0D, 0.0D).tex((double)u1, (double)v2).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-10.0D, -4.0D, 0.0D, (double)u1, (double)v1);
tessellator.addVertexWithUV(10.0D, -4.0D, 0.0D, (double)u2, (double)v1);
tessellator.addVertexWithUV(10.0D, 4.0D, 0.0D, (double)u2, (double)v2);
tessellator.addVertexWithUV(-10.0D, 4.0D, 0.0D, (double)u1, (double)v2);
tessellator.draw();
}
GlStateManager.disableBlend();
GL11.glDisable(GL11.GL_BLEND);
GlStateManager.disableRescaleNormal();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityForceArrow par1Entity)
protected ResourceLocation getArrowTextures(Entity par1Entity)
{
return arrowTextures;
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getArrowTextures(par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderArrow(par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -1,38 +1,37 @@
package electroblob.wizardry.client.renderer;
import electroblob.wizardry.Wizardry;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.client.model.ModelHammer;
import electroblob.wizardry.entity.construct.EntityHammer;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderHammer extends Render<EntityHammer> {
public class RenderHammer extends Render {
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/lightning_hammer.png");
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/entity/lightning_hammer.png");
private ModelHammer model = new ModelHammer();
public RenderHammer(RenderManager renderManager){
super(renderManager);
public RenderHammer(){
}
@Override
public void doRender(EntityHammer entity, double x, double y, double z, float f, float f1) {
public void doRender(Entity entity, double x, double y, double z, float f, float f1) {
GlStateManager.pushMatrix();
GlStateManager.translate(x, y+1.5, z);
GlStateManager.rotate(180, 0F, 0F, 1F);
GL11.glPushMatrix();
GL11.glTranslated(x, y+1.5, z);
GL11.glRotatef(180, 0F, 0F, 1F);
this.bindTexture(texture);
model.render(entity, 0, 0, 0, 0, 0, 0.0625f);
GlStateManager.popMatrix();
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityHammer entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return texture;
}
@@ -1,39 +1,104 @@
package electroblob.wizardry.client.renderer;
import electroblob.wizardry.Wizardry;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.client.model.ModelIceGiant;
import electroblob.wizardry.entity.living.EntityIceGiant;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderIceGiant extends RenderLiving<EntityIceGiant> {
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/ice_giant.png");
public class RenderIceGiant extends RenderLiving
{
private static final ResourceLocation iceGiantTextures = new ResourceLocation("wizardry:textures/entity/ice_giant.png");
public RenderIceGiant(RenderManager renderManager){
super(renderManager, new ModelIceGiant(), 0.5F);
/** Iron Golem's Model. */
private final ModelIceGiant iceGiantModel;
public RenderIceGiant()
{
super(new ModelIceGiant(), 0.5F);
this.iceGiantModel = (ModelIceGiant)this.mainModel;
}
@Override
protected ResourceLocation getEntityTexture(EntityIceGiant entity){
return texture;
}
@Override
protected void rotateCorpse(EntityIceGiant entityLiving, float pitch, float yaw, float partialTicks){
super.rotateCorpse(entityLiving, pitch, yaw, partialTicks);
if ((double)entityLiving.limbSwingAmount >= 0.01D){
/**
* Renders the Iron Golem.
*/
public void doRenderIceGiant(EntityIceGiant par1EntityIceGiant, double par2, double par4, double par6, float par8, float par9)
{
super.doRender(par1EntityIceGiant, par2, par4, par6, par8, par9);
}
protected ResourceLocation getIceGiantTextures(EntityIceGiant par1EntityIceGiant)
{
return iceGiantTextures;
}
/**
* Rotates Iron Golem corpse.
*/
protected void rotateIceGiantCorpse(EntityIceGiant par1EntityIceGiant, float par2, float par3, float par4)
{
super.rotateCorpse(par1EntityIceGiant, par2, par3, par4);
if ((double)par1EntityIceGiant.limbSwingAmount >= 0.01D)
{
float f3 = 13.0F;
float f4 = entityLiving.limbSwing - entityLiving.limbSwingAmount * (1.0F - partialTicks) + 6.0F;
float f4 = par1EntityIceGiant.limbSwing - par1EntityIceGiant.limbSwingAmount * (1.0F - par4) + 6.0F;
float f5 = (Math.abs(f4 % f3 - f3 * 0.5F) - f3 * 0.25F) / (f3 * 0.25F);
GlStateManager.rotate(6.5F * f5, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(6.5F * f5, 0.0F, 0.0F, 1.0F);
}
}
/**
* Renders Iron Golem Equipped items.
*/
protected void renderIceGiantEquippedItems(EntityIceGiant par1EntityIceGiant, float par2)
{
super.renderEquippedItems(par1EntityIceGiant, par2);
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderIceGiant((EntityIceGiant)par1EntityLiving, par2, par4, par6, par8, par9);
}
protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2)
{
this.renderIceGiantEquippedItems((EntityIceGiant)par1EntityLivingBase, par2);
}
protected void rotateCorpse(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
this.rotateIceGiantCorpse((EntityIceGiant)par1EntityLivingBase, par2, par3, par4);
}
public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderIceGiant((EntityIceGiant)par1EntityLivingBase, par2, par4, par6, par8, par9);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getIceGiantTextures((EntityIceGiant)par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderIceGiant((EntityIceGiant)par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -2,82 +2,77 @@ package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.EntityIceSpike;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderIceSpike extends Render<EntityIceSpike> {
public class RenderIceSpike extends Render {
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/ice_spike.png");
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/entity/ice_spike.png");
public RenderIceSpike(){
public RenderIceSpike(RenderManager renderManager){
super(renderManager);
}
@Override
public void doRender(EntityIceSpike entity, double x, double y, double z, float fa, float partialTickTime) {
public void doRender(Entity entity, double x, double y, double z, float fa, float partialTickTime) {
GlStateManager.pushMatrix();
GL11.glPushMatrix();
GlStateManager.translate((float)x, (float)y, (float)z);
GL11.glTranslatef((float)x, (float)y, (float)z);
// Apparently, disabling lighting... doesn't disable lighting. Or at least, you can still set the brightness
// with setLightmapTextureCoords.
GlStateManager.disableLighting();
GL11.glDisable(GL11.GL_LIGHTING);
int j = entity.getBrightnessForRender(partialTickTime);
int k = j % 65536;
int l = j / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)k / 1.0F, (float)l / 1.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
Tessellator tessellator = Tessellator.instance;
bindTexture(texture);
// West face
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(0, 0, 0.5).tex(1, 1).endVertex();
buffer.pos(0, 1, 0.5).tex(1, 0).endVertex();
buffer.pos(0, 1, -0.5).tex(0, 0).endVertex();
buffer.pos(0, 0, -0.5).tex(0, 1).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0, 0, 0.5, 1, 1);
tessellator.addVertexWithUV(0, 1, 0.5, 1, 0);
tessellator.addVertexWithUV(0, 1, -0.5, 0, 0);
tessellator.addVertexWithUV(0, 0, -0.5, 0, 1);
tessellator.draw();
// South face
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
buffer.pos( 0.5, 0, 0).tex(1, 1).endVertex();
buffer.pos( 0.5, 1, 0).tex(1, 0).endVertex();
buffer.pos(-0.5, 1, 0).tex(0, 0).endVertex();
buffer.pos(-0.5, 0, 0).tex(0, 1).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV( 0.5, 0, 0, 1, 1);
tessellator.addVertexWithUV( 0.5, 1, 0, 1, 0);
tessellator.addVertexWithUV(-0.5, 1, 0, 0, 0);
tessellator.addVertexWithUV(-0.5, 0, 0, 0, 1);
tessellator.draw();
// East face
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
buffer.pos(0, 0, -0.5).tex(0, 1).endVertex();
buffer.pos(0, 1, -0.5).tex(0, 0).endVertex();
buffer.pos(0, 1, 0.5).tex(1, 0).endVertex();
buffer.pos(0, 0, 0.5).tex(1, 1).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(0, 0, -0.5, 0, 1);
tessellator.addVertexWithUV(0, 1, -0.5, 0, 0);
tessellator.addVertexWithUV(0, 1, 0.5, 1, 0);
tessellator.addVertexWithUV(0, 0, 0.5, 1, 1);
tessellator.draw();
// North face
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
buffer.pos(-0.5, 0, 0).tex(0, 1).endVertex();
buffer.pos(-0.5, 1, 0).tex(0, 0).endVertex();
buffer.pos( 0.5, 1, 0).tex(1, 0).endVertex();
buffer.pos( 0.5, 0, 0).tex(1, 1).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-0.5, 0, 0, 0, 1);
tessellator.addVertexWithUV(-0.5, 1, 0, 0, 0);
tessellator.addVertexWithUV( 0.5, 1, 0, 1, 0);
tessellator.addVertexWithUV( 0.5, 0, 0, 1, 1);
tessellator.draw();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityIceSpike entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return texture;
}
@@ -1,81 +1,82 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.entity.projectile.EntityLightningDisc;
import net.minecraft.client.renderer.GlStateManager;
import electroblob.wizardry.entity.construct.EntityBubble;
import electroblob.wizardry.entity.construct.EntityHealAura;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
public class RenderLightningDisc extends Render<EntityLightningDisc> {
public class RenderLightningDisc extends Render {
private final ResourceLocation texture;
private float scale = 1.0f;
public RenderLightningDisc(RenderManager renderManager, ResourceLocation texture, float scale) {
super(renderManager);
public RenderLightningDisc(ResourceLocation texture, float scale) {
this.texture = texture;
this.scale = scale;
}
@Override
public void doRender(EntityLightningDisc entity, double par2, double par4, double par6, float par8, float par9){
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9){
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float yOffset = 0;
GlStateManager.translate((float)par2, (float)par4 + yOffset, (float)par6);
if(entity.riddenByEntity != null){
yOffset = entity.riddenByEntity.height/2;
}
GL11.glTranslatef((float)par2, (float)par4 + yOffset, (float)par6);
this.bindTexture(texture);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GlStateManager.rotate(-90, 1, 0, 0);
GL11.glRotatef(-90, 1, 0, 0);
GlStateManager.rotate(entity.ticksExisted*8, 0, 0, 1);
GL11.glRotatef(entity.ticksExisted*8, 0, 0, 1);
GlStateManager.scale(scale, scale, scale);
GL11.glScalef(scale, scale, scale);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
//tessellator.setColorRGBA_I(k1, 128);
//buffer.normal(0.0F, 1.0F, 0.0F);
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.01).tex(1, 0).endVertex();
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.01).tex(0, 0).endVertex();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.draw();
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
//buffer.normal(0.0F, 1.0F, 0.0F);
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.01).tex(0, 0).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.01).tex(1, 0).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.draw();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityLightningDisc entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
@@ -1,71 +1,76 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.construct.EntityLightningPulse;
import net.minecraft.client.renderer.GlStateManager;
import electroblob.wizardry.WizardryUtilities;
import electroblob.wizardry.entity.construct.EntityHealAura;
import electroblob.wizardry.entity.construct.EntityMagicConstruct;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
public class RenderLightningPulse extends Render<EntityLightningPulse> {
public class RenderLightningPulse extends Render {
private final ResourceLocation[] textures = new ResourceLocation[8];
private float scale = 1.0f;
public RenderLightningPulse(RenderManager renderManager, float scale) {
super(renderManager);
public RenderLightningPulse(float scale) {
for(int i=0; i<textures.length; i++){
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/lightning_pulse_" + i + ".png");
textures[i] = new ResourceLocation("wizardry:textures/entity/lightning_pulse_" + i + ".png");
}
this.scale = scale;
}
@Override
public void doRender(EntityLightningPulse entity, double par2, double par4, double par6, float par8, float par9){
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9){
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float yOffset = 0;
GlStateManager.translate((float)par2, (float)par4 + yOffset, (float)par6);
if(entity.riddenByEntity != null){
yOffset = entity.riddenByEntity.height/2;
}
GL11.glTranslatef((float)par2, (float)par4 + yOffset, (float)par6);
this.bindTexture(textures[entity.ticksExisted]);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GlStateManager.rotate(-90, 1, 0, 0);
GL11.glRotatef(-90, 1, 0, 0);
GlStateManager.scale(scale, scale, scale);
GL11.glScalef(scale, scale, scale);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.01).tex(1, 0).endVertex();
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.01).tex(0, 0).endVertex();
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
//tessellator.setColorRGBA_I(k1, 128);
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.draw();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityLightningPulse entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
@@ -1,32 +1,32 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.entity.projectile.EntityMagicArrow;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.projectile.EntityMagicMissile;
@SideOnly(Side.CLIENT)
public class RenderMagicArrow extends Render<EntityMagicArrow> {
private final ResourceLocation texture;
public class RenderMagicArrow extends Render
{
// This class can now be used to render any projectile; hence this field is no longer static or final.
private ResourceLocation arrowTextures;
private boolean blend;
private boolean renderEnds;
private double length = 8.0, width = 2.0;
private int pixelsLong = 16, pixelsWide = 5;
public RenderMagicArrow(RenderManager renderManager, ResourceLocation texture, boolean blend, double length, double width, int pixelsLong, int pixelsWide, boolean renderEnds){
super(renderManager);
this.texture = texture;
public RenderMagicArrow(ResourceLocation texture, boolean blend, double length, double width, int pixelsLong, int pixelsWide, boolean renderEnds){
this.arrowTextures = texture;
this.blend = blend;
this.renderEnds = renderEnds;
this.length = length;
@@ -35,24 +35,22 @@ public class RenderMagicArrow extends Render<EntityMagicArrow> {
this.pixelsWide = pixelsWide;
}
@Override
public void doRender(EntityMagicArrow entity, double par2, double par4, double par6, float par8, float par9){
public void renderArrow(Entity entity, double par2, double par4, double par6, float par8, float par9)
{
this.bindEntityTexture(entity);
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
if(this.blend){
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
GlStateManager.translate((float)par2, (float)par4, (float)par6);
GlStateManager.rotate(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
Tessellator tessellator = Tessellator.instance;
float f2 = 0.0F;
float f3 = pixelsLong / 32.0F;
float f4 = 0.0F;
@@ -63,60 +61,78 @@ public class RenderMagicArrow extends Render<EntityMagicArrow> {
float f9 = (float)10 / 32.0F;
float f10 = 0.05625F;
float f11 = 0.0f;
GlStateManager.enableRescaleNormal();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
//f11 = (float)par1EntityArrow.arrowShake - par9;
if (f11 > 0.0F)
{
float f12 = -MathHelper.sin(f11 * 3.0F) * f11;
GlStateManager.rotate(f12, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F);
}
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(f10, f10, f10);
GlStateManager.translate(-4.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
GL11.glScalef(f10, f10, f10);
GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
GL11.glNormal3f(f10, 0.0F, 0.0F);
if(renderEnds){
// Ends
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-7.0D, -width, -width).tex((double)f6, (double)f8).endVertex();
buffer.pos(-7.0D, -width, width).tex((double)f7, (double)f8).endVertex();
buffer.pos(-7.0D, width, width).tex((double)f7, (double)f9).endVertex();
buffer.pos(-7.0D, width, -width).tex((double)f6, (double)f9).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, -width, -width, (double)f6, (double)f8);
tessellator.addVertexWithUV(-7.0D, -width, width, (double)f7, (double)f8);
tessellator.addVertexWithUV(-7.0D, width, width, (double)f7, (double)f9);
tessellator.addVertexWithUV(-7.0D, width, -width, (double)f6, (double)f9);
tessellator.draw();
GL11.glNormal3f(-f10, 0.0F, 0.0F);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-7.0D, width, -width).tex((double)f6, (double)f8).endVertex();
buffer.pos(-7.0D, width, width).tex((double)f7, (double)f8).endVertex();
buffer.pos(-7.0D, -width, width).tex((double)f7, (double)f9).endVertex();
buffer.pos(-7.0D, -width, -width).tex((double)f6, (double)f9).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-7.0D, width, -width, (double)f6, (double)f8);
tessellator.addVertexWithUV(-7.0D, width, width, (double)f7, (double)f8);
tessellator.addVertexWithUV(-7.0D, -width, width, (double)f7, (double)f9);
tessellator.addVertexWithUV(-7.0D, -width, -width, (double)f6, (double)f9);
tessellator.draw();
}
for (int i = 0; i < 4; ++i){
// Sides
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glNormal3f(0.0F, 0.0F, f10);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
buffer.pos(-length, -width, 0.0D).tex((double)f2, (double)f4).endVertex();
buffer.pos(length, -width, 0.0D).tex((double)f3, (double)f4).endVertex();
buffer.pos(length, width, 0.0D).tex((double)f3, (double)f5).endVertex();
buffer.pos(-length, width, 0.0D).tex((double)f2, (double)f5).endVertex();
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(-length, -width, 0.0D, (double)f2, (double)f4);
tessellator.addVertexWithUV(length, -width, 0.0D, (double)f3, (double)f4);
tessellator.addVertexWithUV(length, width, 0.0D, (double)f3, (double)f5);
tessellator.addVertexWithUV(-length, width, 0.0D, (double)f2, (double)f5);
tessellator.draw();
}
if(this.blend){
GlStateManager.disableBlend();
GL11.glDisable(GL11.GL_BLEND);
}
GlStateManager.disableRescaleNormal();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityMagicArrow arrow)
protected ResourceLocation getArrowTextures(Entity par1Entity)
{
return texture;
return arrowTextures;
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getArrowTextures(par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderArrow(par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -2,129 +2,122 @@ package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.tileentity.TileEntityMagicLight;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicLight> {
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/light_ray.png");
private static final ResourceLocation texture2 = new ResourceLocation(Wizardry.MODID, "textures/entity/light_aura.png");
public class RenderMagicLight extends TileEntitySpecialRenderer{
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/entity/light_ray.png");
private static final ResourceLocation texture2 = new ResourceLocation("wizardry:textures/entity/light_aura.png");
@Override
public void renderTileEntityAt(TileEntityMagicLight tileentity, double x, double y, double z, float f, int destroyStage){
public void renderTileEntityAt(TileEntity tileentity, double x, double y,
double z, float f) {
GlStateManager.pushMatrix();
GL11.glPushMatrix();
GlStateManager.disableCull();
GlStateManager.enableBlend();
GlStateManager.shadeModel(GL11.GL_SMOOTH);
GlStateManager.disableLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
RenderHelper.disableStandardItemLighting();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
RenderHelper.disableStandardItemLighting();
if(tileentity instanceof TileEntityMagicLight){
TileEntityMagicLight timerentity = (TileEntityMagicLight)tileentity;
GlStateManager.translate(x + 0.5, y + 0.5, z + 0.5);
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
if(tileentity.timer < 10){
GlStateManager.scale((float)tileentity.timer/10, (float)tileentity.timer/10, (float)tileentity.timer/10);
}
if(tileentity.timer > tileentity.maxTimer-10){
GlStateManager.scale((float)(tileentity.maxTimer-tileentity.timer)/10, (float)(tileentity.maxTimer-tileentity.timer)/10, (float)(tileentity.maxTimer-tileentity.timer)/10);
}
if(timerentity.timer < 10){
GL11.glScalef((float)timerentity.timer/10, (float)timerentity.timer/10, (float)timerentity.timer/10);
}
if(timerentity.timer > timerentity.maxTimer-10){
GL11.glScalef((float)(timerentity.maxTimer-timerentity.timer)/10, (float)(timerentity.maxTimer-timerentity.timer)/10, (float)(timerentity.maxTimer-timerentity.timer)/10);
}
// Renders the aura effect
Tessellator tessellator = Tessellator.instance;
GL11.glPushMatrix();
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// Renders the aura effect
// This counteracts the reverse rotation behaviour when in front f5 view.
// Fun fact: this is a bug with vanilla too! Look at a snowball in front f5 view, for example.
float yaw = Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? RenderManager.instance.playerViewX : -RenderManager.instance.playerViewX;
GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(yaw, 1.0F, 0.0F, 0.0F);
tessellator.startDrawingQuads();
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
// This counteracts the reverse rotation behaviour when in front f5 view.
// Fun fact: this is a bug with vanilla too! Look at a snowball in front f5 view, for example.
float yaw = Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? Minecraft.getMinecraft().getRenderManager().playerViewX : -Minecraft.getMinecraft().getRenderManager().playerViewX;
GlStateManager.rotate(180.0F - Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(yaw, 1.0F, 0.0F, 0.0F);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
this.bindTexture(texture2);
buffer.pos(-0.6, 0.6, 0).tex(0, 0).endVertex();
buffer.pos(0.6, 0.6, 0).tex(1, 0).endVertex();
buffer.pos(0.6, -0.6, 0).tex(1, 1).endVertex();
buffer.pos(-0.6, -0.6, 0).tex(0, 1).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
// Renders the rays
// For some reason, the old blend function (GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA) caused the innermost
// ends of the rays to appear black, so I have changed it to this, which looks very slightly different.
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_SRC_ALPHA);
this.bindTexture(texture);
if(tileentity.randomiser.length >= 30){
this.bindTexture(texture2);
tessellator.addVertexWithUV(-0.6, 0.6, 0, 0, 0);
tessellator.addVertexWithUV(0.6, 0.6, 0, 1, 0);
tessellator.addVertexWithUV(0.6, -0.6, 0, 1, 1);
tessellator.addVertexWithUV(-0.6, -0.6, 0, 0, 1);
tessellator.draw();
GL11.glPopMatrix();
// Renders the rays
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
this.bindTexture(texture);
for(int j=0; j<30; j++){
int sliceAngle = 20 + tileentity.randomiser[j];
float scale = 0.5f;
GlStateManager.pushMatrix();
GlStateManager.rotate(31*tileentity.randomiser[j], 1, 0, 0);
GlStateManager.rotate(31*tileentity.randomiser2[j], 0, 0, 1);
/*
* OK, so here are the changes to rendering as far as I know:
* Vertex formats specify how the methods are arranged
* Color has to be called for every vertex, I think.
* The new methods thing is a bit weird, because other than the number of arguments there is
* essentially no difference between pos, tex, color, normal and lightmap. At least they make
* the code more readable.
*/
buffer.begin(5, DefaultVertexFormats.POSITION_TEX_COLOR);
buffer.pos(0, 0, 0).tex(0, 0).color(255, 255, 255, 0).endVertex();
buffer.pos(0, 0, 0).tex(0, 1).color(255, 255, 255, 0).endVertex();
double x1 = scale*Math.sin((tileentity.timer + 40*j)*(Math.PI/180));
//double y1 = 0.7*Math.cos((timerentity.timer - 40*j)*(Math.PI/180))*j/10;
double z1 = scale*Math.cos((tileentity.timer + 40*j)*(Math.PI/180));
double x2 = scale*Math.sin((tileentity.timer + 40*j - sliceAngle)*(Math.PI/180));
//double y2 = 0.7*Math.sin((timerentity.timer - 40*j)*(Math.PI/180))*j/10;
double z2 = scale*Math.cos((tileentity.timer + 40*j - sliceAngle)*(Math.PI/180));
buffer.pos(x1, 0, z1).tex(1, 0).color(0, 0, 0, 255).endVertex();
buffer.pos(x2, 0, z2).tex(1, 1).color(0, 0, 0, 255).endVertex();
tessellator.draw();
GlStateManager.popMatrix();
int sliceAngle = 20 + timerentity.randomiser[j];
float scale = 0.5f;
GL11.glPushMatrix();
GL11.glRotatef(31*timerentity.randomiser[j], 1, 0, 0);
GL11.glRotatef(31*timerentity.randomiser2[j], 0, 0, 1);
tessellator.startDrawing(5);
tessellator.setColorOpaque_I(16777215);
tessellator.addVertexWithUV(0, 0, 0, 0, 0);
tessellator.addVertexWithUV(0, 0, 0, 0, 1);
double x1 = scale*Math.sin((timerentity.timer + 40*j)*(Math.PI/180));
//double y1 = 0.7*Math.cos((timerentity.timer - 40*j)*(Math.PI/180))*j/10;
double z1 = scale*Math.cos((timerentity.timer + 40*j)*(Math.PI/180));
double x2 = scale*Math.sin((timerentity.timer + 40*j - sliceAngle)*(Math.PI/180));
//double y2 = 0.7*Math.sin((timerentity.timer - 40*j)*(Math.PI/180))*j/10;
double z2 = scale*Math.cos((timerentity.timer + 40*j - sliceAngle)*(Math.PI/180));
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(x1, 0, z1, 1, 0);
tessellator.addVertexWithUV(x2, 0, z2, 1, 1);
tessellator.draw();
GL11.glPopMatrix();
}
}
GlStateManager.shadeModel(GL11.GL_FLAT);
GlStateManager.enableCull();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
}
}
@@ -0,0 +1,95 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.EntityMagicSlime;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class RenderMagicSlime extends RenderLiving
{
private static final ResourceLocation slimeTextures = new ResourceLocation("textures/entity/slime/slime.png");
private ModelBase scaleAmount;
public RenderMagicSlime(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
super(par1ModelBase, par3);
this.scaleAmount = par2ModelBase;
}
/**
* Determines whether Slime Render should pass or not.
*/
protected int shouldSlimeRenderPass(EntityMagicSlime par1EntityMagicSlime, int par2, float par3)
{
if (par1EntityMagicSlime.isInvisible())
{
return 0;
}
else if (par2 == 0)
{
this.setRenderPassModel(this.scaleAmount);
GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
return 1;
}
else
{
if (par2 == 1)
{
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
return -1;
}
}
/**
* sets the scale for the slime based on getSlimeSize in EntityMagicSlime
*/
protected void scaleSlime(EntityMagicSlime par1EntityMagicSlime, float par2)
{
float f1 = (float)par1EntityMagicSlime.getSlimeSize();
float f2 = (par1EntityMagicSlime.prevSquishFactor + (par1EntityMagicSlime.squishFactor - par1EntityMagicSlime.prevSquishFactor) * par2) / (f1 * 0.5F + 1.0F);
float f3 = 1.0F / (f2 + 1.0F);
GL11.glScalef(f3 * f1, 1.0F / f3 * f1, f3 * f1);
}
protected ResourceLocation getSlimeTextures(EntityMagicSlime par1EntityMagicSlime)
{
return slimeTextures;
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.scaleSlime((EntityMagicSlime)par1EntityLivingBase, par2);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3)
{
return this.shouldSlimeRenderPass((EntityMagicSlime)par1EntityLivingBase, par2, par3);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getSlimeTextures((EntityMagicSlime)par1Entity);
}
}
@@ -0,0 +1,75 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.Wizardry;
import electroblob.wizardry.entity.EntityMeteor;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
@SideOnly(Side.CLIENT)
public class RenderMeteor extends Render
{
private final RenderBlocks sandRenderBlocks = new RenderBlocks();
public RenderMeteor()
{
this.shadowSize = 0.5F;
}
/**
* The actual render method that is used in doRender
*/
public void doRenderFallingSand(EntityMeteor par1EntityFallingSand, double par2, double par4, double par6, float par8, float par9)
{
World world = par1EntityFallingSand.getWorld();
Block block = Wizardry.meteor;
GL11.glPushMatrix();
GL11.glTranslatef((float)par2, (float)par4 + 0.5f, (float)par6);
this.bindEntityTexture(par1EntityFallingSand);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
par1EntityFallingSand.width = 0.98f;
par1EntityFallingSand.height = 0.98f;
this.sandRenderBlocks.setRenderBoundsFromBlock(block);
this.sandRenderBlocks.renderBlockSandFalling(block, world, MathHelper.floor_double(par1EntityFallingSand.posX), MathHelper.floor_double(par1EntityFallingSand.posY), MathHelper.floor_double(par1EntityFallingSand.posZ), 0);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
protected ResourceLocation getFallingSandTextures(EntityMeteor par1Entity)
{
return TextureMap.locationBlocksTexture;
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getFallingSandTextures((EntityMeteor)par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.doRenderFallingSand((EntityMeteor)par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -2,51 +2,130 @@ package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.client.model.ModelPhoenix;
import electroblob.wizardry.entity.living.EntityPhoenix;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderPhoenix extends RenderLiving<EntityPhoenix> {
public class RenderPhoenix extends RenderLiving
{
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/entity/phoenix.png");
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/phoenix.png");
/**
* not actually sure this is size, is not used as of now, but the model would be recreated if the value changed and
* it seems a good match for a bat's size
*/
private int renderedPhoenixSize;
public RenderPhoenix(RenderManager renderManager){
super(renderManager, new ModelPhoenix(), 1.0f);
public RenderPhoenix()
{
super(new ModelPhoenix(), 1.0f);
//this.renderedPhoenixSize = ((ModelPhoenix)this.mainModel).getBatSize();
}
@Override
protected ResourceLocation getEntityTexture(EntityPhoenix entity){
public void func_82443_a(EntityPhoenix par1EntityPhoenix, double par2, double par4, double par6, float par8, float par9)
{
/*
int i = ((ModelPhoenix)this.mainModel).getBatSize();
if (i != this.renderedPhoenixSize)
{
this.renderedPhoenixSize = i;
this.mainModel = new ModelPhoenix();
}
*/
super.doRender(par1EntityPhoenix, par2, par4, par6, par8, par9);
}
protected ResourceLocation getPhoenixTextures(EntityPhoenix par1EntityPhoenix)
{
return texture;
}
@Override
protected void rotateCorpse(EntityPhoenix par1EntityPhoenix, float par2, float par3, float par4){
GlStateManager.translate(0.0F, -0.1F, 0.0F);
protected void func_82442_a(EntityPhoenix par1EntityPhoenix, float par2)
{
GL11.glScalef(1.0F, 1.0F, 1.0F);
}
protected void func_82445_a(EntityPhoenix par1EntityPhoenix, double par2, double par4, double par6)
{
super.renderLivingAt(par1EntityPhoenix, par2, par4, par6);
}
protected void func_82444_a(EntityPhoenix par1EntityPhoenix, float par2, float par3, float par4)
{
GL11.glTranslatef(0.0F, -0.1F, 0.0F);
super.rotateCorpse(par1EntityPhoenix, par2, par3, par4);
}
@Override
public void doRender(EntityPhoenix phoenix, double par2, double par4, double par6, float par8, float par9){
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.func_82443_a((EntityPhoenix)par1EntityLiving, par2, par4, par6, par8, par9);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.func_82442_a((EntityPhoenix)par1EntityLivingBase, par2);
}
protected void rotateCorpse(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4)
{
this.func_82444_a((EntityPhoenix)par1EntityLivingBase, par2, par3, par4);
}
/**
* Sets a simple glTranslate on a LivingEntity.
*/
protected void renderLivingAt(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6)
{
this.func_82445_a((EntityPhoenix)par1EntityLivingBase, par2, par4, par6);
}
public void doRenderLiving(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
this.func_82443_a((EntityPhoenix)par1EntityLivingBase, par2, par4, par6, par8, par9);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getPhoenixTextures((EntityPhoenix)par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
GL11.glPushMatrix();
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
super.doRender(phoenix, par2, par4, par6, par8, par9);
this.func_82443_a((EntityPhoenix)par1Entity, par2, par4, par6, par8, par9);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.popMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
@@ -1,55 +1,49 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.entity.projectile.EntityMagicProjectile;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderProjectile extends Render<EntityMagicProjectile> {
public class RenderProjectile extends Render
{
private float scale;
private boolean blend = false;
private final ResourceLocation texture;
public RenderProjectile(RenderManager renderManager, float scale, ResourceLocation texture, boolean doBlending)
public RenderProjectile(float scale, ResourceLocation texture, boolean doBlending)
{
super(renderManager);
this.scale = scale;
this.texture = texture;
this.blend = doBlending;
}
@Override
public void doRender(EntityMagicProjectile entity, double par2, double par4, double par6, float par8, float par9){
GlStateManager.pushMatrix();
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
GL11.glPushMatrix();
this.bindTexture(texture);
GlStateManager.translate((float)par2, (float)par4, (float)par6);
GlStateManager.enableRescaleNormal();
GL11.glTranslatef((float)par2, (float)par4, (float)par6);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
if(blend){
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
GlStateManager.disableLighting();
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
float f2 = this.scale;
GlStateManager.scale(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
GL11.glScalef(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
Tessellator tessellator = Tessellator.instance;
float f3 = 0.0f;
float f4 = 1.0f;
@@ -62,27 +56,35 @@ public class RenderProjectile extends Render<EntityMagicProjectile> {
// This counteracts the reverse rotation behaviour when in front f5 view.
// Fun fact: this is a bug with vanilla too! Look at a snowball in front f5 view, for example.
float yaw = Minecraft.getMinecraft().gameSettings.thirdPersonView == 2 ? this.renderManager.playerViewX : -this.renderManager.playerViewX;
GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(yaw, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(yaw, 1.0F, 0.0F, 0.0F);
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
//buffer.normal(0.0F, 1.0F, 0.0F);
buffer.pos((double)(0.0F - f8), (double)(0.0F - f9), 0.0D).tex((double)f3, (double)f6).endVertex();
buffer.pos((double)(f7 - f8), (double)(0.0F - f9), 0.0D).tex((double)f4, (double)f6).endVertex();
buffer.pos((double)(f7 - f8), (double)(1.0F - f9), 0.0D).tex((double)f4, (double)f5).endVertex();
buffer.pos((double)(0.0F - f8), (double)(1.0F - f9), 0.0D).tex((double)f3, (double)f5).endVertex();
tessellator.startDrawingQuads();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f8), (double)(0.0F - f9), 0.0D, (double)f3, (double)f6);
tessellator.addVertexWithUV((double)(f7 - f8), (double)(0.0F - f9), 0.0D, (double)f4, (double)f6);
tessellator.addVertexWithUV((double)(f7 - f8), (double)(1.0F - f9), 0.0D, (double)f4, (double)f5);
tessellator.addVertexWithUV((double)(0.0F - f8), (double)(1.0F - f9), 0.0D, (double)f3, (double)f5);
tessellator.draw();
GlStateManager.disableRescaleNormal();
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
if(blend){
GlStateManager.disableBlend();
GL11.glDisable(GL11.GL_BLEND);
}
GlStateManager.enableLighting();
GlStateManager.popMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityMagicProjectile par1Entity){
protected ResourceLocation getTextures(Entity par1Entity)
{
return texture;
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getTextures((Entity)par1Entity);
}
}
@@ -0,0 +1,163 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.entity.EntityShield;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
public class RenderShield extends Render{
private static final ResourceLocation texture = new ResourceLocation("wizardry:textures/entity/shield.png");
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
@Override
public void doRender(Entity entity, double x, double y, double z,
float fa, float fb) {
if(entity instanceof EntityShield){
EntityShield shield = (EntityShield)entity;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
GL11.glShadeModel(GL11.GL_SMOOTH);
//GL11.glDisable(GL11.GL_LIGHTING);
if(Minecraft.getMinecraft().renderViewEntity != shield.player.get() || Minecraft.getMinecraft().gameSettings.thirdPersonView != 0){
GL11.glDisable(GL11.GL_LIGHTING);
}
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
//RenderHelper.disableStandardItemLighting();
GL11.glTranslated(x, y + 0.3, z);
GL11.glRotatef(-1*shield.rotationYaw, 0, 1, 0);
GL11.glRotatef(shield.rotationPitch, 1, 0, 0);
Tessellator tessellator = Tessellator.instance;
this.bindTexture(texture);
this.renderShield(tessellator, -1);
// Enchantment effect
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
this.bindTexture(RES_ITEM_GLINT);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f7 = 0.76F;
GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
float f8 = 0.125F;
//GL11.glScalef(f8, f8, f8);
float f9 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 0.8f;
//GL11.glTranslatef(f9, 0.0F, 0.0F);
//GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
//this.renderShield(tessellator, f9);
GL11.glPopMatrix();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDisable(GL11.GL_BLEND);
//RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
}
}
@Override
protected ResourceLocation getEntityTexture(Entity entity) {
return texture;
}
private void renderShield(Tessellator tessellator, float textureOffset){
double widthOuter = 0.6d;
double heightOuter = 0.7d;
double widthInner = 0.3d;
double heightInner = 0.4d;
double depth = 0.2d;
double textureSection = 1.0d;
double textureU = 0.0d;
if(textureOffset != -1){
textureSection = 0.2d;
textureU = textureOffset;
}
tessellator.startDrawing(5);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(-widthOuter, heightOuter - 0.3, -depth, 0, 0);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(-widthInner, heightInner, 0, textureU, 0.2);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(-widthOuter + 0.3, heightOuter, -depth, 0, 0);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(-widthInner, heightInner, 0, textureU, 0.2);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(widthOuter - 0.3, heightOuter, -depth, 1, 0);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(widthInner, heightInner, 0, textureU + textureSection, 0.2);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(widthOuter, heightOuter - 0.3, -depth, 1, 0);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(widthInner, heightInner, 0, textureU + textureSection, 0.2);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(widthOuter, -heightOuter + 0.3, -depth, 1, 1);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(widthInner, -heightInner, 0, textureU + textureSection, 0.8);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(widthOuter - 0.3, -heightOuter, -depth, 1, 1);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(widthInner, -heightInner, 0, textureU + textureSection, 0.8);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(-widthOuter + 0.3, -heightOuter, -depth, 0, 1);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(-widthInner, -heightInner, 0, textureU, 0.8);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(-widthOuter, -heightOuter + 0.3, -depth, 0, 1);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(-widthInner, -heightInner, 0, textureU, 0.8);
tessellator.setColorRGBA(0, 0, 0, 255);
tessellator.addVertexWithUV(-widthOuter, heightOuter - 0.3, -depth, 0, 0);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(-widthInner, heightInner, 0, textureU, 0.2);
tessellator.draw();
tessellator.startDrawing(5);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(-widthInner, heightInner, 0, textureU, 0.2);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(widthInner, heightInner, 0, textureU + textureSection, 0.2);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(-widthInner, -heightInner, 0, textureU, 0.8);
tessellator.setColorOpaque(200, 200, 255);
tessellator.addVertexWithUV(widthInner, -heightInner, 0, textureU + textureSection, 0.8);
tessellator.draw();
}
}
@@ -1,88 +1,90 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import electroblob.wizardry.WizardryUtilities;
import electroblob.wizardry.entity.construct.EntityHealAura;
import electroblob.wizardry.entity.construct.EntityMagicConstruct;
import electroblob.wizardry.util.WizardryUtilities;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
public class RenderSigil extends Render<EntityMagicConstruct> {
public class RenderSigil extends Render {
private final ResourceLocation texture;
private float scale = 1.0f;
private boolean invisibleToEnemies;
public RenderSigil(RenderManager renderManager, ResourceLocation texture, float scale, boolean invisibleToEnemies) {
super(renderManager);
public RenderSigil(ResourceLocation texture, float scale, boolean invisibleToEnemies) {
this.texture = texture;
this.scale = scale;
this.invisibleToEnemies = invisibleToEnemies;
}
@Override
public void doRender(EntityMagicConstruct entity, double par2, double par4, double par6, float par8, float par9){
public void doRender(Entity entity, double par2, double par4, double par6, float par8, float par9){
// Makes the sigil invisible to enemies of the player that created it
if(this.invisibleToEnemies){
if(this.invisibleToEnemies && entity instanceof EntityMagicConstruct){
if(entity.getCaster() instanceof EntityPlayer
&& !WizardryUtilities.isPlayerAlly((EntityPlayer)entity.getCaster(), Minecraft.getMinecraft().thePlayer)){
EntityMagicConstruct construct = (EntityMagicConstruct)entity;
if(construct.getCaster() instanceof EntityPlayer
&& !WizardryUtilities.isPlayerAlly((EntityPlayer)construct.getCaster(), Minecraft.getMinecraft().thePlayer)){
return;
}
}
GlStateManager.pushMatrix();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float yOffset = 0;
GlStateManager.translate((float)par2, (float)par4 + yOffset, (float)par6);
if(entity.riddenByEntity != null){
yOffset = entity.riddenByEntity.height/2;
}
GL11.glTranslatef((float)par2, (float)par4 + yOffset, (float)par6);
this.bindTexture(texture);
float f6 = 1.0F;
float f7 = 0.5F;
float f8 = 0.5F;
GlStateManager.rotate(-90, 1, 0, 0);
GL11.glRotatef(-90, 1, 0, 0);
// Healing aura rotates slowly
if(entity instanceof EntityHealAura) GlStateManager.rotate(entity.ticksExisted/3.0f, 0, 0, 1);
if(entity instanceof EntityHealAura) GL11.glRotatef(entity.ticksExisted/3.0f, 0, 0, 1);
GlStateManager.scale(scale, scale, scale);
GL11.glScalef(scale, scale, scale);
Tessellator tessellator = Tessellator.getInstance();
VertexBuffer buffer = tessellator.getBuffer();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
//tessellator.setColorRGBA_I(k1, 128);
//buffer.normal(0.0F, 1.0F, 0.0F);
buffer.pos((double)(0.0F - f7), (double)(0.0F - f8), 0.01).tex(0, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(0.0F - f8), 0.01).tex(1, 1).endVertex();
buffer.pos((double)(f6 - f7), (double)(1.0F - f8), 0.01).tex(1, 0).endVertex();
buffer.pos((double)(0.0F - f7), (double)(1.0F - f8), 0.01).tex(0, 0).endVertex();
tessellator.setNormal(0.0F, 1.0F, 0.0F);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(0.0F - f8), 0.01, 0, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(0.0F - f8), 0.01, 1, 1);
tessellator.addVertexWithUV((double)(f6 - f7), (double)(1.0F - f8), 0.01, 1, 0);
tessellator.addVertexWithUV((double)(0.0F - f7), (double)(1.0F - f8), 0.01, 0, 0);
tessellator.draw();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.popMatrix();
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
@Override
protected ResourceLocation getEntityTexture(EntityMagicConstruct entity) {
protected ResourceLocation getEntityTexture(Entity entity) {
return null;
}
@@ -0,0 +1,109 @@
package electroblob.wizardry.client.renderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntitySilverfishMinion;
import net.minecraft.client.model.ModelSilverfish;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class RenderSilverfishMinion extends RenderLiving
{
private static final ResourceLocation silverfishTextures = new ResourceLocation("textures/entity/silverfish.png");
private static final String __OBFID = "CL_00001022";
public RenderSilverfishMinion()
{
super(new ModelSilverfish(), 0.3F);
}
protected float getDeathMaxRotation(EntitySilverfishMinion p_77037_1_)
{
return 180.0F;
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntitySilverfishMinion p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
super.doRender((EntityLiving)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntitySilverfishMinion p_110775_1_)
{
return silverfishTextures;
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntitySilverfishMinion p_77032_1_, int p_77032_2_, float p_77032_3_)
{
return -1;
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntitySilverfishMinion)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
protected float getDeathMaxRotation(EntityLivingBase p_77037_1_)
{
return this.getDeathMaxRotation((EntitySilverfishMinion)p_77037_1_);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_)
{
return this.shouldRenderPass((EntitySilverfishMinion)p_77032_1_, p_77032_2_, p_77032_3_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntitySilverfishMinion)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntitySilverfishMinion)p_110775_1_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntitySilverfishMinion)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}
@@ -0,0 +1,66 @@
package electroblob.wizardry.client.renderer;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.client.model.ModelSkeletonMinion;
import electroblob.wizardry.entity.living.EntitySkeletonMinion;
@SideOnly(Side.CLIENT)
public class RenderSkeletonMinion extends RenderBiped
{
private static final ResourceLocation skeletonTextures = new ResourceLocation("textures/entity/skeleton/skeleton.png");
private static final ResourceLocation witherSkeletonTextures = new ResourceLocation("textures/entity/skeleton/wither_skeleton.png");
public RenderSkeletonMinion()
{
super(new ModelSkeletonMinion(), 0.5F);
}
protected void scaleSkeleton(EntitySkeletonMinion par1EntitySkeletonMinion, float par2)
{
if (par1EntitySkeletonMinion.getSkeletonType() == 1)
{
GL11.glScalef(1.2F, 1.2F, 1.2F);
}
}
protected void func_82422_c()
{
GL11.glTranslatef(0.09375F, 0.1875F, 0.0F);
}
protected ResourceLocation func_110860_a(EntitySkeletonMinion par1EntitySkeletonMinion)
{
return par1EntitySkeletonMinion.getSkeletonType() == 1 ? witherSkeletonTextures : skeletonTextures;
}
protected ResourceLocation func_110856_a(EntityLiving par1EntityLiving)
{
return this.func_110860_a((EntitySkeletonMinion)par1EntityLiving);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.scaleSkeleton((EntitySkeletonMinion)par1EntityLivingBase, par2);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.func_110860_a((EntitySkeletonMinion)par1Entity);
}
}
@@ -0,0 +1,55 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntitySpiderMinion;
import net.minecraft.client.renderer.entity.RenderSpider;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntitySpider;
import net.minecraft.util.ResourceLocation;
@SideOnly(Side.CLIENT)
public class RenderSpiderMinion extends RenderSpider
{
private static final ResourceLocation spiderMinionTextures = new ResourceLocation("textures/entity/spider/cave_spider.png");
public RenderSpiderMinion()
{
this.shadowSize *= 0.7F;
}
protected void scaleSpider(EntitySpiderMinion par1EntitySpiderMinion, float par2)
{
GL11.glScalef(0.7F, 0.7F, 0.7F);
}
protected ResourceLocation getSpiderMinionTextures(EntitySpiderMinion par1EntitySpiderMinion)
{
return spiderMinionTextures;
}
protected ResourceLocation getSpiderTextures(EntitySpiderMinion par1EntitySpider)
{
return this.getSpiderMinionTextures(par1EntitySpider);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.scaleSpider((EntitySpiderMinion)par1EntityLivingBase, par2);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getSpiderMinionTextures((EntitySpiderMinion)par1Entity);
}
}
@@ -1,36 +1,315 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import java.util.Map;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.model.ModelHorse;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderHorse;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.passive.EntityHorse;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import com.google.common.collect.Maps;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntitySpiritHorse;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.texture.LayeredTexture;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.common.MinecraftForge;
@SideOnly(Side.CLIENT)
public class RenderSpiritHorse extends RenderHorse {
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/spirit_horse.png");
public class RenderSpiritHorse extends RenderLiving
{
private static final Map field_110852_a = Maps.newHashMap();
private static final ResourceLocation horseTextures = new ResourceLocation("wizardry:textures/entity/spirit_horse.png");
public RenderSpiritHorse(RenderManager renderManager, float par2){
super(renderManager, new ModelHorse(), par2);
public RenderSpiritHorse(ModelBase par1ModelBase, float par2)
{
super(par1ModelBase, par2);
}
protected void func_110847_a(EntitySpiritHorse par1EntitySpiritHorse, float par2)
{
float f1 = 1.0F;
int i = par1EntitySpiritHorse.getHorseType();
if (i == 1)
{
f1 *= 0.87F;
}
else if (i == 2)
{
f1 *= 0.92F;
}
GL11.glScalef(f1, f1, f1);
super.preRenderCallback(par1EntitySpiritHorse, par2);
}
protected void func_110846_a(EntitySpiritHorse par1EntitySpiritHorse, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (par1EntitySpiritHorse.isInvisible())
{
this.mainModel.setRotationAngles(par2, par3, par4, par5, par6, par7, par1EntitySpiritHorse);
}
else
{
this.bindEntityTexture(par1EntitySpiritHorse);
this.mainModel.render(par1EntitySpiritHorse, par2, par3, par4, par5, par6, par7);
}
}
protected ResourceLocation func_110849_a(EntitySpiritHorse par1EntitySpiritHorse)
{
return horseTextures;
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.func_110847_a((EntitySpiritHorse)par1EntityLivingBase, par2);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
/**
* Renders the model in RenderLiving
*/
protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7)
{
this.func_110846_a((EntitySpiritHorse)par1EntityLivingBase, par2, par3, par4, par5, par6, par7);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.func_110849_a((EntitySpiritHorse)par1Entity);
}
// This is overridden to allow transparent stuff to happen.
@Override
protected ResourceLocation getEntityTexture(EntityHorse entity) {
return texture;
}
public void doRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this, par2, par4, par6))) return;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
this.mainModel.onGround = this.renderSwingProgress(par1EntityLivingBase, par9);
@Override
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime){
super.preRenderCallback(entitylivingbaseIn, partialTickTime);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
if (this.renderPassModel != null)
{
this.renderPassModel.onGround = this.mainModel.onGround;
}
this.mainModel.isRiding = par1EntityLivingBase.isRiding();
if (this.renderPassModel != null)
{
this.renderPassModel.isRiding = this.mainModel.isRiding;
}
this.mainModel.isChild = par1EntityLivingBase.isChild();
if (this.renderPassModel != null)
{
this.renderPassModel.isChild = this.mainModel.isChild;
}
try
{
float f2 = this.interpolateRotation(par1EntityLivingBase.prevRenderYawOffset, par1EntityLivingBase.renderYawOffset, par9);
float f3 = this.interpolateRotation(par1EntityLivingBase.prevRotationYawHead, par1EntityLivingBase.rotationYawHead, par9);
float f4;
float f5 = par1EntityLivingBase.prevRotationPitch + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch) * par9;
this.renderLivingAt(par1EntityLivingBase, par2, par4, par6);
f4 = this.handleRotationFloat(par1EntityLivingBase, par9);
this.rotateCorpse(par1EntityLivingBase, f4, f2, par9);
float f6 = 0.0625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
this.preRenderCallback(par1EntityLivingBase, par9);
GL11.glTranslatef(0.0F, -24.0F * f6 - 0.0078125F, 0.0F);
float f7 = par1EntityLivingBase.prevLimbSwingAmount + (par1EntityLivingBase.limbSwingAmount - par1EntityLivingBase.prevLimbSwingAmount) * par9;
float f8 = par1EntityLivingBase.limbSwing - par1EntityLivingBase.limbSwingAmount * (1.0F - par9);
if (f7 > 1.0F)
{
f7 = 1.0F;
}
GL11.glEnable(GL11.GL_ALPHA_TEST);
//GL11.glEnable(GL11.GL_BLEND);
//GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.mainModel.setLivingAnimations(par1EntityLivingBase, f8, f7, par9);
this.renderModel(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
float f9;
int i;
float f10;
float f11;
/*
for (int j = 0; j < 4; ++j)
{
i = this.shouldRenderPass(par1EntityLivingBase, j, par9);
if (i > 0)
{
this.renderPassModel.setLivingAnimations(par1EntityLivingBase, f8, f7, par9);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
if ((i & 240) == 16)
{
this.func_82408_c(par1EntityLivingBase, j, par9);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
if ((i & 15) == 15)
{
f9 = (float)par1EntityLivingBase.ticksExisted + par9;
//this.bindTexture(RES_ITEM_GLINT);
GL11.glEnable(GL11.GL_BLEND);
f10 = 0.5F;
GL11.glColor4f(f10, f10, f10, 1.0F);
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDepthMask(false);
for (int k = 0; k < 2; ++k)
{
GL11.glDisable(GL11.GL_LIGHTING);
f11 = 0.76F;
GL11.glColor4f(0.5F * f11, 0.25F * f11, 0.8F * f11, 1.0F);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
//GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float f12 = f9 * (0.001F + (float)k * 0.003F) * 20.0F;
float f13 = 0.33333334F;
GL11.glScalef(f13, f13, f13);
GL11.glRotatef(30.0F - (float)k * 60.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, f12, 0.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glDepthMask(true);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
//GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
}
*/
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
//this.renderEquippedItems(par1EntityLivingBase, par9);
float f14 = par1EntityLivingBase.getBrightness(par9);
i = this.getColorMultiplier(par1EntityLivingBase, f14, par9);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
// The red hurt animation.
if ((i >> 24 & 255) > 0 || par1EntityLivingBase.hurtTime > 0 || par1EntityLivingBase.deathTime > 0)
{
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthFunc(GL11.GL_EQUAL);
if (par1EntityLivingBase.hurtTime > 0 || par1EntityLivingBase.deathTime > 0)
{
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
this.mainModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
for (int l = 0; l < 4; ++l)
{
if (this.inheritRenderPass(par1EntityLivingBase, l, par9) >= 0)
{
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
}
}
if ((i >> 24 & 255) > 0)
{
f9 = (float)(i >> 16 & 255) / 255.0F;
f10 = (float)(i >> 8 & 255) / 255.0F;
float f15 = (float)(i & 255) / 255.0F;
f11 = (float)(i >> 24 & 255) / 255.0F;
GL11.glColor4f(f9, f10, f15, f11);
this.mainModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
for (int i1 = 0; i1 < 4; ++i1)
{
if (this.inheritRenderPass(par1EntityLivingBase, i1, par9) >= 0)
{
GL11.glColor4f(f9, f10, f15, f11);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
}
}
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
catch (Exception exception)
{
exception.printStackTrace();
}
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glEnable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
this.passSpecialRender(par1EntityLivingBase, par2, par4, par6);
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this, par2, par4, par6));
}
/**
* Returns a rotation angle that is inbetween two other rotation angles. par1 and par2 are the angles between which
* to interpolate, par3 is probably a float between 0.0 and 1.0 that tells us where "between" the two angles we are.
* Example: par1 = 30, par2 = 50, par3 = 0.5, then return = 40
*/
private float interpolateRotation(float par1, float par2, float par3)
{
float f3;
for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F)
{
;
}
while (f3 >= 180.0F)
{
f3 -= 360.0F;
}
return par1 + par3 * f3;
}
}
@@ -1,35 +1,320 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import electroblob.wizardry.Wizardry;
import net.minecraft.client.model.ModelWolf;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderWolf;
import net.minecraft.entity.passive.EntityWolf;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntitySpiritWolf;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.common.MinecraftForge;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
@SideOnly(Side.CLIENT)
public class RenderSpiritWolf extends RenderWolf {
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/spirit_wolf.png");
public class RenderSpiritWolf extends RenderLiving
{
private static final ResourceLocation wolfTextures = new ResourceLocation("wizardry:textures/entity/spirit_wolf.png");
public RenderSpiritWolf(RenderManager renderManager, float par3){
super(renderManager, new ModelWolf(), par3);
public RenderSpiritWolf(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3)
{
super(par1ModelBase, par3);
this.setRenderPassModel(par2ModelBase);
}
@Override
protected ResourceLocation getEntityTexture(EntityWolf entity) {
return texture;
protected float getTailRotation(EntitySpiritWolf par1EntitySpiritWolf, float par2)
{
return par1EntitySpiritWolf.getTailRotation();
}
protected int func_82447_a(EntitySpiritWolf par1EntitySpiritWolf, int par2, float par3)
{
float f1;
if (par2 == 0)
{
//f1 = par1EntitySpiritWolf.getBrightness(par3) * par1EntitySpiritWolf.getShadingWhileShaking(par3);
this.bindTexture(wolfTextures);
this.setRenderPassModel(this.mainModel);
//GL11.glColor3f(f1, f1, f1);
//GL11.glEnable(GL11.GL_NORMALIZE);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
return 1;
}
/*
else if (par2 == 1 && par1EntitySpiritWolf.isTamed())
{
f1 = par1EntitySpiritWolf.getBrightness(par3) * par1EntitySpiritWolf.getShadingWhileShaking(par3);
this.bindTexture(wolfTextures);
GL11.glColor3f(f1, f1, f1);
return 1;
}
*/
else
{
return -1;
}
}
protected ResourceLocation func_110914_a(EntitySpiritWolf par1EntitySpiritWolf)
{
return wolfTextures;
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3)
{
return this.func_82447_a((EntitySpiritWolf)par1EntityLivingBase, par2, par3);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2){
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
}
// This is overridden to allow transparent stuff to happen.
@Override
protected void preRenderCallback(EntityWolf entity, float partialTickTime){
super.preRenderCallback(entity, partialTickTime);
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
public void doRender(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
if (MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Pre(par1EntityLivingBase, this, par2, par4, par6))) return;
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
this.mainModel.onGround = this.renderSwingProgress(par1EntityLivingBase, par9);
if (this.renderPassModel != null)
{
this.renderPassModel.onGround = this.mainModel.onGround;
}
this.mainModel.isRiding = par1EntityLivingBase.isRiding();
if (this.renderPassModel != null)
{
this.renderPassModel.isRiding = this.mainModel.isRiding;
}
this.mainModel.isChild = par1EntityLivingBase.isChild();
if (this.renderPassModel != null)
{
this.renderPassModel.isChild = this.mainModel.isChild;
}
try
{
float f2 = this.interpolateRotation(par1EntityLivingBase.prevRenderYawOffset, par1EntityLivingBase.renderYawOffset, par9);
float f3 = this.interpolateRotation(par1EntityLivingBase.prevRotationYawHead, par1EntityLivingBase.rotationYawHead, par9);
float f4;
float f5 = par1EntityLivingBase.prevRotationPitch + (par1EntityLivingBase.rotationPitch - par1EntityLivingBase.prevRotationPitch) * par9;
this.renderLivingAt(par1EntityLivingBase, par2, par4, par6);
f4 = this.handleRotationFloat(par1EntityLivingBase, par9);
this.rotateCorpse(par1EntityLivingBase, f4, f2, par9);
float f6 = 0.0625F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
this.preRenderCallback(par1EntityLivingBase, par9);
GL11.glTranslatef(0.0F, -24.0F * f6 - 0.0078125F, 0.0F);
float f7 = par1EntityLivingBase.prevLimbSwingAmount + (par1EntityLivingBase.limbSwingAmount - par1EntityLivingBase.prevLimbSwingAmount) * par9;
float f8 = par1EntityLivingBase.limbSwing - par1EntityLivingBase.limbSwingAmount * (1.0F - par9);
if (f7 > 1.0F)
{
f7 = 1.0F;
}
GL11.glEnable(GL11.GL_ALPHA_TEST);
//GL11.glEnable(GL11.GL_BLEND);
//GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.mainModel.setLivingAnimations(par1EntityLivingBase, f8, f7, par9);
this.renderModel(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
float f9;
int i;
float f10;
float f11;
/*
for (int j = 0; j < 4; ++j)
{
i = this.shouldRenderPass(par1EntityLivingBase, j, par9);
if (i > 0)
{
this.renderPassModel.setLivingAnimations(par1EntityLivingBase, f8, f7, par9);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
if ((i & 240) == 16)
{
this.func_82408_c(par1EntityLivingBase, j, par9);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
if ((i & 15) == 15)
{
f9 = (float)par1EntityLivingBase.ticksExisted + par9;
//this.bindTexture(RES_ITEM_GLINT);
GL11.glEnable(GL11.GL_BLEND);
f10 = 0.5F;
GL11.glColor4f(f10, f10, f10, 1.0F);
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDepthMask(false);
for (int k = 0; k < 2; ++k)
{
GL11.glDisable(GL11.GL_LIGHTING);
f11 = 0.76F;
GL11.glColor4f(0.5F * f11, 0.25F * f11, 0.8F * f11, 1.0F);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
//GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glLoadIdentity();
float f12 = f9 * (0.001F + (float)k * 0.003F) * 20.0F;
float f13 = 0.33333334F;
GL11.glScalef(f13, f13, f13);
GL11.glRotatef(30.0F - (float)k * 60.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, f12, 0.0F);
GL11.glMatrixMode(GL11.GL_MODELVIEW);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glDepthMask(true);
GL11.glLoadIdentity();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
//GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
}
}
*/
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
//this.renderEquippedItems(par1EntityLivingBase, par9);
float f14 = par1EntityLivingBase.getBrightness(par9);
i = this.getColorMultiplier(par1EntityLivingBase, f14, par9);
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glDisable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
// The red hurt animation.
if ((i >> 24 & 255) > 0 || par1EntityLivingBase.hurtTime > 0 || par1EntityLivingBase.deathTime > 0)
{
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDepthFunc(GL11.GL_EQUAL);
if (par1EntityLivingBase.hurtTime > 0 || par1EntityLivingBase.deathTime > 0)
{
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
this.mainModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
for (int l = 0; l < 4; ++l)
{
if (this.inheritRenderPass(par1EntityLivingBase, l, par9) >= 0)
{
GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
}
}
if ((i >> 24 & 255) > 0)
{
f9 = (float)(i >> 16 & 255) / 255.0F;
f10 = (float)(i >> 8 & 255) / 255.0F;
float f15 = (float)(i & 255) / 255.0F;
f11 = (float)(i >> 24 & 255) / 255.0F;
GL11.glColor4f(f9, f10, f15, f11);
this.mainModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
for (int i1 = 0; i1 < 4; ++i1)
{
if (this.inheritRenderPass(par1EntityLivingBase, i1, par9) >= 0)
{
GL11.glColor4f(f9, f10, f15, f11);
this.renderPassModel.render(par1EntityLivingBase, f8, f7, f4, f3 - f2, f5, f6);
}
}
}
GL11.glDepthFunc(GL11.GL_LEQUAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
}
catch (Exception exception)
{
exception.printStackTrace();
}
OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GL11.glEnable(GL11.GL_TEXTURE_2D);
OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
this.passSpecialRender(par1EntityLivingBase, par2, par4, par6);
MinecraftForge.EVENT_BUS.post(new RenderLivingEvent.Post(par1EntityLivingBase, this, par2, par4, par6));
}
/**
* Returns a rotation angle that is inbetween two other rotation angles. par1 and par2 are the angles between which
* to interpolate, par3 is probably a float between 0.0 and 1.0 that tells us where "between" the two angles we are.
* Example: par1 = 30, par2 = 50, par3 = 0.5, then return = 40
*/
private float interpolateRotation(float par1, float par2, float par3)
{
float f3;
for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F)
{
;
}
while (f3 >= 180.0F)
{
f3 -= 360.0F;
}
return par1 + par3 * f3;
}
/**
* Defines what float the third param in setRotationAngles of ModelBase is
*/
protected float handleRotationFloat(EntityLivingBase par1EntityLivingBase, float par2)
{
return this.getTailRotation((EntitySpiritWolf)par1EntityLivingBase, par2);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.func_110914_a((EntitySpiritWolf)par1Entity);
}
}
@@ -1,64 +1,196 @@
package electroblob.wizardry.client.renderer;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashSet;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import cpw.mods.fml.relauncher.ReflectionHelper;
import electroblob.wizardry.tileentity.TileEntityStatue;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RenderZombie;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.entity.monster.EntityIronGolem;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.passive.EntityHorse;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class RenderStatue extends TileEntitySpecialRenderer<TileEntityStatue> {
public class RenderStatue extends TileEntitySpecialRenderer {
private static final ResourceLocation stoneTexture32 = new ResourceLocation("wizardry:textures/entity/stone_statue_32.png");
private static final ResourceLocation stoneTexture64 = new ResourceLocation("wizardry:textures/entity/stone_statue_64.png");
private static final HashSet<Class<? extends EntityLiving>> entitiesUsing64Texture = new HashSet<Class<? extends EntityLiving>>();
// Reflective method and field accesses; defined here since anything only ever needs to be reflectively accessed once.
private int destroyStage = 0; // Gets set each time a statue is rendered to allow access from the layer renderer
// Since the second argument is never used, it might as well be null.
private static final Method selectZombieModel = ReflectionHelper.findMethod(RenderZombie.class, null, new String[]{"func_82427_a"}, EntityZombie.class);
private static final Method preRenderCallback = ReflectionHelper.findMethod(RendererLivingEntity.class, null, new String[]{"func_77041_b", "preRenderCallback"}, EntityLivingBase.class, float.class);
private static final Method shouldRenderPass = ReflectionHelper.findMethod(RendererLivingEntity.class, null, new String[]{"func_77032_a", "shouldRenderPass"}, EntityLivingBase.class, int.class, float.class);
private static final Method renderEquippedItems = ReflectionHelper.findMethod(RendererLivingEntity.class, null, new String[]{"func_77029_c", "renderEquippedItems"}, EntityLivingBase.class, float.class);
private static final Field mainModelField = ReflectionHelper.findField(RendererLivingEntity.class, "field_77045_g", "mainModel");
private static final Field renderPassModelField = ReflectionHelper.findField(RendererLivingEntity.class, "field_77046_h", "renderPassModel");
static {
entitiesUsing64Texture.add(EntityZombie.class);
entitiesUsing64Texture.add(EntityPigZombie.class);
entitiesUsing64Texture.add(EntityVillager.class);
entitiesUsing64Texture.add(EntityWitch.class);
entitiesUsing64Texture.add(EntityHorse.class);
entitiesUsing64Texture.add(EntityIronGolem.class);
entitiesUsing64Texture.add(EntityWither.class);
}
@Override
public void renderTileEntityAt(TileEntityStatue statue, double x, double y, double z, float partialTicks, int destroyStage){
public void renderTileEntityAt(TileEntity tileentity, double x, double y,
double z, float partialTickTime) {
GL11.glPushMatrix();
// The next line makes stuff render in the same place relative to the world wherever the player is.
GL11.glTranslatef((float)x + 0.5F, (float)y, (float)z + 0.5F);
if(tileentity instanceof TileEntityStatue){
TileEntityStatue statue = (TileEntityStatue)tileentity;
if(statue.creature != null && statue.position == 1){
if(statue.isIce){
float yaw = statue.creature.prevRotationYaw;
int i = statue.creature.getBrightnessForRender(0);
if (statue.creature.isBurning())
{
i = 15728880;
}
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glRotatef(-yaw, 0F, 1F, 0F);
RenderManager.instance.renderEntityWithPosYaw(statue.creature, 0, 0, 0, 0, 0);
}else{
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
float someScalingFactor = 0.0625f;
float yaw = statue.creature.prevRotationYaw;
int brightness = statue.creature.getBrightnessForRender(0);
int j = brightness % 65536;
int k = brightness / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glRotatef(-yaw + 180, 0F, 1F, 0F);
Render render = RenderManager.instance.getEntityRenderObject(statue.creature);
if(render instanceof RendererLivingEntity){
RendererLivingEntity renderliving = (RendererLivingEntity)render;
// Reflection. This is... complete madness really, but it works!
// What it effectively does is emulate the doRender method in RendererLivingEntity, but with
// my own control over the textures.
// Edit: Switched over to the forge-supplied ReflectionHelper methods, since these make it a
// lot more concise and easy to read - since they're there, I might as well use them!
// Edit 2: In order for this to work outside the development environment, you need to supply the
// obfuscated (srg) names as well as the mcp ones, unless of course they are the same.
try {
// Chooses the appropriate zombie model, normal or villager
// Fixed by moving before the model fields are accessed
if(render instanceof RenderZombie && statue.creature instanceof EntityZombie){
selectZombieModel.invoke(renderliving, (EntityZombie)statue.creature);
}
// Turns out that java automatically infers the type parameter T in this method from the type
// I am assigning the returned value to. Neat!
ModelBase mainModel = (ModelBase) mainModelField.get(renderliving);
ModelBase renderPassModel = (ModelBase) renderPassModelField.get(renderliving);
mainModel.isRiding = statue.creature.isRiding();
mainModel.isChild = statue.creature.isChild();
if(renderPassModel != null){
renderPassModel.isRiding = statue.creature.isRiding();
renderPassModel.isChild = statue.creature.isChild();
}
if(entitiesUsing64Texture.contains(statue.creature.getClass())){
Minecraft.getMinecraft().renderEngine.bindTexture(stoneTexture64);
}else{
Minecraft.getMinecraft().renderEngine.bindTexture(stoneTexture32);
}
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glScalef(-1.0F, -1.0F, 1.0F);
preRenderCallback.invoke(renderliving, statue.creature, someScalingFactor);
// Why is this -1.5f? No idea!
GL11.glTranslatef(0, -1.5f, 0);
GL11.glEnable(GL11.GL_ALPHA_TEST);
mainModel.render(statue.creature, 0, 0, 0, 0, 0, someScalingFactor);
for(int i=0; i<4; i++){
if((Integer)shouldRenderPass.invoke(render, statue.creature, i, someScalingFactor) > 0){
// Should never be null here since shouldRenderPass returns -1 when it is null, but there's no harm in checking.
if(renderPassModel != null) renderPassModel.render(statue.creature, 0, 0, 0, 0, 0, someScalingFactor);
}
}
GL11.glDepthMask(true);
renderEquippedItems.invoke(render, statue.creature, someScalingFactor);
// 'Pokemon' exception handling... Because why not?!
} catch (Exception e) {
System.err.println("Something went very wrong! Error while rendering petrified creature:");
e.printStackTrace();
}
}
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
}
// Multiblock support for the breaking animation. The chest has its own way of doing this in
// TileEntityRendererDispatcher, but I don't have access to that.
if(statue.position != 1 && destroyStage >= 0){
TileEntity tileentity = statue.getWorld().getTileEntity(statue.getPos().down(statue.position-1));
//System.out.println(tileentity);
if(tileentity instanceof TileEntityStatue){
// If this is the block breaking animation pass and this isn't the bottom block, divert the call to
// the bottom block.
this.renderTileEntityAt((TileEntityStatue)tileentity, x, y - (statue.position-1), z, partialTicks, destroyStage);
}
}
if(statue.creature != null && statue.position == 1){
this.destroyStage = destroyStage;
GlStateManager.pushMatrix();
// The next line makes stuff render in the same place relative to the world wherever the player is.
GlStateManager.translate((float)x + 0.5F, (float)y, (float)z + 0.5F);
GlStateManager.enableLighting();
float yaw = statue.creature.prevRotationYaw;
int i = statue.creature.getBrightnessForRender(0);
int j = i % 65536;
int k = i / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.rotate(-yaw, 0F, 1F, 0F);
// Stops the normal model from rendering.
if(!statue.isIce) statue.creature.setInvisible(true);
// Setting the last parameter to true prevents the debug bounding box from rendering.
// For some reason, passing in the partialTicks causes the entity to spin round really fast
Minecraft.getMinecraft().getRenderManager().doRenderEntity(statue.creature, 0, 0, 0, 0, 0, true);
if(!statue.isIce) statue.creature.setInvisible(false);
GlStateManager.popMatrix();
}
}
public ResourceLocation getBlockBreakingTexture(){
return destroyStage < 0 ? null : DESTROY_STAGES[destroyStage];
GL11.glPopMatrix();
}
}
@@ -0,0 +1,90 @@
package electroblob.wizardry.client.renderer;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.client.entity.AbstractClientPlayer;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderPlayer;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.scoreboard.Score;
import net.minecraft.scoreboard.ScoreObjective;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.event.RenderPlayerEvent;
import net.minecraftforge.common.MinecraftForge;
@Deprecated
public class RenderTransientPlayer extends RenderPlayer {
private static final ResourceLocation steveTextures = new ResourceLocation("textures/entity/steve.png");
private ModelBiped modelBipedMain;
private ModelBiped modelArmorChestplate;
private ModelBiped modelArmor;
public RenderTransientPlayer()
{
super();
this.modelBipedMain = (ModelBiped)this.mainModel;
this.modelArmorChestplate = new ModelBiped(1.0F);
this.modelArmor = new ModelBiped(0.5F);
}
public void func_130009_a(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9)
{
float f2 = 1.0F;
GL11.glColor4f(f2, f2, f2, 0.5f);
ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem();
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = itemstack != null ? 1 : 0;
if (itemstack != null && par1AbstractClientPlayer.getItemInUseCount() > 0)
{
EnumAction enumaction = itemstack.getItemUseAction();
if (enumaction == EnumAction.block)
{
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 3;
}
else if (enumaction == EnumAction.bow)
{
this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = true;
}
}
this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = par1AbstractClientPlayer.isSneaking();
double d3 = par4 - (double)par1AbstractClientPlayer.yOffset;
if (par1AbstractClientPlayer.isSneaking() && !(par1AbstractClientPlayer instanceof EntityPlayerSP))
{
d3 -= 0.125D;
}
super.doRender(par1AbstractClientPlayer, par2, d3, par6, par8, par9);
this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false;
this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false;
this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0;
MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this, par9));
}
}
@@ -0,0 +1,97 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
public class RenderTranslucentItem implements IItemRenderer {
Minecraft mc = Minecraft.getMinecraft();
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
if(type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED){
return true;
}
return false;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
ItemRendererHelper helper) {
return false;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
if(type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED){
GL11.glPushMatrix();
TextureManager texturemanager = this.mc.getTextureManager();
IIcon icon = mc.thePlayer.getItemIcon(item, 1);
if (icon == null)
{
GL11.glPopMatrix();
return;
}
texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glEnable(GL11.GL_BLEND);
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
if (item.hasEffect(1))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
texturemanager.bindTexture(RES_ITEM_GLINT);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f7 = 0.76F;
GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f8 = 0.125F;
GL11.glScalef(f8, f8, f8);
float f9 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f9, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f8, f8, f8);
f9 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f9, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
}
}
@@ -0,0 +1,134 @@
package electroblob.wizardry.client.renderer;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL12;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.IItemRenderer;
@Deprecated
public class RenderWand implements IItemRenderer {
Minecraft mc = Minecraft.getMinecraft();
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
private static final ResourceLocation magicEffect = new ResourceLocation("wizardry:textures/entity/aura.png");
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
if(type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED){
return true;
}
return false;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item,
ItemRendererHelper helper) {
return false;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
if(type == ItemRenderType.EQUIPPED_FIRST_PERSON || type == ItemRenderType.EQUIPPED){
GL11.glPushMatrix();
TextureManager texturemanager = this.mc.getTextureManager();
IIcon icon = mc.thePlayer.getItemIcon(item, 1);
if (icon == null)
{
GL11.glPopMatrix();
return;
}
texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
if (item.hasEffect(1))
{
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
texturemanager.bindTexture(RES_ITEM_GLINT);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f7 = 0.76F;
GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F);
GL11.glMatrixMode(GL11.GL_TEXTURE);
GL11.glPushMatrix();
float f8 = 0.125F;
GL11.glScalef(f8, f8, f8);
float f9 = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(f9, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(f8, f8, f8);
f9 = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-f9, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
Entity entity = (Entity)data[1];
// Spell charge-up effect
if(entity instanceof EntityPlayer && ((EntityPlayer)entity).isUsingItem()){
//System.out.println(type.toString());
GL11.glPushMatrix();
//GL11.glEnable(GL11.GL_BLEND);
//GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor3f(1, 0, 0);
GL11.glRotatef(180, 1, 0, 0);
//GL11.glRotatef(180.0F - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);
//GL11.glRotatef(-RenderManager.instance.playerViewX, 1.0F, 0.0F, 0.0F);
texturemanager.bindTexture(magicEffect);
tessellator.startDrawingQuads();
tessellator.addVertex(0, 0, 0);
tessellator.addVertex(0, 1, 0);
tessellator.addVertex(1, 1, 0);
tessellator.addVertex(1, 0, 0);
tessellator.draw();
//GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
GL11.glPopMatrix();
}
}
}
@@ -1,34 +1,213 @@
package electroblob.wizardry.client.renderer;
import electroblob.wizardry.Wizardry;
import static net.minecraftforge.client.IItemRenderer.ItemRenderType.EQUIPPED;
import static net.minecraftforge.client.IItemRenderer.ItemRendererHelper.BLOCK_3D;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.client.model.ModelWizard;
import electroblob.wizardry.entity.living.EntityWizard;
import net.minecraft.block.Block;
import net.minecraft.client.model.ModelVillager;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.layers.LayerBipedArmor;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.MinecraftForgeClient;
@SideOnly(Side.CLIENT)
public class RenderWizard extends RenderBiped<EntityWizard> {
public class RenderWizard extends RenderBiped
{
static final ResourceLocation[] textures = new ResourceLocation[6];
public RenderWizard(RenderManager renderManager){
super(renderManager, new ModelWizard(), 0.5F);
public RenderWizard()
{
super(new ModelWizard(), 0.5F);
for(int i=0;i<6;i++){
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/wizard_" + i + ".png");
textures[i] = new ResourceLocation("wizardry:textures/entity/wizard_" + i + ".png");
}
// Just using the default without overriding models, since the armour sets its own model anyway.
this.addLayer(new LayerBipedArmor(this));
}
@Override
protected ResourceLocation getEntityTexture(EntityWizard wizard) {
return textures[wizard.textureIndex];
}
/**
* Determines wether Villager Render pass or not.
*/
protected int shouldVillagerRenderPass(EntityWizard par1EntityWizard, int par2, float par3)
{
return -1;
}
public void renderVillager(EntityWizard par1EntityWizard, double par2, double par4, double par6, float par8, float par9)
{
super.doRender(par1EntityWizard, par2, par4, par6, par8, par9);
}
protected ResourceLocation func_110902_a(EntityWizard par1EntityWizard)
{
return textures[par1EntityWizard.textureIndex];
}
protected void renderVillagerEquipedItems(EntityWizard par1EntityWizard, float par2)
{
super.renderEquippedItems(par1EntityWizard, par2);
/*
ItemStack itemstack1 = par1EntityWizard.getHeldItem();
if (itemstack1 != null)
{
GL11.glPushMatrix();
this.villagerModel.bipedRightArm.postRender(0.0625F);
GL11.glTranslatef(-0.0625F, 0.5375F, 0.0625F);
EnumAction enumaction = null;
float f11;
float f6;
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack1, EQUIPPED);
boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemstack1, BLOCK_3D));
boolean isBlock = itemstack1.itemID < Block.blocksList.length && itemstack1.getItemSpriteNumber() == 0;
if (is3D || (isBlock && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack1.itemID].getRenderType())))
{
f11 = 0.5F;
GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
f11 *= 0.75F;
GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(-f11, -f11, f11);
}
else if (itemstack1.itemID == Item.bow.itemID)
{
f11 = 0.625F;
GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
GL11.glRotatef(-20.0F, 0.0F, 1.0F, 0.0F);
GL11.glScalef(f11, -f11, f11);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else if (Item.itemsList[itemstack1.itemID].isFull3D())
{
f11 = 0.625F;
if (Item.itemsList[itemstack1.itemID].shouldRotateAroundWhenRendering())
{
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -0.125F, 0.0F);
}
GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
GL11.glScalef(f11, -f11, f11);
GL11.glRotatef(-100.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
}
else
{
f11 = 0.375F;
GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
GL11.glScalef(f11, f11, f11);
GL11.glRotatef(60.0F, 0.0F, 0.0F, 1.0F);
GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(20.0F, 0.0F, 0.0F, 1.0F);
}
float f12;
float f13;
int j;
if (itemstack1.getItem().requiresMultipleRenderPasses())
{
for (j = 0; j < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++j)
{
int k = itemstack1.getItem().getColorFromItemStack(itemstack1, j);
f13 = (float)(k >> 16 & 255) / 255.0F;
f12 = (float)(k >> 8 & 255) / 255.0F;
f6 = (float)(k & 255) / 255.0F;
GL11.glColor4f(f13, f12, f6, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityWizard, itemstack1, j);
}
}
else
{
j = itemstack1.getItem().getColorFromItemStack(itemstack1, 0);
float f14 = (float)(j >> 16 & 255) / 255.0F;
f13 = (float)(j >> 8 & 255) / 255.0F;
f12 = (float)(j & 255) / 255.0F;
GL11.glColor4f(f14, f13, f12, 1.0F);
this.renderManager.itemRenderer.renderItem(par1EntityWizard, itemstack1, 0);
}
GL11.glPopMatrix();
}
*/
}
protected void preRenderVillager(EntityWizard par1EntityWizard, float par2)
{
float f1 = 0.9375F;
this.shadowSize = 0.5F;
GL11.glScalef(f1, f1, f1);
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.renderVillager((EntityWizard)par1EntityLiving, par2, par4, par6, par8, par9);
}
/**
* Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
* entityLiving, partialTickTime
*/
protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2)
{
this.preRenderVillager((EntityWizard)par1EntityLivingBase, par2);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase par1EntityLivingBase, int par2, float par3)
{
// TODO: Is this the right method name now? There are several with correct parameters. This one may end up being recursive!
return this.shouldRenderPass((EntityLiving)par1EntityLivingBase, par2, par3);
//return this.shouldVillagerRenderPass((EntityWizard)par1EntityLivingBase, par2, par3);
}
protected void renderEquippedItems(EntityLivingBase par1EntityLivingBase, float par2)
{
this.renderVillagerEquipedItems((EntityWizard)par1EntityLivingBase, par2);
}
public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
this.renderVillager((EntityWizard)par1EntityLivingBase, par2, par4, par6, par8, par9);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.func_110902_a((EntityWizard)par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderVillager((EntityWizard)par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -1,26 +1,72 @@
package electroblob.wizardry.client.renderer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntityBlazeMinion;
import net.minecraft.client.model.ModelBlaze;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class RenderWraithMinion extends RenderLiving<EntityBlazeMinion>
public class RenderWraithMinion extends RenderLiving
{
private ResourceLocation texture = new ResourceLocation("textures/entity/blaze.png");
private ResourceLocation blazeTextures;
private int field_77068_a;
public RenderWraithMinion(RenderManager renderManagerIn)
public RenderWraithMinion(ResourceLocation texture)
{
super(renderManagerIn, new ModelBlaze(), 0.5F);
super(new ModelBlaze(), 0.5F);
this.field_77068_a = ((ModelBlaze)this.mainModel).func_78104_a();
this.blazeTextures = texture;
}
@Override
protected ResourceLocation getEntityTexture(EntityBlazeMinion entity)
public void renderBlaze(EntityLiving par1EntityBlazeMinion, double par2, double par4, double par6, float par8, float par9)
{
return texture;
int i = ((ModelBlaze)this.mainModel).func_78104_a();
if (i != this.field_77068_a)
{
this.field_77068_a = i;
this.mainModel = new ModelBlaze();
}
super.doRender(par1EntityBlazeMinion, par2, par4, par6, par8, par9);
}
protected ResourceLocation getBlazeTextures(EntityLiving par1Entity)
{
return blazeTextures;
}
public void doRenderLiving(EntityLiving par1EntityLiving, double par2, double par4, double par6, float par8, float par9)
{
this.renderBlaze(par1EntityLiving, par2, par4, par6, par8, par9);
}
public void renderPlayer(EntityLivingBase par1EntityLivingBase, double par2, double par4, double par6, float par8, float par9)
{
this.renderBlaze((EntityLiving) par1EntityLivingBase, par2, par4, par6, par8, par9);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity par1Entity)
{
return this.getBlazeTextures((EntityLiving)par1Entity);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
{
this.renderBlaze((EntityLiving)par1Entity, par2, par4, par6, par8, par9);
}
}
@@ -0,0 +1,157 @@
package electroblob.wizardry.client.renderer;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.model.ModelZombie;
import net.minecraft.client.model.ModelZombieVillager;
import net.minecraft.client.renderer.entity.RenderBiped;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityPigZombie;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import electroblob.wizardry.entity.living.EntityZombieMinion;
@SideOnly(Side.CLIENT)
public class RenderZombieMinion extends RenderBiped
{
private static final ResourceLocation zombieTextures = new ResourceLocation("textures/entity/zombie/zombie.png");
private ModelBiped field_82434_o;
protected ModelBiped field_82437_k;
protected ModelBiped field_82435_l;
public RenderZombieMinion()
{
super(new ModelZombie(), 0.5F, 1.0F);
this.field_82434_o = this.modelBipedMain;
}
protected void func_82421_b()
{
this.field_82423_g = new ModelZombie(1.0F, true);
this.field_82425_h = new ModelZombie(0.5F, true);
this.field_82437_k = this.field_82423_g;
this.field_82435_l = this.field_82425_h;
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityZombieMinion p_77032_1_, int p_77032_2_, float p_77032_3_)
{
this.func_82427_a(p_77032_1_);
return super.shouldRenderPass((EntityLiving)p_77032_1_, p_77032_2_, p_77032_3_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityZombieMinion p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.func_82427_a(p_76986_1_);
super.doRender((EntityLiving)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntityZombieMinion p_110775_1_)
{
return zombieTextures;
}
protected void renderEquippedItems(EntityZombieMinion p_77029_1_, float p_77029_2_)
{
this.func_82427_a(p_77029_1_);
super.renderEquippedItems((EntityLiving)p_77029_1_, p_77029_2_);
}
private void func_82427_a(EntityZombieMinion p_82427_1_)
{
this.mainModel = this.field_82434_o;
this.field_82423_g = this.field_82437_k;
this.field_82425_h = this.field_82435_l;
this.modelBipedMain = (ModelBiped)this.mainModel;
}
protected void renderEquippedItems(EntityLiving p_77029_1_, float p_77029_2_)
{
this.renderEquippedItems((EntityZombieMinion)p_77029_1_, p_77029_2_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(EntityLiving p_110775_1_)
{
return this.getEntityTexture((EntityZombieMinion)p_110775_1_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLiving p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityZombieMinion)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLiving p_77032_1_, int p_77032_2_, float p_77032_3_)
{
return this.shouldRenderPass((EntityZombieMinion)p_77032_1_, p_77032_2_, p_77032_3_);
}
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityLivingBase p_77032_1_, int p_77032_2_, float p_77032_3_)
{
return this.shouldRenderPass((EntityZombieMinion)p_77032_1_, p_77032_2_, p_77032_3_);
}
protected void renderEquippedItems(EntityLivingBase p_77029_1_, float p_77029_2_)
{
this.renderEquippedItems((EntityZombieMinion)p_77029_1_, p_77029_2_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityZombieMinion)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
/**
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
*/
protected ResourceLocation getEntityTexture(Entity p_110775_1_)
{
return this.getEntityTexture((EntityZombieMinion)p_110775_1_);
}
/**
* Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
* handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
* (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1,
* double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
*/
public void doRender(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_)
{
this.doRender((EntityZombieMinion)p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
}
}