Initial 1.11.2 update
This commit is contained in:
@@ -145,6 +145,7 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
|
||||
/**
|
||||
* The client proxy for wizardry.
|
||||
*
|
||||
* @author Electroblob
|
||||
* @since Wizardry 1.0
|
||||
*/
|
||||
@@ -152,155 +153,168 @@ 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 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");
|
||||
|
||||
// Armour Model
|
||||
public static final ModelBiped WIZARD_ARMOUR_MODEL = new ModelWizardArmour(0.75f);
|
||||
|
||||
|
||||
// SECTION Registry
|
||||
// ===============================================================================================================
|
||||
|
||||
|
||||
@Override
|
||||
public ModelBiped getWizardArmourModel(){
|
||||
return WIZARD_ARMOUR_MODEL;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerKeyBindings(){
|
||||
ClientRegistry.registerKeyBinding(NEXT_SPELL);
|
||||
ClientRegistry.registerKeyBinding(PREVIOUS_SPELL);
|
||||
public void registerKeyBindings(){
|
||||
ClientRegistry.registerKeyBinding(NEXT_SPELL);
|
||||
ClientRegistry.registerKeyBinding(PREVIOUS_SPELL);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerSpellHUD(){
|
||||
public void registerSpellHUD(){
|
||||
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) {
|
||||
public void setToNumberSliderEntry(Property property){
|
||||
property.setConfigEntryClass(NumberSliderEntry.class);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public World getTheWorld() {
|
||||
return Minecraft.getMinecraft().theWorld;
|
||||
public World getTheWorld(){
|
||||
return Minecraft.getMinecraft().world;
|
||||
}
|
||||
|
||||
@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));
|
||||
Minecraft.getMinecraft().getSoundHandler()
|
||||
.playSound(new MovingSoundEntity(entity, sound, volume, pitch, repeat));
|
||||
}
|
||||
|
||||
|
||||
// SECTION Items
|
||||
// ===============================================================================================================
|
||||
|
||||
|
||||
@Override
|
||||
public FontRenderer getFontRenderer(ItemStack stack){
|
||||
|
||||
|
||||
Spell spell = Spells.none;
|
||||
|
||||
|
||||
if(stack.getItem() instanceof ItemWand){
|
||||
spell = WandHelper.getCurrentSpell(stack);
|
||||
}else if(stack.getItem() instanceof ItemSpellBook || stack.getItem() instanceof ItemScroll){
|
||||
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(Minecraft.getMinecraft().player != null && Wizardry.settings.discoveryMode
|
||||
&& WizardData.get(Minecraft.getMinecraft().player) != null
|
||||
&& !Minecraft.getMinecraft().player.capabilities.isCreativeMode
|
||||
&& !WizardData.get(Minecraft.getMinecraft().player).hasSpellBeenDiscovered(spell)){
|
||||
return mixedFontRenderer;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getScrollDisplayName(ItemStack scroll){
|
||||
|
||||
// Displays [Empty slot] if spell is continuous.
|
||||
Spell spell = Spell.get(scroll.getItemDamage());
|
||||
if(spell.isContinuous) spell = Spells.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.
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
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)){
|
||||
discovered = false;
|
||||
}
|
||||
|
||||
|
||||
if(discovered){
|
||||
return I18n.format("item.wizardry:scroll.name", spell.getDisplayName()).trim();
|
||||
}else{
|
||||
return I18n.format("item.wizardry:scroll.undiscovered.name", "#" + SpellGlyphData.getGlyphName(spell, player.worldObj) + "#").trim();
|
||||
return I18n.format("item.wizardry:scroll.undiscovered.name",
|
||||
"#" + SpellGlyphData.getGlyphName(spell, player.world) + "#").trim();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public double getConjuredBowDurability(ItemStack stack){
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
if(player.getActiveItemStack() == stack){
|
||||
return (double)(stack.getItemDamage() + (player.getItemInUseMaxCount()) ) / (double)stack.getMaxDamage();
|
||||
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(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){
|
||||
|
||||
// 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);
|
||||
|
||||
if(type != WizardryParticleType.MAGIC_FIRE) r = MathHelper.clamp(r, 0, 1);
|
||||
g = MathHelper.clamp(g, 0, 1);
|
||||
b = MathHelper.clamp(b, 0, 1);
|
||||
|
||||
switch(type){
|
||||
|
||||
|
||||
case BLIZZARD:
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleBlizzard(world, 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 ParticleDust(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 ParticleDarkMagic(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 ParticleDust(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 ParticleIce(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 ParticleLeaf(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 ParticleGiantBubble(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 ParticleMagicFlame(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 ParticlePath(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));
|
||||
@@ -309,41 +323,46 @@ public class ClientProxy extends CommonProxy {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleSpark(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));
|
||||
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));
|
||||
Minecraft.getMinecraft().effectRenderer
|
||||
.addEffect(new ParticleRotatingSparkle(world, maxAge, x, z, radius, y, r, g, b));
|
||||
break;
|
||||
default:
|
||||
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 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)));
|
||||
}
|
||||
|
||||
// SECTION Packet Handlers
|
||||
// ===============================================================================================================
|
||||
|
||||
|
||||
@Override
|
||||
public void handleCastSpellPacket(PacketCastSpell.Message message){
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
World world = Minecraft.getMinecraft().world;
|
||||
Entity caster = world.getEntityByID(message.casterID);
|
||||
Spell spell = Spell.get(message.spellID);
|
||||
// Should always be true
|
||||
if(caster instanceof EntityPlayer){
|
||||
|
||||
|
||||
((EntityPlayer)caster).setActiveHand(message.hand);
|
||||
|
||||
|
||||
// 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){
|
||||
@@ -352,56 +371,59 @@ public class ClientProxy extends CommonProxy {
|
||||
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));
|
||||
|
||||
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){
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
World world = Minecraft.getMinecraft().world;
|
||||
Entity caster = world.getEntityByID(message.casterID);
|
||||
Spell spell = Spell.get(message.spellID);
|
||||
// Should always be true
|
||||
if(caster instanceof EntityPlayer){
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
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;
|
||||
World world = Minecraft.getMinecraft().world;
|
||||
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));
|
||||
// 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);
|
||||
@@ -412,55 +434,56 @@ public class ClientProxy extends CommonProxy {
|
||||
Wizardry.logger.warn("Recieved a PacketNPCCastSpell, but the caster ID was not the ID of an EntityLiving");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleTransportationPacket(PacketTransportation.Message message){
|
||||
|
||||
World world = Minecraft.getMinecraft().theWorld;
|
||||
|
||||
World world = Minecraft.getMinecraft().world;
|
||||
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++){
|
||||
|
||||
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 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)));
|
||||
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 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)));
|
||||
}
|
||||
for(int i=0; i<20; i++){
|
||||
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 z = caster.posZ + radius*Math.sin(angle);
|
||||
world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, x, y, z, 0, 0.02, 0);
|
||||
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 z = caster.posZ + radius * Math.sin(angle);
|
||||
world.spawnParticle(EnumParticleTypes.VILLAGER_HAPPY, x, y, z, 0, 0.02, 0);
|
||||
}
|
||||
for(int i=0; i<20; i++){
|
||||
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 z = caster.posZ + radius*Math.sin(angle);
|
||||
world.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, x, y, z, 0, 0.02, 0);
|
||||
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 z = caster.posZ + radius * Math.sin(angle);
|
||||
world.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, x, y, z, 0, 0.02, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handlePlayerSyncPacket(Message message){
|
||||
|
||||
WizardData properties = WizardData.get(Minecraft.getMinecraft().thePlayer);
|
||||
|
||||
|
||||
WizardData properties = WizardData.get(Minecraft.getMinecraft().player);
|
||||
|
||||
if(properties != null){
|
||||
|
||||
|
||||
properties.spellsDiscovered = message.spellsDiscovered;
|
||||
|
||||
|
||||
if(message.selectedMinionID == -1){
|
||||
properties.selectedMinion = null;
|
||||
}else{
|
||||
Entity entity = Minecraft.getMinecraft().theWorld.getEntityByID(message.selectedMinionID);
|
||||
|
||||
Entity entity = Minecraft.getMinecraft().world.getEntityByID(message.selectedMinionID);
|
||||
|
||||
if(entity instanceof ISummonedCreature){
|
||||
properties.selectedMinion = new WeakReference<ISummonedCreature>((ISummonedCreature)entity);
|
||||
}else{
|
||||
@@ -469,92 +492,119 @@ public class ClientProxy extends CommonProxy {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleGlyphDataPacket(electroblob.wizardry.packet.PacketGlyphData.Message message){
|
||||
|
||||
SpellGlyphData data = SpellGlyphData.get(Minecraft.getMinecraft().theWorld);
|
||||
|
||||
SpellGlyphData data = SpellGlyphData.get(Minecraft.getMinecraft().world);
|
||||
|
||||
data.randomNames = new HashMap<Spell, String>();
|
||||
data.randomDescriptions = new HashMap<Spell, String>();
|
||||
|
||||
|
||||
for(Spell spell : Spell.getSpells(Spell.allSpells)){
|
||||
// -1 because the none spell isn't included
|
||||
data.randomNames.put(spell, message.names.get(spell.id() - 1));
|
||||
data.randomDescriptions.put(spell, message.descriptions.get(spell.id() - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleClairvoyancePacket(electroblob.wizardry.packet.PacketClairvoyance.Message message) {
|
||||
Clairvoyance.spawnPathPaticles(Minecraft.getMinecraft().theWorld, message.path, message.durationMultiplier);
|
||||
public void handleClairvoyancePacket(electroblob.wizardry.packet.PacketClairvoyance.Message message){
|
||||
Clairvoyance.spawnPathPaticles(Minecraft.getMinecraft().world, 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");
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerRenderers(){
|
||||
|
||||
|
||||
// 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(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);
|
||||
|
||||
// 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,
|
||||
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(EntityForceArrow.class, RenderForceArrow::new);
|
||||
|
||||
// Creatures
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritWolf.class, manager -> new RenderSpiritWolf(manager, 0.5f));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritHorse.class, manager -> new RenderSpiritHorse(manager, 0.5f));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritWolf.class,
|
||||
manager -> new RenderSpiritWolf(manager));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySpiritHorse.class,
|
||||
manager -> new RenderSpiritHorse(manager));
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityWizard.class, RenderWizard::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityEvilWizard.class, RenderEvilWizard::new);
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityDecoy.class, RenderDecoy::new);
|
||||
|
||||
// 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, 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));
|
||||
|
||||
// Effects and constructs
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityArc.class, RenderArc::new);
|
||||
@@ -576,13 +626,19 @@ public class ClientProxy extends CommonProxy {
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityHailstorm.class, RenderBlank::new);
|
||||
|
||||
// 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(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(EntityLightningPulse.class,
|
||||
manager -> new RenderLightningPulse(manager, 8.0f));
|
||||
|
||||
// TESRs
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityArcaneWorkbench.class, new RenderArcaneWorkbench());
|
||||
|
||||
@@ -1,76 +1,81 @@
|
||||
package electroblob.wizardry.client;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
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 net.minecraftforge.fml.common.registry.EntityEntry;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
|
||||
/** [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. */
|
||||
/**
|
||||
* [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;
|
||||
protected Object entityClass;
|
||||
|
||||
public EntityNameEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement, Object value)
|
||||
{
|
||||
super(owningScreen, owningEntryList, configElement, value);
|
||||
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)
|
||||
{
|
||||
//super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected);
|
||||
this.btnValue.xPosition = listWidth / 4;
|
||||
this.btnValue.yPosition = y;
|
||||
public EntityNameEntry(GuiEditArray owningScreen, GuiEditArrayEntries owningEntryList, IConfigElement configElement,
|
||||
Object value){
|
||||
super(owningScreen, owningEntryList, configElement, value);
|
||||
this.btnValue = new GuiButtonExt(0, 0, 0, owningEntryList.controlWidth, 18,
|
||||
I18n.format(this.textFieldValue.getText()));
|
||||
// this.btnValue.enabled = owningScreen.enabled;
|
||||
}
|
||||
|
||||
String trans = I18n.format(this.textFieldValue.getText());
|
||||
if (!trans.equals(this.textFieldValue.getText()))
|
||||
this.btnValue.displayString = trans;
|
||||
else
|
||||
this.btnValue.displayString = this.textFieldValue.getText();
|
||||
//btnValue.packedFGColour = value ? GuiUtils.getColorCode('2', true) : GuiUtils.getColorCode('4', true);
|
||||
@Override
|
||||
public void drawEntry(int slotIndex, int x, int y, int listWidth, int slotHeight, int mouseX, int mouseY,
|
||||
boolean isSelected){
|
||||
// super.drawEntry(slotIndex, x, y, listWidth, slotHeight, tessellator, mouseX, mouseY, isSelected);
|
||||
this.btnValue.xPosition = listWidth / 4;
|
||||
this.btnValue.yPosition = y;
|
||||
|
||||
this.btnValue.drawButton(owningEntryList.getMC(), mouseX, mouseY);
|
||||
}
|
||||
String trans = I18n.format(this.textFieldValue.getText());
|
||||
if(!trans.equals(this.textFieldValue.getText()))
|
||||
this.btnValue.displayString = trans;
|
||||
else
|
||||
this.btnValue.displayString = this.textFieldValue.getText();
|
||||
// btnValue.packedFGColour = value ? GuiUtils.getColorCode('2', true) : GuiUtils.getColorCode('4', true);
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(int index, int x, int y, int mouseEvent, int relativeX, int relativeY)
|
||||
{
|
||||
if (this.btnValue.mousePressed(owningEntryList.getMC(), 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));
|
||||
owningEntryList.recalculateState();
|
||||
return true;
|
||||
}
|
||||
this.btnValue.drawButton(owningEntryList.getMC(), mouseX, mouseY);
|
||||
}
|
||||
|
||||
return super.mousePressed(index, x, y, mouseEvent, relativeX, relativeY);
|
||||
}
|
||||
@Override
|
||||
public boolean mousePressed(int index, int x, int y, int mouseEvent, int relativeX, int relativeY){
|
||||
if(this.btnValue.mousePressed(owningEntryList.getMC(), x, y)){
|
||||
btnValue.playPressSound(owningEntryList.getMC().getSoundHandler());
|
||||
// Goodness only knows if this works, but the class is unimplemented right now so it doesn't really matter.
|
||||
Map<Object, String> map = ForgeRegistries.ENTITIES.getEntries().stream().collect(
|
||||
Collectors.<Entry<ResourceLocation, EntityEntry>, Object, String>toMap(e -> e.getValue().getClass(),
|
||||
e -> e.getValue().getName()));
|
||||
Minecraft.getMinecraft().displayGuiScreen(
|
||||
new GuiSelectString(this.owningScreen, configElement, index, map, this.getValue(), true));
|
||||
owningEntryList.recalculateState();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(int index, int x, int y, int mouseEvent, int relativeX, int relativeY)
|
||||
{
|
||||
this.btnValue.mouseReleased(x, y);
|
||||
super.mouseReleased(index, x, y, mouseEvent, relativeX, relativeY);
|
||||
}
|
||||
return super.mousePressed(index, x, y, mouseEvent, relativeX, relativeY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue()
|
||||
{
|
||||
return this.textFieldValue.getText();
|
||||
}
|
||||
@Override
|
||||
public void mouseReleased(int index, int x, int y, int mouseEvent, int relativeX, int relativeY){
|
||||
this.btnValue.mouseReleased(x, y);
|
||||
super.mouseReleased(index, x, y, mouseEvent, relativeX, relativeY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getValue(){
|
||||
return this.textFieldValue.getText();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,14 +30,15 @@ import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
|
||||
public class GuiArcaneWorkbench extends GuiContainer {
|
||||
|
||||
private GuiButton applyBtn;
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/gui/arcane_workbench.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/arcane_workbench.png");
|
||||
|
||||
private IInventory playerInventory;
|
||||
private IInventory arcaneWorkbenchInventory;
|
||||
|
||||
private final int tooltipWidth = 164;
|
||||
|
||||
public GuiArcaneWorkbench(InventoryPlayer invPlayer, TileEntityArcaneWorkbench entity) {
|
||||
public GuiArcaneWorkbench(InventoryPlayer invPlayer, TileEntityArcaneWorkbench entity){
|
||||
super(new ContainerArcaneWorkbench(invPlayer, entity));
|
||||
this.playerInventory = invPlayer;
|
||||
this.arcaneWorkbenchInventory = entity;
|
||||
@@ -49,12 +50,13 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
public void drawScreen(int p_73863_1_, int p_73863_2_, float p_73863_3_){
|
||||
|
||||
// Tests if there is a wand in the workbench and edits the positioning accordingly
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
guiLeft = (this.width - this.xSize - tooltipWidth)/2;
|
||||
this.applyBtn.xPosition = (this.width - tooltipWidth)/2 + 48;
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots
|
||||
.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
guiLeft = (this.width - this.xSize - tooltipWidth) / 2;
|
||||
this.applyBtn.xPosition = (this.width - tooltipWidth) / 2 + 48;
|
||||
}else{
|
||||
guiLeft = (this.width - this.xSize)/2;
|
||||
this.applyBtn.xPosition = this.width/2 + 48;
|
||||
guiLeft = (this.width - this.xSize) / 2;
|
||||
this.applyBtn.xPosition = this.width / 2 + 48;
|
||||
}
|
||||
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack()){
|
||||
@@ -67,10 +69,10 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY) {
|
||||
public void drawGuiContainerBackgroundLayer(float f, int mouseX, int mouseY){
|
||||
|
||||
GlStateManager.pushAttrib();
|
||||
|
||||
|
||||
GlStateManager.color(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
|
||||
@@ -78,55 +80,58 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
// Changing slots
|
||||
for(int i=0; i<ContainerArcaneWorkbench.CRYSTAL_SLOT; i++){
|
||||
for(int i = 0; i < ContainerArcaneWorkbench.CRYSTAL_SLOT; i++){
|
||||
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);
|
||||
if(slot.xPos >= 0 && slot.yPos >= 0)
|
||||
this.drawTexturedModalRect(guiLeft + slot.xPos - 10, guiTop + slot.yPos - 10, 0, 220, 36, 36);
|
||||
}
|
||||
|
||||
// Tooltip only drawn if there is a wand
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots
|
||||
.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
|
||||
// Tooltip box
|
||||
drawTexturedModalRect(guiLeft + xSize, guiTop, xSize, 0, 256 - xSize - 4, ySize);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, xSize + 4, 0, tooltipWidth - 2*(256 - xSize - 4), ySize);
|
||||
drawTexturedModalRect(guiLeft + xSize + tooltipWidth - (256 - xSize - 4), guiTop, xSize + 4, 0, 256 - xSize - 4, ySize);
|
||||
drawTexturedModalRect(guiLeft + 252, guiTop, xSize + 4, 0, tooltipWidth - 2 * (256 - xSize - 4), ySize);
|
||||
drawTexturedModalRect(guiLeft + xSize + tooltipWidth - (256 - xSize - 4), guiTop, xSize + 4, 0,
|
||||
256 - xSize - 4, ySize);
|
||||
|
||||
ItemStack wand = this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack();
|
||||
|
||||
Spell[] spells = WandHelper.getSpells(wand);
|
||||
|
||||
int i=0;
|
||||
int i = 0;
|
||||
|
||||
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(!this.mc.player.capabilities.isCreativeMode && WizardData.get(this.mc.player) != null){
|
||||
discovered = WizardData.get(this.mc.player).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());
|
||||
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);
|
||||
WizardryUtilities.drawTexturedRect(guiLeft + xSize + 5, guiTop + 34 + 10 * i++, 8, 8);
|
||||
}
|
||||
|
||||
int x = 0;
|
||||
int y = guiTop + 50 + spells.length*10;
|
||||
|
||||
int y = guiTop + 50 + spells.length * 10;
|
||||
|
||||
// Look how much shorter this is with the WandHelper class!
|
||||
for(Item item : WandHelper.getSpecialUpgrades()){
|
||||
|
||||
|
||||
int level = WandHelper.getUpgradeLevel(wand, item);
|
||||
|
||||
|
||||
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.renderItemOverlayIntoGUI(this.fontRendererObj, stack, guiLeft + xSize + 6 + x, y,
|
||||
null);
|
||||
x += 18;
|
||||
GlStateManager.disableDepth();
|
||||
}
|
||||
@@ -134,26 +139,33 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
}
|
||||
|
||||
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){
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
if(this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getHasStack() && this.inventorySlots.getSlot(ContainerArcaneWorkbench.WAND_SLOT).getStack().getItem() instanceof ItemWand){
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -163,29 +175,31 @@ 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.player.capabilities.isCreativeMode && WizardData.get(this.mc.player) != null){
|
||||
discovered = WizardData.get(this.mc.player).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);
|
||||
this.mc.standardGalacticFontRenderer.drawStringWithShadow(
|
||||
"\u00A79" + SpellGlyphData.getGlyphName(spell, this.mc.world), 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);
|
||||
|
||||
|
||||
this.fontRendererObj.drawStringWithShadow(
|
||||
"\u00A7f" + I18n.format("container.wizardry:arcane_workbench.upgrades"), xSize + 6, y + 6, 0);
|
||||
|
||||
int x = 0;
|
||||
y = 50 + spells.length*10;
|
||||
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.
|
||||
@@ -202,12 +216,12 @@ public class GuiArcaneWorkbench extends GuiContainer {
|
||||
|
||||
@Override
|
||||
public void initGui(){
|
||||
this.mc.thePlayer.openContainer = this.inventorySlots;
|
||||
this.mc.player.openContainer = this.inventorySlots;
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.guiTop = (this.height - this.ySize) / 2;
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(this.applyBtn = new GuiButtonApply(0, this.width/2 + 48, this.height/2 + 3));
|
||||
this.buttonList.add(this.applyBtn = new GuiButtonApply(0, this.width / 2 + 48, this.height / 2 + 3));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,32 +10,34 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
class GuiButtonApply extends GuiButton {
|
||||
|
||||
public GuiButtonApply(int id, int x, int y){
|
||||
|
||||
super(id, x, y, 32, 16, I18n.format("container.wizardry:arcane_workbench.apply"));
|
||||
}
|
||||
public GuiButtonApply(int id, int x, int y){
|
||||
|
||||
super(id, x, y, 32, 16, I18n.format("container.wizardry:arcane_workbench.apply"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY){
|
||||
|
||||
// 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;
|
||||
int l = 220;
|
||||
int colour = 14737632;
|
||||
|
||||
if(this.enabled){
|
||||
if(this.hovered){
|
||||
k += this.width*2;
|
||||
colour = 16777120;
|
||||
}
|
||||
}else{
|
||||
k += this.width;
|
||||
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);
|
||||
}
|
||||
public void drawButton(Minecraft minecraft, int mouseX, int mouseY){
|
||||
|
||||
// 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;
|
||||
int l = 220;
|
||||
int colour = 14737632;
|
||||
|
||||
if(this.enabled){
|
||||
if(this.hovered){
|
||||
k += this.width * 2;
|
||||
colour = 16777120;
|
||||
}
|
||||
}else{
|
||||
k += this.width;
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -8,16 +8,17 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
class GuiButtonInvisible extends GuiButton {
|
||||
|
||||
public GuiButtonInvisible(int id, int x, int y, int width, int height){
|
||||
|
||||
super(id, x, y, width, height, "");
|
||||
}
|
||||
public GuiButtonInvisible(int id, int x, int y, int width, int height){
|
||||
|
||||
super(id, x, y, width, height, "");
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
* 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,41 +12,37 @@ 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");
|
||||
/** True for pointing right (next page), false for pointing left (previous page). */
|
||||
private final boolean nextPage;
|
||||
|
||||
public GuiButtonTurnPage(int id, int x, int y, boolean isNextPage)
|
||||
{
|
||||
super(id, x, y, 23, 13, "");
|
||||
this.nextPage = isNextPage;
|
||||
}
|
||||
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;
|
||||
* 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(flag){
|
||||
k += 23;
|
||||
}
|
||||
|
||||
if (!this.nextPage)
|
||||
{
|
||||
l += 13;
|
||||
}
|
||||
if(!this.nextPage){
|
||||
l += 13;
|
||||
}
|
||||
|
||||
WizardryUtilities.drawTexturedRect(this.xPosition, this.yPosition, k, l, 23, 13, 288, 256);
|
||||
}
|
||||
}
|
||||
WizardryUtilities.drawTexturedRect(this.xPosition, this.yPosition, k, l, 23, 13, 288, 256);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,63 +18,63 @@ 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"));
|
||||
//this.titleLine2 = "File location: " + Wizardry.config.getConfigFile().getAbsolutePath();
|
||||
super(parent, getConfigEntries(), Wizardry.MODID, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config.wizardry.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.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());
|
||||
return configList;
|
||||
}
|
||||
|
||||
|
||||
/** Spells category of the config gui. This adds a button which opens up the spells category config. */
|
||||
public static class SpellsCategory extends CategoryEntry
|
||||
{
|
||||
public SpellsCategory(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 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));
|
||||
|
||||
spellsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.SPELLS_CATEGORY);
|
||||
|
||||
return spellsMenu;
|
||||
}
|
||||
}
|
||||
|
||||
/** Resistances category of the config gui. */
|
||||
public static class ResistancesCategory extends CategoryEntry
|
||||
{
|
||||
public ResistancesCategory(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.settings.getConfigCategory(Settings.RESISTANCES_CATEGORY))).getChildElements(),
|
||||
this.owningScreen.modID, Settings.RESISTANCES_CATEGORY, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config.wizardry.title." + Settings.RESISTANCES_CATEGORY));
|
||||
|
||||
idsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.RESISTANCES_CATEGORY);
|
||||
|
||||
return idsMenu;
|
||||
}
|
||||
}
|
||||
public static class SpellsCategory extends CategoryEntry {
|
||||
public SpellsCategory(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 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));
|
||||
|
||||
spellsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.SPELLS_CATEGORY);
|
||||
|
||||
return spellsMenu;
|
||||
}
|
||||
}
|
||||
|
||||
/** Resistances category of the config gui. */
|
||||
public static class ResistancesCategory extends CategoryEntry {
|
||||
public ResistancesCategory(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.settings.getConfigCategory(Settings.RESISTANCES_CATEGORY)))
|
||||
.getChildElements(),
|
||||
this.owningScreen.modID, Settings.RESISTANCES_CATEGORY, false, false,
|
||||
Wizardry.NAME + " - " + I18n.format("config.wizardry.title." + Settings.RESISTANCES_CATEGORY));
|
||||
|
||||
idsMenu.titleLine2 = I18n.format("config.wizardry.subtitle." + Settings.RESISTANCES_CATEGORY);
|
||||
|
||||
return idsMenu;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,29 +11,27 @@ import net.minecraft.world.World;
|
||||
|
||||
/** Crafting table GUI that doesn't require a crafting table container object. */
|
||||
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)
|
||||
{
|
||||
super(new ContainerWorkbench(p_i1084_1_, p_i1084_2_, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||
{
|
||||
this.fontRendererObj.drawString(I18n.format("container.crafting"), 28, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(
|
||||
"textures/gui/container/crafting_table.png");
|
||||
|
||||
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);
|
||||
this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
public GuiPortableCrafting(InventoryPlayer p_i1084_1_, World p_i1084_2_, BlockPos pos){
|
||||
super(new ContainerWorkbench(p_i1084_1_, p_i1084_2_, pos));
|
||||
}
|
||||
|
||||
/**
|
||||
* Draw the foreground layer for the GuiContainer (everything in front of the items)
|
||||
*/
|
||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_){
|
||||
this.fontRendererObj.drawString(I18n.format("container.crafting"), 28, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
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);
|
||||
this.mc.getTextureManager().bindTexture(craftingTableGuiTextures);
|
||||
int k = (this.width - this.xSize) / 2;
|
||||
int l = (this.height - this.ySize) / 2;
|
||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,113 +15,98 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiSpellBook extends GuiScreen {
|
||||
|
||||
|
||||
private int xSize, ySize;
|
||||
private Spell spell;
|
||||
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/gui/spellbook.png");
|
||||
|
||||
public GuiSpellBook(Spell spell) {
|
||||
|
||||
public GuiSpellBook(Spell spell){
|
||||
super();
|
||||
xSize = 288;
|
||||
ySize = 180;
|
||||
this.spell = spell;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
|
||||
int xPos = this.width/2 - xSize/2;
|
||||
int yPos = this.height/2 - this.ySize/2;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
boolean discovered = true;
|
||||
* Draws the screen and all the components in it.
|
||||
*/
|
||||
public void drawScreen(int par1, int par2, float par3){
|
||||
|
||||
int xPos = this.width / 2 - xSize / 2;
|
||||
int yPos = this.height / 2 - this.ySize / 2;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
|
||||
boolean discovered = true;
|
||||
if(Wizardry.settings.discoveryMode && !player.capabilities.isCreativeMode && WizardData.get(player) != null
|
||||
&& !WizardData.get(player).hasSpellBeenDiscovered(spell)){
|
||||
discovered = false;
|
||||
}
|
||||
|
||||
// Draws spell illustration on opposite page, underneath the book so it shows through the hole.
|
||||
// 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(texture);
|
||||
WizardryUtilities.drawTexturedRect(xPos, yPos, 0, 0, xSize, ySize, xSize, 256);
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
||||
WizardryUtilities.drawTexturedRect(xPos, yPos, 0, 0, xSize, ySize, xSize, 256);
|
||||
|
||||
super.drawScreen(par1, par2, par3);
|
||||
|
||||
if(discovered){
|
||||
this.fontRendererObj.drawString(spell.getDisplayName(), xPos+17, yPos+14, 0);
|
||||
this.fontRendererObj.drawString(spell.type.getDisplayName(), xPos+17, yPos+25, 0x777777);
|
||||
this.fontRendererObj.drawString(spell.getDisplayName(), xPos + 17, yPos + 14, 0);
|
||||
this.fontRendererObj.drawString(spell.type.getDisplayName(), xPos + 17, yPos + 25, 0x777777);
|
||||
}else{
|
||||
this.mc.standardGalacticFontRenderer.drawString(SpellGlyphData.getGlyphName(spell, player.worldObj), xPos+17, yPos+14, 0);
|
||||
this.mc.standardGalacticFontRenderer.drawString(spell.type.getDisplayName(), xPos+17, yPos+25, 0x777777);
|
||||
this.mc.standardGalacticFontRenderer.drawString(SpellGlyphData.getGlyphName(spell, player.world), xPos + 17,
|
||||
yPos + 14, 0);
|
||||
this.mc.standardGalacticFontRenderer.drawString(spell.type.getDisplayName(), xPos + 17, yPos + 25,
|
||||
0x777777);
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString("-------------------", xPos+17, yPos+34, 0);
|
||||
|
||||
if(spell.tier == Tier.BASIC){
|
||||
// Basic is usually white but this doesn't show up.
|
||||
this.fontRendererObj.drawString("Tier: \u00A77" + Tier.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();
|
||||
if(!discovered) element = "Element: ?";
|
||||
this.fontRendererObj.drawString(element, xPos+17, yPos+56, 0);
|
||||
|
||||
String manaCost = "Mana Cost: " + spell.cost;
|
||||
if(spell.isContinuous) manaCost = "Mana Cost: " + spell.cost + "/second";
|
||||
if(!discovered) manaCost = "Mana Cost: ?";
|
||||
this.fontRendererObj.drawString(manaCost, xPos+17, yPos+68, 0);
|
||||
|
||||
if(discovered){
|
||||
this.fontRendererObj.drawSplitString(spell.getDescription(), xPos+17, yPos+82, 118, 0);
|
||||
}else{
|
||||
this.mc.standardGalacticFontRenderer.drawSplitString(SpellGlyphData.getGlyphDescription(spell, player.worldObj), xPos+17, yPos+82, 118, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
// Word wrapping
|
||||
int charNumber = 0;
|
||||
int lineNumber = 0;
|
||||
|
||||
while(charNumber < spell.desc.length()){
|
||||
int lineLength = 0;
|
||||
String line;
|
||||
if(spell.desc.length() - charNumber > 22){
|
||||
for(int i = charNumber; i < charNumber+23; i++){
|
||||
if(spell.desc.charAt(i) == ' '){
|
||||
lineLength = i - charNumber;
|
||||
}
|
||||
}
|
||||
line = spell.desc.substring(charNumber, charNumber + lineLength);
|
||||
}else{
|
||||
line = spell.desc.substring(charNumber, spell.desc.length());
|
||||
charNumber = spell.desc.length();
|
||||
}
|
||||
this.fontRendererObj.drawString("\u00A7o" + line, xPos+17, yPos+82+10*lineNumber, 0);
|
||||
charNumber+=(lineLength+1);
|
||||
lineNumber++;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
public void initGui()
|
||||
{
|
||||
this.fontRendererObj.drawString("-------------------", xPos + 17, yPos + 34, 0);
|
||||
|
||||
if(spell.tier == Tier.BASIC){
|
||||
// Basic is usually white but this doesn't show up.
|
||||
this.fontRendererObj.drawString("Tier: \u00A77" + Tier.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();
|
||||
if(!discovered) element = "Element: ?";
|
||||
this.fontRendererObj.drawString(element, xPos + 17, yPos + 56, 0);
|
||||
|
||||
String manaCost = "Mana Cost: " + spell.cost;
|
||||
if(spell.isContinuous) manaCost = "Mana Cost: " + spell.cost + "/second";
|
||||
if(!discovered) manaCost = "Mana Cost: ?";
|
||||
this.fontRendererObj.drawString(manaCost, xPos + 17, yPos + 68, 0);
|
||||
|
||||
if(discovered){
|
||||
this.fontRendererObj.drawSplitString(spell.getDescription(), xPos + 17, yPos + 82, 118, 0);
|
||||
}else{
|
||||
this.mc.standardGalacticFontRenderer.drawSplitString(
|
||||
SpellGlyphData.getGlyphDescription(spell, player.world), xPos + 17, yPos + 82, 118, 0);
|
||||
}
|
||||
|
||||
/* // Word wrapping int charNumber = 0; int lineNumber = 0;
|
||||
*
|
||||
* while(charNumber < spell.desc.length()){ int lineLength = 0; String line; if(spell.desc.length() - charNumber
|
||||
* > 22){ for(int i = charNumber; i < charNumber+23; i++){ if(spell.desc.charAt(i) == ' '){ lineLength = i -
|
||||
* charNumber; } } line = spell.desc.substring(charNumber, charNumber + lineLength); }else{ line =
|
||||
* spell.desc.substring(charNumber, spell.desc.length()); charNumber = spell.desc.length(); }
|
||||
* this.fontRendererObj.drawString("\u00A7o" + line, xPos+17, yPos+82+10*lineNumber, 0);
|
||||
* charNumber+=(lineLength+1); lineNumber++; } */
|
||||
}
|
||||
|
||||
public void initGui(){
|
||||
super.initGui();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.buttonList.clear();
|
||||
}
|
||||
|
||||
public void onGuiClosed()
|
||||
{
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
}
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
this.buttonList.clear();
|
||||
}
|
||||
|
||||
public void onGuiClosed(){
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,9 +30,10 @@ public class GuiSpellDisplay extends Gui {
|
||||
|
||||
private Minecraft mc;
|
||||
|
||||
private static final ResourceLocation hudTexture = new ResourceLocation(Wizardry.MODID, "textures/gui/spell_hud.png");
|
||||
private static final ResourceLocation hudTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/spell_hud.png");
|
||||
|
||||
public GuiSpellDisplay(Minecraft par1Minecraft) {
|
||||
public GuiSpellDisplay(Minecraft par1Minecraft){
|
||||
super();
|
||||
this.mc = par1Minecraft;
|
||||
}
|
||||
@@ -40,7 +41,7 @@ public class GuiSpellDisplay extends Gui {
|
||||
@SubscribeEvent
|
||||
public void draw(RenderGameOverlayEvent event){
|
||||
|
||||
EntityPlayer player = this.mc.thePlayer;
|
||||
EntityPlayer player = this.mc.player;
|
||||
|
||||
// If the player has a wand in each hand, only displays for the one in the main hand.
|
||||
|
||||
@@ -58,7 +59,8 @@ public class GuiSpellDisplay extends Gui {
|
||||
Spell spell = WandHelper.getCurrentSpell(wand);
|
||||
int cooldown = WandHelper.getCurrentCooldown(wand);
|
||||
|
||||
float cooldownMultiplier = 1.0f - WandHelper.getUpgradeLevel(wand, WizardryItems.cooldown_upgrade)*Constants.COOLDOWN_REDUCTION_PER_LEVEL;
|
||||
float cooldownMultiplier = 1.0f - WandHelper.getUpgradeLevel(wand, WizardryItems.cooldown_upgrade)
|
||||
* Constants.COOLDOWN_REDUCTION_PER_LEVEL;
|
||||
|
||||
if(player.isPotionActive(WizardryPotions.font_of_mana)){
|
||||
// Dividing by this rather than setting it takes upgrades and font of mana into account simultaneously
|
||||
@@ -72,17 +74,17 @@ public class GuiSpellDisplay extends Gui {
|
||||
|
||||
if(Wizardry.settings.spellHUDPosition == GuiPosition.BOTTOM_LEFT){
|
||||
left = 0;
|
||||
top = height-36;
|
||||
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;
|
||||
left = width - 128;
|
||||
top = 0;
|
||||
mirror = true;
|
||||
}else if(Wizardry.settings.spellHUDPosition == GuiPosition.BOTTOM_RIGHT){
|
||||
left = width-128;
|
||||
top = height-36;
|
||||
left = width - 128;
|
||||
top = height - 36;
|
||||
mirror = true;
|
||||
}
|
||||
|
||||
@@ -95,16 +97,17 @@ public class GuiSpellDisplay extends Gui {
|
||||
if(event.getType() == RenderGameOverlayEvent.ElementType.TEXT){
|
||||
|
||||
// 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();
|
||||
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);
|
||||
String spellName = discovered ? spell.getDisplayName() : SpellGlyphData.getGlyphName(spell, player.world);
|
||||
FontRenderer font = discovered ? this.mc.fontRendererObj : this.mc.standardGalacticFontRenderer;
|
||||
|
||||
int maxWidth = 90;
|
||||
|
||||
if(font.getStringWidth(spellName) <= maxWidth){
|
||||
// Single line is rendered more centrally
|
||||
font.drawStringWithShadow(colour + spellName, mirror ? left+5 : left+41, top+13, 0xffffffff);
|
||||
font.drawStringWithShadow(colour + spellName, mirror ? left + 5 : left + 41, top + 13, 0xffffffff);
|
||||
|
||||
}else{
|
||||
|
||||
@@ -114,20 +117,21 @@ public class GuiSpellDisplay extends Gui {
|
||||
|
||||
for(Object line : lines){
|
||||
if(line instanceof String){
|
||||
font.drawStringWithShadow(colour + (String)line, mirror ? left+5 : left+41, top+6 + 11*lineNumber, 0xffffffff);
|
||||
font.drawStringWithShadow(colour + (String)line, mirror ? left + 5 : left + 41,
|
||||
top + 6 + 11 * lineNumber, 0xffffffff);
|
||||
}
|
||||
lineNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
}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
|
||||
@@ -135,18 +139,18 @@ public class GuiSpellDisplay extends Gui {
|
||||
|
||||
// Cooldown bar
|
||||
if(cooldown > 0){
|
||||
this.drawTexturedModalRect(mirror ? left+5 : left+41, height-8, 128, 6, 82, 6);
|
||||
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);
|
||||
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);
|
||||
WizardryUtilities.drawTexturedRect(mirror ? left + 94 : left + 2, top + 2, 0, 0, 32, 32, 32, 32);
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
}
|
||||
|
||||
@@ -36,23 +36,29 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
private int pageNumber = 0;
|
||||
|
||||
private static final int PAGE_WIDTH = 120;
|
||||
/** The integer colour for black passed into the font renderer methods. This used to be 0 but that's now white
|
||||
* for some reason, so I've made a it a constant in case it changes again. */
|
||||
/**
|
||||
* The integer colour for black passed into the font renderer methods. This used to be 0 but that's now white for
|
||||
* some reason, so I've made a it a constant in case it changes again.
|
||||
*/
|
||||
// I think this is actually ever-so-slightly lighter than pure black, but the difference is unnoticeable.
|
||||
private static final int BLACK = 1;
|
||||
|
||||
public static final ResourceLocation regularHandbook = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook.png");
|
||||
public static final ResourceLocation regularHandbook = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/handbook.png");
|
||||
public static final ResourceLocation ore = new ResourceLocation(Wizardry.MODID, "textures/gui/ore_picture.png");
|
||||
public static final ResourceLocation crystal = new ResourceLocation(Wizardry.MODID, "textures/items/magic_crystal.png");
|
||||
public static final ResourceLocation workbenchGui = new ResourceLocation(Wizardry.MODID, "textures/gui/arcane_workbench.png");
|
||||
public static final ResourceLocation craftingGrids = new ResourceLocation(Wizardry.MODID, "textures/gui/handbook_recipes.png");
|
||||
public static final ResourceLocation crystal = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/items/magic_crystal.png");
|
||||
public static final ResourceLocation workbenchGui = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/arcane_workbench.png");
|
||||
public static final ResourceLocation craftingGrids = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/handbook_recipes.png");
|
||||
|
||||
private ArrayList<ArrayList<String>> text;
|
||||
private ArrayList<Section> sections;
|
||||
|
||||
|
||||
private int guiPage, imagePage;
|
||||
|
||||
public GuiWizardHandbook() {
|
||||
public GuiWizardHandbook(){
|
||||
super();
|
||||
xSize = 288;
|
||||
ySize = 180;
|
||||
@@ -60,43 +66,47 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float par3){
|
||||
|
||||
int xPos = this.width/2 - xSize/2;
|
||||
int yPos = this.height/2 - this.ySize/2;
|
||||
|
||||
int xPos = this.width / 2 - xSize / 2;
|
||||
int yPos = this.height / 2 - this.ySize / 2;
|
||||
|
||||
// Tests for crafting recipes section
|
||||
if(pageNumber >= (sections.get(sections.size()-1).pageNumber-1)/2 && pageNumber < (sections.get(sections.size()-1).pageNumber-1)/2 + 4){
|
||||
if(pageNumber >= (sections.get(sections.size() - 1).pageNumber - 1) / 2
|
||||
&& pageNumber < (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 4){
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(craftingGrids);
|
||||
}else{
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(regularHandbook);
|
||||
}
|
||||
|
||||
WizardryUtilities.drawTexturedRect(xPos, yPos, 0, 0, xSize, ySize, xSize, 256);
|
||||
|
||||
|
||||
// Arcane workbench gui picture
|
||||
if(pageNumber == (this.guiPage-1)/2){
|
||||
if(pageNumber == (this.guiPage - 1) / 2){
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(workbenchGui);
|
||||
this.drawTexturedModalRect(this.guiPage % 2 == 1 ? xPos + 17 : this.width/2 + 7, yPos + 14, 28, 12, 120, 118);
|
||||
this.drawTexturedModalRect(this.guiPage % 2 == 1 ? xPos + 17 : this.width / 2 + 7, yPos + 14, 28, 12, 120,
|
||||
118);
|
||||
}
|
||||
|
||||
|
||||
// Magic crystal and crystal ore images
|
||||
if(pageNumber == (this.imagePage-1)/2){
|
||||
|
||||
if(pageNumber == (this.imagePage - 1) / 2){
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(ore);
|
||||
WizardryUtilities.drawTexturedRect(this.imagePage % 2 == 1 ? xPos + 17 : this.width/2 + 7, yPos + 80, 0, 0, 64, 64, 64, 64);
|
||||
|
||||
WizardryUtilities.drawTexturedRect(this.imagePage % 2 == 1 ? xPos + 17 : this.width / 2 + 7, yPos + 80, 0,
|
||||
0, 64, 64, 64, 64);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(crystal);
|
||||
drawTexturedStretchedRect(this.imagePage % 2 == 1 ? xPos + 17 + 64 : this.width/2 + 7 + 62, yPos + 80, 0, 0, 64, 64, 1, 1);
|
||||
drawTexturedStretchedRect(this.imagePage % 2 == 1 ? xPos + 17 + 64 : this.width / 2 + 7 + 62, yPos + 80, 0,
|
||||
0, 64, 64, 1, 1);
|
||||
|
||||
}
|
||||
|
||||
this.fontRendererObj.drawString("" + (pageNumber*2 + 1), xPos + xSize/4 - 3, yPos + ySize - 20, 0);
|
||||
this.fontRendererObj.drawString("" + (pageNumber*2 + 2), xPos + 3*xSize/4 - 5, yPos + ySize - 20, 0);
|
||||
|
||||
this.fontRendererObj.drawString("" + (pageNumber * 2 + 1), xPos + xSize / 4 - 3, yPos + ySize - 20, 0);
|
||||
this.fontRendererObj.drawString("" + (pageNumber * 2 + 2), xPos + 3 * xSize / 4 - 5, yPos + ySize - 20, 0);
|
||||
|
||||
super.drawScreen(mouseX, mouseY, par3);
|
||||
|
||||
int lineNumber = 0;
|
||||
|
||||
|
||||
if(pageNumber == 1){
|
||||
for(Section s : sections){
|
||||
s.drawContents();
|
||||
@@ -107,11 +117,13 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
}
|
||||
}
|
||||
|
||||
for(String paragraph : text.get(pageNumber*2)){
|
||||
for(String paragraph : text.get(pageNumber * 2)){
|
||||
|
||||
this.fontRendererObj.drawSplitString(paragraph, xPos + 17, yPos + 14 + lineNumber*this.fontRendererObj.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
this.fontRendererObj.drawSplitString(paragraph, xPos + 17,
|
||||
yPos + 14 + lineNumber * this.fontRendererObj.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
|
||||
List<String> list = new ArrayList<String>(this.fontRendererObj.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH));
|
||||
List<String> list = new ArrayList<String>(
|
||||
this.fontRendererObj.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH));
|
||||
|
||||
lineNumber += list.size();
|
||||
}
|
||||
@@ -119,19 +131,23 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
lineNumber = 0;
|
||||
|
||||
// Prevents crash when the last page is blank (and hence is not in the list of pages)
|
||||
if(text.size() > pageNumber*2 + 1){
|
||||
for(String paragraph : text.get(pageNumber*2 + 1)){
|
||||
if(text.size() > pageNumber * 2 + 1){
|
||||
for(String paragraph : text.get(pageNumber * 2 + 1)){
|
||||
|
||||
// First page is centred
|
||||
if(pageNumber == 0){
|
||||
int startX = this.width/2 + 7 + PAGE_WIDTH/2 - this.fontRendererObj.getStringWidth(paragraph)/2;
|
||||
this.fontRendererObj.drawSplitString(paragraph, startX, yPos + 14 + lineNumber*this.fontRendererObj.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
int startX = this.width / 2 + 7 + PAGE_WIDTH / 2
|
||||
- this.fontRendererObj.getStringWidth(paragraph) / 2;
|
||||
this.fontRendererObj.drawSplitString(paragraph, startX,
|
||||
yPos + 14 + lineNumber * this.fontRendererObj.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
}else{
|
||||
this.fontRendererObj.drawSplitString(paragraph, this.width/2 + 7, yPos + 14 + lineNumber*this.fontRendererObj.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
this.fontRendererObj.drawSplitString(paragraph, this.width / 2 + 7,
|
||||
yPos + 14 + lineNumber * this.fontRendererObj.FONT_HEIGHT, PAGE_WIDTH, BLACK);
|
||||
}
|
||||
|
||||
List<String> list = new ArrayList<String>(this.fontRendererObj.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH));
|
||||
|
||||
|
||||
List<String> list = new ArrayList<String>(
|
||||
this.fontRendererObj.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH));
|
||||
|
||||
lineNumber += list.size();
|
||||
}
|
||||
}
|
||||
@@ -140,7 +156,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
ItemStack craftingResult;
|
||||
|
||||
// Tooltips are rendered after recipes to prevent tooltips on the left appearing behind items on the right.
|
||||
if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2){
|
||||
if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2){
|
||||
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(Items.GOLD_NUGGET);
|
||||
@@ -177,7 +193,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_handbook);
|
||||
this.renderCraftingRecipe(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
|
||||
}else if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2 + 1){
|
||||
}else if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 1){
|
||||
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(WizardryBlocks.crystal_flower);
|
||||
@@ -215,7 +231,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.magic_silk, 2);
|
||||
this.renderCraftingRecipe(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
|
||||
}else if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2 + 2){
|
||||
}else if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 2){
|
||||
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(WizardryItems.magic_silk);
|
||||
@@ -257,7 +273,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_boots);
|
||||
this.renderCraftingRecipe(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
|
||||
}else if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2 + 3){
|
||||
}else if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 3){
|
||||
|
||||
if(Wizardry.settings.useAlternateScrollRecipe){
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
@@ -273,7 +289,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.blank_scroll);
|
||||
this.renderCraftingRecipe(xPos + 23, yPos + 39, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
}
|
||||
|
||||
|
||||
if(Wizardry.settings.firebombIsCraftable){
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(Items.BLAZE_POWDER);
|
||||
@@ -303,10 +319,10 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.smoke_bomb, 3);
|
||||
this.renderCraftingRecipe(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2){
|
||||
if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2){
|
||||
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(Items.GOLD_NUGGET);
|
||||
@@ -343,7 +359,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_handbook);
|
||||
this.renderCraftingTooltips(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
|
||||
}else if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2 + 1){
|
||||
}else if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 1){
|
||||
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(WizardryBlocks.crystal_flower);
|
||||
@@ -381,7 +397,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.magic_silk, 2);
|
||||
this.renderCraftingTooltips(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
|
||||
}else if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2 + 2){
|
||||
}else if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 2){
|
||||
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(WizardryItems.magic_silk);
|
||||
@@ -423,7 +439,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.wizard_boots);
|
||||
this.renderCraftingTooltips(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
|
||||
}else if(pageNumber == (sections.get(sections.size()-1).pageNumber-1)/2 + 3){
|
||||
}else if(pageNumber == (sections.get(sections.size() - 1).pageNumber - 1) / 2 + 3){
|
||||
|
||||
if(Wizardry.settings.useAlternateScrollRecipe){
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
@@ -439,7 +455,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.blank_scroll);
|
||||
this.renderCraftingTooltips(xPos + 23, yPos + 39, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
}
|
||||
|
||||
|
||||
if(Wizardry.settings.firebombIsCraftable){
|
||||
craftingGrid = new ItemStack[3][3];
|
||||
craftingGrid[0][0] = new ItemStack(Items.BLAZE_POWDER);
|
||||
@@ -469,11 +485,12 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
craftingResult = new ItemStack(WizardryItems.smoke_bomb, 3);
|
||||
this.renderCraftingTooltips(xPos + 156, yPos + 98, mouseX, mouseY, craftingGrid, craftingResult);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void renderCraftingRecipe(int xPos, int yPos, int mouseX, int mouseY, ItemStack[][] craftingGrid, ItemStack craftingResult) {
|
||||
private void renderCraftingRecipe(int xPos, int yPos, int mouseX, int mouseY, ItemStack[][] craftingGrid,
|
||||
ItemStack craftingResult){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
@@ -483,11 +500,12 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
GlStateManager.enableLighting();
|
||||
itemRender.zLevel = 100.0F;
|
||||
|
||||
for(int i=0; i<craftingGrid.length; i++){
|
||||
for(int j=0; j<craftingGrid[i].length; j++){
|
||||
for(int i = 0; i < craftingGrid.length; i++){
|
||||
for(int j = 0; j < craftingGrid[i].length; j++){
|
||||
if(craftingGrid[i][j] != null){
|
||||
itemRender.renderItemAndEffectIntoGUI(craftingGrid[i][j], xPos + 18*i, yPos + 18*j);
|
||||
itemRender.renderItemOverlays(this.fontRendererObj, craftingGrid[i][j], xPos + 18*i, yPos + 18*j);
|
||||
itemRender.renderItemAndEffectIntoGUI(craftingGrid[i][j], xPos + 18 * i, yPos + 18 * j);
|
||||
itemRender.renderItemOverlays(this.fontRendererObj, craftingGrid[i][j], xPos + 18 * i,
|
||||
yPos + 18 * j);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -504,22 +522,24 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
}
|
||||
|
||||
private void renderCraftingTooltips(int xPos, int yPos, int mouseX, int mouseY, ItemStack[][] craftingGrid, ItemStack craftingResult) {
|
||||
private void renderCraftingTooltips(int xPos, int yPos, int mouseX, int mouseY, ItemStack[][] craftingGrid,
|
||||
ItemStack craftingResult){
|
||||
|
||||
int guiLeft = this.width/2 - xSize/2;
|
||||
int guiTop = this.height/2 - this.ySize/2;
|
||||
int guiLeft = this.width / 2 - xSize / 2;
|
||||
int guiTop = this.height / 2 - this.ySize / 2;
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
itemRender.zLevel = 0.0F;
|
||||
itemRender.zLevel = 0.0F;
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
for(int i=0; i<craftingGrid.length; i++){
|
||||
for(int j=0; j<craftingGrid[i].length; j++){
|
||||
if(craftingGrid[i][j] != null && isPointInRegion(xPos + 18*i, yPos + 18*j, 16, 16, mouseX + guiLeft, mouseY + guiTop)){
|
||||
for(int i = 0; i < craftingGrid.length; i++){
|
||||
for(int j = 0; j < craftingGrid[i].length; j++){
|
||||
if(craftingGrid[i][j] != null
|
||||
&& isPointInRegion(xPos + 18 * i, yPos + 18 * j, 16, 16, mouseX + guiLeft, mouseY + guiTop)){
|
||||
this.renderToolTip(craftingGrid[i][j], mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
@@ -545,90 +565,104 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
int nextButtonId = 0;
|
||||
|
||||
this.buttonList.clear();
|
||||
this.buttonList.add(new GuiButtonTurnPage(nextButtonId++, this.width/2 + this.xSize/2 - 22 - 23, this.height/2 + this.ySize/2 - 10 - 13, true));
|
||||
this.buttonList.add(new GuiButtonTurnPage(nextButtonId++, this.width/2 - this.xSize/2 + 21, this.height/2 + this.ySize/2 - 10 - 13, false));
|
||||
this.buttonList.add(new GuiButtonTurnPage(nextButtonId++, this.width / 2 + this.xSize / 2 - 22 - 23,
|
||||
this.height / 2 + this.ySize / 2 - 10 - 13, true));
|
||||
this.buttonList.add(new GuiButtonTurnPage(nextButtonId++, this.width / 2 - this.xSize / 2 + 21,
|
||||
this.height / 2 + this.ySize / 2 - 10 - 13, false));
|
||||
|
||||
text = new ArrayList<ArrayList<String>>(1);
|
||||
sections = new ArrayList<Section>(1);
|
||||
|
||||
BufferedReader bufferedreader = null;
|
||||
|
||||
String textFilepath = "wizardry:texts/handbook_" + Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode() + ".txt";
|
||||
|
||||
try {
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(), Charsets.UTF_8));
|
||||
|
||||
} catch (IOException e){
|
||||
|
||||
Wizardry.logger.info("Wizard handbook text file missing for the current language. Using default (English - US) instead.");
|
||||
BufferedReader bufferedreader = null;
|
||||
|
||||
String textFilepath = "wizardry:texts/handbook_"
|
||||
+ Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode() + ".txt";
|
||||
|
||||
try{
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(
|
||||
this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(),
|
||||
Charsets.UTF_8));
|
||||
|
||||
}catch (IOException e){
|
||||
|
||||
Wizardry.logger.info(
|
||||
"Wizard handbook text file missing for the current language. Using default (English - US) instead.");
|
||||
|
||||
textFilepath = "wizardry:texts/handbook_en_US.txt";
|
||||
|
||||
try {
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(), Charsets.UTF_8));
|
||||
|
||||
} catch (IOException x){
|
||||
try{
|
||||
|
||||
bufferedreader = new BufferedReader(new InputStreamReader(
|
||||
this.mc.getResourceManager().getResource(new ResourceLocation(textFilepath)).getInputStream(),
|
||||
Charsets.UTF_8));
|
||||
|
||||
}catch (IOException x){
|
||||
Wizardry.logger.error("Couldn't find file: wizardry:assets/texts/handbook_en_US.txt. The file may be"
|
||||
+ "missing; please try re-downloading and reinstalling Wizardry.", x);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(bufferedreader != null){
|
||||
|
||||
try {
|
||||
|
||||
|
||||
try{
|
||||
|
||||
String paragraph = bufferedreader.readLine();
|
||||
ArrayList<String> page = new ArrayList<String>(1);
|
||||
|
||||
|
||||
int linesPerPage = 16;
|
||||
|
||||
|
||||
int lineNumber = 0;
|
||||
|
||||
|
||||
while(paragraph != null){
|
||||
|
||||
//System.out.println(paragraph);
|
||||
|
||||
|
||||
// System.out.println(paragraph);
|
||||
|
||||
if(paragraph.contains("PAGEBREAK") || lineNumber >= linesPerPage){
|
||||
|
||||
|
||||
text.add(page);
|
||||
|
||||
|
||||
page = new ArrayList<String>(1);
|
||||
|
||||
|
||||
lineNumber = 0;
|
||||
|
||||
|
||||
if(paragraph.contains("PAGEBREAK")) paragraph = bufferedreader.readLine();
|
||||
|
||||
|
||||
}else if(paragraph.contains("LINEBREAK")){
|
||||
|
||||
|
||||
lineNumber++;
|
||||
|
||||
|
||||
page.add("");
|
||||
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
|
||||
}else if(paragraph.contains("SECTION")){
|
||||
|
||||
sections.add(new Section(paragraph.replace("SECTION ", ""), text.size() + 1, this.width/2 + 7,
|
||||
this.height/2 - this.ySize/2 + 14 + (sections.size()+2)*this.fontRendererObj.FONT_HEIGHT, nextButtonId++));
|
||||
|
||||
sections.add(
|
||||
new Section(paragraph.replace("SECTION ", ""), text.size() + 1, this.width / 2 + 7,
|
||||
this.height / 2 - this.ySize / 2 + 14
|
||||
+ (sections.size() + 2) * this.fontRendererObj.FONT_HEIGHT,
|
||||
nextButtonId++));
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
|
||||
}else if(paragraph.contains("IMAGE")){
|
||||
|
||||
|
||||
if(paragraph.contains("WORKBENCH")){
|
||||
this.guiPage = text.size() + 1;
|
||||
}else if(paragraph.contains("CRYSTAL")){
|
||||
this.imagePage = text.size() + 1;
|
||||
}
|
||||
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
paragraph = paragraph.replaceAll("NEXT_SPELL_KEY", Keyboard.getKeyName(ClientProxy.NEXT_SPELL.getKeyCode()));
|
||||
paragraph = paragraph.replaceAll("PREVIOUS_SPELL_KEY", Keyboard.getKeyName(ClientProxy.PREVIOUS_SPELL.getKeyCode()));
|
||||
paragraph = paragraph.replaceAll("MANA_PER_CRYSTAL_MINUS_30", "" + (Constants.MANA_PER_CRYSTAL - 30));
|
||||
|
||||
paragraph = paragraph.replaceAll("NEXT_SPELL_KEY",
|
||||
Keyboard.getKeyName(ClientProxy.NEXT_SPELL.getKeyCode()));
|
||||
paragraph = paragraph.replaceAll("PREVIOUS_SPELL_KEY",
|
||||
Keyboard.getKeyName(ClientProxy.PREVIOUS_SPELL.getKeyCode()));
|
||||
paragraph = paragraph.replaceAll("MANA_PER_CRYSTAL_MINUS_30",
|
||||
"" + (Constants.MANA_PER_CRYSTAL - 30));
|
||||
paragraph = paragraph.replaceAll("MANA_PER_CRYSTAL", "" + Constants.MANA_PER_CRYSTAL);
|
||||
paragraph = paragraph.replaceAll("BASIC_MAX_CHARGE", "" + Tier.BASIC.maxCharge);
|
||||
paragraph = paragraph.replaceAll("APPRENTICE_MAX_CHARGE", "" + Tier.APPRENTICE.maxCharge);
|
||||
@@ -647,35 +681,37 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
paragraph = paragraph.replaceAll("HEALING_COLOUR", Element.HEALING.getFormattingCode());
|
||||
paragraph = paragraph.replaceAll("RESET_COLOUR", "\u00A70");
|
||||
paragraph = paragraph.replaceAll("VERSION", Wizardry.VERSION);
|
||||
|
||||
int linesInParagraph = this.fontRendererObj.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH).size();
|
||||
|
||||
|
||||
int linesInParagraph = this.fontRendererObj
|
||||
.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH).size();
|
||||
|
||||
// Ignores empty lines at the top of a page.
|
||||
if(paragraph.isEmpty() && lineNumber == 0){
|
||||
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
// Normal paragraph, all on one page
|
||||
|
||||
// Normal paragraph, all on one page
|
||||
}else if(lineNumber + linesInParagraph <= linesPerPage){
|
||||
|
||||
|
||||
page.add(paragraph);
|
||||
|
||||
|
||||
lineNumber += linesInParagraph;
|
||||
|
||||
|
||||
paragraph = bufferedreader.readLine();
|
||||
|
||||
// Paragraphs split across two pages (or more?)
|
||||
|
||||
// Paragraphs split across two pages (or more?)
|
||||
}else{
|
||||
|
||||
|
||||
int linesInFirstPart = linesPerPage - lineNumber;
|
||||
|
||||
|
||||
String paragraphFirstPart = "";
|
||||
String paragraphLastPart = "";
|
||||
|
||||
|
||||
int i = 0;
|
||||
|
||||
List<String> strings = this.fontRendererObj.listFormattedStringToWidth(paragraph, GuiWizardHandbook.PAGE_WIDTH);
|
||||
|
||||
|
||||
List<String> strings = this.fontRendererObj.listFormattedStringToWidth(paragraph,
|
||||
GuiWizardHandbook.PAGE_WIDTH);
|
||||
|
||||
for(Object s : strings){
|
||||
if(i < linesInFirstPart){
|
||||
paragraphFirstPart = paragraphFirstPart.concat((String)s + " ");
|
||||
@@ -684,23 +720,24 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
//System.out.println("Paragraph crosses page boundary; string split into: \"" + paragraphFirstPart + "\" and \"" + paragraphLastPart + "\"");
|
||||
|
||||
|
||||
// System.out.println("Paragraph crosses page boundary; string split into: \"" +
|
||||
// paragraphFirstPart + "\" and \"" + paragraphLastPart + "\"");
|
||||
|
||||
page.add(paragraphFirstPart);
|
||||
|
||||
|
||||
lineNumber += linesInFirstPart;
|
||||
|
||||
|
||||
paragraph = paragraphLastPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
text.add(page);
|
||||
|
||||
} catch (IOException e){
|
||||
Wizardry.logger.error("Something went wrong reading file: " + textFilepath + ". The file may be damaged;"
|
||||
+ "please try re-downloading and reinstalling wizardry.", e);
|
||||
|
||||
}catch (IOException e){
|
||||
Wizardry.logger.error("Something went wrong reading file: " + textFilepath
|
||||
+ ". The file may be damaged;" + "please try re-downloading and reinstalling wizardry.", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -709,7 +746,7 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
/** The integer text colour used for the section when it is moused over. Currently orange. */
|
||||
private static final int HIGHLIGHT_COLOUR = 0xdd4c1d;
|
||||
|
||||
|
||||
String name;
|
||||
int pageNumber;
|
||||
int x, y;
|
||||
@@ -721,7 +758,8 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.buttonId = id;
|
||||
GuiWizardHandbook.this.buttonList.add(new GuiButtonInvisible(id, x, y, GuiWizardHandbook.PAGE_WIDTH, GuiWizardHandbook.this.fontRendererObj.FONT_HEIGHT));
|
||||
GuiWizardHandbook.this.buttonList.add(new GuiButtonInvisible(id, x, y, GuiWizardHandbook.PAGE_WIDTH,
|
||||
GuiWizardHandbook.this.fontRendererObj.FONT_HEIGHT));
|
||||
}
|
||||
|
||||
void hideButton(){
|
||||
@@ -729,26 +767,28 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
}
|
||||
|
||||
void drawContents(){
|
||||
|
||||
|
||||
GuiWizardHandbook.this.buttonList.get(buttonId).visible = true;
|
||||
|
||||
GuiWizardHandbook.this.fontRendererObj.drawString(name, x, y, GuiWizardHandbook.this.buttonList.get(buttonId).isMouseOver() ? HIGHLIGHT_COLOUR : BLACK);
|
||||
GuiWizardHandbook.this.fontRendererObj.drawString(name, x, y,
|
||||
GuiWizardHandbook.this.buttonList.get(buttonId).isMouseOver() ? HIGHLIGHT_COLOUR : BLACK);
|
||||
|
||||
int nameWidth = GuiWizardHandbook.this.fontRendererObj.getStringWidth(name);
|
||||
|
||||
String dotsAndNumber = " " + this.pageNumber;
|
||||
|
||||
while(GuiWizardHandbook.this.fontRendererObj.getStringWidth(dotsAndNumber) < GuiWizardHandbook.PAGE_WIDTH - nameWidth - 2){
|
||||
while(GuiWizardHandbook.this.fontRendererObj.getStringWidth(dotsAndNumber) < GuiWizardHandbook.PAGE_WIDTH
|
||||
- nameWidth - 2){
|
||||
dotsAndNumber = "." + dotsAndNumber;
|
||||
}
|
||||
|
||||
GuiWizardHandbook.this.fontRendererObj.drawString(dotsAndNumber, x + GuiWizardHandbook.PAGE_WIDTH - GuiWizardHandbook.this.fontRendererObj.getStringWidth(dotsAndNumber), y, BLACK);
|
||||
GuiWizardHandbook.this.fontRendererObj.drawString(dotsAndNumber, x + GuiWizardHandbook.PAGE_WIDTH
|
||||
- GuiWizardHandbook.this.fontRendererObj.getStringWidth(dotsAndNumber), y, BLACK);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onGuiClosed()
|
||||
{
|
||||
public void onGuiClosed(){
|
||||
super.onGuiClosed();
|
||||
Keyboard.enableRepeatEvents(false);
|
||||
}
|
||||
@@ -761,11 +801,11 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
|
||||
if(par1GuiButton.enabled){
|
||||
if(par1GuiButton.id == 0){
|
||||
if(pageNumber < (text.size()-1)/2) pageNumber++;
|
||||
if(pageNumber < (text.size() - 1) / 2) pageNumber++;
|
||||
}else if(par1GuiButton.id == 1){
|
||||
if(pageNumber > 0) pageNumber--;
|
||||
}else{
|
||||
if(pageNumber == 1) pageNumber = (sections.get(par1GuiButton.id - 2).pageNumber-1)/2;
|
||||
if(pageNumber == 1) pageNumber = (sections.get(par1GuiButton.id - 2).pageNumber - 1) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -774,36 +814,39 @@ public class GuiWizardHandbook extends GuiScreen {
|
||||
* Args: left, top, width, height, pointX, pointY. Note: left, top are local to Gui, pointX, pointY are local to
|
||||
* screen
|
||||
*/
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Draws a textured rectangle, stretching the section of the image to fit the size given.
|
||||
*
|
||||
* @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, expressed as a fraction of the image width
|
||||
* @param v The y position of the top left corner of the section of the image wanted, expressed as a fraction of the image width
|
||||
* @param u The x position of the top left corner of the section of the image wanted, expressed as a fraction of the
|
||||
* image width
|
||||
* @param v The y position of the top left corner of the section of the image wanted, expressed as a fraction of the
|
||||
* image width
|
||||
* @param finalWidth The width as rendered
|
||||
* @param finalHeight The height as rendered
|
||||
* @param width The width of the section, expressed as a fraction of the image width
|
||||
* @param height The height of the section, expressed as a fraction of the image width
|
||||
*/
|
||||
public static void drawTexturedStretchedRect(int x, int y, int u, int v, int finalWidth, int finalHeight, int width, int height){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((x), y + finalHeight, 0).tex(u, v + height).endVertex();
|
||||
buffer.pos(x + finalWidth, y + finalHeight, 0).tex(u + width, v + height).endVertex();
|
||||
buffer.pos(x + finalWidth, (y), 0).tex(u + width, v).endVertex();
|
||||
buffer.pos((x), (y), 0).tex(u, v).endVertex();
|
||||
tessellator.draw();
|
||||
public static void drawTexturedStretchedRect(int x, int y, int u, int v, int finalWidth, int finalHeight, int width,
|
||||
int height){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos((x), y + finalHeight, 0).tex(u, v + height).endVertex();
|
||||
buffer.pos(x + finalWidth, y + finalHeight, 0).tex(u + width, v + height).endVertex();
|
||||
buffer.pos(x + finalWidth, (y), 0).tex(u + width, v).endVertex();
|
||||
buffer.pos((x), (y), 0).tex(u, v).endVertex();
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,87 +8,91 @@ 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 */
|
||||
/**
|
||||
* Font renderer that renders parts of strings surrounded by '#' (without quotes) in the SGA instead of normal text.
|
||||
*
|
||||
* @since Wizardry 1.1
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MixedFontRenderer extends FontRenderer {
|
||||
|
||||
|
||||
public MixedFontRenderer(GameSettings p_i1035_1_, ResourceLocation p_i1035_2_, TextureManager p_i1035_3_,
|
||||
boolean p_i1035_4_) {
|
||||
boolean p_i1035_4_){
|
||||
super(p_i1035_1_, p_i1035_2_, p_i1035_3_, p_i1035_4_);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int drawString(String string, float x, float y, int colour, boolean shadow){
|
||||
|
||||
public int drawString(String string, float x, float y, int colour, boolean shadow){
|
||||
|
||||
int l = 0;
|
||||
|
||||
|
||||
boolean sga = false;
|
||||
|
||||
|
||||
while(string.indexOf('#') > -1){
|
||||
|
||||
|
||||
String section = string.substring(0, string.indexOf('#'));
|
||||
|
||||
|
||||
if(sga){
|
||||
l += Minecraft.getMinecraft().standardGalacticFontRenderer.drawString(section, x, y, colour, shadow);
|
||||
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);
|
||||
}else{
|
||||
l += Minecraft.getMinecraft().fontRendererObj.drawString(section, x, y, colour, shadow);
|
||||
x += Minecraft.getMinecraft().fontRendererObj.getStringWidth(section);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
string = string.substring(string.indexOf('#') + 1);
|
||||
sga = !sga;
|
||||
}
|
||||
|
||||
|
||||
if(sga){
|
||||
l += Minecraft.getMinecraft().standardGalacticFontRenderer.drawString(string, x, y, colour, shadow);
|
||||
}else{
|
||||
l += Minecraft.getMinecraft().fontRendererObj.drawString(string, x, y, colour, shadow);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
l += Minecraft.getMinecraft().standardGalacticFontRenderer.drawString(string, x, y, colour, shadow);
|
||||
}else{
|
||||
l += Minecraft.getMinecraft().fontRendererObj.drawString(string, x, y, colour, shadow);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStringWidth(String string){
|
||||
|
||||
|
||||
int l = 0;
|
||||
|
||||
|
||||
boolean sga = false;
|
||||
|
||||
|
||||
while(string.indexOf('#') > -1){
|
||||
|
||||
|
||||
String section = string.substring(0, string.indexOf('#'));
|
||||
|
||||
|
||||
if(sga){
|
||||
l += Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(section);
|
||||
}else{
|
||||
l += Minecraft.getMinecraft().fontRendererObj.getStringWidth(section);
|
||||
}
|
||||
|
||||
l += Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(section);
|
||||
}else{
|
||||
l += Minecraft.getMinecraft().fontRendererObj.getStringWidth(section);
|
||||
}
|
||||
|
||||
string = string.substring(string.indexOf('#') + 1);
|
||||
sga = !sga;
|
||||
}
|
||||
|
||||
|
||||
if(sga){
|
||||
l += Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(string);
|
||||
}else{
|
||||
l += Minecraft.getMinecraft().fontRendererObj.getStringWidth(string);
|
||||
}
|
||||
|
||||
return l;
|
||||
l += Minecraft.getMinecraft().standardGalacticFontRenderer.getStringWidth(string);
|
||||
}else{
|
||||
l += Minecraft.getMinecraft().fontRendererObj.getStringWidth(string);
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
|
||||
// This doesn't work the same way yet
|
||||
@Override
|
||||
public void drawSplitString(String string, int x, int y, int width, int colour){
|
||||
|
||||
public void drawSplitString(String string, int x, int y, int width, int colour){
|
||||
|
||||
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().standardGalacticFontRenderer.drawSplitString(string.substring(1), x, y, width,
|
||||
colour);
|
||||
}else{
|
||||
Minecraft.getMinecraft().fontRendererObj.drawSplitString(string, x, y, width, colour);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,50 +10,43 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
// 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;
|
||||
public class MovingSoundEntity extends MovingSound {
|
||||
private final Entity source;
|
||||
private float distance = 0.0F;
|
||||
|
||||
public MovingSoundEntity(Entity entity, SoundEvent sound, 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);
|
||||
this.source = entity;
|
||||
this.repeat = repeat;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.repeatDelay = 0;
|
||||
}
|
||||
public MovingSoundEntity(Entity entity, SoundEvent sound, 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);
|
||||
this.source = entity;
|
||||
this.repeat = repeat;
|
||||
this.volume = volume;
|
||||
this.pitch = pitch;
|
||||
this.repeatDelay = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the JList with a new model.
|
||||
*/
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
if (this.source.isDead && repeat)
|
||||
{
|
||||
this.donePlaying = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.xPosF = (float)this.source.posX;
|
||||
this.yPosF = (float)this.source.posY;
|
||||
this.zPosF = (float)this.source.posZ;
|
||||
float f = MathHelper.sqrt_double(this.source.motionX * this.source.motionX + this.source.motionY * this.source.motionY + this.source.motionZ * this.source.motionZ);
|
||||
/**
|
||||
* Updates the JList with a new model.
|
||||
*/
|
||||
@Override
|
||||
public void update(){
|
||||
if(this.source.isDead && repeat){
|
||||
this.donePlaying = true;
|
||||
}else{
|
||||
this.xPosF = (float)this.source.posX;
|
||||
this.yPosF = (float)this.source.posY;
|
||||
this.zPosF = (float)this.source.posZ;
|
||||
float f = MathHelper.sqrt(this.source.motionX * this.source.motionX
|
||||
+ this.source.motionY * this.source.motionY + this.source.motionZ * this.source.motionZ);
|
||||
|
||||
// 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.volume = 0.0F + MathHelper.clamp_float(f, 0.0F, 0.5F) * 0.7F;
|
||||
}
|
||||
else
|
||||
{
|
||||
//this.pitch = 0.0F;
|
||||
//this.volume = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Is this something to do with the Doppler effect?
|
||||
if((double)f >= 0.01D){
|
||||
this.distance = MathHelper.clamp(this.distance + 0.0025F, 0.0F, 1.0F);
|
||||
this.volume = 0.0F + MathHelper.clamp(f, 0.0F, 0.5F) * 0.7F;
|
||||
}else{
|
||||
// this.pitch = 0.0F;
|
||||
// this.volume = 0.0F;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,20 +42,29 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
|
||||
/**
|
||||
* Event handler responsible for all client-side only events, mostly rendering.
|
||||
*
|
||||
* @author Electroblob
|
||||
* @since Wizardry 1.0
|
||||
*/
|
||||
@Mod.EventBusSubscriber(Side.CLIENT)
|
||||
public final class WizardryClientEventHandler {
|
||||
|
||||
private static final ResourceLocation shieldTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/shield.png");
|
||||
private static final ResourceLocation wingTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/wing.png");
|
||||
private static final ResourceLocation shadowWardTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/shadow_ward.png");
|
||||
private static final ResourceLocation sixthSenseTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/sixth_sense.png");
|
||||
private static final ResourceLocation sixthSenseOverlayTexture = new ResourceLocation(Wizardry.MODID, "textures/gui/sixth_sense_overlay.png");
|
||||
private static final ResourceLocation frostOverlayTexture = new ResourceLocation(Wizardry.MODID, "textures/gui/frost_overlay.png");
|
||||
private static final ResourceLocation pointerTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/pointer.png");
|
||||
private static final ResourceLocation targetPointerTexture = new ResourceLocation(Wizardry.MODID, "textures/entity/target_pointer.png");
|
||||
private static final ResourceLocation shieldTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/shield.png");
|
||||
private static final ResourceLocation wingTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/wing.png");
|
||||
private static final ResourceLocation shadowWardTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/shadow_ward.png");
|
||||
private static final ResourceLocation sixthSenseTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/sixth_sense.png");
|
||||
private static final ResourceLocation sixthSenseOverlayTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/sixth_sense_overlay.png");
|
||||
private static final ResourceLocation frostOverlayTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/gui/frost_overlay.png");
|
||||
private static final ResourceLocation pointerTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/pointer.png");
|
||||
private static final ResourceLocation targetPointerTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/target_pointer.png");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onTextureStitchEvent(TextureStitchEvent.Pre event){
|
||||
@@ -66,8 +75,8 @@ public final class WizardryClientEventHandler {
|
||||
// Shift-scrolling to change spells
|
||||
@SubscribeEvent
|
||||
public static void onMouseEvent(MouseEvent event){
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||
ItemStack wand = player.getHeldItemMainhand();
|
||||
|
||||
if(wand == null || !(wand.getItem() instanceof ItemWand)){
|
||||
@@ -75,7 +84,7 @@ public final class WizardryClientEventHandler {
|
||||
// If the player isn't holding a wand, then nothing else needs to be done.
|
||||
if(wand == null || !(wand.getItem() instanceof ItemWand)) return;
|
||||
}
|
||||
|
||||
|
||||
if(Minecraft.getMinecraft().inGameHasFocus && wand != null && event.getDwheel() != 0 && player.isSneaking()
|
||||
&& Wizardry.settings.enableShiftScrolling){
|
||||
|
||||
@@ -100,19 +109,19 @@ public final class WizardryClientEventHandler {
|
||||
// Bow zoom. Taken directly from AbstractClientPlayer so it works exactly like vanilla.
|
||||
if(event.getEntity().isHandActive() && event.getEntity().getActiveItemStack() != null
|
||||
&& event.getEntity().getActiveItemStack().getItem() instanceof ItemSpectralBow){
|
||||
|
||||
int maxUseTicks = event.getEntity().getItemInUseMaxCount();
|
||||
|
||||
float maxUseSeconds = (float)maxUseTicks / 20.0F;
|
||||
|
||||
if(maxUseSeconds > 1.0F){
|
||||
maxUseSeconds = 1.0F;
|
||||
}else{
|
||||
maxUseSeconds = maxUseSeconds * maxUseSeconds;
|
||||
}
|
||||
int maxUseTicks = event.getEntity().getItemInUseMaxCount();
|
||||
|
||||
event.setNewfov(event.getFov() * 1.0F - maxUseSeconds * 0.15F);
|
||||
}
|
||||
float maxUseSeconds = (float)maxUseTicks / 20.0F;
|
||||
|
||||
if(maxUseSeconds > 1.0F){
|
||||
maxUseSeconds = 1.0F;
|
||||
}else{
|
||||
maxUseSeconds = maxUseSeconds * maxUseSeconds;
|
||||
}
|
||||
|
||||
event.setNewfov(event.getFov() * 1.0F - maxUseSeconds * 0.15F);
|
||||
}
|
||||
}
|
||||
|
||||
// Third person
|
||||
@@ -128,126 +137,101 @@ public final class WizardryClientEventHandler {
|
||||
public static void onRenderWorldLastEvent(RenderWorldLastEvent event){
|
||||
// Now only fires in first person.
|
||||
if(Minecraft.getMinecraft().gameSettings.thirdPersonView == 0){
|
||||
renderShieldFirstPerson(Minecraft.getMinecraft().thePlayer);
|
||||
renderShadowWardFirstPerson(Minecraft.getMinecraft().thePlayer);
|
||||
renderShieldFirstPerson(Minecraft.getMinecraft().player);
|
||||
renderShadowWardFirstPerson(Minecraft.getMinecraft().player);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderLivingEvent(RenderLivingEvent.Post<EntityLivingBase> event){
|
||||
/*
|
||||
// Frost effect
|
||||
if(event.entity.isPotionActive(Wizardry.frost)){
|
||||
/* // Frost effect if(event.entity.isPotionActive(Wizardry.frost)){
|
||||
*
|
||||
* GlStateManager.pushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GlStateManager.enableBlend();
|
||||
* GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
*
|
||||
* float someScalingFactor = 0.0625f;
|
||||
*
|
||||
* float yaw = event.entity.prevRotationYaw;
|
||||
*
|
||||
* //int brightness = event.entity.getBrightnessForRender(0);
|
||||
*
|
||||
* //int j = brightness % 65536; //int k = brightness / 65536;
|
||||
* //OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
|
||||
* //GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
*
|
||||
*
|
||||
* GlStateManager.translate(event.x, event.y, event.z);
|
||||
*
|
||||
* GlStateManager.rotate(-yaw + 180, 0F, 1F, 0F);
|
||||
*
|
||||
* Render render = renderManager.getEntityRenderObject(event.entity);
|
||||
*
|
||||
* RenderLiving renderliving = event.renderer;
|
||||
*
|
||||
* // Reflection
|
||||
*
|
||||
* try {
|
||||
*
|
||||
* Timer timer = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "timer");
|
||||
*
|
||||
* // Chooses the appropriate zombie model, normal or villager // Fixed by moving before the model fields are
|
||||
* accessed if(render instanceof RenderZombie && event.entity instanceof EntityZombie){ // The second argument
|
||||
* is never used... ReflectionHelper.findMethod(RenderZombie.class, (RenderZombie)render, new
|
||||
* String[]{"func_82427_a"}, EntityZombie.class) .invoke(renderliving, (EntityZombie)event.entity); }
|
||||
*
|
||||
* // 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 =
|
||||
* ReflectionHelper.getPrivateValue(RenderLiving.class, renderliving, "mainModel");
|
||||
*
|
||||
* mainModel.isRiding = event.entity.isRiding(); mainModel.isChild = event.entity.isChild();
|
||||
*
|
||||
* GlStateManager.enableRescaleNormal(); GlStateManager.scale(-1.0F, -1.0F, 1.0F);
|
||||
*
|
||||
* // The second argument is never used... ReflectionHelper.findMethod(RenderLiving.class, renderliving, new
|
||||
* String[]{"preRenderCallback"}, EntityLivingBase.class, float.class) .invoke(renderliving, event.entity,
|
||||
* someScalingFactor);
|
||||
*
|
||||
* // Why is this -1.5f? No idea! GlStateManager.translate(0, -1.5f, 0);
|
||||
*
|
||||
* float f6 = event.entity.prevLimbSwingAmount + (event.entity.limbSwingAmount -
|
||||
* event.entity.prevLimbSwingAmount) * timer.renderPartialTicks; float f7 = event.entity.limbSwing -
|
||||
* event.entity.limbSwingAmount * (1.0F - timer.renderPartialTicks);
|
||||
*
|
||||
* if (event.entity.isChild()) { f7 *= 3.0F; }
|
||||
*
|
||||
* if (f6 > 1.0F) { f6 = 1.0F; }
|
||||
*
|
||||
* mainModel.setLivingAnimations(event.entity, f7, f6, timer.renderPartialTicks);
|
||||
*
|
||||
* GlStateManager.enableAlpha(); GlStateManager.color(0.5f, 0.7f, 1, 0.5f);
|
||||
*
|
||||
* mainModel.render(event.entity, f7, f6, 0, 0, 0, someScalingFactor);
|
||||
*
|
||||
* GL11.glDepthMask(true);
|
||||
*
|
||||
* // 'Pokemon' exception handling... Because why not?! } catch (Exception e) {
|
||||
* System.err.println("Something went very wrong! Error while rendering frost effect:"); e.printStackTrace(); }
|
||||
*
|
||||
* GlStateManager.disableAlpha(); GlStateManager.disableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA,
|
||||
* GL11.GL_ONE_MINUS_SRC_ALPHA); GlStateManager.disableRescaleNormal(); GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
* GlStateManager.popMatrix(); } */
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float someScalingFactor = 0.0625f;
|
||||
|
||||
float yaw = event.entity.prevRotationYaw;
|
||||
|
||||
//int brightness = event.entity.getBrightnessForRender(0);
|
||||
|
||||
//int j = brightness % 65536;
|
||||
//int k = brightness / 65536;
|
||||
//OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
|
||||
//GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
GlStateManager.translate(event.x, event.y, event.z);
|
||||
|
||||
GlStateManager.rotate(-yaw + 180, 0F, 1F, 0F);
|
||||
|
||||
Render render = renderManager.getEntityRenderObject(event.entity);
|
||||
|
||||
RenderLiving renderliving = event.renderer;
|
||||
|
||||
// Reflection
|
||||
|
||||
try {
|
||||
|
||||
Timer timer = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "timer");
|
||||
|
||||
// Chooses the appropriate zombie model, normal or villager
|
||||
// Fixed by moving before the model fields are accessed
|
||||
if(render instanceof RenderZombie && event.entity instanceof EntityZombie){
|
||||
// The second argument is never used...
|
||||
ReflectionHelper.findMethod(RenderZombie.class, (RenderZombie)render, new String[]{"func_82427_a"}, EntityZombie.class)
|
||||
.invoke(renderliving, (EntityZombie)event.entity);
|
||||
}
|
||||
|
||||
// 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 = ReflectionHelper.getPrivateValue(RenderLiving.class, renderliving, "mainModel");
|
||||
|
||||
mainModel.isRiding = event.entity.isRiding();
|
||||
mainModel.isChild = event.entity.isChild();
|
||||
|
||||
GlStateManager.enableRescaleNormal();
|
||||
GlStateManager.scale(-1.0F, -1.0F, 1.0F);
|
||||
|
||||
// The second argument is never used...
|
||||
ReflectionHelper.findMethod(RenderLiving.class, renderliving, new String[]{"preRenderCallback"}, EntityLivingBase.class, float.class)
|
||||
.invoke(renderliving, event.entity, someScalingFactor);
|
||||
|
||||
// Why is this -1.5f? No idea!
|
||||
GlStateManager.translate(0, -1.5f, 0);
|
||||
|
||||
float f6 = event.entity.prevLimbSwingAmount + (event.entity.limbSwingAmount - event.entity.prevLimbSwingAmount) * timer.renderPartialTicks;
|
||||
float f7 = event.entity.limbSwing - event.entity.limbSwingAmount * (1.0F - timer.renderPartialTicks);
|
||||
|
||||
if (event.entity.isChild())
|
||||
{
|
||||
f7 *= 3.0F;
|
||||
}
|
||||
|
||||
if (f6 > 1.0F)
|
||||
{
|
||||
f6 = 1.0F;
|
||||
}
|
||||
|
||||
mainModel.setLivingAnimations(event.entity, f7, f6, timer.renderPartialTicks);
|
||||
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.color(0.5f, 0.7f, 1, 0.5f);
|
||||
|
||||
mainModel.render(event.entity, f7, f6, 0, 0, 0, someScalingFactor);
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
|
||||
// 'Pokemon' exception handling... Because why not?!
|
||||
} catch (Exception e) {
|
||||
System.err.println("Something went very wrong! Error while rendering frost effect:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
GlStateManager.disableAlpha();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
*/
|
||||
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
WizardData properties = WizardData.get(mc.thePlayer);
|
||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(mc.theWorld, mc.thePlayer, 16);
|
||||
WizardData properties = WizardData.get(mc.player);
|
||||
RayTraceResult rayTrace = WizardryUtilities.standardEntityRayTrace(mc.world, mc.player, 16);
|
||||
RenderManager renderManager = event.getRenderer().getRenderManager();
|
||||
|
||||
ItemStack wand = mc.thePlayer.getHeldItemMainhand();
|
||||
|
||||
ItemStack wand = mc.player.getHeldItemMainhand();
|
||||
|
||||
if(wand == null || !(wand.getItem() instanceof ItemWand)){
|
||||
wand = mc.thePlayer.getHeldItemOffhand();
|
||||
wand = mc.player.getHeldItemOffhand();
|
||||
}
|
||||
|
||||
|
||||
// Target selection pointer
|
||||
if(mc.thePlayer.isSneaking() && wand != null && wand.getItem() instanceof ItemWand && rayTrace != null
|
||||
if(mc.player.isSneaking() && wand != null && wand.getItem() instanceof ItemWand && rayTrace != null
|
||||
&& rayTrace.entityHit instanceof EntityLivingBase && rayTrace.entityHit == event.getEntity()
|
||||
&& properties != null && properties.selectedMinion != null){
|
||||
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
@@ -273,9 +257,9 @@ public final class WizardryClientEventHandler {
|
||||
mc.renderEngine.bindTexture(targetPointerTexture);
|
||||
|
||||
buffer.pos(-0.2, 0.24, 0).tex(0, 0).endVertex();
|
||||
buffer.pos(0.2, 0.24, 0).tex(9f/16f, 0).endVertex();
|
||||
buffer.pos(0.2, -0.24, 0).tex(9f/16f, 11f/16f).endVertex();
|
||||
buffer.pos(-0.2, -0.24, 0).tex(0, 11f/16f).endVertex();
|
||||
buffer.pos(0.2, 0.24, 0).tex(9f / 16f, 0).endVertex();
|
||||
buffer.pos(0.2, -0.24, 0).tex(9f / 16f, 11f / 16f).endVertex();
|
||||
buffer.pos(-0.2, -0.24, 0).tex(0, 11f / 16f).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
@@ -287,8 +271,9 @@ public final class WizardryClientEventHandler {
|
||||
}
|
||||
|
||||
// Summoned creature selection pointer
|
||||
if(properties != null && properties.selectedMinion != null && properties.selectedMinion.get() == event.getEntity()){
|
||||
|
||||
if(properties != null && properties.selectedMinion != null
|
||||
&& properties.selectedMinion.get() == event.getEntity()){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
@@ -314,9 +299,9 @@ public final class WizardryClientEventHandler {
|
||||
mc.renderEngine.bindTexture(pointerTexture);
|
||||
|
||||
buffer.pos(-0.2, 0.24, 0).tex(0, 0).endVertex();
|
||||
buffer.pos(0.2, 0.24, 0).tex(9f/16f, 0).endVertex();
|
||||
buffer.pos(0.2, -0.24, 0).tex(9f/16f, 11f/16f).endVertex();
|
||||
buffer.pos(-0.2, -0.24, 0).tex(0, 11f/16f).endVertex();
|
||||
buffer.pos(0.2, 0.24, 0).tex(9f / 16f, 0).endVertex();
|
||||
buffer.pos(0.2, -0.24, 0).tex(9f / 16f, 11f / 16f).endVertex();
|
||||
buffer.pos(-0.2, -0.24, 0).tex(0, 11f / 16f).endVertex();
|
||||
|
||||
tessellator.draw();
|
||||
|
||||
@@ -326,11 +311,13 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
|
||||
// Sixth sense
|
||||
if(mc.thePlayer.isPotionActive(WizardryPotions.sixth_sense) && event.getEntity() != mc.thePlayer
|
||||
&& mc.thePlayer.getActivePotionEffect(WizardryPotions.sixth_sense) != null
|
||||
&& event.getEntity().getDistanceToEntity(mc.thePlayer) < 20*(1+mc.thePlayer.getActivePotionEffect(WizardryPotions.sixth_sense).getAmplifier()*Constants.RANGE_INCREASE_PER_LEVEL)){
|
||||
if(mc.player.isPotionActive(WizardryPotions.sixth_sense) && event.getEntity() != mc.player
|
||||
&& mc.player.getActivePotionEffect(WizardryPotions.sixth_sense) != null
|
||||
&& event.getEntity().getDistanceToEntity(mc.player) < 20
|
||||
* (1 + mc.player.getActivePotionEffect(WizardryPotions.sixth_sense).getAmplifier()
|
||||
* Constants.RANGE_INCREASE_PER_LEVEL)){
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
@@ -375,9 +362,9 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onRenderGameOverlayEvent(RenderGameOverlayEvent.Post event){
|
||||
|
||||
|
||||
if(event.getType() == RenderGameOverlayEvent.ElementType.HELMET
|
||||
&& Minecraft.getMinecraft().thePlayer.isPotionActive(WizardryPotions.sixth_sense)){
|
||||
&& Minecraft.getMinecraft().player.isPotionActive(WizardryPotions.sixth_sense)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -387,17 +374,18 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableAlpha();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(sixthSenseOverlayTexture);
|
||||
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos(0.0D, (double)event.getResolution().getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
|
||||
buffer.pos((double)event.getResolution().getScaledWidth(), (double)event.getResolution().getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex();
|
||||
buffer.pos((double)event.getResolution().getScaledWidth(), (double)event.getResolution().getScaledHeight(),
|
||||
-90.0D).tex(1.0D, 1.0D).endVertex();
|
||||
buffer.pos((double)event.getResolution().getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex();
|
||||
buffer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GlStateManager.enableAlpha();
|
||||
@@ -407,7 +395,7 @@ public final class WizardryClientEventHandler {
|
||||
}
|
||||
|
||||
if(event.getType() == RenderGameOverlayEvent.ElementType.HELMET
|
||||
&& Minecraft.getMinecraft().thePlayer.isPotionActive(WizardryPotions.frost)){
|
||||
&& Minecraft.getMinecraft().player.isPotionActive(WizardryPotions.frost)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -417,16 +405,17 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GlStateManager.disableAlpha();
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(frostOverlayTexture);
|
||||
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
buffer.pos(0.0D, (double)event.getResolution().getScaledHeight(), -90.0D).tex(0.0D, 1.0D).endVertex();
|
||||
buffer.pos((double)event.getResolution().getScaledWidth(), (double)event.getResolution().getScaledHeight(), -90.0D).tex(1.0D, 1.0D).endVertex();
|
||||
buffer.pos((double)event.getResolution().getScaledWidth(), (double)event.getResolution().getScaledHeight(),
|
||||
-90.0D).tex(1.0D, 1.0D).endVertex();
|
||||
buffer.pos((double)event.getResolution().getScaledWidth(), 0.0D, -90.0D).tex(1.0D, 0.0D).endVertex();
|
||||
buffer.pos(0.0D, 0.0D, -90.0D).tex(0.0D, 0.0D).endVertex();
|
||||
|
||||
|
||||
tessellator.draw();
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
@@ -440,8 +429,10 @@ public final class WizardryClientEventHandler {
|
||||
// FIXME: Something in here is making the first person shadow ward rather translucent.
|
||||
private static void renderShadowWardFirstPerson(EntityPlayer entityplayer){
|
||||
ItemStack wand = entityplayer.getActiveItemStack();
|
||||
if(WizardData.get(entityplayer) != null && WizardData.get(entityplayer).currentlyCasting() instanceof ShadowWard || (entityplayer.isHandActive() && wand != null && wand.getItemDamage() < wand.getMaxDamage()
|
||||
&& wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof ShadowWard)){
|
||||
if(WizardData.get(entityplayer) != null && WizardData.get(entityplayer).currentlyCasting() instanceof ShadowWard
|
||||
|| (entityplayer.isHandActive() && wand != null && wand.getItemDamage() < wand.getMaxDamage()
|
||||
&& wand.getItem() instanceof ItemWand
|
||||
&& WandHelper.getCurrentSpell(wand) instanceof ShadowWard)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -455,18 +446,18 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.translate(0, 1.2, 0);
|
||||
GlStateManager.rotate(-entityplayer.rotationYaw, 0, 1, 0);
|
||||
GlStateManager.rotate(entityplayer.rotationPitch, 1, 0, 0);
|
||||
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(shadowWardTexture);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(0, 0, 1.2);
|
||||
GlStateManager.rotate(entityplayer.worldObj.getWorldTime()*-2, 0, 0, 1);
|
||||
GlStateManager.rotate(entityplayer.world.getWorldTime() * -2, 0, 0, 1);
|
||||
GlStateManager.scale(1.1, 1.1, 1.1);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
buffer.pos(-0.5, 0.5, -0.5).tex(0, 0).endVertex();
|
||||
@@ -498,8 +489,9 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
private static void renderShadowWardIfActive(EntityPlayer entityplayer){
|
||||
ItemStack wand = entityplayer.getActiveItemStack();
|
||||
if(WizardData.get(entityplayer).currentlyCasting() instanceof ShadowWard || (entityplayer.isHandActive() && wand != null
|
||||
&& wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof ShadowWard)){
|
||||
if(WizardData.get(entityplayer).currentlyCasting() instanceof ShadowWard || (entityplayer.isHandActive()
|
||||
&& wand != null && wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand
|
||||
&& WandHelper.getCurrentSpell(wand) instanceof ShadowWard)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -510,14 +502,14 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
GlStateManager.rotate(-entityplayer.renderYawOffset, 0, 1, 0);
|
||||
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(shadowWardTexture);
|
||||
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
GlStateManager.translate(0, 1.2, 0);
|
||||
GlStateManager.rotate(entityplayer.worldObj.getWorldTime()*-2, 0, 0, 1);
|
||||
GlStateManager.rotate(entityplayer.world.getWorldTime() * -2, 0, 0, 1);
|
||||
GlStateManager.scale(1.1, 1.1, 1.1);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
@@ -548,8 +540,9 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
private static void renderWingsIfActive(EntityPlayer entityplayer, float partialTickTime){
|
||||
ItemStack wand = entityplayer.getActiveItemStack();
|
||||
if(WizardData.get(entityplayer).currentlyCasting() instanceof Flight || (entityplayer.isHandActive() && wand != null
|
||||
&& wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof Flight)){
|
||||
if(WizardData.get(entityplayer).currentlyCasting() instanceof Flight
|
||||
|| (entityplayer.isHandActive() && wand != null && wand.getItemDamage() < wand.getMaxDamage()
|
||||
&& wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof Flight)){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -558,9 +551,9 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
//GlStateManager.rotate(-entityplayer.rotationYawHead, 0, 1, 0);
|
||||
// GlStateManager.rotate(-entityplayer.rotationYawHead, 0, 1, 0);
|
||||
GlStateManager.rotate(-entityplayer.renderYawOffset, 0, 1, 0);
|
||||
//GlStateManager.rotate(180, 1, 0, 0);
|
||||
// GlStateManager.rotate(180, 1, 0, 0);
|
||||
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(wingTexture);
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
@@ -569,7 +562,7 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(0.1, 0.4, -0.15);
|
||||
GlStateManager.rotate(20 + 20*(float)Math.sin(entityplayer.worldObj.getWorldTime()*0.3), 0, 1, 0);
|
||||
GlStateManager.rotate(20 + 20 * (float)Math.sin(entityplayer.world.getWorldTime() * 0.3), 0, 1, 0);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
@@ -594,7 +587,7 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.translate(-0.1, 0.4, -0.15);
|
||||
GlStateManager.rotate(-200 - 20*(float)Math.sin(entityplayer.worldObj.getWorldTime()*0.3), 0, 1, 0);
|
||||
GlStateManager.rotate(-200 - 20 * (float)Math.sin(entityplayer.world.getWorldTime() * 0.3), 0, 1, 0);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
@@ -625,8 +618,10 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
private static void renderShieldFirstPerson(EntityPlayer entityplayer){
|
||||
ItemStack wand = entityplayer.getActiveItemStack();
|
||||
if(WizardData.get(entityplayer) != null && WizardData.get(entityplayer).shield != null && (WizardData.get(entityplayer).currentlyCasting() instanceof Shield || (entityplayer.isHandActive() && wand != null
|
||||
&& wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof Shield))){
|
||||
if(WizardData.get(entityplayer) != null && WizardData.get(entityplayer).shield != null
|
||||
&& (WizardData.get(entityplayer).currentlyCasting() instanceof Shield || (entityplayer.isHandActive()
|
||||
&& wand != null && wand.getItemDamage() < wand.getMaxDamage()
|
||||
&& wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof Shield))){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -649,13 +644,13 @@ public final class WizardryClientEventHandler {
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(shieldTexture);
|
||||
|
||||
renderShield(tessellator);
|
||||
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
//RenderHelper.enableStandardItemLighting();
|
||||
// RenderHelper.enableStandardItemLighting();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
@@ -663,8 +658,10 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
private static void renderShieldIfActive(EntityPlayer entityplayer){
|
||||
ItemStack wand = entityplayer.getActiveItemStack();
|
||||
if(WizardData.get(entityplayer).shield != null && (WizardData.get(entityplayer).currentlyCasting() instanceof Shield || (entityplayer.isHandActive() && wand != null
|
||||
&& wand.getItemDamage() < wand.getMaxDamage() && wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof Shield))){
|
||||
if(WizardData.get(entityplayer).shield != null
|
||||
&& (WizardData.get(entityplayer).currentlyCasting() instanceof Shield || (entityplayer.isHandActive()
|
||||
&& wand != null && wand.getItemDamage() < wand.getMaxDamage()
|
||||
&& wand.getItem() instanceof ItemWand && WandHelper.getCurrentSpell(wand) instanceof Shield))){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -679,9 +676,9 @@ public final class WizardryClientEventHandler {
|
||||
|
||||
GlStateManager.translate(0, 1.3, 0);
|
||||
|
||||
//GlStateManager.rotate(180, 0, 1, 0);
|
||||
// GlStateManager.rotate(180, 0, 1, 0);
|
||||
GlStateManager.rotate(-entityplayer.renderYawOffset, 0, 1, 0);
|
||||
//GlStateManager.rotate(-entityplayer.rotationPitch, 1, 0, 0);
|
||||
// GlStateManager.rotate(-entityplayer.rotationPitch, 1, 0, 0);
|
||||
|
||||
GlStateManager.translate(0, 0, 0.8);
|
||||
|
||||
@@ -696,7 +693,7 @@ public final class WizardryClientEventHandler {
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
//RenderHelper.enableStandardItemLighting();
|
||||
// RenderHelper.enableStandardItemLighting();
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@@ -4,80 +4,75 @@ import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelHammer extends ModelBase
|
||||
{
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
ModelRenderer Shape4;
|
||||
ModelRenderer Shape5;
|
||||
ModelRenderer Shape6;
|
||||
|
||||
public ModelHammer()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
Shape1 = new ModelRenderer(this, 0, 0);
|
||||
Shape1.addBox(0F, 0F, 0F, 20, 12, 12);
|
||||
Shape1.setRotationPoint(-10F, 12F, -6F);
|
||||
Shape1.setTextureSize(64, 64);
|
||||
Shape1.mirror = true;
|
||||
setRotation(Shape1, 0F, 0F, 0F);
|
||||
Shape2 = new ModelRenderer(this, 0, 24);
|
||||
Shape2.addBox(0F, 0F, 0F, 4, 14, 4);
|
||||
Shape2.setRotationPoint(-2F, -2F, -2F);
|
||||
Shape2.setTextureSize(64, 64);
|
||||
Shape2.mirror = true;
|
||||
setRotation(Shape2, 0F, 0F, 0F);
|
||||
Shape3 = new ModelRenderer(this, 0, 49);
|
||||
Shape3.addBox(0F, 0F, 0F, 5, 5, 5);
|
||||
Shape3.setRotationPoint(-2.5F, -7F, -2.5F);
|
||||
Shape3.setTextureSize(64, 64);
|
||||
Shape3.mirror = true;
|
||||
setRotation(Shape3, 0F, 0F, 0F);
|
||||
Shape4 = new ModelRenderer(this, 0, 42);
|
||||
Shape4.addBox(0F, 0F, 0F, 5, 2, 5);
|
||||
Shape4.setRotationPoint(-2.5F, 10F, -2.5F);
|
||||
Shape4.setTextureSize(64, 64);
|
||||
Shape4.mirror = true;
|
||||
setRotation(Shape4, 0F, 0F, 0F);
|
||||
Shape5 = new ModelRenderer(this, 20, 24);
|
||||
Shape5.addBox(0F, 0F, 0F, 2, 14, 14);
|
||||
Shape5.setRotationPoint(-8F, 11F, -7F);
|
||||
Shape5.setTextureSize(64, 64);
|
||||
Shape5.mirror = true;
|
||||
setRotation(Shape5, 0F, 0F, 0F);
|
||||
Shape6 = new ModelRenderer(this, 20, 24);
|
||||
Shape6.addBox(0F, 0F, 0F, 2, 14, 14);
|
||||
Shape6.setRotationPoint(6F, 11F, -7F);
|
||||
Shape6.setTextureSize(64, 64);
|
||||
Shape6.mirror = true;
|
||||
setRotation(Shape6, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
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);
|
||||
Shape1.render(f5);
|
||||
Shape2.render(f5);
|
||||
Shape3.render(f5);
|
||||
Shape4.render(f5);
|
||||
Shape5.render(f5);
|
||||
Shape6.render(f5);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
public class ModelHammer extends ModelBase {
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
ModelRenderer Shape4;
|
||||
ModelRenderer Shape5;
|
||||
ModelRenderer Shape6;
|
||||
|
||||
public ModelHammer(){
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
Shape1 = new ModelRenderer(this, 0, 0);
|
||||
Shape1.addBox(0F, 0F, 0F, 20, 12, 12);
|
||||
Shape1.setRotationPoint(-10F, 12F, -6F);
|
||||
Shape1.setTextureSize(64, 64);
|
||||
Shape1.mirror = true;
|
||||
setRotation(Shape1, 0F, 0F, 0F);
|
||||
Shape2 = new ModelRenderer(this, 0, 24);
|
||||
Shape2.addBox(0F, 0F, 0F, 4, 14, 4);
|
||||
Shape2.setRotationPoint(-2F, -2F, -2F);
|
||||
Shape2.setTextureSize(64, 64);
|
||||
Shape2.mirror = true;
|
||||
setRotation(Shape2, 0F, 0F, 0F);
|
||||
Shape3 = new ModelRenderer(this, 0, 49);
|
||||
Shape3.addBox(0F, 0F, 0F, 5, 5, 5);
|
||||
Shape3.setRotationPoint(-2.5F, -7F, -2.5F);
|
||||
Shape3.setTextureSize(64, 64);
|
||||
Shape3.mirror = true;
|
||||
setRotation(Shape3, 0F, 0F, 0F);
|
||||
Shape4 = new ModelRenderer(this, 0, 42);
|
||||
Shape4.addBox(0F, 0F, 0F, 5, 2, 5);
|
||||
Shape4.setRotationPoint(-2.5F, 10F, -2.5F);
|
||||
Shape4.setTextureSize(64, 64);
|
||||
Shape4.mirror = true;
|
||||
setRotation(Shape4, 0F, 0F, 0F);
|
||||
Shape5 = new ModelRenderer(this, 20, 24);
|
||||
Shape5.addBox(0F, 0F, 0F, 2, 14, 14);
|
||||
Shape5.setRotationPoint(-8F, 11F, -7F);
|
||||
Shape5.setTextureSize(64, 64);
|
||||
Shape5.mirror = true;
|
||||
setRotation(Shape5, 0F, 0F, 0F);
|
||||
Shape6 = new ModelRenderer(this, 20, 24);
|
||||
Shape6.addBox(0F, 0F, 0F, 2, 14, 14);
|
||||
Shape6.setRotationPoint(6F, 11F, -7F);
|
||||
Shape6.setTextureSize(64, 64);
|
||||
Shape6.mirror = true;
|
||||
setRotation(Shape6, 0F, 0F, 0F);
|
||||
}
|
||||
|
||||
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);
|
||||
Shape1.render(f5);
|
||||
Shape2.render(f5);
|
||||
Shape3.render(f5);
|
||||
Shape4.render(f5);
|
||||
Shape5.render(f5);
|
||||
Shape6.render(f5);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,309 +13,299 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelIceGiant extends ModelBase
|
||||
{
|
||||
/** The head model for the iron golem. */
|
||||
public ModelRenderer iceGiantHead;
|
||||
public class ModelIceGiant extends ModelBase {
|
||||
/** The head model for the iron golem. */
|
||||
public ModelRenderer iceGiantHead;
|
||||
|
||||
/** The body model for the iron golem. */
|
||||
public ModelRenderer iceGiantBody;
|
||||
/** The body model for the iron golem. */
|
||||
public ModelRenderer iceGiantBody;
|
||||
|
||||
/** The right arm model for the iron golem. */
|
||||
public ModelRenderer iceGiantRightArm;
|
||||
/** The right arm model for the iron golem. */
|
||||
public ModelRenderer iceGiantRightArm;
|
||||
|
||||
/** The left arm model for the iron golem. */
|
||||
public ModelRenderer iceGiantLeftArm;
|
||||
/** The left arm model for the iron golem. */
|
||||
public ModelRenderer iceGiantLeftArm;
|
||||
|
||||
/** The left leg model for the Iron Golem. */
|
||||
public ModelRenderer iceGiantLeftLeg;
|
||||
/** The left leg model for the Iron Golem. */
|
||||
public ModelRenderer iceGiantLeftLeg;
|
||||
|
||||
/** The right leg model for the Iron Golem. */
|
||||
public ModelRenderer iceGiantRightLeg;
|
||||
|
||||
ModelRenderer headSpike1;
|
||||
ModelRenderer headSpike2;
|
||||
ModelRenderer headSpike3;
|
||||
ModelRenderer headSpike4;
|
||||
ModelRenderer headSpike5;
|
||||
ModelRenderer headSpike6;
|
||||
ModelRenderer headSpike7;
|
||||
ModelRenderer rightArmSpike1;
|
||||
ModelRenderer rightArmSpike2;
|
||||
ModelRenderer leftArmSpike1;
|
||||
ModelRenderer leftArmSpike2;
|
||||
ModelRenderer bodySpike1;
|
||||
ModelRenderer bodySpike2;
|
||||
ModelRenderer bodySpike3;
|
||||
ModelRenderer bodySpike4;
|
||||
ModelRenderer bodySpike5;
|
||||
/** The right leg model for the Iron Golem. */
|
||||
public ModelRenderer iceGiantRightLeg;
|
||||
|
||||
public ModelIceGiant()
|
||||
{
|
||||
this(0.0F);
|
||||
}
|
||||
ModelRenderer headSpike1;
|
||||
ModelRenderer headSpike2;
|
||||
ModelRenderer headSpike3;
|
||||
ModelRenderer headSpike4;
|
||||
ModelRenderer headSpike5;
|
||||
ModelRenderer headSpike6;
|
||||
ModelRenderer headSpike7;
|
||||
ModelRenderer rightArmSpike1;
|
||||
ModelRenderer rightArmSpike2;
|
||||
ModelRenderer leftArmSpike1;
|
||||
ModelRenderer leftArmSpike2;
|
||||
ModelRenderer bodySpike1;
|
||||
ModelRenderer bodySpike2;
|
||||
ModelRenderer bodySpike3;
|
||||
ModelRenderer bodySpike4;
|
||||
ModelRenderer bodySpike5;
|
||||
|
||||
public ModelIceGiant(float par1)
|
||||
{
|
||||
this(par1, -7.0F);
|
||||
}
|
||||
public ModelIceGiant(){
|
||||
this(0.0F);
|
||||
}
|
||||
|
||||
public ModelIceGiant(float par1, float par2)
|
||||
{
|
||||
short short1 = 128;
|
||||
short short2 = 128;
|
||||
|
||||
this.iceGiantHead = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantHead.setRotationPoint(0.0F, 0.0F + par2, -1.0F);
|
||||
this.iceGiantHead.setTextureOffset(0, 10).addBox(-6.0F, -14.0F, -6.5F, 12, 12, 12, par1);
|
||||
|
||||
this.iceGiantBody = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
this.iceGiantBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, par1);
|
||||
this.iceGiantBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, par1 + 0.5F);
|
||||
|
||||
this.iceGiantRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantRightArm.setRotationPoint(0.0F, -7.0F, 0.0F);
|
||||
this.iceGiantRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, par1);
|
||||
|
||||
this.iceGiantLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F);
|
||||
this.iceGiantLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, par1);
|
||||
|
||||
this.iceGiantLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);
|
||||
this.iceGiantLeftLeg.setRotationPoint(-4.0F, 18.0F + par2, 0.0F);
|
||||
this.iceGiantLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);
|
||||
|
||||
this.iceGiantRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);
|
||||
this.iceGiantRightLeg.mirror = true;
|
||||
this.iceGiantRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + par2, 0.0F);
|
||||
this.iceGiantRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);
|
||||
|
||||
headSpike1 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike1.addBox(-4F, -4F, 0F, 4, 4, 4);
|
||||
headSpike1.setRotationPoint(-4F, -10F, -5F);
|
||||
headSpike1.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike1, -0.1047198F, -0.5235988F, 0.9599311F);
|
||||
|
||||
headSpike2 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike2.addBox(0F, -4F, 0F, 4, 4, 4);
|
||||
headSpike2.setRotationPoint(4F, -16F, 0F);
|
||||
headSpike2.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike2, 0.5585054F, 0.9250245F, -0.5235988F);
|
||||
|
||||
headSpike3 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike3.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
headSpike3.setRotationPoint(4F, -13F, 4F);
|
||||
headSpike3.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike3, 0.7853982F, -1.396263F, 0.7853982F);
|
||||
|
||||
headSpike4 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike4.addBox(-4F, -4F, 0F, 4, 4, 4);
|
||||
headSpike4.setRotationPoint(-4F, -16F, 0F);
|
||||
headSpike4.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike4, 0.5585054F, -0.9250245F, 0.5235988F);
|
||||
|
||||
headSpike5 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike5.addBox(0F, -4F, 0F, 4, 4, 4);
|
||||
headSpike5.setRotationPoint(4F, -10F, -5F);
|
||||
headSpike5.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike5, 0.5235988F, -0.9599311F, 0.1047198F);
|
||||
|
||||
rightArmSpike1 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
rightArmSpike1.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
rightArmSpike1.setRotationPoint(-11F, -8F, 0F);
|
||||
rightArmSpike1.mirror = true;
|
||||
setRotationWithEulerYzx(rightArmSpike1, 0.7853982F, 1.134464F, 0.9599311F);
|
||||
|
||||
headSpike6 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike6.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
headSpike6.setRotationPoint(-4F, -13F, 4F);
|
||||
headSpike6.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike6, 0.7853982F, -1.745329F, 0.7853982F);
|
||||
|
||||
leftArmSpike1 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
leftArmSpike1.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
leftArmSpike1.setRotationPoint(11F, -8F, 0F);
|
||||
leftArmSpike1.mirror = true;
|
||||
setRotationWithEulerYzx(leftArmSpike1, 0.7853982F, -1.134464F, -0.9599311F);
|
||||
|
||||
leftArmSpike2 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
leftArmSpike2.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
leftArmSpike2.setRotationPoint(12F, -4F, 0F);
|
||||
leftArmSpike2.mirror = true;
|
||||
setRotationWithEulerYzx(leftArmSpike2, 0.7853982F, 0F, -0.9599311F);
|
||||
|
||||
bodySpike1 = new ModelRenderer(this, 32, 69).setTextureSize(short1, short2);
|
||||
bodySpike1.addBox(-3F, -3F, -3F, 6, 6, 6);
|
||||
bodySpike1.setRotationPoint(-4F, -4F, 3F);
|
||||
bodySpike1.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike1, 0.2808018F, 0.8096675F, 0.8339369F);
|
||||
|
||||
rightArmSpike2 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
rightArmSpike2.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
rightArmSpike2.setRotationPoint(-12F, -4F, 0F);
|
||||
rightArmSpike2.mirror = true;
|
||||
setRotationWithEulerYzx(rightArmSpike2, 0.7853982F, 0F, 0.9599311F);
|
||||
|
||||
bodySpike2 = new ModelRenderer(this, 32, 69).setTextureSize(short1, short2);
|
||||
bodySpike2.addBox(-3F, -3F, -3F, 6, 6, 6);
|
||||
bodySpike2.setRotationPoint(4F, -4F, 3F);
|
||||
bodySpike2.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike2, 0.2808018F, -0.8096757F, -0.8339358F);
|
||||
|
||||
bodySpike3 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
bodySpike3.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
bodySpike3.setRotationPoint(6F, -2F, -5F);
|
||||
bodySpike3.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike3, 1.120006F, -1.347726F, -0.8969422F);
|
||||
|
||||
bodySpike4 = new ModelRenderer(this, 32, 69).setTextureSize(short1, short2);
|
||||
bodySpike4.addBox(-3F, -3F, -3F, 6, 6, 6);
|
||||
bodySpike4.setRotationPoint(0F, -4F, -4F);
|
||||
bodySpike4.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike4, 0.7853982F, -1.570796F, 0.9599311F);
|
||||
|
||||
headSpike7 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike7.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
headSpike7.setRotationPoint(0F, -20F, 4F);
|
||||
headSpike7.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike7, 0.7853982F, 1.570796F, 0.7853982F);
|
||||
|
||||
bodySpike5 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
bodySpike5.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
bodySpike5.setRotationPoint(-6F, -2F, -5F);
|
||||
bodySpike5.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike5, 1.120006F, 1.347725F, 0.896934F);
|
||||
|
||||
this.convertToChild(this.iceGiantHead, headSpike1);
|
||||
this.convertToChild(this.iceGiantHead, headSpike2);
|
||||
this.convertToChild(this.iceGiantHead, headSpike3);
|
||||
this.convertToChild(this.iceGiantHead, headSpike4);
|
||||
this.convertToChild(this.iceGiantHead, headSpike5);
|
||||
this.convertToChild(this.iceGiantHead, headSpike6);
|
||||
this.convertToChild(this.iceGiantHead, headSpike7);
|
||||
this.convertToChild(this.iceGiantRightArm, rightArmSpike1);
|
||||
this.convertToChild(this.iceGiantRightArm, rightArmSpike2);
|
||||
this.convertToChild(this.iceGiantLeftArm, leftArmSpike1);
|
||||
this.convertToChild(this.iceGiantLeftArm, leftArmSpike2);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike1);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike2);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike3);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike4);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike5);
|
||||
|
||||
}
|
||||
public ModelIceGiant(float par1){
|
||||
this(par1, -7.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)
|
||||
{
|
||||
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
this.iceGiantHead.render(par7);
|
||||
this.iceGiantBody.render(par7);
|
||||
this.iceGiantLeftLeg.render(par7);
|
||||
this.iceGiantRightLeg.render(par7);
|
||||
this.iceGiantRightArm.render(par7);
|
||||
this.iceGiantLeftArm.render(par7);
|
||||
}
|
||||
public ModelIceGiant(float par1, float par2){
|
||||
short short1 = 128;
|
||||
short short2 = 128;
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
this.iceGiantHead.rotateAngleY = par4 / (180F / (float)Math.PI);
|
||||
this.iceGiantHead.rotateAngleX = par5 / (180F / (float)Math.PI);
|
||||
this.iceGiantLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2;
|
||||
this.iceGiantRightLeg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2;
|
||||
this.iceGiantLeftLeg.rotateAngleY = 0.0F;
|
||||
this.iceGiantRightLeg.rotateAngleY = 0.0F;
|
||||
}
|
||||
this.iceGiantHead = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantHead.setRotationPoint(0.0F, 0.0F + par2, -1.0F);
|
||||
this.iceGiantHead.setTextureOffset(0, 10).addBox(-6.0F, -14.0F, -6.5F, 12, 12, 12, par1);
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
EntityIceGiant entityicegiant = (EntityIceGiant)par1EntityLivingBase;
|
||||
int i = entityicegiant.getAttackTimer();
|
||||
this.iceGiantBody = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantBody.setRotationPoint(0.0F, 0.0F + par2, 0.0F);
|
||||
this.iceGiantBody.setTextureOffset(0, 40).addBox(-9.0F, -2.0F, -6.0F, 18, 12, 11, par1);
|
||||
this.iceGiantBody.setTextureOffset(0, 70).addBox(-4.5F, 10.0F, -3.0F, 9, 5, 6, par1 + 0.5F);
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
this.iceGiantRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);
|
||||
this.iceGiantLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.iceGiantRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
|
||||
this.iceGiantLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
|
||||
}
|
||||
}
|
||||
this.iceGiantRightArm = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantRightArm.setRotationPoint(0.0F, -7.0F, 0.0F);
|
||||
this.iceGiantRightArm.setTextureOffset(60, 21).addBox(-13.0F, -2.5F, -3.0F, 4, 30, 6, par1);
|
||||
|
||||
private float func_78172_a(float par1, float par2)
|
||||
{
|
||||
return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F);
|
||||
}
|
||||
|
||||
/** This is really useful for converting the source from a Techne model export
|
||||
* which will have absolute rotation points that need to be converted before
|
||||
* creating the addChild() relationship. [Courtesy of jabelar] */
|
||||
protected void convertToChild(ModelRenderer parent, ModelRenderer child)
|
||||
{
|
||||
// move child rotation point to be relative to parent
|
||||
child.rotationPointX -= parent.rotationPointX;
|
||||
child.rotationPointY -= parent.rotationPointY;
|
||||
child.rotationPointZ -= parent.rotationPointZ;
|
||||
// make rotations relative to parent
|
||||
child.rotateAngleX -= parent.rotateAngleX;
|
||||
child.rotateAngleY -= parent.rotateAngleY;
|
||||
child.rotateAngleZ -= parent.rotateAngleZ;
|
||||
// create relationship
|
||||
parent.addChild(child);
|
||||
}
|
||||
|
||||
/** Fixes the Techne rotation order bug. [Courtesy of tprk77] */
|
||||
private Vector3f ConvertEulerYzxToZyx(Vector3f eulerYzx) {
|
||||
// Create a matrix from YZX ordered Euler angles
|
||||
float a = MathHelper.cos(eulerYzx.x);
|
||||
float b = MathHelper.sin(eulerYzx.x);
|
||||
float c = MathHelper.cos(eulerYzx.y);
|
||||
float d = MathHelper.sin(eulerYzx.y);
|
||||
float e = MathHelper.cos(eulerYzx.z);
|
||||
float f = MathHelper.sin(eulerYzx.z);
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.m00 = c * e;
|
||||
matrix.m01 = b * d - a * c * f;
|
||||
matrix.m02 = b * c * f + a * d;
|
||||
matrix.m10 = f;
|
||||
matrix.m11 = a * e;
|
||||
matrix.m12 = -b * e;
|
||||
matrix.m20 = -d * e;
|
||||
matrix.m21 = a * d * f + b * c;
|
||||
matrix.m22 = a * c - b * d * f;
|
||||
matrix.m33 = 1.0F;
|
||||
// Create ZYX ordered Euler angles from the matrix
|
||||
Vector3f eulerZyx = new Vector3f();
|
||||
eulerZyx.y = (float) Math.asin(MathHelper.clamp_float(-matrix.m20, -1, 1));
|
||||
if (MathHelper.abs(matrix.m20) < 0.99999) {
|
||||
eulerZyx.x = (float) Math.atan2(matrix.m21, matrix.m22);
|
||||
eulerZyx.z = (float) Math.atan2(matrix.m10, matrix.m00);
|
||||
} else {
|
||||
eulerZyx.x = 0.0F;
|
||||
eulerZyx.z = (float) Math.atan2(-matrix.m01, matrix.m11);
|
||||
}
|
||||
return eulerZyx;
|
||||
}
|
||||
|
||||
private void setRotationWithEulerYzx(ModelRenderer model, float x, float y, float z) {
|
||||
Vector3f eulerYzx = new Vector3f(x, y, z);
|
||||
Vector3f eulerZyx = ConvertEulerYzxToZyx(eulerYzx);
|
||||
model.rotateAngleX = eulerZyx.x;
|
||||
model.rotateAngleY = eulerZyx.y;
|
||||
model.rotateAngleZ = eulerZyx.z;
|
||||
}
|
||||
this.iceGiantLeftArm = (new ModelRenderer(this)).setTextureSize(short1, short2);
|
||||
this.iceGiantLeftArm.setRotationPoint(0.0F, -7.0F, 0.0F);
|
||||
this.iceGiantLeftArm.setTextureOffset(60, 58).addBox(9.0F, -2.5F, -3.0F, 4, 30, 6, par1);
|
||||
|
||||
this.iceGiantLeftLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);
|
||||
this.iceGiantLeftLeg.setRotationPoint(-4.0F, 18.0F + par2, 0.0F);
|
||||
this.iceGiantLeftLeg.setTextureOffset(37, 0).addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);
|
||||
|
||||
this.iceGiantRightLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(short1, short2);
|
||||
this.iceGiantRightLeg.mirror = true;
|
||||
this.iceGiantRightLeg.setTextureOffset(60, 0).setRotationPoint(5.0F, 18.0F + par2, 0.0F);
|
||||
this.iceGiantRightLeg.addBox(-3.5F, -3.0F, -3.0F, 6, 16, 5, par1);
|
||||
|
||||
headSpike1 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike1.addBox(-4F, -4F, 0F, 4, 4, 4);
|
||||
headSpike1.setRotationPoint(-4F, -10F, -5F);
|
||||
headSpike1.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike1, -0.1047198F, -0.5235988F, 0.9599311F);
|
||||
|
||||
headSpike2 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike2.addBox(0F, -4F, 0F, 4, 4, 4);
|
||||
headSpike2.setRotationPoint(4F, -16F, 0F);
|
||||
headSpike2.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike2, 0.5585054F, 0.9250245F, -0.5235988F);
|
||||
|
||||
headSpike3 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike3.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
headSpike3.setRotationPoint(4F, -13F, 4F);
|
||||
headSpike3.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike3, 0.7853982F, -1.396263F, 0.7853982F);
|
||||
|
||||
headSpike4 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike4.addBox(-4F, -4F, 0F, 4, 4, 4);
|
||||
headSpike4.setRotationPoint(-4F, -16F, 0F);
|
||||
headSpike4.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike4, 0.5585054F, -0.9250245F, 0.5235988F);
|
||||
|
||||
headSpike5 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike5.addBox(0F, -4F, 0F, 4, 4, 4);
|
||||
headSpike5.setRotationPoint(4F, -10F, -5F);
|
||||
headSpike5.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike5, 0.5235988F, -0.9599311F, 0.1047198F);
|
||||
|
||||
rightArmSpike1 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
rightArmSpike1.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
rightArmSpike1.setRotationPoint(-11F, -8F, 0F);
|
||||
rightArmSpike1.mirror = true;
|
||||
setRotationWithEulerYzx(rightArmSpike1, 0.7853982F, 1.134464F, 0.9599311F);
|
||||
|
||||
headSpike6 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike6.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
headSpike6.setRotationPoint(-4F, -13F, 4F);
|
||||
headSpike6.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike6, 0.7853982F, -1.745329F, 0.7853982F);
|
||||
|
||||
leftArmSpike1 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
leftArmSpike1.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
leftArmSpike1.setRotationPoint(11F, -8F, 0F);
|
||||
leftArmSpike1.mirror = true;
|
||||
setRotationWithEulerYzx(leftArmSpike1, 0.7853982F, -1.134464F, -0.9599311F);
|
||||
|
||||
leftArmSpike2 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
leftArmSpike2.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
leftArmSpike2.setRotationPoint(12F, -4F, 0F);
|
||||
leftArmSpike2.mirror = true;
|
||||
setRotationWithEulerYzx(leftArmSpike2, 0.7853982F, 0F, -0.9599311F);
|
||||
|
||||
bodySpike1 = new ModelRenderer(this, 32, 69).setTextureSize(short1, short2);
|
||||
bodySpike1.addBox(-3F, -3F, -3F, 6, 6, 6);
|
||||
bodySpike1.setRotationPoint(-4F, -4F, 3F);
|
||||
bodySpike1.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike1, 0.2808018F, 0.8096675F, 0.8339369F);
|
||||
|
||||
rightArmSpike2 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
rightArmSpike2.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
rightArmSpike2.setRotationPoint(-12F, -4F, 0F);
|
||||
rightArmSpike2.mirror = true;
|
||||
setRotationWithEulerYzx(rightArmSpike2, 0.7853982F, 0F, 0.9599311F);
|
||||
|
||||
bodySpike2 = new ModelRenderer(this, 32, 69).setTextureSize(short1, short2);
|
||||
bodySpike2.addBox(-3F, -3F, -3F, 6, 6, 6);
|
||||
bodySpike2.setRotationPoint(4F, -4F, 3F);
|
||||
bodySpike2.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike2, 0.2808018F, -0.8096757F, -0.8339358F);
|
||||
|
||||
bodySpike3 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
bodySpike3.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
bodySpike3.setRotationPoint(6F, -2F, -5F);
|
||||
bodySpike3.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike3, 1.120006F, -1.347726F, -0.8969422F);
|
||||
|
||||
bodySpike4 = new ModelRenderer(this, 32, 69).setTextureSize(short1, short2);
|
||||
bodySpike4.addBox(-3F, -3F, -3F, 6, 6, 6);
|
||||
bodySpike4.setRotationPoint(0F, -4F, -4F);
|
||||
bodySpike4.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike4, 0.7853982F, -1.570796F, 0.9599311F);
|
||||
|
||||
headSpike7 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
headSpike7.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
headSpike7.setRotationPoint(0F, -20F, 4F);
|
||||
headSpike7.mirror = true;
|
||||
setRotationWithEulerYzx(headSpike7, 0.7853982F, 1.570796F, 0.7853982F);
|
||||
|
||||
bodySpike5 = new ModelRenderer(this, 0, 0).setTextureSize(short1, short2);
|
||||
bodySpike5.addBox(-2F, -2F, -2F, 4, 4, 4);
|
||||
bodySpike5.setRotationPoint(-6F, -2F, -5F);
|
||||
bodySpike5.mirror = true;
|
||||
setRotationWithEulerYzx(bodySpike5, 1.120006F, 1.347725F, 0.896934F);
|
||||
|
||||
this.convertToChild(this.iceGiantHead, headSpike1);
|
||||
this.convertToChild(this.iceGiantHead, headSpike2);
|
||||
this.convertToChild(this.iceGiantHead, headSpike3);
|
||||
this.convertToChild(this.iceGiantHead, headSpike4);
|
||||
this.convertToChild(this.iceGiantHead, headSpike5);
|
||||
this.convertToChild(this.iceGiantHead, headSpike6);
|
||||
this.convertToChild(this.iceGiantHead, headSpike7);
|
||||
this.convertToChild(this.iceGiantRightArm, rightArmSpike1);
|
||||
this.convertToChild(this.iceGiantRightArm, rightArmSpike2);
|
||||
this.convertToChild(this.iceGiantLeftArm, leftArmSpike1);
|
||||
this.convertToChild(this.iceGiantLeftArm, leftArmSpike2);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike1);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike2);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike3);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike4);
|
||||
this.convertToChild(this.iceGiantBody, bodySpike5);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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){
|
||||
this.setRotationAngles(par2, par3, par4, par5, par6, par7, par1Entity);
|
||||
this.iceGiantHead.render(par7);
|
||||
this.iceGiantBody.render(par7);
|
||||
this.iceGiantLeftLeg.render(par7);
|
||||
this.iceGiantRightLeg.render(par7);
|
||||
this.iceGiantRightArm.render(par7);
|
||||
this.iceGiantLeftArm.render(par7);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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){
|
||||
this.iceGiantHead.rotateAngleY = par4 / (180F / (float)Math.PI);
|
||||
this.iceGiantHead.rotateAngleX = par5 / (180F / (float)Math.PI);
|
||||
this.iceGiantLeftLeg.rotateAngleX = -1.5F * this.func_78172_a(par1, 13.0F) * par2;
|
||||
this.iceGiantRightLeg.rotateAngleX = 1.5F * this.func_78172_a(par1, 13.0F) * par2;
|
||||
this.iceGiantLeftLeg.rotateAngleY = 0.0F;
|
||||
this.iceGiantRightLeg.rotateAngleY = 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){
|
||||
EntityIceGiant entityicegiant = (EntityIceGiant)par1EntityLivingBase;
|
||||
int i = entityicegiant.getAttackTimer();
|
||||
|
||||
if(i > 0){
|
||||
this.iceGiantRightArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);
|
||||
this.iceGiantLeftArm.rotateAngleX = -2.0F + 1.5F * this.func_78172_a((float)i - par4, 10.0F);
|
||||
}else{
|
||||
this.iceGiantRightArm.rotateAngleX = (-0.2F + 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
|
||||
this.iceGiantLeftArm.rotateAngleX = (-0.2F - 1.5F * this.func_78172_a(par2, 13.0F)) * par3;
|
||||
}
|
||||
}
|
||||
|
||||
private float func_78172_a(float par1, float par2){
|
||||
return (Math.abs(par1 % par2 - par2 * 0.5F) - par2 * 0.25F) / (par2 * 0.25F);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is really useful for converting the source from a Techne model export which will have absolute rotation
|
||||
* points that need to be converted before creating the addChild() relationship. [Courtesy of jabelar]
|
||||
*/
|
||||
protected void convertToChild(ModelRenderer parent, ModelRenderer child){
|
||||
// move child rotation point to be relative to parent
|
||||
child.rotationPointX -= parent.rotationPointX;
|
||||
child.rotationPointY -= parent.rotationPointY;
|
||||
child.rotationPointZ -= parent.rotationPointZ;
|
||||
// make rotations relative to parent
|
||||
child.rotateAngleX -= parent.rotateAngleX;
|
||||
child.rotateAngleY -= parent.rotateAngleY;
|
||||
child.rotateAngleZ -= parent.rotateAngleZ;
|
||||
// create relationship
|
||||
parent.addChild(child);
|
||||
}
|
||||
|
||||
/** Fixes the Techne rotation order bug. [Courtesy of tprk77] */
|
||||
private Vector3f ConvertEulerYzxToZyx(Vector3f eulerYzx){
|
||||
// Create a matrix from YZX ordered Euler angles
|
||||
float a = MathHelper.cos(eulerYzx.x);
|
||||
float b = MathHelper.sin(eulerYzx.x);
|
||||
float c = MathHelper.cos(eulerYzx.y);
|
||||
float d = MathHelper.sin(eulerYzx.y);
|
||||
float e = MathHelper.cos(eulerYzx.z);
|
||||
float f = MathHelper.sin(eulerYzx.z);
|
||||
Matrix4f matrix = new Matrix4f();
|
||||
matrix.m00 = c * e;
|
||||
matrix.m01 = b * d - a * c * f;
|
||||
matrix.m02 = b * c * f + a * d;
|
||||
matrix.m10 = f;
|
||||
matrix.m11 = a * e;
|
||||
matrix.m12 = -b * e;
|
||||
matrix.m20 = -d * e;
|
||||
matrix.m21 = a * d * f + b * c;
|
||||
matrix.m22 = a * c - b * d * f;
|
||||
matrix.m33 = 1.0F;
|
||||
// Create ZYX ordered Euler angles from the matrix
|
||||
Vector3f eulerZyx = new Vector3f();
|
||||
eulerZyx.y = (float)Math.asin(MathHelper.clamp(-matrix.m20, -1, 1));
|
||||
if(MathHelper.abs(matrix.m20) < 0.99999){
|
||||
eulerZyx.x = (float)Math.atan2(matrix.m21, matrix.m22);
|
||||
eulerZyx.z = (float)Math.atan2(matrix.m10, matrix.m00);
|
||||
}else{
|
||||
eulerZyx.x = 0.0F;
|
||||
eulerZyx.z = (float)Math.atan2(-matrix.m01, matrix.m11);
|
||||
}
|
||||
return eulerZyx;
|
||||
}
|
||||
|
||||
private void setRotationWithEulerYzx(ModelRenderer model, float x, float y, float z){
|
||||
Vector3f eulerYzx = new Vector3f(x, y, z);
|
||||
Vector3f eulerZyx = ConvertEulerYzxToZyx(eulerYzx);
|
||||
model.rotateAngleX = eulerZyx.x;
|
||||
model.rotateAngleY = eulerZyx.y;
|
||||
model.rotateAngleZ = eulerZyx.z;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,134 +6,126 @@ import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ModelPhoenix extends ModelBase {
|
||||
|
||||
ModelRenderer body;
|
||||
ModelRenderer rightWing;
|
||||
ModelRenderer leftWing;
|
||||
ModelRenderer tailFeathers;
|
||||
ModelRenderer tail;
|
||||
ModelRenderer head;
|
||||
ModelRenderer neck;
|
||||
ModelRenderer beak;
|
||||
ModelRenderer plume;
|
||||
|
||||
public ModelPhoenix()
|
||||
{
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
/* For future reference:
|
||||
* - setRotationPoint sets the origin of a part relative to that of its parent.
|
||||
* - The first 3 arguments of addBox set the position of a part relative to its rotation point, and the last
|
||||
* 3 arguments are the size of the part.
|
||||
* (This means that rotation point and position seem to be the wrong way round, since changing the rotation point
|
||||
* will move the component without changing which point on the component it rotates about.)
|
||||
* - The two integer arguments in the ModelRenderer constructor are the texture offset.
|
||||
* - Mirror does nothing unless you set it before addBox.
|
||||
* - Rotation is the usual pitch, yaw, roll.
|
||||
*/
|
||||
|
||||
body = new ModelRenderer(this, 0, 34);
|
||||
body.addBox(0F, 0F, -3F, 6, 15, 6);
|
||||
body.setRotationPoint(-3F, 0F, -5F);
|
||||
body.setTextureSize(64, 64);
|
||||
body.mirror = true;
|
||||
setRotation(body, 0.296706F, 0F, 0F);
|
||||
|
||||
rightWing = new ModelRenderer(this, 0, 0);
|
||||
rightWing.mirror = true;
|
||||
rightWing.addBox(-27F, -27F, 0F, 27, 34, 0);
|
||||
rightWing.setRotationPoint(0F, 5F, 0F);
|
||||
rightWing.setTextureSize(64, 64);
|
||||
setRotation(rightWing, 0.1745329F, 0F, 0F);
|
||||
|
||||
leftWing = new ModelRenderer(this, 0, 0);
|
||||
leftWing.addBox(0F, -27F, 0F, 27, 34, 0);
|
||||
leftWing.setRotationPoint(6F, 5F, 0F);
|
||||
leftWing.setTextureSize(64, 64);
|
||||
setRotation(leftWing, 0.1745329F, 0F, 0F);
|
||||
|
||||
tailFeathers = new ModelRenderer(this, 0, 57);
|
||||
tailFeathers.addBox(-5F, 0F, 0F, 10, 7, 0);
|
||||
tailFeathers.setRotationPoint(0F, 7F, 1F);
|
||||
tailFeathers.setTextureSize(64, 64);
|
||||
tailFeathers.mirror = true;
|
||||
setRotation(tailFeathers, 0.5235988F, 0F, 0F);
|
||||
|
||||
tail = new ModelRenderer(this, 20, 55);
|
||||
tail.addBox(-1F, 0F, -1F, 2, 7, 2);
|
||||
tail.setRotationPoint(3F, 15F, 2F);
|
||||
tail.setTextureSize(64, 64);
|
||||
tail.mirror = true;
|
||||
setRotation(tail, 0.4014257F, 0F, 0F);
|
||||
|
||||
head = new ModelRenderer(this, 24, 34);
|
||||
head.addBox(-2F, -4F, -5F, 4, 4, 6);
|
||||
head.setRotationPoint(0F, -4F, 0F);
|
||||
head.setTextureSize(64, 64);
|
||||
head.mirror = true;
|
||||
setRotation(head, 0F, 0F, 0F);
|
||||
|
||||
neck = new ModelRenderer(this, 24, 44);
|
||||
neck.addBox(-1F, -4F, -1F, 2, 4, 2);
|
||||
neck.setRotationPoint(0F, 0F, -4F);
|
||||
neck.setTextureSize(64, 64);
|
||||
neck.mirror = true;
|
||||
setRotation(neck, 0.2443461F, 0F, 0F);
|
||||
|
||||
beak = new ModelRenderer(this, 32, 44);
|
||||
beak.addBox(-0.5F, 4F, -1F, 1, 2, 3);
|
||||
beak.setRotationPoint(0F, -5F, -8F);
|
||||
beak.setTextureSize(64, 64);
|
||||
beak.mirror = true;
|
||||
setRotation(beak, 0.2792527F, 0F, 0F);
|
||||
|
||||
plume = new ModelRenderer(this, 28, 50);
|
||||
plume.addBox(-0.03333334F, 1F, 0F, 0, 5, 5);
|
||||
plume.setRotationPoint(0F, -7F, 0F);
|
||||
plume.setTextureSize(64, 64);
|
||||
plume.mirror = true;
|
||||
setRotation(plume, 0F, 0F, 0F);
|
||||
|
||||
neck.addChild(head);
|
||||
head.addChild(plume);
|
||||
head.addChild(beak);
|
||||
tail.addChild(tailFeathers);
|
||||
body.addChild(tail);
|
||||
body.addChild(rightWing);
|
||||
body.addChild(leftWing);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
//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;
|
||||
this.body.rotateAngleX = 0.3f + MathHelper.cos(f2 * 0.1F) * 0.15F;
|
||||
this.body.rotateAngleY = 0.0F;
|
||||
this.tail.rotateAngleX = this.body.rotateAngleX * 1.1f;
|
||||
this.tailFeathers.rotateAngleX = this.body.rotateAngleX * 1.2f;
|
||||
this.rightWing.rotateAngleY = MathHelper.cos(f2 * 0.3F) * (float)Math.PI * 0.15F;
|
||||
this.leftWing.rotateAngleY = -this.rightWing.rotateAngleY;
|
||||
|
||||
body.render(f5);
|
||||
neck.render(f5);
|
||||
}
|
||||
|
||||
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 body;
|
||||
ModelRenderer rightWing;
|
||||
ModelRenderer leftWing;
|
||||
ModelRenderer tailFeathers;
|
||||
ModelRenderer tail;
|
||||
ModelRenderer head;
|
||||
ModelRenderer neck;
|
||||
ModelRenderer beak;
|
||||
ModelRenderer plume;
|
||||
|
||||
public ModelPhoenix(){
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
/* For future reference: - setRotationPoint sets the origin of a part relative to that of its parent. - The
|
||||
* first 3 arguments of addBox set the position of a part relative to its rotation point, and the last 3
|
||||
* arguments are the size of the part. (This means that rotation point and position seem to be the wrong way
|
||||
* round, since changing the rotation point will move the component without changing which point on the
|
||||
* component it rotates about.) - The two integer arguments in the ModelRenderer constructor are the texture
|
||||
* offset. - Mirror does nothing unless you set it before addBox. - Rotation is the usual pitch, yaw, roll. */
|
||||
|
||||
body = new ModelRenderer(this, 0, 34);
|
||||
body.addBox(0F, 0F, -3F, 6, 15, 6);
|
||||
body.setRotationPoint(-3F, 0F, -5F);
|
||||
body.setTextureSize(64, 64);
|
||||
body.mirror = true;
|
||||
setRotation(body, 0.296706F, 0F, 0F);
|
||||
|
||||
rightWing = new ModelRenderer(this, 0, 0);
|
||||
rightWing.mirror = true;
|
||||
rightWing.addBox(-27F, -27F, 0F, 27, 34, 0);
|
||||
rightWing.setRotationPoint(0F, 5F, 0F);
|
||||
rightWing.setTextureSize(64, 64);
|
||||
setRotation(rightWing, 0.1745329F, 0F, 0F);
|
||||
|
||||
leftWing = new ModelRenderer(this, 0, 0);
|
||||
leftWing.addBox(0F, -27F, 0F, 27, 34, 0);
|
||||
leftWing.setRotationPoint(6F, 5F, 0F);
|
||||
leftWing.setTextureSize(64, 64);
|
||||
setRotation(leftWing, 0.1745329F, 0F, 0F);
|
||||
|
||||
tailFeathers = new ModelRenderer(this, 0, 57);
|
||||
tailFeathers.addBox(-5F, 0F, 0F, 10, 7, 0);
|
||||
tailFeathers.setRotationPoint(0F, 7F, 1F);
|
||||
tailFeathers.setTextureSize(64, 64);
|
||||
tailFeathers.mirror = true;
|
||||
setRotation(tailFeathers, 0.5235988F, 0F, 0F);
|
||||
|
||||
tail = new ModelRenderer(this, 20, 55);
|
||||
tail.addBox(-1F, 0F, -1F, 2, 7, 2);
|
||||
tail.setRotationPoint(3F, 15F, 2F);
|
||||
tail.setTextureSize(64, 64);
|
||||
tail.mirror = true;
|
||||
setRotation(tail, 0.4014257F, 0F, 0F);
|
||||
|
||||
head = new ModelRenderer(this, 24, 34);
|
||||
head.addBox(-2F, -4F, -5F, 4, 4, 6);
|
||||
head.setRotationPoint(0F, -4F, 0F);
|
||||
head.setTextureSize(64, 64);
|
||||
head.mirror = true;
|
||||
setRotation(head, 0F, 0F, 0F);
|
||||
|
||||
neck = new ModelRenderer(this, 24, 44);
|
||||
neck.addBox(-1F, -4F, -1F, 2, 4, 2);
|
||||
neck.setRotationPoint(0F, 0F, -4F);
|
||||
neck.setTextureSize(64, 64);
|
||||
neck.mirror = true;
|
||||
setRotation(neck, 0.2443461F, 0F, 0F);
|
||||
|
||||
beak = new ModelRenderer(this, 32, 44);
|
||||
beak.addBox(-0.5F, 4F, -1F, 1, 2, 3);
|
||||
beak.setRotationPoint(0F, -5F, -8F);
|
||||
beak.setTextureSize(64, 64);
|
||||
beak.mirror = true;
|
||||
setRotation(beak, 0.2792527F, 0F, 0F);
|
||||
|
||||
plume = new ModelRenderer(this, 28, 50);
|
||||
plume.addBox(-0.03333334F, 1F, 0F, 0, 5, 5);
|
||||
plume.setRotationPoint(0F, -7F, 0F);
|
||||
plume.setTextureSize(64, 64);
|
||||
plume.mirror = true;
|
||||
setRotation(plume, 0F, 0F, 0F);
|
||||
|
||||
neck.addChild(head);
|
||||
head.addChild(plume);
|
||||
head.addChild(beak);
|
||||
tail.addChild(tailFeathers);
|
||||
body.addChild(tail);
|
||||
body.addChild(rightWing);
|
||||
body.addChild(leftWing);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// 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;
|
||||
this.body.rotateAngleX = 0.3f + MathHelper.cos(f2 * 0.1F) * 0.15F;
|
||||
this.body.rotateAngleY = 0.0F;
|
||||
this.tail.rotateAngleX = this.body.rotateAngleX * 1.1f;
|
||||
this.tailFeathers.rotateAngleX = this.body.rotateAngleX * 1.2f;
|
||||
this.rightWing.rotateAngleY = MathHelper.cos(f2 * 0.3F) * (float)Math.PI * 0.15F;
|
||||
this.leftWing.rotateAngleY = -this.rightWing.rotateAngleY;
|
||||
|
||||
body.render(f5);
|
||||
neck.render(f5);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,172 +3,127 @@ package electroblob.wizardry.client.model;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
|
||||
public class ModelWizard extends ModelBiped
|
||||
{
|
||||
//fields
|
||||
ModelRenderer Shape5;
|
||||
ModelRenderer Shape8;
|
||||
ModelRenderer Shape9;
|
||||
ModelRenderer Shape10;
|
||||
ModelRenderer Shape7;
|
||||
ModelRenderer Shape11;
|
||||
ModelRenderer Shape12;
|
||||
ModelRenderer beard;
|
||||
ModelRenderer Shape13;
|
||||
|
||||
public ModelWizard()
|
||||
{
|
||||
//super(0, 0, 64, 32);
|
||||
/*
|
||||
bipedRightLeg = new ModelRenderer(this, 32, 0); // 32 and 0 are the x and y texture offsets respectively.
|
||||
bipedRightLeg.addBox(-2F, 0F, -2F, 4, 12, 4); // x, y, z, u, v, w.
|
||||
bipedRightLeg.setRotationPoint(-2F, 12F, 0F); // Rotation point xyz (absolute, not relative)
|
||||
bipedRightLeg.setTextureSize(64, 64);
|
||||
bipedRightLeg.mirror = true;
|
||||
setRotation(bipedRightLeg, 0F, 0F, 0F);
|
||||
|
||||
bipedLeftLeg.mirror = true;
|
||||
bipedLeftLeg = new ModelRenderer(this, 32, 0);
|
||||
bipedLeftLeg.addBox(-2F, 0F, -2F, 4, 12, 4);
|
||||
bipedLeftLeg.setRotationPoint(2F, 12F, 0F);
|
||||
bipedLeftLeg.setTextureSize(64, 64);
|
||||
bipedLeftLeg.mirror = true;
|
||||
setRotation(bipedLeftLeg, 0F, 0F, 0F);
|
||||
bipedLeftLeg.mirror = false;
|
||||
|
||||
bipedBody = new ModelRenderer(this, 0, 16);
|
||||
bipedBody.addBox(0F, 0F, 0F, 8, 12, 4);
|
||||
bipedBody.setRotationPoint(-4F, 0F, -2F);
|
||||
bipedBody.setTextureSize(64, 64);
|
||||
bipedBody.mirror = true;
|
||||
setRotation(bipedBody, 0F, 0F, 0F);
|
||||
|
||||
bipedLeftArm.mirror = true;
|
||||
bipedLeftArm = new ModelRenderer(this, 48, 0);
|
||||
bipedLeftArm.addBox(-1F, 0F, -2F, 4, 12, 4);
|
||||
bipedLeftArm.setRotationPoint(4F, 0F, 0F);
|
||||
bipedLeftArm.setTextureSize(64, 64);
|
||||
bipedLeftArm.mirror = true;
|
||||
setRotation(bipedLeftArm, 0F, 0F, 0F);
|
||||
bipedLeftArm.mirror = false;
|
||||
|
||||
bipedRightArm = new ModelRenderer(this, 48, 0);
|
||||
bipedRightArm.addBox(-3F, 0F, -2F, 4, 12, 4);
|
||||
bipedRightArm.setRotationPoint(-4F, 0F, 0F);
|
||||
bipedRightArm.setTextureSize(64, 64);
|
||||
bipedRightArm.mirror = true;
|
||||
setRotation(bipedRightArm, 0F, 0F, 0F);
|
||||
|
||||
bipedHead = new ModelRenderer(this, 0, 0);
|
||||
bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8);
|
||||
bipedHead.setRotationPoint(0F, 0F, 0F);
|
||||
bipedHead.setTextureSize(64, 64);
|
||||
bipedHead.mirror = true;
|
||||
setRotation(bipedHead, 0F, 0F, 0F);
|
||||
*/
|
||||
Shape5 = new ModelRenderer(this, 0, 51);
|
||||
Shape5.addBox(0F, 0F, 0F, 12, 1, 12);
|
||||
Shape5.setRotationPoint(-6F, -7F, -6F);
|
||||
Shape5.setTextureSize(64, 64);
|
||||
Shape5.mirror = true;
|
||||
setRotation(Shape5, 0F, 0F, 0F);
|
||||
Shape8 = new ModelRenderer(this, 0, 32);
|
||||
Shape8.addBox(0F, 0F, 0F, 6, 1, 6);
|
||||
Shape8.setRotationPoint(-3F, -9F, -3F);
|
||||
Shape8.setTextureSize(64, 64);
|
||||
Shape8.mirror = true;
|
||||
setRotation(Shape8, -0.0349066F, 0F, 0F);
|
||||
Shape9 = new ModelRenderer(this, 24, 32);
|
||||
Shape9.addBox(0F, 0F, 0F, 3, 3, 3);
|
||||
Shape9.setRotationPoint(-1.5F, -13F, -0.5F);
|
||||
Shape9.setTextureSize(64, 64);
|
||||
Shape9.mirror = true;
|
||||
setRotation(Shape9, -0.2511622F, 0F, 0F);
|
||||
Shape10 = new ModelRenderer(this, 0, 39);
|
||||
Shape10.addBox(0F, 0F, 0F, 5, 1, 5);
|
||||
Shape10.setRotationPoint(-2.5F, -10F, -2.5F);
|
||||
Shape10.setTextureSize(64, 64);
|
||||
Shape10.mirror = true;
|
||||
setRotation(Shape10, -0.0698132F, 0F, 0F);
|
||||
Shape7 = new ModelRenderer(this, 0, 45);
|
||||
Shape7.addBox(0F, 0F, 0F, 4, 2, 4);
|
||||
Shape7.setRotationPoint(-2F, -11F, -1.5F);
|
||||
Shape7.setTextureSize(64, 64);
|
||||
Shape7.mirror = true;
|
||||
setRotation(Shape7, -0.1396263F, 0F, 0F);
|
||||
Shape11 = new ModelRenderer(this, 20, 39);
|
||||
Shape11.addBox(0F, 0F, 0F, 2, 3, 2);
|
||||
Shape11.setRotationPoint(-1F, -15F, 1F);
|
||||
Shape11.setTextureSize(64, 64);
|
||||
Shape11.mirror = true;
|
||||
setRotation(Shape11, -0.4363323F, 0F, 0F);
|
||||
Shape12 = new ModelRenderer(this, 28, 39);
|
||||
Shape12.addBox(0F, 0F, 0F, 1, 2, 1);
|
||||
Shape12.setRotationPoint(-0.5F, -16F, 2.5F);
|
||||
Shape12.setTextureSize(64, 64);
|
||||
Shape12.mirror = true;
|
||||
setRotation(Shape12, -0.715585F, 0F, 0F);
|
||||
beard = new ModelRenderer(this, 32, 0);
|
||||
beard.addBox(0F, 0F, 0F, 8, 5, 0);
|
||||
beard.setRotationPoint(-4F, 0F, -4F);
|
||||
beard.setTextureSize(64, 64);
|
||||
beard.mirror = true;
|
||||
setRotation(beard, 0F, 0F, 0F);
|
||||
Shape13 = new ModelRenderer(this, 36, 16);
|
||||
Shape13.addBox(4F, 0F, 2F, 8, 20, 6);
|
||||
Shape13.setRotationPoint(-4F, 0F, -3F);
|
||||
Shape13.setTextureSize(64, 64);
|
||||
Shape13.mirror = true;
|
||||
setRotation(Shape13, 0F, 0F, 0F);
|
||||
|
||||
// Makes head bits move with head
|
||||
//bipedHead.addChild(Shape5);
|
||||
bipedHead.addChild(beard);
|
||||
//bipedHead.addChild(Shape7);
|
||||
//bipedHead.addChild(Shape8);
|
||||
//bipedHead.addChild(Shape9);
|
||||
//bipedHead.addChild(Shape10);
|
||||
//bipedHead.addChild(Shape11);
|
||||
//bipedHead.addChild(Shape12);
|
||||
|
||||
// Makes cloak attached to body
|
||||
//bipedBody.addChild(Shape13);
|
||||
|
||||
// No outer head layer
|
||||
this.bipedHeadwear.isHidden = true;
|
||||
}
|
||||
/*
|
||||
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);
|
||||
bipedRightLeg.render(f5);
|
||||
bipedLeftLeg.render(f5);
|
||||
bipedBody.render(f5);
|
||||
bipedLeftArm.render(f5);
|
||||
bipedRightArm.render(f5);
|
||||
bipedHead.render(f5);
|
||||
Shape5.render(f5);
|
||||
Shape8.render(f5);
|
||||
Shape9.render(f5);
|
||||
Shape10.render(f5);
|
||||
Shape7.render(f5);
|
||||
Shape11.render(f5);
|
||||
Shape12.render(f5);
|
||||
Shape6.render(f5);
|
||||
Shape13.render(f5);
|
||||
}
|
||||
*/
|
||||
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);
|
||||
}
|
||||
*/
|
||||
public class ModelWizard extends ModelBiped {
|
||||
// fields
|
||||
ModelRenderer Shape5;
|
||||
ModelRenderer Shape8;
|
||||
ModelRenderer Shape9;
|
||||
ModelRenderer Shape10;
|
||||
ModelRenderer Shape7;
|
||||
ModelRenderer Shape11;
|
||||
ModelRenderer Shape12;
|
||||
ModelRenderer beard;
|
||||
ModelRenderer Shape13;
|
||||
|
||||
public ModelWizard(){
|
||||
// super(0, 0, 64, 32);
|
||||
/* bipedRightLeg = new ModelRenderer(this, 32, 0); // 32 and 0 are the x and y texture offsets respectively.
|
||||
* bipedRightLeg.addBox(-2F, 0F, -2F, 4, 12, 4); // x, y, z, u, v, w. bipedRightLeg.setRotationPoint(-2F, 12F,
|
||||
* 0F); // Rotation point xyz (absolute, not relative) bipedRightLeg.setTextureSize(64, 64);
|
||||
* bipedRightLeg.mirror = true; setRotation(bipedRightLeg, 0F, 0F, 0F);
|
||||
*
|
||||
* bipedLeftLeg.mirror = true; bipedLeftLeg = new ModelRenderer(this, 32, 0); bipedLeftLeg.addBox(-2F, 0F, -2F,
|
||||
* 4, 12, 4); bipedLeftLeg.setRotationPoint(2F, 12F, 0F); bipedLeftLeg.setTextureSize(64, 64);
|
||||
* bipedLeftLeg.mirror = true; setRotation(bipedLeftLeg, 0F, 0F, 0F); bipedLeftLeg.mirror = false;
|
||||
*
|
||||
* bipedBody = new ModelRenderer(this, 0, 16); bipedBody.addBox(0F, 0F, 0F, 8, 12, 4);
|
||||
* bipedBody.setRotationPoint(-4F, 0F, -2F); bipedBody.setTextureSize(64, 64); bipedBody.mirror = true;
|
||||
* setRotation(bipedBody, 0F, 0F, 0F);
|
||||
*
|
||||
* bipedLeftArm.mirror = true; bipedLeftArm = new ModelRenderer(this, 48, 0); bipedLeftArm.addBox(-1F, 0F, -2F,
|
||||
* 4, 12, 4); bipedLeftArm.setRotationPoint(4F, 0F, 0F); bipedLeftArm.setTextureSize(64, 64);
|
||||
* bipedLeftArm.mirror = true; setRotation(bipedLeftArm, 0F, 0F, 0F); bipedLeftArm.mirror = false;
|
||||
*
|
||||
* bipedRightArm = new ModelRenderer(this, 48, 0); bipedRightArm.addBox(-3F, 0F, -2F, 4, 12, 4);
|
||||
* bipedRightArm.setRotationPoint(-4F, 0F, 0F); bipedRightArm.setTextureSize(64, 64); bipedRightArm.mirror =
|
||||
* true; setRotation(bipedRightArm, 0F, 0F, 0F);
|
||||
*
|
||||
* bipedHead = new ModelRenderer(this, 0, 0); bipedHead.addBox(-4F, -8F, -4F, 8, 8, 8);
|
||||
* bipedHead.setRotationPoint(0F, 0F, 0F); bipedHead.setTextureSize(64, 64); bipedHead.mirror = true;
|
||||
* setRotation(bipedHead, 0F, 0F, 0F); */
|
||||
Shape5 = new ModelRenderer(this, 0, 51);
|
||||
Shape5.addBox(0F, 0F, 0F, 12, 1, 12);
|
||||
Shape5.setRotationPoint(-6F, -7F, -6F);
|
||||
Shape5.setTextureSize(64, 64);
|
||||
Shape5.mirror = true;
|
||||
setRotation(Shape5, 0F, 0F, 0F);
|
||||
Shape8 = new ModelRenderer(this, 0, 32);
|
||||
Shape8.addBox(0F, 0F, 0F, 6, 1, 6);
|
||||
Shape8.setRotationPoint(-3F, -9F, -3F);
|
||||
Shape8.setTextureSize(64, 64);
|
||||
Shape8.mirror = true;
|
||||
setRotation(Shape8, -0.0349066F, 0F, 0F);
|
||||
Shape9 = new ModelRenderer(this, 24, 32);
|
||||
Shape9.addBox(0F, 0F, 0F, 3, 3, 3);
|
||||
Shape9.setRotationPoint(-1.5F, -13F, -0.5F);
|
||||
Shape9.setTextureSize(64, 64);
|
||||
Shape9.mirror = true;
|
||||
setRotation(Shape9, -0.2511622F, 0F, 0F);
|
||||
Shape10 = new ModelRenderer(this, 0, 39);
|
||||
Shape10.addBox(0F, 0F, 0F, 5, 1, 5);
|
||||
Shape10.setRotationPoint(-2.5F, -10F, -2.5F);
|
||||
Shape10.setTextureSize(64, 64);
|
||||
Shape10.mirror = true;
|
||||
setRotation(Shape10, -0.0698132F, 0F, 0F);
|
||||
Shape7 = new ModelRenderer(this, 0, 45);
|
||||
Shape7.addBox(0F, 0F, 0F, 4, 2, 4);
|
||||
Shape7.setRotationPoint(-2F, -11F, -1.5F);
|
||||
Shape7.setTextureSize(64, 64);
|
||||
Shape7.mirror = true;
|
||||
setRotation(Shape7, -0.1396263F, 0F, 0F);
|
||||
Shape11 = new ModelRenderer(this, 20, 39);
|
||||
Shape11.addBox(0F, 0F, 0F, 2, 3, 2);
|
||||
Shape11.setRotationPoint(-1F, -15F, 1F);
|
||||
Shape11.setTextureSize(64, 64);
|
||||
Shape11.mirror = true;
|
||||
setRotation(Shape11, -0.4363323F, 0F, 0F);
|
||||
Shape12 = new ModelRenderer(this, 28, 39);
|
||||
Shape12.addBox(0F, 0F, 0F, 1, 2, 1);
|
||||
Shape12.setRotationPoint(-0.5F, -16F, 2.5F);
|
||||
Shape12.setTextureSize(64, 64);
|
||||
Shape12.mirror = true;
|
||||
setRotation(Shape12, -0.715585F, 0F, 0F);
|
||||
beard = new ModelRenderer(this, 32, 0);
|
||||
beard.addBox(0F, 0F, 0F, 8, 5, 0);
|
||||
beard.setRotationPoint(-4F, 0F, -4F);
|
||||
beard.setTextureSize(64, 64);
|
||||
beard.mirror = true;
|
||||
setRotation(beard, 0F, 0F, 0F);
|
||||
Shape13 = new ModelRenderer(this, 36, 16);
|
||||
Shape13.addBox(4F, 0F, 2F, 8, 20, 6);
|
||||
Shape13.setRotationPoint(-4F, 0F, -3F);
|
||||
Shape13.setTextureSize(64, 64);
|
||||
Shape13.mirror = true;
|
||||
setRotation(Shape13, 0F, 0F, 0F);
|
||||
|
||||
// Makes head bits move with head
|
||||
// bipedHead.addChild(Shape5);
|
||||
bipedHead.addChild(beard);
|
||||
// bipedHead.addChild(Shape7);
|
||||
// bipedHead.addChild(Shape8);
|
||||
// bipedHead.addChild(Shape9);
|
||||
// bipedHead.addChild(Shape10);
|
||||
// bipedHead.addChild(Shape11);
|
||||
// bipedHead.addChild(Shape12);
|
||||
|
||||
// Makes cloak attached to body
|
||||
// bipedBody.addChild(Shape13);
|
||||
|
||||
// No outer head layer
|
||||
this.bipedHeadwear.isHidden = true;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
* bipedRightLeg.render(f5); bipedLeftLeg.render(f5); bipedBody.render(f5); bipedLeftArm.render(f5);
|
||||
* bipedRightArm.render(f5); bipedHead.render(f5); Shape5.render(f5); Shape8.render(f5); Shape9.render(f5);
|
||||
* Shape10.render(f5); Shape7.render(f5); Shape11.render(f5); Shape12.render(f5); Shape6.render(f5);
|
||||
* Shape13.render(f5); } */
|
||||
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); } */
|
||||
}
|
||||
|
||||
@@ -4,8 +4,7 @@ import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelWizardArmour extends ModelBiped
|
||||
{
|
||||
public class ModelWizardArmour extends ModelBiped {
|
||||
ModelRenderer Shape1;
|
||||
ModelRenderer Shape2;
|
||||
ModelRenderer Shape3;
|
||||
@@ -90,7 +89,7 @@ public class ModelWizardArmour extends ModelBiped
|
||||
bipedHead.addChild(Shape6);
|
||||
bipedHead.addChild(Shape7);
|
||||
// Makes the robe move with the body
|
||||
//bipedBody.addChild(robe);
|
||||
// bipedBody.addChild(robe);
|
||||
}
|
||||
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5){
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
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.minecraft.util.NonNullList;
|
||||
import net.minecraftforge.client.event.ModelRegistryEvent;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -18,6 +16,7 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* Class responsible for registering all of wizardry's item (and itemblock) models.
|
||||
*
|
||||
* @author Electroblob
|
||||
* @since Wizardry 2.1
|
||||
*/
|
||||
@@ -27,166 +26,173 @@ 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.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.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.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.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.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.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.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.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.spectral_sword);
|
||||
registerItemModel(WizardryItems.spectral_pickaxe);
|
||||
registerItemModel(WizardryItems.spectral_bow);
|
||||
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.mana_flask);
|
||||
registerItemModel(WizardryItems.spectral_sword);
|
||||
registerItemModel(WizardryItems.spectral_pickaxe);
|
||||
registerItemModel(WizardryItems.spectral_bow);
|
||||
|
||||
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.mana_flask);
|
||||
|
||||
registerItemModel(WizardryItems.flaming_axe);
|
||||
registerItemModel(WizardryItems.frost_axe);
|
||||
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.firebomb);
|
||||
registerItemModel(WizardryItems.poison_bomb);
|
||||
|
||||
registerItemModel(WizardryItems.blank_scroll);
|
||||
registerItemModel(WizardryItems.scroll);
|
||||
registerItemModel(WizardryItems.flaming_axe);
|
||||
registerItemModel(WizardryItems.frost_axe);
|
||||
|
||||
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.firebomb);
|
||||
registerItemModel(WizardryItems.poison_bomb);
|
||||
|
||||
registerItemModel(WizardryItems.wizard_hat_fire);
|
||||
registerItemModel(WizardryItems.wizard_robe_fire);
|
||||
registerItemModel(WizardryItems.wizard_leggings_fire);
|
||||
registerItemModel(WizardryItems.wizard_boots_fire);
|
||||
registerItemModel(WizardryItems.blank_scroll);
|
||||
registerItemModel(WizardryItems.scroll);
|
||||
|
||||
registerItemModel(WizardryItems.wizard_hat_ice);
|
||||
registerItemModel(WizardryItems.wizard_robe_ice);
|
||||
registerItemModel(WizardryItems.wizard_leggings_ice);
|
||||
registerItemModel(WizardryItems.wizard_boots_ice);
|
||||
registerItemModel(WizardryItems.armour_upgrade);
|
||||
|
||||
registerItemModel(WizardryItems.wizard_hat_lightning);
|
||||
registerItemModel(WizardryItems.wizard_robe_lightning);
|
||||
registerItemModel(WizardryItems.wizard_leggings_lightning);
|
||||
registerItemModel(WizardryItems.wizard_boots_lightning);
|
||||
registerItemModel(WizardryItems.magic_silk);
|
||||
|
||||
registerItemModel(WizardryItems.wizard_hat_necromancy);
|
||||
registerItemModel(WizardryItems.wizard_robe_necromancy);
|
||||
registerItemModel(WizardryItems.wizard_leggings_necromancy);
|
||||
registerItemModel(WizardryItems.wizard_boots_necromancy);
|
||||
registerItemModel(WizardryItems.wizard_hat);
|
||||
registerItemModel(WizardryItems.wizard_robe);
|
||||
registerItemModel(WizardryItems.wizard_leggings);
|
||||
registerItemModel(WizardryItems.wizard_boots);
|
||||
|
||||
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_fire);
|
||||
registerItemModel(WizardryItems.wizard_robe_fire);
|
||||
registerItemModel(WizardryItems.wizard_leggings_fire);
|
||||
registerItemModel(WizardryItems.wizard_boots_fire);
|
||||
|
||||
registerItemModel(WizardryItems.wizard_hat_healing);
|
||||
registerItemModel(WizardryItems.wizard_robe_healing);
|
||||
registerItemModel(WizardryItems.wizard_leggings_healing);
|
||||
registerItemModel(WizardryItems.wizard_boots_healing);
|
||||
registerItemModel(WizardryItems.wizard_hat_ice);
|
||||
registerItemModel(WizardryItems.wizard_robe_ice);
|
||||
registerItemModel(WizardryItems.wizard_leggings_ice);
|
||||
registerItemModel(WizardryItems.wizard_boots_ice);
|
||||
|
||||
registerItemModel(WizardryItems.spectral_helmet);
|
||||
registerItemModel(WizardryItems.spectral_chestplate);
|
||||
registerItemModel(WizardryItems.spectral_leggings);
|
||||
registerItemModel(WizardryItems.spectral_boots);
|
||||
|
||||
registerItemModel(WizardryItems.smoke_bomb);
|
||||
|
||||
registerItemModel(WizardryItems.identification_scroll);
|
||||
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
|
||||
|
||||
/**
|
||||
* 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. */
|
||||
* {@link NullPointerException} will result.
|
||||
*/
|
||||
private static void registerItemModel(Item item){
|
||||
|
||||
|
||||
if(item.getHasSubtypes()){
|
||||
List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
NonNullList<ItemStack> items = NonNullList.create();
|
||||
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"));
|
||||
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"));
|
||||
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));
|
||||
|
||||
/**
|
||||
* 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,67 +6,69 @@ 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;
|
||||
}
|
||||
private double angle;
|
||||
private double radius;
|
||||
private double speed;
|
||||
|
||||
// @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);
|
||||
// }
|
||||
// }
|
||||
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 onUpdate(){
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
this.fullBrightness = true;
|
||||
}
|
||||
|
||||
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;
|
||||
// @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);
|
||||
// }
|
||||
// }
|
||||
|
||||
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);
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
if(this.particleAge > this.particleMaxAge / 2){
|
||||
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
|
||||
}
|
||||
|
||||
}
|
||||
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.move(motionX, motionY, motionZ);
|
||||
|
||||
if(this.particleAge > this.particleMaxAge / 2){
|
||||
this.setAlphaF(
|
||||
1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package electroblob.wizardry.client.particle;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -14,7 +12,6 @@ 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;
|
||||
@@ -23,6 +20,7 @@ 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
|
||||
*/
|
||||
@@ -40,33 +38,41 @@ public abstract class ParticleCustomTexture extends Particle {
|
||||
this.init();
|
||||
}
|
||||
|
||||
public ParticleCustomTexture(World world, double x, double y, double z, double vx, double vy, double vz, int maxAge){
|
||||
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. */
|
||||
|
||||
/**
|
||||
* 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. */
|
||||
|
||||
/**
|
||||
* 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. */
|
||||
/* 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() {
|
||||
public int getFXLayer(){
|
||||
// This can only be 0-3 or it will cause an ArrayIndexOutOfBoundsException in EffectRenderer.
|
||||
return 3;
|
||||
}
|
||||
@@ -78,73 +84,76 @@ public abstract class ParticleCustomTexture extends Particle {
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
*/
|
||||
}
|
||||
// TESTME: Probably no longer necessary.
|
||||
// @Override
|
||||
// public void move(double x, double y, double z){
|
||||
//
|
||||
// double d0 = y;
|
||||
//
|
||||
// if (this.canCollide)
|
||||
// {
|
||||
// List<AxisAlignedBB> list = this.world.getCollisionBoxes((Entity)null, this.getBoundingBox().addCoord(x, y, z));
|
||||
//
|
||||
// for (AxisAlignedBB axisalignedbb : list)
|
||||
// {
|
||||
// y = axisalignedbb.calculateYOffset(this.getBoundingBox(), y);
|
||||
// }
|
||||
//
|
||||
// this.setBoundingBox(this.getBoundingBox().offset(0.0D, y, 0.0D));
|
||||
//
|
||||
// for (AxisAlignedBB axisalignedbb1 : list)
|
||||
// {
|
||||
// x = axisalignedbb1.calculateXOffset(this.getBoundingBox(), x);
|
||||
// }
|
||||
//
|
||||
// this.setBoundingBox(this.getBoundingBox().offset(x, 0.0D, 0.0D));
|
||||
//
|
||||
// for (AxisAlignedBB axisalignedbb2 : list)
|
||||
// {
|
||||
// z = axisalignedbb2.calculateZOffset(this.getBoundingBox(), z);
|
||||
// }
|
||||
//
|
||||
// this.setBoundingBox(this.getBoundingBox().offset(0.0D, 0.0D, z));
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// this.setBoundingBox(this.getBoundingBox().offset(x, y, z));
|
||||
// }
|
||||
//
|
||||
// this.resetPositionToBB();
|
||||
// this.onGround = 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){
|
||||
|
||||
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);
|
||||
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)lightmapX / 1.0F,
|
||||
(float)lightmapY / 1.0F);
|
||||
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(getTexture());
|
||||
@@ -152,9 +161,9 @@ public abstract class ParticleCustomTexture extends Particle {
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
|
||||
|
||||
float u1 = (float)this.particleTextureIndexX / (float)getXFrames();
|
||||
float u2 = u1 + 1.0f/getXFrames();
|
||||
float u2 = u1 + 1.0f / getXFrames();
|
||||
float v1 = (float)this.particleTextureIndexY / (float)getYFrames();
|
||||
float v2 = v1 + 1.0f/getYFrames();
|
||||
float v2 = v1 + 1.0f / getYFrames();
|
||||
float scale = 0.1F * this.particleScale;
|
||||
|
||||
// I'm pretty sure these were always static.
|
||||
@@ -166,13 +175,22 @@ public abstract class ParticleCustomTexture extends Particle {
|
||||
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();;
|
||||
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();
|
||||
@@ -180,13 +198,19 @@ public abstract class ParticleCustomTexture extends Particle {
|
||||
|
||||
}
|
||||
|
||||
/** 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 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){
|
||||
|
||||
@@ -9,82 +9,70 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ParticleDarkMagic extends Particle {
|
||||
|
||||
/** 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)
|
||||
{
|
||||
super(par1World, par2, par4, par6, par8, par10, par12);
|
||||
this.motionY *= 0.20000000298023224D;
|
||||
|
||||
this.particleRed = r;
|
||||
this.particleGreen = g;
|
||||
this.particleBlue = b;
|
||||
/** Base spell texture index */
|
||||
private int baseSpellTextureIndex = 128;
|
||||
|
||||
this.particleScale *= 0.75F;
|
||||
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.canCollide = true;
|
||||
}
|
||||
public ParticleDarkMagic(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;
|
||||
|
||||
@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 * 32.0F;
|
||||
this.particleRed = r;
|
||||
this.particleGreen = g;
|
||||
this.particleBlue = b;
|
||||
|
||||
if (f6 < 0.0F)
|
||||
{
|
||||
f6 = 0.0F;
|
||||
}
|
||||
this.particleScale *= 0.75F;
|
||||
this.particleMaxAge = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.canCollide = true;
|
||||
}
|
||||
|
||||
if (f6 > 1.0F)
|
||||
{
|
||||
f6 = 1.0F;
|
||||
}
|
||||
@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 * 32.0F;
|
||||
|
||||
super.renderParticle(buffer, entity, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
}
|
||||
if(f6 < 0.0F){
|
||||
f6 = 0.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(f6 > 1.0F){
|
||||
f6 = 1.0F;
|
||||
}
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
this.setExpired();
|
||||
}
|
||||
super.renderParticle(buffer, entity, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
|
||||
}
|
||||
|
||||
this.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
|
||||
this.motionY += 0.004D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
/*
|
||||
if (this.posY == this.prevPosY)
|
||||
{
|
||||
this.motionX *= 1.1D;
|
||||
this.motionZ *= 1.1D;
|
||||
}
|
||||
*/
|
||||
this.motionX *= 0.9599999785423279D;
|
||||
this.motionY *= 0.9599999785423279D;
|
||||
this.motionZ *= 0.9599999785423279D;
|
||||
/**
|
||||
* 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.isCollided)
|
||||
{
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
}
|
||||
if(this.particleAge++ >= this.particleMaxAge){
|
||||
this.setExpired();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base spell texture index
|
||||
*/
|
||||
public void setBaseSpellTextureIndex(int par1)
|
||||
{
|
||||
this.baseSpellTextureIndex = par1;
|
||||
}
|
||||
this.setParticleTextureIndex(this.baseSpellTextureIndex + (7 - this.particleAge * 8 / this.particleMaxAge));
|
||||
this.motionY += 0.004D;
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
/* if (this.posY == this.prevPosY) { this.motionX *= 1.1D; this.motionZ *= 1.1D; } */
|
||||
this.motionX *= 0.9599999785423279D;
|
||||
this.motionY *= 0.9599999785423279D;
|
||||
this.motionZ *= 0.9599999785423279D;
|
||||
|
||||
if(this.onGround){
|
||||
this.motionX *= 0.699999988079071D;
|
||||
this.motionZ *= 0.699999988079071D;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the base spell texture index
|
||||
*/
|
||||
public void setBaseSpellTextureIndex(int par1){
|
||||
this.baseSpellTextureIndex = par1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,51 +7,42 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ParticleDust extends Particle {
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
super(par1World, x, y, z, par8, par10, par12);
|
||||
this.particleRed = r;
|
||||
this.particleGreen = g;
|
||||
this.particleBlue = b;
|
||||
this.setParticleTextureIndex(0);
|
||||
this.setSize(0.01F, 0.01F);
|
||||
this.particleScale *= this.rand.nextFloat() + 0.2F;
|
||||
this.motionX = par8;
|
||||
this.motionY = par10;
|
||||
this.motionZ = par12;
|
||||
this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.shaded = shaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
public ParticleDust(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;
|
||||
this.particleGreen = g;
|
||||
this.particleBlue = b;
|
||||
this.setParticleTextureIndex(0);
|
||||
this.setSize(0.01F, 0.01F);
|
||||
this.particleScale *= this.rand.nextFloat() + 0.2F;
|
||||
this.motionX = par8;
|
||||
this.motionY = par10;
|
||||
this.motionZ = par12;
|
||||
this.particleMaxAge = (int)(16.0D / (Math.random() * 0.8D + 0.2D));
|
||||
this.shaded = shaded;
|
||||
}
|
||||
|
||||
if (this.particleMaxAge-- <= 0)
|
||||
{
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightnessForRender(float par1)
|
||||
{
|
||||
return shaded ? super.getBrightnessForRender(par1) : 15728880;
|
||||
}
|
||||
/*
|
||||
@Override
|
||||
public float getBrightness(float par1)
|
||||
{
|
||||
return shaded ? super.getBrightness(par1) : 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;
|
||||
// this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
|
||||
if(this.particleMaxAge-- <= 0){
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBrightnessForRender(float par1){
|
||||
return shaded ? super.getBrightnessForRender(par1) : 15728880;
|
||||
}
|
||||
/* @Override public float getBrightness(float par1) { return shaded ? super.getBrightness(par1) : 1.0F; } */
|
||||
}
|
||||
|
||||
@@ -7,44 +7,43 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ParticleGiantBubble extends Particle
|
||||
{
|
||||
/** 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 class ParticleGiantBubble extends Particle {
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
super(par1World, par2, par4, par6, par8, par10, par12);
|
||||
this.particleRed = 1.0F;
|
||||
this.particleGreen = 1.0F;
|
||||
this.particleBlue = 1.0F;
|
||||
this.setParticleTextureIndex(32);
|
||||
this.setSize(0.02F, 0.02F);
|
||||
this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F;
|
||||
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 = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
}
|
||||
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate()
|
||||
{
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.motionY += 0.002D;
|
||||
this.moveEntity(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.8500000238418579D;
|
||||
this.motionY *= 0.8500000238418579D;
|
||||
this.motionZ *= 0.8500000238418579D;
|
||||
public ParticleGiantBubble(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(32);
|
||||
this.setSize(0.02F, 0.02F);
|
||||
this.particleScale *= this.rand.nextFloat() * 0.6F + 0.2F;
|
||||
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 = (int)(8.0D / (Math.random() * 0.8D + 0.2D));
|
||||
}
|
||||
|
||||
if (this.particleMaxAge-- <= 0)
|
||||
{
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Called to update the entity's position/logic.
|
||||
*/
|
||||
public void onUpdate(){
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
this.motionY += 0.002D;
|
||||
this.move(this.motionX, this.motionY, this.motionZ);
|
||||
this.motionX *= 0.8500000238418579D;
|
||||
this.motionY *= 0.8500000238418579D;
|
||||
this.motionZ *= 0.8500000238418579D;
|
||||
|
||||
if(this.particleMaxAge-- <= 0){
|
||||
this.setExpired();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,9 @@ 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");
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -18,7 +19,7 @@ public class ParticleIce extends ParticleCustomTexture {
|
||||
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));
|
||||
@@ -28,7 +29,18 @@ public class ParticleIce extends ParticleCustomTexture {
|
||||
this.fullBrightness = true;
|
||||
}
|
||||
|
||||
@Override public ResourceLocation getTexture(){ return TEXTURE; }
|
||||
@Override protected int getXFrames(){ return 4; }
|
||||
@Override protected int getYFrames(){ return 4; }
|
||||
@Override
|
||||
public ResourceLocation getTexture(){
|
||||
return TEXTURE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getXFrames(){
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYFrames(){
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@ 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");
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -18,16 +19,27 @@ public class ParticleLeaf extends ParticleCustomTexture {
|
||||
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; }
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,39 +9,38 @@ 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);
|
||||
}
|
||||
/** The scale of the flame particle */
|
||||
private float flameScale;
|
||||
|
||||
@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);
|
||||
}
|
||||
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 int getBrightnessForRender(float par1)
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,81 +13,95 @@ 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){
|
||||
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;
|
||||
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){
|
||||
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;
|
||||
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(){
|
||||
|
||||
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;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
if (this.particleAge++ >= this.particleMaxAge)
|
||||
{
|
||||
this.setExpired();
|
||||
}
|
||||
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();
|
||||
}
|
||||
this.move(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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,54 +6,56 @@ 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);
|
||||
}
|
||||
private double angle;
|
||||
private double radius;
|
||||
private double speed;
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
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);
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
|
||||
if(this.particleAge > this.particleMaxAge / 2){
|
||||
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
|
||||
}
|
||||
|
||||
}
|
||||
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.move(motionX, motionY, motionZ);
|
||||
|
||||
if(this.particleAge > this.particleMaxAge / 2){
|
||||
this.setAlphaF(
|
||||
1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,10 @@ 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");
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -18,16 +19,27 @@ public class ParticleSnow extends ParticleCustomTexture {
|
||||
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; }
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,47 +12,59 @@ 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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,89 +8,104 @@ 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");
|
||||
|
||||
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;
|
||||
|
||||
// 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){
|
||||
// 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);
|
||||
}
|
||||
// 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){
|
||||
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; }
|
||||
// initialRed = r;
|
||||
// initialGreen = g;
|
||||
// initialBlue = b;
|
||||
}
|
||||
|
||||
@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.
|
||||
*/
|
||||
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. */
|
||||
}
|
||||
|
||||
@@ -9,75 +9,77 @@ 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;
|
||||
}
|
||||
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;
|
||||
|
||||
@Override
|
||||
public void onUpdate(){
|
||||
|
||||
this.prevPosX = this.posX;
|
||||
this.prevPosY = this.posY;
|
||||
this.prevPosZ = this.posZ;
|
||||
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));
|
||||
|
||||
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));
|
||||
// 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;
|
||||
}
|
||||
|
||||
// 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);
|
||||
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.move(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);
|
||||
}
|
||||
|
||||
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,14 +1,9 @@
|
||||
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;
|
||||
@@ -20,172 +15,140 @@ 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}).
|
||||
* Layer used to render the stone texture on a petrified creature. Handles dynamic tiling of the stone texture.
|
||||
*
|
||||
* @author Electroblob
|
||||
* @since Wizardry 1.2
|
||||
*/
|
||||
public class LayerStone implements LayerRenderer<EntityLivingBase> {
|
||||
|
||||
protected ModelBase model;
|
||||
private final RenderLivingBase<?> renderer;
|
||||
|
||||
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){
|
||||
for(Entry<Class<? extends Entity>, Render<? extends Entity>> entry : Minecraft.getMinecraft()
|
||||
.getRenderManager().entityRenderMap.entrySet()){
|
||||
// Because the zombie classes are now split properly, their renderers play nicely like everything 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()
|
||||
// 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)){
|
||||
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 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;
|
||||
}
|
||||
}
|
||||
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(entity.posX), 0,
|
||||
MathHelper.floor(entity.posZ));
|
||||
|
||||
if(entity.world.isBlockLoaded(pos)){
|
||||
pos.setY(MathHelper.floor(entity.posY + (double)entity.getEyeHeight()));
|
||||
return entity.world.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){
|
||||
|
||||
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.
|
||||
// NOTE: You can do all sorts of fun stuff with this, just by applying transformations in the 2D texture space.
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
@Override
|
||||
public boolean shouldCombineTextures(){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,9 @@ class RayHelper implements Comparable<RayHelper> {
|
||||
double x1, y1, z1;
|
||||
double x2, y2, z2;
|
||||
double offsetX, offsetY, offsetZ;
|
||||
|
||||
RayHelper(int ordinal, double x1, double y1, double z1, double x2, double y2, double z2, double offsetX, double offsetY, double offsetZ){
|
||||
|
||||
RayHelper(int ordinal, double x1, double y1, double z1, double x2, double y2, double z2, double offsetX,
|
||||
double offsetY, double offsetZ){
|
||||
this.ordinal = ordinal;
|
||||
this.x1 = x1;
|
||||
this.y1 = y1;
|
||||
@@ -20,20 +21,20 @@ class RayHelper implements Comparable<RayHelper> {
|
||||
this.offsetY = offsetY;
|
||||
this.offsetZ = offsetZ;
|
||||
}
|
||||
|
||||
|
||||
double getDistanceFromViewpoint(){
|
||||
|
||||
double midX = (x1+x2)/2;
|
||||
double midY = (y1+y2)/2;
|
||||
double midZ = (z1+z2)/2;
|
||||
|
||||
double absoluteX = offsetX+midX;
|
||||
double absoluteY = offsetY+midY;
|
||||
double absoluteZ = offsetZ+midZ;
|
||||
|
||||
return Math.sqrt(absoluteX*absoluteX + absoluteY*absoluteY + absoluteZ*absoluteZ);
|
||||
|
||||
double midX = (x1 + x2) / 2;
|
||||
double midY = (y1 + y2) / 2;
|
||||
double midZ = (z1 + z2) / 2;
|
||||
|
||||
double absoluteX = offsetX + midX;
|
||||
double absoluteY = offsetY + midY;
|
||||
double absoluteZ = offsetZ + midZ;
|
||||
|
||||
return Math.sqrt(absoluteX * absoluteX + absoluteY * absoluteY + absoluteZ * absoluteZ);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int compareTo(RayHelper ray){
|
||||
if(this.getDistanceFromViewpoint() > ray.getDistanceFromViewpoint()){
|
||||
|
||||
@@ -19,23 +19,23 @@ public class RenderArc extends Render<EntityArc> {
|
||||
|
||||
public RenderArc(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
for(int i=0;i<16;i++){
|
||||
for(int i = 0; i < 16; i++){
|
||||
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/arc_" + i + ".png");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityArc arc, double d0, double d1, double d2,
|
||||
float fa, float fb) {
|
||||
public void doRender(EntityArc arc, 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.
|
||||
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);
|
||||
|
||||
//System.out.println("Entity coords: " + entity.posX + ", " + entity.posY + ", " + entity.posZ);
|
||||
//System.out.println("doRender parameters: " + d0 + ", " + d1 + ", " + d2 + ", " + fa + ", " + fb);
|
||||
// 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();
|
||||
@@ -57,62 +57,66 @@ public class RenderArc extends Render<EntityArc> {
|
||||
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 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;
|
||||
|
||||
//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().player;
|
||||
|
||||
//EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
|
||||
// double xViewDist = player.posX - d0;
|
||||
// double yViewDist = player.posY + player.eyeHeight - d1;
|
||||
// double zViewDist = player.posZ - d2;
|
||||
|
||||
//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);
|
||||
|
||||
//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);
|
||||
|
||||
//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
|
||||
// Half the width of the arc
|
||||
double arcWidth = 0.3d;
|
||||
|
||||
//Right hand side of vertical plane
|
||||
// Right hand side of vertical plane
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
//Target end
|
||||
// Target end
|
||||
buffer.pos(0, -0.5, 0).tex(1, 1).endVertex();
|
||||
buffer.pos(0, 0.5, 0).tex(1, 0).endVertex();
|
||||
//Caster end
|
||||
// Caster end
|
||||
buffer.pos(dx, dy, dz).tex(0, 0).endVertex();
|
||||
buffer.pos(dx, dy-1, dz).tex(0, 1).endVertex();
|
||||
buffer.pos(dx, dy - 1, dz).tex(0, 1).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
//Left
|
||||
// Left
|
||||
buffer.begin(GL11.GL_QUADS, net.minecraft.client.renderer.vertex.DefaultVertexFormats.POSITION_TEX);
|
||||
//Target end
|
||||
// Target end
|
||||
buffer.pos(0, -0.5, 0).tex(1, 1).endVertex();
|
||||
//Caster end
|
||||
buffer.pos(dx, dy-1, dz).tex(0, 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
|
||||
// Target end
|
||||
buffer.pos(0, 0.5, 0).tex(1, 0).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
//Bottom of horizontal plane
|
||||
// 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();
|
||||
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
|
||||
// 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();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -122,7 +126,7 @@ public class RenderArc extends Render<EntityArc> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityArc entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityArc entity){
|
||||
return textures[entity.textureIndex];
|
||||
}
|
||||
|
||||
|
||||
@@ -18,82 +18,86 @@ 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 RenderArcaneWorkbench(){}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityArcaneWorkbench tileentity, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
private static final ResourceLocation runeTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/rune.png");
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
// This line makes stuff render in the same place relative to the world wherever the player is.
|
||||
public RenderArcaneWorkbench(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityArcaneWorkbench tileentity, double x, double y, double z,
|
||||
float partialTicks, int destroyStage){
|
||||
|
||||
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();
|
||||
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)));
|
||||
}
|
||||
GlStateManager.pushMatrix();
|
||||
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();
|
||||
GlStateManager.popMatrix();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
private void renderEffect(TileEntityArcaneWorkbench tileentity) {
|
||||
|
||||
ItemStack itemstack = tileentity.getStackInSlot(ContainerArcaneWorkbench.WAND_SLOT);
|
||||
|
||||
if(itemstack != null){
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
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);
|
||||
private void renderEffect(TileEntityArcaneWorkbench tileentity){
|
||||
|
||||
ItemStack itemstack = tileentity.getStackInSlot(ContainerArcaneWorkbench.WAND_SLOT);
|
||||
|
||||
if(!itemstack.isEmpty()){
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
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();
|
||||
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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
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);
|
||||
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
// View angle is negated because of the 180 flip.
|
||||
GlStateManager.rotate((float)(-viewAngle-90f), 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();
|
||||
}
|
||||
}
|
||||
private void renderWand(TileEntityArcaneWorkbench tileentity, double viewAngle){
|
||||
ItemStack stack = tileentity.getStackInSlot(ContainerArcaneWorkbench.WAND_SLOT);
|
||||
|
||||
if(!stack.isEmpty()){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
|
||||
|
||||
GlStateManager.rotate(180, 0, 1, 0);
|
||||
// View angle is negated because of the 180 flip.
|
||||
GlStateManager.rotate((float)(-viewAngle - 90f), 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,17 @@ 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");
|
||||
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) {
|
||||
public RenderBlackHole(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityBlackHole blackhole, double x, double y, double z, float fa, float fb) {
|
||||
public void doRender(EntityBlackHole blackhole, double x, double y, double z, float fa, float fb){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -42,8 +44,8 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
|
||||
GlStateManager.translate(x, y, z);
|
||||
|
||||
//float pitch = (float) Math.toDegrees(Math.atan(y/(x*x+z*z)));
|
||||
//float yaw = (float) Math.toDegrees(Math.atan(x/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.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
@@ -51,10 +53,13 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
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);
|
||||
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);
|
||||
GlStateManager.scale((float)(blackhole.lifetime - blackhole.ticksExisted) / 10,
|
||||
(float)(blackhole.lifetime - blackhole.ticksExisted) / 10,
|
||||
(float)(blackhole.lifetime - blackhole.ticksExisted) / 10);
|
||||
}
|
||||
|
||||
this.bindTexture(texture);
|
||||
@@ -67,7 +72,7 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
|
||||
ArrayList<RayHelper> rays = new ArrayList<RayHelper>(1);
|
||||
|
||||
for(int j=0; j<30; j++){
|
||||
for(int j = 0; j < 30; j++){
|
||||
|
||||
float scale = 3.0f;
|
||||
|
||||
@@ -76,33 +81,29 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
|
||||
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 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 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 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);
|
||||
|
||||
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();
|
||||
*/
|
||||
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);
|
||||
*
|
||||
* 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));
|
||||
|
||||
}
|
||||
@@ -112,16 +113,16 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
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);
|
||||
// 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);
|
||||
// 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);
|
||||
// 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();
|
||||
|
||||
@@ -132,20 +133,15 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
/* Deprecated in favour of particle style method.
|
||||
GlStateManager.rotate(yaw, 0, 1, 0);
|
||||
// GL transformations are relative, hence only x rotation
|
||||
if(z < 0){
|
||||
GlStateManager.rotate(pitch, 1, 0, 0);
|
||||
}else{
|
||||
GlStateManager.rotate(-1*pitch, 1, 0, 0);
|
||||
}
|
||||
*/
|
||||
/* Deprecated in favour of particle style method. GlStateManager.rotate(yaw, 0, 1, 0); // GL transformations are
|
||||
* relative, hence only x rotation if(z < 0){ GlStateManager.rotate(pitch, 1, 0, 0); }else{
|
||||
* GlStateManager.rotate(-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;
|
||||
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);
|
||||
|
||||
@@ -162,7 +158,6 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
|
||||
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||
GlStateManager.enableCull();
|
||||
GlStateManager.disableBlend();
|
||||
@@ -173,7 +168,7 @@ public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityBlackHole entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityBlackHole entity){
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,17 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderBlank extends Render<Entity> {
|
||||
|
||||
public RenderBlank(RenderManager renderManager) {
|
||||
public RenderBlank(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entity, double d0, double d1, double d2,
|
||||
float f, float f1) {
|
||||
public void doRender(Entity entity, double d0, double d1, double d2, float f, float f1){
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
protected ResourceLocation getEntityTexture(Entity entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,10 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class RenderBubble extends Render<EntityBubble> {
|
||||
|
||||
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");
|
||||
private static final ResourceLocation darkOrbTexture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/dark_orb.png");
|
||||
|
||||
public RenderBubble(RenderManager renderManager) {
|
||||
public RenderBubble(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@@ -34,7 +35,7 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
float yOffset = 0;
|
||||
|
||||
if(WizardryUtilities.getRider(entity) != null){
|
||||
yOffset = WizardryUtilities.getRider(entity).height/2;
|
||||
yOffset = WizardryUtilities.getRider(entity).height / 2;
|
||||
}
|
||||
|
||||
GlStateManager.translate((float)par2, (float)par4 + yOffset, (float)par6);
|
||||
@@ -58,20 +59,21 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
|
||||
// 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;
|
||||
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);
|
||||
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);
|
||||
// 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();
|
||||
@@ -80,8 +82,8 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
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)(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();
|
||||
}
|
||||
|
||||
@@ -97,7 +99,7 @@ public class RenderBubble extends Render<EntityBubble> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityBubble entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityBubble entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,58 +16,58 @@ import net.minecraft.util.ResourceLocation;
|
||||
public class RenderDecay extends Render<EntityDecay> {
|
||||
|
||||
private static final ResourceLocation[] textures = new ResourceLocation[10];
|
||||
|
||||
|
||||
public RenderDecay(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
for(int i=0;i<10;i++){
|
||||
for(int i = 0; i < 10; i++){
|
||||
textures[i] = new ResourceLocation(Wizardry.MODID, "textures/entity/decay_" + i + ".png");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityDecay entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
float scale = 2*Math.min(1, (float)(EntityDecay.LIFETIME - entity.ticksExisted)/50f);
|
||||
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
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);
|
||||
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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
public void doRender(EntityDecay entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
float scale = 2 * Math.min(1, (float)(EntityDecay.LIFETIME - entity.ticksExisted) / 50f);
|
||||
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
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);
|
||||
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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityDecay entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityDecay entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,26 +15,25 @@ import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
// 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.
|
||||
|
||||
|
||||
private static final Method getEntityTexture = ReflectionHelper.findMethod(Render.class, "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) {
|
||||
|
||||
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;
|
||||
@@ -50,7 +49,7 @@ public class RenderDecoy extends RenderBiped<EntityDecoy> {
|
||||
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;
|
||||
@@ -66,10 +65,11 @@ public class RenderDecoy extends RenderBiped<EntityDecoy> {
|
||||
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);
|
||||
|
||||
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;
|
||||
@@ -85,19 +85,22 @@ public class RenderDecoy extends RenderBiped<EntityDecoy> {
|
||||
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");
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,24 +11,23 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderEvilWizard extends RenderBiped<EntityEvilWizard>
|
||||
{
|
||||
static final ResourceLocation[] textures = new ResourceLocation[6];
|
||||
public class RenderEvilWizard extends RenderBiped<EntityEvilWizard> {
|
||||
static final ResourceLocation[] textures = new ResourceLocation[6];
|
||||
|
||||
public RenderEvilWizard(RenderManager renderManager){
|
||||
|
||||
super(renderManager, new ModelWizard(), 0.5F);
|
||||
|
||||
for(int i=0;i<6;i++){
|
||||
public RenderEvilWizard(RenderManager renderManager){
|
||||
|
||||
super(renderManager, new ModelWizard(), 0.5F);
|
||||
|
||||
for(int i = 0; i < 6; i++){
|
||||
textures[i] = new ResourceLocation(Wizardry.MODID, "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];
|
||||
}
|
||||
// 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];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,163 +17,170 @@ import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderFireRing extends Render<EntityFireRing> {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private float scale = 1.0f;
|
||||
|
||||
public RenderFireRing(RenderManager renderManager, ResourceLocation texture, float scale) {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private float scale = 1.0f;
|
||||
|
||||
public RenderFireRing(RenderManager renderManager, ResourceLocation texture, float scale){
|
||||
super(renderManager);
|
||||
this.texture = texture;
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityFireRing entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
GlStateManager.scale(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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
// Fire
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
TextureAtlasSprite icon = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(Blocks.FIRE.getDefaultState()).getParticleTexture();
|
||||
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);
|
||||
float f1 = 1.0f;
|
||||
GlStateManager.scale(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 f61 = 0.0F;
|
||||
int i = 0;
|
||||
|
||||
GlStateManager.rotate((360f/(float)sides)*k, 0, 1, 0);
|
||||
GlStateManager.translate(0, 0, -2.3f);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
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();
|
||||
|
||||
if (i / 2 % 2 == 0)
|
||||
{
|
||||
float f11 = f9;
|
||||
f9 = f71;
|
||||
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();
|
||||
f4 -= 0.45F;
|
||||
f5 -= 0.45F;
|
||||
f2 *= 0.9F;
|
||||
f61 += 0.03F;
|
||||
++i;
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
public void doRender(EntityFireRing entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
for(int k=0; k<sides; k++){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)par2, (float)par4 + 0.05f, (float)par6);
|
||||
float f1 = 1.0f;
|
||||
GlStateManager.scale(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 f61 = 0.0F;
|
||||
int i = 0;
|
||||
|
||||
GlStateManager.rotate((360f/(float)sides)*k, 0, 1, 0);
|
||||
GlStateManager.translate(0, 0, 2.3f);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
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();
|
||||
|
||||
if (i / 2 % 2 == 0)
|
||||
{
|
||||
float f11 = f9;
|
||||
f9 = f71;
|
||||
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();
|
||||
f4 -= 0.45F;
|
||||
f5 -= 0.45F;
|
||||
f2 *= 0.9F;
|
||||
f61 += 0.03F;
|
||||
++i;
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
}
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
GlStateManager.scale(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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
// Fire
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
TextureAtlasSprite icon = Minecraft.getMinecraft().getBlockRendererDispatcher()
|
||||
.getModelForState(Blocks.FIRE.getDefaultState()).getParticleTexture();
|
||||
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);
|
||||
float f1 = 1.0f;
|
||||
GlStateManager.scale(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 f61 = 0.0F;
|
||||
int i = 0;
|
||||
|
||||
GlStateManager.rotate((360f / (float)sides) * k, 0, 1, 0);
|
||||
GlStateManager.translate(0, 0, -2.3f);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
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();
|
||||
|
||||
if(i / 2 % 2 == 0){
|
||||
float f11 = f9;
|
||||
f9 = f71;
|
||||
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();
|
||||
f4 -= 0.45F;
|
||||
f5 -= 0.45F;
|
||||
f2 *= 0.9F;
|
||||
f61 += 0.03F;
|
||||
++i;
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
for(int k = 0; k < sides; k++){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate((float)par2, (float)par4 + 0.05f, (float)par6);
|
||||
float f1 = 1.0f;
|
||||
GlStateManager.scale(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 f61 = 0.0F;
|
||||
int i = 0;
|
||||
|
||||
GlStateManager.rotate((360f / (float)sides) * k, 0, 1, 0);
|
||||
GlStateManager.translate(0, 0, 2.3f);
|
||||
|
||||
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
|
||||
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();
|
||||
|
||||
if(i / 2 % 2 == 0){
|
||||
float f11 = f9;
|
||||
f9 = f71;
|
||||
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();
|
||||
f4 -= 0.45F;
|
||||
f5 -= 0.45F;
|
||||
f2 *= 0.9F;
|
||||
f61 += 0.03F;
|
||||
++i;
|
||||
}
|
||||
|
||||
tessellator.draw();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityFireRing entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityFireRing entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,111 +17,111 @@ import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderForceArrow extends Render<EntityForceArrow>{
|
||||
public class RenderForceArrow extends Render<EntityForceArrow> {
|
||||
|
||||
private static final ResourceLocation arrowTextures = new ResourceLocation(Wizardry.MODID, "textures/entity/force_arrow.png");
|
||||
private static final ResourceLocation arrowTextures = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/force_arrow.png");
|
||||
|
||||
public RenderForceArrow(RenderManager renderManager){
|
||||
public RenderForceArrow(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityForceArrow arrow, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
this.bindEntityTexture(arrow);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(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();
|
||||
float pixel = 1.0f/32.0f;
|
||||
float u1 = 0.0f;
|
||||
float u2 = pixel*14;
|
||||
float v1 = 0.0f;
|
||||
float v2 = pixel*7;
|
||||
float u3 = pixel*16;
|
||||
float u4 = 1.0f;
|
||||
float v3 = 0.0f;
|
||||
float v4 = pixel*16;
|
||||
float u5 = 0.0f;
|
||||
float u6 = pixel*7;
|
||||
float v5 = pixel*25;
|
||||
float v6 = 1.0f;
|
||||
float scale = 0.05625F;
|
||||
float f11 = 0.0f;
|
||||
GlStateManager.enableRescaleNormal();
|
||||
//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);
|
||||
}
|
||||
|
||||
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);
|
||||
@Override
|
||||
public void doRender(EntityForceArrow arrow, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
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.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;
|
||||
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.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.draw();
|
||||
}
|
||||
this.bindEntityTexture(arrow);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
GlStateManager.rotate(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.draw();
|
||||
}
|
||||
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();
|
||||
float pixel = 1.0f / 32.0f;
|
||||
float u1 = 0.0f;
|
||||
float u2 = pixel * 14;
|
||||
float v1 = 0.0f;
|
||||
float v2 = pixel * 7;
|
||||
float u3 = pixel * 16;
|
||||
float u4 = 1.0f;
|
||||
float v3 = 0.0f;
|
||||
float v4 = pixel * 16;
|
||||
float u5 = 0.0f;
|
||||
float u6 = pixel * 7;
|
||||
float v5 = pixel * 25;
|
||||
float v6 = 1.0f;
|
||||
float scale = 0.05625F;
|
||||
float f11 = 0.0f;
|
||||
GlStateManager.enableRescaleNormal();
|
||||
// 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);
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
scale *= 0.8f;
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityForceArrow par1Entity)
|
||||
{
|
||||
return arrowTextures;
|
||||
}
|
||||
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
GlStateManager.translate(-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.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;
|
||||
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.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.draw();
|
||||
}
|
||||
|
||||
GlStateManager.color(1, 1, 1, 1);
|
||||
|
||||
for(int i = 0; i < 4; ++i){
|
||||
GlStateManager.rotate(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.draw();
|
||||
}
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityForceArrow par1Entity){
|
||||
return arrowTextures;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,30 +9,31 @@ import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderHammer extends Render<EntityHammer> {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/lightning_hammer.png");
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/lightning_hammer.png");
|
||||
private ModelHammer model = new ModelHammer();
|
||||
|
||||
|
||||
public RenderHammer(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityHammer entity, double x, double y, double z, float f, float f1) {
|
||||
|
||||
public void doRender(EntityHammer entity, double x, double y, double z, float f, float f1){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(x, y+1.5, z);
|
||||
GlStateManager.translate(x, y + 1.5, z);
|
||||
GlStateManager.rotate(180, 0F, 0F, 1F);
|
||||
|
||||
|
||||
this.bindTexture(texture);
|
||||
|
||||
|
||||
model.render(entity, 0, 0, 0, 0, 0, 0.0625f);
|
||||
|
||||
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityHammer entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityHammer entity){
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,28 +12,29 @@ 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 RenderIceGiant(RenderManager renderManager){
|
||||
super(renderManager, new ModelIceGiant(), 0.5F);
|
||||
}
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/ice_giant.png");
|
||||
|
||||
public RenderIceGiant(RenderManager renderManager){
|
||||
super(renderManager, new ModelIceGiant(), 0.5F);
|
||||
}
|
||||
|
||||
@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){
|
||||
float f3 = 13.0F;
|
||||
float f4 = entityLiving.limbSwing - entityLiving.limbSwingAmount * (1.0F - partialTicks) + 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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyRotations(EntityIceGiant entityLiving, float pitch, float yaw, float partialTicks){
|
||||
|
||||
super.applyRotations(entityLiving, pitch, yaw, partialTicks);
|
||||
|
||||
if((double)entityLiving.limbSwingAmount >= 0.01D){
|
||||
float f3 = 13.0F;
|
||||
float f4 = entityLiving.limbSwing - entityLiving.limbSwingAmount * (1.0F - partialTicks) + 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,28 +15,29 @@ import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderIceSpike extends Render<EntityIceSpike> {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/ice_spike.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/ice_spike.png");
|
||||
|
||||
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(EntityIceSpike entity, double x, double y, double z, float fa, float partialTickTime){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
|
||||
GlStateManager.translate((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();
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
@@ -45,15 +46,15 @@ public class RenderIceSpike extends Render<EntityIceSpike> {
|
||||
|
||||
// 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, 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.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, 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.draw();
|
||||
@@ -61,23 +62,23 @@ public class RenderIceSpike extends Render<EntityIceSpike> {
|
||||
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();
|
||||
buffer.pos(0, 1, 0.5).tex(1, 0).endVertex();
|
||||
buffer.pos(0, 0, 0.5).tex(1, 1).endVertex();
|
||||
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();
|
||||
buffer.pos(0.5, 1, 0).tex(1, 0).endVertex();
|
||||
buffer.pos(0.5, 0, 0).tex(1, 1).endVertex();
|
||||
tessellator.draw();
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityIceSpike entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityIceSpike entity){
|
||||
return texture;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,69 +13,69 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderLightningDisc extends Render<EntityLightningDisc> {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private float scale = 1.0f;
|
||||
|
||||
public RenderLightningDisc(RenderManager renderManager, ResourceLocation texture, float scale) {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private float scale = 1.0f;
|
||||
|
||||
public RenderLightningDisc(RenderManager renderManager, ResourceLocation texture, float scale){
|
||||
super(renderManager);
|
||||
this.texture = texture;
|
||||
this.scale = scale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityLightningDisc entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
GlStateManager.rotate(entity.ticksExisted*8, 0, 0, 1);
|
||||
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
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);
|
||||
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.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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
public void doRender(EntityLightningDisc entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
GlStateManager.rotate(entity.ticksExisted * 8, 0, 0, 1);
|
||||
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
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);
|
||||
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.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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityLightningDisc entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityLightningDisc entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,58 +14,58 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderLightningPulse extends Render<EntityLightningPulse> {
|
||||
|
||||
private final ResourceLocation[] textures = new ResourceLocation[8];
|
||||
private float scale = 1.0f;
|
||||
|
||||
public RenderLightningPulse(RenderManager renderManager, float scale) {
|
||||
|
||||
private final ResourceLocation[] textures = new ResourceLocation[8];
|
||||
private float scale = 1.0f;
|
||||
|
||||
public RenderLightningPulse(RenderManager renderManager, float scale){
|
||||
super(renderManager);
|
||||
for(int i=0; i<textures.length; i++){
|
||||
for(int i = 0; i < textures.length; i++){
|
||||
textures[i] = new ResourceLocation(Wizardry.MODID, "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){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
GlStateManager.scale(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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
public void doRender(EntityLightningPulse entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
GlStateManager.scale(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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityLightningPulse entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityLightningPulse entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,105 +18,106 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderMagicArrow extends Render<EntityMagicArrow> {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private boolean blend;
|
||||
private boolean renderEnds;
|
||||
private double length = 8.0, width = 2.0;
|
||||
private int pixelsLong = 16, pixelsWide = 5;
|
||||
private final ResourceLocation texture;
|
||||
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;
|
||||
this.blend = blend;
|
||||
this.renderEnds = renderEnds;
|
||||
this.length = length;
|
||||
this.width = width;
|
||||
this.pixelsLong = pixelsLong;
|
||||
this.pixelsWide = pixelsWide;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityMagicArrow entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
this.bindEntityTexture(entity);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
if(this.blend){
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(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();
|
||||
float f2 = 0.0F;
|
||||
float f3 = pixelsLong / 32.0F;
|
||||
float f4 = 0.0F;
|
||||
float f5 = pixelsWide / 32.0F;
|
||||
float f6 = 0.0F;
|
||||
float f7 = 0.15625F;
|
||||
float f8 = (float)5 / 32.0F;
|
||||
float f9 = (float)10 / 32.0F;
|
||||
float f10 = 0.05625F;
|
||||
float f11 = 0.0f;
|
||||
GlStateManager.enableRescaleNormal();
|
||||
//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);
|
||||
}
|
||||
public RenderMagicArrow(RenderManager renderManager, ResourceLocation texture, boolean blend, double length,
|
||||
double width, int pixelsLong, int pixelsWide, boolean renderEnds){
|
||||
super(renderManager);
|
||||
this.texture = texture;
|
||||
this.blend = blend;
|
||||
this.renderEnds = renderEnds;
|
||||
this.length = length;
|
||||
this.width = width;
|
||||
this.pixelsLong = pixelsLong;
|
||||
this.pixelsWide = pixelsWide;
|
||||
}
|
||||
|
||||
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.scale(f10, f10, f10);
|
||||
GlStateManager.translate(-4.0F, 0.0F, 0.0F);
|
||||
GL11.glNormal3f(f10, 0.0F, 0.0F);
|
||||
@Override
|
||||
public void doRender(EntityMagicArrow entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
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.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.draw();
|
||||
}
|
||||
this.bindEntityTexture(entity);
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
for (int i = 0; i < 4; ++i){
|
||||
// Sides
|
||||
GlStateManager.rotate(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.draw();
|
||||
}
|
||||
if(this.blend){
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
if(this.blend){
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
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();
|
||||
float f2 = 0.0F;
|
||||
float f3 = pixelsLong / 32.0F;
|
||||
float f4 = 0.0F;
|
||||
float f5 = pixelsWide / 32.0F;
|
||||
float f6 = 0.0F;
|
||||
float f7 = 0.15625F;
|
||||
float f8 = (float)5 / 32.0F;
|
||||
float f9 = (float)10 / 32.0F;
|
||||
float f10 = 0.05625F;
|
||||
float f11 = 0.0f;
|
||||
GlStateManager.enableRescaleNormal();
|
||||
// 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityMagicArrow arrow)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
GlStateManager.rotate(45.0F, 1.0F, 0.0F, 0.0F);
|
||||
GlStateManager.scale(f10, f10, f10);
|
||||
GlStateManager.translate(-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.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.draw();
|
||||
}
|
||||
|
||||
for(int i = 0; i < 4; ++i){
|
||||
// Sides
|
||||
GlStateManager.rotate(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.draw();
|
||||
}
|
||||
|
||||
if(this.blend){
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityMagicArrow arrow){
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,11 +16,14 @@ 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");
|
||||
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");
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityMagicLight tileentity, double x, double y, double z, float f, int destroyStage){
|
||||
public void renderTileEntityAt(TileEntityMagicLight tileentity, double x, double y, double z, float f,
|
||||
int destroyStage){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
@@ -34,10 +37,13 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
||||
GlStateManager.translate(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);
|
||||
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(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);
|
||||
}
|
||||
|
||||
// Renders the aura effect
|
||||
@@ -51,7 +57,9 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
||||
|
||||
// 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;
|
||||
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);
|
||||
|
||||
@@ -75,45 +83,41 @@ public class RenderMagicLight extends TileEntitySpecialRenderer<TileEntityMagicL
|
||||
GlStateManager.blendFunc(GL11.GL_ONE, GL11.GL_SRC_ALPHA);
|
||||
|
||||
this.bindTexture(texture);
|
||||
|
||||
|
||||
if(tileentity.randomiser.length >= 30){
|
||||
for(int j=0; j<30; j++){
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
|
||||
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));
|
||||
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,37 +16,37 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderPhoenix extends RenderLiving<EntityPhoenix> {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/phoenix.png");
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/phoenix.png");
|
||||
|
||||
public RenderPhoenix(RenderManager renderManager){
|
||||
super(renderManager, new ModelPhoenix(), 1.0f);
|
||||
}
|
||||
public RenderPhoenix(RenderManager renderManager){
|
||||
super(renderManager, new ModelPhoenix(), 1.0f);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityPhoenix entity){
|
||||
return texture;
|
||||
}
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityPhoenix entity){
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void rotateCorpse(EntityPhoenix par1EntityPhoenix, float par2, float par3, float par4){
|
||||
GlStateManager.translate(0.0F, -0.1F, 0.0F);
|
||||
super.rotateCorpse(par1EntityPhoenix, par2, par3, par4);
|
||||
}
|
||||
@Override
|
||||
protected void applyRotations(EntityPhoenix par1EntityPhoenix, float par2, float par3, float par4){
|
||||
GlStateManager.translate(0.0F, -0.1F, 0.0F);
|
||||
super.applyRotations(par1EntityPhoenix, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityPhoenix phoenix, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
super.doRender(phoenix, par2, par4, par6, par8, par9);
|
||||
@Override
|
||||
public void doRender(EntityPhoenix phoenix, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
GlStateManager.pushMatrix();
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
super.doRender(phoenix, par2, par4, par6, par8, par9);
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,71 +18,71 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderProjectile extends Render<EntityMagicProjectile> {
|
||||
|
||||
private float scale;
|
||||
private boolean blend = false;
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private float scale;
|
||||
private boolean blend = false;
|
||||
|
||||
public RenderProjectile(RenderManager renderManager, float scale, ResourceLocation texture, boolean doBlending)
|
||||
{
|
||||
super(renderManager);
|
||||
this.scale = scale;
|
||||
this.texture = texture;
|
||||
this.blend = doBlending;
|
||||
}
|
||||
private final ResourceLocation texture;
|
||||
|
||||
@Override
|
||||
public void doRender(EntityMagicProjectile entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
this.bindTexture(texture);
|
||||
GlStateManager.translate((float)par2, (float)par4, (float)par6);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
if(blend){
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
float f2 = this.scale;
|
||||
GlStateManager.scale(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
float f3 = 0.0f;
|
||||
float f4 = 1.0f;
|
||||
float f5 = 0.0f;
|
||||
float f6 = 1.0f;
|
||||
float f7 = 1.0F;
|
||||
float f8 = 0.5F;
|
||||
float f9 = 0.25F;
|
||||
|
||||
// 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);
|
||||
|
||||
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.draw();
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
if(blend){
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityMagicProjectile par1Entity){
|
||||
return texture;
|
||||
}
|
||||
public RenderProjectile(RenderManager renderManager, 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();
|
||||
this.bindTexture(texture);
|
||||
GlStateManager.translate((float)par2, (float)par4, (float)par6);
|
||||
GlStateManager.enableRescaleNormal();
|
||||
if(blend){
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240f, 240f);
|
||||
|
||||
float f2 = this.scale;
|
||||
GlStateManager.scale(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
VertexBuffer buffer = tessellator.getBuffer();
|
||||
|
||||
float f3 = 0.0f;
|
||||
float f4 = 1.0f;
|
||||
float f5 = 0.0f;
|
||||
float f6 = 1.0f;
|
||||
float f7 = 1.0F;
|
||||
float f8 = 0.5F;
|
||||
float f9 = 0.25F;
|
||||
|
||||
// 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);
|
||||
|
||||
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.draw();
|
||||
|
||||
GlStateManager.disableRescaleNormal();
|
||||
if(blend){
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityMagicProjectile par1Entity){
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,12 +17,12 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderSigil extends Render<EntityMagicConstruct> {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private float scale = 1.0f;
|
||||
private boolean invisibleToEnemies;
|
||||
|
||||
public RenderSigil(RenderManager renderManager, ResourceLocation texture, float scale, boolean invisibleToEnemies) {
|
||||
|
||||
private final ResourceLocation texture;
|
||||
private float scale = 1.0f;
|
||||
private boolean invisibleToEnemies;
|
||||
|
||||
public RenderSigil(RenderManager renderManager, ResourceLocation texture, float scale, boolean invisibleToEnemies){
|
||||
super(renderManager);
|
||||
this.texture = texture;
|
||||
this.scale = scale;
|
||||
@@ -30,59 +30,59 @@ public class RenderSigil extends Render<EntityMagicConstruct> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(EntityMagicConstruct entity, double par2, double par4, double par6, float par8, float par9){
|
||||
|
||||
public void doRender(EntityMagicConstruct 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(entity.getCaster() instanceof EntityPlayer
|
||||
&& !WizardryUtilities.isPlayerAlly((EntityPlayer)entity.getCaster(), Minecraft.getMinecraft().thePlayer)){
|
||||
|
||||
if(entity.getCaster() instanceof EntityPlayer && !WizardryUtilities
|
||||
.isPlayerAlly((EntityPlayer)entity.getCaster(), Minecraft.getMinecraft().player)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
// Healing aura rotates slowly
|
||||
if(entity instanceof EntityHealAura) GlStateManager.rotate(entity.ticksExisted/3.0f, 0, 0, 1);
|
||||
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
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);
|
||||
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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.disableLighting();
|
||||
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
float yOffset = 0;
|
||||
|
||||
GlStateManager.translate((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);
|
||||
|
||||
// Healing aura rotates slowly
|
||||
if(entity instanceof EntityHealAura) GlStateManager.rotate(entity.ticksExisted / 3.0f, 0, 0, 1);
|
||||
|
||||
GlStateManager.scale(scale, scale, scale);
|
||||
|
||||
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);
|
||||
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.draw();
|
||||
|
||||
GlStateManager.disableBlend();
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableRescaleNormal();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityMagicConstruct entity) {
|
||||
protected ResourceLocation getEntityTexture(EntityMagicConstruct entity){
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package electroblob.wizardry.client.renderer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
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;
|
||||
@@ -14,23 +13,24 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderSpiritHorse extends RenderHorse {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/spirit_horse.png");
|
||||
|
||||
public RenderSpiritHorse(RenderManager renderManager, float par2){
|
||||
super(renderManager, new ModelHorse(), par2);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityHorse entity) {
|
||||
return texture;
|
||||
}
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/spirit_horse.png");
|
||||
|
||||
@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);
|
||||
}
|
||||
public RenderSpiritHorse(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityHorse entity){
|
||||
return texture;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ 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;
|
||||
@@ -14,22 +13,23 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderSpiritWolf extends RenderWolf {
|
||||
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID, "textures/entity/spirit_wolf.png");
|
||||
|
||||
public RenderSpiritWolf(RenderManager renderManager, float par3){
|
||||
super(renderManager, new ModelWolf(), par3);
|
||||
}
|
||||
private static final ResourceLocation texture = new ResourceLocation(Wizardry.MODID,
|
||||
"textures/entity/spirit_wolf.png");
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityWolf entity) {
|
||||
return texture;
|
||||
}
|
||||
public RenderSpiritWolf(RenderManager renderManager){
|
||||
super(renderManager);
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityWolf entity){
|
||||
return texture;
|
||||
}
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,33 +9,35 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class RenderStatue extends TileEntitySpecialRenderer<TileEntityStatue> {
|
||||
|
||||
|
||||
private int destroyStage = 0; // Gets set each time a statue is rendered to allow access from the layer renderer
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityStatue statue, double x, double y, double z, float partialTicks, int destroyStage){
|
||||
public void renderTileEntityAt(TileEntityStatue statue, double x, double y, double z, float partialTicks,
|
||||
int destroyStage){
|
||||
|
||||
// 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);
|
||||
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);
|
||||
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);
|
||||
|
||||
@@ -51,12 +53,12 @@ public class RenderStatue extends TileEntitySpecialRenderer<TileEntityStatue> {
|
||||
// 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];
|
||||
}
|
||||
|
||||
@@ -13,22 +13,22 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class RenderWizard extends RenderBiped<EntityWizard> {
|
||||
|
||||
static final ResourceLocation[] textures = new ResourceLocation[6];
|
||||
static final ResourceLocation[] textures = new ResourceLocation[6];
|
||||
|
||||
public RenderWizard(RenderManager renderManager){
|
||||
|
||||
super(renderManager, new ModelWizard(), 0.5F);
|
||||
|
||||
for(int i=0;i<6;i++){
|
||||
public RenderWizard(RenderManager renderManager){
|
||||
|
||||
super(renderManager, new ModelWizard(), 0.5F);
|
||||
|
||||
for(int i = 0; i < 6; i++){
|
||||
textures[i] = new ResourceLocation(Wizardry.MODID, "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];
|
||||
}
|
||||
// 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];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,18 +9,15 @@ 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<EntityBlazeMinion> {
|
||||
private ResourceLocation texture = new ResourceLocation("textures/entity/blaze.png");
|
||||
|
||||
public RenderWraithMinion(RenderManager renderManagerIn)
|
||||
{
|
||||
super(renderManagerIn, new ModelBlaze(), 0.5F);
|
||||
}
|
||||
public RenderWraithMinion(RenderManager renderManagerIn){
|
||||
super(renderManagerIn, new ModelBlaze(), 0.5F);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityBlazeMinion entity)
|
||||
{
|
||||
return texture;
|
||||
}
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(EntityBlazeMinion entity){
|
||||
return texture;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user