mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-23 21:39:44 +00:00
Refractored Code
+added Solar Factory -removed unnessecary solar and essentia generator classes +started gtnh researches +added tooltip clearance on solars (maximal output) Signed-off-by: bartimaeusnek <[email protected]>
This commit is contained in:
1 parent
980df8516a
commit
0fecf28b65
397 files changed
+8693
-9288
No files matched your search
@@ -1,16 +1,15 @@
|
||||
package emt.client;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import emt.util.EMTTextHelper;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class EMTKeys {
|
||||
public static KeyBinding keyUnequip;
|
||||
public static KeyBinding keyUnequip;
|
||||
|
||||
public static void registerKeys() {
|
||||
keyUnequip = new KeyBinding(EMTTextHelper.localize("gui.EMT.key.unequip"), Keyboard.KEY_Z, "EMT");
|
||||
ClientRegistry.registerKeyBinding(keyUnequip);
|
||||
}
|
||||
public static void registerKeys() {
|
||||
keyUnequip = new KeyBinding(EMTTextHelper.localize("gui.EMT.key.unequip"), Keyboard.KEY_Z, "EMT");
|
||||
ClientRegistry.registerKeyBinding(keyUnequip);
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,34 @@
|
||||
package emt.client.gui;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.client.gui.container.ContainerEtheralMacerator;
|
||||
import emt.tile.TileEntityEtherealMacerator;
|
||||
import emt.util.EMTTextHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.client.gui.container.ContainerEtheralMacerator;
|
||||
import emt.tile.TileEntityEtherealMacerator;
|
||||
import emt.util.EMTTextHelper;
|
||||
|
||||
public class GuiEtherealMacerator extends GuiContainer {
|
||||
|
||||
public GuiEtherealMacerator(InventoryPlayer inventory, TileEntityEtherealMacerator te) {
|
||||
super(new ContainerEtheralMacerator(inventory, te));
|
||||
xSize = 176;
|
||||
ySize = 165;
|
||||
}
|
||||
public static final ResourceLocation texture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/etherealmacerator.png");
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/etherealmacerator.png");
|
||||
public GuiEtherealMacerator(InventoryPlayer inventory, TileEntityEtherealMacerator te) {
|
||||
super(new ContainerEtheralMacerator(inventory, te));
|
||||
xSize = 176;
|
||||
ySize = 165;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int j, int i) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int j, int i) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.etherealMacerator.title"), 6, 6, 4210752);
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.etherealMacerator.title"), 6, 6, 4210752);
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
@@ -9,67 +9,61 @@ import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GuiGenerator extends GuiContainer {
|
||||
|
||||
private static ResourceLocation tex = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/generator.png");
|
||||
|
||||
TileEntityBaseGenerator tileentity;
|
||||
private boolean allowUserInput;
|
||||
private int xSize;
|
||||
private int ySize;
|
||||
|
||||
public GuiGenerator(InventoryPlayer invPlayer, TileEntityBaseGenerator entity) {
|
||||
super(new ConainerGenerator(invPlayer, entity));
|
||||
this.tileentity = entity;
|
||||
this.allowUserInput = false;
|
||||
this.xSize = 194;
|
||||
this.ySize = 168;
|
||||
}
|
||||
private static ResourceLocation tex = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/generator.png");
|
||||
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
String formatPanelName = I18n.format(this.tileentity.getInventoryName(), new Object[0]);
|
||||
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, nmPos, 7, 6618118);
|
||||
|
||||
String storageString = I18n.format("emt.Storage", new Object[0]);
|
||||
String fuel=I18n.format("emt.Fuel", new Object[0]);
|
||||
if (this.tileentity.maxstorage<1000)
|
||||
this.fontRendererObj.drawString(storageString + this.tileentity.storage + "/" + this.tileentity.maxstorage +"EU", 36, 22, 0);
|
||||
else if (10000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 10000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage) + "/" + (this.tileentity.maxstorage/1000) +"kEU", 36, 22, 0);
|
||||
else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage/1000) + "/" + (this.tileentity.maxstorage/1000000) +"MEU", 36, 22, 0);
|
||||
else if (1000000000 <= this.tileentity.maxstorage)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage/1000000) + "/" + (this.tileentity.maxstorage/1000000000) +"GEU", 36, 22, 0);
|
||||
if(this.tileentity.isActive)
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+Double.toString(this.tileentity.generating/20/20)+" EU/t", 36, 35, 0);
|
||||
else
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+"0 EU/t",36, 35, 0);
|
||||
this.fontRendererObj.drawString(fuel+": "+Integer.toString(this.tileentity.fuel),36,48,0);
|
||||
this.fontRendererObj.drawString(fuel+"/t: "+Integer.toString((this.tileentity.fuel*20*20)-this.tileentity.tick),36,63,0);
|
||||
}
|
||||
TileEntityBaseGenerator tileentity;
|
||||
private int xSize;
|
||||
private int ySize;
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.renderEngine.bindTexture(tex);
|
||||
|
||||
int h = (this.width - this.xSize) / 2;
|
||||
int k = (this.height - this.ySize) / 2;
|
||||
drawTexturedModalRect(h, k, 0, 0, this.xSize, this.ySize);
|
||||
if (this.tileentity.storage > 0)
|
||||
{
|
||||
int l = this.tileentity.gaugeEnergyScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
|
||||
}
|
||||
|
||||
if (this.tileentity.fuel > 0)
|
||||
{
|
||||
int l = this.tileentity.gaugeFuelScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 42, 195, 0, l, 14);
|
||||
}
|
||||
}
|
||||
public GuiGenerator(InventoryPlayer invPlayer, TileEntityBaseGenerator entity) {
|
||||
super(new ConainerGenerator(invPlayer, entity));
|
||||
this.tileentity = entity;
|
||||
this.allowUserInput = false;
|
||||
this.xSize = 194;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
String formatPanelName = I18n.format(this.tileentity.getInventoryName());
|
||||
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, nmPos, 7, 6618118);
|
||||
String storageString = I18n.format("emt.Storage");
|
||||
String fuel = I18n.format("emt.Fuel");
|
||||
if (this.tileentity.maxstorage < 1000)
|
||||
this.fontRendererObj.drawString(storageString + this.tileentity.mpshownstroage * 1000 + "/" + this.tileentity.maxstorage + "EU", 36, 22, 0);
|
||||
else if (10000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 10000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage) + "/" + (this.tileentity.maxstorage / 1000) + "kEU", 36, 22, 0);
|
||||
else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage / 1000) + "/" + (this.tileentity.maxstorage / 1000000) + "MEU", 36, 22, 0);
|
||||
else if (1000000000 <= this.tileentity.maxstorage)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mpshownstroage / 1000000) + "/" + (this.tileentity.maxstorage / 1000000000) + "GEU", 36, 22, 0);
|
||||
if (this.tileentity.isActive)
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating") + Double.toString(this.tileentity.generating / 20 / 20) + " EU/t", 36, 35, 0);
|
||||
else
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating") + "0 EU/t", 36, 35, 0);
|
||||
this.fontRendererObj.drawString(fuel + ": " + Integer.toString(this.tileentity.fuel), 36, 48, 0);
|
||||
this.fontRendererObj.drawString(fuel + "/t: " + Integer.toString((this.tileentity.fuel * 20 * 20) - this.tileentity.tick), 36, 63, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
this.mc.renderEngine.bindTexture(tex);
|
||||
|
||||
int h = (this.width - this.xSize) / 2;
|
||||
int k = (this.height - this.ySize) / 2;
|
||||
drawTexturedModalRect(h, k, 0, 0, this.xSize, this.ySize);
|
||||
if (this.tileentity.mpshownstroage > 0) {
|
||||
int l = this.tileentity.gaugeEnergyScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
|
||||
}
|
||||
|
||||
if (this.tileentity.fuel > 0) {
|
||||
int l = this.tileentity.gaugeFuelScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 42, 195, 0, l, 14);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +1,34 @@
|
||||
package emt.client.gui;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.client.gui.container.ContainerIndustrialWandRecharge;
|
||||
import emt.tile.TileEntityIndustrialWandRecharge;
|
||||
import emt.util.EMTTextHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.client.gui.container.ContainerIndustrialWandRecharge;
|
||||
import emt.tile.TileEntityIndustrialWandRecharge;
|
||||
import emt.util.EMTTextHelper;
|
||||
|
||||
public class GuiIndustrialWandRecharger extends GuiContainer {
|
||||
|
||||
public GuiIndustrialWandRecharger(InventoryPlayer inventory, TileEntityIndustrialWandRecharge te) {
|
||||
super(new ContainerIndustrialWandRecharge(inventory, te));
|
||||
xSize = 176;
|
||||
ySize = 165;
|
||||
}
|
||||
public static final ResourceLocation texture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/wandcharger.png");
|
||||
|
||||
public static final ResourceLocation texture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/wandcharger.png");
|
||||
public GuiIndustrialWandRecharger(InventoryPlayer inventory, TileEntityIndustrialWandRecharge te) {
|
||||
super(new ContainerIndustrialWandRecharge(inventory, te));
|
||||
xSize = 176;
|
||||
ySize = 165;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int j, int i) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
@Override
|
||||
public void drawGuiContainerBackgroundLayer(float f, int j, int i) {
|
||||
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
}
|
||||
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.wandRecharge.title"), 6, 6, 4210752);
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.wandRecharge.title"), 6, 6, 4210752);
|
||||
this.fontRendererObj.drawString(EMTTextHelper.localize("gui.EMT.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
}
|
||||
@@ -10,106 +10,102 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiSolar extends GuiContainer {
|
||||
|
||||
private static ResourceLocation tex = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/solar.png");
|
||||
|
||||
TileEntitySolarBase tileentity;
|
||||
private boolean allowUserInput;
|
||||
private int xSize;
|
||||
private int ySize;
|
||||
private String color;
|
||||
private int cColor;
|
||||
|
||||
public GuiSolar(InventoryPlayer invPlayer, TileEntitySolarBase entity) {
|
||||
super(new ContainerSolars(invPlayer, entity));
|
||||
this.tileentity = entity;
|
||||
this.allowUserInput = false;
|
||||
this.xSize = 194;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
||||
{
|
||||
color = this.tileentity.getInventoryName().replaceAll("Solar", "").replaceAll("Compressed", "").replaceAll("Triple", "").replaceAll("Double", "").trim();
|
||||
if (color != null)
|
||||
switch (color)
|
||||
{
|
||||
case "Aer": {
|
||||
GL11.glColor4f(1.0f, 0.86f, 0.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case "Terra": {
|
||||
GL11.glColor4f(0.0f, 0.66f, 0.08f, 1.0f);
|
||||
cColor=8224255;
|
||||
break;
|
||||
}
|
||||
case "Ordo": {
|
||||
GL11.glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case "Perditio": {
|
||||
GL11.glColor4f(0.33F, 0.33F, 0.33F, 1.0F);
|
||||
break;
|
||||
}
|
||||
case "Ignis": {
|
||||
GL11.glColor4f(0.82f, 0.11f, 0.11f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case "Aqua": {
|
||||
GL11.glColor4f(0.27f, 0.65f, 1.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
this.mc.renderEngine.bindTexture(tex);
|
||||
|
||||
int h = (this.width - this.xSize) / 2;
|
||||
int k = (this.height - this.ySize) / 2;
|
||||
drawTexturedModalRect(h, k, 0, 0, this.xSize, this.ySize);
|
||||
if (this.tileentity.mp_storage > 0)
|
||||
{
|
||||
int l = this.tileentity.gaugeEnergyScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
|
||||
}
|
||||
if (this.tileentity.generating>9)
|
||||
drawTexturedModalRect(h + 18, k + 42, 195, 20, 11, 14);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
||||
{
|
||||
String formatPanelName = I18n.format(this.tileentity.getInventoryName(), new Object[0]);
|
||||
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
|
||||
|
||||
if(!color.equals("Terra"))
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, 6618118);
|
||||
else
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, cColor);
|
||||
|
||||
String storageString = I18n.format("emt.Storage", new Object[0]);
|
||||
|
||||
if (this.tileentity.maxstorage<1000)
|
||||
this.fontRendererObj.drawString(storageString + this.tileentity.storage + "/" + this.tileentity.maxstorage +"EU", 36, 22, 0);
|
||||
else if (10000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 10000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage) + "/" + (this.tileentity.maxstorage/1000) +"kEU", 36, 22, 0);
|
||||
else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage/1000) + "/" + (this.tileentity.maxstorage/1000000) +"MEU", 36, 22, 0);
|
||||
else if (1000000000 <= this.tileentity.maxstorage)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage/1000000) + "/" + (this.tileentity.maxstorage/1000000000) +"GEU", 36, 22, 0);
|
||||
if(this.tileentity.isActive)
|
||||
if (Double.toString(this.tileentity.generating).length()>5)
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+Double.toString(this.tileentity.generating).substring(0, 4)+" EU/t", 36, 35, 0);
|
||||
else
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+Double.toString(this.tileentity.generating)+" EU/t", 36, 35, 0);
|
||||
else
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+"0 EU/t",36, 35, 0);
|
||||
}
|
||||
private static ResourceLocation tex = new ResourceLocation(EMT.TEXTURE_PATH, "textures/guis/solar.png");
|
||||
|
||||
TileEntitySolarBase tileentity;
|
||||
private boolean allowUserInput;
|
||||
private int xSize;
|
||||
private int ySize;
|
||||
private String color;
|
||||
private int cColor;
|
||||
|
||||
public GuiSolar(InventoryPlayer invPlayer, TileEntitySolarBase entity) {
|
||||
super(new ContainerSolars(invPlayer, entity));
|
||||
this.tileentity = entity;
|
||||
this.allowUserInput = false;
|
||||
this.xSize = 194;
|
||||
this.ySize = 168;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
color = this.tileentity.getInventoryName().replaceAll("Solar", "").replaceAll("Compressed", "").replaceAll("Triple", "").replaceAll("Double", "").trim();
|
||||
if (color != null)
|
||||
switch (color) {
|
||||
case "Aer": {
|
||||
GL11.glColor4f(1.0f, 0.86f, 0.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case "Terra": {
|
||||
GL11.glColor4f(0.0f, 0.66f, 0.08f, 1.0f);
|
||||
cColor = 8224255;
|
||||
break;
|
||||
}
|
||||
case "Ordo": {
|
||||
GL11.glColor4f(0.8f, 0.8f, 0.8f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case "Perditio": {
|
||||
GL11.glColor4f(0.33F, 0.33F, 0.33F, 1.0F);
|
||||
break;
|
||||
}
|
||||
case "Ignis": {
|
||||
GL11.glColor4f(0.82f, 0.11f, 0.11f, 1.0f);
|
||||
break;
|
||||
}
|
||||
case "Aqua": {
|
||||
GL11.glColor4f(0.27f, 0.65f, 1.0f, 1.0f);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
|
||||
this.mc.renderEngine.bindTexture(tex);
|
||||
|
||||
int h = (this.width - this.xSize) / 2;
|
||||
int k = (this.height - this.ySize) / 2;
|
||||
drawTexturedModalRect(h, k, 0, 0, this.xSize, this.ySize);
|
||||
if (this.tileentity.mp_storage > 0) {
|
||||
int l = this.tileentity.gaugeEnergyScaled(33);
|
||||
drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14);
|
||||
}
|
||||
if (this.tileentity.generating > 9)
|
||||
drawTexturedModalRect(h + 18, k + 42, 195, 20, 11, 14);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
String formatPanelName = I18n.format(this.tileentity.getInventoryName(), new Object[0]);
|
||||
int nmPos = (this.xSize - this.fontRendererObj.getStringWidth(formatPanelName)) / 2;
|
||||
|
||||
if (!color.equals("Terra"))
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, 6618118);
|
||||
else
|
||||
this.fontRendererObj.drawStringWithShadow(formatPanelName, 0, 7, cColor);
|
||||
|
||||
String storageString = I18n.format("emt.Storage", new Object[0]);
|
||||
|
||||
if (this.tileentity.maxstorage < 1000)
|
||||
this.fontRendererObj.drawString(storageString + this.tileentity.storage + "/" + this.tileentity.maxstorage + "EU", 36, 22, 0);
|
||||
else if (10000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 10000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage) + "/" + (this.tileentity.maxstorage / 1000) + "kEU", 36, 22, 0);
|
||||
else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage / 1000) + "/" + (this.tileentity.maxstorage / 1000000) + "MEU", 36, 22, 0);
|
||||
else if (1000000000 <= this.tileentity.maxstorage)
|
||||
this.fontRendererObj.drawString(storageString + (this.tileentity.mp_storage / 1000000) + "/" + (this.tileentity.maxstorage / 1000000000) + "GEU", 36, 22, 0);
|
||||
if (this.tileentity.isActive)
|
||||
// if (Double.toString(this.tileentity.generating).length()>5)
|
||||
// this.fontRendererObj.drawString(I18n.format("emt.Generating",new Object[0])+Double.toString(this.tileentity.generating).substring(0, 4)+" EU/t", 36, 35, 0);
|
||||
// else
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating", new Object[0]) + Double.toString(this.tileentity.generating) + " EU/t", 36, 35, 0);
|
||||
else
|
||||
this.fontRendererObj.drawString(I18n.format("emt.Generating", new Object[0]) + "0 EU/t", 36, 35, 0);
|
||||
}
|
||||
}
|
||||
@@ -8,27 +8,27 @@ import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.ConfigElement;
|
||||
|
||||
import static emt.util.EMTConfigHandler.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import static emt.util.EMTConfigHandler.*;
|
||||
|
||||
public class EMTGuiConfig extends GuiConfig {
|
||||
|
||||
public EMTGuiConfig(GuiScreen parentScreen) {
|
||||
super(parentScreen, getConfigElements(parentScreen), EMT.MOD_ID, false, false, StatCollector.translateToLocal("gui." + EMT.MOD_ID + ".config.title"));
|
||||
}
|
||||
public EMTGuiConfig(GuiScreen parentScreen) {
|
||||
super(parentScreen, getConfigElements(parentScreen), EMT.MOD_ID, false, false, StatCollector.translateToLocal("gui." + EMT.MOD_ID + ".config.title"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static List<IConfigElement> getConfigElements(GuiScreen parent) {
|
||||
List<IConfigElement> list = new ArrayList<IConfigElement>();
|
||||
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(RANDOM.toLowerCase(Locale.US))));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(VALUES.toLowerCase(Locale.US))));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(RESEARCH.toLowerCase(Locale.US))));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(OUTPUTS.toLowerCase(Locale.US))));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(RANDOM.toLowerCase(Locale.US))));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(VALUES.toLowerCase(Locale.US))));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(RESEARCH.toLowerCase(Locale.US))));
|
||||
list.add(new ConfigElement<ConfigCategory>(config.getCategory(OUTPUTS.toLowerCase(Locale.US))));
|
||||
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@@ -8,23 +8,23 @@ import java.util.Set;
|
||||
|
||||
public class EMTGuiFactory implements IModGuiFactory {
|
||||
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
@Override
|
||||
public void initialize(Minecraft minecraftInstance) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return EMTGuiConfig.class;
|
||||
}
|
||||
@Override
|
||||
public Class<? extends GuiScreen> mainConfigGuiClass() {
|
||||
return EMTGuiConfig.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public Set<RuntimeOptionCategoryElement> runtimeGuiCategories() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,64 +5,89 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import thaumcraft.api.aspects.Aspect;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class ConainerGenerator
|
||||
extends Container
|
||||
{
|
||||
private TileEntityBaseGenerator tileentity;
|
||||
|
||||
public ConainerGenerator(InventoryPlayer inventoryplayer, TileEntityBaseGenerator tileentity)
|
||||
{
|
||||
this.tileentity = tileentity;
|
||||
}
|
||||
|
||||
public void addCraftingToCrafters(ICrafting icrafting)
|
||||
{
|
||||
|
||||
super.addCraftingToCrafters(icrafting);
|
||||
icrafting.sendProgressBarUpdate(this, 0, (short) (this.tileentity.generating/400));
|
||||
icrafting.sendProgressBarUpdate(this, 1, (byte) this.tileentity.fuel);
|
||||
icrafting.sendProgressBarUpdate(this, 2, (short) this.tileentity.mpshownstroage);
|
||||
}
|
||||
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
for (int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)this.crafters.get(i);
|
||||
|
||||
icrafting.sendProgressBarUpdate(this, 0, (short) (this.tileentity.generating/400));
|
||||
icrafting.sendProgressBarUpdate(this, 1, (byte) this.tileentity.fuel);
|
||||
icrafting.sendProgressBarUpdate(this, 2, (short) (this.tileentity.storage/1000));
|
||||
extends Container {
|
||||
private TileEntityBaseGenerator tileentity;
|
||||
|
||||
public ConainerGenerator(InventoryPlayer inventoryplayer, TileEntityBaseGenerator tileentity) {
|
||||
this.tileentity = tileentity;
|
||||
}
|
||||
}
|
||||
|
||||
public void updateProgressBar(int i, int j)
|
||||
{
|
||||
if (i == 0) {
|
||||
this.tileentity.generating = (((int)j)*400);
|
||||
|
||||
public void detectAndSendChanges() {
|
||||
for (int i = 0; i < this.crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
icrafting.sendProgressBarUpdate(this, 0, (short) (this.tileentity.generating / 400));
|
||||
icrafting.sendProgressBarUpdate(this, 1, (byte) this.tileentity.fuel);
|
||||
icrafting.sendProgressBarUpdate(this, 2, (short) (this.tileentity.storage / 1000));
|
||||
icrafting.sendProgressBarUpdate(this, 3, (byte) encryptAspect(this.tileentity.aspect));
|
||||
icrafting.sendProgressBarUpdate(this, 4, (byte) (this.tileentity.isActive ? 1 : 0));
|
||||
}
|
||||
}
|
||||
if (i == 1) {
|
||||
this.tileentity.fuel=((byte) j);
|
||||
|
||||
private byte encryptAspect(Aspect aspect) {
|
||||
switch (aspect.getTag().toUpperCase(Locale.US)) {
|
||||
case "POTENTIA":
|
||||
return 0;
|
||||
case "IGNIS":
|
||||
return 1;
|
||||
case "AURAM":
|
||||
return 2;
|
||||
case "ARBOR":
|
||||
return 3;
|
||||
case "AER":
|
||||
return 4;
|
||||
case "LUCRUM":
|
||||
return 5;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (i == 2) {
|
||||
this.tileentity.mpshownstroage=(short) j;
|
||||
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if (i == 0) {
|
||||
this.tileentity.generating = (((int) j) * 400);
|
||||
} else if (i == 1) {
|
||||
this.tileentity.fuel = ((byte) j);
|
||||
} else if (i == 2) {
|
||||
this.tileentity.mpshownstroage = (short) j;
|
||||
} else if (i == 3 && this.tileentity.aspect == null)
|
||||
switch (j) {
|
||||
case 0:
|
||||
this.tileentity.aspect = Aspect.ENERGY;
|
||||
break;
|
||||
case 1:
|
||||
this.tileentity.aspect = Aspect.FIRE;
|
||||
break;
|
||||
case 2:
|
||||
this.tileentity.aspect = Aspect.AURA;
|
||||
break;
|
||||
case 3:
|
||||
this.tileentity.aspect = Aspect.TREE;
|
||||
break;
|
||||
case 4:
|
||||
this.tileentity.aspect = Aspect.AIR;
|
||||
break;
|
||||
case 5:
|
||||
this.tileentity.aspect = Aspect.GREED;
|
||||
break;
|
||||
}
|
||||
else if (i == 4) {
|
||||
this.tileentity.isActive = ((byte) j) == ((byte) 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
this.detectAndSendChanges();
|
||||
return this.tileentity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
this.detectAndSendChanges();
|
||||
return this.tileentity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -12,77 +12,72 @@ import thaumcraft.common.container.SlotOutput;
|
||||
|
||||
public class ContainerEtheralMacerator extends Container {
|
||||
|
||||
TileEntityEtherealMacerator te;
|
||||
TileEntityEtherealMacerator te;
|
||||
|
||||
public ContainerEtheralMacerator(InventoryPlayer inventory, TileEntity te) {
|
||||
this.te = ((TileEntityEtherealMacerator) te);
|
||||
addSlotToContainer(new Slot(this.te, 0, 56, 26));
|
||||
addSlotToContainer(new SlotOutput(this.te, 2, 116, 26));
|
||||
addSlotToContainer(new SlotOutput(this.te, 1, 116, 53));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
public ContainerEtheralMacerator(InventoryPlayer inventory, TileEntity te) {
|
||||
this.te = ((TileEntityEtherealMacerator) te);
|
||||
addSlotToContainer(new Slot(this.te, 0, 56, 26));
|
||||
addSlotToContainer(new SlotOutput(this.te, 2, 116, 26));
|
||||
addSlotToContainer(new SlotOutput(this.te, 1, 116, 53));
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int j = 0; j < 9; j++) {
|
||||
addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 9; i++) {
|
||||
addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return this.te.isUseableByPlayer(player);
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return this.te.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(par2);
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (par2 == 1) {
|
||||
if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
|
||||
return null;
|
||||
}
|
||||
if (par2 == 1) {
|
||||
if (!this.mergeItemStack(itemstack1, 2, 38, true)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if (par2 != 0) {
|
||||
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) {
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (par2 >= 2 && par2 < 29) {
|
||||
if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (par2 >= 29 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(itemstack1, 3, 38, false)) {
|
||||
return null;
|
||||
}
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
} else if (par2 != 0) {
|
||||
if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) {
|
||||
if (!this.mergeItemStack(itemstack1, 0, 1, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (par2 >= 2 && par2 < 29) {
|
||||
if (!this.mergeItemStack(itemstack1, 29, 38, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (par2 >= 29 && par2 < 38 && !this.mergeItemStack(itemstack1, 2, 29, false)) {
|
||||
return null;
|
||||
}
|
||||
} else if (!this.mergeItemStack(itemstack1, 3, 38, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
|
||||
}
|
||||
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
@@ -9,63 +9,61 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerIndustrialWandRecharge extends Container {
|
||||
|
||||
TileEntityIndustrialWandRecharge charger;
|
||||
TileEntityIndustrialWandRecharge charger;
|
||||
|
||||
public ContainerIndustrialWandRecharge(InventoryPlayer invPlayer, TileEntityIndustrialWandRecharge entity) {
|
||||
this.charger = entity;
|
||||
public ContainerIndustrialWandRecharge(InventoryPlayer invPlayer, TileEntityIndustrialWandRecharge entity) {
|
||||
this.charger = entity;
|
||||
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, x, 8 + x * 18, 142));
|
||||
}
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, x, 8 + x * 18, 142));
|
||||
}
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, 9 + x + y * 9, 8 + x * 18, 84 + y * 18));
|
||||
}
|
||||
}
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(new Slot(invPlayer, 9 + x + y * 9, 8 + x * 18, 84 + y * 18));
|
||||
}
|
||||
}
|
||||
|
||||
this.addSlotToContainer(new Slot(charger, 0, 80, 35));
|
||||
}
|
||||
this.addSlotToContainer(new Slot(charger, 0, 80, 35));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return charger.isUseableByPlayer(player);
|
||||
}
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return charger.isUseableByPlayer(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(par2);
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
ItemStack itemstack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack itemstack1 = slot.getStack();
|
||||
itemstack = itemstack1.copy();
|
||||
|
||||
if (par2 == 36) {
|
||||
if (!this.mergeItemStack(itemstack1, 0, 35, false)) {
|
||||
return null;
|
||||
}
|
||||
if (par2 == 36) {
|
||||
if (!this.mergeItemStack(itemstack1, 0, 35, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
}
|
||||
else if (!charger.isItemValidForSlot(0, itemstack1) || !this.mergeItemStack(itemstack1, 36, 37, false)) {
|
||||
return null;
|
||||
}
|
||||
slot.onSlotChange(itemstack1, itemstack);
|
||||
} else if (!charger.isItemValidForSlot(0, itemstack1) || !this.mergeItemStack(itemstack1, 36, 37, false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
if (itemstack1.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
if (itemstack1.stackSize == itemstack.stackSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
|
||||
}
|
||||
slot.onPickupFromSlot(par1EntityPlayer, itemstack1);
|
||||
}
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
return itemstack;
|
||||
}
|
||||
}
|
||||
@@ -7,66 +7,53 @@ import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerSolars
|
||||
extends Container
|
||||
{
|
||||
private TileEntitySolarBase tileentity;
|
||||
|
||||
public ContainerSolars(InventoryPlayer inventoryplayer, TileEntitySolarBase tileentity)
|
||||
{
|
||||
this.tileentity = tileentity;
|
||||
}
|
||||
|
||||
public void addCraftingToCrafters(ICrafting icrafting)
|
||||
{
|
||||
super.addCraftingToCrafters(icrafting);
|
||||
icrafting.sendProgressBarUpdate(this, 0, (short) this.tileentity.generating);
|
||||
icrafting.sendProgressBarUpdate(this, 1, (short) this.tileentity.mp_storage);
|
||||
}
|
||||
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
short help = 0;
|
||||
if (this.tileentity.generating < 326D && this.tileentity.generating > 9D)
|
||||
help = (short) (this.tileentity.generating*100*-1);
|
||||
else
|
||||
help = (short) (this.tileentity.generating);
|
||||
|
||||
for (int i = 0; i < this.crafters.size(); i++)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting)this.crafters.get(i);
|
||||
|
||||
icrafting.sendProgressBarUpdate(this, 0, help);
|
||||
icrafting.sendProgressBarUpdate(this, 1, (short) (this.tileentity.getSourceStored()/1000));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateProgressBar(int i, int j)
|
||||
{
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
if (i == 0) {
|
||||
if (j < 0) {
|
||||
double help= j;
|
||||
help=help/100*-1;
|
||||
this.tileentity.generating = help;
|
||||
}
|
||||
else
|
||||
this.tileentity.generating=j;
|
||||
public class ContainerSolars
|
||||
extends Container {
|
||||
byte[] generating = new byte[8];
|
||||
byte[] mpStorage = new byte[8];
|
||||
private TileEntitySolarBase tileentity;
|
||||
|
||||
public ContainerSolars(InventoryPlayer inventoryplayer, TileEntitySolarBase tileentity) {
|
||||
this.tileentity = tileentity;
|
||||
}
|
||||
if (i == 1) {
|
||||
this.tileentity.mp_storage = (short) (j);
|
||||
|
||||
public void detectAndSendChanges() {
|
||||
byte[] generating = ByteBuffer.allocate(8).putDouble(this.tileentity.generating).array();
|
||||
byte[] mpStorage = ByteBuffer.allocate(8).putDouble(this.tileentity.getSourceStored() / 1000).array();
|
||||
for (int i = 0; i < this.crafters.size(); i++) {
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get(i);
|
||||
|
||||
for (int j = 0; j < generating.length; j++) {
|
||||
icrafting.sendProgressBarUpdate(this, j, generating[j]);
|
||||
}
|
||||
|
||||
for (int j = 0; j < mpStorage.length; j++) {
|
||||
icrafting.sendProgressBarUpdate(this, 8 + j, mpStorage[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateProgressBar(int i, int j) {
|
||||
if (i < 8) {
|
||||
generating[i] = (byte) j;
|
||||
if (i == 7)
|
||||
this.tileentity.generating = ByteBuffer.wrap(generating).getDouble();
|
||||
}
|
||||
if (i > 7 && i < 16) {
|
||||
mpStorage[i - 8] = (byte) j;
|
||||
if (i == 15)
|
||||
this.tileentity.mp_storage = (long) ByteBuffer.wrap(mpStorage).getDouble();
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
this.detectAndSendChanges();
|
||||
return this.tileentity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
this.detectAndSendChanges();
|
||||
return this.tileentity.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
@@ -10,111 +10,111 @@ import net.minecraft.item.EnumAction;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ModelSpecialArmor extends ModelBiped {
|
||||
public ModelRenderer rightWing;
|
||||
public ModelRenderer leftWing;
|
||||
public ModelRenderer center;
|
||||
public ModelRenderer jetpack;
|
||||
public boolean isJumping;
|
||||
public int type = 0;// 0 - Nothing, 1 - Jetpack, 2 - Wings
|
||||
public ModelRenderer rightWing;
|
||||
public ModelRenderer leftWing;
|
||||
public ModelRenderer center;
|
||||
public ModelRenderer jetpack;
|
||||
public boolean isJumping;
|
||||
public int type = 0;// 0 - Nothing, 1 - Jetpack, 2 - Wings
|
||||
|
||||
public ModelSpecialArmor() {
|
||||
this(1, 0);
|
||||
}
|
||||
public ModelSpecialArmor() {
|
||||
this(1, 0);
|
||||
}
|
||||
|
||||
public ModelSpecialArmor(float scale, int type) {
|
||||
this(scale, 0.0F, type);
|
||||
}
|
||||
public ModelSpecialArmor(float scale, int type) {
|
||||
this(scale, 0.0F, type);
|
||||
}
|
||||
|
||||
public ModelSpecialArmor(float scale, float offset, int type) {
|
||||
super(scale, offset, type == 1? 128 : 64, type == 0? 32 : type == 1? 96 : 64);
|
||||
this.type = type;
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 96;
|
||||
this.jetpack = new ModelRenderer(this, 16, 69);
|
||||
this.jetpack.setTextureSize(64, 48);
|
||||
this.jetpack.addBox(-4.0F, -12.0F, -2.0F, 8, 12 * 2, 4, scale * 2);
|
||||
this.jetpack.setRotationPoint(0.0F, 0.0F + offset, 0.0F);
|
||||
break;
|
||||
public ModelSpecialArmor(float scale, float offset, int type) {
|
||||
super(scale, offset, type == 1 ? 128 : 64, type == 0 ? 32 : type == 1 ? 96 : 64);
|
||||
this.type = type;
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.textureWidth = 128;
|
||||
this.textureHeight = 96;
|
||||
this.jetpack = new ModelRenderer(this, 16, 69);
|
||||
this.jetpack.setTextureSize(64, 48);
|
||||
this.jetpack.addBox(-4.0F, -12.0F, -2.0F, 8, 12 * 2, 4, scale * 2);
|
||||
this.jetpack.setRotationPoint(0.0F, 0.0F + offset, 0.0F);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 64;
|
||||
rightWing = new ModelRenderer(this, 24, 0 + 32);
|
||||
rightWing.addBox(-11F, -1F, 0F, 11, 13, 1);
|
||||
rightWing.setRotationPoint(-2F, 0F, 3F);
|
||||
rightWing.setTextureSize(64, 32);
|
||||
rightWing.mirror = false;
|
||||
setRotation(rightWing, 0F, 0.1570796F, 0F);
|
||||
|
||||
leftWing = new ModelRenderer(this, 0, 0 + 32);
|
||||
leftWing.addBox(0F, -1F, 0F, 11, 13, 1);
|
||||
leftWing.setRotationPoint(2F, 0F, 3F);
|
||||
leftWing.setTextureSize(64, 32);
|
||||
leftWing.mirror = true;
|
||||
setRotation(leftWing, 0F, -0.1570796F, 0F);
|
||||
case 2:
|
||||
this.textureWidth = 64;
|
||||
this.textureHeight = 64;
|
||||
rightWing = new ModelRenderer(this, 24, 0 + 32);
|
||||
rightWing.addBox(-11F, -1F, 0F, 11, 13, 1);
|
||||
rightWing.setRotationPoint(-2F, 0F, 3F);
|
||||
rightWing.setTextureSize(64, 32);
|
||||
rightWing.mirror = false;
|
||||
setRotation(rightWing, 0F, 0.1570796F, 0F);
|
||||
|
||||
center = new ModelRenderer(this, 0, 14 + 32);
|
||||
center.addBox(0F, 0F, 1F, 8, 14, 1);
|
||||
center.setRotationPoint(-4F, 0F, 3F);
|
||||
center.setTextureSize(64, 32);
|
||||
center.mirror = true;
|
||||
setRotation(center, 0F, 0F, 0F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
leftWing = new ModelRenderer(this, 0, 0 + 32);
|
||||
leftWing.addBox(0F, -1F, 0F, 11, 13, 1);
|
||||
leftWing.setRotationPoint(2F, 0F, 3F);
|
||||
leftWing.setTextureSize(64, 32);
|
||||
leftWing.mirror = true;
|
||||
setRotation(leftWing, 0F, -0.1570796F, 0F);
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
center = new ModelRenderer(this, 0, 14 + 32);
|
||||
center.addBox(0F, 0F, 1F, 8, 14, 1);
|
||||
center.setRotationPoint(-4F, 0F, 3F);
|
||||
center.setTextureSize(64, 32);
|
||||
center.mirror = true;
|
||||
setRotation(center, 0F, 0F, 0F);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void render(Entity entity, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
this.heldItemRight = player.inventory.getCurrentItem() != null? 1 : 0;
|
||||
this.isRiding = player.isRiding();
|
||||
this.isSneak = player.isSneaking();
|
||||
this.aimedBow = player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem().getItemUseAction(player.inventory.getCurrentItem()) == EnumAction.bow && player.isUsingItem();
|
||||
this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entity);
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
this.bipedBody.render(scale);
|
||||
this.bipedRightArm.render(scale);
|
||||
this.bipedLeftArm.render(scale);
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.jetpack.render(scale);
|
||||
break;
|
||||
case 2:
|
||||
this.center.render(scale);
|
||||
this.leftWing.render(scale);
|
||||
this.rightWing.render(scale);
|
||||
}
|
||||
public void render(Entity entity, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
this.heldItemRight = player.inventory.getCurrentItem() != null ? 1 : 0;
|
||||
this.isRiding = player.isRiding();
|
||||
this.isSneak = player.isSneaking();
|
||||
this.aimedBow = player.inventory.getCurrentItem() != null && player.inventory.getCurrentItem().getItem().getItemUseAction(player.inventory.getCurrentItem()) == EnumAction.bow && player.isUsingItem();
|
||||
this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entity);
|
||||
|
||||
}
|
||||
this.bipedBody.render(scale);
|
||||
this.bipedRightArm.render(scale);
|
||||
this.bipedLeftArm.render(scale);
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.jetpack.render(scale);
|
||||
break;
|
||||
case 2:
|
||||
this.center.render(scale);
|
||||
this.leftWing.render(scale);
|
||||
this.rightWing.render(scale);
|
||||
}
|
||||
|
||||
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity) {
|
||||
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entity);
|
||||
if (this.isJumping) {
|
||||
this.rightWing.rotateAngleY = 0.5f;
|
||||
this.leftWing.rotateAngleY = -0.5f;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.isSneak) {
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.jetpack.rotateAngleX = 0.5F;
|
||||
break;
|
||||
case 2:
|
||||
this.center.offsetY -= 0.1;
|
||||
this.rightWing.offsetY -= 0.1;
|
||||
this.leftWing.offsetY -= 0.1;
|
||||
this.center.rotateAngleX = 0.5F;
|
||||
this.rightWing.rotateAngleX = 0.5F;
|
||||
this.leftWing.rotateAngleX = 0.5F;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void setRotationAngles(float p_78087_1_, float p_78087_2_, float p_78087_3_, float p_78087_4_, float p_78087_5_, float p_78087_6_, Entity entity) {
|
||||
super.setRotationAngles(p_78087_1_, p_78087_2_, p_78087_3_, p_78087_4_, p_78087_5_, p_78087_6_, entity);
|
||||
if (this.isJumping) {
|
||||
this.rightWing.rotateAngleY = 0.5f;
|
||||
this.leftWing.rotateAngleY = -0.5f;
|
||||
}
|
||||
|
||||
if (this.isSneak) {
|
||||
switch (this.type) {
|
||||
case 1:
|
||||
this.jetpack.rotateAngleX = 0.5F;
|
||||
break;
|
||||
case 2:
|
||||
this.center.offsetY -= 0.1;
|
||||
this.rightWing.offsetY -= 0.1;
|
||||
this.leftWing.offsetY -= 0.1;
|
||||
this.center.rotateAngleX = 0.5F;
|
||||
this.rightWing.rotateAngleX = 0.5F;
|
||||
this.leftWing.rotateAngleX = 0.5F;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,70 +6,69 @@ import net.minecraft.entity.Entity;
|
||||
|
||||
public class ModelWings extends ModelBiped {
|
||||
|
||||
ModelRenderer rightWing;
|
||||
ModelRenderer leftWing;
|
||||
ModelRenderer center;
|
||||
public boolean isJumping = false;
|
||||
ModelRenderer rightWing;
|
||||
ModelRenderer leftWing;
|
||||
ModelRenderer center;
|
||||
|
||||
public boolean isJumping = false;
|
||||
public ModelWings() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
public ModelWings() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
rightWing = new ModelRenderer(this, 24, 0);
|
||||
rightWing.addBox(-11F, -1F, -1.5F, 11, 13, 1);
|
||||
rightWing.setRotationPoint(-2F, 0F, 3F);
|
||||
rightWing.setTextureSize(64, 32);
|
||||
rightWing.mirror = false;
|
||||
setRotation(rightWing, 0F, 0.1570796F, 0F);
|
||||
|
||||
rightWing = new ModelRenderer(this, 24, 0);
|
||||
rightWing.addBox(-11F, -1F, -1.5F, 11, 13, 1);
|
||||
rightWing.setRotationPoint(-2F, 0F, 3F);
|
||||
rightWing.setTextureSize(64, 32);
|
||||
rightWing.mirror = false;
|
||||
setRotation(rightWing, 0F, 0.1570796F, 0F);
|
||||
leftWing = new ModelRenderer(this, 0, 0);
|
||||
leftWing.addBox(0F, -1F, -1.5F, 11, 13, 1);
|
||||
leftWing.setRotationPoint(2F, 0F, 3F);
|
||||
leftWing.setTextureSize(64, 32);
|
||||
leftWing.mirror = true;
|
||||
setRotation(leftWing, 0F, -0.1570796F, 0F);
|
||||
|
||||
leftWing = new ModelRenderer(this, 0, 0);
|
||||
leftWing.addBox(0F, -1F, -1.5F, 11, 13, 1);
|
||||
leftWing.setRotationPoint(2F, 0F, 3F);
|
||||
leftWing.setTextureSize(64, 32);
|
||||
leftWing.mirror = true;
|
||||
setRotation(leftWing, 0F, -0.1570796F, 0F);
|
||||
center = new ModelRenderer(this, 0, 14);
|
||||
center.addBox(0F, 0F, -0.5F, 8, 14, 1);
|
||||
center.setRotationPoint(-4F, 0F, 3F);
|
||||
center.setTextureSize(64, 32);
|
||||
center.mirror = true;
|
||||
setRotation(center, 0F, 0F, 0F);
|
||||
|
||||
center = new ModelRenderer(this, 0, 14);
|
||||
center.addBox(0F, 0F, -0.5F, 8, 14, 1);
|
||||
center.setRotationPoint(-4F, 0F, 3F);
|
||||
center.setTextureSize(64, 32);
|
||||
center.mirror = true;
|
||||
setRotation(center, 0F, 0F, 0F);
|
||||
this.bipedBody.addChild(rightWing);
|
||||
this.bipedBody.addChild(leftWing);
|
||||
this.bipedBody.addChild(center);
|
||||
}
|
||||
|
||||
this.bipedBody.addChild(rightWing);
|
||||
this.bipedBody.addChild(leftWing);
|
||||
this.bipedBody.addChild(center);
|
||||
}
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
rightWing.render(f5);
|
||||
leftWing.render(f5);
|
||||
center.render(f5);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
this.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
rightWing.render(f5);
|
||||
leftWing.render(f5);
|
||||
center.render(f5);
|
||||
}
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
public void setRotationAngles(float f, float f1, float pt, float f3, float f4, float f5, Entity entity) {
|
||||
|
||||
public void setRotationAngles(float f, float f1, float pt, float f3, float f4, float f5, Entity entity) {
|
||||
if (isJumping) {
|
||||
this.rightWing.rotateAngleY = 0.5f;
|
||||
this.leftWing.rotateAngleY = -0.5f;
|
||||
}
|
||||
|
||||
if (isJumping) {
|
||||
this.rightWing.rotateAngleY = 0.5f;
|
||||
this.leftWing.rotateAngleY = -0.5f;
|
||||
}
|
||||
|
||||
if (entity.isSneaking()) {
|
||||
this.center.offsetY -= 0.1;
|
||||
this.rightWing.offsetY -= 0.1;
|
||||
this.leftWing.offsetY -= 0.1;
|
||||
this.center.rotateAngleX = 0.5F;
|
||||
this.rightWing.rotateAngleX = 0.5F;
|
||||
this.leftWing.rotateAngleX = 0.5F;
|
||||
}
|
||||
}
|
||||
if (entity.isSneaking()) {
|
||||
this.center.offsetY -= 0.1;
|
||||
this.rightWing.offsetY -= 0.1;
|
||||
this.leftWing.offsetY -= 0.1;
|
||||
this.center.rotateAngleX = 0.5F;
|
||||
this.rightWing.rotateAngleX = 0.5F;
|
||||
this.leftWing.rotateAngleX = 0.5F;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package emt.client.renderer;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.entity.EntityLaser;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
@@ -7,63 +9,60 @@ import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.entity.EntityLaser;
|
||||
|
||||
public class RenderLaser extends Render {
|
||||
|
||||
private static final ResourceLocation laserTexture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/models/lasermodel.png");
|
||||
private static final ResourceLocation laserTexture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/models/lasermodel.png");
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entityLaser, double x, double y, double z, float par8, float pTick) {
|
||||
this.bindEntityTexture(entityLaser);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glRotatef(entityLaser.rotationYaw - 90, 0, 1, 0);
|
||||
GL11.glRotatef(entityLaser.rotationPitch, 0, 0, 1);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
byte b0 = 0;
|
||||
float f2 = 0.4f;
|
||||
float f3 = 0.7f;
|
||||
float f4 = (float) (0 + b0 * 10) / 32f;
|
||||
float f5 = (float) (5 + b0 * 10) / 32f;
|
||||
float f10 = 0.05625F;
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
@Override
|
||||
public void doRender(Entity entityLaser, double x, double y, double z, float par8, float pTick) {
|
||||
this.bindEntityTexture(entityLaser);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glRotatef(entityLaser.rotationYaw - 90, 0, 1, 0);
|
||||
GL11.glRotatef(entityLaser.rotationPitch, 0, 0, 1);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
byte b0 = 0;
|
||||
float f2 = 0.4f;
|
||||
float f3 = 0.7f;
|
||||
float f4 = (float) (0 + b0 * 10) / 32f;
|
||||
float f5 = (float) (5 + b0 * 10) / 32f;
|
||||
float f10 = 0.05625F;
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glRotatef(45, 1, 0, 0);
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
GL11.glTranslatef(-4, 0, 0);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glRotatef(45, 1, 0, 0);
|
||||
GL11.glScalef(f10, f10, f10);
|
||||
GL11.glTranslatef(-4, 0, 0);
|
||||
GL11.glPushAttrib(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
GL11.glNormal3f(0, 0, f10);
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(-8, 0, 0, f2, f4);
|
||||
tess.addVertexWithUV(8, 0, 0, f3, f4);
|
||||
tess.addVertexWithUV(8, 4, 0, f3, f5);
|
||||
tess.addVertexWithUV(-8, 4, 0, f2, f5);
|
||||
tess.draw();
|
||||
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(8, 0, 0, f2, f4);
|
||||
tess.addVertexWithUV(-8, 0, 0, f3, f4);
|
||||
tess.addVertexWithUV(-8, 4, 0, f3, f5);
|
||||
tess.addVertexWithUV(8, 4, 0, f2, f5);
|
||||
tess.draw();
|
||||
}
|
||||
GL11.glPopAttrib();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
GL11.glRotatef(90, 1, 0, 0);
|
||||
GL11.glNormal3f(0, 0, f10);
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(-8, 0, 0, f2, f4);
|
||||
tess.addVertexWithUV(8, 0, 0, f3, f4);
|
||||
tess.addVertexWithUV(8, 4, 0, f3, f5);
|
||||
tess.addVertexWithUV(-8, 4, 0, f2, f5);
|
||||
tess.draw();
|
||||
|
||||
protected ResourceLocation getArrowTextures(EntityLaser entityLaser) {
|
||||
return laserTexture;
|
||||
}
|
||||
tess.startDrawingQuads();
|
||||
tess.addVertexWithUV(8, 0, 0, f2, f4);
|
||||
tess.addVertexWithUV(-8, 0, 0, f3, f4);
|
||||
tess.addVertexWithUV(-8, 4, 0, f3, f5);
|
||||
tess.addVertexWithUV(8, 4, 0, f2, f5);
|
||||
tess.draw();
|
||||
}
|
||||
GL11.glPopAttrib();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getArrowTextures((EntityLaser) entity);
|
||||
}
|
||||
protected ResourceLocation getArrowTextures(EntityLaser entityLaser) {
|
||||
return laserTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity entity) {
|
||||
return this.getArrowTextures((EntityLaser) entity);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,5 @@
|
||||
package emt.client.renderer;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import emt.EMT;
|
||||
import emt.entity.EntityShield;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -14,86 +9,90 @@ import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
|
||||
public class RenderShield extends Render {
|
||||
private static final ResourceLocation shieldTexture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/models/shield.png");
|
||||
static int glCallList;
|
||||
private static final ResourceLocation shieldTexture = new ResourceLocation(EMT.TEXTURE_PATH, "textures/models/shield.png");
|
||||
static int glCallList;
|
||||
|
||||
static {
|
||||
glCallList = GLAllocation.generateDisplayLists(3);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glNewList(glCallList, GL11.GL_COMPILE);
|
||||
static {
|
||||
glCallList = GLAllocation.generateDisplayLists(3);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glNewList(glCallList, GL11.GL_COMPILE);
|
||||
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
float sin1;
|
||||
float cos1;
|
||||
float sin1;
|
||||
float cos1;
|
||||
|
||||
float sin2;
|
||||
float cos2;
|
||||
float sin2;
|
||||
float cos2;
|
||||
|
||||
float hsin1 = -1;
|
||||
float hcos1 = 0;
|
||||
float hsin1 = -1;
|
||||
float hcos1 = 0;
|
||||
|
||||
float hsin2;
|
||||
float hcos2;
|
||||
float hsin2;
|
||||
float hcos2;
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
for (float h = -90; h < 90; h += 15) {
|
||||
sin1 = 0;
|
||||
cos1 = 1;
|
||||
tessellator.startDrawingQuads();
|
||||
for (float h = -90; h < 90; h += 15) {
|
||||
sin1 = 0;
|
||||
cos1 = 1;
|
||||
|
||||
hsin2 = MathHelper.sin((float) Math.toRadians(h + 15));
|
||||
hcos2 = MathHelper.cos((float) Math.toRadians(h + 15));
|
||||
hsin2 = MathHelper.sin((float) Math.toRadians(h + 15));
|
||||
hcos2 = MathHelper.cos((float) Math.toRadians(h + 15));
|
||||
|
||||
for (float angle = 0; angle < 360; angle += 15) {
|
||||
sin2 = MathHelper.sin((float) Math.toRadians(angle + 15));
|
||||
cos2 = MathHelper.cos((float) Math.toRadians(angle + 15));
|
||||
for (float angle = 0; angle < 360; angle += 15) {
|
||||
sin2 = MathHelper.sin((float) Math.toRadians(angle + 15));
|
||||
cos2 = MathHelper.cos((float) Math.toRadians(angle + 15));
|
||||
|
||||
tessellator.addVertexWithUV(sin1 * hcos1 * 2, hsin1 * 2, cos1 * hcos1 * 2, 1, 1);
|
||||
tessellator.addVertexWithUV(sin1 * hcos2 * 2, hsin2 * 2, cos1 * hcos2 * 2, 1, 0);
|
||||
tessellator.addVertexWithUV(sin2 * hcos2 * 2, hsin2 * 2, cos2 * hcos2 * 2, 0, 0);
|
||||
tessellator.addVertexWithUV(sin2 * hcos1 * 2, hsin1 * 2, cos2 * hcos1 * 2, 0, 1);
|
||||
tessellator.addVertexWithUV(sin1 * hcos1 * 2, hsin1 * 2, cos1 * hcos1 * 2, 1, 1);
|
||||
tessellator.addVertexWithUV(sin1 * hcos2 * 2, hsin2 * 2, cos1 * hcos2 * 2, 1, 0);
|
||||
tessellator.addVertexWithUV(sin2 * hcos2 * 2, hsin2 * 2, cos2 * hcos2 * 2, 0, 0);
|
||||
tessellator.addVertexWithUV(sin2 * hcos1 * 2, hsin1 * 2, cos2 * hcos1 * 2, 0, 1);
|
||||
|
||||
sin1 = sin2;
|
||||
cos1 = cos2;
|
||||
}
|
||||
sin1 = sin2;
|
||||
cos1 = cos2;
|
||||
}
|
||||
|
||||
hsin1 = hsin2;
|
||||
hcos1 = hcos2;
|
||||
}
|
||||
tessellator.draw();
|
||||
hsin1 = hsin2;
|
||||
hcos1 = hcos2;
|
||||
}
|
||||
tessellator.draw();
|
||||
|
||||
GL11.glEndList();
|
||||
}
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doRender(Entity entityShield, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityShield);
|
||||
@Override
|
||||
public void doRender(Entity entityShield, double x, double y, double z, float par8, float par9) {
|
||||
this.bindEntityTexture(entityShield);
|
||||
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPushAttrib(GL_LIGHTING);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glAlphaFunc(GL_GREATER, 0);
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glPushAttrib(GL_LIGHTING);
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glPushMatrix();
|
||||
if (((EntityShield) entityShield).owner != null && !Minecraft.getMinecraft().thePlayer.getDisplayName().equals(((EntityShield) entityShield).owner.getDisplayName())) {
|
||||
glTranslated(x, y, z);
|
||||
}
|
||||
glPushMatrix();
|
||||
if (((EntityShield) entityShield).owner != null && !Minecraft.getMinecraft().thePlayer.getDisplayName().equals(((EntityShield) entityShield).owner.getDisplayName())) {
|
||||
glTranslated(x, y, z);
|
||||
}
|
||||
|
||||
glCallList(this.glCallList);
|
||||
glCallList(this.glCallList);
|
||||
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
glPopMatrix();
|
||||
glPopAttrib();
|
||||
glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity texture) {
|
||||
return shieldTexture;
|
||||
}
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture(Entity texture) {
|
||||
return shieldTexture;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user