mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-21 12:42:57 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -1,23 +1,24 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import tconstruct.library.weaponry.IAmmo;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.library.weaponry.IAmmo;
|
||||
|
||||
public class AmmoItemRenderer extends FlexibleToolRenderer {
|
||||
//public static FontRenderer fontRenderer;
|
||||
// public static FontRenderer fontRenderer;
|
||||
|
||||
public AmmoItemRenderer() {
|
||||
// super(true);
|
||||
//fontRenderer = new FontRenderer(Minecraft.getMinecraft().gameSettings, new ResourceLocation(Reference.RESOURCE, "textures/font/border_numbers.png"), Minecraft.getMinecraft().renderEngine, false);
|
||||
// super(true);
|
||||
// fontRenderer = new FontRenderer(Minecraft.getMinecraft().gameSettings, new
|
||||
// ResourceLocation(Reference.RESOURCE, "textures/font/border_numbers.png"),
|
||||
// Minecraft.getMinecraft().renderEngine, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if(type == ItemRenderType.INVENTORY)
|
||||
return true;
|
||||
if (type == ItemRenderType.INVENTORY) return true;
|
||||
|
||||
return super.handleRenderType(item, type);
|
||||
}
|
||||
@@ -26,19 +27,17 @@ public class AmmoItemRenderer extends FlexibleToolRenderer {
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
// render the item regularly
|
||||
super.renderItem(type, item, data);
|
||||
//RenderItem.getInstance().renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, item, 0,0);
|
||||
// RenderItem.getInstance().renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer,
|
||||
// Minecraft.getMinecraft().renderEngine, item, 0,0);
|
||||
|
||||
if(item.getTagCompound() == null || type != ItemRenderType.INVENTORY)
|
||||
return;
|
||||
if (item.getTagCompound() == null || type != ItemRenderType.INVENTORY) return;
|
||||
|
||||
// render custom stacksize
|
||||
renderAmmoCount(item);
|
||||
}
|
||||
|
||||
public void renderAmmoCount(ItemStack item)
|
||||
{
|
||||
if(!(item.getItem() instanceof IAmmo))
|
||||
return;
|
||||
public void renderAmmoCount(ItemStack item) {
|
||||
if (!(item.getItem() instanceof IAmmo)) return;
|
||||
int amount = ((IAmmo) item.getItem()).getAmmoCount(item);
|
||||
String str = String.valueOf(amount);
|
||||
|
||||
|
||||
@@ -25,186 +25,188 @@ import tconstruct.util.network.GogglePacket;
|
||||
|
||||
public class ArmorControls {
|
||||
|
||||
public static final String keybindCategory = "tconstruct.keybindings";
|
||||
public static final String[] keyDescs = new String[]{"key.tarmor", "key.tgoggles", "key.tbelt", "key.tzoom"};
|
||||
public static KeyBinding armorKey = new KeyBinding(keyDescs[0], 24, keybindCategory);
|
||||
public static KeyBinding toggleGoggles = new KeyBinding(keyDescs[1], 34, keybindCategory);
|
||||
public static KeyBinding beltSwap = new KeyBinding(keyDescs[2], 48, keybindCategory);
|
||||
public static KeyBinding zoomKey = new KeyBinding(keyDescs[3], 44, keybindCategory); //TODO: Make this hold, not toggle
|
||||
static KeyBinding jumpKey;
|
||||
static KeyBinding invKey;
|
||||
static Minecraft mc;
|
||||
public static final String keybindCategory = "tconstruct.keybindings";
|
||||
public static final String[] keyDescs = new String[] {"key.tarmor", "key.tgoggles", "key.tbelt", "key.tzoom"};
|
||||
public static KeyBinding armorKey = new KeyBinding(keyDescs[0], 24, keybindCategory);
|
||||
public static KeyBinding toggleGoggles = new KeyBinding(keyDescs[1], 34, keybindCategory);
|
||||
public static KeyBinding beltSwap = new KeyBinding(keyDescs[2], 48, keybindCategory);
|
||||
public static KeyBinding zoomKey =
|
||||
new KeyBinding(keyDescs[3], 44, keybindCategory); // TODO: Make this hold, not toggle
|
||||
static KeyBinding jumpKey;
|
||||
static KeyBinding invKey;
|
||||
static Minecraft mc;
|
||||
|
||||
boolean jumping;
|
||||
int midairJumps = 0;
|
||||
boolean climbing = false;
|
||||
boolean onGround = false;
|
||||
public static boolean zoom = false;
|
||||
boolean activeGoggles = false; //TODO: Set this on server login
|
||||
boolean jumping;
|
||||
int midairJumps = 0;
|
||||
boolean climbing = false;
|
||||
boolean onGround = false;
|
||||
public static boolean zoom = false;
|
||||
boolean activeGoggles = false; // TODO: Set this on server login
|
||||
|
||||
int currentTab = 1;
|
||||
// boolean onStilts = false;
|
||||
int currentTab = 1;
|
||||
// boolean onStilts = false;
|
||||
|
||||
private final KeyBinding[] keys;
|
||||
private final KeyBinding[] keys;
|
||||
|
||||
public ArmorControls() {
|
||||
getVanillaKeyBindings();
|
||||
keys = new KeyBinding[]{
|
||||
armorKey,
|
||||
toggleGoggles,
|
||||
beltSwap,
|
||||
zoomKey,
|
||||
null, null
|
||||
};
|
||||
}
|
||||
public ArmorControls() {
|
||||
getVanillaKeyBindings();
|
||||
keys = new KeyBinding[] {armorKey, toggleGoggles, beltSwap, zoomKey, null, null};
|
||||
}
|
||||
|
||||
public void registerKeys() {
|
||||
// Register bindings
|
||||
for (KeyBinding key : keys) {
|
||||
if (key != null) {
|
||||
ClientRegistry.registerKeyBinding(key);
|
||||
}
|
||||
}
|
||||
if (Loader.isModLoaded("notenoughkeys")) {
|
||||
Api.registerMod(TConstruct.modID, keyDescs);
|
||||
}
|
||||
// Add mc keys
|
||||
keys[4] = jumpKey;
|
||||
keys[5] = invKey;
|
||||
}
|
||||
public void registerKeys() {
|
||||
// Register bindings
|
||||
for (KeyBinding key : keys) {
|
||||
if (key != null) {
|
||||
ClientRegistry.registerKeyBinding(key);
|
||||
}
|
||||
}
|
||||
if (Loader.isModLoaded("notenoughkeys")) {
|
||||
Api.registerMod(TConstruct.modID, keyDescs);
|
||||
}
|
||||
// Add mc keys
|
||||
keys[4] = jumpKey;
|
||||
keys[5] = invKey;
|
||||
}
|
||||
|
||||
private static void getVanillaKeyBindings() {
|
||||
mc = Minecraft.getMinecraft();
|
||||
jumpKey = mc.gameSettings.keyBindJump;
|
||||
invKey = mc.gameSettings.keyBindInventory;
|
||||
}
|
||||
private static void getVanillaKeyBindings() {
|
||||
mc = Minecraft.getMinecraft();
|
||||
jumpKey = mc.gameSettings.keyBindJump;
|
||||
invKey = mc.gameSettings.keyBindInventory;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
if (!Loader.isModLoaded("notenoughkeys")) {
|
||||
checkAndPerformKeyActions(null, false);
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
if (!Loader.isModLoaded("notenoughkeys")) {
|
||||
checkAndPerformKeyActions(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "notenoughkeys")
|
||||
@SubscribeEvent
|
||||
public void keyEventSpecial(KeyBindingPressedEvent event) {
|
||||
if (event.keyBinding != null && event.isKeyBindingPressed) {
|
||||
checkAndPerformKeyActions(event.keyBinding, true);
|
||||
}
|
||||
}
|
||||
@Optional.Method(modid = "notenoughkeys")
|
||||
@SubscribeEvent
|
||||
public void keyEventSpecial(KeyBindingPressedEvent event) {
|
||||
if (event.keyBinding != null && event.isKeyBindingPressed) {
|
||||
checkAndPerformKeyActions(event.keyBinding, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndPerformKeyActions(KeyBinding keyBinding, boolean inputFromNotEnoughKeys) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == armorKey : armorKey.isPressed()) {
|
||||
openArmorGui();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == jumpKey : jumpKey.isPressed()) {
|
||||
performHigherJump();
|
||||
return;
|
||||
}
|
||||
if (mc.currentScreen == null) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == toggleGoggles : toggleGoggles.isPressed()) {
|
||||
checkAndToggleNightVision();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == beltSwap : beltSwap.isPressed()) {
|
||||
doBeltSwapIfPossible();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == zoomKey : zoomKey.isPressed()) {
|
||||
zoom = !zoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkAndPerformKeyActions(KeyBinding keyBinding, boolean inputFromNotEnoughKeys) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == armorKey : armorKey.isPressed()) {
|
||||
openArmorGui();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == jumpKey : jumpKey.isPressed()) {
|
||||
performHigherJump();
|
||||
return;
|
||||
}
|
||||
if (mc.currentScreen == null) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == toggleGoggles : toggleGoggles.isPressed()) {
|
||||
checkAndToggleNightVision();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == beltSwap : beltSwap.isPressed()) {
|
||||
doBeltSwapIfPossible();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == zoomKey : zoomKey.isPressed()) {
|
||||
zoom = !zoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void performHigherJump() {
|
||||
if (mc.thePlayer.capabilities.isCreativeMode) {
|
||||
return;
|
||||
}
|
||||
if (jumping && midairJumps > 0) {
|
||||
mc.thePlayer.motionY = 0.42D;
|
||||
mc.thePlayer.fallDistance = 0;
|
||||
if (mc.thePlayer.isPotionActive(Potion.jump)) {
|
||||
mc.thePlayer.motionY += (float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
|
||||
}
|
||||
midairJumps--;
|
||||
resetFallDamage();
|
||||
}
|
||||
if (!jumping) {
|
||||
jumping = mc.thePlayer.isAirBorne;
|
||||
ItemStack shoes = mc.thePlayer.getCurrentArmor(0);
|
||||
if (shoes != null && shoes.hasTagCompound() && shoes.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = shoes.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
ItemStack wings = mc.thePlayer.getCurrentArmor(1);
|
||||
if (wings != null && wings.hasTagCompound() && wings.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = wings.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void performHigherJump() {
|
||||
if (mc.thePlayer.capabilities.isCreativeMode) {
|
||||
return;
|
||||
}
|
||||
if (jumping && midairJumps > 0) {
|
||||
mc.thePlayer.motionY = 0.42D;
|
||||
mc.thePlayer.fallDistance = 0;
|
||||
if (mc.thePlayer.isPotionActive(Potion.jump)) {
|
||||
mc.thePlayer.motionY +=
|
||||
(float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
|
||||
}
|
||||
midairJumps--;
|
||||
resetFallDamage();
|
||||
}
|
||||
if (!jumping) {
|
||||
jumping = mc.thePlayer.isAirBorne;
|
||||
ItemStack shoes = mc.thePlayer.getCurrentArmor(0);
|
||||
if (shoes != null
|
||||
&& shoes.hasTagCompound()
|
||||
&& shoes.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = shoes.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
ItemStack wings = mc.thePlayer.getCurrentArmor(1);
|
||||
if (wings != null
|
||||
&& wings.hasTagCompound()
|
||||
&& wings.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = wings.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndToggleNightVision() {
|
||||
ItemStack goggles = mc.thePlayer.getCurrentArmor(3);
|
||||
if (goggles != null && goggles.getItem() instanceof TravelGear) { // TODO: Genericize this
|
||||
if (goggles.hasTagCompound() && goggles.getTagCompound().getCompoundTag(((TravelGear) goggles.getItem()).getBaseTagName()).getBoolean("Night Vision")) {
|
||||
activeGoggles = !activeGoggles;
|
||||
PlayerAbilityHelper.toggleGoggles(mc.thePlayer, activeGoggles);
|
||||
toggleGoggles();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkAndToggleNightVision() {
|
||||
ItemStack goggles = mc.thePlayer.getCurrentArmor(3);
|
||||
if (goggles != null && goggles.getItem() instanceof TravelGear) { // TODO: Genericize this
|
||||
if (goggles.hasTagCompound()
|
||||
&& goggles.getTagCompound()
|
||||
.getCompoundTag(((TravelGear) goggles.getItem()).getBaseTagName())
|
||||
.getBoolean("Night Vision")) {
|
||||
activeGoggles = !activeGoggles;
|
||||
PlayerAbilityHelper.toggleGoggles(mc.thePlayer, activeGoggles);
|
||||
toggleGoggles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean doBeltSwapIfPossible() {
|
||||
if (ArmorProxyClient.armorExtended.inventory[3] != null) {
|
||||
PlayerAbilityHelper.swapBelt(mc.thePlayer, ArmorProxyClient.armorExtended);
|
||||
toggleBelt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean doBeltSwapIfPossible() {
|
||||
if (ArmorProxyClient.armorExtended.inventory[3] != null) {
|
||||
PlayerAbilityHelper.swapBelt(mc.thePlayer, ArmorProxyClient.armorExtended);
|
||||
toggleBelt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void landOnGround() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
}
|
||||
public void landOnGround() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
}
|
||||
|
||||
public void resetControls() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
climbing = false;
|
||||
onGround = false;
|
||||
}
|
||||
public void resetControls() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
climbing = false;
|
||||
onGround = false;
|
||||
}
|
||||
|
||||
void resetFallDamage() {
|
||||
AbstractPacket packet = new DoubleJumpPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
void resetFallDamage() {
|
||||
AbstractPacket packet = new DoubleJumpPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
public static void openArmorGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.armorGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
public static void openArmorGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.armorGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
public static void openKnapsackGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.knapsackGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
public static void openKnapsackGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.knapsackGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
private void toggleGoggles() {
|
||||
AbstractPacket packet = new GogglePacket(activeGoggles);
|
||||
updateServer(packet);
|
||||
}
|
||||
private void toggleGoggles() {
|
||||
AbstractPacket packet = new GogglePacket(activeGoggles);
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
private static void toggleBelt() {
|
||||
AbstractPacket packet = new BeltPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
static void updateServer(AbstractPacket abstractPacket) {
|
||||
TConstruct.packetPipeline.sendToServer(abstractPacket);
|
||||
}
|
||||
private static void toggleBelt() {
|
||||
AbstractPacket packet = new BeltPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
static void updateServer(AbstractPacket abstractPacket) {
|
||||
TConstruct.packetPipeline.sendToServer(abstractPacket);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -8,15 +8,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class BreakingFX extends EntityFX
|
||||
{
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item)
|
||||
{
|
||||
public class BreakingFX extends EntityFX {
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item) {
|
||||
this(par1World, par2, par4, par6, par8Item, 0);
|
||||
}
|
||||
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item, int par9)
|
||||
{
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item, int par9) {
|
||||
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
||||
this.setParticleIcon(par8Item.getIconFromDamage(par9));
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||
@@ -24,8 +21,16 @@ public class BreakingFX extends EntityFX
|
||||
this.particleScale /= 2.0F;
|
||||
}
|
||||
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Item par14Item, int par15)
|
||||
{
|
||||
public BreakingFX(
|
||||
World par1World,
|
||||
double par2,
|
||||
double par4,
|
||||
double par6,
|
||||
double par8,
|
||||
double par10,
|
||||
double par12,
|
||||
Item par14Item,
|
||||
int par15) {
|
||||
this(par1World, par2, par4, par6, par14Item, par15);
|
||||
this.motionX *= 0.10000000149011612D;
|
||||
this.motionY *= 0.10000000149011612D;
|
||||
@@ -36,22 +41,20 @@ public class BreakingFX extends EntityFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer ()
|
||||
{
|
||||
public int getFXLayer() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle (Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
public void renderParticle(
|
||||
Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
|
||||
float f6 = ((float) this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
|
||||
float f7 = f6 + 0.015609375F;
|
||||
float f8 = ((float) this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
|
||||
float f9 = f8 + 0.015609375F;
|
||||
float f10 = 0.1F * this.particleScale;
|
||||
|
||||
if (this.particleIcon != null)
|
||||
{
|
||||
if (this.particleIcon != null) {
|
||||
f6 = this.particleIcon.getInterpolatedU((double) (this.particleTextureJitterX / 4.0F * 16.0F));
|
||||
f7 = this.particleIcon.getInterpolatedU((double) ((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
|
||||
f8 = this.particleIcon.getInterpolatedV((double) (this.particleTextureJitterY / 4.0F * 16.0F));
|
||||
@@ -63,9 +66,29 @@ public class BreakingFX extends EntityFX
|
||||
float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ);
|
||||
float f14 = 1.0F;
|
||||
par1Tessellator.setColorOpaque_F(f14 * this.particleRed, f14 * this.particleGreen, f14 * this.particleBlue);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 - par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 - par5 * f10 - par7 * f10), (double) f6, (double) f9);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 - par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 - par5 * f10 + par7 * f10), (double) f6, (double) f8);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 + par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 + par5 * f10 + par7 * f10), (double) f7, (double) f8);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 + par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 + par5 * f10 - par7 * f10), (double) f7, (double) f9);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 - par3 * f10 - par6 * f10),
|
||||
(double) (f12 - par4 * f10),
|
||||
(double) (f13 - par5 * f10 - par7 * f10),
|
||||
(double) f6,
|
||||
(double) f9);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 - par3 * f10 + par6 * f10),
|
||||
(double) (f12 + par4 * f10),
|
||||
(double) (f13 - par5 * f10 + par7 * f10),
|
||||
(double) f6,
|
||||
(double) f8);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 + par3 * f10 + par6 * f10),
|
||||
(double) (f12 + par4 * f10),
|
||||
(double) (f13 + par5 * f10 + par7 * f10),
|
||||
(double) f7,
|
||||
(double) f8);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 + par3 * f10 - par6 * f10),
|
||||
(double) (f12 - par4 * f10),
|
||||
(double) (f13 + par5 * f10 - par7 * f10),
|
||||
(double) f7,
|
||||
(double) f9);
|
||||
}
|
||||
}
|
||||
@@ -11,64 +11,52 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
public class CustomBowRenderer implements IItemRenderer
|
||||
{
|
||||
public class CustomBowRenderer implements IItemRenderer {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private RenderBlocks renderBlocksInstance = new RenderBlocks();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
EntityLivingBase living = (EntityLivingBase) data[1];
|
||||
ItemRenderer renderer = RenderManager.instance.itemRenderer;
|
||||
for (int i = 0; i < item.getItem().getRenderPasses(item.getItemDamage()) + 1; i++)
|
||||
renderItem(living, item, i, type);
|
||||
}
|
||||
|
||||
public void renderItem (EntityLivingBase living, ItemStack stack, int renderPass, ItemRenderType type)
|
||||
{
|
||||
public void renderItem(EntityLivingBase living, ItemStack stack, int renderPass, ItemRenderType type) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
IIcon icon = null;
|
||||
if (living instanceof EntityPlayer)
|
||||
{
|
||||
if (living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
if (player.getItemInUse() != null)
|
||||
icon = stack.getItem().getIcon(stack, renderPass, player, player.getItemInUse(), player.getItemInUseCount());
|
||||
else
|
||||
icon = living.getItemIcon(stack, renderPass);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = stack.getItem()
|
||||
.getIcon(stack, renderPass, player, player.getItemInUse(), player.getItemInUseCount());
|
||||
else icon = living.getItemIcon(stack, renderPass);
|
||||
} else {
|
||||
icon = living.getItemIcon(stack, renderPass);
|
||||
}
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
if (icon == null) {
|
||||
GL11.glPopMatrix();
|
||||
return;
|
||||
}
|
||||
TextureManager texturemanager = this.mc.getTextureManager();
|
||||
texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber()));
|
||||
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0.6F, 0.5F, 0.5F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glRotatef(180.0F, 0F, 0F, 1.0F);
|
||||
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.75F);
|
||||
GL11.glTranslatef(-0.6F, -0.25F, 1.0F);
|
||||
@@ -95,5 +83,4 @@ public class CustomBowRenderer implements IItemRenderer
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,14 +10,13 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author TheObliterator
|
||||
*
|
||||
*
|
||||
* A class to create and draw true type fonts onto the Minecraft game
|
||||
* engine.
|
||||
*/
|
||||
public class CustomFont
|
||||
{
|
||||
public class CustomFont {
|
||||
private int texID;
|
||||
private int[] xPos;
|
||||
private int[] yPos;
|
||||
@@ -28,9 +27,9 @@ public class CustomFont
|
||||
/**
|
||||
* Instantiates the font, filling in default start and end character
|
||||
* parameters.
|
||||
*
|
||||
*
|
||||
* 'new CustomFont(ModLoader.getMinecraftInstance(), "Arial", 12);
|
||||
*
|
||||
*
|
||||
* @param mc
|
||||
* The Minecraft instance for the font to be bound to.
|
||||
* @param fontName
|
||||
@@ -38,8 +37,7 @@ public class CustomFont
|
||||
* @param size
|
||||
* The size of the font to be drawn.
|
||||
*/
|
||||
public CustomFont(Minecraft mc, Object font, int size)
|
||||
{
|
||||
public CustomFont(Minecraft mc, Object font, int size) {
|
||||
this(mc, font, size, 0, 4000);
|
||||
}
|
||||
|
||||
@@ -47,9 +45,9 @@ public class CustomFont
|
||||
* Instantiates the font, pre-rendering a sprite font image by using a true
|
||||
* type font on a bitmap. Then allocating that bitmap to the Minecraft
|
||||
* rendering engine for later use.
|
||||
*
|
||||
*
|
||||
* 'new CustomFont(ModLoader.getMinecraftInstance(), "Arial", 12, 32, 126);'
|
||||
*
|
||||
*
|
||||
* @param mc
|
||||
* The Minecraft instance for the font to be bound to.
|
||||
* @param fontName
|
||||
@@ -61,8 +59,7 @@ public class CustomFont
|
||||
* @param endChar
|
||||
* The ending ASCII character id to be drawable. (Default 126)
|
||||
*/
|
||||
public CustomFont(Minecraft mc, Object font, int size, int startChar, int endChar)
|
||||
{
|
||||
public CustomFont(Minecraft mc, Object font, int size, int startChar, int endChar) {
|
||||
this.startChar = startChar;
|
||||
this.endChar = endChar;
|
||||
xPos = new int[endChar - startChar];
|
||||
@@ -74,27 +71,20 @@ public class CustomFont
|
||||
// it is not the Minecraft engine will not draw it properly.
|
||||
BufferedImage img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics g = img.getGraphics();
|
||||
try
|
||||
{
|
||||
if (font instanceof String)
|
||||
{
|
||||
try {
|
||||
if (font instanceof String) {
|
||||
String fontName = (String) font;
|
||||
if (fontName.contains("/"))
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, new File(fontName)).deriveFont((float) size));
|
||||
else
|
||||
g.setFont(new Font(fontName, 0, size));
|
||||
}
|
||||
else if (font instanceof InputStream)
|
||||
{
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (InputStream) font).deriveFont((float) size));
|
||||
}
|
||||
else if (font instanceof File)
|
||||
{
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, new File(fontName))
|
||||
.deriveFont((float) size));
|
||||
else g.setFont(new Font(fontName, 0, size));
|
||||
} else if (font instanceof InputStream) {
|
||||
g.setFont(
|
||||
Font.createFont(Font.TRUETYPE_FONT, (InputStream) font).deriveFont((float) size));
|
||||
} else if (font instanceof File) {
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (File) font).deriveFont((float) size));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -110,14 +100,12 @@ public class CustomFont
|
||||
// later when drawing.
|
||||
int x = 2;
|
||||
int y = 2;
|
||||
for (int i = startChar; i < endChar; i++)
|
||||
{
|
||||
for (int i = startChar; i < endChar; i++) {
|
||||
g.drawString("" + ((char) i), x, y + g.getFontMetrics().getAscent());
|
||||
xPos[i - startChar] = x;
|
||||
yPos[i - startChar] = y - metrics.getMaxDescent();
|
||||
x += metrics.stringWidth("" + (char) i) + 2;
|
||||
if (x >= 250 - metrics.getMaxAdvance())
|
||||
{
|
||||
if (x >= 250 - metrics.getMaxAdvance()) {
|
||||
x = 2;
|
||||
y += metrics.getMaxAscent() + metrics.getMaxDescent() + size / 2;
|
||||
}
|
||||
@@ -131,7 +119,7 @@ public class CustomFont
|
||||
|
||||
/**
|
||||
* Draws a given string with an automatically calculated shadow below it.
|
||||
*
|
||||
*
|
||||
* @param gui
|
||||
* The gui/subclass to be drawn on
|
||||
* @param text
|
||||
@@ -143,8 +131,7 @@ public class CustomFont
|
||||
* @param color
|
||||
* The color of the non-shadowed text (Hex)
|
||||
*/
|
||||
public void drawStringS (Gui gui, String text, int x, int y, int color)
|
||||
{
|
||||
public void drawStringS(Gui gui, String text, int x, int y, int color) {
|
||||
int l = color & 0xff000000;
|
||||
int shade = (color & 0xfcfcfc) >> 2;
|
||||
shade += l;
|
||||
@@ -154,7 +141,7 @@ public class CustomFont
|
||||
|
||||
/**
|
||||
* Draws a given string onto a gui/subclass.
|
||||
*
|
||||
*
|
||||
* @param gui
|
||||
* The gui/subclass to be drawn on
|
||||
* @param text
|
||||
@@ -166,8 +153,7 @@ public class CustomFont
|
||||
* @param color
|
||||
* The color of the non-shadowed text (Hex)
|
||||
*/
|
||||
public void drawString (Gui gui, String text, int x, int y, int color)
|
||||
{
|
||||
public void drawString(Gui gui, String text, int x, int y, int color) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(3553 /* GL_TEXTURE_2D */);
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, texID);
|
||||
@@ -177,14 +163,11 @@ public class CustomFont
|
||||
float alpha = (float) (color >> 24 & 0xff) / 255F;
|
||||
GL11.glColor4f(red, green, blue, alpha);
|
||||
int startX = x;
|
||||
for (int i = 0; i < text.length(); i++)
|
||||
{
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
if (c == '\\')
|
||||
{
|
||||
if (c == '\\') {
|
||||
char type = text.charAt(i + 1);
|
||||
if (type == 'n')
|
||||
{
|
||||
if (type == 'n') {
|
||||
y += metrics.getAscent() + 2;
|
||||
x = startX;
|
||||
}
|
||||
@@ -199,64 +182,56 @@ public class CustomFont
|
||||
/**
|
||||
* Returns the created FontMetrics which is used to retrive various
|
||||
* information about the True Type Font
|
||||
*
|
||||
*
|
||||
* @return FontMetrics of the created font.
|
||||
*/
|
||||
public FontMetrics getMetrics ()
|
||||
{
|
||||
public FontMetrics getMetrics() {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the drawing width of a given string of string.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* The string to be measured
|
||||
* @return The width of the given string.
|
||||
*/
|
||||
public int getStringWidth (String text)
|
||||
{
|
||||
public int getStringWidth(String text) {
|
||||
return (int) getBounds(text).getWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the drawing height of a given string of string.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* The string to be measured
|
||||
* @return The height of the given string.
|
||||
*/
|
||||
public int getStringHeight (String text)
|
||||
{
|
||||
public int getStringHeight(String text) {
|
||||
return (int) getBounds(text).getHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns a Rectangle that contains the width and height
|
||||
* demensions of the given string.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* The string to be measured
|
||||
* @return Rectangle containing width and height that the text will consume
|
||||
* when drawn.
|
||||
*/
|
||||
private Rectangle getBounds (String text)
|
||||
{
|
||||
private Rectangle getBounds(String text) {
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
int tw = 0;
|
||||
for (int i = 0; i < text.length(); i++)
|
||||
{
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
if (c == '\\')
|
||||
{
|
||||
if (c == '\\') {
|
||||
char type = text.charAt(i + 1);
|
||||
|
||||
if (type == 'n')
|
||||
{
|
||||
if (type == 'n') {
|
||||
h += metrics.getAscent() + 2;
|
||||
if (tw > w)
|
||||
w = tw;
|
||||
if (tw > w) w = tw;
|
||||
tw = 0;
|
||||
}
|
||||
i++;
|
||||
@@ -264,8 +239,7 @@ public class CustomFont
|
||||
}
|
||||
tw += metrics.stringWidth("" + c);
|
||||
}
|
||||
if (tw > w)
|
||||
w = tw;
|
||||
if (tw > w) w = tw;
|
||||
h += metrics.getAscent();
|
||||
return new Rectangle(0, 0, w, h);
|
||||
}
|
||||
@@ -273,22 +247,27 @@ public class CustomFont
|
||||
/**
|
||||
* Private drawing method used within other drawing methods.
|
||||
*/
|
||||
private void drawChar (Gui gui, char c, int x, int y)
|
||||
{
|
||||
private void drawChar(Gui gui, char c, int x, int y) {
|
||||
Rectangle2D bounds = metrics.getStringBounds("" + c, null);
|
||||
drawTexturedModalRect(x, y, xPos[(byte) c - startChar], yPos[(byte) c - startChar], (int) bounds.getWidth(), (int) bounds.getHeight() + metrics.getMaxDescent());
|
||||
drawTexturedModalRect(
|
||||
x,
|
||||
y,
|
||||
xPos[(byte) c - startChar],
|
||||
yPos[(byte) c - startChar],
|
||||
(int) bounds.getWidth(),
|
||||
(int) bounds.getHeight() + metrics.getMaxDescent());
|
||||
}
|
||||
|
||||
public void drawTexturedModalRect (int x, int y, int u, int v, int width, int height)
|
||||
{
|
||||
public void drawTexturedModalRect(int x, int y, int u, int v, int width, int height) {
|
||||
float offsetWidth = 0.00390625F;
|
||||
float offsetHeight = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((x + 0), (y + height), 0, ((u + 0) * offsetWidth), ((v + height) * offsetHeight));
|
||||
tessellator.addVertexWithUV((x + width), (y + height), 0, ((u + width) * offsetWidth), ((v + height) * offsetHeight));
|
||||
tessellator.addVertexWithUV(
|
||||
(x + width), (y + height), 0, ((u + width) * offsetWidth), ((v + height) * offsetHeight));
|
||||
tessellator.addVertexWithUV((x + width), (y + 0), 0, ((u + width) * offsetWidth), ((v + 0) * offsetHeight));
|
||||
tessellator.addVertexWithUV((x + 0), (y + 0), 0, ((u + 0) * offsetWidth), ((v + 0) * offsetHeight));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,23 +12,22 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class FlexibleToolRenderer implements IItemRenderer {
|
||||
public float depth = 1/32f;
|
||||
public float depth = 1 / 32f;
|
||||
|
||||
public void setDepth(float d) { depth = d; }
|
||||
public void setDepth(float d) {
|
||||
depth = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
if(!item.hasTagCompound())
|
||||
return false;
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if (!item.hasTagCompound()) return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
//GL11.glTranslatef(-0.0625F, -0.0625F, 0F);
|
||||
// GL11.glTranslatef(-0.0625F, -0.0625F, 0F);
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
//GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
// GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
@@ -41,8 +40,7 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return handleRenderType(item, type) & helper.ordinal() < ItemRendererHelper.EQUIPPED_BLOCK.ordinal();
|
||||
}
|
||||
|
||||
@@ -51,13 +49,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
protected void specialAnimation(ItemRenderType type, ItemStack item) {}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data) {
|
||||
if(item == null || item.getItem() == null || !(item.getItem() instanceof ToolCore))
|
||||
return;
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
if (item == null || item.getItem() == null || !(item.getItem() instanceof ToolCore)) return;
|
||||
|
||||
Entity ent = null;
|
||||
if (data.length > 1)
|
||||
ent = (Entity) data[1];
|
||||
if (data.length > 1) ent = (Entity) data[1];
|
||||
|
||||
IIcon[] parts = new IIcon[toolIcons];
|
||||
int iconParts = getIcons(item, type, ent, parts);
|
||||
@@ -80,8 +76,7 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
float[] yDiff = new float[iconParts];
|
||||
float[] xSub = new float[iconParts];
|
||||
float[] ySub = new float[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon icon = parts[i];
|
||||
xMin[i] = icon.getMinU();
|
||||
xMax[i] = icon.getMaxU();
|
||||
@@ -98,22 +93,18 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
if(type != ItemRenderType.ENTITY) {
|
||||
if (type != ItemRenderType.ENTITY) {
|
||||
specialAnimation(type, item);
|
||||
}
|
||||
else
|
||||
GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft.
|
||||
} else GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft.
|
||||
|
||||
// prepare colors
|
||||
int[] color = new int[iconParts];
|
||||
for(int i = 0; i < iconParts; i++)
|
||||
color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
for (int i = 0; i < iconParts; i++) color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
|
||||
// one side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, 1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 0, +depth, xMax[i], yMax[i]);
|
||||
tess.addVertexWithUV(1, 0, +depth, xMin[i], yMax[i]);
|
||||
@@ -125,8 +116,7 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
// other side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, -1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]);
|
||||
tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]);
|
||||
@@ -141,12 +131,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
float pos;
|
||||
float iconPos;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
for (int k = 0, e = (int)w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]);
|
||||
@@ -161,13 +149,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
tess.setNormal(1, 0, 0);
|
||||
float posEnd;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
float d2 = 1f / w;
|
||||
for (int k = 0, e = (int)w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -182,13 +168,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
float d2 = 1f / h;
|
||||
for (int k = 0, e = (int)h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -203,12 +187,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, -1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
for (int k = 0, e = (int)h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(1, pos, +depth, xMin[i], iconPos);
|
||||
@@ -223,21 +205,19 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderInventory(int count, IIcon[] icons, ItemStack item)
|
||||
{
|
||||
public void renderInventory(int count, IIcon[] icons, ItemStack item) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);
|
||||
//GL11.glDisable(GL11.GL_BLEND);
|
||||
// GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
tess.startDrawingQuads();
|
||||
|
||||
// draw a simple rectangle for the inventory icon
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
for (int i = 0; i < count; ++i) {
|
||||
tess.setColorOpaque_I(item.getItem().getColorFromItemStack(item, i));
|
||||
|
||||
final IIcon icon = icons[i];
|
||||
@@ -245,23 +225,22 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
final float xmax = icon.getMaxU();
|
||||
final float ymin = icon.getMinV();
|
||||
final float ymax = icon.getMaxV();
|
||||
tess.addVertexWithUV( 0, 16, 0, xmin, ymax);
|
||||
tess.addVertexWithUV(0, 16, 0, xmin, ymax);
|
||||
tess.addVertexWithUV(16, 16, 0, xmax, ymax);
|
||||
tess.addVertexWithUV(16, 0, 0, xmax, ymin);
|
||||
tess.addVertexWithUV( 0, 0, 0, xmin, ymin);
|
||||
tess.addVertexWithUV(16, 0, 0, xmax, ymin);
|
||||
tess.addVertexWithUV(0, 0, 0, xmin, ymin);
|
||||
}
|
||||
tess.draw();
|
||||
|
||||
//GL11.glEnable(GL11.GL_BLEND);
|
||||
// GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public int getIcons(ItemStack item, ItemRenderType type, Entity ent, IIcon[] parts)
|
||||
{
|
||||
int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage());
|
||||
public int getIcons(ItemStack item, ItemRenderType type, Entity ent, IIcon[] parts) {
|
||||
int iconParts = toolIcons; // tool.getRenderPasses(item.getItemDamage());
|
||||
// TODO: have the tools define how many render passes they have
|
||||
// (requires more logic rewrite than it sounds like)
|
||||
|
||||
@@ -271,35 +250,28 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
IIcon[] tempParts = new IIcon[iconParts];
|
||||
label:
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer)
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) ent;
|
||||
ItemStack itemInUse = player.getItemInUse();
|
||||
if (itemInUse != null)
|
||||
{
|
||||
if (itemInUse != null) {
|
||||
int useCount = player.getItemInUseCount();
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
for (int i = iconParts; i-- > 0; )
|
||||
tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount);
|
||||
break label;
|
||||
}
|
||||
}
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
tempParts[i] = tool.getIcon(item, i);
|
||||
for (int i = iconParts; i-- > 0; ) tempParts[i] = tool.getIcon(item, i);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon part = tempParts[i];
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon)
|
||||
++count;
|
||||
else
|
||||
parts[i - count] = part;
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) ++count;
|
||||
else parts[i - count] = part;
|
||||
}
|
||||
iconParts -= count;
|
||||
|
||||
if (iconParts <= 0)
|
||||
{
|
||||
if (iconParts <= 0) {
|
||||
iconParts = 1;
|
||||
parts[0] = ToolCore.blankSprite;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@ public class IconFlipped extends net.minecraft.client.renderer.IconFlipped {
|
||||
}
|
||||
|
||||
// has a faulty implementation in original class
|
||||
public float getMinV()
|
||||
{
|
||||
public float getMinV() {
|
||||
return this.flipV ? this.baseIcon.getMaxV() : this.baseIcon.getMinV();
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,9 @@ package tconstruct.client;
|
||||
|
||||
import net.minecraft.block.Block.SoundType;
|
||||
|
||||
public class StepSoundSlime extends SoundType
|
||||
{
|
||||
public class StepSoundSlime extends SoundType {
|
||||
|
||||
public StepSoundSlime(String par1Str, float par2, float par3)
|
||||
{
|
||||
public StepSoundSlime(String par1Str, float par2, float par3) {
|
||||
super(par1Str, par2, par3);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
@@ -15,8 +13,7 @@ public class StepSoundSlime extends SoundType
|
||||
* Used when a block breaks, EXA: Player break, Shep eating grass, etc..
|
||||
*/
|
||||
@Override
|
||||
public String getBreakSound ()
|
||||
{
|
||||
public String getBreakSound() {
|
||||
return this.soundName + ".big";
|
||||
}
|
||||
|
||||
@@ -24,9 +21,7 @@ public class StepSoundSlime extends SoundType
|
||||
* Used when a entity walks over, or otherwise interacts with the block.
|
||||
*/
|
||||
@Override
|
||||
public String getStepResourcePath ()
|
||||
{
|
||||
public String getStepResourcePath() {
|
||||
return this.soundName + ".small";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package tconstruct.client;
|
||||
import java.io.InputStream;
|
||||
import java.text.DecimalFormat;
|
||||
import javax.xml.parsers.*;
|
||||
|
||||
import mantle.client.SmallFontRenderer;
|
||||
import mantle.lib.client.MantleClientRegistry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -35,7 +34,8 @@ public class TProxyClient extends TProxyCommon {
|
||||
/* Registers any rendering code. */
|
||||
public void registerRenderer() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, false);
|
||||
smallFontRenderer = new SmallFontRenderer(
|
||||
mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, false);
|
||||
}
|
||||
|
||||
public static Document diary;
|
||||
@@ -47,7 +47,10 @@ public class TProxyClient extends TProxyCommon {
|
||||
|
||||
public void readManuals() {
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
String CurrentLanguage = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
|
||||
String CurrentLanguage = Minecraft.getMinecraft()
|
||||
.getLanguageManager()
|
||||
.getCurrentLanguage()
|
||||
.getLanguageCode();
|
||||
|
||||
Document diary_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/diary.xml", dbFactory);
|
||||
Document volume1_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/firstday.xml", dbFactory);
|
||||
@@ -59,7 +62,8 @@ public class TProxyClient extends TProxyCommon {
|
||||
volume1 = volume1_cl != null ? volume1_cl : readManual("/assets/tinker/manuals/en_US/firstday.xml", dbFactory);
|
||||
volume2 = volume2_cl != null ? volume2_cl : readManual("/assets/tinker/manuals/en_US/materials.xml", dbFactory);
|
||||
smelter = smelter_cl != null ? smelter_cl : readManual("/assets/tinker/manuals/en_US/smeltery.xml", dbFactory);
|
||||
weaponry = weaponry_cl != null ? weaponry_cl : readManual("/assets/tinker/manuals/en_US/weaponry.xml", dbFactory);
|
||||
weaponry =
|
||||
weaponry_cl != null ? weaponry_cl : readManual("/assets/tinker/manuals/en_US/weaponry.xml", dbFactory);
|
||||
|
||||
initManualIcons();
|
||||
initManualRecipes();
|
||||
@@ -96,12 +100,9 @@ public class TProxyClient extends TProxyCommon {
|
||||
MantleClientRegistry.registerManualIcon("netherrack", new ItemStack(Blocks.netherrack));
|
||||
}
|
||||
|
||||
public void initManualRecipes() {
|
||||
}
|
||||
public void initManualRecipes() {}
|
||||
|
||||
void initManualPages() {
|
||||
|
||||
}
|
||||
void initManualPages() {}
|
||||
|
||||
public static Document getManualFromStack(ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
@@ -121,5 +122,4 @@ public class TProxyClient extends TProxyCommon {
|
||||
public void recalculateHealth() {
|
||||
ArmorProxyClient.armorExtended.recalculateHealth(mc.thePlayer, TPlayerStats.get(mc.thePlayer));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -14,105 +10,88 @@ import org.lwjgl.opengl.*;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ToolCoreRenderer implements IItemRenderer
|
||||
{
|
||||
public class ToolCoreRenderer implements IItemRenderer {
|
||||
private final boolean isEntity;
|
||||
private final boolean noEntityTranslation;
|
||||
|
||||
public ToolCoreRenderer()
|
||||
{
|
||||
public ToolCoreRenderer() {
|
||||
this(false, false);
|
||||
}
|
||||
|
||||
public ToolCoreRenderer(boolean isEntity)
|
||||
{
|
||||
public ToolCoreRenderer(boolean isEntity) {
|
||||
this(isEntity, false);
|
||||
}
|
||||
|
||||
public ToolCoreRenderer(boolean isEntity, boolean noEntityTranslation)
|
||||
{
|
||||
public ToolCoreRenderer(boolean isEntity, boolean noEntityTranslation) {
|
||||
this.isEntity = isEntity;
|
||||
this.noEntityTranslation = noEntityTranslation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
if (!item.hasTagCompound())
|
||||
return false;
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if (!item.hasTagCompound()) return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return !isEntity;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
TConstruct.logger.warn("[TCon] Unhandled render case!");
|
||||
case FIRST_PERSON_MAP:
|
||||
return false;
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return !isEntity;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
TConstruct.logger.warn("[TCon] Unhandled render case!");
|
||||
case FIRST_PERSON_MAP:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return handleRenderType(item, type) & helper.ordinal() < ItemRendererHelper.EQUIPPED_BLOCK.ordinal();
|
||||
}
|
||||
|
||||
private static final int toolIcons = 10;
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
ToolCore tool = (ToolCore) item.getItem();
|
||||
|
||||
boolean isInventory = type == ItemRenderType.INVENTORY;
|
||||
Entity ent = null;
|
||||
if (data.length > 1)
|
||||
ent = (Entity) data[1];
|
||||
if (data.length > 1) ent = (Entity) data[1];
|
||||
|
||||
int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage());
|
||||
int iconParts = toolIcons; // tool.getRenderPasses(item.getItemDamage());
|
||||
// TODO: have the tools define how many render passes they have
|
||||
// (requires more logic rewrite than it sounds like)
|
||||
|
||||
IIcon[] tempParts = new IIcon[iconParts];
|
||||
label:
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer)
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) ent;
|
||||
ItemStack itemInUse = player.getItemInUse();
|
||||
if (itemInUse != null)
|
||||
{
|
||||
if (itemInUse != null) {
|
||||
int useCount = player.getItemInUseCount();
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
for (int i = iconParts; i-- > 0; )
|
||||
tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount);
|
||||
break label;
|
||||
}
|
||||
}
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
tempParts[i] = tool.getIcon(item, i);
|
||||
for (int i = iconParts; i-- > 0; ) tempParts[i] = tool.getIcon(item, i);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
IIcon[] parts = new IIcon[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon part = tempParts[i];
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon)
|
||||
++count;
|
||||
else
|
||||
parts[i - count] = part;
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) ++count;
|
||||
else parts[i - count] = part;
|
||||
}
|
||||
iconParts -= count;
|
||||
|
||||
if (iconParts <= 0)
|
||||
{
|
||||
if (iconParts <= 0) {
|
||||
iconParts = 1;
|
||||
// TODO: assign default sprite
|
||||
// parts = new Icon[]{ defaultSprite };
|
||||
@@ -131,8 +110,7 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
float[] yDiff = new float[iconParts];
|
||||
float[] xSub = new float[iconParts];
|
||||
float[] ySub = new float[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon icon = parts[i];
|
||||
xMin[i] = icon.getMinU();
|
||||
xMax[i] = icon.getMaxU();
|
||||
@@ -149,26 +127,22 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
|
||||
// color
|
||||
int[] color = new int[iconParts];
|
||||
for(int i = 0; i < iconParts; i++)
|
||||
color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
|
||||
for (int i = 0; i < iconParts; i++) color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
if (type == ItemRenderType.INVENTORY)
|
||||
{
|
||||
if (type == ItemRenderType.INVENTORY) {
|
||||
|
||||
//TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
//texturemanager.getResourceLocation(item.getItemSpriteNumber());
|
||||
//TextureUtil.func_152777_a(false, false, 1.0F);
|
||||
// TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
// texturemanager.getResourceLocation(item.getItemSpriteNumber());
|
||||
// TextureUtil.func_152777_a(false, false, 1.0F);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
tess.startDrawingQuads();
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 16, 0, xMin[i], yMax[i]);
|
||||
tess.addVertexWithUV(16, 16, 0, xMax[i], yMax[i]);
|
||||
@@ -180,31 +154,28 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
//GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
//texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
|
||||
//TextureUtil.func_147945_b();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0, -4 / 16f, 0);
|
||||
break;
|
||||
case ENTITY:
|
||||
if (!noEntityTranslation)
|
||||
GL11.glTranslatef(-0.5f, 0f, depth); // correction of the rotation point when items lie on the ground
|
||||
break;
|
||||
default:
|
||||
// GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
// texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
|
||||
// TextureUtil.func_147945_b();
|
||||
} else {
|
||||
switch (type) {
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0, -4 / 16f, 0);
|
||||
break;
|
||||
case ENTITY:
|
||||
if (!noEntityTranslation)
|
||||
GL11.glTranslatef(
|
||||
-0.5f, 0f, depth); // correction of the rotation point when items lie on the ground
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
// one side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, 1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 0, 0, xMax[i], yMax[i]);
|
||||
tess.addVertexWithUV(1, 0, 0, xMin[i], yMax[i]);
|
||||
@@ -216,8 +187,7 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
// other side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, -1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]);
|
||||
tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]);
|
||||
@@ -232,12 +202,10 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
float pos;
|
||||
float iconPos;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
for (int k = 0, e = (int) w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]);
|
||||
@@ -252,13 +220,11 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
tess.setNormal(1, 0, 0);
|
||||
float posEnd;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
float d2 = 1f / w;
|
||||
for (int k = 0, e = (int) w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -273,13 +239,11 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
float d2 = 1f / h;
|
||||
for (int k = 0, e = (int) h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -294,12 +258,10 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, -1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
for (int k = 0, e = (int) h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(1, pos, 0, xMin[i], iconPos);
|
||||
|
||||
@@ -12,32 +12,27 @@ import tconstruct.mechworks.entity.item.ExplosivePrimed;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ExplosiveRender extends Render
|
||||
{
|
||||
public class ExplosiveRender extends Render {
|
||||
private RenderBlocks blockRenderer = new RenderBlocks();
|
||||
|
||||
public ExplosiveRender()
|
||||
{
|
||||
public ExplosiveRender() {
|
||||
this.shadowSize = 0.5F;
|
||||
}
|
||||
|
||||
public void renderPrimedTNT (ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void renderPrimedTNT(
|
||||
ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
float f2;
|
||||
|
||||
if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F)
|
||||
{
|
||||
if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) {
|
||||
f2 = 1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F;
|
||||
|
||||
if (f2 < 0.0F)
|
||||
{
|
||||
if (f2 < 0.0F) {
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
if (f2 > 1.0F)
|
||||
{
|
||||
if (f2 > 1.0F) {
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
@@ -51,8 +46,7 @@ public class ExplosiveRender extends Render
|
||||
this.bindEntityTexture(par1EntityTNTPrimed);
|
||||
this.blockRenderer.renderBlockAsItem(TinkerWorld.slimeExplosive, 0, par1EntityTNTPrimed.getBrightness(par9));
|
||||
|
||||
if (par1EntityTNTPrimed.fuse / 5 % 2 == 0)
|
||||
{
|
||||
if (par1EntityTNTPrimed.fuse / 5 % 2 == 0) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -68,8 +62,7 @@ public class ExplosiveRender extends Render
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110808_a (ExplosivePrimed par1EntityTNTPrimed)
|
||||
{
|
||||
protected ResourceLocation func_110808_a(ExplosivePrimed par1EntityTNTPrimed) {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
|
||||
@@ -78,8 +71,7 @@ public class ExplosiveRender extends Render
|
||||
* unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110808_a((ExplosivePrimed) par1Entity);
|
||||
}
|
||||
|
||||
@@ -92,8 +84,7 @@ public class ExplosiveRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.renderPrimedTNT((ExplosivePrimed) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
}
|
||||
@@ -16,21 +16,22 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class ArrowRender extends Render
|
||||
{
|
||||
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
public class ArrowRender extends Render {
|
||||
private static final ResourceLocation RES_ITEM_GLINT =
|
||||
new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
private RenderBlocks itemRenderBlocks = new RenderBlocks();
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel;
|
||||
|
||||
public static boolean renderInFrame;
|
||||
|
||||
public ArrowRender()
|
||||
{
|
||||
public ArrowRender() {
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
@@ -38,14 +39,13 @@ public class ArrowRender extends Render
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(
|
||||
ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.bindEntityTexture(par1ArrowEntity);
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = par1ArrowEntity.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
if (itemstack.getItem() != null) {
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
|
||||
@@ -61,26 +61,25 @@ public class ArrowRender extends Render
|
||||
Block block = null;
|
||||
block = BlockUtils.getBlockFromItem(itemstack.getItem());
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType()))
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0
|
||||
&& block != null
|
||||
&& RenderBlocks.renderItemIn3d(
|
||||
BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType())) {
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
float f7 = 0.25F;
|
||||
int j = block.getRenderType();
|
||||
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2)
|
||||
{
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2) {
|
||||
f7 = 0.5F;
|
||||
}
|
||||
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
|
||||
for (i = 0; i < b0; ++i)
|
||||
{
|
||||
for (i = 0; i < b0; ++i) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
if (i > 0) {
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
@@ -91,53 +90,41 @@ public class ArrowRender extends Render
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) {
|
||||
this.random.setSeed(187L);
|
||||
IIcon icon = itemstack.getItem().getIcon(itemstack, k);
|
||||
f8 = 1.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
i = itemstack.getItem().getColorFromItemStack(itemstack, k);
|
||||
f5 = (float) (i >> 16 & 255) / 255.0F;
|
||||
f4 = (float) (i >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (i & 255) / 255.0F;
|
||||
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
IIcon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
|
||||
f8 = (float) (l >> 16 & 255) / 255.0F;
|
||||
float f9 = (float) (l >> 8 & 255) / 255.0F;
|
||||
f5 = (float) (l & 255) / 255.0F;
|
||||
f4 = 1.0F;
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -148,27 +135,27 @@ public class ArrowRender extends Render
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(ArrowEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (ArrowEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
ArrowEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7) {
|
||||
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
|
||||
}
|
||||
|
||||
private void renderDroppedItem (ArrowEntity arrow, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
ArrowEntity arrow, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
if (par2Icon == null) {
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(arrow.getEntityItem().getItemSpriteNumber());
|
||||
ResourceLocation resourcelocation =
|
||||
texturemanager.getResourceLocation(arrow.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
@@ -193,39 +180,47 @@ public class ArrowRender extends Render
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
for (int k = 0; k < b0; ++k) {
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F,
|
||||
0.0F,
|
||||
1.0F,
|
||||
0.0F);
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F,
|
||||
0.0F,
|
||||
0.0F,
|
||||
1.0F);
|
||||
// Makes items offset when in 3D, like when in 2D, looks much
|
||||
// better. Considered a vanilla bug...
|
||||
if (k > 0 && shouldSpreadItems())
|
||||
{
|
||||
if (k > 0 && shouldSpreadItems()) {
|
||||
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
GL11.glTranslatef(x, y, f12 + f11);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
}
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0) {
|
||||
this.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tessellator,
|
||||
f5,
|
||||
f6,
|
||||
f4,
|
||||
f7,
|
||||
((IIcon) par2Icon).getIconWidth(),
|
||||
((IIcon) par2Icon).getIconHeight(),
|
||||
f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
if (itemstack.hasEffect(pass)) {
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.bindTexture(RES_ITEM_GLINT);
|
||||
@@ -260,8 +255,7 @@ public class ArrowRender extends Render
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((ArrowEntity) par1Entity);
|
||||
}
|
||||
|
||||
@@ -274,28 +268,25 @@ public class ArrowRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
public boolean shouldSpreadItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -14,30 +14,30 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class ArrowRenderCustom extends Render
|
||||
{
|
||||
public class ArrowRenderCustom extends Render {
|
||||
private static RenderItem renderer = new RenderItem();
|
||||
private Random random = new Random();
|
||||
|
||||
public ArrowRenderCustom()
|
||||
{
|
||||
}
|
||||
public ArrowRenderCustom() {}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (ArrowEntity arrow, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(ArrowEntity arrow, double par2, double par4, double par6, float par8, float par9) {
|
||||
random.setSeed(187L);
|
||||
ItemStack item = arrow.getEntityItem();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par9 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par9 - 45.0F,
|
||||
0.0F,
|
||||
0.0F,
|
||||
1.0F);
|
||||
float shake = arrow.arrowShake - par9;
|
||||
if (shake > 0.0F)
|
||||
GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
if (shake > 0.0F) GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
float scale = 1.35f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
@@ -49,16 +49,24 @@ public class ArrowRenderCustom extends Render
|
||||
/**
|
||||
* Renders the item's icon or block into the UI at the specified position.
|
||||
*/
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the item's icon or block into the GUI, including the glint effect.
|
||||
*/
|
||||
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemAndEffectIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -66,8 +74,12 @@ public class ArrowRenderCustom extends Render
|
||||
* Renders the item's overlay information. Examples being stack count or
|
||||
* damage on top of the item's image at the specified position.
|
||||
*/
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemOverlayIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
renderer.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -80,19 +92,17 @@ public class ArrowRenderCustom extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((ArrowEntity) par1Entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(ArrowEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
}
|
||||
@@ -18,21 +18,22 @@ import tconstruct.tools.entity.DaggerEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class DaggerRender extends Render
|
||||
{
|
||||
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
public class DaggerRender extends Render {
|
||||
private static final ResourceLocation RES_ITEM_GLINT =
|
||||
new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
private RenderBlocks itemRenderBlocks = new RenderBlocks();
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel;
|
||||
|
||||
public static boolean renderInFrame = true;
|
||||
|
||||
public DaggerRender()
|
||||
{
|
||||
public DaggerRender() {
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
@@ -40,14 +41,13 @@ public class DaggerRender extends Render
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (DaggerEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(
|
||||
DaggerEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.bindEntityTexture(par1ArrowEntity);
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = par1ArrowEntity.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
if (itemstack.getItem() != null) {
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
|
||||
@@ -62,12 +62,13 @@ public class DaggerRender extends Render
|
||||
|
||||
Block block = BlockUtils.getBlockFromItem(itemstack.getItem());
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType()))
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0
|
||||
&& block != null
|
||||
&& RenderBlocks.renderItemIn3d(
|
||||
BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType())) {
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
if (renderInFrame) {
|
||||
GL11.glScalef(1.25F, 1.25F, 1.25F);
|
||||
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
|
||||
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||
@@ -76,19 +77,16 @@ public class DaggerRender extends Render
|
||||
float f7 = 0.25F;
|
||||
int j = block.getRenderType();
|
||||
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2)
|
||||
{
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2) {
|
||||
f7 = 0.5F;
|
||||
}
|
||||
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
|
||||
for (i = 0; i < b0; ++i)
|
||||
{
|
||||
for (i = 0; i < b0; ++i) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
if (i > 0) {
|
||||
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
|
||||
@@ -99,69 +97,51 @@ public class DaggerRender extends Render
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) {
|
||||
if (renderInFrame) {
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) {
|
||||
this.random.setSeed(187L);
|
||||
IIcon icon = itemstack.getItem().getIcon(itemstack, k);
|
||||
f8 = 1.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
i = itemstack.getItem().getColorFromItemStack(itemstack, k);
|
||||
f5 = (float) (i >> 16 & 255) / 255.0F;
|
||||
f4 = (float) (i >> 8 & 255) / 255.0F;
|
||||
f6 = (float) (i & 255) / 255.0F;
|
||||
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
} else {
|
||||
if (renderInFrame) {
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
IIcon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
|
||||
f8 = (float) (l >> 16 & 255) / 255.0F;
|
||||
float f9 = (float) (l >> 8 & 255) / 255.0F;
|
||||
f5 = (float) (l & 255) / 255.0F;
|
||||
f4 = 1.0F;
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -172,27 +152,27 @@ public class DaggerRender extends Render
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (DaggerEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(DaggerEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (DaggerEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
DaggerEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7) {
|
||||
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
|
||||
}
|
||||
|
||||
private void renderDroppedItem (DaggerEntity dagger, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
DaggerEntity dagger, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
if (par2Icon == null) {
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(dagger.getEntityItem().getItemSpriteNumber());
|
||||
ResourceLocation resourcelocation =
|
||||
texturemanager.getResourceLocation(dagger.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
@@ -213,12 +193,9 @@ public class DaggerRender extends Render
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
if (renderInFrame) {
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glRotatef((((float) 0 + par4) / 20.0F + 0) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
@@ -230,25 +207,29 @@ public class DaggerRender extends Render
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
for (int k = 0; k < b0; ++k) {
|
||||
// Makes items offset when in 3D, like when in 2D, looks much
|
||||
// better. Considered a vanilla bug...
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0) {
|
||||
this.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(rotation, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tessellator,
|
||||
f5,
|
||||
f6,
|
||||
f4,
|
||||
f7,
|
||||
((IIcon) par2Icon).getIconWidth(),
|
||||
((IIcon) par2Icon).getIconHeight(),
|
||||
f12);
|
||||
|
||||
/*
|
||||
* if (itemstack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
@@ -280,13 +261,22 @@ public class DaggerRender extends Render
|
||||
/**
|
||||
* Renders the item's icon or block into the UI at the specified position.
|
||||
*/
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
|
||||
}
|
||||
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, boolean renderEffect)
|
||||
{
|
||||
public void renderItemIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5,
|
||||
boolean renderEffect) {
|
||||
Item k = par3ItemStack.getItem();
|
||||
int l = par3ItemStack.getItemDamage();
|
||||
Object object = par3ItemStack.getIconIndex();
|
||||
@@ -296,8 +286,9 @@ public class DaggerRender extends Render
|
||||
float f2;
|
||||
|
||||
Block block = BlockUtils.getBlockFromItem(k);
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(k).getRenderType()))
|
||||
{
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0
|
||||
&& block != null
|
||||
&& RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(k).getRenderType())) {
|
||||
par2TextureManager.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
|
||||
@@ -311,8 +302,7 @@ public class DaggerRender extends Render
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
@@ -321,44 +311,42 @@ public class DaggerRender extends Render
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (k.requiresMultipleRenderPasses())
|
||||
{
|
||||
} else if (k.requiresMultipleRenderPasses()) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int j1 = 0; j1 < k.getRenderPasses(l); ++j1)
|
||||
{
|
||||
par2TextureManager.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
||||
for (int j1 = 0; j1 < k.getRenderPasses(l); ++j1) {
|
||||
par2TextureManager.bindTexture(
|
||||
par3ItemStack.getItemSpriteNumber() == 0
|
||||
? TextureMap.locationBlocksTexture
|
||||
: TextureMap.locationItemsTexture);
|
||||
IIcon icon = k.getIcon(par3ItemStack, j1);
|
||||
int k1 = k.getColorFromItemStack(par3ItemStack, j1);
|
||||
f1 = (float) (k1 >> 16 & 255) / 255.0F;
|
||||
f2 = (float) (k1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (k1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
GL11.glColor4f(f1, f2, f3, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, icon, 16, 16);
|
||||
|
||||
if (par3ItemStack.hasEffect(j1))
|
||||
{
|
||||
if (par3ItemStack.hasEffect(j1)) {
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
ResourceLocation resourcelocation = par2TextureManager.getResourceLocation(par3ItemStack.getItemSpriteNumber());
|
||||
ResourceLocation resourcelocation =
|
||||
par2TextureManager.getResourceLocation(par3ItemStack.getItemSpriteNumber());
|
||||
par2TextureManager.bindTexture(resourcelocation);
|
||||
|
||||
if (object == null)
|
||||
{
|
||||
object = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation)).getAtlasSprite("missingno");
|
||||
if (object == null) {
|
||||
object = ((TextureMap)
|
||||
Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation))
|
||||
.getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
i1 = k.getColorFromItemStack(par3ItemStack, 0);
|
||||
@@ -366,16 +354,14 @@ public class DaggerRender extends Render
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, (IIcon) object, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
if (par3ItemStack.hasEffect(0))
|
||||
{
|
||||
if (par3ItemStack.hasEffect(0)) {
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
@@ -383,8 +369,7 @@ public class DaggerRender extends Render
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
private void renderEffect (TextureManager manager, int x, int y)
|
||||
{
|
||||
private void renderEffect(TextureManager manager, int x, int y) {
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
@@ -404,12 +389,16 @@ public class DaggerRender extends Render
|
||||
/**
|
||||
* Render the item's icon or block into the GUI, including the glint effect.
|
||||
*/
|
||||
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (!ForgeHooksClient.renderInventoryItem(field_147909_c, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5))
|
||||
{
|
||||
public void renderItemAndEffectIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
if (par3ItemStack != null) {
|
||||
if (!ForgeHooksClient.renderInventoryItem(
|
||||
field_147909_c, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float)
|
||||
par5)) {
|
||||
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
|
||||
}
|
||||
|
||||
@@ -430,37 +419,51 @@ public class DaggerRender extends Render
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
{
|
||||
if (j1 == 0)
|
||||
{
|
||||
private void renderGlint(int par1, int par2, int par3, int par4, int par5) {
|
||||
for (int j1 = 0; j1 < 2; ++j1) {
|
||||
if (j1 == 0) {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
if (j1 == 1) {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873))
|
||||
/ (3000.0F + (float) (j1 * 1873))
|
||||
* 256.0F;
|
||||
float f3 = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f4 = 4.0F;
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
if (j1 == 1) {
|
||||
f4 = -1.0F;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + 0),
|
||||
(double) (par3 + par5),
|
||||
(double) this.zLevel,
|
||||
(double) ((f2 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + par4),
|
||||
(double) (par3 + par5),
|
||||
(double) this.zLevel,
|
||||
(double) ((f2 + (float) par4 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + par4),
|
||||
(double) (par3 + 0),
|
||||
(double) this.zLevel,
|
||||
(double) ((f2 + (float) par4) * f),
|
||||
(double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double)
|
||||
((f3 + 0.0F) * f1));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -469,29 +472,42 @@ public class DaggerRender extends Render
|
||||
* Renders the item's overlay information. Examples being stack count or
|
||||
* damage on top of the item's image at the specified position.
|
||||
*/
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemOverlayIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
|
||||
}
|
||||
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (par3ItemStack.stackSize > 1 || par6Str != null)
|
||||
{
|
||||
public void renderItemOverlayIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5,
|
||||
String par6Str) {
|
||||
if (par3ItemStack != null) {
|
||||
if (par3ItemStack.stackSize > 1 || par6Str != null) {
|
||||
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
par1FontRenderer.drawStringWithShadow(s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
|
||||
par1FontRenderer.drawStringWithShadow(
|
||||
s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
if (par3ItemStack.isItemDamaged())
|
||||
{
|
||||
int k = (int) Math.round(13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D / (double) par3ItemStack.getMaxDamage());
|
||||
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
|
||||
if (par3ItemStack.isItemDamaged()) {
|
||||
int k = (int) Math.round(13.0D
|
||||
- (double) par3ItemStack.getItemDamageForDisplay()
|
||||
* 13.0D
|
||||
/ (double) par3ItemStack.getMaxDamage());
|
||||
int l = (int) Math.round(255.0D
|
||||
- (double) par3ItemStack.getItemDamageForDisplay()
|
||||
* 255.0D
|
||||
/ (double) par3ItemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
@@ -513,8 +529,7 @@ public class DaggerRender extends Render
|
||||
* Adds a quad to the tesselator at the specified position with the set
|
||||
* width and height and color. Args: tessellator, x, y, width, height, color
|
||||
*/
|
||||
private void renderQuad (Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6) {
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I(par6);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
|
||||
@@ -524,20 +539,29 @@ public class DaggerRender extends Render
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderIcon (int par1, int par2, IIcon par3Icon, int par4, int par5)
|
||||
{
|
||||
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double)
|
||||
par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + par4),
|
||||
(double) (par2 + par5),
|
||||
(double) this.zLevel,
|
||||
(double) par3Icon.getMaxU(),
|
||||
(double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double)
|
||||
par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double)
|
||||
par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((DaggerEntity) par1Entity);
|
||||
}
|
||||
|
||||
@@ -550,61 +574,49 @@ public class DaggerRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((DaggerEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
public boolean shouldSpreadItems() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
public boolean shouldBob() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte getMiniBlockCount (ItemStack stack)
|
||||
{
|
||||
public byte getMiniBlockCount(ItemStack stack) {
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 5)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 20)
|
||||
ret = 4;
|
||||
if (stack.stackSize > 40)
|
||||
ret = 5;
|
||||
if (stack.stackSize > 1) ret = 2;
|
||||
if (stack.stackSize > 5) ret = 3;
|
||||
if (stack.stackSize > 20) ret = 4;
|
||||
if (stack.stackSize > 40) ret = 5;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for a subclass to override how many rendered items appear in a
|
||||
* "mini item 3d stack"
|
||||
*
|
||||
*
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public byte getMiniItemCount (ItemStack stack)
|
||||
{
|
||||
public byte getMiniItemCount(ItemStack stack) {
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 15)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 31)
|
||||
ret = 4;
|
||||
if (stack.stackSize > 1) ret = 2;
|
||||
if (stack.stackSize > 15) ret = 3;
|
||||
if (stack.stackSize > 31) ret = 4;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,12 @@ import tconstruct.tools.entity.DaggerEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class DaggerRenderCustom extends Render
|
||||
{
|
||||
public class DaggerRenderCustom extends Render {
|
||||
private static RenderItem renderer = new RenderItem();
|
||||
private static ToolCoreRenderer toolCoreRenderer = new ToolCoreRenderer(true, true);
|
||||
private Random random = new Random();
|
||||
|
||||
public DaggerRenderCustom()
|
||||
{
|
||||
public DaggerRenderCustom() {
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
@@ -30,25 +28,33 @@ public class DaggerRenderCustom extends Render
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (DaggerEntity dagger, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(DaggerEntity dagger, double par2, double par4, double par6, float par8, float par9) {
|
||||
random.setSeed(187L);
|
||||
ItemStack item = dagger.getEntityItem();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glRotatef(dagger.prevRotationYaw + (dagger.rotationYaw - dagger.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(
|
||||
dagger.prevRotationYaw + (dagger.rotationYaw - dagger.prevRotationYaw) * par9 - 90.0F,
|
||||
0.0F,
|
||||
1.0F,
|
||||
0.0F);
|
||||
GL11.glRotatef(
|
||||
dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9 - 45.0F,
|
||||
0.0F,
|
||||
0.0F,
|
||||
1.0F);
|
||||
|
||||
float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9;
|
||||
GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(rotation * 15, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(-0.25f, -0.25f, 0f); // translate to the middle. This makes it so that the dagger rotates around its center
|
||||
GL11.glTranslatef(
|
||||
-0.25f, -0.25f,
|
||||
0f); // translate to the middle. This makes it so that the dagger rotates around its center
|
||||
float shake = dagger.arrowShake - par9;
|
||||
if (shake > 0.0F)
|
||||
GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
//GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
if (shake > 0.0F) GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
// GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
float scale = 1.35f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
@@ -66,16 +72,24 @@ public class DaggerRenderCustom extends Render
|
||||
/**
|
||||
* Renders the item's icon or block into the UI at the specified position.
|
||||
*/
|
||||
public void renderItemIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the item's icon or block into the GUI, including the glint effect.
|
||||
*/
|
||||
public void renderItemAndEffectIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemAndEffectIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -83,8 +97,12 @@ public class DaggerRenderCustom extends Render
|
||||
* Renders the item's overlay information. Examples being stack count or
|
||||
* damage on top of the item's image at the specified position.
|
||||
*/
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5)
|
||||
{
|
||||
public void renderItemOverlayIntoGUI(
|
||||
FontRenderer par1FontRenderer,
|
||||
TextureManager par2TextureManager,
|
||||
ItemStack par3ItemStack,
|
||||
int par4,
|
||||
int par5) {
|
||||
renderer.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -97,19 +115,17 @@ public class DaggerRenderCustom extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((DaggerEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((DaggerEntity) par1Entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (DaggerEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(DaggerEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
}
|
||||
@@ -12,19 +12,16 @@ import org.lwjgl.opengl.*;
|
||||
import tconstruct.tools.entity.LaunchedPotion;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class LaunchedItemRender extends Render
|
||||
{
|
||||
public class LaunchedItemRender extends Render {
|
||||
private Item field_94151_a;
|
||||
private int field_94150_f;
|
||||
|
||||
public LaunchedItemRender(Item par1Item, int par2)
|
||||
{
|
||||
public LaunchedItemRender(Item par1Item, int par2) {
|
||||
this.field_94151_a = par1Item;
|
||||
this.field_94150_f = par2;
|
||||
}
|
||||
|
||||
public LaunchedItemRender(Item par1Item)
|
||||
{
|
||||
public LaunchedItemRender(Item par1Item) {
|
||||
this(par1Item, 0);
|
||||
}
|
||||
|
||||
@@ -37,12 +34,10 @@ public class LaunchedItemRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
IIcon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
|
||||
|
||||
if (icon != null)
|
||||
{
|
||||
if (icon != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
@@ -50,8 +45,7 @@ public class LaunchedItemRender extends Render
|
||||
this.bindEntityTexture(par1Entity);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (icon == ItemPotion.func_94589_d("bottle_splash"))
|
||||
{
|
||||
if (icon == ItemPotion.func_94589_d("bottle_splash")) {
|
||||
int i = PotionHelper.func_77915_a(((LaunchedPotion) par1Entity).getPotionDamage(), false);
|
||||
float f2 = (float) (i >> 16 & 255) / 255.0F;
|
||||
float f3 = (float) (i >> 8 & 255) / 255.0F;
|
||||
@@ -70,13 +64,11 @@ public class LaunchedItemRender extends Render
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return TextureMap.locationItemsTexture;
|
||||
}
|
||||
|
||||
private void func_77026_a (Tessellator par1Tessellator, IIcon par2Icon)
|
||||
{
|
||||
private void func_77026_a(Tessellator par1Tessellator, IIcon par2Icon) {
|
||||
float f = par2Icon.getMinU();
|
||||
float f1 = par2Icon.getMaxU();
|
||||
float f2 = par2Icon.getMinV();
|
||||
@@ -94,5 +86,4 @@ public class LaunchedItemRender extends Render
|
||||
par1Tessellator.addVertexWithUV((double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2);
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,19 +4,13 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public abstract class RangedRenderBase extends Render
|
||||
{
|
||||
public RangedRenderBase()
|
||||
{
|
||||
}
|
||||
public abstract class RangedRenderBase extends Render {
|
||||
public RangedRenderBase() {}
|
||||
|
||||
@Override
|
||||
public void doRender (Entity entity, double d, double d1, double d2, float f, float f1)
|
||||
{
|
||||
}
|
||||
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {}
|
||||
|
||||
public void renderItem (Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
public void renderItem(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D - (double) f5, 0.0D, f1, f3);
|
||||
@@ -33,8 +27,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
for (int i = 0; i < 16; i++) {
|
||||
float f6 = (float) i / 16F;
|
||||
float f10 = (f1 + (f - f1) * f6) - 0.001953125F;
|
||||
float f14 = f4 * f6 + 0.0625F;
|
||||
@@ -47,8 +40,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
for (int j = 0; j < 16; j++) {
|
||||
float f7 = (float) j / 16F;
|
||||
float f11 = (f1 + (f - f1) * f7) - 0.001953125F;
|
||||
float f15 = f4 * f7;
|
||||
@@ -61,8 +53,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
for (int k = 0; k < 16; k++) {
|
||||
float f8 = (float) k / 16F;
|
||||
float f12 = (f3 + (f2 - f3) * f8) - 0.001953125F;
|
||||
float f16 = f4 * f8;
|
||||
@@ -75,8 +66,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
for (int l = 0; l < 16; l++)
|
||||
{
|
||||
for (int l = 0; l < 16; l++) {
|
||||
float f9 = (float) l / 16F;
|
||||
float f13 = (f3 + (f2 - f3) * f9) - 0.001953125F;
|
||||
float f17 = f4 * f9 + 0.0625F;
|
||||
|
||||
@@ -8,17 +8,14 @@ import net.minecraft.util.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
public class BlockCastPage extends BookPage
|
||||
{
|
||||
public class BlockCastPage extends BookPage {
|
||||
String text;
|
||||
ItemStack[] icons;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("text");
|
||||
if (nodes != null)
|
||||
text = nodes.item(0).getTextContent();
|
||||
if (nodes != null) text = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("recipe");
|
||||
if (nodes != null)
|
||||
@@ -26,12 +23,9 @@ public class BlockCastPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
if (isTranslatable)
|
||||
text = StatCollector.translateToLocal(text);
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
if (text != null) {
|
||||
if (isTranslatable) text = StatCollector.translateToLocal(text);
|
||||
manual.fonts.drawString("\u00a7n" + text, localWidth + 70, localHeight + 4, 0);
|
||||
}
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
@@ -39,20 +33,28 @@ public class BlockCastPage extends BookPage
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
manual.renderitem.zLevel = 100;
|
||||
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 138) / 2, (localHeight + 110) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 70) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 70) / 2, (localHeight + 110) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 138) / 2, (localHeight + 110) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 70) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 70) / 2, (localHeight + 110) / 2);
|
||||
|
||||
if (icons[0].stackSize > 1)
|
||||
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2, String.valueOf(icons[0].stackSize));
|
||||
manual.renderitem.renderItemOverlayIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 106) / 2,
|
||||
(localHeight + 74) / 2,
|
||||
String.valueOf(icons[0].stackSize));
|
||||
|
||||
manual.renderitem.zLevel = 0;
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
String ingr = StatCollector.translateToLocal("manual.page.casting1");
|
||||
if (isTranslatable)
|
||||
ingr = StatCollector.translateToLocal(ingr);
|
||||
if (isTranslatable) ingr = StatCollector.translateToLocal(ingr);
|
||||
manual.fonts.drawString(ingr + ":", localWidth + 120, localHeight + 32, 0);
|
||||
manual.fonts.drawString("- " + icons[1].getDisplayName(), localWidth + 120, localHeight + 42, 0);
|
||||
if (icons[2] != null)
|
||||
@@ -62,8 +64,7 @@ public class BlockCastPage extends BookPage
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/booksmeltery.png");
|
||||
|
||||
@Override
|
||||
public void renderBackgroundLayer (int localWidth, int localHeight)
|
||||
{
|
||||
public void renderBackgroundLayer(int localWidth, int localHeight) {
|
||||
manual.getMC().getTextureManager().bindTexture(background);
|
||||
manual.drawTexturedModalRect(localWidth, localHeight + 32, 0, 0, 174, 115);
|
||||
manual.drawTexturedModalRect(localWidth + 62, localHeight + 105, 2, 118, 45, 45);
|
||||
|
||||
@@ -12,25 +12,21 @@ import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.util.HarvestLevels;
|
||||
|
||||
public class MaterialPage extends BookPage
|
||||
{
|
||||
public class MaterialPage extends BookPage {
|
||||
String title;
|
||||
ItemStack[] icons;
|
||||
String iconText;
|
||||
ToolMaterial material;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("title");
|
||||
if (nodes != null)
|
||||
title = nodes.item(0).getTextContent();
|
||||
if (nodes != null) title = nodes.item(0).getTextContent();
|
||||
|
||||
icons = new ItemStack[4];
|
||||
|
||||
nodes = element.getElementsByTagName("text");
|
||||
if (nodes != null)
|
||||
iconText = nodes.item(0).getTextContent();
|
||||
if (nodes != null) iconText = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("icon");
|
||||
if (nodes != null)
|
||||
@@ -39,8 +35,7 @@ public class MaterialPage extends BookPage
|
||||
nodes = element.getElementsByTagName("toolmaterial");
|
||||
if (nodes != null && nodes.getLength() > 0)
|
||||
material = TConstructRegistry.getMaterial(nodes.item(0).getTextContent());
|
||||
else
|
||||
material = TConstructRegistry.getMaterial(title);
|
||||
else material = TConstructRegistry.getMaterial(title);
|
||||
|
||||
nodes = element.getElementsByTagName("material").item(0).getChildNodes();
|
||||
|
||||
@@ -50,8 +45,7 @@ public class MaterialPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
String mat = StatCollector.translateToLocal("manual.page.material.material");
|
||||
String shard = StatCollector.translateToLocal("manual.page.material.shard");
|
||||
String rod = StatCollector.translateToLocal("manual.page.material.rod");
|
||||
@@ -70,8 +64,7 @@ public class MaterialPage extends BookPage
|
||||
String stoneboundLevel = StatCollector.translateToLocal("manual.page.material8");
|
||||
String splinteringLevel = StatCollector.translateToLocal("manual.page.material9");
|
||||
|
||||
if (isTranslatable)
|
||||
{
|
||||
if (isTranslatable) {
|
||||
title = StatCollector.translateToLocal(title);
|
||||
iconText = StatCollector.translateToLocal(iconText);
|
||||
mat = StatCollector.translateToLocal(mat);
|
||||
@@ -91,7 +84,6 @@ public class MaterialPage extends BookPage
|
||||
reinforcedLevel = StatCollector.translateToLocal(reinforcedLevel);
|
||||
stoneboundLevel = StatCollector.translateToLocal(stoneboundLevel);
|
||||
splinteringLevel = StatCollector.translateToLocal(splinteringLevel);
|
||||
|
||||
}
|
||||
manual.fonts.drawString("\u00a7n" + title, localWidth + 70, localHeight + 4, 0);
|
||||
manual.fonts.drawSplitString(iconText, localWidth, localHeight + 16, 178, 0);
|
||||
@@ -105,75 +97,98 @@ public class MaterialPage extends BookPage
|
||||
manual.renderitem.zLevel = 100;
|
||||
// renderitem.renderItemAndEffectIntoGUI(fonts, getMC().renderEngine,
|
||||
// icons[0], localWidth + 50, localHeight + 0);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], localWidth + 108, localHeight + 50);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], localWidth + 108, localHeight + 82);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[3], localWidth + 108, localHeight + 114);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], localWidth + 108, localHeight + 50);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[2], localWidth + 108, localHeight + 82);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[3], localWidth + 108, localHeight + 114);
|
||||
manual.renderitem.zLevel = 0;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
String icon = icons[1].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable)
|
||||
icon = StatCollector.translateToLocal(icon);
|
||||
String icon =
|
||||
icons[1].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable) icon = StatCollector.translateToLocal(icon);
|
||||
int iconOffset = icon.length() > 12 ? 0 : 3;
|
||||
manual.fonts.drawSplitString(icon, localWidth + 128, localHeight + 50 + iconOffset, 52, 0);
|
||||
|
||||
if (icons[2] != null)
|
||||
{
|
||||
if (icons[2] != null) {
|
||||
icon = icons[2].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable)
|
||||
icon = StatCollector.translateToLocal(icon);
|
||||
if (isTranslatable) icon = StatCollector.translateToLocal(icon);
|
||||
iconOffset = icon.length() > 12 ? 0 : 3;
|
||||
manual.fonts.drawSplitString(icons[2].getTooltip(manual.getMC().thePlayer, false).get((0)).toString(), localWidth + 128, localHeight + 82 + iconOffset, 52, 0);
|
||||
manual.fonts.drawSplitString(
|
||||
icons[2].getTooltip(manual.getMC().thePlayer, false)
|
||||
.get((0))
|
||||
.toString(),
|
||||
localWidth + 128,
|
||||
localHeight + 82 + iconOffset,
|
||||
52,
|
||||
0);
|
||||
}
|
||||
if (icons[3] != null)
|
||||
{
|
||||
if (icons[3] != null) {
|
||||
icon = icons[3].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable)
|
||||
icon = StatCollector.translateToLocal(icon);
|
||||
if (isTranslatable) icon = StatCollector.translateToLocal(icon);
|
||||
iconOffset = icon.length() > 12 ? 0 : 3;
|
||||
manual.fonts.drawSplitString(icons[3].getTooltip(manual.getMC().thePlayer, false).get((0)).toString(), localWidth + 128, localHeight + 114 + iconOffset, 52, 0);
|
||||
manual.fonts.drawSplitString(
|
||||
icons[3].getTooltip(manual.getMC().thePlayer, false)
|
||||
.get((0))
|
||||
.toString(),
|
||||
localWidth + 128,
|
||||
localHeight + 114 + iconOffset,
|
||||
52,
|
||||
0);
|
||||
}
|
||||
|
||||
manual.fonts.drawString(durability + ": " + material.durability(), localWidth, localHeight + 40, 0);
|
||||
manual.fonts.drawString(handleModifier + ": " + material.handleDurability() + "x", localWidth, localHeight + 50, 0);
|
||||
manual.fonts.drawString(fullToolDurability + ": " + (int) (material.durability() * material.handleDurability()), localWidth, localHeight + 60, 0);
|
||||
manual.fonts.drawString(
|
||||
handleModifier + ": " + material.handleDurability() + "x", localWidth, localHeight + 50, 0);
|
||||
manual.fonts.drawString(
|
||||
fullToolDurability + ": " + (int) (material.durability() * material.handleDurability()),
|
||||
localWidth,
|
||||
localHeight + 60,
|
||||
0);
|
||||
|
||||
manual.fonts.drawString(miningSpeed + ": " + material.toolSpeed() / 100f, localWidth, localHeight + 80, 0);
|
||||
manual.fonts.drawString(miningLevel + ": " + material.harvestLevel() + " (" + HarvestLevels.getHarvestLevelName(material.harvestLevel()) + ")", localWidth, localHeight + 90, 0);
|
||||
manual.fonts.drawString(
|
||||
miningLevel + ": " + material.harvestLevel() + " ("
|
||||
+ HarvestLevels.getHarvestLevelName(material.harvestLevel()) + ")",
|
||||
localWidth,
|
||||
localHeight + 90,
|
||||
0);
|
||||
int attack = material.attack();
|
||||
String heart = attack == 2 ? " " + heart_ : " " + hearts;
|
||||
if (attack % 2 == 0)
|
||||
manual.fonts.drawString(baseAttack + ": " + material.attack() / 2 + heart, localWidth, localHeight + 100, 0);
|
||||
manual.fonts.drawString(
|
||||
baseAttack + ": " + material.attack() / 2 + heart, localWidth, localHeight + 100, 0);
|
||||
else
|
||||
manual.fonts.drawString(baseAttack + ": " + material.attack() / 2f + heart, localWidth, localHeight + 100, 0);
|
||||
manual.fonts.drawString(
|
||||
baseAttack + ": " + material.attack() / 2f + heart, localWidth, localHeight + 100, 0);
|
||||
|
||||
int offset = 0;
|
||||
String ability = material.ability();
|
||||
if (!ability.equals(""))
|
||||
{
|
||||
if (!ability.equals("")) {
|
||||
manual.fonts.drawString(materialTrait + ": " + ability, localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
if (material.name().equals("Paper") || material.name().equals("Thaumium"))
|
||||
manual.fonts.drawString(extraMod, localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
}
|
||||
|
||||
if (material.reinforced() > 0)
|
||||
{
|
||||
if (material.reinforced() > 0) {
|
||||
manual.fonts.drawString(traitReinforced, localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
manual.fonts.drawString(reinforcedLevel + ": " + material.reinforced(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
manual.fonts.drawString(
|
||||
reinforcedLevel + ": " + material.reinforced(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (material.shoddy() > 0)
|
||||
{
|
||||
manual.fonts.drawString(stoneboundLevel + ": " + material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
if (material.shoddy() > 0) {
|
||||
manual.fonts.drawString(
|
||||
stoneboundLevel + ": " + material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
}
|
||||
else if (material.shoddy() < 0)
|
||||
{
|
||||
manual.fonts.drawString(splinteringLevel + ": " + -material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
} else if (material.shoddy() < 0) {
|
||||
manual.fonts.drawString(
|
||||
splinteringLevel + ": " + -material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ import net.minecraft.util.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
public class ModifierPage extends BookPage
|
||||
{
|
||||
public class ModifierPage extends BookPage {
|
||||
String type;
|
||||
ItemStack[] icons;
|
||||
ItemStack[][] iconsMulti;
|
||||
@@ -20,28 +19,23 @@ public class ModifierPage extends BookPage
|
||||
int counter;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("tooltype");
|
||||
if (nodes != null)
|
||||
type = nodes.item(0).getTextContent();
|
||||
if (nodes != null) type = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("recipe");
|
||||
if (nodes != null)
|
||||
{
|
||||
if (nodes != null) {
|
||||
String recipe = nodes.item(0).getTextContent();
|
||||
icons = MantleClientRegistry.getRecipeIcons(recipe);
|
||||
|
||||
if (type.equals("travelmulti"))
|
||||
{
|
||||
if (type.equals("travelmulti")) {
|
||||
List<ItemStack[]> stacks = new LinkedList<ItemStack[]>();
|
||||
List<String> tools = new LinkedList<String>();
|
||||
String[] suffixes = new String[] { "goggles", "vest", "wings", "boots", "glove", "belt" };
|
||||
for (String suffix : suffixes)
|
||||
{
|
||||
ItemStack[] icons2 = MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
|
||||
if (icons2 != null)
|
||||
{
|
||||
String[] suffixes = new String[] {"goggles", "vest", "wings", "boots", "glove", "belt"};
|
||||
for (String suffix : suffixes) {
|
||||
ItemStack[] icons2 =
|
||||
MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
|
||||
if (icons2 != null) {
|
||||
stacks.add(icons2);
|
||||
tools.add(suffix);
|
||||
}
|
||||
@@ -49,8 +43,7 @@ public class ModifierPage extends BookPage
|
||||
|
||||
iconsMulti = new ItemStack[stacks.size()][];
|
||||
toolMulti = new ItemStack[stacks.size()];
|
||||
for (int i = 0; i < stacks.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < stacks.size(); i++) {
|
||||
iconsMulti[i] = stacks.get(i);
|
||||
toolMulti[i] = MantleClientRegistry.getManualIcon("travel" + tools.get(i));
|
||||
}
|
||||
@@ -64,67 +57,87 @@ public class ModifierPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
String tStation = StatCollector.translateToLocal("manual.page.modifier1");
|
||||
if (icons.length > 3)
|
||||
tStation = StatCollector.translateToLocal("manual.page.modifier2");
|
||||
if (icons.length > 4)
|
||||
tStation = StatCollector.translateToLocal("manual.page.modifier3");
|
||||
if (isTranslatable)
|
||||
tStation = StatCollector.translateToLocal(tStation);
|
||||
if (icons.length > 3) tStation = StatCollector.translateToLocal("manual.page.modifier2");
|
||||
if (icons.length > 4) tStation = StatCollector.translateToLocal("manual.page.modifier3");
|
||||
if (isTranslatable) tStation = StatCollector.translateToLocal(tStation);
|
||||
manual.fonts.drawString("\u00a7n" + tStation, localWidth + 60, localHeight + 4, 0);
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
|
||||
if (type.equals("weapon"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
|
||||
if (type.equals("travelgoggles"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
|
||||
if (type.equals("travelvest"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelvest");
|
||||
if (type.equals("travelwings"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelwings");
|
||||
if (type.equals("travelboots"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelboots");
|
||||
if (type.equals("travelbelt"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelbelt");
|
||||
if (type.equals("travelglove"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelglove");
|
||||
if (type.equals("travelmulti"))
|
||||
toolstack = toolMulti[counter];
|
||||
if (type.equals("weapon")) toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
|
||||
if (type.equals("travelgoggles")) toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
|
||||
if (type.equals("travelvest")) toolstack = MantleClientRegistry.getManualIcon("travelvest");
|
||||
if (type.equals("travelwings")) toolstack = MantleClientRegistry.getManualIcon("travelwings");
|
||||
if (type.equals("travelboots")) toolstack = MantleClientRegistry.getManualIcon("travelboots");
|
||||
if (type.equals("travelbelt")) toolstack = MantleClientRegistry.getManualIcon("travelbelt");
|
||||
if (type.equals("travelglove")) toolstack = MantleClientRegistry.getManualIcon("travelglove");
|
||||
if (type.equals("travelmulti")) toolstack = toolMulti[counter];
|
||||
|
||||
// update displayed item
|
||||
if (iconsMulti != null && iconsMulti.length > 0 && type.equals("travelmulti") && System.currentTimeMillis() - lastUpdate > 1000)
|
||||
{
|
||||
if (iconsMulti != null
|
||||
&& iconsMulti.length > 0
|
||||
&& type.equals("travelmulti")
|
||||
&& System.currentTimeMillis() - lastUpdate > 1000) {
|
||||
lastUpdate = System.currentTimeMillis();
|
||||
counter++;
|
||||
if (counter >= iconsMulti.length)
|
||||
counter = 0;
|
||||
if (counter >= iconsMulti.length) counter = 0;
|
||||
icons = iconsMulti[counter];
|
||||
toolstack = toolMulti[counter];
|
||||
}
|
||||
|
||||
manual.renderitem.zLevel = 100;
|
||||
if (icons.length < 4)
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 54) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 130) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
|
||||
if (icons.length < 4) {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
toolstack,
|
||||
(localWidth + 54) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 130) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
|
||||
if (icons[2] != null)
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 18) / 2, (localHeight + 74) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 74) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 140) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth - 2) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth - 2) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[3], (localWidth + 36) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[2],
|
||||
(localWidth + 18) / 2,
|
||||
(localHeight + 74) / 2);
|
||||
} else {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
toolstack,
|
||||
(localWidth + 74) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 140) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth - 2) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth - 2) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[3], (localWidth + 36) / 2, (localHeight + 36) / 2);
|
||||
if (icons[4] != null)
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[4], (localWidth + 36) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[4],
|
||||
(localWidth + 36) / 2,
|
||||
(localHeight + 74) / 2);
|
||||
}
|
||||
manual.renderitem.zLevel = 0;
|
||||
|
||||
@@ -136,12 +149,9 @@ public class ModifierPage extends BookPage
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookmodify.png");
|
||||
|
||||
@Override
|
||||
public void renderBackgroundLayer (int localWidth, int localHeight)
|
||||
{
|
||||
public void renderBackgroundLayer(int localWidth, int localHeight) {
|
||||
manual.getMC().getTextureManager().bindTexture(background);
|
||||
if (icons.length > 3)
|
||||
manual.drawTexturedModalRect(localWidth - 7, localHeight + 32, 0, 80, 182, 78);
|
||||
else
|
||||
manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
||||
if (icons.length > 3) manual.drawTexturedModalRect(localWidth - 7, localHeight + 32, 0, 80, 182, 78);
|
||||
else manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
||||
}
|
||||
}
|
||||
@@ -8,33 +8,28 @@ import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
public class ToolPage extends BookPage
|
||||
{
|
||||
public class ToolPage extends BookPage {
|
||||
String title;
|
||||
ItemStack[] icons;
|
||||
String[] iconText;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("title");
|
||||
if (nodes != null)
|
||||
title = nodes.item(0).getTextContent();
|
||||
if (nodes != null) title = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("item");
|
||||
iconText = new String[nodes.getLength() + 2];
|
||||
icons = new ItemStack[nodes.getLength() + 1];
|
||||
|
||||
for (int i = 0; i < nodes.getLength(); i++)
|
||||
{
|
||||
for (int i = 0; i < nodes.getLength(); i++) {
|
||||
NodeList children = nodes.item(i).getChildNodes();
|
||||
iconText[i + 2] = children.item(1).getTextContent();
|
||||
icons[i + 1] = MantleClientRegistry.getManualIcon(children.item(3).getTextContent());
|
||||
}
|
||||
|
||||
nodes = element.getElementsByTagName("text");
|
||||
if (nodes != null)
|
||||
{
|
||||
if (nodes != null) {
|
||||
iconText[0] = nodes.item(0).getTextContent();
|
||||
iconText[1] = nodes.item(1).getTextContent();
|
||||
}
|
||||
@@ -45,11 +40,9 @@ public class ToolPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
String cParts = StatCollector.translateToLocal("manual.page.tool1");
|
||||
if (isTranslatable)
|
||||
{
|
||||
if (isTranslatable) {
|
||||
title = StatCollector.translateToLocal(title);
|
||||
iconText[0] = StatCollector.translateToLocal(iconText[0]);
|
||||
iconText[1] = StatCollector.translateToLocal(iconText[1]);
|
||||
@@ -66,12 +59,18 @@ public class ToolPage extends BookPage
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
manual.renderitem.zLevel = 100;
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
|
||||
for (int i = 1; i < icons.length; i++)
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 120, localHeight + 20 + 10 * size + 18 * i);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
|
||||
for (int i = 1; i < icons.length; i++) {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[i],
|
||||
localWidth + 120,
|
||||
localHeight + 20 + 10 * size + 18 * i);
|
||||
int partOffset = iconText[i + 1].length() > 11 ? -3 : 0;
|
||||
manual.fonts.drawSplitString(iconText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i + partOffset, 44, 0);
|
||||
manual.fonts.drawSplitString(
|
||||
iconText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i + partOffset, 44, 0);
|
||||
}
|
||||
manual.renderitem.zLevel = 0;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
@@ -8,23 +8,19 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
public abstract class AbstractTab extends GuiButton
|
||||
{
|
||||
public abstract class AbstractTab extends GuiButton {
|
||||
ResourceLocation texture = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
|
||||
ItemStack renderStack;
|
||||
RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
public AbstractTab(int id, int posX, int posY, ItemStack renderStack)
|
||||
{
|
||||
public AbstractTab(int id, int posX, int posY, ItemStack renderStack) {
|
||||
super(id, posX, posY, 28, 32, "");
|
||||
this.renderStack = renderStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton (Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int yTexPos = this.enabled ? 3 : 32;
|
||||
@@ -40,8 +36,10 @@ public abstract class AbstractTab extends GuiButton
|
||||
this.itemRenderer.zLevel = 100.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
this.itemRenderer.renderItemAndEffectIntoGUI(
|
||||
mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
this.itemRenderer.renderItemOverlayIntoGUI(
|
||||
mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
this.itemRenderer.zLevel = 0.0F;
|
||||
@@ -51,19 +49,22 @@ public abstract class AbstractTab extends GuiButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed (Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
boolean inWindow = this.enabled && this.visible && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
boolean inWindow = this.enabled
|
||||
&& this.visible
|
||||
&& mouseX >= this.xPosition
|
||||
&& mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
|
||||
if (inWindow)
|
||||
{
|
||||
if (inWindow) {
|
||||
this.onTabClicked();
|
||||
}
|
||||
|
||||
return inWindow;
|
||||
}
|
||||
|
||||
public abstract void onTabClicked ();
|
||||
public abstract void onTabClicked();
|
||||
|
||||
public abstract boolean shouldAddToList ();
|
||||
public abstract boolean shouldAddToList();
|
||||
}
|
||||
@@ -4,22 +4,18 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.client.ArmorControls;
|
||||
|
||||
public class InventoryTabArmorExtended extends AbstractTab
|
||||
{
|
||||
public InventoryTabArmorExtended()
|
||||
{
|
||||
public class InventoryTabArmorExtended extends AbstractTab {
|
||||
public InventoryTabArmorExtended() {
|
||||
super(0, 0, 0, new ItemStack(Items.diamond_chestplate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
public void onTabClicked() {
|
||||
ArmorControls.openArmorGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
public boolean shouldAddToList() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4,22 +4,18 @@ import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.*;
|
||||
import tconstruct.client.ArmorControls;
|
||||
|
||||
public class InventoryTabKnapsack extends AbstractTab
|
||||
{
|
||||
public InventoryTabKnapsack()
|
||||
{
|
||||
public class InventoryTabKnapsack extends AbstractTab {
|
||||
public InventoryTabKnapsack() {
|
||||
super(0, 0, 0, new ItemStack(TinkerArmor.knapsack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
public void onTabClicked() {
|
||||
ArmorControls.openKnapsackGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
public boolean shouldAddToList() {
|
||||
return ArmorProxyClient.armorExtended != null
|
||||
&& ArmorProxyClient.armorExtended.inventory[2] != null
|
||||
&& ArmorProxyClient.armorExtended.inventory[2].getItem() == TinkerArmor.knapsack;
|
||||
|
||||
@@ -3,22 +3,18 @@ package tconstruct.client.tabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InventoryTabVanilla extends AbstractTab
|
||||
{
|
||||
public InventoryTabVanilla()
|
||||
{
|
||||
public class InventoryTabVanilla extends AbstractTab {
|
||||
public InventoryTabVanilla() {
|
||||
super(0, 0, 0, new ItemStack(Blocks.crafting_table));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
public void onTabClicked() {
|
||||
TabRegistry.openInventoryGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
public boolean shouldAddToList() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,37 @@
|
||||
package tconstruct.client.tabs;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.network.play.client.C0DPacketCloseWindow;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.network.play.client.C0DPacketCloseWindow;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
||||
public class TabRegistry
|
||||
{
|
||||
public class TabRegistry {
|
||||
private static ArrayList<AbstractTab> tabList = new ArrayList<AbstractTab>();
|
||||
|
||||
public static void registerTab (AbstractTab tab)
|
||||
{
|
||||
public static void registerTab(AbstractTab tab) {
|
||||
tabList.add(tab);
|
||||
}
|
||||
|
||||
public static ArrayList<AbstractTab> getTabList ()
|
||||
{
|
||||
public static ArrayList<AbstractTab> getTabList() {
|
||||
return tabList;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void guiPostInit (GuiScreenEvent.InitGuiEvent.Post event)
|
||||
{
|
||||
if ((event.gui instanceof GuiInventory))
|
||||
{
|
||||
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
if ((event.gui instanceof GuiInventory)) {
|
||||
int xSize = 176;
|
||||
int ySize = 166;
|
||||
int guiLeft = (event.gui.width - xSize) / 2;
|
||||
int guiTop = (event.gui.height - ySize) / 2;
|
||||
guiLeft += getPotionOffset();
|
||||
guiLeft += getPotionOffset();
|
||||
|
||||
updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
|
||||
addTabsToList(event.gui.buttonList);
|
||||
@@ -47,22 +40,18 @@ public class TabRegistry
|
||||
|
||||
private static Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static void openInventoryGui ()
|
||||
{
|
||||
public static void openInventoryGui() {
|
||||
mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
|
||||
GuiInventory inventory = new GuiInventory(mc.thePlayer);
|
||||
mc.displayGuiScreen(inventory);
|
||||
}
|
||||
|
||||
public static void updateTabValues (int cornerX, int cornerY, Class<?> selectedButton)
|
||||
{
|
||||
public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedButton) {
|
||||
int count = 2;
|
||||
for (int i = 0; i < tabList.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < tabList.size(); i++) {
|
||||
AbstractTab t = tabList.get(i);
|
||||
|
||||
if (t.shouldAddToList())
|
||||
{
|
||||
if (t.shouldAddToList()) {
|
||||
t.id = count;
|
||||
t.xPosition = cornerX + (count - 2) * 28;
|
||||
t.yPosition = cornerY - 28;
|
||||
@@ -72,51 +61,38 @@ public class TabRegistry
|
||||
}
|
||||
}
|
||||
|
||||
public static void addTabsToList (List buttonList)
|
||||
{
|
||||
for (AbstractTab tab : tabList)
|
||||
{
|
||||
if (tab.shouldAddToList())
|
||||
{
|
||||
public static void addTabsToList(List buttonList) {
|
||||
for (AbstractTab tab : tabList) {
|
||||
if (tab.shouldAddToList()) {
|
||||
buttonList.add(tab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getPotionOffset()
|
||||
{
|
||||
// If at least one potion is active...
|
||||
if (!mc.thePlayer.getActivePotionEffects().isEmpty())
|
||||
{
|
||||
if (Loader.isModLoaded("NotEnoughItems"))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check whether NEI is hidden and enabled
|
||||
Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
|
||||
Object hidden = c.getMethod("isHidden").invoke(null);
|
||||
Object enabled = c.getMethod("isEnabled").invoke(null);
|
||||
if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean)
|
||||
{
|
||||
if ((Boolean)hidden || !((Boolean)enabled))
|
||||
{
|
||||
// If NEI is disabled or hidden, offset the tabs by 60
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If NEI is not installed, offset the tabs
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
|
||||
// No potions, no offset needed
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getPotionOffset() {
|
||||
// If at least one potion is active...
|
||||
if (!mc.thePlayer.getActivePotionEffects().isEmpty()) {
|
||||
if (Loader.isModLoaded("NotEnoughItems")) {
|
||||
try {
|
||||
// Check whether NEI is hidden and enabled
|
||||
Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
|
||||
Object hidden = c.getMethod("isHidden").invoke(null);
|
||||
Object enabled = c.getMethod("isEnabled").invoke(null);
|
||||
if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) {
|
||||
if ((Boolean) hidden || !((Boolean) enabled)) {
|
||||
// If NEI is disabled or hidden, offset the tabs by 60
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} else {
|
||||
// If NEI is not installed, offset the tabs
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
|
||||
// No potions, no offset needed
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user