diff --git a/.gitignore b/.gitignore index 3ba4cc5..7f4c30f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/bin/ #General use .gitignore for Minecraft modding. #Folders @@ -43,4 +44,4 @@ Thumbs.db #Vim backups *~ -*.bat +*.bat \ No newline at end of file diff --git a/build.gradle b/build.gradle index a87d18f..e3ea640 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,11 @@ buildscript { apply plugin: 'forge' +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + ext.configFile = file "build.properties" configFile.withReader { def prop = new Properties() diff --git a/build.properties b/build.properties index b867c87..0074e92 100644 --- a/build.properties +++ b/build.properties @@ -1,5 +1,5 @@ package_group=emt mc_version=1.7.10 forge_version=10.13.4.1614 -mod_version=1.2.7.0 +mod_version=1.2.7.1 mod_name=ElectroMagicTools diff --git a/src/main/java/emt/block/BlockSolars.java b/src/main/java/emt/block/BlockSolars.java index 835e4b6..5adc12b 100644 --- a/src/main/java/emt/block/BlockSolars.java +++ b/src/main/java/emt/block/BlockSolars.java @@ -28,6 +28,7 @@ import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -223,4 +224,20 @@ public class BlockSolars extends BlockBaseContainer { world.removeTileEntity(x, y, z); super.breakBlock(world, x, y, z, block, meta); } + + @Override + public boolean onBlockActivated(World world, int i, int j, int k, EntityPlayer player, int s, float f1, float f2, float f3) + { + if (player.isSneaking()) { + return false; + } + if (world.isRemote) { + return true; + } + TileEntity tileentity = world.getTileEntity(i, j, k); + if (tileentity != null) { + player.openGui(emt.EMT.instance, 1, world, i, j, k); + } + return true; + } } diff --git a/src/main/java/emt/client/gui/GuiSolar.java b/src/main/java/emt/client/gui/GuiSolar.java new file mode 100644 index 0000000..ab1e225 --- /dev/null +++ b/src/main/java/emt/client/gui/GuiSolar.java @@ -0,0 +1,115 @@ +package emt.client.gui; + +import org.lwjgl.opengl.GL11; + +import emt.EMT; +import emt.client.gui.container.ConainerGenerator; +import emt.client.gui.container.ContainerSolars; +import emt.tile.generator.TileEntityBaseGenerator; +import emt.tile.solar.TileEntitySolarBase; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.resources.I18n; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.ResourceLocation; + +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.storage > 0) + { + int l = this.tileentity.gaugeEnergyScaled(33); + drawTexturedModalRect(h + 18, k + 23, 195, 0, l, 14); + } + if (this.tileentity.generating>0) + 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.storage/1000) + "/" + (this.tileentity.maxstorage/1000) +"kEU", 36, 22, 0); + else if (10000000 <= this.tileentity.maxstorage && this.tileentity.maxstorage < 1000000000) + this.fontRendererObj.drawString(storageString + (this.tileentity.storage/1000000) + "/" + (this.tileentity.maxstorage/1000000) +"MEU", 36, 22, 0); + else if (1000000000 <= this.tileentity.maxstorage) + this.fontRendererObj.drawString(storageString + (this.tileentity.storage/1000000000) + "/" + (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); + } +} diff --git a/src/main/java/emt/client/gui/container/ConainerGenerator.java b/src/main/java/emt/client/gui/container/ConainerGenerator.java index 43c5e5b..0f24225 100644 --- a/src/main/java/emt/client/gui/container/ConainerGenerator.java +++ b/src/main/java/emt/client/gui/container/ConainerGenerator.java @@ -126,6 +126,7 @@ public class ConainerGenerator public boolean canInteractWith(EntityPlayer entityplayer) { + detectAndSendChanges(); return this.tileentity.isUseableByPlayer(entityplayer); } } \ No newline at end of file diff --git a/src/main/java/emt/client/gui/container/ContainerSolars.java b/src/main/java/emt/client/gui/container/ContainerSolars.java new file mode 100644 index 0000000..0ea62c8 --- /dev/null +++ b/src/main/java/emt/client/gui/container/ContainerSolars.java @@ -0,0 +1,125 @@ +package emt.client.gui.container; + +import emt.tile.solar.TileEntitySolarBase; +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.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class ContainerSolars + extends Container +{ + private TileEntitySolarBase tileentity; + public int storage; + + public ContainerSolars(InventoryPlayer inventoryplayer, TileEntitySolarBase tileentity) + { + this.storage = 0; + this.tileentity = tileentity; + /* for (int j = 0; j < 4; j++) { + addSlotToContainer(new Slot(this.tileentity, j, 17 + j * 18, 59)); + } + + for (int i = 0; i < 3; i++) { + for (int k = 0; k < 9; k++) { + addSlotToContainer(new Slot(inventoryplayer, k + i * 9 + 9, 17 + k * 18, 86 + i * 18)); + } + } + for (int j = 0; j < 9; j++) { + addSlotToContainer(new Slot(inventoryplayer, j, 17 + j * 18, 144)); + } + + addSlotToContainer(new Slot(this.tileentity, 5, 17 + 7 * 18, 59));*/ + } + + public void addCraftingToCrafters(ICrafting icrafting) + { + super.addCraftingToCrafters(icrafting); + icrafting.sendProgressBarUpdate(this, 0, (int) this.tileentity.generating); + icrafting.sendProgressBarUpdate(this, 1, this.tileentity.storage); + } + + public void detectAndSendChanges() + { + super.detectAndSendChanges(); + float help = (float) (this.tileentity.generating*1000); + for (int i = 0; i < this.crafters.size(); i++) + { + ICrafting icrafting = (ICrafting)this.crafters.get(i); + + icrafting.sendProgressBarUpdate(this, 0, (int) help); + icrafting.sendProgressBarUpdate(this, 1, this.tileentity.storage); + } + this.tileentity.storage = ((int)this.tileentity.energySource.getEnergyStored()); + } + + public void updateProgressBar(int i, int j) + { + if (i == 0) { + float help = (float)j; + this.tileentity.generating = help/1000; + } + if (i == 1) { + if (j= 0) && (slot <= 3)) + { + if (!mergeItemStack(stackInSlot, 4, 40, true)) { + return null; + } + } + else if ((slot >= 4) && (slot < 31)) + { + if (!mergeItemStack(stackInSlot, 0, 4, false)) { + if (!mergeItemStack(stackInSlot, 31, 40, false)) { + return null; + } + } + } + else if ((slot >= 31) && (slot < 39)) + { + if (!mergeItemStack(stackInSlot, 0, 30, false)) { + return null; + } + } + else if (!mergeItemStack(stackInSlot, 0, 30, false)) { + return null; + } + if (stackInSlot.stackSize == 0) { + slotObject.putStack(null); + } else { + slotObject.onSlotChanged(); + } + if (stack.stackSize != stackInSlot.stackSize) { + slotObject.onPickupFromSlot(par1EntityPlayer, stackInSlot); + } else { + return null; + } + } + return stack; + } + + public boolean canInteractWith(EntityPlayer entityplayer) + { + detectAndSendChanges(); + return this.tileentity.isUseableByPlayer(entityplayer); + } +} \ No newline at end of file diff --git a/src/main/java/emt/item/block/ItemBlockEssentiaGenerators.java b/src/main/java/emt/item/block/ItemBlockEssentiaGenerators.java index 40728d4..83529c0 100644 --- a/src/main/java/emt/item/block/ItemBlockEssentiaGenerators.java +++ b/src/main/java/emt/item/block/ItemBlockEssentiaGenerators.java @@ -6,6 +6,7 @@ import org.lwjgl.input.Keyboard; import emt.util.EMTConfigHandler; import emt.util.EMTEssentiasOutputs; +import emt.util.EMTTextHelper; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; @@ -58,38 +59,39 @@ public class ItemBlockEssentiaGenerators extends ItemBlock { if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { switch (is.getItemDamage()) { case 0: - list.add(StatCollector.translateToLocal("emt.Output")+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.ENERGY.getTag())/20/20)) +" EU/t"); - list.add(StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.ENERGY.getTag()))) +" EU"); - + list.add(EMTTextHelper.BRIGHT_BLUE+StatCollector.translateToLocal("emt.Generating")+EMTTextHelper.LIGHT_GRAY+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.ENERGY.getTag())/20/20)) +" EU/t"); + list.add(EMTTextHelper.BRIGHT_GREEN+StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+EMTTextHelper.LIGHT_GRAY+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.ENERGY.getTag()))) +" EU"); break; + case 1: - list.add(StatCollector.translateToLocal("emt.Output")+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.FIRE.getTag())/20/20)) +" EU/t"); - list.add(StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.FIRE.getTag()))) +" EU"); + list.add(EMTTextHelper.BRIGHT_BLUE+StatCollector.translateToLocal("emt.Generating")+EMTTextHelper.LIGHT_GRAY+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.FIRE.getTag())/20/20)) +" EU/t"); + list.add(EMTTextHelper.BRIGHT_GREEN+StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+EMTTextHelper.LIGHT_GRAY+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.FIRE.getTag()))) +" EU"); break; + case 2: - list.add(StatCollector.translateToLocal("emt.Output")+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.AURA.getTag())/20/20)) +" EU/t"); - list.add(StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.AURA.getTag()))) +" EU"); - + list.add(EMTTextHelper.BRIGHT_BLUE+StatCollector.translateToLocal("emt.Generating")+EMTTextHelper.LIGHT_GRAY+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.AURA.getTag())/20/20)) +" EU/t"); + list.add(EMTTextHelper.BRIGHT_GREEN+StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+EMTTextHelper.LIGHT_GRAY+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.AURA.getTag()))) +" EU"); break; + case 3: - list.add(StatCollector.translateToLocal("emt.Output")+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.TREE.getTag())/20/20)) +" EU/t"); - list.add(StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.FIRE.getTag()))) +" EU"); - + list.add(EMTTextHelper.BRIGHT_BLUE+StatCollector.translateToLocal("emt.Generating")+EMTTextHelper.LIGHT_GRAY+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.TREE.getTag())/20/20)) +" EU/t"); + list.add(EMTTextHelper.BRIGHT_GREEN+StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+EMTTextHelper.LIGHT_GRAY+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.FIRE.getTag()))) +" EU"); break; + case 4: - list.add(StatCollector.translateToLocal("emt.Output")+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.AIR.getTag())/20/20)) +" EU/t"); - list.add(StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.AIR.getTag()))) +" EU"); - + list.add(EMTTextHelper.BRIGHT_BLUE+StatCollector.translateToLocal("emt.Generating")+EMTTextHelper.LIGHT_GRAY+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.AIR.getTag())/20/20)) +" EU/t"); + list.add(EMTTextHelper.BRIGHT_GREEN+StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+EMTTextHelper.LIGHT_GRAY+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.AIR.getTag()))) +" EU"); break; + case 5: - list.add(StatCollector.translateToLocal("emt.Output")+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.GREED.getTag())/20/20)) +" EU/t"); - list.add(StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.GREED.getTag()))) +" EU"); - + list.add(EMTTextHelper.BRIGHT_BLUE+StatCollector.translateToLocal("emt.Generating")+EMTTextHelper.LIGHT_GRAY+Integer.toString((int)(EMTEssentiasOutputs.outputs.get(Aspect.GREED.getTag())/20/20)) +" EU/t"); + list.add(EMTTextHelper.BRIGHT_GREEN+StatCollector.translateToLocal("gui.EMT.book.aspect.output.essentia.eu")+": "+EMTTextHelper.LIGHT_GRAY+Double.toString((EMTEssentiasOutputs.outputs.get(Aspect.GREED.getTag()))) +" EU"); break; + default: break; } - list.add(StatCollector.translateToLocal("emt.Storage")+Double.toString(EMTConfigHandler.EssentiaGeneratorStorage)+" EU"); + list.add(EMTTextHelper.YELLOW+StatCollector.translateToLocal("emt.Storage")+EMTTextHelper.LIGHT_GRAY+Double.toString(EMTConfigHandler.EssentiaGeneratorStorage)+" EU"); } else list.add(StatCollector.translateToLocal("emt.PressShift")); } diff --git a/src/main/java/emt/item/block/ItemBlockSolars.java b/src/main/java/emt/item/block/ItemBlockSolars.java index 9f8a2aa..8906c1f 100644 --- a/src/main/java/emt/item/block/ItemBlockSolars.java +++ b/src/main/java/emt/item/block/ItemBlockSolars.java @@ -4,6 +4,8 @@ import static emt.util.EMTTextHelper.localize; import java.util.List; +import org.lwjgl.input.Keyboard; + import emt.block.BlockBaseContainer; import emt.util.EMTConfigHandler; import emt.util.EMTTextHelper; @@ -11,6 +13,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; public class ItemBlockSolars extends ItemBlock { @@ -136,6 +139,7 @@ public class ItemBlockSolars extends ItemBlock { @Override public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean advancedItemTooltips) { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) { if (instance == 0) { switch (itemstack.getItemDamage()) { case 0: { @@ -150,65 +154,81 @@ public class ItemBlockSolars extends ItemBlock { list.add(EMTConfigHandler.tripleCompressedSolarOutput + localize("tooltip.EMT.euPerTick")); break; } - case 3: { - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.compressedSolarOutput + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.raining")); + case 3: {//aqua + list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.compressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.compressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.underwater")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (3F * EMTConfigHandler.compressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.raining")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (6F * EMTConfigHandler.compressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.thunder")); break; } case 4: { - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.doubleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.raining")); + list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.doubleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.doubleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.underwater")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (3F * EMTConfigHandler.doubleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.raining")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (6F * EMTConfigHandler.doubleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.thunder")); break; } case 5: { - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.tripleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.raining")); + list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.tripleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.tripleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.underwater")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (3F * EMTConfigHandler.tripleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.raining")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + (6F * EMTConfigHandler.tripleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.thunder")); break; } - case 6: { - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.compressedSolarOutput + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); + + case 6: {//dark + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (0.75F * EMTConfigHandler.compressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.day")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.compressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); break; } case 7: { - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.doubleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); + + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (0.75F * EMTConfigHandler.doubleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.day")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.doubleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); break; } case 8: { - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.tripleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (0.75F * EMTConfigHandler.tripleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.day")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.tripleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); break; } - case 9: { - list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.compressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.triple")); + case 9: {//ordo + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.compressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.day")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (0.75F * EMTConfigHandler.compressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); break; } case 10: { - list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.doubleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.triple")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.doubleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.day")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (0.75F * EMTConfigHandler.doubleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); break; } case 11: { - list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.tripleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.triple")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (2F * EMTConfigHandler.tripleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.day")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + (0.75F * EMTConfigHandler.tripleCompressedSolarOutput) + " " + localize("tooltip.EMT.euPerTick") + " " + localize("tooltip.EMT.night")); break; } - case 12: { + case 12: {//fire list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.compressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.triple") + " " + localize("tooltip.EMT.output.double.lava")); list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double") + " " + localize("tooltip.EMT.output.double.nether")); break; } case 13: { list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.doubleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.triple") + " " + localize("tooltip.EMT.output.double.lava")); list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double") + " " + localize("tooltip.EMT.output.double.nether")); break; } case 14: { list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.tripleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double") + " " + localize("tooltip.EMT.output.double.lava")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.triple") + " " + localize("tooltip.EMT.output.double.lava")); list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double") + " " + localize("tooltip.EMT.output.double.nether")); break; } - case 15: { + case 15: {//aer list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.compressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half") + " " + localize("tooltip.EMT.output.double.half.height")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half.height")); break; } default: { @@ -222,27 +242,27 @@ public class ItemBlockSolars extends ItemBlock { switch (itemstack.getItemDamage()) { case 0: { list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.doubleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half") + " " + localize("tooltip.EMT.output.double.half.height")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half.height")); break; } case 1: { list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.tripleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half") + " " + localize("tooltip.EMT.output.double.half.height")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half.height")); break; } - case 2: { + case 2: {//terra list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.compressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half") + " " + localize("tooltip.EMT.output.double.half.low")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half.low")); break; } case 3: { list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.doubleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half") + " " + localize("tooltip.EMT.output.double.half.low")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half.low")); break; } case 4: { list.add(EMTTextHelper.BRIGHT_BLUE + localize("tooltip.EMT.normalConditions") + ": " + EMTTextHelper.LIGHT_GRAY + EMTConfigHandler.tripleCompressedSolarOutput + " " + localize("tooltip.EMT.euPerTick")); - list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half") + " " + localize("tooltip.EMT.output.double.half.low")); + list.add(EMTTextHelper.BRIGHT_GREEN + localize("tooltip.EMT.specialEffect") + ": " + EMTTextHelper.LIGHT_GRAY + localize("tooltip.EMT.output.double.half.low")); break; } default: { @@ -251,5 +271,7 @@ public class ItemBlockSolars extends ItemBlock { } } } + } else + list.add(StatCollector.translateToLocal("emt.PressShift")); } } diff --git a/src/main/java/emt/proxy/CommonProxy.java b/src/main/java/emt/proxy/CommonProxy.java index e4dc4b9..f80129b 100644 --- a/src/main/java/emt/proxy/CommonProxy.java +++ b/src/main/java/emt/proxy/CommonProxy.java @@ -4,12 +4,15 @@ import cpw.mods.fml.common.network.IGuiHandler; import emt.client.gui.GuiEtherealMacerator; import emt.client.gui.GuiGenerator; import emt.client.gui.GuiIndustrialWandRecharger; +import emt.client.gui.GuiSolar; import emt.client.gui.container.ConainerGenerator; import emt.client.gui.container.ContainerEtheralMacerator; import emt.client.gui.container.ContainerIndustrialWandRecharge; +import emt.client.gui.container.ContainerSolars; import emt.tile.TileEntityEtherealMacerator; import emt.tile.TileEntityIndustrialWandRecharge; import emt.tile.generator.TileEntityBaseGenerator; +import emt.tile.solar.TileEntitySolarBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; @@ -40,6 +43,9 @@ public class CommonProxy implements IGuiHandler { else if (entity != null && entity instanceof TileEntityBaseGenerator) { return new ConainerGenerator(player.inventory, (TileEntityBaseGenerator) entity); } + else if (entity != null && entity instanceof TileEntitySolarBase) { + return new ContainerSolars(player.inventory, (TileEntitySolarBase) entity); + } default: return null; } @@ -61,6 +67,9 @@ public class CommonProxy implements IGuiHandler { else if (entity != null && entity instanceof TileEntityBaseGenerator) { return new GuiGenerator(player.inventory, (TileEntityBaseGenerator) entity); } + else if (entity != null && entity instanceof TileEntitySolarBase) { + return new GuiSolar(player.inventory, (TileEntitySolarBase) entity); + } default: return null; } diff --git a/src/main/java/emt/tile/generator/TileEntityBaseGenerator.java b/src/main/java/emt/tile/generator/TileEntityBaseGenerator.java index 73731e9..90136ad 100644 --- a/src/main/java/emt/tile/generator/TileEntityBaseGenerator.java +++ b/src/main/java/emt/tile/generator/TileEntityBaseGenerator.java @@ -54,21 +54,22 @@ public class TileEntityBaseGenerator public TileEntityBaseGenerator(Aspect aspect) { - this.energySource.setCapacity(EMTConfigHandler.EssentiaGeneratorStorage); - this.maxstorage = ((int)this.energySource.getCapacity()); - this.maxfuel = 64; - this.fuel = 0; - this.storage = 0; - this.refuel = 1; - this.aspect = aspect; - this.generating = ((Double)EMTEssentiasOutputs.outputs.get(aspect.getTag())).doubleValue(); - this.color = -1; + super(); + this.energySource.setCapacity(EMTConfigHandler.EssentiaGeneratorStorage); + this.maxstorage = ((int)this.energySource.getCapacity()); + this.maxfuel = 64; + this.fuel = 0; + this.storage = 0; + this.refuel = 1; + this.aspect = aspect; + this.generating = ((Double)EMTEssentiasOutputs.outputs.get(aspect.getTag())).doubleValue(); + this.color = -1; } public void updateEntity() { this.dead = false; - this.timer = 1L; + this.timer =+ 1L; storeFuel(); fillfrompipe(); createEnergy(); @@ -76,20 +77,6 @@ public class TileEntityBaseGenerator this.energySource.updateEntity(); } - public void inputintoGTnet() - { - for (byte i = 0; i < 6; i = (byte)(i + 1)) { - if (getIGregTechTileEntityAtSide(i) != null) - { - IGregTechTileEntity aBaseMetaTileEntity = getIGregTechTileEntityAtSide(i); - if (isUniversalEnergyStored(getOutputVoltage() * getOutputAmperage())) - { - long tEU = IEnergyConnected.Util.emitEnergyToNetwork(getOutputVoltage(), getOutputAmperage(), this); - drainEnergyUnits(i, getOutputVoltage(), tEU); - } - } - } - } public void storeFuel() { @@ -384,7 +371,21 @@ public class TileEntityBaseGenerator { return true; } - + public void inputintoGTnet() + { + for (byte i = 0; i < 6; i = (byte)(i + 1)) { + if (getIGregTechTileEntityAtSide(i) != null) + { + IGregTechTileEntity aBaseMetaTileEntity = getIGregTechTileEntityAtSide(i); + if (isUniversalEnergyStored(getOutputVoltage() * getOutputAmperage())) + { + long tEU = IEnergyConnected.Util.emitEnergyToNetwork(getOutputVoltage(), getOutputAmperage(), this); + drainEnergyUnits(i, getOutputVoltage(), tEU); + } + } + } + } + public byte getColorization() { return this.color; diff --git a/src/main/java/emt/tile/solar/TileEntitySolarBase.java b/src/main/java/emt/tile/solar/TileEntitySolarBase.java index af4bd91..8d28eef 100644 --- a/src/main/java/emt/tile/solar/TileEntitySolarBase.java +++ b/src/main/java/emt/tile/solar/TileEntitySolarBase.java @@ -1,15 +1,32 @@ package emt.tile.solar; -import ic2.api.energy.prefab.BasicSource; -import ic2.api.tile.IWrenchable; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; - import java.util.Random; +import cpw.mods.fml.common.FMLCommonHandler; import emt.tile.TileEntityEMT; +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.tileentity.IBasicEnergyContainer; +import gregtech.api.interfaces.tileentity.IEnergyConnected; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.interfaces.tileentity.IHasWorldObjectAndCoords; +import gregtech.api.net.GT_Packet_Block_Event; +import ic2.api.energy.prefab.BasicSource; +import ic2.api.tile.IWrenchable; +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; +import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.IFluidHandler; -public abstract class TileEntitySolarBase extends TileEntityEMT implements IWrenchable { +public abstract class TileEntitySolarBase extends TileEntityEMT implements IInventory, IWrenchable, IHasWorldObjectAndCoords, IEnergyConnected, IBasicEnergyContainer { public BasicSource energySource; public static Random random = new Random(); @@ -19,26 +36,32 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IWren public boolean noSunlight; public int tick; public double output = 0; + public long timer = 0L; + public boolean dead = true; + public double generating; + public byte color = (-1); + public int storage; + public long maxstorage=0; + public boolean isActive=false; public TileEntitySolarBase() { - this.tick = random.nextInt(64); + this.tick = 10; + this.storage = 0; } @Override public void updateEntity() { + this.dead = false; + this.timer =+ 1L; + inputintoGTnet(); energySource.updateEntity(); checkConditions(); } + public abstract float calc_multi(); + public void checkConditions() { - if (!initialized && worldObj != null) { - canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; - noSunlight = worldObj.provider.hasNoSky; initialized = true; - } - if (noSunlight) { - return; - } if (tick-- == 0) { updateSunState(); tick = 64; @@ -48,8 +71,13 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IWren public void createEnergy() { if (theSunIsVisible) { - energySource.addEnergy(output); + isActive=true; + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + this.energySource.addEnergy(this.output*calc_multi()); + this.generating=output*calc_multi(); + } } + else isActive=false; } public void updateSunState() { @@ -80,6 +108,55 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IWren energySource.readFromNBT(nbttagcompound); } + public int getSizeInventory(){ + return 5; + } + + public ItemStack getStackInSlot(int i){ + return null; + } + + public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_){ + return null; + } + + public ItemStack getStackInSlotOnClosing(int p_70304_1_){ + return null; + } + + public void setInventorySlotContents(int p_70299_1_, ItemStack p_70299_2_) {} + + public boolean hasCustomInventoryName(){ + return true; + } + + public String getInventoryName() + { + return StatCollector.translateToLocal("tile.EMT.solar."+getInventoryName().replaceAll(" ", "").toLowerCase()+".name"); + } + + public int getInventoryStackLimit(){ + return 0; + } + + public boolean isUseableByPlayer(EntityPlayer p_70300_1_){ + return true; + } + + public void openInventory() {} + + public void closeInventory() {} + + public int gaugeEnergyScaled(int i){ + return (int) (this.storage * i / (int) this.maxstorage); + } + + + @Override + public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) { + return false; + } + @Override public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) { return false; @@ -103,4 +180,493 @@ public abstract class TileEntitySolarBase extends TileEntityEMT implements IWren public float getWrenchDropRate() { return 1; } + + public void inputintoGTnet() + { + for (byte i = 0; i < 6; i = (byte)(i + 1)) { + if (getIGregTechTileEntityAtSide(i) != null) + { + IGregTechTileEntity aBaseMetaTileEntity = getIGregTechTileEntityAtSide(i); + if (isUniversalEnergyStored(getOutputVoltage() * getOutputAmperage())) + { + long tEU = IEnergyConnected.Util.emitEnergyToNetwork(getOutputVoltage(), getOutputAmperage(), this); + drainEnergyUnits(i, getOutputVoltage(), tEU); + } + } + } + } + + public byte getColorization() + { + return this.color; + } + + public byte setColorization(byte aColor) + { + this.color = aColor; + return this.color; + } + + public boolean isUniversalEnergyStored(long aEnergyAmount) + { + return aEnergyAmount < this.energySource.getEnergyStored(); + } + + public long getUniversalEnergyStored() + { + return (long) this.energySource.getEnergyStored(); + } + + public long getUniversalEnergyCapacity() + { + return (long) this.energySource.getCapacity(); + } + + public long getOutputAmperage(){ + long ret; + if(this.energySource.getSourceTier()<=4) { + if (this.generating <= GT_Values.V[this.energySource.getSourceTier()-2]) { + ret = 1L; + } + if (this.generating % GT_Values.V[this.energySource.getSourceTier()-2] == 0.0D) { + ret = (long) (this.generating / GT_Values.V[this.energySource.getSourceTier()-2]); + } + else + ret = (long) (1L + (this.generating / GT_Values.V[this.energySource.getSourceTier()-2])); + } + else { + if (this.generating <= GT_Values.V[this.energySource.getSourceTier()-1]) { + ret= 1L; + } + if (this.generating % GT_Values.V[this.energySource.getSourceTier()] == 0.0D) { + ret= (long) (this.generating / GT_Values.V[this.energySource.getSourceTier()-1]); + } + else + ret= (long) (1L + (this.generating / GT_Values.V[this.energySource.getSourceTier()-1])); + } + return ret; + + } + + public long getOutputVoltage() + { + if(this.energySource.getSourceTier()<=4) + return GT_Values.V[(this.energySource.getSourceTier()-2)]; + else + return GT_Values.V[(this.energySource.getSourceTier()-1)]; + } + + public long getInputAmperage() + { + return 0L; + } + + public long getInputVoltage() + { + return 0L; + } + + public boolean decreaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooLessEnergy) + { + if (this.energySource.getEnergyStored() > aEnergy) + { + this.energySource.drawEnergy(aEnergy); + this.storage = ((int)this.energySource.getEnergyStored()); + return true; + } + return false; + } + + public boolean increaseStoredEnergyUnits(long aEnergy, boolean aIgnoreTooMuchEnergy) + { + return false; + } + + public boolean drainEnergyUnits(byte aSide, long aVoltage, long aAmperage) + { + return decreaseStoredEnergyUnits(aVoltage * aAmperage, this.energySource.getEnergyStored() > aVoltage * aAmperage); + } + + public long getAverageElectricInput() + { + return 0L; + } + + public long getAverageElectricOutput() + { + return 0L; + } + + public long getStoredEU() + { + return (long) this.energySource.getEnergyStored(); + } + + public long getEUCapacity(){ + return (long) this.energySource.getCapacity(); + } + + public long getStoredSteam() + { + return 0L; + } + + public long getSteamCapacity() + { + return 0L; + } + + public boolean increaseStoredSteam(long aEnergy, boolean aIgnoreTooMuchEnergy) + { + return false; + } + + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) + { + return 0L; + } + + public boolean inputEnergyFrom(byte aSide) + { + return false; + } + + public boolean outputsEnergyTo(byte aSide) + { + return true; + } + + public boolean energyStateReady() + { + return true; + } + + public World getWorld() + { + return this.worldObj; + } + + public int getXCoord() + { + return this.xCoord; + } + + public short getYCoord() + { + return (short)this.yCoord; + } + + public int getZCoord() + { + return this.zCoord; + } + + public boolean isServerSide() + { + return FMLCommonHandler.instance().getEffectiveSide().isServer(); + } + + public boolean isClientSide() + { + return FMLCommonHandler.instance().getEffectiveSide().isClient(); + } + + public int getRandomNumber(int aRange) + { + return this.worldObj.rand.nextInt(aRange); + } + + public TileEntity getTileEntity(int aX, int aY, int aZ) + { + return this.worldObj.getTileEntity(aX, aY, aZ); + } + + public TileEntity getTileEntityOffset(int aX, int aY, int aZ) + { + return this.worldObj.getTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); + } + + public TileEntity getTileEntityAtSide(byte aSide) + { + if ((aSide < 0) || (aSide >= 6)) { + return null; + } + int tX = getOffsetX(aSide, 1);int tY = getOffsetY(aSide, 1);int tZ = getOffsetZ(aSide, 1); + return this.worldObj.getTileEntity(tX, tY, tZ); + } + + public TileEntity getTileEntityAtSideAndDistance(byte aSide, int aDistance) + { + if (aDistance == 1) { + return getTileEntityAtSide(aSide); + } + return getTileEntity(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); + } + + public IInventory getIInventory(int aX, int aY, int aZ) + { + return null; + } + + public IInventory getIInventoryOffset(int aX, int aY, int aZ) + { + return null; + } + + public IInventory getIInventoryAtSide(byte aSide) + { + return null; + } + + public IInventory getIInventoryAtSideAndDistance(byte aSide, int aDistance) + { + return null; + } + + public IFluidHandler getITankContainer(int aX, int aY, int aZ) + { + return null; + } + + public IFluidHandler getITankContainerOffset(int aX, int aY, int aZ) + { + return null; + } + + public IFluidHandler getITankContainerAtSide(byte aSide) + { + return null; + } + + public IFluidHandler getITankContainerAtSideAndDistance(byte aSide, int aDistance) + { + return null; + } + + public IGregTechTileEntity getIGregTechTileEntity(int aX, int aY, int aZ) + { + TileEntity tTileEntity = getTileEntity(aX, aY, aZ); + if ((tTileEntity instanceof IGregTechTileEntity)) { + return (IGregTechTileEntity)tTileEntity; + } + return null; + } + + public IGregTechTileEntity getIGregTechTileEntityOffset(int aX, int aY, int aZ) + { + return getIGregTechTileEntity(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); + } + + public IGregTechTileEntity getIGregTechTileEntityAtSide(byte aSide) + { + TileEntity tTileEntity = getTileEntityAtSide(aSide); + if ((tTileEntity instanceof IGregTechTileEntity)) { + return (IGregTechTileEntity)tTileEntity; + } + return null; + } + + public IGregTechTileEntity getIGregTechTileEntityAtSideAndDistance(byte aSide, int aDistance) + { + TileEntity tTileEntity = getTileEntityAtSideAndDistance(aSide, aDistance); + if ((tTileEntity instanceof IGregTechTileEntity)) { + return (IGregTechTileEntity)tTileEntity; + } + return null; + } + + public Block getBlock(int aX, int aY, int aZ) + { + return this.worldObj.getBlock(aX, aY, aZ); + } + + public Block getBlockOffset(int aX, int aY, int aZ) + { + return getBlock(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); + } + + public Block getBlockAtSide(byte aSide) + { + if ((aSide < 0) || (aSide >= 6)) { + return null; + } + int tX = getOffsetX(aSide, 1);int tY = getOffsetY(aSide, 1);int tZ = getOffsetZ(aSide, 1); + return this.worldObj.getBlock(tX, tY, tZ); + } + + public Block getBlockAtSideAndDistance(byte aSide, int aDistance) + { + if (aDistance == 1) { + return getBlockAtSide(aSide); + } + return getBlock(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); + } + + public byte getMetaID(int aX, int aY, int aZ) + { + return (byte)this.worldObj.getBlockMetadata(aX, aY, aZ); + } + + public byte getMetaIDOffset(int aX, int aY, int aZ) + { + return getMetaID(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); + } + + public byte getMetaIDAtSide(byte aSide) + { + int tX = getOffsetX(aSide, 1);int tY = getOffsetY(aSide, 1);int tZ = getOffsetZ(aSide, 1); + return (byte)this.worldObj.getBlockMetadata(tX, tY, tZ); + } + + public byte getMetaIDAtSideAndDistance(byte aSide, int aDistance) + { + if (aDistance == 1) { + return getMetaIDAtSide(aSide); + } + return getMetaID(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); + } + + public byte getLightLevel(int aX, int aY, int aZ) + { + return 0; + } + + public byte getLightLevelOffset(int aX, int aY, int aZ) + { + return 0; + } + + public byte getLightLevelAtSide(byte aSide) + { + return 0; + } + + public byte getLightLevelAtSideAndDistance(byte aSide, int aDistance) + { + return 0; + } + + public boolean getOpacity(int aX, int aY, int aZ) + { + return false; + } + + public boolean getOpacityOffset(int aX, int aY, int aZ) + { + return false; + } + + public boolean getOpacityAtSide(byte aSide) + { + return false; + } + + public boolean getOpacityAtSideAndDistance(byte aSide, int aDistance) + { + return false; + } + + public boolean getSky(int aX, int aY, int aZ) + { + boolean sky = true; + do + { + if (!this.worldObj.getBlock(aX, ++aY, aZ).getMaterial().equals(Material.air)) { + sky = false; + } + } while ((sky) && (aY < 256)); + return sky; + } + + public boolean getSkyOffset(int aX, int aY, int aZ) + { + return getSky(aX + this.xCoord, aY + this.yCoord, aZ + this.zCoord); + } + + public boolean getSkyAtSide(byte aSide) + { + return false; + } + + public boolean getSkyAtSideAndDistance(byte aSide, int aDistance) + { + return false; + } + + public boolean getAir(int aX, int aY, int aZ) + { + return this.worldObj.getBlock(aX, aY, aZ).equals(Blocks.air); + } + + public boolean getAirOffset(int aX, int aY, int aZ) + { + return getAir(this.xCoord + aX, this.yCoord + aY, this.zCoord + aZ); + } + + public boolean getAirAtSide(byte aSide) + { + return getAirAtSideAndDistance(aSide, 1); + } + + public boolean getAirAtSideAndDistance(byte aSide, int aDistance) + { + return getAir(getOffsetX(aSide, aDistance), getOffsetY(aSide, aDistance), getOffsetZ(aSide, aDistance)); + } + + public BiomeGenBase getBiome() + { + return this.worldObj.getBiomeGenForCoords(this.xCoord, this.zCoord); + } + + public BiomeGenBase getBiome(int aX, int aZ) + { + return this.worldObj.getBiomeGenForCoords(aX, aZ); + } + + public int getOffsetX(byte aSide, int aMultiplier) + { + return this.xCoord + ForgeDirection.getOrientation(aSide).offsetX * aMultiplier; + } + + public short getOffsetY(byte aSide, int aMultiplier) + { + return (short)(this.yCoord + ForgeDirection.getOrientation(aSide).offsetY * aMultiplier); + } + + public int getOffsetZ(byte aSide, int aMultiplier) + { + return this.zCoord + ForgeDirection.getOrientation(aSide).offsetZ * aMultiplier; + } + + public boolean isDead() + { + return this.dead; + } + + public void sendBlockEvent(byte aID, byte aValue) + { + GT_Values.NW.sendPacketToAllPlayersInRange(this.worldObj, new GT_Packet_Block_Event(this.xCoord, (short)this.yCoord, this.zCoord, aID, aValue), this.xCoord, this.zCoord); + } + + public long getTimer() + { + return this.timer; + } + + public void setLightValue(byte aLightValue) {} + + public boolean isInvalidTileEntity() + { + return this.tileEntityInvalid; + } + + public boolean openGUI(EntityPlayer aPlayer, int aID) + { + return false; + } + + public boolean openGUI(EntityPlayer aPlayer) + { + return false; + } } diff --git a/src/main/java/emt/tile/solar/air/TileEntityAirSolar.java b/src/main/java/emt/tile/solar/air/TileEntityAirSolar.java index 7320599..035fd1c 100644 --- a/src/main/java/emt/tile/solar/air/TileEntityAirSolar.java +++ b/src/main/java/emt/tile/solar/air/TileEntityAirSolar.java @@ -13,20 +13,27 @@ public class TileEntityAirSolar extends TileEntitySolarBase { super(); energySource = new BasicSource(this, 10000, 3); output = EMTConfigHandler.compressedSolarOutput; - } - + this.maxstorage=this.getEUCapacity(); + }; + @Override - public void createEnergy() { - if (theSunIsVisible && this.yCoord >= 160) { - energySource.addEnergy(output * 2.5); - } - else if (theSunIsVisible) { - energySource.addEnergy(output); - } - } + public float calc_multi() { + if (this.yCoord<5) + return 1F; + else if (this.yCoord>220) + return 3F; + else + return (float) ((41D/43D) + ((2D/215D) * (double) this.yCoord)); + + } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 15); } + + @Override + public String getInventoryName() { + return "Compressed Aer Solar"; + } } diff --git a/src/main/java/emt/tile/solar/air/TileEntityDoubleAirSolar.java b/src/main/java/emt/tile/solar/air/TileEntityDoubleAirSolar.java index fc91a6b..9e7a33b 100644 --- a/src/main/java/emt/tile/solar/air/TileEntityDoubleAirSolar.java +++ b/src/main/java/emt/tile/solar/air/TileEntityDoubleAirSolar.java @@ -10,12 +10,18 @@ public class TileEntityDoubleAirSolar extends TileEntityAirSolar { public TileEntityDoubleAirSolar() { super(); - energySource = new BasicSource(this, 10000, 4); + energySource = new BasicSource(this, 100000, 4); output = EMTConfigHandler.doubleCompressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars2, 1, 0); } + + @Override + public String getInventoryName() { + return "Double Compressed Aer Solar"; + } } diff --git a/src/main/java/emt/tile/solar/air/TileEntityTripleAirSolar.java b/src/main/java/emt/tile/solar/air/TileEntityTripleAirSolar.java index 1f8d3c3..c21a0bd 100644 --- a/src/main/java/emt/tile/solar/air/TileEntityTripleAirSolar.java +++ b/src/main/java/emt/tile/solar/air/TileEntityTripleAirSolar.java @@ -11,11 +11,17 @@ public class TileEntityTripleAirSolar extends TileEntityAirSolar { public TileEntityTripleAirSolar() { super(); output = EMTConfigHandler.tripleCompressedSolarOutput; - energySource = new BasicSource(this, 40000, 5); + energySource = new BasicSource(this, 1000000, 5); + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars2, 1, 1); } + + @Override + public String getInventoryName() { + return "Triple Compressed Aer Solar"; + } } diff --git a/src/main/java/emt/tile/solar/compressed/TileEntityCompressedSolar.java b/src/main/java/emt/tile/solar/compressed/TileEntityCompressedSolar.java index 8c1b1af..43dd883 100644 --- a/src/main/java/emt/tile/solar/compressed/TileEntityCompressedSolar.java +++ b/src/main/java/emt/tile/solar/compressed/TileEntityCompressedSolar.java @@ -13,10 +13,21 @@ public class TileEntityCompressedSolar extends TileEntitySolarBase { super(); energySource = new BasicSource(this, 10000, 3); output = EMTConfigHandler.compressedSolarOutput; - } + this.maxstorage=this.getEUCapacity(); + }; @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 0); } + + @Override + public float calc_multi() { + return 1F; + } + + @Override + public String getInventoryName() { + return "Compressed Solar"; + } } diff --git a/src/main/java/emt/tile/solar/compressed/TileEntityDoubleCompressedSolar.java b/src/main/java/emt/tile/solar/compressed/TileEntityDoubleCompressedSolar.java index fb9424e..e495bb3 100644 --- a/src/main/java/emt/tile/solar/compressed/TileEntityDoubleCompressedSolar.java +++ b/src/main/java/emt/tile/solar/compressed/TileEntityDoubleCompressedSolar.java @@ -11,12 +11,23 @@ public class TileEntityDoubleCompressedSolar extends TileEntitySolarBase { public TileEntityDoubleCompressedSolar() { super(); - energySource = new BasicSource(this, 10000, 4); + energySource = new BasicSource(this, 100000, 4); output = EMTConfigHandler.doubleCompressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 1); } + + @Override + public float calc_multi() { + return 1F; + } + + @Override + public String getInventoryName() { + return "Double Compressed Solar"; + } } diff --git a/src/main/java/emt/tile/solar/compressed/TileEntityTripleCompressedSolar.java b/src/main/java/emt/tile/solar/compressed/TileEntityTripleCompressedSolar.java index b66055a..cef8f25 100644 --- a/src/main/java/emt/tile/solar/compressed/TileEntityTripleCompressedSolar.java +++ b/src/main/java/emt/tile/solar/compressed/TileEntityTripleCompressedSolar.java @@ -12,11 +12,22 @@ public class TileEntityTripleCompressedSolar extends TileEntitySolarBase { public TileEntityTripleCompressedSolar() { super(); output = EMTConfigHandler.tripleCompressedSolarOutput; - energySource = new BasicSource(this, 40000, 5); + energySource = new BasicSource(this, 1000000, 5); + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 2); } + + @Override + public float calc_multi() { + return 1F; + } + + @Override + public String getInventoryName() { + return "Triple Compressed Solar"; + } } diff --git a/src/main/java/emt/tile/solar/dark/TileEntityDarkSolar.java b/src/main/java/emt/tile/solar/dark/TileEntityDarkSolar.java index cf3e940..93ff1b4 100644 --- a/src/main/java/emt/tile/solar/dark/TileEntityDarkSolar.java +++ b/src/main/java/emt/tile/solar/dark/TileEntityDarkSolar.java @@ -1,5 +1,6 @@ package emt.tile.solar.dark; +import cpw.mods.fml.common.FMLCommonHandler; import emt.init.EMTBlocks; import emt.tile.solar.TileEntitySolarBase; import emt.util.EMTConfigHandler; @@ -13,17 +14,34 @@ public class TileEntityDarkSolar extends TileEntitySolarBase { super(); energySource = new BasicSource(this, 10000, 3); output = EMTConfigHandler.compressedSolarOutput; - } + this.maxstorage=this.getEUCapacity(); + }; @Override public void createEnergy() { - if (worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) && !worldObj.isDaytime() && !worldObj.isRaining() && !worldObj.isThundering()) { - energySource.addEnergy(output); - } + if ((this.worldObj.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) && (!this.worldObj.isRaining()) && (!this.worldObj.isThundering())) { + isActive=true; + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + this.generating=output*calc_multi(); + this.energySource.addEnergy(this.output*calc_multi()); + } + } else isActive = false; } + @Override + public float calc_multi() { + if (this.worldObj.isDaytime()) + return 0.75F; + else return 2F; + } + @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 6); } + + @Override + public String getInventoryName() { + return "Compressed Perditio Solar"; + } } diff --git a/src/main/java/emt/tile/solar/dark/TileEntityDoubleDarkSolar.java b/src/main/java/emt/tile/solar/dark/TileEntityDoubleDarkSolar.java index d0b324d..27c2396 100644 --- a/src/main/java/emt/tile/solar/dark/TileEntityDoubleDarkSolar.java +++ b/src/main/java/emt/tile/solar/dark/TileEntityDoubleDarkSolar.java @@ -10,12 +10,19 @@ public class TileEntityDoubleDarkSolar extends TileEntityDarkSolar { public TileEntityDoubleDarkSolar() { super(); - energySource = new BasicSource(this, 10000, 4); + energySource = new BasicSource(this, 100000, 4); output = EMTConfigHandler.doubleCompressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 7); } + + + @Override + public String getInventoryName() { + return "Double Compressed Perditio Solar"; + } } diff --git a/src/main/java/emt/tile/solar/dark/TileEntityTripleDarkSolar.java b/src/main/java/emt/tile/solar/dark/TileEntityTripleDarkSolar.java index 3ec8b29..4bc1ed9 100644 --- a/src/main/java/emt/tile/solar/dark/TileEntityTripleDarkSolar.java +++ b/src/main/java/emt/tile/solar/dark/TileEntityTripleDarkSolar.java @@ -11,11 +11,18 @@ public class TileEntityTripleDarkSolar extends TileEntityDarkSolar { public TileEntityTripleDarkSolar() { super(); output = EMTConfigHandler.tripleCompressedSolarOutput; - energySource = new BasicSource(this, 40000, 5); + energySource = new BasicSource(this, 1000000, 5); + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 8); } + + + @Override + public String getInventoryName() { + return "Triple Compressed Perditio Solar"; + } } diff --git a/src/main/java/emt/tile/solar/earth/TileEntityDoubleEarthSolar.java b/src/main/java/emt/tile/solar/earth/TileEntityDoubleEarthSolar.java index 5dc6c0f..b33fe65 100644 --- a/src/main/java/emt/tile/solar/earth/TileEntityDoubleEarthSolar.java +++ b/src/main/java/emt/tile/solar/earth/TileEntityDoubleEarthSolar.java @@ -10,12 +10,19 @@ public class TileEntityDoubleEarthSolar extends TileEntityEarthSolar { public TileEntityDoubleEarthSolar() { super(); - energySource = new BasicSource(this, 10000, 4); + energySource = new BasicSource(this, 100000, 4); output = EMTConfigHandler.doubleCompressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars2, 1, 3); } + + + @Override + public String getInventoryName() { + return "Double Compressed Terra Solar"; + } } diff --git a/src/main/java/emt/tile/solar/earth/TileEntityEarthSolar.java b/src/main/java/emt/tile/solar/earth/TileEntityEarthSolar.java index 7fa46c1..6b08979 100644 --- a/src/main/java/emt/tile/solar/earth/TileEntityEarthSolar.java +++ b/src/main/java/emt/tile/solar/earth/TileEntityEarthSolar.java @@ -13,20 +13,26 @@ public class TileEntityEarthSolar extends TileEntitySolarBase { super(); energySource = new BasicSource(this, 10000, 3); output = EMTConfigHandler.compressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override - public void createEnergy() { - if (theSunIsVisible && this.yCoord <= 10) { - energySource.addEnergy(output * 2.5); - } - else if (theSunIsVisible) { - energySource.addEnergy(output); - } + public float calc_multi() { + if (this.yCoord<5) + return 3F; + else if (this.yCoord>220) + return 1F; + else + return (float) ((-2D)/215D*(double)this.yCoord + 131D/43D); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars2, 1, 2); } + + @Override + public String getInventoryName() { + return "Compressed Terra Solar"; + } } diff --git a/src/main/java/emt/tile/solar/earth/TileEntityTripleEarthSolar.java b/src/main/java/emt/tile/solar/earth/TileEntityTripleEarthSolar.java index 59ba71b..ae1aa26 100644 --- a/src/main/java/emt/tile/solar/earth/TileEntityTripleEarthSolar.java +++ b/src/main/java/emt/tile/solar/earth/TileEntityTripleEarthSolar.java @@ -11,11 +11,18 @@ public class TileEntityTripleEarthSolar extends TileEntityEarthSolar { public TileEntityTripleEarthSolar() { super(); output = EMTConfigHandler.tripleCompressedSolarOutput; - energySource = new BasicSource(this, 40000, 5); + energySource = new BasicSource(this, 1000000, 5); + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars2, 1, 4); } + + + @Override + public String getInventoryName() { + return "Triple Compressed Terra Solar"; + } } diff --git a/src/main/java/emt/tile/solar/fire/TileEntityDoubleFireSolar.java b/src/main/java/emt/tile/solar/fire/TileEntityDoubleFireSolar.java index a9cd652..10a8dfa 100644 --- a/src/main/java/emt/tile/solar/fire/TileEntityDoubleFireSolar.java +++ b/src/main/java/emt/tile/solar/fire/TileEntityDoubleFireSolar.java @@ -10,12 +10,19 @@ public class TileEntityDoubleFireSolar extends TileEntityFireSolar { public TileEntityDoubleFireSolar() { super(); - energySource = new BasicSource(this, 10000, 4); + energySource = new BasicSource(this, 1000000, 4); output = EMTConfigHandler.doubleCompressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 13); } + + + @Override + public String getInventoryName() { + return "Double Compressed Ignis Solar"; + } } diff --git a/src/main/java/emt/tile/solar/fire/TileEntityFireSolar.java b/src/main/java/emt/tile/solar/fire/TileEntityFireSolar.java index cb9083c..dee9fc4 100644 --- a/src/main/java/emt/tile/solar/fire/TileEntityFireSolar.java +++ b/src/main/java/emt/tile/solar/fire/TileEntityFireSolar.java @@ -1,11 +1,14 @@ package emt.tile.solar.fire; +import cpw.mods.fml.common.FMLCommonHandler; import emt.init.EMTBlocks; import emt.tile.solar.TileEntitySolarBase; import emt.util.EMTConfigHandler; import ic2.api.energy.prefab.BasicSource; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.visnet.VisNetHandler; public class TileEntityFireSolar extends TileEntitySolarBase { @@ -13,28 +16,49 @@ public class TileEntityFireSolar extends TileEntitySolarBase { super(); energySource = new BasicSource(this, 10000, 3); output = EMTConfigHandler.compressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public void checkConditions() { - if (!initialized && worldObj != null) { - canRain = worldObj.getWorldChunkManager().getBiomeGenAt(xCoord, zCoord).getIntRainfall() > 0; - initialized = true; + boolean ignis = ((this.worldObj.provider.dimensionId == (-1)) || (theSunIsVisible)); + if(ignis) { + this.isActive=true; + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + this.generating=output*calc_multi(); + this.energySource.addEnergy(this.output*calc_multi()); + } } - - if (worldObj.provider.dimensionId == -1) { - energySource.addEnergy(output * 2); - } - else { - if (tick-- == 0) { - updateSunState(); - tick = 64; + else this.isActive=false; + /*if (!ignis && VisNetHandler.drainVis(worldObj, xCoord, yCoord, zCoord, Aspect.FIRE, 10)>=10) { + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + energySource.addEnergy(15F); + this.generating=15D; } + }*/ + if (tick-- == 0) { + updateSunState(); + tick = 64; } } + @Override + public float calc_multi() { + if (VisNetHandler.drainVis(worldObj, xCoord, yCoord, zCoord, Aspect.FIRE, 10)>=10) + return 3F; + else if (this.worldObj.provider.dimensionId == (-1)) + return 2F; + else + return 1F; + } + @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 12); } + + @Override + public String getInventoryName() { + return "Compressed Ignis Solar"; + } } diff --git a/src/main/java/emt/tile/solar/fire/TileEntityTripleFireSolar.java b/src/main/java/emt/tile/solar/fire/TileEntityTripleFireSolar.java index 3d72f0c..827e7d7 100644 --- a/src/main/java/emt/tile/solar/fire/TileEntityTripleFireSolar.java +++ b/src/main/java/emt/tile/solar/fire/TileEntityTripleFireSolar.java @@ -11,11 +11,18 @@ public class TileEntityTripleFireSolar extends TileEntityFireSolar { public TileEntityTripleFireSolar() { super(); output = EMTConfigHandler.tripleCompressedSolarOutput; - energySource = new BasicSource(this, 40000, 5); + energySource = new BasicSource(this, 1000000, 5); + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 14); } + + + @Override + public String getInventoryName() { + return "Triple Compressed Ignis Solar"; + } } diff --git a/src/main/java/emt/tile/solar/order/TileEntityDoubleOrderSolar.java b/src/main/java/emt/tile/solar/order/TileEntityDoubleOrderSolar.java index b04d9ba..927f007 100644 --- a/src/main/java/emt/tile/solar/order/TileEntityDoubleOrderSolar.java +++ b/src/main/java/emt/tile/solar/order/TileEntityDoubleOrderSolar.java @@ -10,12 +10,18 @@ public class TileEntityDoubleOrderSolar extends TileEntityOrderSolar { public TileEntityDoubleOrderSolar() { super(); - energySource = new BasicSource(this, 10000, 4); + energySource = new BasicSource(this, 100000, 4); output = EMTConfigHandler.doubleCompressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 10); } + + @Override + public String getInventoryName() { + return "Double Compressed Ordo Solar"; + } } diff --git a/src/main/java/emt/tile/solar/order/TileEntityOrderSolar.java b/src/main/java/emt/tile/solar/order/TileEntityOrderSolar.java index 73e4062..eadf0f5 100644 --- a/src/main/java/emt/tile/solar/order/TileEntityOrderSolar.java +++ b/src/main/java/emt/tile/solar/order/TileEntityOrderSolar.java @@ -1,5 +1,6 @@ package emt.tile.solar.order; +import cpw.mods.fml.common.FMLCommonHandler; import emt.init.EMTBlocks; import emt.tile.solar.TileEntitySolarBase; import emt.util.EMTConfigHandler; @@ -13,17 +14,34 @@ public class TileEntityOrderSolar extends TileEntitySolarBase { super(); energySource = new BasicSource(this, 10000, 3); output = EMTConfigHandler.compressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public void createEnergy() { - if (theSunIsVisible) { - energySource.addEnergy(output * 3); - } + if ((this.worldObj.canBlockSeeTheSky(this.xCoord, this.yCoord + 1, this.zCoord)) && (!this.worldObj.isRaining()) && (!this.worldObj.isThundering())) { + isActive = true; + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + this.energySource.addEnergy(this.output*calc_multi()); + this.generating=output*calc_multi(); + } + }else isActive = false; + } + + @Override + public float calc_multi() { + if (this.worldObj.isDaytime()) + return 2F; + else return 0.75F; } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 9); } + + @Override + public String getInventoryName() { + return "Compressed Ordo Solar"; + } } diff --git a/src/main/java/emt/tile/solar/order/TileEntityTripleOrderSolar.java b/src/main/java/emt/tile/solar/order/TileEntityTripleOrderSolar.java index 164976a..9f8bc44 100644 --- a/src/main/java/emt/tile/solar/order/TileEntityTripleOrderSolar.java +++ b/src/main/java/emt/tile/solar/order/TileEntityTripleOrderSolar.java @@ -11,11 +11,18 @@ public class TileEntityTripleOrderSolar extends TileEntityOrderSolar { public TileEntityTripleOrderSolar() { super(); output = EMTConfigHandler.tripleCompressedSolarOutput; - energySource = new BasicSource(this, 40000, 5); + energySource = new BasicSource(this, 1000000, 5); + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 11); } + + + @Override + public String getInventoryName() { + return "Triple Compressed Ordo Solar"; + } } diff --git a/src/main/java/emt/tile/solar/water/TileEntityDoubleWaterSolar.java b/src/main/java/emt/tile/solar/water/TileEntityDoubleWaterSolar.java index 7d1e8d4..55a0d8a 100644 --- a/src/main/java/emt/tile/solar/water/TileEntityDoubleWaterSolar.java +++ b/src/main/java/emt/tile/solar/water/TileEntityDoubleWaterSolar.java @@ -10,12 +10,19 @@ public class TileEntityDoubleWaterSolar extends TileEntityWaterSolar { public TileEntityDoubleWaterSolar() { super(); - energySource = new BasicSource(this, 10000, 4); + energySource = new BasicSource(this, 100000, 4); output = EMTConfigHandler.doubleCompressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 4); } + + + @Override + public String getInventoryName() { + return "Double Compressed Aqua Solar"; + } } diff --git a/src/main/java/emt/tile/solar/water/TileEntityTripleWaterSolar.java b/src/main/java/emt/tile/solar/water/TileEntityTripleWaterSolar.java index 594daac..513e001 100644 --- a/src/main/java/emt/tile/solar/water/TileEntityTripleWaterSolar.java +++ b/src/main/java/emt/tile/solar/water/TileEntityTripleWaterSolar.java @@ -11,11 +11,18 @@ public class TileEntityTripleWaterSolar extends TileEntityWaterSolar { public TileEntityTripleWaterSolar() { super(); output = EMTConfigHandler.tripleCompressedSolarOutput; - energySource = new BasicSource(this, 40000, 5); + energySource = new BasicSource(this, 1000000, 5); + this.maxstorage=this.getEUCapacity(); } @Override public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 5); } + + + @Override + public String getInventoryName() { + return "Triple Compressed Aqua Solar"; + } } diff --git a/src/main/java/emt/tile/solar/water/TileEntityWaterSolar.java b/src/main/java/emt/tile/solar/water/TileEntityWaterSolar.java index 1a17c78..1aa61c7 100644 --- a/src/main/java/emt/tile/solar/water/TileEntityWaterSolar.java +++ b/src/main/java/emt/tile/solar/water/TileEntityWaterSolar.java @@ -1,10 +1,12 @@ package emt.tile.solar.water; +import cpw.mods.fml.common.FMLCommonHandler; import emt.init.EMTBlocks; import emt.tile.solar.TileEntitySolarBase; import emt.util.EMTConfigHandler; import ic2.api.energy.prefab.BasicSource; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; public class TileEntityWaterSolar extends TileEntitySolarBase { @@ -13,12 +15,21 @@ public class TileEntityWaterSolar extends TileEntitySolarBase { super(); energySource = new BasicSource(this, 10000, 3); output = EMTConfigHandler.compressedSolarOutput; + this.maxstorage=this.getEUCapacity(); } @Override public void createEnergy() { - if (worldObj.isRaining() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord) || worldObj.isThundering() && worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord)) { - energySource.addEnergy(output); + if (theSunIsVisible || (this.worldObj.isRaining() && this.worldObj.isDaytime()) || this.worldObj.isThundering()){ + isActive = true; + if (FMLCommonHandler.instance().getEffectiveSide().isServer()) { + this.generating=output*calc_multi(); + energySource.addEnergy(output*calc_multi()); + } + } + else { + isActive = false; + this.generating=0D; } } @@ -26,4 +37,22 @@ public class TileEntityWaterSolar extends TileEntitySolarBase { public ItemStack getWrenchDrop(EntityPlayer entityPlayer) { return new ItemStack(EMTBlocks.emtSolars, 1, 3); } + + @Override + public float calc_multi() { + if (worldObj.isThundering()) + return 6F; + else if (worldObj.isRaining()) + return 3F; + else if (!worldObj.isThundering() && !worldObj.isRaining() && worldObj.getBlock(xCoord, yCoord+1, zCoord).equals(Blocks.water)) + return 2F; + else + return 1F; + + } + + @Override + public String getInventoryName() { + return "Compressed Aqua Solar"; + } } diff --git a/src/main/resources/assets/emt/lang/en_US.lang b/src/main/resources/assets/emt/lang/en_US.lang index 157b7e6..d5b5de8 100644 --- a/src/main/resources/assets/emt/lang/en_US.lang +++ b/src/main/resources/assets/emt/lang/en_US.lang @@ -31,15 +31,17 @@ tooltip.EMT.specialEffect=Special Effect tooltip.EMT.normalConditions=Normal Conditions tooltip.EMT.euPerTick=EU/t tooltip.EMT.night=at night +tooltip.EMT.day=at day tooltip.EMT.forget=Didn't I forget a tooltip? tooltip.EMT.raining=while raining -tooltip.EMT.output.triple=Output multiplied by 3 +tooltip.EMT.thunder=while in a thunderstorm +tooltip.EMT.underwater=while under water tooltip.EMT.output.double=Output multiplied by 2 -tooltip.EMT.output.double.half=Output multiplied by 2.5 +tooltip.EMT.output.triple=Output multiplied by 3 tooltip.EMT.output.double.nether=when located in the Nether -tooltip.EMT.output.double.lava=when lava is on top -tooltip.EMT.output.double.half.height=when the block is over Y = 160 -tooltip.EMT.output.double.half.low=when the block is under Y = 10 +tooltip.EMT.output.double.lava=when fed with Ignis Centivis +tooltip.EMT.output.double.half.height=Higher output at heights (x1 at y = 5, x3 at y=220) +tooltip.EMT.output.double.half.low=Higher output at depths (x1 at y = 220, x3 at y=5) #=============Entity Names============= entity.EMT.laser.name=Laser diff --git a/src/main/resources/assets/emt/textures/guis/solar.png b/src/main/resources/assets/emt/textures/guis/solar.png new file mode 100644 index 0000000..41a65c0 Binary files /dev/null and b/src/main/resources/assets/emt/textures/guis/solar.png differ