speedran making a fully functional crucible

This commit is contained in:
Bob 2021-02-12 00:35:00 +01:00
parent 68af222c19
commit 04861b1b0a
17 changed files with 4673 additions and 113 deletions

View File

@ -904,6 +904,7 @@ item.cordite.name=Kordit
item.cotton_candy.name=Radioaktive Zuckerwatte
item.crate_caller.name=Nachschub-Requester
item.crowbar.name=Mk.V Kistenöffnungsapparat "Brechstange"
item.crucible.name=Schmelztiegel
item.crystal_aluminium.name=Aluminiumkristalle
item.crystal_beryllium.name=Berylliumkristalle
item.crystal_charred.name=Verkohlter Kristall

View File

@ -910,6 +910,7 @@ item.cordite.name=Cordite
item.cotton_candy.name=Radioactive Cotton Candy
item.crate_caller.name=Supply Drop Requester
item.crowbar.name=Mk.V Crate Opening Device "Crowbar"
item.crucible.name=Crucible
item.crystal_aluminium.name=Aluminium Crystals
item.crystal_beryllium.name=Beryllium Crystals
item.crystal_charred.name=Charred Crystal

File diff suppressed because it is too large Load Diff

View File

@ -142,6 +142,8 @@
"weapon.ballsLaser": {"category": "hostile", "sounds": [{"name": "weapon/ballsLaser", "stream": false}]},
"weapon.dartShoot": {"category": "player", "sounds": [{"name": "weapon/dartShoot", "stream": false}]},
"weapon.mukeExplosion": {"category": "player", "sounds": [{"name": "weapon/mukeExplosion", "stream": false}]},
"weapon.cDeploy": {"category": "player", "sounds": [{"name": "weapon/cDeploy", "stream": false}]},
"weapon.cSwing": {"category": "player", "sounds": [{"name": "weapon/cSwing", "stream": false}]},
"weapon.reloadTurret": {"category": "player", "sounds": [{"name": "weapon/reloadTurret", "stream": false}]},
"weapon.switchmode1": {"category": "player", "sounds": [{"name": "weapon/switchmode1", "stream": false}]},

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

View File

@ -0,0 +1,9 @@
package com.hbm.items;
import net.minecraft.entity.player.EntityPlayer;
public interface IEquipReceiver {
public void onEquip(EntityPlayer player);
}

View File

@ -1411,6 +1411,8 @@ public class ModItems {
public static Item gun_dampfmaschine;
public static Item gun_waluigi;
public static Item gun_darter;
public static Item crucible;
public static Item grenade_generic;
public static Item grenade_strong;
@ -3491,6 +3493,9 @@ public class ModItems {
gun_dampfmaschine = new GunDampfmaschine().setUnlocalizedName("gun_dampfmaschine").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_dampfmaschine");
gun_darter = new ItemGunDart(GunDartFactory.getDarterConfig()).setFull3D().setUnlocalizedName("gun_darter").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":gun_darter");
ToolMaterial matCrucible = EnumHelper.addToolMaterial("CRUCIBLE", 3, 10000, 50.0F, 100.0F, 200);;
crucible = new ItemCrucible(500, 1F, matCrucible).setUnlocalizedName("crucible").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":crucible");
grenade_generic = new ItemGrenade(4).setUnlocalizedName("grenade_generic").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_generic");
grenade_strong = new ItemGrenade(5).setUnlocalizedName("grenade_strong").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_strong");
grenade_frag = new ItemGrenade(4).setUnlocalizedName("grenade_frag").setCreativeTab(MainRegistry.weaponTab).setTextureName(RefStrings.MODID + ":grenade_frag_alt");
@ -5781,6 +5786,7 @@ public class ModItems {
GameRegistry.registerItem(gun_moist_nugget, gun_moist_nugget.getUnlocalizedName());
GameRegistry.registerItem(gun_dampfmaschine, gun_dampfmaschine.getUnlocalizedName());
GameRegistry.registerItem(gun_darter, gun_darter.getUnlocalizedName());
GameRegistry.registerItem(crucible, crucible.getUnlocalizedName());
//Ammo
GameRegistry.registerItem(gun_revolver_iron_ammo, gun_revolver_iron_ammo.getUnlocalizedName());

View File

@ -28,150 +28,146 @@ import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.event.world.BlockEvent;
public class ItemSwordAbility extends ItemSword implements IItemAbility {
private EnumRarity rarity = EnumRarity.common;
//was there a reason for this to be private?
protected float damage;
protected double movement;
private List<WeaponAbility> hitAbility = new ArrayList();
// was there a reason for this to be private?
protected float damage;
protected double movement;
private List<WeaponAbility> hitAbility = new ArrayList();
public ItemSwordAbility(float damage, double movement, ToolMaterial material) {
super(material);
this.damage = damage;
this.movement = movement;
}
public ItemSwordAbility addHitAbility(WeaponAbility weaponAbility) {
this.hitAbility.add(weaponAbility);
return this;
}
//<insert obvious Rarity joke here>
// <insert obvious Rarity joke here>
public ItemSwordAbility setRarity(EnumRarity rarity) {
this.rarity = rarity;
return this;
}
public EnumRarity getRarity(ItemStack stack) {
return this.rarity != EnumRarity.common ? this.rarity : super.getRarity(stack);
}
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase attacker) {
if(!attacker.worldObj.isRemote && !this.hitAbility.isEmpty() && attacker instanceof EntityPlayer && canOperate(stack)) {
//hacky hacky hack
if(this == ModItems.mese_gavel)
attacker.worldObj.playSoundAtEntity(victim, "hbm:weapon.whack", 3.0F, 1.F);
for(WeaponAbility ability : this.hitAbility) {
public EnumRarity getRarity(ItemStack stack) {
return this.rarity != EnumRarity.common ? this.rarity : super.getRarity(stack);
}
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase attacker) {
if(!attacker.worldObj.isRemote && !this.hitAbility.isEmpty() && attacker instanceof EntityPlayer && canOperate(stack)) {
// hacky hacky hack
if(this == ModItems.mese_gavel)
attacker.worldObj.playSoundAtEntity(victim, "hbm:weapon.whack", 3.0F, 1.F);
for(WeaponAbility ability : this.hitAbility) {
ability.onHit(attacker.worldObj, (EntityPlayer) attacker, victim, this);
}
}
stack.damageItem(1, attacker);
return true;
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = HashMultimap.create();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double)this.damage, 0));
}
}
stack.damageItem(1, attacker);
return true;
}
@Override
public Multimap getItemAttributeModifiers() {
Multimap multimap = HashMultimap.create();
multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", (double) this.damage, 0));
multimap.put(SharedMonsterAttributes.movementSpeed.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Tool modifier", movement, 1));
return multimap;
}
public void breakExtraBlock(World world, int x, int y, int z, EntityPlayer playerEntity, int refX, int refY, int refZ) {
if (world.isAirBlock(x, y, z))
return;
return multimap;
}
if(!(playerEntity instanceof EntityPlayerMP))
return;
EntityPlayerMP player = (EntityPlayerMP) playerEntity;
ItemStack stack = player.getHeldItem();
public void breakExtraBlock(World world, int x, int y, int z, EntityPlayer playerEntity, int refX, int refY, int refZ) {
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
if(world.isAirBlock(x, y, z))
return;
if(!canHarvestBlock(block, stack))
return;
if(!(playerEntity instanceof EntityPlayerMP))
return;
Block refBlock = world.getBlock(refX, refY, refZ);
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
float strength = ForgeHooks.blockStrength(block, player, world, x,y,z);
EntityPlayerMP player = (EntityPlayerMP) playerEntity;
ItemStack stack = player.getHeldItem();
if (!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength/strength > 10f)
return;
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x,y,z);
if(event.isCanceled())
return;
if(!canHarvestBlock(block, stack))
return;
if (player.capabilities.isCreativeMode) {
block.onBlockHarvested(world, x, y, z, meta, player);
if (block.removedByPlayer(world, player, x, y, z, false))
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
Block refBlock = world.getBlock(refX, refY, refZ);
float refStrength = ForgeHooks.blockStrength(refBlock, player, world, refX, refY, refZ);
float strength = ForgeHooks.blockStrength(block, player, world, x, y, z);
if (!world.isRemote) {
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
}
return;
}
if(!ForgeHooks.canHarvestBlock(block, player, meta) || refStrength / strength > 10f)
return;
player.getCurrentEquippedItem().func_150999_a(world, block, x, y, z, player);
BlockEvent.BreakEvent event = ForgeHooks.onBlockBreakEvent(world, player.theItemInWorldManager.getGameType(), player, x, y, z);
if(event.isCanceled())
return;
if (!world.isRemote) {
block.onBlockHarvested(world, x,y,z, meta, player);
if(player.capabilities.isCreativeMode) {
block.onBlockHarvested(world, x, y, z, meta, player);
if(block.removedByPlayer(world, player, x, y, z, false))
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
if(block.removedByPlayer(world, player, x,y,z, true))
{
block.onBlockDestroyedByPlayer( world, x,y,z, meta);
block.harvestBlock(world, player, x,y,z, meta);
block.dropXpOnBlockBreak(world, x,y,z, event.getExpToDrop());
}
if(!world.isRemote) {
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
}
return;
}
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
} else {
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
if(block.removedByPlayer(world, player, x,y,z, true))
{
block.onBlockDestroyedByPlayer(world, x,y,z, meta);
}
ItemStack itemstack = player.getCurrentEquippedItem();
if (itemstack != null)
{
itemstack.func_150999_a(world, block, x, y, z, player);
player.getCurrentEquippedItem().func_150999_a(world, block, x, y, z, player);
if (itemstack.stackSize == 0)
{
player.destroyCurrentEquippedItem();
}
}
if(!world.isRemote) {
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
}
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
if(!this.hitAbility.isEmpty()) {
list.add("Weapon modifiers: ");
for(WeaponAbility ability : this.hitAbility) {
block.onBlockHarvested(world, x, y, z, meta, player);
if(block.removedByPlayer(world, player, x, y, z, true)) {
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
block.harvestBlock(world, player, x, y, z, meta);
block.dropXpOnBlockBreak(world, x, y, z, event.getExpToDrop());
}
player.playerNetServerHandler.sendPacket(new S23PacketBlockChange(x, y, z, world));
} else {
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
if(block.removedByPlayer(world, player, x, y, z, true)) {
block.onBlockDestroyedByPlayer(world, x, y, z, meta);
}
ItemStack itemstack = player.getCurrentEquippedItem();
if(itemstack != null) {
itemstack.func_150999_a(world, block, x, y, z, player);
if(itemstack.stackSize == 0) {
player.destroyCurrentEquippedItem();
}
}
Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
}
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean ext) {
if(!this.hitAbility.isEmpty()) {
list.add("Weapon modifiers: ");
for(WeaponAbility ability : this.hitAbility) {
list.add(" " + EnumChatFormatting.RED + ability.getFullName());
}
}
}
protected boolean canOperate(ItemStack stack) {
return true;
}
}
}
}
protected boolean canOperate(ItemStack stack) {
return true;
}
}

View File

@ -0,0 +1,73 @@
package com.hbm.items.weapon;
import com.hbm.items.IEquipReceiver;
import com.hbm.items.tool.ItemSwordAbility;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
public class ItemCrucible extends ItemSwordAbility implements IEquipReceiver {
public ItemCrucible(float damage, double movement, ToolMaterial material) {
super(damage, movement, material);
}
@Override
public void onEquip(EntityPlayer player) {
if(!(player instanceof EntityPlayerMP))
return;
World world = player.worldObj;
world.playSoundEffect(player.posX, player.posY, player.posZ, "hbm:weapon.cDeploy", 1.0F, 1.0F);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("type", "anim");
nbt.setString("mode", "crucible");
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)player);
}
@Override
public boolean onEntitySwing(EntityLivingBase entityLiving, ItemStack stack) {
if(!(entityLiving instanceof EntityPlayerMP))
return false;
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("type", "anim");
nbt.setString("mode", "cSwing");
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(nbt, 0, 0, 0), (EntityPlayerMP)entityLiving);
return false;
}
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase attacker) {
attacker.worldObj.playSoundEffect(victim.posX, victim.posY, victim.posZ, "mob.zombie.woodbreak", 1.0F, 0.75F + victim.getRNG().nextFloat() * 0.2F);
if(!attacker.worldObj.isRemote && !victim.isEntityAlive()) {
int count = Math.min((int)Math.ceil(victim.getMaxHealth() / 3D), 250);
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaburst");
data.setInteger("count", count * 4);
data.setDouble("motion", 0.1D);
data.setString("mode", "blockdust");
data.setInteger("block", Block.getIdFromBlock(Blocks.redstone_block));
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, victim.posX, victim.posY + victim.height * 0.5, victim.posZ), new TargetPoint(victim.dimension, victim.posX, victim.posY + victim.height * 0.5, victim.posZ, 50));
}
return super.hitEntity(stack, victim, attacker);
}
}

View File

@ -2,6 +2,7 @@
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.model.ModelChicken;
import net.minecraft.client.particle.EntityAuraFX;
import net.minecraft.client.particle.EntityBlockDustFX;
@ -49,6 +50,11 @@ import com.hbm.entity.projectile.*;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.items.ModItems;
import com.hbm.particle.*;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.HbmAnimations;
import com.hbm.render.anim.HbmAnimations.Animation;
import com.hbm.render.block.*;
import com.hbm.render.entity.*;
import com.hbm.render.entity.effect.*;
@ -246,6 +252,7 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.lead_gavel, new ItemRenderGavel());
MinecraftForgeClient.registerItemRenderer(ModItems.diamond_gavel, new ItemRenderGavel());
MinecraftForgeClient.registerItemRenderer(ModItems.mese_gavel, new ItemRenderGavel());
MinecraftForgeClient.registerItemRenderer(ModItems.crucible, new ItemRenderCrucible());
//guns
MinecraftForgeClient.registerItemRenderer(ModItems.gun_rpg, new ItemRenderRpg());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_karl, new ItemRenderRpg());
@ -1144,6 +1151,42 @@ public class ClientProxy extends ServerProxy {
Minecraft.getMinecraft().effectRenderer.addEffect(new ParticleRift(man, world, x, y, z));
}
if("anim".equals(type)) {
if("crucible".equals(data.getString("mode"))) {
BusAnimation animation = new BusAnimation()
.addBus("GUARD_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 0))
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 800))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50)));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
if("cSwing".equals(data.getString("mode"))) {
if(HbmAnimations.getRelevantTransformation("SWING_ROT")[0] == 0) {
int offset = rand.nextInt(80) - 20;
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90 - offset, 90 - offset, 35, 75))
.addKeyframe(new BusAnimationKeyframe(90 + offset, 90 - offset, -45, 150))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-3, 0, 0, 75))
.addKeyframe(new BusAnimationKeyframe(8, 0, 0, 150))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)));
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
}
}
}
@Override

View File

@ -32,6 +32,7 @@ import com.hbm.handler.BossSpawnHandler;
import com.hbm.handler.EntityEffectHandler;
import com.hbm.handler.RadiationWorldHandler;
import com.hbm.handler.HTTPHandler;
import com.hbm.items.IEquipReceiver;
import com.hbm.items.ModItems;
import com.hbm.items.armor.ArmorFSB;
import com.hbm.items.armor.ItemArmorMod;
@ -304,6 +305,12 @@ public class ModEventHandler
try {
prevArmor = (ItemStack[]) ReflectionHelper.findField(EntityLivingBase.class, "field_82180_bT", "previousEquipment").get(event.entityLiving);
} catch(Exception e) { }
if(event.entityLiving instanceof EntityPlayer && prevArmor != null && (prevArmor[0] == null || !ItemStack.areItemStacksEqual(prevArmor[0], event.entityLiving.getHeldItem()))
&& event.entityLiving.getHeldItem() != null && event.entityLiving.getHeldItem().getItem() instanceof IEquipReceiver) {
((IEquipReceiver)event.entityLiving.getHeldItem().getItem()).onEquip((EntityPlayer) event.entityLiving);
}
for(int i = 1; i < 5; i++) {

View File

@ -483,6 +483,7 @@ public class ResourceManager {
public static final IModelCustom stopsign = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/weapons/stopsign.obj"));
public static final IModelCustom pch = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/pch.obj"));
public static final IModelCustom gavel = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/gavel.obj"));
public static final IModelCustom crucible = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/crucible.obj"));
public static final IModelCustom brimstone = AdvancedModelLoader.loadModel(new ResourceLocation(RefStrings.MODID, "models/brimstone.obj"));
public static final IModelCustom hk69 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/hk69.obj"));
@ -520,6 +521,9 @@ public class ResourceManager {
public static final ResourceLocation gavel_lead = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/gavel_lead.png");
public static final ResourceLocation gavel_diamond = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/gavel_diamond.png");
public static final ResourceLocation gavel_mese = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/gavel_mese.png");
public static final ResourceLocation crucible_hilt = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/crucible_hilt.png");
public static final ResourceLocation crucible_guard = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/crucible_guard.png");
public static final ResourceLocation crucible_blade = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/crucible_blade.png");
public static final ResourceLocation brimstone_tex = new ResourceLocation(RefStrings.MODID, "textures/models/brimstone.png");
public static final ResourceLocation hk69_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/hk69.png");

View File

@ -0,0 +1,173 @@
package com.hbm.render.item.weapon;
import org.lwjgl.opengl.GL11;
import com.hbm.items.ModItems;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import cpw.mods.fml.relauncher.ReflectionHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
import net.minecraftforge.client.IItemRenderer.ItemRendererHelper;
public class ItemRenderCrucible implements IItemRenderer {
public ItemRenderCrucible() { }
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(type) {
case EQUIPPED:
case EQUIPPED_FIRST_PERSON:
case ENTITY:
case INVENTORY:
return true;
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION);
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
GL11.glShadeModel(GL11.GL_SMOOTH);
switch(type) {
case EQUIPPED_FIRST_PERSON:
GL11.glTranslated(1.5, -0.3, 0);
if(player.isBlocking()) {
GL11.glTranslated(-0.125, -0.25, 0);
}
player.isSwingInProgress = false;
GL11.glScaled(0.3, 0.3, 0.3);
GL11.glRotated(45, 0, 0, 1);
GL11.glRotated(90, 0, 1, 0);
if(!player.isBlocking()) {
double[] sRot = HbmAnimations.getRelevantTransformation("SWING_ROT");
double[] sTrans = HbmAnimations.getRelevantTransformation("SWING_TRANS");
GL11.glTranslated(sTrans[0], sTrans[1], sTrans[2]);
GL11.glRotated(sRot[0], 1, 0, 0);
GL11.glRotated(sRot[2], 0, 0, 1);
GL11.glRotated(sRot[1], 0, 1, 0);
}
double[] rot = HbmAnimations.getRelevantTransformation("GUARD_ROT");
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_hilt);
ResourceManager.crucible.renderPart("Hilt");
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_guard);
GL11.glPushMatrix();
if(rot[2] == 1) {
GL11.glTranslated(0, 3, 0.5);
GL11.glRotated(rot[0], -1, 0, 0);
GL11.glTranslated(0, -3, -0.5);
}
ResourceManager.crucible.renderPart("GuardLeft");
GL11.glPopMatrix();
GL11.glPushMatrix();
if(rot[2] == 1) {
GL11.glTranslated(0, 3, -0.5);
GL11.glRotated(rot[0], 1, 0, 0);
GL11.glTranslated(0, -3, 0.5);
}
ResourceManager.crucible.renderPart("GuardRight");
GL11.glPopMatrix();
float equippedProgress = ReflectionHelper.getPrivateValue(ItemRenderer.class, Minecraft.getMinecraft().entityRenderer.itemRenderer, "equippedProgress", "field_78454_c");
if(equippedProgress == 1.0F && rot[2] == 0) {
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
GL11.glTranslated(0.005, 0, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_blade);
ResourceManager.crucible.renderPart("Blade");
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
break;
case ENTITY:
GL11.glTranslated(-0.75, 0.6, 0);
GL11.glRotated(-45, 0, 0, 1);
case EQUIPPED:
GL11.glRotated(45, 0, 0, 1);
GL11.glTranslated(0.75, -0.4, 0);
GL11.glRotated(90, 0, 1, 0);
GL11.glScaled(0.15, 0.15, 0.15);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_hilt);
ResourceManager.crucible.renderPart("Hilt");
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_guard);
ResourceManager.crucible.renderPart("GuardLeft");
ResourceManager.crucible.renderPart("GuardRight");
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_CULL_FACE);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240F, 240F);
GL11.glTranslated(0.005, 0, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_blade);
ResourceManager.crucible.renderPart("Blade");
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopAttrib();
GL11.glPopMatrix();
break;
case INVENTORY:
GL11.glTranslated(2, 14, 0);
GL11.glRotated(-135, 0, 0, 1);
GL11.glRotated(90, 0, 1, 0);
double scale = 1.5D;
GL11.glScaled(scale, scale, scale);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_hilt);
ResourceManager.crucible.renderPart("Hilt");
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_guard);
ResourceManager.crucible.renderPart("GuardLeft");
ResourceManager.crucible.renderPart("GuardRight");
GL11.glTranslated(0.005, 0, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.crucible_blade);
ResourceManager.crucible.renderPart("Blade");
break;
default: break;
}
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}