Rewrite to use new RebornCore Power API. Texture fixes.
This commit is contained in:
parent
6f54e3801f
commit
b292fdd352
77 changed files with 1342 additions and 3008 deletions
|
@ -42,15 +42,13 @@ public class GuiAlloySmelter extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = alloysmelter.getProgressScaled(24);
|
||||||
|
if (j > 0) {
|
||||||
j = alloysmelter.getProgressScaled(24);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 79, l + 34, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = alloysmelter.getEnergyScaled(12);
|
|
||||||
|
j = (int)(alloysmelter.getEnergy() * 24f / alloysmelter.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -45,15 +45,12 @@ public class GuiAssemblingMachine extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = assemblingmachine.getProgressScaled(20);
|
||||||
|
if (j > 0) {
|
||||||
j = assemblingmachine.getProgressScaled(20);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 86, l + 34, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = assemblingmachine.getEnergyScaled(12);
|
j = (int)(assemblingmachine.getEnergy() * 12f / assemblingmachine.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 56, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -42,9 +42,7 @@ public class GuiBatbox extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = (int)(generator.getEnergy() * 24f / generator.getMaxPower());
|
||||||
|
|
||||||
j = generator.getEnergyScaled(24);
|
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||||
|
|
|
@ -78,17 +78,15 @@ public class GuiBlastFurnace extends GuiContainer
|
||||||
l + 52 + 12 - 0, -1);
|
l + 52 + 12 - 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int j = 0;
|
|
||||||
this.mc.getTextureManager().bindTexture(texture);
|
this.mc.getTextureManager().bindTexture(texture);
|
||||||
j = blastfurnace.getProgressScaled(24);
|
int j = blastfurnace.getProgressScaled(24);
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 64, l + 37, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 64, l + 37, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = blastfurnace.getEnergyScaled(12);
|
j = (int)(blastfurnace.getEnergy() * 12f / blastfurnace.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 9, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 9, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,7 @@ public class GuiCentrifuge extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = centrifuge.getProgressScaled(11);
|
||||||
|
|
||||||
j = centrifuge.getProgressScaled(11);
|
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j);
|
this.drawTexturedModalRect(k + 83, l + 23 + 10 - j, 177, 15 + 10 - j, 10, j);
|
||||||
|
@ -54,10 +52,8 @@ public class GuiCentrifuge extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
|
this.drawTexturedModalRect(k + 68 + 10 - j, l + 38, 177 + 10 - j, 27, j, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = centrifuge.getEnergyScaled(12);
|
j = (int)(centrifuge.getEnergy() * 12f / centrifuge.getMaxPower());
|
||||||
|
if (j > 0) {
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,9 +42,8 @@ public class GuiChargeBench extends GuiContainer
|
||||||
|
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
j = chargebench.getEnergyScaled(12);
|
j = (int)(chargebench.getEnergy() * 12f / chargebench.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 10, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 10, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,9 +51,8 @@ public class GuiChemicalReactor extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
|
this.drawTexturedModalRect(k + 73, l + 39, 177, 15, 30, j);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = chemicalReactor.getEnergyScaled(12);
|
j = (int)(chemicalReactor.getEnergy() * 12f / chemicalReactor.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 9, l + 32 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,19 +34,16 @@ public class GuiCompressor extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = compressor.getProgressScaled(24);
|
||||||
|
if (j > 0) {
|
||||||
j = compressor.getProgressScaled(24);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = compressor.getEnergyScaled(12);
|
j = (int)(compressor.getEnergy() * 12f / compressor.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||||
|
|
|
@ -34,19 +34,16 @@ public class GuiElectricFurnace extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = furnace.gaugeProgressScaled(24);
|
||||||
|
if (j > 0) {
|
||||||
j = furnace.gaugeProgressScaled(24);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 78, l + 34, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 78, l + 34, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = furnace.getEnergyScaled(12);
|
j = (int)(furnace.getEnergy() * 12f / furnace.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
protected void drawGuiContainerForegroundLayer(int p_146979_1_, int p_146979_2_)
|
||||||
|
|
|
@ -35,17 +35,13 @@ public class GuiExtractor extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = extractor.getProgressScaled(24);
|
||||||
|
if (j > 0) {
|
||||||
j = extractor.getProgressScaled(24);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = extractor.getEnergyScaled(12);
|
j = (int)(extractor.getEnergy() * 12f / extractor.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,11 +42,8 @@ public class GuiGenerator extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = (int)(generator.getEnergy() * 24f / generator.getMaxPower());
|
||||||
|
if (j > 0) {
|
||||||
j = generator.getEnergyScaled(24);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,9 +43,8 @@ public class GuiGrinder extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 80, l + 36, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 80, l + 36, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = grinder.getEnergyScaled(12);
|
j = (int)(grinder.getEnergy() * 12f / grinder.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class GuiImplosionCompressor extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 60, l + 37, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 60, l + 37, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = compresser.getEnergyScaled(12);
|
j = (int)(compresser.getEnergy() * 12f / compresser.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 14, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 14, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class GuiIndustrialElectrolyzer extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 72, l + 38, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 72, l + 38, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = eletrolyzer.getEnergyScaled(12);
|
j = (int)(eletrolyzer.getEnergy() * 12f / eletrolyzer.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 134, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 134, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class GuiIndustrialGrinder extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 50, l + 36, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = grinder.getEnergyScaled(12);
|
j = (int)(grinder.getEnergy() * 12f / grinder.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 132, l + 63 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -50,9 +50,8 @@ public class GuiIndustrialSawmill extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 56, l + 38, 176, 14, j - 1, 11);
|
this.drawTexturedModalRect(k + 56, l + 38, 176, 14, j - 1, 11);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = sawmill.getEnergyScaled(12);
|
j = (int)(sawmill.getEnergy() * 12f / sawmill.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0) {
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 33, l + 65 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
}
|
}
|
||||||
// TODO 1.8
|
// TODO 1.8
|
||||||
|
|
|
@ -45,11 +45,8 @@ public class GuiMFE extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = (int)(generator.getEnergy() * 24f / generator.getMaxPower());
|
||||||
|
if (j > 0) {
|
||||||
j = generator.getEnergyScaled(24);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -45,11 +45,8 @@ public class GuiMFSU extends GuiContainer
|
||||||
int l = (this.height - this.ySize) / 2;
|
int l = (this.height - this.ySize) / 2;
|
||||||
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
|
||||||
|
|
||||||
int j = 0;
|
int j = (int)(generator.getEnergy() * 24f / generator.getMaxPower());
|
||||||
|
if (j > 0) {
|
||||||
j = generator.getEnergyScaled(24);
|
|
||||||
if (j > 0)
|
|
||||||
{
|
|
||||||
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
this.drawTexturedModalRect(k + 109, l + 21 + 12, 176, 0, j + 1, 16);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class GuiRecycler extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = compressor.getEnergyScaled(12);
|
j = (int)(compressor.getEnergy() * 12f / compressor.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class GuiRollingMachine extends GuiContainer
|
||||||
int j = this.containerRollingMachine.getBurnTimeRemainingScaled(24);
|
int j = this.containerRollingMachine.getBurnTimeRemainingScaled(24);
|
||||||
this.drawTexturedModalRect(k + 91, l + 34, 176, 14, j + 1, 19);
|
this.drawTexturedModalRect(k + 91, l + 34, 176, 14, j + 1, 19);
|
||||||
|
|
||||||
j = this.rollingMachine.getEnergyScaled(12);
|
j = (int)(rollingMachine.getEnergy() * 12f / rollingMachine.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 7, l + 33 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 7, l + 33 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class GuiScrapboxinator extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 78, l + 35, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = tile.getEnergyScaled(12);
|
j = (int)(tile.getEnergy() * 12f / tile.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 24, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class GuiVacuumFreezer extends GuiContainer
|
||||||
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
|
this.drawTexturedModalRect(k + 79, l + 37, 176, 14, j + 1, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
j = crafter.getEnergyScaled(12);
|
j = (int)(crafter.getEnergy() * 12f / crafter.getMaxPower());
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
this.drawTexturedModalRect(k + 26, l + 36 + 12 - j, 176, 12 - j, 14, j + 2);
|
||||||
|
|
|
@ -55,8 +55,7 @@ public class ItemBlockAesu extends ItemBlock
|
||||||
}
|
}
|
||||||
if (stack != null && stack.hasTagCompound())
|
if (stack != null && stack.hasTagCompound())
|
||||||
{
|
{
|
||||||
((TileAesu) world.getTileEntity(pos))
|
//TODO ((TileAesu) world.getTileEntity(pos)).readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
|
||||||
.readFromNBTWithoutCoords(stack.getTagCompound().getCompoundTag("tileEntity"));
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,8 @@ import net.minecraftforge.common.property.IUnlistedProperty;
|
||||||
import net.minecraftforge.common.property.Properties;
|
import net.minecraftforge.common.property.Properties;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import reborncore.api.power.IEnergyInterfaceTile;
|
import reborncore.api.power.IEnergyInterfaceTile;
|
||||||
|
import reborncore.api.power.tile.IEnergyProducerTile;
|
||||||
|
import reborncore.api.power.tile.IEnergyReceiverTile;
|
||||||
import reborncore.common.RebornCoreConfig;
|
import reborncore.common.RebornCoreConfig;
|
||||||
import reborncore.common.misc.Functions;
|
import reborncore.common.misc.Functions;
|
||||||
import reborncore.common.misc.vecmath.Vecs3dCube;
|
import reborncore.common.misc.vecmath.Vecs3dCube;
|
||||||
|
@ -211,8 +213,11 @@ public class CableMultipart extends Multipart
|
||||||
TileEntity tile = getNeighbourTile(dir);
|
TileEntity tile = getNeighbourTile(dir);
|
||||||
if(tile != null) {
|
if(tile != null) {
|
||||||
EnumFacing facing = dir.getOpposite();
|
EnumFacing facing = dir.getOpposite();
|
||||||
if (tile instanceof IEnergyInterfaceTile &&
|
if (tile instanceof IEnergyReceiverTile &&
|
||||||
((IEnergyInterfaceTile) tile).canAcceptEnergy(facing)) {
|
((IEnergyReceiverTile) tile).canAcceptEnergy(facing)) {
|
||||||
|
return true;
|
||||||
|
} else if(tile instanceof IEnergyProducerTile &&
|
||||||
|
((IEnergyProducerTile) tile).canProvideEnergy(facing)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (tile instanceof IEnergyReceiver &&
|
} else if (tile instanceof IEnergyReceiver &&
|
||||||
((IEnergyReceiver) tile).canConnectEnergy(facing) &&
|
((IEnergyReceiver) tile).canConnectEnergy(facing) &&
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.Loader;
|
import net.minecraftforge.fml.common.Loader;
|
||||||
import reborncore.api.power.IEnergyInterfaceTile;
|
import reborncore.api.power.IEnergyInterfaceTile;
|
||||||
|
import reborncore.api.power.tile.IEnergyReceiverTile;
|
||||||
import reborncore.common.RebornCoreConfig;
|
import reborncore.common.RebornCoreConfig;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
import reborncore.mcmultipart.block.TileMultipartContainer;
|
import reborncore.mcmultipart.block.TileMultipartContainer;
|
||||||
|
@ -26,25 +27,6 @@ import java.util.function.BiFunction;
|
||||||
|
|
||||||
public class EnergyUtils {
|
public class EnergyUtils {
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatches energy to available neighbours
|
|
||||||
* @param world world
|
|
||||||
* @param source source position
|
|
||||||
* @param tile controller
|
|
||||||
* @param amount amount of energy
|
|
||||||
* @return amount of energy dispatched
|
|
||||||
*/
|
|
||||||
public static double dispatchEnergyToNeighbours(World world, BlockPos source, IEnergyInterfaceTile tile, double amount) {
|
|
||||||
double energyLeft = amount;
|
|
||||||
for(EnumFacing facing : EnumFacing.VALUES) {
|
|
||||||
if(tile.canProvideEnergy(facing)) {
|
|
||||||
PowerNetReceiver receiver = getReceiver(world, facing.getOpposite(), source.offset(facing));
|
|
||||||
if(receiver != null) energyLeft -= receiver.receiveEnergy(energyLeft, false);
|
|
||||||
if(energyLeft == 0) return energyLeft;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return amount - energyLeft;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Same as {@link #dispatchWiresEnergyPacketRecursively(World, ArrayList, BlockPos, boolean, double)}
|
* Same as {@link #dispatchWiresEnergyPacketRecursively(World, ArrayList, BlockPos, boolean, double)}
|
||||||
|
@ -174,8 +156,8 @@ public class EnergyUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PowerNetReceiver getInternalReceiver(TileEntity tileEntity, EnumFacing side) {
|
public static PowerNetReceiver getInternalReceiver(TileEntity tileEntity, EnumFacing side) {
|
||||||
if(tileEntity instanceof IEnergyInterfaceTile) {
|
if(tileEntity instanceof IEnergyReceiverTile) {
|
||||||
IEnergyInterfaceTile energyInterface = (IEnergyInterfaceTile) tileEntity;
|
IEnergyReceiverTile energyInterface = (IEnergyReceiverTile) tileEntity;
|
||||||
return new PowerNetReceiver(
|
return new PowerNetReceiver(
|
||||||
(energy, simulated) -> {
|
(energy, simulated) -> {
|
||||||
if(energyInterface.canAcceptEnergy(side))
|
if(energyInterface.canAcceptEnergy(side))
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.tiles;
|
package techreborn.tiles;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -7,12 +8,13 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileAesu extends TilePowerAcceptor implements IWrenchable
|
public class TileAesu extends TilePowerAcceptorProducer implements IWrenchable {
|
||||||
{
|
|
||||||
|
|
||||||
public static final int MAX_OUTPUT = ConfigTechReborn.AesuMaxOutput;
|
public static final int MAX_OUTPUT = ConfigTechReborn.AesuMaxOutput;
|
||||||
public static final int MAX_STORAGE = ConfigTechReborn.AesuMaxStorage;
|
public static final int MAX_STORAGE = ConfigTechReborn.AesuMaxStorage;
|
||||||
|
@ -22,117 +24,116 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable
|
||||||
private double euChange;
|
private double euChange;
|
||||||
private int ticks;
|
private int ticks;
|
||||||
|
|
||||||
public TileAesu()
|
|
||||||
{
|
|
||||||
super(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
if (ticks == ConfigTechReborn.AverageEuOutTickTime) {
|
||||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime)
|
|
||||||
{
|
|
||||||
euChange = -1;
|
euChange = -1;
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
|
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
ticks++;
|
ticks++;
|
||||||
euChange += getEnergy() - euLastTick;
|
euChange += getEnergy() - euLastTick;
|
||||||
if (euLastTick == getEnergy())
|
if (euLastTick == getEnergy()) {
|
||||||
{
|
|
||||||
euChange = 0;
|
euChange = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
euLastTick = getEnergy();
|
euLastTick = getEnergy();
|
||||||
|
|
||||||
|
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||||
|
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||||
|
for(EnumFacing facing : EnumFacing.VALUES) {
|
||||||
|
double disposed = emitEnergy(facing, maxOutput);
|
||||||
|
if(disposed != 0) {
|
||||||
|
maxOutput -= disposed;
|
||||||
|
useEnergy(disposed);
|
||||||
|
if (maxOutput == 0) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO move to RebornCore
|
||||||
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
return receiver.receiveEnergy(amount, false);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return getDropWithNBT();
|
return getDropWithNBT();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleGuiInputFromClient(int id)
|
public void handleGuiInputFromClient(int id) {
|
||||||
{
|
if (id == 0) {
|
||||||
if (id == 0)
|
|
||||||
{
|
|
||||||
OUTPUT += 256;
|
OUTPUT += 256;
|
||||||
}
|
}
|
||||||
if (id == 1)
|
if (id == 1) {
|
||||||
{
|
|
||||||
OUTPUT += 64;
|
OUTPUT += 64;
|
||||||
}
|
}
|
||||||
if (id == 2)
|
if (id == 2) {
|
||||||
{
|
|
||||||
OUTPUT -= 64;
|
OUTPUT -= 64;
|
||||||
}
|
}
|
||||||
if (id == 3)
|
if (id == 3) {
|
||||||
{
|
|
||||||
OUTPUT -= 256;
|
OUTPUT -= 256;
|
||||||
}
|
}
|
||||||
if (OUTPUT > MAX_OUTPUT)
|
if (OUTPUT > MAX_OUTPUT) {
|
||||||
{
|
|
||||||
OUTPUT = MAX_OUTPUT;
|
OUTPUT = MAX_OUTPUT;
|
||||||
}
|
}
|
||||||
if (OUTPUT <= -1)
|
if (OUTPUT <= -1) {
|
||||||
{
|
|
||||||
OUTPUT = 0;
|
OUTPUT = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEuChange()
|
public double getEuChange() {
|
||||||
{
|
if (euChange == -1) {
|
||||||
if (euChange == -1)
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (euChange / ticks);
|
return (euChange / ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getDropWithNBT()
|
public ItemStack getDropWithNBT() {
|
||||||
{
|
|
||||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||||
ItemStack dropStack = new ItemStack(ModBlocks.Aesu, 1);
|
ItemStack dropStack = new ItemStack(ModBlocks.Aesu, 1);
|
||||||
writeToNBTWithoutCoords(tileEntity);
|
|
||||||
dropStack.setTagCompound(new NBTTagCompound());
|
dropStack.setTagCompound(new NBTTagCompound());
|
||||||
dropStack.getTagCompound().setTag("tileEntity", tileEntity);
|
dropStack.getTagCompound().setTag("tileEntity", tileEntity);
|
||||||
return dropStack;
|
return dropStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tagCompound.setDouble("euChange", euChange);
|
tagCompound.setDouble("euChange", euChange);
|
||||||
tagCompound.setDouble("euLastTick", euLastTick);
|
tagCompound.setDouble("euLastTick", euLastTick);
|
||||||
|
@ -141,8 +142,7 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
this.euChange = nbttagcompound.getDouble("euChange");
|
this.euChange = nbttagcompound.getDouble("euChange");
|
||||||
this.euLastTick = nbttagcompound.getDouble("euLastTick");
|
this.euLastTick = nbttagcompound.getDouble("euLastTick");
|
||||||
|
@ -151,38 +151,18 @@ public class TileAesu extends TilePowerAcceptor implements IWrenchable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
|
||||||
return TileAesu.MAX_STORAGE;
|
return TileAesu.MAX_STORAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public double getMaxOutput() {
|
||||||
{
|
|
||||||
return getFacingEnum() != direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return getFacingEnum() == direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return OUTPUT;
|
return OUTPUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxInput()
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.INSANE;
|
||||||
return 4096 * 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.EXTREME;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,8 +18,7 @@ import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, IInventoryProvider
|
public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public Inventory inventory = new Inventory(4, "TileAlloyFurnace", 64, this);
|
public Inventory inventory = new Inventory(4, "TileAlloyFurnace", 64, this);
|
||||||
|
@ -31,8 +30,7 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
int output = 2;
|
int output = 2;
|
||||||
int fuel = 3;
|
int fuel = 3;
|
||||||
|
|
||||||
public TileAlloyFurnace()
|
public TileAlloyFurnace() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,31 +38,24 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
* Returns the number of ticks that the supplied fuel item will keep the
|
* Returns the number of ticks that the supplied fuel item will keep the
|
||||||
* furnace burning, or 0 if the item isn't fuel
|
* furnace burning, or 0 if the item isn't fuel
|
||||||
*/
|
*/
|
||||||
public static int getItemBurnTime(ItemStack stack)
|
public static int getItemBurnTime(ItemStack stack) {
|
||||||
{
|
if (stack == null) {
|
||||||
if (stack == null)
|
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
Item item = stack.getItem();
|
Item item = stack.getItem();
|
||||||
|
|
||||||
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR)
|
if (item instanceof ItemBlock && Block.getBlockFromItem(item) != Blocks.AIR) {
|
||||||
{
|
|
||||||
Block block = Block.getBlockFromItem(item);
|
Block block = Block.getBlockFromItem(item);
|
||||||
|
|
||||||
if (block == Blocks.WOODEN_SLAB)
|
if (block == Blocks.WOODEN_SLAB) {
|
||||||
{
|
|
||||||
return 150;
|
return 150;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block.getMaterial(block.getDefaultState()) == Material.WOOD)
|
if (block.getMaterial(block.getDefaultState()) == Material.WOOD) {
|
||||||
{
|
|
||||||
return 300;
|
return 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block == Blocks.COAL_BLOCK)
|
if (block == Blocks.COAL_BLOCK) {
|
||||||
{
|
|
||||||
return 16000;
|
return 16000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,71 +81,54 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
|
||||||
boolean flag = this.burnTime > 0;
|
boolean flag = this.burnTime > 0;
|
||||||
boolean flag1 = false;
|
boolean flag1 = false;
|
||||||
if (this.burnTime > 0)
|
if (this.burnTime > 0) {
|
||||||
{
|
|
||||||
--this.burnTime;
|
--this.burnTime;
|
||||||
}
|
}
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote) {
|
||||||
{
|
if (this.burnTime != 0 || getStackInSlot(input1) != null && getStackInSlot(fuel) != null) {
|
||||||
if (this.burnTime != 0 || getStackInSlot(input1) != null && getStackInSlot(fuel) != null)
|
if (this.burnTime == 0 && this.canSmelt()) {
|
||||||
{
|
|
||||||
if (this.burnTime == 0 && this.canSmelt())
|
|
||||||
{
|
|
||||||
this.currentItemBurnTime = this.burnTime = getItemBurnTime(getStackInSlot(fuel));
|
this.currentItemBurnTime = this.burnTime = getItemBurnTime(getStackInSlot(fuel));
|
||||||
if (this.burnTime > 0)
|
if (this.burnTime > 0) {
|
||||||
{
|
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
if (this.getStackInSlot(fuel) != null)
|
if (this.getStackInSlot(fuel) != null) {
|
||||||
{
|
|
||||||
decrStackSize(fuel, 1);
|
decrStackSize(fuel, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.isBurning() && this.canSmelt())
|
if (this.isBurning() && this.canSmelt()) {
|
||||||
{
|
|
||||||
++this.cookTime;
|
++this.cookTime;
|
||||||
if (this.cookTime == 200)
|
if (this.cookTime == 200) {
|
||||||
{
|
|
||||||
this.cookTime = 0;
|
this.cookTime = 0;
|
||||||
this.smeltItem();
|
this.smeltItem();
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
this.cookTime = 0;
|
this.cookTime = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag != this.burnTime > 0)
|
if (flag != this.burnTime > 0) {
|
||||||
{
|
|
||||||
flag1 = true;
|
flag1 = true;
|
||||||
// TODO sync on/off
|
// TODO sync on/off
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (flag1)
|
if (flag1) {
|
||||||
{
|
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasAllInputs(IBaseRecipeType recipeType)
|
public boolean hasAllInputs(IBaseRecipeType recipeType) {
|
||||||
{
|
if (recipeType == null) {
|
||||||
if (recipeType == null)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (ItemStack input : recipeType.getInputs())
|
for (ItemStack input : recipeType.getInputs()) {
|
||||||
{
|
|
||||||
Boolean hasItem = false;
|
Boolean hasItem = false;
|
||||||
for (int inputslot = 0; inputslot < 2; inputslot++)
|
for (int inputslot = 0; inputslot < 2; inputslot++) {
|
||||||
{
|
|
||||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true,
|
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputslot), true, true,
|
||||||
recipeType.useOreDic()) && inventory.getStackInSlot(inputslot).stackSize >= input.stackSize)
|
recipeType.useOreDic()) && inventory.getStackInSlot(inputslot).stackSize >= input.stackSize) {
|
||||||
{
|
|
||||||
hasItem = true;
|
hasItem = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -164,18 +138,13 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canSmelt()
|
private boolean canSmelt() {
|
||||||
{
|
if (this.getStackInSlot(input1) == null || this.getStackInSlot(input2) == null) {
|
||||||
if (this.getStackInSlot(input1) == null || this.getStackInSlot(input2) == null)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe))
|
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||||
{
|
if (hasAllInputs(recipeType)) {
|
||||||
if (hasAllInputs(recipeType))
|
|
||||||
{
|
|
||||||
itemstack = recipeType.getOutput(0);
|
itemstack = recipeType.getOutput(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -189,13 +158,13 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
return false;
|
return false;
|
||||||
int result = getStackInSlot(output).stackSize + itemstack.stackSize;
|
int result = getStackInSlot(output).stackSize + itemstack.stackSize;
|
||||||
return result <= getInventoryStackLimit() && result <= this.getStackInSlot(output).getMaxStackSize(); // Forge
|
return result <= getInventoryStackLimit() && result <= this.getStackInSlot(output).getMaxStackSize(); // Forge
|
||||||
// BugFix:
|
// BugFix:
|
||||||
// Make
|
// Make
|
||||||
// it
|
// it
|
||||||
// respect
|
// respect
|
||||||
// stack
|
// stack
|
||||||
// sizes
|
// sizes
|
||||||
// properly.
|
// properly.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,51 +172,37 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
* Turn one item from the furnace source stack into the appropriate smelted
|
* Turn one item from the furnace source stack into the appropriate smelted
|
||||||
* item in the furnace result stack
|
* item in the furnace result stack
|
||||||
*/
|
*/
|
||||||
public void smeltItem()
|
public void smeltItem() {
|
||||||
{
|
if (this.canSmelt()) {
|
||||||
if (this.canSmelt())
|
|
||||||
{
|
|
||||||
ItemStack itemstack = null;
|
ItemStack itemstack = null;
|
||||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe))
|
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||||
{
|
if (hasAllInputs(recipeType)) {
|
||||||
if (hasAllInputs(recipeType))
|
|
||||||
{
|
|
||||||
itemstack = recipeType.getOutput(0);
|
itemstack = recipeType.getOutput(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (itemstack != null)
|
if (itemstack != null) {
|
||||||
{
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getStackInSlot(output) == null)
|
if (this.getStackInSlot(output) == null) {
|
||||||
{
|
|
||||||
setInventorySlotContents(output, itemstack.copy());
|
setInventorySlotContents(output, itemstack.copy());
|
||||||
} else if (this.getStackInSlot(output).getItem() == itemstack.getItem())
|
} else if (this.getStackInSlot(output).getItem() == itemstack.getItem()) {
|
||||||
{
|
|
||||||
decrStackSize(output, -itemstack.stackSize);
|
decrStackSize(output, -itemstack.stackSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe))
|
for (IBaseRecipeType recipeType : RecipeHandler.getRecipeClassFromName(Reference.alloySmelteRecipe)) {
|
||||||
{
|
|
||||||
boolean hasAllRecipes = true;
|
boolean hasAllRecipes = true;
|
||||||
if (hasAllInputs(recipeType))
|
if (hasAllInputs(recipeType)) {
|
||||||
{
|
|
||||||
|
|
||||||
} else
|
} else {
|
||||||
{
|
hasAllRecipes = false;
|
||||||
hasAllRecipes = false;
|
}
|
||||||
}
|
if (hasAllRecipes) {
|
||||||
if (hasAllRecipes)
|
for (ItemStack input : recipeType.getInputs()) {
|
||||||
{
|
for (int inputSlot = 0; inputSlot < 2; inputSlot++) {
|
||||||
for (ItemStack input : recipeType.getInputs())
|
|
||||||
{
|
|
||||||
for (int inputSlot = 0; inputSlot < 2; inputSlot++)
|
|
||||||
{
|
|
||||||
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
if (ItemUtils.isItemEqual(input, inventory.getStackInSlot(inputSlot), true, true,
|
||||||
recipeType.useOreDic()))
|
recipeType.useOreDic())) {
|
||||||
{
|
|
||||||
inventory.decrStackSize(inputSlot, input.stackSize);
|
inventory.decrStackSize(inputSlot, input.stackSize);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -262,58 +217,48 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
/**
|
/**
|
||||||
* Furnace isBurning
|
* Furnace isBurning
|
||||||
*/
|
*/
|
||||||
public boolean isBurning()
|
public boolean isBurning() {
|
||||||
{
|
|
||||||
return this.burnTime > 0;
|
return this.burnTime > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getBurnTimeRemainingScaled(int scale)
|
public int getBurnTimeRemainingScaled(int scale) {
|
||||||
{
|
if (this.currentItemBurnTime == 0) {
|
||||||
if (this.currentItemBurnTime == 0)
|
|
||||||
{
|
|
||||||
this.currentItemBurnTime = 200;
|
this.currentItemBurnTime = 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.burnTime * scale / this.currentItemBurnTime;
|
return this.burnTime * scale / this.currentItemBurnTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCookProgressScaled(int scale)
|
public int getCookProgressScaled(int scale) {
|
||||||
{
|
|
||||||
return this.cookTime * scale / 200;
|
return this.cookTime * scale / 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.AlloyFurnace, 1);
|
return new ItemStack(ModBlocks.AlloyFurnace, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,4 +266,5 @@ public class TileAlloyFurnace extends TileMachineBase implements IWrenchable, II
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,25 +9,21 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.utils.upgrade.UpgradeHandler;
|
import techreborn.utils.upgrade.UpgradeHandler;
|
||||||
|
|
||||||
public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, IRecipeCrafterProvider
|
public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, IRecipeCrafterProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public Inventory inventory = new Inventory(8, "TileAlloySmelter", 64, this);
|
public Inventory inventory = new Inventory(8, "TileAlloySmelter", 64, this);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int capacity = 1000;
|
|
||||||
UpgradeHandler upgrades;
|
UpgradeHandler upgrades;
|
||||||
|
|
||||||
public TileAlloySmelter()
|
public TileAlloySmelter() {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -39,60 +35,51 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
upgrades.tick();
|
upgrades.tick();
|
||||||
charge(3);
|
//charge(3); TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.AlloySmelter, 1);
|
return new ItemStack(ModBlocks.AlloySmelter, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
inventory.readFromNBT(tagCompound);
|
inventory.readFromNBT(tagCompound);
|
||||||
crafter.readFromNBT(tagCompound);
|
crafter.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
|
@ -110,67 +97,36 @@ public class TileAlloySmelter extends TilePowerAcceptor implements IWrenchable,I
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2} : new int[]{0, 1, 2};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex == 2)
|
if (slotIndex == 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2;
|
return slotIndex == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0 && crafter.currentNeededTicks != 0) {
|
||||||
if (crafter.currentTickTime != 0 && crafter.currentNeededTicks != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 8000;
|
||||||
return capacity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,23 +10,20 @@ import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IContainerProvider;
|
import reborncore.api.tile.IContainerProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.container.RebornContainer;
|
import reborncore.common.container.RebornContainer;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.client.container.ContainerAssemblingMachine;
|
import techreborn.client.container.ContainerAssemblingMachine;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileAssemblingMachine extends TilePowerAcceptor implements IWrenchable, ISidedInventory,IInventoryProvider, IRecipeCrafterProvider, IContainerProvider
|
public class TileAssemblingMachine extends TilePowerAcceptor implements IWrenchable, ISidedInventory,IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public Inventory inventory = new Inventory(8, "TileAssemblingMachine", 64, this);
|
public Inventory inventory = new Inventory(8, "TileAssemblingMachine", 64, this);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
|
|
||||||
public TileAssemblingMachine()
|
public TileAssemblingMachine() {
|
||||||
{
|
|
||||||
super(2);
|
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -37,66 +34,57 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
crafter.updateEntity();
|
||||||
charge(3);
|
// charge(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.AssemblyMachine, 1);
|
return new ItemStack(ModBlocks.AssemblyMachine, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2} : new int[]{0, 1, 2};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex == 2)
|
if (slotIndex == 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2;
|
return slotIndex == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,49 +98,21 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.MEDIUM;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -169,4 +129,5 @@ public class TileAssemblingMachine extends TilePowerAcceptor implements IWrencha
|
||||||
public RebornContainer getContainer() {
|
public RebornContainer getContainer() {
|
||||||
return RebornContainer.getContainerFromClass(ContainerAssemblingMachine.class, this);
|
return RebornContainer.getContainerFromClass(ContainerAssemblingMachine.class, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,8 @@ import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.misc.Location;
|
import reborncore.common.misc.Location;
|
||||||
import reborncore.common.multiblock.IMultiblockPart;
|
import reborncore.common.multiblock.IMultiblockPart;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.api.recipe.ITileRecipeHandler;
|
import techreborn.api.recipe.ITileRecipeHandler;
|
||||||
|
@ -27,8 +27,7 @@ import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.multiblocks.MultiBlockCasing;
|
import techreborn.multiblocks.MultiBlockCasing;
|
||||||
|
|
||||||
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider
|
public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory, ITileRecipeHandler<BlastFurnaceRecipe>, IRecipeCrafterProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public static int euTick = 5;
|
public static int euTick = 5;
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
|
@ -36,9 +35,7 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int capacity = 1000;
|
public int capacity = 1000;
|
||||||
|
|
||||||
public TileBlastFurnace()
|
public TileBlastFurnace() {
|
||||||
{
|
|
||||||
super(ConfigTechReborn.CentrifugeTier);
|
|
||||||
// TODO configs
|
// TODO configs
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -50,65 +47,53 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.BlastFurnace, 1);
|
return new ItemStack(ModBlocks.BlastFurnace, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getHeat()
|
public int getHeat() {
|
||||||
{
|
for (EnumFacing direction : EnumFacing.values()) {
|
||||||
for (EnumFacing direction : EnumFacing.values())
|
|
||||||
{
|
|
||||||
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
||||||
if (tileEntity instanceof TileMachineCasing)
|
if (tileEntity instanceof TileMachineCasing) {
|
||||||
{
|
|
||||||
if (((TileMachineCasing) tileEntity).isConnected()
|
if (((TileMachineCasing) tileEntity).isConnected()
|
||||||
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled())
|
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()) {
|
||||||
{
|
|
||||||
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
MultiBlockCasing casing = ((TileMachineCasing) tileEntity).getMultiblockController();
|
||||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
||||||
location.modifyPositionFromSide(direction, 1);
|
location.modifyPositionFromSide(direction, 1);
|
||||||
int heat = 0;
|
int heat = 0;
|
||||||
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ()))
|
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY() - 1, location.getZ()))
|
||||||
.getBlock() == tileEntity.getBlockType())
|
.getBlock() == tileEntity.getBlockType()) {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (IMultiblockPart part : casing.connectedParts)
|
for (IMultiblockPart part : casing.connectedParts) {
|
||||||
{
|
|
||||||
BlockMachineCasing casing1 = (BlockMachineCasing) worldObj.getBlockState(part.getPos())
|
BlockMachineCasing casing1 = (BlockMachineCasing) worldObj.getBlockState(part.getPos())
|
||||||
.getBlock();
|
.getBlock();
|
||||||
heat += casing1
|
heat += casing1
|
||||||
|
@ -119,9 +104,8 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
||||||
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ()))
|
if (worldObj.getBlockState(new BlockPos(location.getX(), location.getY(), location.getZ()))
|
||||||
.getBlock().getUnlocalizedName().equals("tile.lava")
|
.getBlock().getUnlocalizedName().equals("tile.lava")
|
||||||
&& worldObj
|
&& worldObj
|
||||||
.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ()))
|
.getBlockState(new BlockPos(location.getX(), location.getY() + 1, location.getZ()))
|
||||||
.getBlock().getUnlocalizedName().equals("tile.lava"))
|
.getBlock().getUnlocalizedName().equals("tile.lava")) {
|
||||||
{
|
|
||||||
heat += 500;
|
heat += 500;
|
||||||
}
|
}
|
||||||
return heat;
|
return heat;
|
||||||
|
@ -132,96 +116,61 @@ public class TileBlastFurnace extends TilePowerAcceptor implements IWrenchable,I
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||||
{
|
|
||||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||||
getPos().getY(), getPos().getZ());
|
getPos().getY(), getPos().getZ());
|
||||||
readFromNBT(packet.getNbtCompound());
|
readFromNBT(packet.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
tickTime = tagCompound.getInteger("tickTime");
|
tickTime = tagCompound.getInteger("tickTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
writeUpdateToNBT(tagCompound);
|
writeUpdateToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUpdateToNBT(NBTTagCompound tagCompound)
|
public void writeUpdateToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
tagCompound.setInteger("tickTime", tickTime);
|
tagCompound.setInteger("tickTime", tickTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2, 3} : new int[]{0, 1, 2, 3};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3 } : new int[] { 0, 1, 2, 3 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex >= 2)
|
if (slotIndex >= 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2 || slotIndex == 3;
|
return slotIndex == 2 || slotIndex == 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 512000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.HIGH;
|
return EnumPowerTier.HIGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,8 @@ import reborncore.api.tile.IContainerProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.container.RebornContainer;
|
import reborncore.common.container.RebornContainer;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
import reborncore.common.powerSystem.PoweredItem;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.client.container.ContainerCentrifuge;
|
import techreborn.client.container.ContainerCentrifuge;
|
||||||
|
@ -23,9 +23,7 @@ import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TileCentrifuge extends TilePowerAcceptor
|
public class TileCentrifuge extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||||
implements IWrenchable,IInventoryProvider, IListInfoProvider, IRecipeCrafterProvider, IContainerProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public Inventory inventory = new Inventory(11, "TileCentrifuge", 64, this);
|
public Inventory inventory = new Inventory(11, "TileCentrifuge", 64, this);
|
||||||
|
@ -33,9 +31,7 @@ public class TileCentrifuge extends TilePowerAcceptor
|
||||||
|
|
||||||
public int euTick = ConfigTechReborn.CentrifugeInputTick;
|
public int euTick = ConfigTechReborn.CentrifugeInputTick;
|
||||||
|
|
||||||
public TileCentrifuge()
|
public TileCentrifuge() {
|
||||||
{
|
|
||||||
super(2);
|
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -50,20 +46,16 @@ public class TileCentrifuge extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
charge(6);
|
// charge(6); TODO
|
||||||
if (inventory.getStackInSlot(6) != null)
|
if (inventory.getStackInSlot(6) != null) {
|
||||||
{
|
|
||||||
ItemStack stack = inventory.getStackInSlot(6);
|
ItemStack stack = inventory.getStackInSlot(6);
|
||||||
if(stack.getItem() instanceof IEnergyItemInfo){
|
if (stack.getItem() instanceof IEnergyItemInfo) {
|
||||||
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
IEnergyItemInfo item = (IEnergyItemInfo) stack.getItem();
|
||||||
if (item.canProvideEnergy(stack))
|
if (item.canProvideEnergy(stack)) {
|
||||||
{
|
if (getEnergy() != getMaxPower()) {
|
||||||
if (getEnergy() != getMaxPower())
|
|
||||||
{
|
|
||||||
addEnergy(item.getMaxTransfer(stack));
|
addEnergy(item.getMaxTransfer(stack));
|
||||||
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
PoweredItem.setEnergy(PoweredItem.getEnergy(stack) - item.getMaxTransfer(stack), stack);
|
||||||
}
|
}
|
||||||
|
@ -73,105 +65,68 @@ public class TileCentrifuge extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.centrifuge, 1);
|
return new ItemStack(ModBlocks.centrifuge, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
crafter.readFromNBT(tagCompound);
|
crafter.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInfo(List<String> info, boolean isRealTile)
|
public void addInfo(List<String> info, boolean isRealTile) {
|
||||||
{
|
|
||||||
super.addInfo(info, isRealTile);
|
super.addInfo(info, isRealTile);
|
||||||
info.add("Round and round it goes");
|
info.add("Round and round it goes");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.MEDIUM;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,35 +8,23 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.power.IEnergyInterfaceItem;
|
import reborncore.api.power.IEnergyInterfaceItem;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileChargeBench extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory
|
public class TileChargeBench extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileChargeBench", 64, this);
|
public Inventory inventory = new Inventory(6, "TileChargeBench", 64, this);
|
||||||
public int capacity = 100000;
|
|
||||||
|
|
||||||
public TileChargeBench()
|
|
||||||
{
|
|
||||||
super(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
for (int i = 0; i < 6; i++)
|
for (int i = 0; i < 6; i++) {
|
||||||
{
|
if (inventory.getStackInSlot(i) != null) {
|
||||||
if (inventory.getStackInSlot(i) != null)
|
if (getEnergy() > 0) {
|
||||||
{
|
|
||||||
if (getEnergy() > 0)
|
|
||||||
{
|
|
||||||
ItemStack stack = inventory.getStackInSlot(i);
|
ItemStack stack = inventory.getStackInSlot(i);
|
||||||
if (stack.getItem() instanceof IEnergyInterfaceItem)
|
if (stack.getItem() instanceof IEnergyInterfaceItem) {
|
||||||
{
|
|
||||||
IEnergyInterfaceItem interfaceItem = (IEnergyInterfaceItem) stack.getItem();
|
IEnergyInterfaceItem interfaceItem = (IEnergyInterfaceItem) stack.getItem();
|
||||||
double trans = Math.min(interfaceItem.getMaxPower(stack) - interfaceItem.getEnergy(stack),
|
double trans = Math.min(interfaceItem.getMaxPower(stack) - interfaceItem.getEnergy(stack),
|
||||||
Math.min(interfaceItem.getMaxTransfer(stack), getEnergy()));
|
Math.min(interfaceItem.getMaxTransfer(stack), getEnergy()));
|
||||||
|
@ -49,56 +37,47 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable,II
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.chargeBench, 1);
|
return new ItemStack(ModBlocks.chargeBench, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2, 3, 4, 5} : new int[]{0, 1, 2, 3, 4, 5};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
// if (itemStack.getItem() instanceof IElectricItem) {
|
// if (itemStack.getItem() instanceof IElectricItem) {
|
||||||
// double CurrentCharge = ElectricItem.manager.getCharge(itemStack);
|
// double CurrentCharge = ElectricItem.manager.getCharge(itemStack);
|
||||||
// double MaxCharge = ((IElectricItem)
|
// double MaxCharge = ((IElectricItem)
|
||||||
|
@ -110,38 +89,12 @@ public class TileChargeBench extends TilePowerAcceptor implements IWrenchable,II
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return capacity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 512;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.MEDIUM;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
@ -24,7 +24,6 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
||||||
|
|
||||||
public TileChemicalReactor()
|
public TileChemicalReactor()
|
||||||
{
|
{
|
||||||
super(2);
|
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -35,11 +34,11 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
super.update();
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
charge(3);
|
//charge(3); TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -135,31 +134,7 @@ public class TileChemicalReactor extends TilePowerAcceptor implements IWrenchabl
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower()
|
||||||
{
|
{
|
||||||
return 10000;
|
return 8000;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,12 +6,11 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable,IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(1, "TileChunkLoader", 64, this);
|
public Inventory inventory = new Inventory(1, "TileChunkLoader", 64, this);
|
||||||
|
|
||||||
|
@ -20,79 +19,42 @@ public class TileChunkLoader extends TilePowerAcceptor implements IWrenchable,II
|
||||||
|
|
||||||
public int euTick = 32;
|
public int euTick = 32;
|
||||||
|
|
||||||
public TileChunkLoader()
|
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.ChunkLoader, 1);
|
return new ItemStack(ModBlocks.ChunkLoader, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.MEDIUM;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,8 +31,9 @@ public class TileDigitalChest extends TileMachineBase implements IInventoryProvi
|
||||||
public Inventory inventory = new Inventory(3, "TileDigitalChest", storage, this);
|
public Inventory inventory = new Inventory(3, "TileDigitalChest", storage, this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
|
super.update();
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote)
|
||||||
{
|
{
|
||||||
if (storedItem != null)
|
if (storedItem != null)
|
||||||
|
|
|
@ -12,8 +12,8 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.misc.Location;
|
import reborncore.common.misc.Location;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.blocks.BlockMachineCasing;
|
import techreborn.blocks.BlockMachineCasing;
|
||||||
|
@ -28,7 +28,6 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
||||||
|
|
||||||
public TileImplosionCompressor()
|
public TileImplosionCompressor()
|
||||||
{
|
{
|
||||||
super(1);
|
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -101,11 +100,10 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (getMutliBlock())
|
if (getMutliBlock()) {
|
||||||
{
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -169,37 +167,13 @@ public class TileImplosionCompressor extends TilePowerAcceptor implements IWrenc
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower()
|
||||||
{
|
{
|
||||||
return 100000;
|
return 64000;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier()
|
public EnumPowerTier getTier()
|
||||||
{
|
{
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -9,8 +9,8 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
@ -24,7 +24,6 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
||||||
|
|
||||||
public TileIndustrialElectrolyzer()
|
public TileIndustrialElectrolyzer()
|
||||||
{
|
{
|
||||||
super(2);
|
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -38,11 +37,11 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
super.update();
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
charge(6);
|
//charge(6); TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -138,37 +137,13 @@ public class TileIndustrialElectrolyzer extends TilePowerAcceptor implements IWr
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower()
|
||||||
{
|
{
|
||||||
return 1000;
|
return 64000;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier()
|
public EnumPowerTier getTier()
|
||||||
{
|
{
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -12,8 +12,8 @@ import net.minecraftforge.fluids.*;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
|
@ -24,9 +24,7 @@ import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.init.ModFluids;
|
import techreborn.init.ModFluids;
|
||||||
|
|
||||||
public class TileIndustrialGrinder extends TilePowerAcceptor
|
public class TileIndustrialGrinder extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider {
|
||||||
implements IWrenchable, IFluidHandler, IInventoryProvider, ISidedInventory, ITileRecipeHandler<IndustrialGrinderRecipe>, IRecipeCrafterProvider
|
|
||||||
{
|
|
||||||
public static final int TANK_CAPACITY = 16000;
|
public static final int TANK_CAPACITY = 16000;
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
|
@ -35,9 +33,7 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int connectionStatus;
|
public int connectionStatus;
|
||||||
|
|
||||||
public TileIndustrialGrinder()
|
public TileIndustrialGrinder() {
|
||||||
{
|
|
||||||
super(ConfigTechReborn.CentrifugeTier);
|
|
||||||
// TODO configs
|
// TODO configs
|
||||||
|
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
|
@ -52,52 +48,42 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.IndustrialGrinder, 1);
|
return new ItemStack(ModBlocks.IndustrialGrinder, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getMutliBlock()
|
public boolean getMutliBlock() {
|
||||||
{
|
for (EnumFacing direction : EnumFacing.values()) {
|
||||||
for (EnumFacing direction : EnumFacing.values())
|
|
||||||
{
|
|
||||||
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
||||||
if (tileEntity instanceof TileMachineCasing)
|
if (tileEntity instanceof TileMachineCasing) {
|
||||||
{
|
|
||||||
if (((TileMachineCasing) tileEntity).isConnected()
|
if (((TileMachineCasing) tileEntity).isConnected()
|
||||||
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()
|
&& ((TileMachineCasing) tileEntity).getMultiblockController().isAssembled()
|
||||||
&& ((TileMachineCasing) tileEntity).getMultiblockController().height == 3)
|
&& ((TileMachineCasing) tileEntity).getMultiblockController().height == 3) {
|
||||||
{
|
|
||||||
connectionStatus = 1;
|
connectionStatus = 1;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -108,11 +94,9 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
if (getMutliBlock()) {
|
||||||
if (getMutliBlock())
|
|
||||||
{
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
}
|
}
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 5);
|
FluidUtils.drainContainers(this, inventory, 0, 5);
|
||||||
|
@ -120,16 +104,14 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
tank.readFromNBT(tagCompound);
|
tank.readFromNBT(tagCompound);
|
||||||
crafter.readFromNBT(tagCompound);
|
crafter.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tank.writeToNBT(tagCompound);
|
tank.writeToNBT(tagCompound);
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
|
@ -137,24 +119,20 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate() {
|
||||||
{
|
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkUnload()
|
public void onChunkUnload() {
|
||||||
{
|
|
||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IFluidHandler */
|
/* IFluidHandler */
|
||||||
@Override
|
@Override
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||||
{
|
|
||||||
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
||||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate)
|
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate) {
|
||||||
{
|
|
||||||
int filled = tank.fill(resource, doFill);
|
int filled = tank.fill(resource, doFill);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return filled;
|
return filled;
|
||||||
|
@ -163,10 +141,8 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||||
{
|
if (resource == null || !resource.isFluidEqual(tank.getFluid())) {
|
||||||
if (resource == null || !resource.isFluidEqual(tank.getFluid()))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
||||||
|
@ -175,95 +151,60 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drained;
|
return drained;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return fluid == FluidRegistry.WATER || fluid == ModFluids.fluidMercury || fluid == ModFluids.fluidSodiumpersulfate;
|
return fluid == FluidRegistry.WATER || fluid == ModFluids.fluidMercury || fluid == ModFluids.fluidSodiumpersulfate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||||
{
|
return new FluidTankInfo[]{tank.getInfo()};
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2, 3, 4, 5} : new int[]{0, 1, 2, 3, 4, 5};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4, 5 } : new int[] { 0, 1, 2, 3, 4, 5 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex >= 2)
|
if (slotIndex >= 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4 || slotIndex == 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.MEDIUM;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -320,4 +261,5 @@ public class TileIndustrialGrinder extends TilePowerAcceptor
|
||||||
public RecipeCrafter getRecipeCrafter() {
|
public RecipeCrafter getRecipeCrafter() {
|
||||||
return crafter;
|
return crafter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,8 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.misc.Location;
|
import reborncore.common.misc.Location;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
|
@ -26,9 +26,7 @@ import techreborn.blocks.BlockMachineCasing;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.init.ModFluids;
|
import techreborn.init.ModFluids;
|
||||||
|
|
||||||
public class TileIndustrialSawmill extends TilePowerAcceptor
|
public class TileIndustrialSawmill extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider, ISidedInventory, IListInfoProvider, ITileRecipeHandler<IndustrialSawmillRecipe>, IRecipeCrafterProvider {
|
||||||
implements IWrenchable, IFluidHandler,IInventoryProvider, ISidedInventory, IListInfoProvider, ITileRecipeHandler<IndustrialSawmillRecipe>, IRecipeCrafterProvider
|
|
||||||
{
|
|
||||||
public static final int TANK_CAPACITY = 16000;
|
public static final int TANK_CAPACITY = 16000;
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
|
@ -36,9 +34,7 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||||
public Tank tank = new Tank("TileSawmill", TANK_CAPACITY, this);
|
public Tank tank = new Tank("TileSawmill", TANK_CAPACITY, this);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
|
|
||||||
public TileIndustrialSawmill()
|
public TileIndustrialSawmill() {
|
||||||
{
|
|
||||||
super(2);
|
|
||||||
// TODO configs
|
// TODO configs
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[2];
|
int[] inputs = new int[2];
|
||||||
|
@ -52,27 +48,21 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
if (getMutliBlock()) {
|
||||||
if (getMutliBlock())
|
|
||||||
{
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
}
|
}
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 4);
|
FluidUtils.drainContainers(this, inventory, 0, 4);
|
||||||
FluidUtils.drainContainers(this, inventory, 1, 4);
|
FluidUtils.drainContainers(this, inventory, 1, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getMutliBlock()
|
public boolean getMutliBlock() {
|
||||||
{
|
for (EnumFacing direction : EnumFacing.values()) {
|
||||||
for (EnumFacing direction : EnumFacing.values())
|
|
||||||
{
|
|
||||||
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
TileEntity tileEntity = worldObj.getTileEntity(new BlockPos(getPos().getX() + direction.getFrontOffsetX(),
|
||||||
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
getPos().getY() + direction.getFrontOffsetY(), getPos().getZ() + direction.getFrontOffsetZ()));
|
||||||
if (tileEntity instanceof TileMachineCasing)
|
if (tileEntity instanceof TileMachineCasing) {
|
||||||
{
|
if ((tileEntity.getBlockType() instanceof BlockMachineCasing)) {
|
||||||
if ((tileEntity.getBlockType() instanceof BlockMachineCasing))
|
|
||||||
{
|
|
||||||
int heat;
|
int heat;
|
||||||
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) tileEntity.getBlockType();
|
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) tileEntity.getBlockType();
|
||||||
heat = blockMachineCasing
|
heat = blockMachineCasing
|
||||||
|
@ -80,8 +70,7 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||||
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
Location location = new Location(getPos().getX(), getPos().getY(), getPos().getZ(), direction);
|
||||||
location.modifyPositionFromSide(direction, 1);
|
location.modifyPositionFromSide(direction, 1);
|
||||||
if (worldObj.getBlockState(location.getBlockPos()).getBlock().getUnlocalizedName()
|
if (worldObj.getBlockState(location.getBlockPos()).getBlock().getUnlocalizedName()
|
||||||
.equals("tile.lava"))
|
.equals("tile.lava")) {
|
||||||
{
|
|
||||||
heat += 500;
|
heat += 500;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -92,51 +81,43 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.industrialSawmill, 1);
|
return new ItemStack(ModBlocks.industrialSawmill, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
tank.readFromNBT(tagCompound);
|
tank.readFromNBT(tagCompound);
|
||||||
crafter.readFromNBT(tagCompound);
|
crafter.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tank.writeToNBT(tagCompound);
|
tank.writeToNBT(tagCompound);
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
|
@ -145,11 +126,9 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||||
|
|
||||||
/* IFluidHandler */
|
/* IFluidHandler */
|
||||||
@Override
|
@Override
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||||
{
|
|
||||||
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
if (resource.getFluid() == FluidRegistry.WATER || resource.getFluid() == ModFluids.fluidMercury
|
||||||
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate)
|
|| resource.getFluid() == ModFluids.fluidSodiumpersulfate) {
|
||||||
{
|
|
||||||
int filled = tank.fill(resource, doFill);
|
int filled = tank.fill(resource, doFill);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return filled;
|
return filled;
|
||||||
|
@ -158,10 +137,8 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||||
{
|
if (resource == null || !resource.isFluidEqual(tank.getFluid())) {
|
||||||
if (resource == null || !resource.isFluidEqual(tank.getFluid()))
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
FluidStack fluidStack = tank.drain(resource.amount, doDrain);
|
||||||
|
@ -170,95 +147,60 @@ public class TileIndustrialSawmill extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drained = tank.drain(maxDrain, doDrain);
|
FluidStack drained = tank.drain(maxDrain, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drained;
|
return drained;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return fluid == FluidRegistry.WATER;
|
return fluid == FluidRegistry.WATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||||
{
|
return new FluidTankInfo[]{tank.getInfo()};
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2, 3, 4} : new int[]{0, 1, 2, 3, 4};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2, 3, 4 } : new int[] { 0, 1, 2, 3, 4 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex >= 2)
|
if (slotIndex >= 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4;
|
return slotIndex == 2 || slotIndex == 3 || slotIndex == 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.MEDIUM;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -16,8 +16,7 @@ import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.tile.TileMachineBase;
|
import reborncore.common.tile.TileMachineBase;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
|
|
||||||
public class TileIronFurnace extends TileMachineBase implements IInventoryProvider
|
public class TileIronFurnace extends TileMachineBase implements IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public Inventory inventory = new Inventory(3, "TileIronFurnace", 64, this);
|
public Inventory inventory = new Inventory(3, "TileIronFurnace", 64, this);
|
||||||
|
@ -30,18 +29,14 @@ public class TileIronFurnace extends TileMachineBase implements IInventoryProvid
|
||||||
int fuelslot = 2;
|
int fuelslot = 2;
|
||||||
boolean active = false;
|
boolean active = false;
|
||||||
|
|
||||||
public int gaugeProgressScaled(int scale)
|
public int gaugeProgressScaled(int scale) {
|
||||||
{
|
|
||||||
return (progress * scale) / fuelScale;
|
return (progress * scale) / fuelScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int gaugeFuelScaled(int scale)
|
public int gaugeFuelScaled(int scale) {
|
||||||
{
|
if (fuelGague == 0) {
|
||||||
if (fuelGague == 0)
|
|
||||||
{
|
|
||||||
fuelGague = fuel;
|
fuelGague = fuel;
|
||||||
if (fuelGague == 0)
|
if (fuelGague == 0) {
|
||||||
{
|
|
||||||
fuelGague = fuelScale;
|
fuelGague = fuelScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,88 +44,69 @@ public class TileIronFurnace extends TileMachineBase implements IInventoryProvid
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
boolean burning = isBurning();
|
boolean burning = isBurning();
|
||||||
boolean updateInventory = false;
|
boolean updateInventory = false;
|
||||||
if (fuel > 0)
|
if (fuel > 0) {
|
||||||
{
|
|
||||||
fuel--;
|
fuel--;
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
if (fuel <= 0 && canSmelt())
|
if (fuel <= 0 && canSmelt()) {
|
||||||
{
|
|
||||||
fuel = fuelGague = (int) (TileEntityFurnace.getItemBurnTime(getStackInSlot(fuelslot)) * 1.25);
|
fuel = fuelGague = (int) (TileEntityFurnace.getItemBurnTime(getStackInSlot(fuelslot)) * 1.25);
|
||||||
if (fuel > 0)
|
if (fuel > 0) {
|
||||||
{
|
|
||||||
if (getStackInSlot(fuelslot).getItem().hasContainerItem()) // Fuel
|
if (getStackInSlot(fuelslot).getItem().hasContainerItem()) // Fuel
|
||||||
// slot
|
// slot
|
||||||
{
|
{
|
||||||
setInventorySlotContents(fuelslot,
|
setInventorySlotContents(fuelslot,
|
||||||
new ItemStack(getStackInSlot(fuelslot).getItem().getContainerItem()));
|
new ItemStack(getStackInSlot(fuelslot).getItem().getContainerItem()));
|
||||||
} else if (getStackInSlot(fuelslot).stackSize > 1)
|
} else if (getStackInSlot(fuelslot).stackSize > 1) {
|
||||||
{
|
|
||||||
decrStackSize(fuelslot, 1);
|
decrStackSize(fuelslot, 1);
|
||||||
} else if (getStackInSlot(fuelslot).stackSize == 1)
|
} else if (getStackInSlot(fuelslot).stackSize == 1) {
|
||||||
{
|
|
||||||
setInventorySlotContents(fuelslot, null);
|
setInventorySlotContents(fuelslot, null);
|
||||||
}
|
}
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isBurning() && canSmelt())
|
if (isBurning() && canSmelt()) {
|
||||||
{
|
|
||||||
progress++;
|
progress++;
|
||||||
if (progress >= fuelScale)
|
if (progress >= fuelScale) {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
cookItems();
|
cookItems();
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
}
|
}
|
||||||
if (burning != isBurning())
|
if (burning != isBurning()) {
|
||||||
{
|
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
if (updateInventory)
|
if (updateInventory) {
|
||||||
{
|
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cookItems()
|
public void cookItems() {
|
||||||
{
|
if (this.canSmelt()) {
|
||||||
if (this.canSmelt())
|
|
||||||
{
|
|
||||||
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
||||||
|
|
||||||
if (getStackInSlot(output) == null)
|
if (getStackInSlot(output) == null) {
|
||||||
{
|
|
||||||
setInventorySlotContents(output, itemstack.copy());
|
setInventorySlotContents(output, itemstack.copy());
|
||||||
} else if (getStackInSlot(output).isItemEqual(itemstack))
|
} else if (getStackInSlot(output).isItemEqual(itemstack)) {
|
||||||
{
|
|
||||||
getStackInSlot(output).stackSize += itemstack.stackSize;
|
getStackInSlot(output).stackSize += itemstack.stackSize;
|
||||||
}
|
}
|
||||||
if (getStackInSlot(input1).stackSize > 1)
|
if (getStackInSlot(input1).stackSize > 1) {
|
||||||
{
|
|
||||||
this.decrStackSize(input1, 1);
|
this.decrStackSize(input1, 1);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
setInventorySlotContents(input1, null);
|
setInventorySlotContents(input1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSmelt()
|
public boolean canSmelt() {
|
||||||
{
|
if (getStackInSlot(input1) == null) {
|
||||||
if (getStackInSlot(input1) == null)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
||||||
if (itemstack == null)
|
if (itemstack == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -143,26 +119,21 @@ public class TileIronFurnace extends TileMachineBase implements IInventoryProvid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBurning()
|
public boolean isBurning() {
|
||||||
{
|
|
||||||
return fuel > 0;
|
return fuel > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getResultFor(ItemStack stack)
|
public ItemStack getResultFor(ItemStack stack) {
|
||||||
{
|
|
||||||
ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
|
ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
|
||||||
if (result != null)
|
if (result != null) {
|
||||||
{
|
|
||||||
return result.copy();
|
return result.copy();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateState()
|
public void updateState() {
|
||||||
{
|
|
||||||
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
||||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase)
|
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||||
{
|
|
||||||
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != fuel > 0)
|
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != fuel > 0)
|
||||||
blockMachineBase.setActive(fuel > 0, worldObj, pos);
|
blockMachineBase.setActive(fuel > 0, worldObj, pos);
|
||||||
|
|
|
@ -5,71 +5,51 @@ import reborncore.common.multiblock.MultiblockValidationException;
|
||||||
import reborncore.common.multiblock.rectangular.RectangularMultiblockTileEntityBase;
|
import reborncore.common.multiblock.rectangular.RectangularMultiblockTileEntityBase;
|
||||||
import techreborn.multiblocks.MultiBlockCasing;
|
import techreborn.multiblocks.MultiBlockCasing;
|
||||||
|
|
||||||
public class TileMachineCasing extends RectangularMultiblockTileEntityBase
|
public class TileMachineCasing extends RectangularMultiblockTileEntityBase {
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMachineActivated()
|
public void onMachineActivated() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMachineDeactivated()
|
public void onMachineDeactivated() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MultiblockControllerBase createNewMultiblock()
|
public MultiblockControllerBase createNewMultiblock() {
|
||||||
{
|
|
||||||
return new MultiBlockCasing(worldObj);
|
return new MultiBlockCasing(worldObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends MultiblockControllerBase> getMultiblockControllerType()
|
public Class<? extends MultiblockControllerBase> getMultiblockControllerType() {
|
||||||
{
|
|
||||||
return MultiBlockCasing.class;
|
return MultiBlockCasing.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void isGoodForFrame() throws MultiblockValidationException
|
public void isGoodForFrame() throws MultiblockValidationException {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void isGoodForSides() throws MultiblockValidationException
|
public void isGoodForSides() throws MultiblockValidationException {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void isGoodForTop() throws MultiblockValidationException
|
public void isGoodForTop() throws MultiblockValidationException {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void isGoodForBottom() throws MultiblockValidationException
|
public void isGoodForBottom() throws MultiblockValidationException {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void isGoodForInterior() throws MultiblockValidationException
|
public void isGoodForInterior() throws MultiblockValidationException {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiBlockCasing getMultiblockController()
|
public MultiBlockCasing getMultiblockController() {
|
||||||
{
|
|
||||||
return (MultiBlockCasing) super.getMultiblockController();
|
return (MultiBlockCasing) super.getMultiblockController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update() {}
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,15 +6,14 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.init.ModItems;
|
import techreborn.init.ModItems;
|
||||||
import techreborn.items.ItemParts;
|
import techreborn.items.ItemParts;
|
||||||
|
|
||||||
public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public static int fabricationRate = 10000;
|
public static int fabricationRate = 10000;
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
|
@ -22,44 +21,32 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
||||||
public int progresstime = 0;
|
public int progresstime = 0;
|
||||||
private int amplifier = 0;
|
private int amplifier = 0;
|
||||||
|
|
||||||
public TileMatterFabricator()
|
|
||||||
{
|
|
||||||
super(6);
|
|
||||||
// TODO configs
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.MatterFabricator, 1);
|
return new ItemStack(ModBlocks.MatterFabricator, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,28 +71,21 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
||||||
// return slotIndex == 6;
|
// return slotIndex == 6;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public int maxProgresstime()
|
public int maxProgresstime() {
|
||||||
{
|
|
||||||
return fabricationRate;
|
return fabricationRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
|
||||||
|
|
||||||
if (!super.worldObj.isRemote)
|
if (!super.worldObj.isRemote) {
|
||||||
{
|
for (int i = 0; i < 6; i++) {
|
||||||
for (int i = 0; i < 6; i++)
|
|
||||||
{
|
|
||||||
ItemStack stack = inventory.getStackInSlot(i);
|
ItemStack stack = inventory.getStackInSlot(i);
|
||||||
if (this.amplifier < 10000 && stack != null)
|
if (this.amplifier < 10000 && stack != null) {
|
||||||
{
|
|
||||||
int amp = (int) ((long) (getValue(stack) / 32));
|
int amp = (int) ((long) (getValue(stack) / 32));
|
||||||
if (ItemUtils.isItemEqual(stack, inventory.getStackInSlot(i), true, true))
|
if (ItemUtils.isItemEqual(stack, inventory.getStackInSlot(i), true, true)) {
|
||||||
{
|
if (canUseEnergy(1)) {
|
||||||
if (canUseEnergy(1))
|
|
||||||
{
|
|
||||||
useEnergy(1);
|
useEnergy(1);
|
||||||
this.amplifier += amp;
|
this.amplifier += amp;
|
||||||
inventory.decrStackSize(i, 1);
|
inventory.decrStackSize(i, 1);
|
||||||
|
@ -114,22 +94,18 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.amplifier > 0)
|
if (this.amplifier > 0) {
|
||||||
{
|
if (this.amplifier > this.getEnergy()) {
|
||||||
if (this.amplifier > this.getEnergy())
|
|
||||||
{
|
|
||||||
this.progresstime += this.getEnergy();
|
this.progresstime += this.getEnergy();
|
||||||
this.amplifier -= this.getEnergy();
|
this.amplifier -= this.getEnergy();
|
||||||
this.decreaseStoredEnergy(this.getEnergy(), true);
|
this.decreaseStoredEnergy(this.getEnergy(), true);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
this.progresstime += this.amplifier;
|
this.progresstime += this.amplifier;
|
||||||
this.decreaseStoredEnergy(this.amplifier, true);
|
this.decreaseStoredEnergy(this.amplifier, true);
|
||||||
this.amplifier = 0;
|
this.amplifier = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.progresstime > this.maxProgresstime() && this.spaceForOutput())
|
if (this.progresstime > this.maxProgresstime() && this.spaceForOutput()) {
|
||||||
{
|
|
||||||
this.progresstime -= this.maxProgresstime();
|
this.progresstime -= this.maxProgresstime();
|
||||||
this.addOutputProducts();
|
this.addOutputProducts();
|
||||||
}
|
}
|
||||||
|
@ -138,52 +114,42 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean spaceForOutput()
|
private boolean spaceForOutput() {
|
||||||
{
|
|
||||||
return inventory.getStackInSlot(6) == null
|
return inventory.getStackInSlot(6) == null
|
||||||
|| ItemUtils.isItemEqual(inventory.getStackInSlot(6), new ItemStack(ModItems.uuMatter), true, true)
|
|| ItemUtils.isItemEqual(inventory.getStackInSlot(6), new ItemStack(ModItems.uuMatter), true, true)
|
||||||
&& inventory.getStackInSlot(6).stackSize < 64;
|
&& inventory.getStackInSlot(6).stackSize < 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addOutputProducts()
|
private void addOutputProducts() {
|
||||||
{
|
|
||||||
|
|
||||||
if (inventory.getStackInSlot(6) == null)
|
if (inventory.getStackInSlot(6) == null) {
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(6, new ItemStack(ModItems.uuMatter));
|
inventory.setInventorySlotContents(6, new ItemStack(ModItems.uuMatter));
|
||||||
} else if (ItemUtils.isItemEqual(inventory.getStackInSlot(6), new ItemStack(ModItems.uuMatter), true, true))
|
} else if (ItemUtils.isItemEqual(inventory.getStackInSlot(6), new ItemStack(ModItems.uuMatter), true, true)) {
|
||||||
{
|
|
||||||
inventory.getStackInSlot(6).stackSize = Math.min(64, 1 + inventory.getStackInSlot(6).stackSize);
|
inventory.getStackInSlot(6).stackSize = Math.min(64, 1 + inventory.getStackInSlot(6).stackSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean decreaseStoredEnergy(double aEnergy, boolean aIgnoreTooLessEnergy)
|
public boolean decreaseStoredEnergy(double aEnergy, boolean aIgnoreTooLessEnergy) {
|
||||||
{
|
if (this.getEnergy() - aEnergy < 0 && !aIgnoreTooLessEnergy) {
|
||||||
if (this.getEnergy() - aEnergy < 0 && !aIgnoreTooLessEnergy)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
setEnergy(this.getEnergy() - aEnergy);
|
setEnergy(this.getEnergy() - aEnergy);
|
||||||
if (this.getEnergy() < 0)
|
if (this.getEnergy() < 0) {
|
||||||
{
|
|
||||||
setEnergy(0);
|
setEnergy(0);
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO ic2
|
// TODO ic2
|
||||||
public int getValue(ItemStack itemStack)
|
public int getValue(ItemStack itemStack) {
|
||||||
{
|
|
||||||
// int value = getValue(Recipes.matterAmplifier.getOutputFor(itemStack,
|
// int value = getValue(Recipes.matterAmplifier.getOutputFor(itemStack,
|
||||||
// false));
|
// false));
|
||||||
if(itemStack.getItem() == ModItems.parts && itemStack.getItemDamage() == ItemParts.getPartByName("scrap").getItemDamage()){
|
if (itemStack.getItem() == ModItems.parts && itemStack.getItemDamage() == ItemParts.getPartByName("scrap").getItemDamage()) {
|
||||||
return 5000;
|
return 5000;
|
||||||
} else if (itemStack.getItem() == ModItems.scrapBox){
|
} else if (itemStack.getItem() == ModItems.scrapBox) {
|
||||||
return 45000;
|
return 45000;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -197,36 +163,12 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 1024000;
|
||||||
return 100000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxOutput()
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 4096;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.EXTREME;
|
return EnumPowerTier.EXTREME;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,4 +176,5 @@ public class TileMatterFabricator extends TilePowerAcceptor implements IWrenchab
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,90 +5,48 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.WorldUtils;
|
import reborncore.common.util.WorldUtils;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
public class TilePlayerDectector extends TilePowerAcceptor
|
public class TilePlayerDectector extends TilePowerAcceptor {
|
||||||
{
|
|
||||||
|
|
||||||
public String owenerUdid = "";
|
public String owenerUdid = "";
|
||||||
boolean redstone = false;
|
boolean redstone = false;
|
||||||
|
|
||||||
public TilePlayerDectector()
|
@Override
|
||||||
{
|
public double getMaxPower() {
|
||||||
super(1);
|
return 8000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return 10000;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0) {
|
||||||
if (!worldObj.isRemote && worldObj.getWorldTime() % 20 == 0)
|
|
||||||
{
|
|
||||||
boolean lastRedstone = redstone;
|
boolean lastRedstone = redstone;
|
||||||
redstone = false;
|
redstone = false;
|
||||||
if (canUseEnergy(10))
|
if (canUseEnergy(10)) {
|
||||||
{
|
|
||||||
Iterator tIterator = super.worldObj.playerEntities.iterator();
|
Iterator tIterator = super.worldObj.playerEntities.iterator();
|
||||||
while (tIterator.hasNext())
|
while (tIterator.hasNext()) {
|
||||||
{
|
|
||||||
EntityPlayer player = (EntityPlayer) tIterator.next();
|
EntityPlayer player = (EntityPlayer) tIterator.next();
|
||||||
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D,
|
if (player.getDistanceSq((double) super.getPos().getX() + 0.5D,
|
||||||
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D)
|
(double) super.getPos().getY() + 0.5D, (double) super.getPos().getZ() + 0.5D) <= 256.0D) {
|
||||||
{
|
|
||||||
BlockMachineBase blockMachineBase = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
|
BlockMachineBase blockMachineBase = (BlockMachineBase) worldObj.getBlockState(pos).getBlock();
|
||||||
int meta = blockMachineBase.getMetaFromState(worldObj.getBlockState(pos));
|
int meta = blockMachineBase.getMetaFromState(worldObj.getBlockState(pos));
|
||||||
if (meta == 0)
|
if (meta == 0) {// ALL
|
||||||
{// ALL
|
|
||||||
redstone = true;
|
redstone = true;
|
||||||
} else if (meta == 1)
|
} else if (meta == 1) {// Others
|
||||||
{// Others
|
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString())) {
|
||||||
if (!owenerUdid.isEmpty() && !owenerUdid.equals(player.getUniqueID().toString()))
|
|
||||||
{
|
|
||||||
redstone = true;
|
redstone = true;
|
||||||
}
|
}
|
||||||
} else
|
} else {// You
|
||||||
{// You
|
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUniqueID().toString())) {
|
||||||
if (!owenerUdid.isEmpty() && owenerUdid.equals(player.getUniqueID().toString()))
|
|
||||||
{
|
|
||||||
redstone = true;
|
redstone = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,31 +55,28 @@ public class TilePlayerDectector extends TilePowerAcceptor
|
||||||
}
|
}
|
||||||
useEnergy(10);
|
useEnergy(10);
|
||||||
}
|
}
|
||||||
if (lastRedstone != redstone)
|
if (lastRedstone != redstone) {
|
||||||
{
|
|
||||||
WorldUtils.updateBlock(worldObj, getPos());
|
WorldUtils.updateBlock(worldObj, getPos());
|
||||||
worldObj.notifyNeighborsOfStateChange(getPos(), worldObj.getBlockState(getPos()).getBlock());
|
worldObj.notifyNeighborsOfStateChange(getPos(), worldObj.getBlockState(getPos()).getBlock());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isProvidingPower()
|
public boolean isProvidingPower() {
|
||||||
{
|
|
||||||
return redstone;
|
return redstone;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tag)
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
{
|
|
||||||
super.readFromNBT(tag);
|
super.readFromNBT(tag);
|
||||||
owenerUdid = tag.getString("ownerID");
|
owenerUdid = tag.getString("ownerID");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tag)
|
public NBTTagCompound writeToNBT(NBTTagCompound tag) {
|
||||||
{
|
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
tag.setString("ownerID", owenerUdid);
|
tag.setString("ownerID", owenerUdid);
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fluids.*;
|
import net.minecraftforge.fluids.*;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.PowerSystem;
|
import reborncore.common.powerSystem.PowerSystem;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
|
|
||||||
|
@ -24,16 +24,12 @@ public class TilePump extends TilePowerAcceptor implements IFluidHandler {
|
||||||
|
|
||||||
public Tank tank = new Tank("TilePump", 10000, this);
|
public Tank tank = new Tank("TilePump", 10000, this);
|
||||||
|
|
||||||
public TilePump() {
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 10 == 0 && !tank.isFull() && tank.getCapacity() - tank.getFluidAmount() >= 1000 && canUseEnergy(ConfigTechReborn.pumpExtractEU)){
|
if (!worldObj.isRemote && worldObj.getTotalWorldTime() % 10 == 0 && !tank.isFull() && tank.getCapacity() - tank.getFluidAmount() >= 1000 && canUseEnergy(ConfigTechReborn.pumpExtractEU)) {
|
||||||
FluidStack fluidStack = drainBlock(worldObj, pos.down(), false);
|
FluidStack fluidStack = drainBlock(worldObj, pos.down(), false);
|
||||||
if(fluidStack != null){
|
if (fluidStack != null) {
|
||||||
tank.fill(drainBlock(worldObj, pos.down(), true), true);
|
tank.fill(drainBlock(worldObj, pos.down(), true), true);
|
||||||
useEnergy(ConfigTechReborn.pumpExtractEU);
|
useEnergy(ConfigTechReborn.pumpExtractEU);
|
||||||
}
|
}
|
||||||
|
@ -80,27 +76,7 @@ public class TilePump extends TilePowerAcceptor implements IFluidHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower() {
|
public double getMaxPower() {
|
||||||
return 10000;
|
return 16000;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput() {
|
|
||||||
return 32;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,71 +85,62 @@ public class TilePump extends TilePowerAcceptor implements IFluidHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
readFromNBTWithoutCoords(tagCompound);
|
readFromNBTWithoutCoords(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound)
|
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
tank.readFromNBT(tagCompound);
|
tank.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
writeToNBTWithoutCoords(tagCompound);
|
writeToNBTWithoutCoords(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
tank.writeToNBT(tagCompound);
|
tank.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IFluidHandler
|
// IFluidHandler
|
||||||
@Override
|
@Override
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||||
{
|
|
||||||
int fill = tank.fill(resource, doFill);
|
int fill = tank.fill(resource, doFill);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return fill;
|
return fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||||
{
|
return new FluidTankInfo[]{tank.getInfo()};
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,8 +19,7 @@ import techreborn.init.ModBlocks;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TileQuantumChest extends TileMachineBase
|
public class TileQuantumChest extends TileMachineBase
|
||||||
implements IInventoryProvider, IWrenchable, IDeepStorageUnit, IListInfoProvider
|
implements IInventoryProvider, IWrenchable, IDeepStorageUnit, IListInfoProvider {
|
||||||
{
|
|
||||||
|
|
||||||
// Slot 0 = Input
|
// Slot 0 = Input
|
||||||
// Slot 1 = Output
|
// Slot 1 = Output
|
||||||
|
@ -33,56 +32,44 @@ public class TileQuantumChest extends TileMachineBase
|
||||||
public Inventory inventory = new Inventory(3, "TileQuantumChest", storage, this);
|
public Inventory inventory = new Inventory(3, "TileQuantumChest", storage, this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote) {
|
||||||
{
|
if (storedItem != null) {
|
||||||
if (storedItem != null)
|
|
||||||
{
|
|
||||||
ItemStack fakeStack = storedItem.copy();
|
ItemStack fakeStack = storedItem.copy();
|
||||||
fakeStack.stackSize = 1;
|
fakeStack.stackSize = 1;
|
||||||
setInventorySlotContents(2, fakeStack);
|
setInventorySlotContents(2, fakeStack);
|
||||||
} else if (storedItem == null && getStackInSlot(1) != null)
|
} else if (storedItem == null && getStackInSlot(1) != null) {
|
||||||
{
|
|
||||||
ItemStack fakeStack = getStackInSlot(1).copy();
|
ItemStack fakeStack = getStackInSlot(1).copy();
|
||||||
fakeStack.stackSize = 1;
|
fakeStack.stackSize = 1;
|
||||||
setInventorySlotContents(2, fakeStack);
|
setInventorySlotContents(2, fakeStack);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getStackInSlot(0) != null)
|
if (getStackInSlot(0) != null) {
|
||||||
{
|
if (storedItem == null) {
|
||||||
if (storedItem == null)
|
|
||||||
{
|
|
||||||
storedItem = getStackInSlot(0);
|
storedItem = getStackInSlot(0);
|
||||||
setInventorySlotContents(0, null);
|
setInventorySlotContents(0, null);
|
||||||
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true))
|
} else if (ItemUtils.isItemEqual(storedItem, getStackInSlot(0), true, true)) {
|
||||||
{
|
if (storedItem.stackSize <= storage - getStackInSlot(0).stackSize) {
|
||||||
if (storedItem.stackSize <= storage - getStackInSlot(0).stackSize)
|
|
||||||
{
|
|
||||||
storedItem.stackSize += getStackInSlot(0).stackSize;
|
storedItem.stackSize += getStackInSlot(0).stackSize;
|
||||||
decrStackSize(0, getStackInSlot(0).stackSize);
|
decrStackSize(0, getStackInSlot(0).stackSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedItem != null && getStackInSlot(1) == null)
|
if (storedItem != null && getStackInSlot(1) == null) {
|
||||||
{
|
|
||||||
ItemStack itemStack = storedItem.copy();
|
ItemStack itemStack = storedItem.copy();
|
||||||
itemStack.stackSize = itemStack.getMaxStackSize();
|
itemStack.stackSize = itemStack.getMaxStackSize();
|
||||||
setInventorySlotContents(1, itemStack);
|
setInventorySlotContents(1, itemStack);
|
||||||
storedItem.stackSize -= itemStack.getMaxStackSize();
|
storedItem.stackSize -= itemStack.getMaxStackSize();
|
||||||
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true))
|
} else if (ItemUtils.isItemEqual(getStackInSlot(1), storedItem, true, true)) {
|
||||||
{
|
|
||||||
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize;
|
int wanted = getStackInSlot(1).getMaxStackSize() - getStackInSlot(1).stackSize;
|
||||||
if (storedItem.stackSize >= wanted)
|
if (storedItem.stackSize >= wanted) {
|
||||||
{
|
|
||||||
decrStackSize(1, -wanted);
|
decrStackSize(1, -wanted);
|
||||||
storedItem.stackSize -= wanted;
|
storedItem.stackSize -= wanted;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
decrStackSize(1, -storedItem.stackSize);
|
decrStackSize(1, -storedItem.stackSize);
|
||||||
storedItem = null;
|
storedItem = null;
|
||||||
}
|
}
|
||||||
|
@ -91,51 +78,43 @@ public class TileQuantumChest extends TileMachineBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||||
{
|
|
||||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||||
getPos().getY(), getPos().getZ());
|
getPos().getY(), getPos().getZ());
|
||||||
readFromNBT(packet.getNbtCompound());
|
readFromNBT(packet.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
readFromNBTWithoutCoords(tagCompound);
|
readFromNBTWithoutCoords(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound)
|
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
|
|
||||||
storedItem = null;
|
storedItem = null;
|
||||||
|
|
||||||
if (tagCompound.hasKey("storedStack"))
|
if (tagCompound.hasKey("storedStack")) {
|
||||||
{
|
|
||||||
storedItem = ItemStack.loadItemStackFromNBT((NBTTagCompound) tagCompound.getTag("storedStack"));
|
storedItem = ItemStack.loadItemStackFromNBT((NBTTagCompound) tagCompound.getTag("storedStack"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (storedItem != null)
|
if (storedItem != null) {
|
||||||
{
|
|
||||||
storedItem.stackSize = tagCompound.getInteger("storedQuantity");
|
storedItem.stackSize = tagCompound.getInteger("storedQuantity");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
writeToNBTWithoutCoords(tagCompound);
|
writeToNBTWithoutCoords(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||||
{
|
if (storedItem != null) {
|
||||||
if (storedItem != null)
|
|
||||||
{
|
|
||||||
tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound()));
|
tagCompound.setTag("storedStack", storedItem.writeToNBT(new NBTTagCompound()));
|
||||||
tagCompound.setInteger("storedQuantity", storedItem.stackSize);
|
tagCompound.setInteger("storedQuantity", storedItem.stackSize);
|
||||||
} else{
|
} else {
|
||||||
tagCompound.setInteger("storedQuantity", 0);
|
tagCompound.setInteger("storedQuantity", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,37 +122,31 @@ public class TileQuantumChest extends TileMachineBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1F;
|
return 1F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return getDropWithNBT();
|
return getDropWithNBT();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getDropWithNBT()
|
public ItemStack getDropWithNBT() {
|
||||||
{
|
|
||||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||||
ItemStack dropStack = new ItemStack(ModBlocks.quantumChest, 1);
|
ItemStack dropStack = new ItemStack(ModBlocks.quantumChest, 1);
|
||||||
writeToNBTWithoutCoords(tileEntity);
|
writeToNBTWithoutCoords(tileEntity);
|
||||||
|
@ -183,47 +156,39 @@ public class TileQuantumChest extends TileMachineBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStoredItemType()
|
public ItemStack getStoredItemType() {
|
||||||
{
|
|
||||||
return this.storedItem;
|
return this.storedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStoredItemCount(int amount)
|
public void setStoredItemCount(int amount) {
|
||||||
{
|
|
||||||
this.storedItem.stackSize = 0;
|
this.storedItem.stackSize = 0;
|
||||||
this.storedItem.stackSize += (amount);
|
this.storedItem.stackSize += (amount);
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setStoredItemType(ItemStack type, int amount)
|
public void setStoredItemType(ItemStack type, int amount) {
|
||||||
{
|
|
||||||
this.storedItem = type;
|
this.storedItem = type;
|
||||||
this.storedItem.stackSize = amount;
|
this.storedItem.stackSize = amount;
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxStoredCount()
|
public int getMaxStoredCount() {
|
||||||
{
|
|
||||||
return this.storage;
|
return this.storage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInfo(List<String> info, boolean isRealTile)
|
public void addInfo(List<String> info, boolean isRealTile) {
|
||||||
{
|
if (isRealTile) {
|
||||||
if (isRealTile)
|
|
||||||
{
|
|
||||||
int size = 0;
|
int size = 0;
|
||||||
String name = "of nothing";
|
String name = "of nothing";
|
||||||
if (storedItem != null)
|
if (storedItem != null) {
|
||||||
{
|
|
||||||
name = storedItem.getDisplayName();
|
name = storedItem.getDisplayName();
|
||||||
size += storedItem.stackSize;
|
size += storedItem.stackSize;
|
||||||
}
|
}
|
||||||
if (getStackInSlot(1) != null)
|
if (getStackInSlot(1) != null) {
|
||||||
{
|
|
||||||
name = getStackInSlot(1).getDisplayName();
|
name = getStackInSlot(1).getDisplayName();
|
||||||
size += getStackInSlot(1).stackSize;
|
size += getStackInSlot(1).stackSize;
|
||||||
}
|
}
|
||||||
|
@ -235,4 +200,5 @@ public class TileQuantumChest extends TileMachineBase
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,60 +22,49 @@ import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class TileQuantumTank extends TileMachineBase
|
public class TileQuantumTank extends TileMachineBase implements IFluidHandler,IInventoryProvider, IWrenchable, IListInfoProvider {
|
||||||
implements IFluidHandler,IInventoryProvider, IWrenchable, IListInfoProvider
|
|
||||||
{
|
|
||||||
|
|
||||||
public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this);
|
public Tank tank = new Tank("TileQuantumTank", Integer.MAX_VALUE, this);
|
||||||
public Inventory inventory = new Inventory(3, "TileQuantumTank", 64, this);
|
public Inventory inventory = new Inventory(3, "TileQuantumTank", 64, this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
readFromNBTWithoutCoords(tagCompound);
|
readFromNBTWithoutCoords(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound)
|
public void readFromNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
tank.readFromNBT(tagCompound);
|
tank.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
writeToNBTWithoutCoords(tagCompound);
|
writeToNBTWithoutCoords(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBTWithoutCoords(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
tank.writeToNBT(tagCompound);
|
tank.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||||
{
|
|
||||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||||
getPos().getY(), getPos().getZ());
|
getPos().getY(), getPos().getZ());
|
||||||
readFromNBT(packet.getNbtCompound());
|
readFromNBT(packet.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
if (!worldObj.isRemote) {
|
||||||
if (!worldObj.isRemote)
|
|
||||||
{
|
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
||||||
if (tank.getFluidType() != null && getStackInSlot(2) == null)
|
if (tank.getFluidType() != null && getStackInSlot(2) == null) {
|
||||||
{
|
|
||||||
// inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
// inventory.setInventorySlotContents(2, new ItemStack(tank.getFluidType().getBlock()));
|
||||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null)
|
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
||||||
{
|
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
|
@ -84,79 +73,67 @@ public class TileQuantumTank extends TileMachineBase
|
||||||
|
|
||||||
// IFluidHandler
|
// IFluidHandler
|
||||||
@Override
|
@Override
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||||
{
|
|
||||||
int fill = tank.fill(resource, doFill);
|
int fill = tank.fill(resource, doFill);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return fill;
|
return fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||||
{
|
return new FluidTankInfo[]{tank.getInfo()};
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1F;
|
return 1F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return getDropWithNBT();
|
return getDropWithNBT();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getDropWithNBT()
|
public ItemStack getDropWithNBT() {
|
||||||
{
|
|
||||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||||
ItemStack dropStack = new ItemStack(ModBlocks.quantumTank, 1);
|
ItemStack dropStack = new ItemStack(ModBlocks.quantumTank, 1);
|
||||||
writeToNBTWithoutCoords(tileEntity);
|
writeToNBTWithoutCoords(tileEntity);
|
||||||
|
@ -166,15 +143,11 @@ public class TileQuantumTank extends TileMachineBase
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInfo(List<String> info, boolean isRealTile)
|
public void addInfo(List<String> info, boolean isRealTile) {
|
||||||
{
|
if (isRealTile) {
|
||||||
if (isRealTile)
|
if (tank.getFluid() != null) {
|
||||||
{
|
|
||||||
if (tank.getFluid() != null)
|
|
||||||
{
|
|
||||||
info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName());
|
info.add(tank.getFluidAmount() + " of " + tank.getFluidType().getName());
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
info.add("Empty");
|
info.add("Empty");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,4 +159,5 @@ public class TileQuantumTank extends TileMachineBase
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,15 +9,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.api.RollingMachineRecipe;
|
import techreborn.api.RollingMachineRecipe;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
//TODO add tick and power bars.
|
//TODO add tick and power bars.
|
||||||
public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable,IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public final InventoryCrafting craftMatrix = new InventoryCrafting(new RollingTileContainer(), 3, 3);
|
public final InventoryCrafting craftMatrix = new InventoryCrafting(new RollingTileContainer(), 3, 3);
|
||||||
public Inventory inventory = new Inventory(3, "TileRollingMachine", 64, this);
|
public Inventory inventory = new Inventory(3, "TileRollingMachine", 64, this);
|
||||||
|
@ -28,73 +27,34 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
||||||
|
|
||||||
public int euTick = 5;
|
public int euTick = 5;
|
||||||
|
|
||||||
public TileRollingMachine()
|
@Override
|
||||||
{
|
public double getMaxPower() {
|
||||||
super(1);
|
return 64000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.MEDIUM;
|
||||||
return 100000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
return true;
|
//charge(2); TODO
|
||||||
}
|
if (!worldObj.isRemote) {
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateEntity()
|
|
||||||
{
|
|
||||||
super.updateEntity();
|
|
||||||
charge(2);
|
|
||||||
if (!worldObj.isRemote)
|
|
||||||
{
|
|
||||||
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj);
|
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj);
|
||||||
if (currentRecipe != null && canMake())
|
if (currentRecipe != null && canMake()) {
|
||||||
{
|
if (tickTime >= runTime) {
|
||||||
if (tickTime >= runTime)
|
|
||||||
{
|
|
||||||
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj);
|
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj);
|
||||||
if (currentRecipe != null)
|
if (currentRecipe != null) {
|
||||||
{
|
|
||||||
boolean hasCrafted = false;
|
boolean hasCrafted = false;
|
||||||
if (inventory.getStackInSlot(0) == null)
|
if (inventory.getStackInSlot(0) == null) {
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(0, currentRecipe);
|
inventory.setInventorySlotContents(0, currentRecipe);
|
||||||
tickTime = -1;
|
tickTime = -1;
|
||||||
hasCrafted = true;
|
hasCrafted = true;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
if (inventory.getStackInSlot(0).stackSize + currentRecipe.stackSize <= currentRecipe
|
if (inventory.getStackInSlot(0).stackSize + currentRecipe.stackSize <= currentRecipe
|
||||||
.getMaxStackSize())
|
.getMaxStackSize()) {
|
||||||
{
|
|
||||||
ItemStack stack = inventory.getStackInSlot(0);
|
ItemStack stack = inventory.getStackInSlot(0);
|
||||||
stack.stackSize = stack.stackSize + currentRecipe.stackSize;
|
stack.stackSize = stack.stackSize + currentRecipe.stackSize;
|
||||||
inventory.setInventorySlotContents(0, stack);
|
inventory.setInventorySlotContents(0, stack);
|
||||||
|
@ -102,10 +62,8 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
||||||
hasCrafted = true;
|
hasCrafted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasCrafted)
|
if (hasCrafted) {
|
||||||
{
|
for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
|
||||||
for (int i = 0; i < craftMatrix.getSizeInventory(); i++)
|
|
||||||
{
|
|
||||||
craftMatrix.decrStackSize(i, 1);
|
craftMatrix.decrStackSize(i, 1);
|
||||||
}
|
}
|
||||||
currentRecipe = null;
|
currentRecipe = null;
|
||||||
|
@ -113,69 +71,56 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentRecipe != null)
|
if (currentRecipe != null) {
|
||||||
{
|
if (canUseEnergy(euTick) && tickTime < runTime) {
|
||||||
if (canUseEnergy(euTick) && tickTime < runTime)
|
|
||||||
{
|
|
||||||
useEnergy(euTick);
|
useEnergy(euTick);
|
||||||
tickTime++;
|
tickTime++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentRecipe == null)
|
if (currentRecipe == null) {
|
||||||
{
|
|
||||||
tickTime = -1;
|
tickTime = -1;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj);
|
currentRecipe = RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj);
|
||||||
if (currentRecipe != null)
|
if (currentRecipe != null) {
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(1, currentRecipe);
|
inventory.setInventorySlotContents(1, currentRecipe);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
inventory.setInventorySlotContents(1, null);
|
inventory.setInventorySlotContents(1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canMake()
|
public boolean canMake() {
|
||||||
{
|
|
||||||
return RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj) != null;
|
return RollingMachineRecipe.instance.findMatchingRecipe(craftMatrix, worldObj) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.RollingMachine, 1);
|
return new ItemStack(ModBlocks.RollingMachine, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
ItemUtils.readInvFromNBT(craftMatrix, "Crafting", tagCompound);
|
ItemUtils.readInvFromNBT(craftMatrix, "Crafting", tagCompound);
|
||||||
isRunning = tagCompound.getBoolean("isRunning");
|
isRunning = tagCompound.getBoolean("isRunning");
|
||||||
|
@ -183,29 +128,25 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
ItemUtils.writeInvToNBT(craftMatrix, "Crafting", tagCompound);
|
ItemUtils.writeInvToNBT(craftMatrix, "Crafting", tagCompound);
|
||||||
writeUpdateToNBT(tagCompound);
|
writeUpdateToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writeUpdateToNBT(NBTTagCompound tagCompound)
|
public void writeUpdateToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
tagCompound.setBoolean("isRunning", isRunning);
|
tagCompound.setBoolean("isRunning", isRunning);
|
||||||
tagCompound.setInteger("tickTime", tickTime);
|
tagCompound.setInteger("tickTime", tickTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate()
|
public void invalidate() {
|
||||||
{
|
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkUnload()
|
public void onChunkUnload() {
|
||||||
{
|
|
||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,14 +155,13 @@ public class TileRollingMachine extends TilePowerAcceptor implements IWrenchable
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RollingTileContainer extends Container
|
private static class RollingTileContainer extends Container {
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.ScrapboxList;
|
import techreborn.api.ScrapboxList;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
@ -17,11 +17,9 @@ import techreborn.init.ModItems;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory
|
public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileScrapboxinator", 64, this);
|
public Inventory inventory = new Inventory(6, "TileScrapboxinator", 64, this);
|
||||||
public int capacity = 1000;
|
|
||||||
public int cost = 20;
|
public int cost = 20;
|
||||||
public int progress;
|
public int progress;
|
||||||
public int time = 200;
|
public int time = 200;
|
||||||
|
@ -30,93 +28,71 @@ public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable
|
||||||
public int input1 = 0;
|
public int input1 = 0;
|
||||||
public int output = 1;
|
public int output = 1;
|
||||||
|
|
||||||
public TileScrapboxinator()
|
public int gaugeProgressScaled(int scale) {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int gaugeProgressScaled(int scale)
|
|
||||||
{
|
|
||||||
return (progress * scale) / time;
|
return (progress * scale) / time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
boolean burning = isBurning();
|
boolean burning = isBurning();
|
||||||
boolean updateInventory = false;
|
boolean updateInventory = false;
|
||||||
if (getEnergy() <= cost && canOpen())
|
if (getEnergy() <= cost && canOpen()) {
|
||||||
{
|
if (getEnergy() > cost) {
|
||||||
if (getEnergy() > cost)
|
|
||||||
{
|
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isBurning() && canOpen())
|
if (isBurning() && canOpen()) {
|
||||||
{
|
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
progress++;
|
progress++;
|
||||||
if (progress >= time)
|
if (progress >= time) {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
recycleItems();
|
recycleItems();
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
if (burning != isBurning())
|
if (burning != isBurning()) {
|
||||||
{
|
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
if (updateInventory)
|
if (updateInventory) {
|
||||||
{
|
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recycleItems()
|
public void recycleItems() {
|
||||||
{
|
if (this.canOpen() && !worldObj.isRemote) {
|
||||||
if (this.canOpen() && !worldObj.isRemote)
|
|
||||||
{
|
|
||||||
int random = new Random().nextInt(ScrapboxList.stacks.size());
|
int random = new Random().nextInt(ScrapboxList.stacks.size());
|
||||||
ItemStack out = ScrapboxList.stacks.get(random).copy();
|
ItemStack out = ScrapboxList.stacks.get(random).copy();
|
||||||
if (getStackInSlot(output) == null)
|
if (getStackInSlot(output) == null) {
|
||||||
{
|
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
setInventorySlotContents(output, out);
|
setInventorySlotContents(output, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getStackInSlot(input1).stackSize > 1)
|
if (getStackInSlot(input1).stackSize > 1) {
|
||||||
{
|
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
this.decrStackSize(input1, 1);
|
this.decrStackSize(input1, 1);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
setInventorySlotContents(input1, null);
|
setInventorySlotContents(input1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canOpen()
|
public boolean canOpen() {
|
||||||
{
|
|
||||||
return getStackInSlot(input1) != null && getStackInSlot(output) == null;
|
return getStackInSlot(input1) != null && getStackInSlot(output) == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBurning()
|
public boolean isBurning() {
|
||||||
{
|
|
||||||
return getEnergy() > cost;
|
return getEnergy() > cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateState()
|
public void updateState() {
|
||||||
{
|
|
||||||
IBlockState blockState = worldObj.getBlockState(pos);
|
IBlockState blockState = worldObj.getBlockState(pos);
|
||||||
if (blockState.getBlock() instanceof BlockMachineBase)
|
if (blockState.getBlock() instanceof BlockMachineBase) {
|
||||||
{
|
|
||||||
BlockMachineBase blockMachineBase = (BlockMachineBase) blockState.getBlock();
|
BlockMachineBase blockMachineBase = (BlockMachineBase) blockState.getBlock();
|
||||||
if (blockState.getValue(BlockMachineBase.ACTIVE) != progress > 0)
|
if (blockState.getValue(BlockMachineBase.ACTIVE) != progress > 0)
|
||||||
blockMachineBase.setActive(progress > 0, worldObj, pos);
|
blockMachineBase.setActive(progress > 0, worldObj, pos);
|
||||||
|
@ -124,56 +100,46 @@ public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.scrapboxinator, 1);
|
return new ItemStack(ModBlocks.scrapboxinator, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2} : new int[]{0, 1, 2};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex == 2)
|
if (slotIndex == 2)
|
||||||
return false;
|
return false;
|
||||||
if (slotIndex == 1)
|
if (slotIndex == 1) {
|
||||||
{
|
if (itemStack.getItem() == ModItems.scrapBox) {
|
||||||
if (itemStack.getItem() == ModItems.scrapBox)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,45 +147,18 @@ public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2;
|
return slotIndex == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 16000;
|
||||||
return capacity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.LOW;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.MEDIUM;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,4 +166,5 @@ public class TileScrapboxinator extends TilePowerAcceptor implements IWrenchable
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,8 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.api.recipe.ITileRecipeHandler;
|
import techreborn.api.recipe.ITileRecipeHandler;
|
||||||
|
@ -20,17 +20,14 @@ import techreborn.api.recipe.machines.VacuumFreezerRecipe;
|
||||||
import techreborn.blocks.BlockMachineCasing;
|
import techreborn.blocks.BlockMachineCasing;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ITileRecipeHandler<VacuumFreezerRecipe>, IRecipeCrafterProvider
|
public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ITileRecipeHandler<VacuumFreezerRecipe>, IRecipeCrafterProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public int tickTime;
|
public int tickTime;
|
||||||
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
|
public Inventory inventory = new Inventory(3, "TileVacuumFreezer", 64, this);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int multiBlockStatus = 0;
|
public int multiBlockStatus = 0;
|
||||||
|
|
||||||
public TileVacuumFreezer()
|
public TileVacuumFreezer() {
|
||||||
{
|
|
||||||
super(2);
|
|
||||||
// Input slots
|
// Input slots
|
||||||
int[] inputs = new int[1];
|
int[] inputs = new int[1];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
|
@ -40,128 +37,84 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
|
|
||||||
if (worldObj.getTotalWorldTime() % 20 == 0)
|
if (worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
{
|
|
||||||
multiBlockStatus = checkMachine() ? 1 : 0;
|
multiBlockStatus = checkMachine() ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.MEDIUM;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.AlloySmelter, 1);
|
return new ItemStack(ModBlocks.AlloySmelter, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
crafter.readFromNBT(tagCompound);
|
crafter.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean checkMachine()
|
public boolean checkMachine() {
|
||||||
{
|
|
||||||
int xDir = EnumFacing.UP.getFrontOffsetX() * 2;
|
int xDir = EnumFacing.UP.getFrontOffsetX() * 2;
|
||||||
int yDir = EnumFacing.UP.getFrontOffsetY() * 2;
|
int yDir = EnumFacing.UP.getFrontOffsetY() * 2;
|
||||||
int zDir = EnumFacing.UP.getFrontOffsetZ() * 2;
|
int zDir = EnumFacing.UP.getFrontOffsetZ() * 2;
|
||||||
for (int i = -1; i < 2; i++)
|
for (int i = -1; i < 2; i++) {
|
||||||
{
|
for (int j = -1; j < 2; j++) {
|
||||||
for (int j = -1; j < 2; j++)
|
for (int k = -1; k < 2; k++) {
|
||||||
{
|
if ((i != 0) || (j != 0) || (k != 0)) {
|
||||||
for (int k = -1; k < 2; k++)
|
|
||||||
{
|
|
||||||
if ((i != 0) || (j != 0) || (k != 0))
|
|
||||||
{
|
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j,
|
if (worldObj.getBlockState(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j,
|
||||||
getPos().getZ() - zDir + k)).getBlock() != ModBlocks.MachineCasing)
|
getPos().getZ() - zDir + k)).getBlock() != ModBlocks.MachineCasing) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
IBlockState BlockStateContainer = worldObj.getBlockState(new BlockPos(
|
IBlockState BlockStateContainer = worldObj.getBlockState(new BlockPos(
|
||||||
|
@ -169,14 +122,12 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
||||||
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) BlockStateContainer.getBlock();
|
BlockMachineCasing blockMachineCasing = (BlockMachineCasing) BlockStateContainer.getBlock();
|
||||||
if (blockMachineCasing
|
if (blockMachineCasing
|
||||||
.getMetaFromState(BlockStateContainer) != (((i == 0) && (j == 0) && (k != 0))
|
.getMetaFromState(BlockStateContainer) != (((i == 0) && (j == 0) && (k != 0))
|
||||||
|| ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2
|
|| ((i == 0) && (j != 0) && (k == 0)) || ((i != 0) && (j == 0) && (k == 0)) ? 2
|
||||||
: 1))
|
: 1)) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (!worldObj.isAirBlock(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j,
|
} else if (!worldObj.isAirBlock(new BlockPos(getPos().getX() - xDir + i, getPos().getY() - yDir + j,
|
||||||
getPos().getZ() - zDir + k)))
|
getPos().getZ() - zDir + k))) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,4 +160,5 @@ public class TileVacuumFreezer extends TilePowerAcceptor implements IWrenchable,
|
||||||
public RecipeCrafter getRecipeCrafter() {
|
public RecipeCrafter getRecipeCrafter() {
|
||||||
return crafter;
|
return crafter;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraft.util.text.ITextComponent;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.ItemUtils;
|
import reborncore.common.util.ItemUtils;
|
||||||
import techreborn.api.reactor.FusionReactorRecipe;
|
import techreborn.api.reactor.FusionReactorRecipe;
|
||||||
|
@ -15,7 +16,7 @@ import techreborn.api.reactor.FusionReactorRecipeHelper;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileEntityFusionController extends TilePowerAcceptor implements IInventoryProvider
|
public class TileEntityFusionController extends TilePowerAcceptorProducer implements IInventoryProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(3, "TileEntityFusionController", 64, this);
|
public Inventory inventory = new Inventory(3, "TileEntityFusionController", 64, this);
|
||||||
|
@ -31,31 +32,23 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
FusionReactorRecipe currentRecipe = null;
|
FusionReactorRecipe currentRecipe = null;
|
||||||
boolean hasStartedCrafting = false;
|
boolean hasStartedCrafting = false;
|
||||||
|
|
||||||
public TileEntityFusionController()
|
|
||||||
{
|
|
||||||
super(4);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower() {
|
public double getMaxPower() {
|
||||||
return 100000000;
|
return 100000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public boolean canAcceptEnergy(EnumFacing direction) {
|
||||||
{
|
return hasStartedCrafting;
|
||||||
return !(direction == EnumFacing.DOWN || direction == EnumFacing.UP);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
public boolean canProvideEnergy(EnumFacing direction) {
|
||||||
{
|
return !hasStartedCrafting;
|
||||||
return direction == EnumFacing.DOWN || direction == EnumFacing.UP;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxOutput()
|
public double getMaxOutput() {
|
||||||
{
|
|
||||||
if (!hasStartedCrafting)
|
if (!hasStartedCrafting)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -63,18 +56,10 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
return 1000000;
|
return 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput() {
|
|
||||||
if (hasStartedCrafting) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return 8192;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier()
|
public EnumPowerTier getTier()
|
||||||
{
|
{
|
||||||
return EnumPowerTier.EXTREME;
|
return EnumPowerTier.INSANE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -152,9 +137,9 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update()
|
||||||
{
|
{
|
||||||
super.updateEntity();
|
super.update();
|
||||||
// TODO improve this code a lot
|
// TODO improve this code a lot
|
||||||
|
|
||||||
if (worldObj.getTotalWorldTime() % 20 == 0)
|
if (worldObj.getTotalWorldTime() % 20 == 0)
|
||||||
|
@ -276,11 +261,29 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0 && hasStartedCrafting) {
|
if (!worldObj.isRemote && getEnergy() > 0 && hasStartedCrafting) {
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
for(EnumFacing facing : EnumFacing.VALUES) {
|
||||||
|
double disposed = emitEnergy(facing, maxOutput);
|
||||||
|
if(disposed != 0) {
|
||||||
|
maxOutput -= disposed;
|
||||||
|
useEnergy(disposed);
|
||||||
|
if (maxOutput == 0) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO move to RebornCore
|
||||||
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
return receiver.receiveEnergy(amount, false);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean validateRecipe()
|
private boolean validateRecipe()
|
||||||
{
|
{
|
||||||
if (ItemUtils.isItemEqual(getStackInSlot(topStackSlot), currentRecipe.getTopInput(), true, true, true))
|
if (ItemUtils.isItemEqual(getStackInSlot(topStackSlot), currentRecipe.getTopInput(), true, true, true))
|
||||||
|
@ -333,7 +336,7 @@ public class TileEntityFusionController extends TilePowerAcceptor implements IIn
|
||||||
@Override
|
@Override
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return null;
|
return "Fusion Reactor";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -12,6 +13,7 @@ import reborncore.api.fuel.FluidPowerManager;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
|
@ -19,16 +21,23 @@ import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler, IInventoryProvider
|
public class TileDieselGenerator extends TilePowerProducer implements IWrenchable, IFluidHandler, IInventoryProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
||||||
public Tank tank = new Tank("TileDieselGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
public Tank tank = new Tank("TileDieselGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||||
public Inventory inventory = new Inventory(3, "TileDieselGenerator", 64, this);
|
public Inventory inventory = new Inventory(3, "TileDieselGenerator", 64, this);
|
||||||
|
|
||||||
public TileDieselGenerator()
|
|
||||||
{
|
@Override
|
||||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -131,8 +140,8 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
FluidUtils.fillContainers(this, inventory, 0, 1, tank.getFluidType());
|
||||||
|
@ -147,57 +156,28 @@ public class TileDieselGenerator extends TilePowerAcceptor implements IWrenchabl
|
||||||
if (!tank.isEmpty() && tank.getFluidType() != null
|
if (!tank.isEmpty() && tank.getFluidType() != null
|
||||||
&& FluidPowerManager.fluidPowerValues.containsKey(tank.getFluidType())) {
|
&& FluidPowerManager.fluidPowerValues.containsKey(tank.getFluidType())) {
|
||||||
double powerIn = FluidPowerManager.fluidPowerValues.get(tank.getFluidType());
|
double powerIn = FluidPowerManager.fluidPowerValues.get(tank.getFluidType());
|
||||||
if (getFreeSpace() >= powerIn) {
|
if (getMaxPower() - getEnergy() >= powerIn) {
|
||||||
addEnergy(powerIn, false);
|
addEnergy(powerIn, false);
|
||||||
tank.drain(1, true);
|
tank.drain(1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier()
|
public EnumPowerTier getTier()
|
||||||
{
|
{
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,25 +9,31 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.powerSystem.TilePowerAcceptor;
|
||||||
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
public class TileDragonEggSiphoner extends TilePowerProducer implements IWrenchable,IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public static final int euTick = ConfigTechReborn.DragonEggSiphonerOutput;
|
public static final int euTick = ConfigTechReborn.DragonEggSiphonerOutput;
|
||||||
public Inventory inventory = new Inventory(3, "TileAlloySmelter", 64, this);
|
public Inventory inventory = new Inventory(3, "TileAlloySmelter", 64, this);
|
||||||
|
|
||||||
public TileDragonEggSiphoner()
|
@Override
|
||||||
{
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
super(2);
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
|
if (worldObj.getBlockState(new BlockPos(getPos().getX(), getPos().getY() + 1, getPos().getZ()))
|
||||||
|
@ -35,81 +41,44 @@ public class TileDragonEggSiphoner extends TilePowerAcceptor implements IWrencha
|
||||||
addEnergy(euTick);
|
addEnergy(euTick);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.Dragoneggenergysiphoner, 1);
|
return new ItemStack(ModBlocks.Dragoneggenergysiphoner, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 256000;
|
||||||
return 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return euTick;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.HIGH;
|
return EnumPowerTier.HIGH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,32 +1,31 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fluids.*;
|
import net.minecraftforge.fluids.*;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.IWrenchable;
|
||||||
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
public class TileGasTurbine extends TilePowerProducer implements IWrenchable, IFluidHandler,IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
// TODO: run this off config
|
// TODO: run this off config
|
||||||
public static final int euTick = 16;
|
public static final int euTick = 16;
|
||||||
public Tank tank = new Tank("TileGasTurbine", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
public Tank tank = new Tank("TileGasTurbine", Fluid.BUCKET_VOLUME * 10, this);
|
||||||
public Inventory inventory = new Inventory(3, "TileGasTurbine", 64, this);
|
public Inventory inventory = new Inventory(3, "TileGasTurbine", 64, this);
|
||||||
Map<String, Integer> fluids = new HashMap<>();
|
Map<String, Integer> fluids = new HashMap<>();
|
||||||
|
|
||||||
|
@ -35,9 +34,7 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
||||||
// amounts.
|
// amounts.
|
||||||
double pendingWithdraw = 0.0;
|
double pendingWithdraw = 0.0;
|
||||||
|
|
||||||
public TileGasTurbine()
|
public TileGasTurbine() {
|
||||||
{
|
|
||||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
|
||||||
// TODO: fix this to have Gas Turbine generator values
|
// TODO: fix this to have Gas Turbine generator values
|
||||||
|
|
||||||
fluids.put("fluidhydrogen", 15000);
|
fluids.put("fluidhydrogen", 15000);
|
||||||
|
@ -45,107 +42,103 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
{
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.Gasturbine, 1);
|
return new ItemStack(ModBlocks.Gasturbine, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||||
{
|
|
||||||
int fill = tank.fill(resource, doFill);
|
int fill = tank.fill(resource, doFill);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return fill;
|
return fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||||
{
|
if (fluid != null) {
|
||||||
if (fluid != null)
|
|
||||||
{
|
|
||||||
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||||
{
|
return new FluidTankInfo[]{tank.getInfo()};
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
tank.readFromNBT(tagCompound);
|
tank.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tank.writeToNBT(tagCompound);
|
tank.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||||
{
|
|
||||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||||
getPos().getY(), getPos().getZ());
|
getPos().getY(), getPos().getZ());
|
||||||
readFromNBT(packet.getNbtCompound());
|
readFromNBT(packet.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
|
@ -173,45 +166,15 @@ public class TileGasTurbine extends TilePowerAcceptor implements IWrenchable, IF
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 64000;
|
||||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return euTick;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.MEDIUM;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -9,37 +10,42 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInventoryProvider
|
public class TileGenerator extends TilePowerProducer implements IWrenchable,IInventoryProvider {
|
||||||
{
|
|
||||||
public static int outputAmount = 10; // This is in line with BC engines rf,
|
public static int outputAmount = 10; // This is in line with BC engines rf,
|
||||||
public Inventory inventory = new Inventory(2, "TileGenerator", 64, this);
|
public Inventory inventory = new Inventory(2, "TileGenerator", 64, this);
|
||||||
public int fuelSlot = 0;
|
public int fuelSlot = 0;
|
||||||
public int burnTime;
|
public int burnTime;
|
||||||
public int totalBurnTime = 0;
|
public int totalBurnTime = 0;
|
||||||
// sould properly use the conversion
|
// sould properly use the conversion
|
||||||
// ratio here.
|
// ratio here.
|
||||||
public boolean isBurning;
|
public boolean isBurning;
|
||||||
public boolean lastTickBurning;
|
public boolean lastTickBurning;
|
||||||
ItemStack burnItem;
|
ItemStack burnItem;
|
||||||
|
|
||||||
public TileGenerator()
|
public static int getItemBurnTime(ItemStack stack) {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int getItemBurnTime(ItemStack stack)
|
|
||||||
{
|
|
||||||
return TileEntityFurnace.getItemBurnTime(stack) / 4;
|
return TileEntityFurnace.getItemBurnTime(stack) / 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
super.updateEntity();
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update() {
|
||||||
|
super.update();
|
||||||
if (worldObj.isRemote) {
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -69,17 +75,11 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInv
|
||||||
|
|
||||||
lastTickBurning = isBurning;
|
lastTickBurning = isBurning;
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateState()
|
public void updateState() {
|
||||||
{
|
|
||||||
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
||||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase)
|
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||||
{
|
|
||||||
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != burnTime > 0)
|
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != burnTime > 0)
|
||||||
blockMachineBase.setActive(burnTime > 0, worldObj, pos);
|
blockMachineBase.setActive(burnTime > 0, worldObj, pos);
|
||||||
|
@ -87,68 +87,37 @@ public class TileGenerator extends TilePowerAcceptor implements IWrenchable,IInv
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 8000;
|
||||||
return 100;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer p0)
|
public ItemStack getWrenchDrop(EntityPlayer p0) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.Generator);
|
return new ItemStack(ModBlocks.Generator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,30 +1,35 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.IWrenchable;
|
||||||
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
public class TileHeatGenerator extends TilePowerProducer implements IWrenchable {
|
||||||
{
|
|
||||||
|
|
||||||
public static final int euTick = ConfigTechReborn.HeatGeneratorOutput;
|
public static final int euTick = ConfigTechReborn.HeatGeneratorOutput;
|
||||||
|
|
||||||
public TileHeatGenerator()
|
@Override
|
||||||
{
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
super(1);
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
if (worldObj.getBlockState(new BlockPos(getPos().getX() + 1, getPos().getY(), getPos().getZ()))
|
if (worldObj.getBlockState(new BlockPos(getPos().getX() + 1, getPos().getY(), getPos().getZ()))
|
||||||
|
@ -46,89 +51,45 @@ public class TileHeatGenerator extends TilePowerAcceptor implements IWrenchable
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.heatGenerator, 1);
|
return new ItemStack(ModBlocks.heatGenerator, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 16000;
|
||||||
return 10000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public void addWailaInfo(List<String> info)
|
|
||||||
// {
|
|
||||||
// super.addWailaInfo(info);
|
|
||||||
// info.add("Power Generarating " + euTick +" EU/t");
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,18 +8,14 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.oredict.OreDictionary;
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileLightningRod extends TilePowerAcceptor {
|
public class TileLightningRod extends TilePowerProducer {
|
||||||
|
|
||||||
private int onStatusHoldTicks = -1;
|
private int onStatusHoldTicks = -1;
|
||||||
|
|
||||||
public TileLightningRod() {
|
|
||||||
super(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
super.update();
|
super.update();
|
||||||
|
@ -51,10 +47,6 @@ public class TileLightningRod extends TilePowerAcceptor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public float getLightningStrikeMultiplier() {
|
public float getLightningStrikeMultiplier() {
|
||||||
|
@ -72,6 +64,17 @@ public class TileLightningRod extends TilePowerAcceptor {
|
||||||
return 4F;
|
return 4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValidIronFence(int y) {
|
public boolean isValidIronFence(int y) {
|
||||||
Item itemBlock = Item.getItemFromBlock(worldObj.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock());
|
Item itemBlock = Item.getItemFromBlock(worldObj.getBlockState(new BlockPos(pos.getX(), y, pos.getZ())).getBlock());
|
||||||
for(ItemStack fence : OreDictionary.getOres("fenceIron")) {
|
for(ItemStack fence : OreDictionary.getOres("fenceIron")) {
|
||||||
|
@ -82,32 +85,17 @@ public class TileLightningRod extends TilePowerAcceptor {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower() {
|
public double getMaxPower() {
|
||||||
return 327680;
|
return 1024000;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction) {
|
|
||||||
return direction == getFacingEnum();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxOutput() {
|
public double getMaxOutput() {
|
||||||
return 2048;
|
return 32768;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput() {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier() {
|
public EnumPowerTier getTier() {
|
||||||
return EnumPowerTier.HIGH;
|
return EnumPowerTier.INSANE;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +1,27 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.NetworkManager;
|
import net.minecraft.network.NetworkManager;
|
||||||
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fluids.*;
|
import net.minecraftforge.fluids.*;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.IWrenchable;
|
||||||
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
import techreborn.config.ConfigTechReborn;
|
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
public class TileSemifluidGenerator extends TilePowerProducer implements IWrenchable, IFluidHandler,IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
// TODO: run this off config
|
// TODO: run this off config
|
||||||
public static final int euTick = 8;
|
public static final int euTick = 8;
|
||||||
|
@ -35,9 +34,7 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
||||||
// amounts.
|
// amounts.
|
||||||
double pendingWithdraw = 0.0;
|
double pendingWithdraw = 0.0;
|
||||||
|
|
||||||
public TileSemifluidGenerator()
|
public TileSemifluidGenerator() {
|
||||||
{
|
|
||||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
|
||||||
// TODO: fix this to have SemiFluid generator values
|
// TODO: fix this to have SemiFluid generator values
|
||||||
|
|
||||||
fluids.put("creosote", 3000);
|
fluids.put("creosote", 3000);
|
||||||
|
@ -51,107 +48,103 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
{
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.Semifluidgenerator, 1);
|
return new ItemStack(ModBlocks.Semifluidgenerator, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||||
{
|
|
||||||
int fill = tank.fill(resource, doFill);
|
int fill = tank.fill(resource, doFill);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return fill;
|
return fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||||
{
|
if (fluid != null) {
|
||||||
if (fluid != null)
|
|
||||||
{
|
|
||||||
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
return fluids.containsKey(FluidRegistry.getFluidName(fluid));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||||
{
|
return new FluidTankInfo[]{tank.getInfo()};
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
tank.readFromNBT(tagCompound);
|
tank.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tank.writeToNBT(tagCompound);
|
tank.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||||
{
|
|
||||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||||
getPos().getY(), getPos().getZ());
|
getPos().getY(), getPos().getZ());
|
||||||
readFromNBT(packet.getNbtCompound());
|
readFromNBT(packet.getNbtCompound());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (!worldObj.isRemote)
|
if (!worldObj.isRemote)
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
|
|
||||||
|
@ -177,45 +170,15 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 16000;
|
||||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return euTick;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,4 +186,5 @@ public class TileSemifluidGenerator extends TilePowerAcceptor implements IWrench
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,9 @@ package techreborn.tiles.generator;
|
||||||
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import techreborn.blocks.generator.BlockSolarPanel;
|
import techreborn.blocks.generator.BlockSolarPanel;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
|
@ -12,22 +13,15 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 25/02/2016.
|
* Created by modmuss50 on 25/02/2016.
|
||||||
*/
|
*/
|
||||||
public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
public class TileSolarPanel extends TilePowerProducer implements ITickable {
|
||||||
{
|
|
||||||
|
|
||||||
boolean shouldMakePower = false;
|
boolean shouldMakePower = false;
|
||||||
boolean lastTickSate = false;
|
|
||||||
|
|
||||||
int powerToAdd;
|
int powerToAdd;
|
||||||
|
|
||||||
public TileSolarPanel()
|
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
if (worldObj.getTotalWorldTime() % 60 == 0) {
|
if (worldObj.getTotalWorldTime() % 60 == 0) {
|
||||||
shouldMakePower = isSunOut();
|
shouldMakePower = isSunOut();
|
||||||
|
@ -41,19 +35,12 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
||||||
}
|
}
|
||||||
worldObj.setBlockState(getPos(), worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
worldObj.setBlockState(getPos(), worldObj.getBlockState(this.getPos()).withProperty(BlockSolarPanel.ACTIVE, isSunOut()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInfo(List<String> info, boolean isRealTile)
|
public void addInfo(List<String> info, boolean isRealTile) {
|
||||||
{
|
|
||||||
super.addInfo(info, isRealTile);
|
super.addInfo(info, isRealTile);
|
||||||
if (isRealTile)
|
if (isRealTile) {
|
||||||
{
|
|
||||||
// FIXME: 25/02/2016
|
// FIXME: 25/02/2016
|
||||||
// info.add(TextFormatting.LIGHT_PURPLE + "Power gen/tick " +
|
// info.add(TextFormatting.LIGHT_PURPLE + "Power gen/tick " +
|
||||||
// TextFormatting.GREEN + PowerSystem.getLocalizedPower(
|
// TextFormatting.GREEN + PowerSystem.getLocalizedPower(
|
||||||
|
@ -61,45 +48,30 @@ public class TileSolarPanel extends TilePowerAcceptor implements ITickable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isSunOut()
|
@Override
|
||||||
{
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
return worldObj.canBlockSeeSky(pos.up()) && !worldObj.isRaining() && !worldObj.isThundering()
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSunOut() {
|
||||||
|
return worldObj.canBlockSeeSky(pos.up()) && !worldObj.isRaining() && !worldObj.isThundering()
|
||||||
&& worldObj.isDaytime();
|
&& worldObj.isDaytime();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 8000;
|
||||||
return 1000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
@ -12,8 +11,9 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraftforge.fluids.*;
|
import net.minecraftforge.fluids.*;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
|
import reborncore.common.IWrenchable;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import reborncore.common.util.FluidUtils;
|
import reborncore.common.util.FluidUtils;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import reborncore.common.util.Tank;
|
import reborncore.common.util.Tank;
|
||||||
|
@ -21,79 +21,73 @@ import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchable, IFluidHandler,IInventoryProvider
|
public class TileThermalGenerator extends TilePowerProducer implements IWrenchable, IFluidHandler,IInventoryProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
public static final int euTick = ConfigTechReborn.ThermalGeneratorOutput;
|
||||||
public Tank tank = new Tank("TileThermalGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
public Tank tank = new Tank("TileThermalGenerator", FluidContainerRegistry.BUCKET_VOLUME * 10, this);
|
||||||
public Inventory inventory = new Inventory(3, "TileThermalGenerator", 64, this);
|
public Inventory inventory = new Inventory(3, "TileThermalGenerator", 64, this);
|
||||||
|
|
||||||
public TileThermalGenerator()
|
@Override
|
||||||
{
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
super(ConfigTechReborn.ThermalGeneratorTier);
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.thermalGenerator, 1);
|
return new ItemStack(ModBlocks.thermalGenerator, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
|
public int fill(EnumFacing from, FluidStack resource, boolean doFill) {
|
||||||
{
|
|
||||||
int fill = tank.fill(resource, doFill);
|
int fill = tank.fill(resource, doFill);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return fill;
|
return fill;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
|
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(resource.amount, doDrain);
|
FluidStack drain = tank.drain(resource.amount, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
|
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain) {
|
||||||
{
|
|
||||||
FluidStack drain = tank.drain(maxDrain, doDrain);
|
FluidStack drain = tank.drain(maxDrain, doDrain);
|
||||||
tank.compareAndUpdate();
|
tank.compareAndUpdate();
|
||||||
return drain;
|
return drain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canFill(EnumFacing from, Fluid fluid)
|
public boolean canFill(EnumFacing from, Fluid fluid) {
|
||||||
{
|
if (fluid != null) {
|
||||||
if (fluid != null)
|
if (fluid == FluidRegistry.LAVA) {
|
||||||
{
|
|
||||||
if (fluid == FluidRegistry.LAVA)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,35 +95,30 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canDrain(EnumFacing from, Fluid fluid)
|
public boolean canDrain(EnumFacing from, Fluid fluid) {
|
||||||
{
|
|
||||||
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
return tank.getFluid() == null || tank.getFluid().getFluid() == fluid;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FluidTankInfo[] getTankInfo(EnumFacing from)
|
public FluidTankInfo[] getTankInfo(EnumFacing from) {
|
||||||
{
|
return new FluidTankInfo[]{tank.getInfo()};
|
||||||
return new FluidTankInfo[] { tank.getInfo() };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
tank.readFromNBT(tagCompound);
|
tank.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
tank.writeToNBT(tagCompound);
|
tank.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet)
|
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) {
|
||||||
{
|
|
||||||
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
worldObj.markBlockRangeForRenderUpdate(getPos().getX(), getPos().getY(), getPos().getZ(), getPos().getX(),
|
||||||
getPos().getY(), getPos().getZ());
|
getPos().getY(), getPos().getZ());
|
||||||
readFromNBT(packet.getNbtCompound());
|
readFromNBT(packet.getNbtCompound());
|
||||||
|
@ -137,8 +126,8 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// TODO optimise this code
|
// TODO optimise this code
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
FluidUtils.drainContainers(this, inventory, 0, 1);
|
FluidUtils.drainContainers(this, inventory, 0, 1);
|
||||||
for (EnumFacing direction : EnumFacing.values()) {
|
for (EnumFacing direction : EnumFacing.values()) {
|
||||||
|
@ -172,46 +161,15 @@ public class TileThermalGenerator extends TilePowerAcceptor implements IWrenchab
|
||||||
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
} else if (tank.getFluidType() == null && getStackInSlot(2) != null) {
|
||||||
setInventorySlotContents(2, null);
|
setInventorySlotContents(2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 16000;
|
||||||
return ConfigTechReborn.ThermalGeneratorCharge;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,84 +2,57 @@ package techreborn.tiles.generator;
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 25/02/2016.
|
* Created by modmuss50 on 25/02/2016.
|
||||||
*/
|
*/
|
||||||
public class TileWaterMill extends TilePowerAcceptor
|
public class TileWaterMill extends TilePowerProducer {
|
||||||
{
|
|
||||||
|
|
||||||
int waterblocks = 0;
|
int waterblocks = 0;
|
||||||
|
|
||||||
public TileWaterMill()
|
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (worldObj.getTotalWorldTime() % 20 == 0) {
|
if (worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
checkForWater();
|
checkForWater();
|
||||||
}
|
}
|
||||||
if (waterblocks > 0) {
|
if (waterblocks > 0) {
|
||||||
addEnergy(waterblocks);
|
addEnergy(waterblocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkForWater()
|
public void checkForWater() {
|
||||||
{
|
|
||||||
waterblocks = 0;
|
waterblocks = 0;
|
||||||
for (EnumFacing facing : EnumFacing.HORIZONTALS)
|
for (EnumFacing facing : EnumFacing.HORIZONTALS) {
|
||||||
{
|
if (worldObj.getBlockState(getPos().offset(facing)).getBlock() == Blocks.WATER) {
|
||||||
if (worldObj.getBlockState(getPos().offset(facing)).getBlock() == Blocks.WATER)
|
|
||||||
{
|
|
||||||
waterblocks++;
|
waterblocks++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
{
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
return 1000;
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public double getMaxPower() {
|
||||||
{
|
return 8000;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,70 +1,47 @@
|
||||||
package techreborn.tiles.generator;
|
package techreborn.tiles.generator;
|
||||||
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerProducer;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 25/02/2016.
|
* Created by modmuss50 on 25/02/2016.
|
||||||
*/
|
*/
|
||||||
public class TileWindMill extends TilePowerAcceptor
|
public class TileWindMill extends TilePowerProducer {
|
||||||
{
|
|
||||||
|
|
||||||
int basePower = 16;
|
int basePower = 16;
|
||||||
|
|
||||||
public TileWindMill()
|
|
||||||
{
|
|
||||||
super(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (pos.getY() > 64) {
|
if (pos.getY() > 64) {
|
||||||
double actualPower = basePower + basePower * worldObj.getThunderStrength(1.0F);
|
double actualPower = basePower + basePower * worldObj.getThunderStrength(1.0F);
|
||||||
addEnergy(actualPower);
|
addEnergy(actualPower);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
{
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
return 10000;
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
addEnergy(amount - receiver.receiveEnergy(amount, false));
|
||||||
|
} else addEnergy(amount);
|
||||||
|
return 0; //Temporary hack die to my bug RebornCore
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public double getMaxPower() {
|
||||||
{
|
return 8000;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 128;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,37 +15,29 @@ import java.util.HashMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
|
||||||
public class IDSUManager
|
public class IDSUManager {
|
||||||
{
|
|
||||||
|
|
||||||
public static final String savename = "idsu.json";
|
public static final String savename = "idsu.json";
|
||||||
public static IDSUManager INSTANCE;
|
public static IDSUManager INSTANCE;
|
||||||
public HashMap<World, IDSUWorldSaveData> worldData = new HashMap<>();
|
public HashMap<World, IDSUWorldSaveData> worldData = new HashMap<>();
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void worldSave(WorldEvent.Save event)
|
public void worldSave(WorldEvent.Save event) {
|
||||||
{
|
|
||||||
if (event.getWorld() != null && event.getWorld().getSaveHandler() != null
|
if (event.getWorld() != null && event.getWorld().getSaveHandler() != null
|
||||||
&& event.getWorld().getSaveHandler().getWorldDirectory() != null)
|
&& event.getWorld().getSaveHandler().getWorldDirectory() != null) {
|
||||||
{
|
if (worldData.containsKey(event.getWorld())) {
|
||||||
if (worldData.containsKey(event.getWorld()))
|
|
||||||
{
|
|
||||||
worldData.get(event.getWorld()).save();
|
worldData.get(event.getWorld()).save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
@SubscribeEvent(priority = EventPriority.HIGHEST)
|
||||||
public void worldLoad(WorldEvent.Load event)
|
public void worldLoad(WorldEvent.Load event) {
|
||||||
{
|
|
||||||
if (event.getWorld() != null && event.getWorld().getSaveHandler() != null
|
if (event.getWorld() != null && event.getWorld().getSaveHandler() != null
|
||||||
&& event.getWorld().getSaveHandler().getWorldDirectory() != null)
|
&& event.getWorld().getSaveHandler().getWorldDirectory() != null) {
|
||||||
{
|
if (worldData.containsKey(event.getWorld())) {
|
||||||
if (worldData.containsKey(event.getWorld()))
|
|
||||||
{
|
|
||||||
worldData.get(event.getWorld()).load();
|
worldData.get(event.getWorld()).load();
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
IDSUWorldSaveData worldSaveData = new IDSUWorldSaveData(event.getWorld());
|
IDSUWorldSaveData worldSaveData = new IDSUWorldSaveData(event.getWorld());
|
||||||
worldData.put(event.getWorld(), worldSaveData);
|
worldData.put(event.getWorld(), worldSaveData);
|
||||||
worldSaveData.load();
|
worldSaveData.load();
|
||||||
|
@ -54,13 +46,10 @@ public class IDSUManager
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
public void worldClosed(WorldEvent.Unload event)
|
public void worldClosed(WorldEvent.Unload event) {
|
||||||
{
|
|
||||||
if (event.getWorld() != null && event.getWorld().getSaveHandler() != null
|
if (event.getWorld() != null && event.getWorld().getSaveHandler() != null
|
||||||
&& event.getWorld().getSaveHandler().getWorldDirectory() != null)
|
&& event.getWorld().getSaveHandler().getWorldDirectory() != null) {
|
||||||
{
|
if (worldData.containsKey(event.getWorld())) {
|
||||||
if (worldData.containsKey(event.getWorld()))
|
|
||||||
{
|
|
||||||
worldData.get(event.getWorld()).save();
|
worldData.get(event.getWorld()).save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,13 +57,10 @@ public class IDSUManager
|
||||||
worldData.clear();
|
worldData.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDSUValueSaveData getSaveDataForWorld(World world, String channel)
|
public IDSUValueSaveData getSaveDataForWorld(World world, String channel) {
|
||||||
{
|
if (worldData.containsKey(world)) {
|
||||||
if (worldData.containsKey(world))
|
|
||||||
{
|
|
||||||
return worldData.get(world).getSaves(channel);
|
return worldData.get(world).getSaves(channel);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
IDSUWorldSaveData worldSaveData = new IDSUWorldSaveData(world);
|
IDSUWorldSaveData worldSaveData = new IDSUWorldSaveData(world);
|
||||||
worldData.put(world, worldSaveData);
|
worldData.put(world, worldSaveData);
|
||||||
worldSaveData.load();
|
worldSaveData.load();
|
||||||
|
@ -82,13 +68,10 @@ public class IDSUManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDSUWorldSaveData getWorldDataFormWorld(World world)
|
public IDSUWorldSaveData getWorldDataFormWorld(World world) {
|
||||||
{
|
if (worldData.containsKey(world)) {
|
||||||
if (worldData.containsKey(world))
|
|
||||||
{
|
|
||||||
return worldData.get(world);
|
return worldData.get(world);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
IDSUWorldSaveData worldSaveData = new IDSUWorldSaveData(world);
|
IDSUWorldSaveData worldSaveData = new IDSUWorldSaveData(world);
|
||||||
worldData.put(world, worldSaveData);
|
worldData.put(world, worldSaveData);
|
||||||
worldSaveData.load();
|
worldSaveData.load();
|
||||||
|
@ -96,31 +79,25 @@ public class IDSUManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadFromString(String json, World world)
|
public void loadFromString(String json, World world) {
|
||||||
{
|
if (json.equals("EMPTY")) {
|
||||||
if (json.equals("EMPTY"))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IDSUWorldSaveData worldSaveData;
|
IDSUWorldSaveData worldSaveData;
|
||||||
if (worldData.containsKey(world))
|
if (worldData.containsKey(world)) {
|
||||||
{
|
|
||||||
worldSaveData = worldData.get(world);
|
worldSaveData = worldData.get(world);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
worldSaveData = new IDSUWorldSaveData(world);
|
worldSaveData = new IDSUWorldSaveData(world);
|
||||||
worldData.put(world, worldSaveData);
|
worldData.put(world, worldSaveData);
|
||||||
}
|
}
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
Type typeOfHashMap = new TypeToken<TreeMap<Integer, IDSUValueSaveData>>()
|
Type typeOfHashMap = new TypeToken<TreeMap<Integer, IDSUValueSaveData>>() {
|
||||||
{
|
|
||||||
}.getType();
|
}.getType();
|
||||||
worldSaveData.idsuValues.clear();
|
worldSaveData.idsuValues.clear();
|
||||||
worldSaveData.idsuValues = gson.fromJson(json, typeOfHashMap);
|
worldSaveData.idsuValues = gson.fromJson(json, typeOfHashMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IDSUWorldSaveData
|
public class IDSUWorldSaveData {
|
||||||
{
|
|
||||||
|
|
||||||
public TreeMap<String, IDSUValueSaveData> idsuValues = new TreeMap<>();
|
public TreeMap<String, IDSUValueSaveData> idsuValues = new TreeMap<>();
|
||||||
|
|
||||||
|
@ -132,114 +109,90 @@ public class IDSUManager
|
||||||
|
|
||||||
File file;
|
File file;
|
||||||
|
|
||||||
public IDSUWorldSaveData(World world)
|
public IDSUWorldSaveData(World world) {
|
||||||
{
|
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.saveHandler = world.getSaveHandler();
|
this.saveHandler = world.getSaveHandler();
|
||||||
folder = new File(saveHandler.getWorldDirectory(), "idsuData");
|
folder = new File(saveHandler.getWorldDirectory(), "idsuData");
|
||||||
file = new File(folder, savename);
|
file = new File(folder, savename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDSUValueSaveData getSaves(String udid)
|
public IDSUValueSaveData getSaves(String udid) {
|
||||||
{
|
if (udid == null) {
|
||||||
if (udid == null)
|
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (idsuValues.containsKey(udid))
|
if (idsuValues.containsKey(udid)) {
|
||||||
{
|
|
||||||
return idsuValues.get(udid);
|
return idsuValues.get(udid);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
IDSUValueSaveData data = new IDSUValueSaveData();
|
IDSUValueSaveData data = new IDSUValueSaveData();
|
||||||
idsuValues.put(udid, data);
|
idsuValues.put(udid, data);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load()
|
public void load() {
|
||||||
{
|
if (!file.exists()) {
|
||||||
if (!file.exists())
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(file));
|
BufferedReader reader = new BufferedReader(new FileReader(file));
|
||||||
Type typeOfHashMap = new TypeToken<TreeMap<String, IDSUValueSaveData>>()
|
Type typeOfHashMap = new TypeToken<TreeMap<String, IDSUValueSaveData>>() {
|
||||||
{
|
|
||||||
}.getType();
|
}.getType();
|
||||||
idsuValues.clear();
|
idsuValues.clear();
|
||||||
idsuValues = gson.fromJson(reader, typeOfHashMap);
|
idsuValues = gson.fromJson(reader, typeOfHashMap);
|
||||||
} catch (Exception e)
|
} catch (Exception e) {
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save()
|
public void save() {
|
||||||
{
|
if (idsuValues.isEmpty()) {
|
||||||
if (idsuValues.isEmpty())
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!file.exists())
|
if (!file.exists()) {
|
||||||
{
|
if (!folder.exists()) {
|
||||||
if (!folder.exists())
|
|
||||||
{
|
|
||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
file.createNewFile();
|
file.createNewFile();
|
||||||
} catch (IOException e)
|
} catch (IOException e) {
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||||
String json = gson.toJson(idsuValues);
|
String json = gson.toJson(idsuValues);
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
FileWriter writer = new FileWriter(file);
|
FileWriter writer = new FileWriter(file);
|
||||||
writer.write(json);
|
writer.write(json);
|
||||||
writer.close();
|
writer.close();
|
||||||
} catch (IOException e)
|
} catch (IOException e) {
|
||||||
{
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class IDSUValueSaveData
|
public class IDSUValueSaveData {
|
||||||
{
|
|
||||||
|
|
||||||
public double storedPower = 0;
|
public double storedPower = 0;
|
||||||
|
|
||||||
public IDSUValueSaveData(double storedPower)
|
public IDSUValueSaveData(double storedPower) {
|
||||||
{
|
|
||||||
this.storedPower = storedPower;
|
this.storedPower = storedPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDSUValueSaveData()
|
public IDSUValueSaveData() {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getStoredPower()
|
public double getStoredPower() {
|
||||||
{
|
|
||||||
return storedPower;
|
return storedPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStoredPower(double storedPower)
|
public void setStoredPower(double storedPower) {
|
||||||
{
|
|
||||||
this.storedPower = storedPower;
|
this.storedPower = storedPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addEnergy(double storedPower)
|
public void addEnergy(double storedPower) {
|
||||||
{
|
|
||||||
this.storedPower += storedPower;
|
this.storedPower += storedPower;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package techreborn.tiles.idsu;
|
package techreborn.tiles.idsu;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.IWrenchable;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
public class TileIDSU extends TilePowerAcceptorProducer implements IWrenchable {
|
||||||
{
|
|
||||||
|
|
||||||
public String ownerUdid;
|
public String ownerUdid;
|
||||||
public int tier;
|
public int tier;
|
||||||
|
@ -23,111 +23,67 @@ public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
||||||
private double euChange;
|
private double euChange;
|
||||||
private int ticks;
|
private int ticks;
|
||||||
|
|
||||||
public TileIDSU(int tier1, int output1, int maxStorage1)
|
public TileIDSU(int tier1, int output1, int maxStorage1) {
|
||||||
{
|
|
||||||
super(tier1);
|
|
||||||
this.tier = tier1;
|
this.tier = tier1;
|
||||||
this.output = output1;
|
this.output = output1;
|
||||||
this.maxStorage = maxStorage1;
|
this.maxStorage = maxStorage1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileIDSU()
|
public TileIDSU() {
|
||||||
{
|
|
||||||
this(5, 2048, 100000000);
|
this(5, 2048, 100000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getEnergy()
|
public double getEnergy() {
|
||||||
{
|
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
|
||||||
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid))
|
|
||||||
{
|
|
||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
return IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower;
|
return IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setEnergy(double energy)
|
public void setEnergy(double energy) {
|
||||||
{
|
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid)) {
|
||||||
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid))
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower = energy;
|
IDSUManager.INSTANCE.getSaveDataForWorld(worldObj, ownerUdid).storedPower = energy;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBTWithoutCoords(NBTTagCompound tag)
|
public double getMaxPower() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxPower()
|
|
||||||
{
|
|
||||||
return 1000000000;
|
return 1000000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.INSANE;
|
||||||
return getFacingEnum() != direction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public float getChargeLevel() {
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return getFacingEnum() == direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return maxStorage;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.EXTREME;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getChargeLevel()
|
|
||||||
{
|
|
||||||
float ret = (float) this.getEnergy() / (float) this.maxStorage;
|
float ret = (float) this.getEnergy() / (float) this.maxStorage;
|
||||||
if (ret > 1.0F)
|
if (ret > 1.0F) {
|
||||||
{
|
|
||||||
ret = 1.0F;
|
ret = 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
public void readFromNBT(NBTTagCompound nbttagcompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(nbttagcompound);
|
super.readFromNBT(nbttagcompound);
|
||||||
this.ownerUdid = nbttagcompound.getString("ownerUdid");
|
this.ownerUdid = nbttagcompound.getString("ownerUdid");
|
||||||
}
|
}
|
||||||
|
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(nbttagcompound);
|
super.writeToNBT(nbttagcompound);
|
||||||
if (ownerUdid == null && StringUtils.isBlank(ownerUdid) || StringUtils.isEmpty(ownerUdid))
|
if (ownerUdid == null || StringUtils.isEmpty(ownerUdid)) {
|
||||||
{
|
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
}
|
}
|
||||||
nbttagcompound.setString("ownerUdid", this.ownerUdid);
|
nbttagcompound.setString("ownerUdid", this.ownerUdid);
|
||||||
return nbttagcompound;
|
return nbttagcompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
|
|
||||||
if (ticks == ConfigTechReborn.AverageEuOutTickTime) {
|
if (ticks == ConfigTechReborn.AverageEuOutTickTime) {
|
||||||
euChange = -1;
|
euChange = -1;
|
||||||
|
@ -145,38 +101,55 @@ public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
for(EnumFacing facing : EnumFacing.VALUES) {
|
||||||
|
double disposed = emitEnergy(facing, maxOutput);
|
||||||
|
if(disposed != 0) {
|
||||||
|
maxOutput -= disposed;
|
||||||
|
useEnergy(disposed);
|
||||||
|
if (maxOutput == 0) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
|
//TODO move to RebornCore
|
||||||
{
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
return receiver.receiveEnergy(amount, false);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean wrenchCanSetFacing(EntityPlayer p0, EnumFacing p1)
|
@Override
|
||||||
{
|
public boolean wrenchCanSetFacing(EntityPlayer p0, EnumFacing p1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public EnumFacing getFacing()
|
@Override
|
||||||
{
|
public EnumFacing getFacing() {
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean wrenchCanRemove(EntityPlayer p0)
|
@Override
|
||||||
{
|
public boolean wrenchCanRemove(EntityPlayer p0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public float getWrenchDropRate()
|
@Override
|
||||||
{
|
public float getWrenchDropRate() {
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
NBTTagCompound tileEntity = new NBTTagCompound();
|
NBTTagCompound tileEntity = new NBTTagCompound();
|
||||||
ItemStack dropStack = new ItemStack(ModBlocks.Idsu, 1);
|
ItemStack dropStack = new ItemStack(ModBlocks.Idsu, 1);
|
||||||
writeToNBT(tileEntity);
|
writeToNBT(tileEntity);
|
||||||
|
@ -185,40 +158,32 @@ public class TileIDSU extends TilePowerAcceptor implements IWrenchable
|
||||||
return dropStack;
|
return dropStack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEuChange()
|
public double getEuChange() {
|
||||||
{
|
if (euChange == -1) {
|
||||||
if (euChange == -1)
|
|
||||||
{
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (euChange / ticks);
|
return (euChange / ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleGuiInputFromClient(int id)
|
public void handleGuiInputFromClient(int id) {
|
||||||
{
|
if (id == 0) {
|
||||||
if (id == 0)
|
|
||||||
{
|
|
||||||
output += 256;
|
output += 256;
|
||||||
}
|
}
|
||||||
if (id == 1)
|
if (id == 1) {
|
||||||
{
|
|
||||||
output += 64;
|
output += 64;
|
||||||
}
|
}
|
||||||
if (id == 2)
|
if (id == 2) {
|
||||||
{
|
|
||||||
output -= 64;
|
output -= 64;
|
||||||
}
|
}
|
||||||
if (id == 3)
|
if (id == 3) {
|
||||||
{
|
|
||||||
output -= 256;
|
output -= 256;
|
||||||
}
|
}
|
||||||
if (output > 4096)
|
if (output > 4096) {
|
||||||
{
|
|
||||||
output = 4096;
|
output = 4096;
|
||||||
}
|
}
|
||||||
if (output <= -1)
|
if (output <= -1) {
|
||||||
{
|
|
||||||
output = 0;
|
output = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,15 +3,14 @@ package techreborn.tiles.lesu;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.config.ConfigTechReborn;
|
import techreborn.config.ConfigTechReborn;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class TileLesu extends TilePowerAcceptor
|
public class TileLesu extends TilePowerAcceptorProducer {// TODO wrench
|
||||||
{// TODO wrench
|
|
||||||
|
|
||||||
public int connectedBlocks = 0;
|
public int connectedBlocks = 0;
|
||||||
public Inventory inventory = new Inventory(2, "TileAesu", 64, this);
|
public Inventory inventory = new Inventory(2, "TileAesu", 64, this);
|
||||||
|
@ -22,14 +21,10 @@ public class TileLesu extends TilePowerAcceptor
|
||||||
private int output;
|
private int output;
|
||||||
private int maxStorage;
|
private int maxStorage;
|
||||||
|
|
||||||
public TileLesu()
|
|
||||||
{
|
|
||||||
super(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
super.updateEntity();
|
super.update();
|
||||||
if (worldObj.isRemote) {
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -77,53 +72,44 @@ public class TileLesu extends TilePowerAcceptor
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
for(EnumFacing facing : EnumFacing.VALUES) {
|
||||||
|
double disposed = emitEnergy(facing, maxOutput);
|
||||||
|
if(disposed != 0) {
|
||||||
|
maxOutput -= disposed;
|
||||||
|
useEnergy(disposed);
|
||||||
|
if (maxOutput == 0) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getEuChange()
|
//TODO move to RebornCore
|
||||||
{
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
if (euChange == -1)
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
{
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
return receiver.receiveEnergy(amount, false);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public double getEuChange() {
|
||||||
|
if (euChange == -1) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return (euChange / ticks);
|
return (euChange / ticks);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
|
||||||
return maxStorage;
|
return maxStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
return EnumPowerTier.INSANE;
|
||||||
return direction != getFacingEnum();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return direction == getFacingEnum();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 8192;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.EXTREME;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package techreborn.tiles.storage;
|
package techreborn.tiles.storage;
|
||||||
|
|
||||||
import reborncore.api.IListInfoProvider;
|
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by modmuss50 on 14/03/2016.
|
* Created by modmuss50 on 14/03/2016.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
package techreborn.tiles.storage;
|
package techreborn.tiles.storage;
|
||||||
|
|
||||||
import reborncore.api.IListInfoProvider;
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import reborncore.api.IListInfoProvider;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.power.IEnergyItemInfo;
|
import reborncore.api.power.IEnergyItemInfo;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
|
import reborncore.common.IWrenchable;
|
||||||
import reborncore.common.powerSystem.PoweredItem;
|
import reborncore.common.powerSystem.PoweredItem;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptorProducer;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.blocks.storage.BlockEnergyStorage;
|
import techreborn.blocks.storage.BlockEnergyStorage;
|
||||||
import techreborn.power.EnergyUtils;
|
import techreborn.power.EnergyUtils;
|
||||||
|
@ -21,7 +22,7 @@ import java.util.List;
|
||||||
/**
|
/**
|
||||||
* Created by Rushmead
|
* Created by Rushmead
|
||||||
*/
|
*/
|
||||||
public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable, ITickable, IInventoryProvider, IListInfoProvider {
|
public class TileEnergyStorage extends TilePowerAcceptorProducer implements IWrenchable, ITickable, IInventoryProvider, IListInfoProvider {
|
||||||
|
|
||||||
public Inventory inventory;
|
public Inventory inventory;
|
||||||
public String name;
|
public String name;
|
||||||
|
@ -32,7 +33,6 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
public int maxStorage;
|
public int maxStorage;
|
||||||
|
|
||||||
public TileEnergyStorage(String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
public TileEnergyStorage(String name, int invSize, Block wrenchDrop, EnumPowerTier tier, int maxInput, int maxOuput, int maxStorage) {
|
||||||
super(1);
|
|
||||||
inventory = new Inventory(invSize, "Tile" + name, 64, this);
|
inventory = new Inventory(invSize, "Tile" + name, 64, this);
|
||||||
this.wrenchDrop = wrenchDrop;
|
this.wrenchDrop = wrenchDrop;
|
||||||
this.tier = tier;
|
this.tier = tier;
|
||||||
|
@ -64,7 +64,8 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void update() {
|
||||||
|
super.update();
|
||||||
if (inventory.getStackInSlot(0) != null) {
|
if (inventory.getStackInSlot(0) != null) {
|
||||||
ItemStack stack = inventory.getStackInSlot(0);
|
ItemStack stack = inventory.getStackInSlot(0);
|
||||||
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
if (!(stack.getItem() instanceof IEnergyItemInfo)) {
|
||||||
|
@ -92,13 +93,33 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (!worldObj.isRemote && getEnergy() > 0) {
|
if (!worldObj.isRemote && getEnergy() > 0) {
|
||||||
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
double maxOutput = getEnergy() > getMaxOutput() ? getMaxOutput() : getEnergy();
|
||||||
useEnergy(EnergyUtils.dispatchEnergyToNeighbours(worldObj, getPos(), this, maxOutput));
|
for(EnumFacing facing : EnumFacing.VALUES) {
|
||||||
|
double disposed = emitEnergy(facing, maxOutput);
|
||||||
|
if(disposed != 0) {
|
||||||
|
maxOutput -= disposed;
|
||||||
|
useEnergy(disposed);
|
||||||
|
if (maxOutput == 0) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO move to RebornCore
|
||||||
|
public double emitEnergy(EnumFacing enumFacing, double amount) {
|
||||||
|
BlockPos pos = getPos().offset(enumFacing);
|
||||||
|
EnergyUtils.PowerNetReceiver receiver = EnergyUtils.getReceiver(
|
||||||
|
worldObj, enumFacing.getOpposite(), pos);
|
||||||
|
if(receiver != null) {
|
||||||
|
return receiver.receiveEnergy(amount, false);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFacing(EnumFacing enumFacing) {
|
public void setFacing(EnumFacing enumFacing) {
|
||||||
worldObj.setBlockState(pos, worldObj.getBlockState(pos).withProperty(BlockEnergyStorage.FACING, enumFacing));
|
worldObj.setBlockState(pos, worldObj.getBlockState(pos).withProperty(BlockEnergyStorage.FACING, enumFacing));
|
||||||
|
@ -119,12 +140,6 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
return maxStorage;
|
return maxStorage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canAcceptEnergy(EnumFacing direction) {
|
|
||||||
|
|
||||||
return getFacingEnum() != direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacingEnum() {
|
public EnumFacing getFacingEnum() {
|
||||||
Block block = worldObj.getBlockState(pos).getBlock();
|
Block block = worldObj.getBlockState(pos).getBlock();
|
||||||
|
@ -134,21 +149,6 @@ public class TileEnergyStorage extends TilePowerAcceptor implements IWrenchable,
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction) {
|
|
||||||
return getFacing() == direction;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput() {
|
|
||||||
return maxOutput;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput() {
|
|
||||||
return maxInput;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumPowerTier getTier() {
|
public EnumPowerTier getTier() {
|
||||||
return tier;
|
return tier;
|
||||||
|
|
|
@ -8,22 +8,19 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileCompressor extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, ISidedInventory
|
public class TileCompressor extends TilePowerAcceptor implements IWrenchable, IInventoryProvider, IRecipeCrafterProvider, ISidedInventory {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileCompressor", 64, this);
|
public Inventory inventory = new Inventory(6, "TileCompressor", 64, this);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int capacity = 1000;
|
public int capacity = 1000;
|
||||||
|
|
||||||
public TileCompressor()
|
public TileCompressor() {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
int[] inputs = new int[1];
|
int[] inputs = new int[1];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
int[] outputs = new int[1];
|
int[] outputs = new int[1];
|
||||||
|
@ -32,111 +29,74 @@ public class TileCompressor extends TilePowerAcceptor implements IWrenchable, II
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
crafter.updateEntity();
|
||||||
// upgrades.tick();
|
// upgrades.tick();
|
||||||
charge(3);
|
//charge(3); TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.Compressor, 1);
|
return new ItemStack(ModBlocks.Compressor, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{0, 1, 2} : new int[]{0, 1, 2};
|
||||||
return side == EnumFacing.DOWN ? new int[] { 0, 1, 2 } : new int[] { 0, 1, 2 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex == 2)
|
if (slotIndex == 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2;
|
return slotIndex == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package techreborn.tiles.teir1;
|
package techreborn.tiles.teir1;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
|
@ -9,99 +8,79 @@ import net.minecraft.item.crafting.FurnaceRecipes;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
|
import reborncore.common.IWrenchable;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory
|
public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileElectricFurnace", 64, this);
|
public Inventory inventory = new Inventory(6, "TileElectricFurnace", 64, this);
|
||||||
public int capacity = 1000;
|
|
||||||
public int progress;
|
public int progress;
|
||||||
public int fuelScale = 100;
|
public int fuelScale = 100;
|
||||||
public int cost = 8;
|
public int cost = 8;
|
||||||
int input1 = 0;
|
int input1 = 0;
|
||||||
int output = 1;
|
int output = 1;
|
||||||
private static final int[] SLOTS_TOP = new int[] {0};
|
private static final int[] SLOTS_TOP = new int[]{0};
|
||||||
private static final int[] SLOTS_BOTTOM = new int[] {1};
|
private static final int[] SLOTS_BOTTOM = new int[]{1};
|
||||||
private static final int[] SLOTS_SIDES = new int[] {1};
|
private static final int[] SLOTS_SIDES = new int[]{1};
|
||||||
|
|
||||||
public TileElectricFurnace()
|
public int gaugeProgressScaled(int scale) {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int gaugeProgressScaled(int scale)
|
|
||||||
{
|
|
||||||
return (progress * scale) / fuelScale;
|
return (progress * scale) / fuelScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
|
//charge(3); TODO
|
||||||
boolean burning = isBurning();
|
boolean burning = isBurning();
|
||||||
boolean updateInventory = false;
|
boolean updateInventory = false;
|
||||||
if (isBurning() && canSmelt())
|
if (isBurning() && canSmelt()) {
|
||||||
{
|
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
progress++;
|
progress++;
|
||||||
if(progress % 10 == 0){
|
if (progress % 10 == 0) {
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
}
|
}
|
||||||
if (progress >= fuelScale)
|
if (progress >= fuelScale) {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
cookItems();
|
cookItems();
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
if (burning != isBurning())
|
if (burning != isBurning()) {
|
||||||
{
|
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
if (updateInventory)
|
if (updateInventory) {
|
||||||
{
|
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cookItems()
|
public void cookItems() {
|
||||||
{
|
if (this.canSmelt()) {
|
||||||
if (this.canSmelt())
|
|
||||||
{
|
|
||||||
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
||||||
|
|
||||||
if (getStackInSlot(output) == null)
|
if (getStackInSlot(output) == null) {
|
||||||
{
|
|
||||||
setInventorySlotContents(output, itemstack.copy());
|
setInventorySlotContents(output, itemstack.copy());
|
||||||
} else if (getStackInSlot(output).isItemEqual(itemstack))
|
} else if (getStackInSlot(output).isItemEqual(itemstack)) {
|
||||||
{
|
|
||||||
getStackInSlot(output).stackSize += itemstack.stackSize;
|
getStackInSlot(output).stackSize += itemstack.stackSize;
|
||||||
}
|
}
|
||||||
if (getStackInSlot(input1).stackSize > 1)
|
if (getStackInSlot(input1).stackSize > 1) {
|
||||||
{
|
|
||||||
this.decrStackSize(input1, 1);
|
this.decrStackSize(input1, 1);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
setInventorySlotContents(input1, null);
|
setInventorySlotContents(input1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canSmelt()
|
public boolean canSmelt() {
|
||||||
{
|
if (getStackInSlot(input1) == null) {
|
||||||
if (getStackInSlot(input1) == null)
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
ItemStack itemstack = FurnaceRecipes.instance().getSmeltingResult(getStackInSlot(input1));
|
||||||
if (itemstack == null)
|
if (itemstack == null)
|
||||||
return false;
|
return false;
|
||||||
|
@ -114,26 +93,21 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBurning()
|
public boolean isBurning() {
|
||||||
{
|
|
||||||
return getEnergy() > cost;
|
return getEnergy() > cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemStack getResultFor(ItemStack stack)
|
public ItemStack getResultFor(ItemStack stack) {
|
||||||
{
|
|
||||||
ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
|
ItemStack result = FurnaceRecipes.instance().getSmeltingResult(stack);
|
||||||
if (result != null)
|
if (result != null) {
|
||||||
{
|
|
||||||
return result.copy();
|
return result.copy();
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateState()
|
public void updateState() {
|
||||||
{
|
|
||||||
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
||||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase)
|
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||||
{
|
|
||||||
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != progress > 0)
|
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != progress > 0)
|
||||||
blockMachineBase.setActive(progress > 0, worldObj, pos);
|
blockMachineBase.setActive(progress > 0, worldObj, pos);
|
||||||
|
@ -141,94 +115,59 @@ public class TileElectricFurnace extends TilePowerAcceptor implements IWrenchabl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.ElectricFurnace, 1);
|
return new ItemStack(ModBlocks.ElectricFurnace, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
|
||||||
return side == EnumFacing.DOWN ? SLOTS_BOTTOM : (side == EnumFacing.UP ? SLOTS_TOP : SLOTS_SIDES);
|
return side == EnumFacing.DOWN ? SLOTS_BOTTOM : (side == EnumFacing.UP ? SLOTS_TOP : SLOTS_SIDES);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex == 2)
|
if (slotIndex == 2)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == 2;
|
return slotIndex == 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
return 16000;
|
||||||
return capacity;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
package techreborn.tiles.teir1;
|
package techreborn.tiles.teir1;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import reborncore.common.container.RebornContainer;
|
|
||||||
import reborncore.common.IWrenchable;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -12,24 +8,22 @@ import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.recipe.IRecipeCrafterProvider;
|
import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IContainerProvider;
|
import reborncore.api.tile.IContainerProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.IWrenchable;
|
||||||
|
import reborncore.common.container.RebornContainer;
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.client.container.ContainerExtractor;
|
import techreborn.client.container.ContainerExtractor;
|
||||||
import techreborn.client.container.ContainerGrinder;
|
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, IRecipeCrafterProvider, IContainerProvider
|
public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileExtractor", 64, this);
|
public Inventory inventory = new Inventory(6, "TileExtractor", 64, this);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int capacity = 1000;
|
public int capacity = 1000;
|
||||||
|
|
||||||
public TileExtractor()
|
public TileExtractor() {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
int[] inputs = new int[1];
|
int[] inputs = new int[1];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
int[] outputs = new int[1];
|
int[] outputs = new int[1];
|
||||||
|
@ -38,106 +32,68 @@ public class TileExtractor extends TilePowerAcceptor implements IWrenchable,IInv
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void updateEntity() {
|
||||||
{
|
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
// upgrades.tick();
|
// upgrades.tick();
|
||||||
charge(3);
|
//charge(3); TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.Extractor, 1);
|
return new ItemStack(ModBlocks.Extractor, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
crafter.readFromNBT(tagCompound);
|
crafter.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public EnumPowerTier getTier() {
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package techreborn.tiles.teir1;
|
||||||
|
|
||||||
import reborncore.common.IWrenchable;
|
import reborncore.common.IWrenchable;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
@ -12,27 +11,21 @@ import reborncore.api.recipe.IRecipeCrafterProvider;
|
||||||
import reborncore.api.tile.IContainerProvider;
|
import reborncore.api.tile.IContainerProvider;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.container.RebornContainer;
|
import reborncore.common.container.RebornContainer;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
|
||||||
import reborncore.common.recipes.RecipeCrafter;
|
import reborncore.common.recipes.RecipeCrafter;
|
||||||
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.api.Reference;
|
import techreborn.api.Reference;
|
||||||
import techreborn.client.container.ContainerCentrifuge;
|
|
||||||
import techreborn.client.container.ContainerGrinder;
|
import techreborn.client.container.ContainerGrinder;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class TileGrinder extends TilePowerAcceptor implements IWrenchable,IInventoryProvider,
|
public class TileGrinder extends TilePowerAcceptor implements IWrenchable,IInventoryProvider,
|
||||||
IListInfoProvider, IRecipeCrafterProvider, IContainerProvider
|
IListInfoProvider, IRecipeCrafterProvider, IContainerProvider {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
public Inventory inventory = new Inventory(6, "TileGrinder", 64, this);
|
||||||
public RecipeCrafter crafter;
|
public RecipeCrafter crafter;
|
||||||
public int capacity = 1000;
|
public int capacity = 1000;
|
||||||
|
|
||||||
public TileGrinder()
|
public TileGrinder() {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
int[] inputs = new int[1];
|
int[] inputs = new int[1];
|
||||||
inputs[0] = 0;
|
inputs[0] = 0;
|
||||||
int[] outputs = new int[1];
|
int[] outputs = new int[1];
|
||||||
|
@ -41,114 +34,72 @@ public class TileGrinder extends TilePowerAcceptor implements IWrenchable,IInven
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
super.updateEntity();
|
|
||||||
crafter.updateEntity();
|
crafter.updateEntity();
|
||||||
charge(3);
|
//charge(3); TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.Grinder, 1);
|
return new ItemStack(ModBlocks.Grinder, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tagCompound)
|
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.readFromNBT(tagCompound);
|
super.readFromNBT(tagCompound);
|
||||||
inventory.readFromNBT(tagCompound);
|
inventory.readFromNBT(tagCompound);
|
||||||
crafter.readFromNBT(tagCompound);
|
crafter.readFromNBT(tagCompound);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound)
|
public NBTTagCompound writeToNBT(NBTTagCompound tagCompound) {
|
||||||
{
|
|
||||||
super.writeToNBT(tagCompound);
|
super.writeToNBT(tagCompound);
|
||||||
crafter.writeToNBT(tagCompound);
|
crafter.writeToNBT(tagCompound);
|
||||||
return tagCompound;
|
return tagCompound;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getProgressScaled(int scale)
|
public int getProgressScaled(int scale) {
|
||||||
{
|
if (crafter.currentTickTime != 0) {
|
||||||
if (crafter.currentTickTime != 0)
|
|
||||||
{
|
|
||||||
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
return crafter.currentTickTime * scale / crafter.currentNeededTicks;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.LOW;
|
return EnumPowerTier.LOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void addInfo(List<String> info, boolean isRealTile)
|
|
||||||
{
|
|
||||||
info.add("Macerator");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Inventory getInventory() {
|
public Inventory getInventory() {
|
||||||
return inventory;
|
return inventory;
|
||||||
|
|
|
@ -9,13 +9,12 @@ import net.minecraft.util.EnumFacing;
|
||||||
import reborncore.api.power.EnumPowerTier;
|
import reborncore.api.power.EnumPowerTier;
|
||||||
import reborncore.api.tile.IInventoryProvider;
|
import reborncore.api.tile.IInventoryProvider;
|
||||||
import reborncore.common.blocks.BlockMachineBase;
|
import reborncore.common.blocks.BlockMachineBase;
|
||||||
import reborncore.common.powerSystem.TilePowerAcceptor;
|
import reborncore.common.tile.TilePowerAcceptor;
|
||||||
import reborncore.common.util.Inventory;
|
import reborncore.common.util.Inventory;
|
||||||
import techreborn.init.ModBlocks;
|
import techreborn.init.ModBlocks;
|
||||||
import techreborn.items.ItemParts;
|
import techreborn.items.ItemParts;
|
||||||
|
|
||||||
public class TileRecycler extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory
|
public class TileRecycler extends TilePowerAcceptor implements IWrenchable,IInventoryProvider, ISidedInventory {
|
||||||
{
|
|
||||||
|
|
||||||
public Inventory inventory = new Inventory(6, "TileRecycler", 64, this);
|
public Inventory inventory = new Inventory(6, "TileRecycler", 64, this);
|
||||||
public int capacity = 1000;
|
public int capacity = 1000;
|
||||||
|
@ -27,118 +26,91 @@ public class TileRecycler extends TilePowerAcceptor implements IWrenchable,IInve
|
||||||
public int input1 = 0;
|
public int input1 = 0;
|
||||||
public int output = 1;
|
public int output = 1;
|
||||||
|
|
||||||
public TileRecycler()
|
public int gaugeProgressScaled(int scale) {
|
||||||
{
|
|
||||||
super(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int gaugeProgressScaled(int scale)
|
|
||||||
{
|
|
||||||
return (progress * scale) / time;
|
return (progress * scale) / time;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity()
|
public void update() {
|
||||||
{
|
super.update();
|
||||||
if(worldObj.isRemote){
|
//charge(3); TODO
|
||||||
|
if (worldObj.isRemote) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean burning = isBurning();
|
boolean burning = isBurning();
|
||||||
boolean updateInventory = false;
|
boolean updateInventory = false;
|
||||||
if (getEnergy() <= cost && canRecycle())
|
if (getEnergy() <= cost && canRecycle()) {
|
||||||
{
|
if (getEnergy() > cost) {
|
||||||
if (getEnergy() > cost)
|
|
||||||
{
|
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isBurning() && canRecycle())
|
if (isBurning() && canRecycle()) {
|
||||||
{
|
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
progress++;
|
progress++;
|
||||||
if (progress >= time)
|
if (progress >= time) {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
recycleItems();
|
recycleItems();
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
progress = 0;
|
progress = 0;
|
||||||
updateState();
|
updateState();
|
||||||
}
|
}
|
||||||
if (burning != isBurning())
|
if (burning != isBurning()) {
|
||||||
{
|
|
||||||
updateInventory = true;
|
updateInventory = true;
|
||||||
}
|
}
|
||||||
if (updateInventory)
|
if (updateInventory) {
|
||||||
{
|
|
||||||
markDirty();
|
markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recycleItems()
|
public void recycleItems() {
|
||||||
{
|
if (this.canRecycle()) {
|
||||||
if (this.canRecycle())
|
|
||||||
{
|
|
||||||
ItemStack itemstack = ItemParts.getPartByName("scrap");
|
ItemStack itemstack = ItemParts.getPartByName("scrap");
|
||||||
int randomchance = worldObj.rand.nextInt(chance);
|
int randomchance = worldObj.rand.nextInt(chance);
|
||||||
|
|
||||||
if (getStackInSlot(output) == null)
|
if (getStackInSlot(output) == null) {
|
||||||
{
|
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
if (randomchance == 1)
|
if (randomchance == 1) {
|
||||||
{
|
|
||||||
setInventorySlotContents(output, itemstack.copy());
|
setInventorySlotContents(output, itemstack.copy());
|
||||||
}
|
}
|
||||||
} else if (getStackInSlot(output).isItemEqual(itemstack))
|
} else if (getStackInSlot(output).isItemEqual(itemstack)) {
|
||||||
{
|
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
if (randomchance == 1)
|
if (randomchance == 1) {
|
||||||
{
|
|
||||||
getStackInSlot(output).stackSize += itemstack.stackSize;
|
getStackInSlot(output).stackSize += itemstack.stackSize;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (getStackInSlot(input1).stackSize > 1)
|
if (getStackInSlot(input1).stackSize > 1) {
|
||||||
{
|
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
this.decrStackSize(input1, 1);
|
this.decrStackSize(input1, 1);
|
||||||
} else
|
} else {
|
||||||
{
|
|
||||||
useEnergy(cost);
|
useEnergy(cost);
|
||||||
setInventorySlotContents(input1, null);
|
setInventorySlotContents(input1, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canRecycle()
|
public boolean canRecycle() {
|
||||||
{
|
|
||||||
return getStackInSlot(input1) != null && hasSlotGotSpace(output);
|
return getStackInSlot(input1) != null && hasSlotGotSpace(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSlotGotSpace(int slot)
|
public boolean hasSlotGotSpace(int slot) {
|
||||||
{
|
if (getStackInSlot(slot) == null) {
|
||||||
if (getStackInSlot(slot) == null)
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
} else if (getStackInSlot(slot).stackSize < getStackInSlot(slot).getMaxStackSize())
|
} else if (getStackInSlot(slot).stackSize < getStackInSlot(slot).getMaxStackSize()) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBurning()
|
public boolean isBurning() {
|
||||||
{
|
|
||||||
return getEnergy() > cost;
|
return getEnergy() > cost;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateState()
|
public void updateState() {
|
||||||
{
|
|
||||||
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
IBlockState BlockStateContainer = worldObj.getBlockState(pos);
|
||||||
if (BlockStateContainer.getBlock() instanceof BlockMachineBase)
|
if (BlockStateContainer.getBlock() instanceof BlockMachineBase) {
|
||||||
{
|
|
||||||
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
BlockMachineBase blockMachineBase = (BlockMachineBase) BlockStateContainer.getBlock();
|
||||||
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != progress > 0)
|
if (BlockStateContainer.getValue(BlockMachineBase.ACTIVE) != progress > 0)
|
||||||
blockMachineBase.setActive(progress > 0, worldObj, pos);
|
blockMachineBase.setActive(progress > 0, worldObj, pos);
|
||||||
|
@ -146,94 +118,59 @@ public class TileRecycler extends TilePowerAcceptor implements IWrenchable,IInve
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side)
|
public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, EnumFacing side) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumFacing getFacing()
|
public EnumFacing getFacing() {
|
||||||
{
|
|
||||||
return getFacingEnum();
|
return getFacingEnum();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean wrenchCanRemove(EntityPlayer entityPlayer)
|
public boolean wrenchCanRemove(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return entityPlayer.isSneaking();
|
return entityPlayer.isSneaking();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getWrenchDropRate()
|
public float getWrenchDropRate() {
|
||||||
{
|
|
||||||
return 1.0F;
|
return 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getWrenchDrop(EntityPlayer entityPlayer)
|
public ItemStack getWrenchDrop(EntityPlayer entityPlayer) {
|
||||||
{
|
|
||||||
return new ItemStack(ModBlocks.recycler, 1);
|
return new ItemStack(ModBlocks.recycler, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isComplete()
|
public boolean isComplete() {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISidedInventory
|
// ISidedInventory
|
||||||
@Override
|
@Override
|
||||||
public int[] getSlotsForFace(EnumFacing side)
|
public int[] getSlotsForFace(EnumFacing side) {
|
||||||
{
|
return side == EnumFacing.DOWN ? new int[]{output} : new int[]{input1};
|
||||||
return side == EnumFacing.DOWN ? new int[] { output } : new int[] { input1 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canInsertItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
if (slotIndex == output)
|
if (slotIndex == output)
|
||||||
return false;
|
return false;
|
||||||
return isItemValidForSlot(slotIndex, itemStack);
|
return isItemValidForSlot(slotIndex, itemStack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side)
|
public boolean canExtractItem(int slotIndex, ItemStack itemStack, EnumFacing side) {
|
||||||
{
|
|
||||||
return slotIndex == output;
|
return slotIndex == output;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double getMaxPower()
|
public double getMaxPower() {
|
||||||
{
|
|
||||||
return capacity;
|
return capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canAcceptEnergy(EnumFacing direction)
|
public EnumPowerTier getTier() {
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean canProvideEnergy(EnumFacing direction)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxOutput()
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public double getMaxInput()
|
|
||||||
{
|
|
||||||
return 32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public EnumPowerTier getTier()
|
|
||||||
{
|
|
||||||
return EnumPowerTier.MEDIUM;
|
return EnumPowerTier.MEDIUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,11 @@ import techreborn.blocks.transformers.BlockTransformer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Rushmead
|
* Created by Rushmead
|
||||||
|
*
|
||||||
|
* @deprecated ? If wires limited to transfer rate and doesn't burn out, what's use of the transformers?
|
||||||
|
* TODO: Rewrite, find use or remove
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class TileTransformer extends TilePowerAcceptor implements IWrenchable, ITickable
|
public class TileTransformer extends TilePowerAcceptor implements IWrenchable, ITickable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -4,16 +4,16 @@
|
||||||
"transform":"forge:default-block",
|
"transform":"forge:default-block",
|
||||||
"model":"orientable",
|
"model":"orientable",
|
||||||
"textures":{
|
"textures":{
|
||||||
"particle":"techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_off",
|
"particle":"techreborn:blocks/machine/advanced_machines/advanced_machine_side",
|
||||||
"top":"techreborn:blocks/machine/advanced_machines/machine_top",
|
"top":"techreborn:blocks/machine/advanced_machines/machine_top",
|
||||||
"side":"techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_off"
|
"side":"techreborn:blocks/machine/advanced_machines/advanced_machine_side"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variants":{
|
"variants":{
|
||||||
"inventory":{
|
"inventory":{
|
||||||
"transform":"forge:default-block",
|
"transform":"forge:default-block",
|
||||||
"textures":{
|
"textures":{
|
||||||
"front":"techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_off"
|
"front":"techreborn:blocks/machine/advanced_machines/advanced_machine_side"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"facing":{
|
"facing":{
|
||||||
|
@ -33,22 +33,22 @@
|
||||||
"active":{
|
"active":{
|
||||||
"true":{
|
"true":{
|
||||||
"textures":{
|
"textures":{
|
||||||
"front":"techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_on"
|
"front":"techreborn:blocks/machine/advanced_machines/advanced_machine_side"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"false":{
|
"false":{
|
||||||
"textures":{
|
"textures":{
|
||||||
"front":"techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_off"
|
"front":"techreborn:blocks/machine/advanced_machines/advanced_machine_side"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"inventory": {
|
"inventory": {
|
||||||
"model": "orientable",
|
"model": "orientable",
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_off",
|
"particle": "techreborn:blocks/machine/advanced_machines/advanced_machine_side",
|
||||||
"top": "techreborn:blocks/machine/advanced_machines/machine_top",
|
"top": "techreborn:blocks/machine/advanced_machines/machine_top",
|
||||||
"side": "techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_off",
|
"side": "techreborn:blocks/machine/advanced_machines/advanced_machine_side",
|
||||||
"front": "techreborn:blocks/machine/advanced_machines/industrial_electrolyzer_front_off"
|
"front": "techreborn:blocks/machine/advanced_machines/advanced_machine_side"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
"model":"orientable",
|
"model":"orientable",
|
||||||
"textures":{
|
"textures":{
|
||||||
"particle": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
"particle": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
||||||
"top": "techreborn:blocks/machine/generators/lightning_rod_top",
|
"top": "techreborn:blocks/machine/generators/gas_generator_top",
|
||||||
"side": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
"side": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
||||||
"down":"techreborn:blocks/machine/generators/lightning_rod_side_off",
|
"down":"techreborn:blocks/machine/generators/lightning_rod_side_off",
|
||||||
"front":"techreborn:blocks/machine/generators/plasma_generator_front"
|
"front":"techreborn:blocks/machine/generators/plasma_generator_front"
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
"model": "orientable",
|
"model": "orientable",
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
"particle": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
||||||
"top": "techreborn:blocks/machine/generators/lightning_rod_top",
|
"top": "techreborn:blocks/machine/generators/gas_generator_top",
|
||||||
"side": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
"side": "techreborn:blocks/machine/generators/lightning_rod_side_off",
|
||||||
"down":"techreborn:blocks/machine/generators/lightning_rod_side_off",
|
"down":"techreborn:blocks/machine/generators/lightning_rod_side_off",
|
||||||
"front":"techreborn:blocks/machine/generators/plasma_generator_front"
|
"front":"techreborn:blocks/machine/generators/plasma_generator_front"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "techreborn:item/techrebornItem",
|
"parent": "techreborn:item/techrebornItem",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "techreborn:items/tool/energyCrystalEmpty"
|
"layer0": "techreborn:items/tool/energyCrystal"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "techreborn:item/techrebornItem",
|
"parent": "techreborn:item/techrebornItem",
|
||||||
"textures": {
|
"textures": {
|
||||||
"layer0": "techreborn:items/tool/lapotronCrystalEmpty"
|
"layer0": "techreborn:items/tool/lapotronCrystal"
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
After Width: | Height: | Size: 238 B |
Loading…
Add table
Add a link
Reference in a new issue