Fix #4 Tile Entity Load Error
This commit is contained in:
parent
c18300a664
commit
fb61becf91
17 changed files with 324 additions and 235 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package com.oitsjustjose.criss_cross;
|
package com.oitsjustjose.criss_cross;
|
||||||
|
|
||||||
|
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
||||||
import com.oitsjustjose.criss_cross.lib.Config;
|
import com.oitsjustjose.criss_cross.lib.Config;
|
||||||
import com.oitsjustjose.criss_cross.lib.CreativeTab;
|
import com.oitsjustjose.criss_cross.lib.CreativeTab;
|
||||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||||
|
|
@ -19,8 +20,9 @@ import net.minecraftforge.fml.common.Mod.Instance;
|
||||||
import net.minecraftforge.fml.common.SidedProxy;
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
@Mod(modid = Lib.MODID, name = Lib.NAME, version = Lib.VERSION, guiFactory = Lib.GUI_FACTORY, acceptedMinecraftVersions = "1.8.8, 1.8.9")
|
@Mod(modid = Lib.MODID, name = Lib.NAME, version = Lib.VERSION, guiFactory = Lib.GUI_FACTORY, acceptedMinecraftVersions = "1.8.9")
|
||||||
public class CrissCross
|
public class CrissCross
|
||||||
{
|
{
|
||||||
public static CreativeTabs CCTab = new CreativeTab();
|
public static CreativeTabs CCTab = new CreativeTab();
|
||||||
|
|
@ -41,6 +43,8 @@ public class CrissCross
|
||||||
LibBlocks.init();
|
LibBlocks.init();
|
||||||
LibItems.init();
|
LibItems.init();
|
||||||
CraftingRecipes.init();
|
CraftingRecipes.init();
|
||||||
|
|
||||||
|
NetworkRegistry.INSTANCE.registerGuiHandler(this, new GUIHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class ContainerCobblegen extends Container
|
||||||
this.cobblegen.fuelTime = timeType2;
|
this.cobblegen.fuelTime = timeType2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.cobblegen.fuelUsetime = timeType2;
|
this.cobblegen.currentFuelBuffer = timeType2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ public class ContainerCobblegen extends Container
|
||||||
super.onCraftGuiOpened(crafting);
|
super.onCraftGuiOpened(crafting);
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.cobblegen.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.cobblegen.fuelTime);
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.cobblegen.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.cobblegen.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -74,12 +74,12 @@ public class ContainerCobblegen extends Container
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.cobblegen.processTime);
|
||||||
if (this.lastChopTime != this.cobblegen.fuelTime)
|
if (this.lastChopTime != this.cobblegen.fuelTime)
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.cobblegen.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.cobblegen.fuelTime);
|
||||||
if (this.lastFuelTime != this.cobblegen.fuelUsetime)
|
if (this.lastFuelTime != this.cobblegen.currentFuelBuffer)
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.cobblegen.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.cobblegen.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
this.lastUseTime = this.cobblegen.processTime;
|
this.lastUseTime = this.cobblegen.processTime;
|
||||||
this.lastChopTime = this.cobblegen.fuelTime;
|
this.lastChopTime = this.cobblegen.fuelTime;
|
||||||
this.lastFuelTime = this.cobblegen.fuelUsetime;
|
this.lastFuelTime = this.cobblegen.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -43,10 +43,10 @@ public class ContainerCropomator extends Container
|
||||||
this.cropomator.processTime = timeType2;
|
this.cropomator.processTime = timeType2;
|
||||||
|
|
||||||
if (timeType1 == 1)
|
if (timeType1 == 1)
|
||||||
this.cropomator.catalystTime = timeType2;
|
this.cropomator.fuelTime = timeType2;
|
||||||
|
|
||||||
if (timeType1 == 2)
|
if (timeType1 == 2)
|
||||||
this.cropomator.catalystInUseTime = timeType2;
|
this.cropomator.currentFuelBuffer = timeType2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -54,8 +54,8 @@ public class ContainerCropomator extends Container
|
||||||
{
|
{
|
||||||
super.onCraftGuiOpened(crafting);
|
super.onCraftGuiOpened(crafting);
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime);
|
crafting.sendProgressBarUpdate(this, 1, this.cropomator.fuelTime);
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime);
|
crafting.sendProgressBarUpdate(this, 2, this.cropomator.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -68,14 +68,14 @@ public class ContainerCropomator extends Container
|
||||||
|
|
||||||
if (this.lastUseTime != this.cropomator.processTime)
|
if (this.lastUseTime != this.cropomator.processTime)
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.cropomator.processTime);
|
||||||
if (this.lastProcessTime != this.cropomator.catalystTime)
|
if (this.lastProcessTime != this.cropomator.fuelTime)
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.cropomator.catalystTime);
|
crafting.sendProgressBarUpdate(this, 1, this.cropomator.fuelTime);
|
||||||
if (this.lastCatalystInUseTime != this.cropomator.catalystInUseTime)
|
if (this.lastCatalystInUseTime != this.cropomator.currentFuelBuffer)
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.cropomator.catalystInUseTime);
|
crafting.sendProgressBarUpdate(this, 2, this.cropomator.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
this.lastUseTime = this.cropomator.processTime;
|
this.lastUseTime = this.cropomator.processTime;
|
||||||
this.lastProcessTime = this.cropomator.catalystTime;
|
this.lastProcessTime = this.cropomator.fuelTime;
|
||||||
this.lastCatalystInUseTime = this.cropomator.catalystInUseTime;
|
this.lastCatalystInUseTime = this.cropomator.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -40,22 +40,22 @@ public class ContainerElectroextractor extends Container
|
||||||
public void updateProgressBar(int timeType1, int timeType2)
|
public void updateProgressBar(int timeType1, int timeType2)
|
||||||
{
|
{
|
||||||
if (timeType1 == 0)
|
if (timeType1 == 0)
|
||||||
this.electroextractor.crushTime = timeType2;
|
this.electroextractor.processTime = timeType2;
|
||||||
|
|
||||||
if (timeType1 == 1)
|
if (timeType1 == 1)
|
||||||
this.electroextractor.fuelTime = timeType2;
|
this.electroextractor.fuelTime = timeType2;
|
||||||
|
|
||||||
if (timeType1 == 2)
|
if (timeType1 == 2)
|
||||||
this.electroextractor.fuelInUseTime = timeType2;
|
this.electroextractor.currentFuelBuffer = timeType2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCraftGuiOpened(ICrafting crafting)
|
public void onCraftGuiOpened(ICrafting crafting)
|
||||||
{
|
{
|
||||||
super.onCraftGuiOpened(crafting);
|
super.onCraftGuiOpened(crafting);
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime);
|
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.processTime);
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime);
|
crafting.sendProgressBarUpdate(this, 2, this.electroextractor.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -66,16 +66,16 @@ public class ContainerElectroextractor extends Container
|
||||||
{
|
{
|
||||||
ICrafting crafting = this.crafters.get(i);
|
ICrafting crafting = this.crafters.get(i);
|
||||||
|
|
||||||
if (this.lastUseTime != this.electroextractor.crushTime)
|
if (this.lastUseTime != this.electroextractor.processTime)
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.crushTime);
|
crafting.sendProgressBarUpdate(this, 0, this.electroextractor.processTime);
|
||||||
if (this.lastCrushTime != this.electroextractor.fuelTime)
|
if (this.lastCrushTime != this.electroextractor.fuelTime)
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.electroextractor.fuelTime);
|
||||||
if (this.lastFuelTime != this.electroextractor.fuelInUseTime)
|
if (this.lastFuelTime != this.electroextractor.currentFuelBuffer)
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.electroextractor.fuelInUseTime);
|
crafting.sendProgressBarUpdate(this, 2, this.electroextractor.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
this.lastUseTime = this.electroextractor.crushTime;
|
this.lastUseTime = this.electroextractor.processTime;
|
||||||
this.lastCrushTime = this.electroextractor.fuelTime;
|
this.lastCrushTime = this.electroextractor.fuelTime;
|
||||||
this.lastFuelTime = this.electroextractor.fuelInUseTime;
|
this.lastFuelTime = this.electroextractor.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -42,13 +42,13 @@ public class ContainerScribe extends Container
|
||||||
switch (timeType1)
|
switch (timeType1)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
this.scribe.writingTime = timeType2;
|
this.scribe.processTime = timeType2;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.scribe.fuelTime = timeType2;
|
this.scribe.fuelTime = timeType2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.scribe.fuelUsetime = timeType2;
|
this.scribe.currentFuelBuffer = timeType2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -57,9 +57,9 @@ public class ContainerScribe extends Container
|
||||||
public void onCraftGuiOpened(ICrafting crafting)
|
public void onCraftGuiOpened(ICrafting crafting)
|
||||||
{
|
{
|
||||||
super.onCraftGuiOpened(crafting);
|
super.onCraftGuiOpened(crafting);
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.scribe.writingTime);
|
crafting.sendProgressBarUpdate(this, 0, this.scribe.processTime);
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.scribe.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -70,16 +70,16 @@ public class ContainerScribe extends Container
|
||||||
{
|
{
|
||||||
ICrafting crafting = this.crafters.get(i);
|
ICrafting crafting = this.crafters.get(i);
|
||||||
|
|
||||||
if (this.lastUseTime != this.scribe.writingTime)
|
if (this.lastUseTime != this.scribe.processTime)
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.scribe.writingTime);
|
crafting.sendProgressBarUpdate(this, 0, this.scribe.processTime);
|
||||||
if (this.lastChopTime != this.scribe.fuelTime)
|
if (this.lastChopTime != this.scribe.fuelTime)
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.scribe.fuelTime);
|
||||||
if (this.lastFuelTime != this.scribe.fuelUsetime)
|
if (this.lastFuelTime != this.scribe.currentFuelBuffer)
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.scribe.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.scribe.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
this.lastUseTime = this.scribe.writingTime;
|
this.lastUseTime = this.scribe.processTime;
|
||||||
this.lastChopTime = this.scribe.fuelTime;
|
this.lastChopTime = this.scribe.fuelTime;
|
||||||
this.lastFuelTime = this.scribe.fuelUsetime;
|
this.lastFuelTime = this.scribe.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class ContainerStonegen extends Container
|
||||||
this.Stonegen.fuelTime = timeType2;
|
this.Stonegen.fuelTime = timeType2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.Stonegen.fuelUsetime = timeType2;
|
this.Stonegen.currentFuelBuffer = timeType2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ public class ContainerStonegen extends Container
|
||||||
super.onCraftGuiOpened(crafting);
|
super.onCraftGuiOpened(crafting);
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.Stonegen.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.Stonegen.fuelTime);
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.Stonegen.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.Stonegen.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -74,12 +74,12 @@ public class ContainerStonegen extends Container
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.Stonegen.processTime);
|
||||||
if (this.lastChopTime != this.Stonegen.fuelTime)
|
if (this.lastChopTime != this.Stonegen.fuelTime)
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.Stonegen.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.Stonegen.fuelTime);
|
||||||
if (this.lastFuelTime != this.Stonegen.fuelUsetime)
|
if (this.lastFuelTime != this.Stonegen.currentFuelBuffer)
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.Stonegen.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.Stonegen.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
this.lastUseTime = this.Stonegen.processTime;
|
this.lastUseTime = this.Stonegen.processTime;
|
||||||
this.lastChopTime = this.Stonegen.fuelTime;
|
this.lastChopTime = this.Stonegen.fuelTime;
|
||||||
this.lastFuelTime = this.Stonegen.fuelUsetime;
|
this.lastFuelTime = this.Stonegen.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ public class ContainerWoodchipper extends Container
|
||||||
this.woodchipper.fuelTime = timeType2;
|
this.woodchipper.fuelTime = timeType2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.woodchipper.fuelUsetime = timeType2;
|
this.woodchipper.currentFuelBuffer = timeType2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -59,7 +59,7 @@ public class ContainerWoodchipper extends Container
|
||||||
super.onCraftGuiOpened(crafting);
|
super.onCraftGuiOpened(crafting);
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.woodchipper.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -74,12 +74,12 @@ public class ContainerWoodchipper extends Container
|
||||||
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
|
crafting.sendProgressBarUpdate(this, 0, this.woodchipper.processTime);
|
||||||
if (this.lastChopTime != this.woodchipper.fuelTime)
|
if (this.lastChopTime != this.woodchipper.fuelTime)
|
||||||
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
|
crafting.sendProgressBarUpdate(this, 1, this.woodchipper.fuelTime);
|
||||||
if (this.lastFuelTime != this.woodchipper.fuelUsetime)
|
if (this.lastFuelTime != this.woodchipper.currentFuelBuffer)
|
||||||
crafting.sendProgressBarUpdate(this, 2, this.woodchipper.fuelUsetime);
|
crafting.sendProgressBarUpdate(this, 2, this.woodchipper.currentFuelBuffer);
|
||||||
}
|
}
|
||||||
this.lastUseTime = this.woodchipper.processTime;
|
this.lastUseTime = this.woodchipper.processTime;
|
||||||
this.lastChopTime = this.woodchipper.fuelTime;
|
this.lastChopTime = this.woodchipper.fuelTime;
|
||||||
this.lastFuelTime = this.woodchipper.fuelUsetime;
|
this.lastFuelTime = this.woodchipper.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes;
|
import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes;
|
||||||
|
|
||||||
import mezz.jei.util.StackUtil;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class ScribeRecipeMaker
|
public class ScribeRecipeMaker
|
||||||
|
|
@ -26,7 +25,7 @@ public class ScribeRecipeMaker
|
||||||
ItemStack input = entry.getKey();
|
ItemStack input = entry.getKey();
|
||||||
ItemStack output = entry.getValue();
|
ItemStack output = entry.getValue();
|
||||||
|
|
||||||
List<ItemStack> inputs = StackUtil.getSubtypes(input);
|
List<ItemStack> inputs = JEIPluginManager.jeiHelper.getStackHelper().getSubtypes(input);
|
||||||
ScribeRecipeJEI recipe = new ScribeRecipeJEI(inputs, output);
|
ScribeRecipeJEI recipe = new ScribeRecipeJEI(inputs, output);
|
||||||
recipes.add(recipe);
|
recipes.add(recipe);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,13 @@
|
||||||
package com.oitsjustjose.criss_cross.lib;
|
package com.oitsjustjose.criss_cross.lib;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.CrissCross;
|
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockCobblegen;
|
import com.oitsjustjose.criss_cross.blocks.BlockCobblegen;
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockCropomator;
|
import com.oitsjustjose.criss_cross.blocks.BlockCropomator;
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor;
|
import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor;
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockScribe;
|
import com.oitsjustjose.criss_cross.blocks.BlockScribe;
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockStonegen;
|
import com.oitsjustjose.criss_cross.blocks.BlockStonegen;
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockWoodchipper;
|
import com.oitsjustjose.criss_cross.blocks.BlockWoodchipper;
|
||||||
import com.oitsjustjose.criss_cross.gui.GUIHandler;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
|
||||||
|
|
||||||
public class LibBlocks
|
public class LibBlocks
|
||||||
{
|
{
|
||||||
|
|
@ -31,6 +28,5 @@ public class LibBlocks
|
||||||
stonegen = new BlockStonegen();
|
stonegen = new BlockStonegen();
|
||||||
scribe = new BlockScribe();
|
scribe = new BlockScribe();
|
||||||
// TODO: atmosManipulator = new BlockAtmosManipulator();
|
// TODO: atmosManipulator = new BlockAtmosManipulator();
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(CrissCross.instance, new GUIHandler());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2,21 +2,14 @@ package com.oitsjustjose.criss_cross.tileentity;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.ITickable;
|
|
||||||
|
|
||||||
public class TileAtmosManipulator extends TileEntity implements ITickable
|
public class TileAtmosManipulator extends TileEntity
|
||||||
{
|
{
|
||||||
public boolean isUseableByPlayer(EntityPlayer player)
|
public boolean isUseableByPlayer(EntityPlayer player)
|
||||||
{
|
{
|
||||||
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
|
return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void update()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRain()
|
public void setRain()
|
||||||
{
|
{
|
||||||
worldObj.getWorldInfo().setRaining(true);
|
worldObj.getWorldInfo().setRaining(true);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
|
import com.oitsjustjose.criss_cross.blocks.BlockCobblegen;
|
||||||
import com.oitsjustjose.criss_cross.container.ContainerCobblegen;
|
import com.oitsjustjose.criss_cross.container.ContainerCobblegen;
|
||||||
import com.oitsjustjose.criss_cross.lib.Config;
|
import com.oitsjustjose.criss_cross.lib.Config;
|
||||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||||
|
|
@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntityLockable;
|
import net.minecraft.tileentity.TileEntityLockable;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
@ -31,16 +32,16 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||||
private static String customName;
|
private static String customName;
|
||||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||||
|
|
||||||
public int fuelTime;
|
public int fuelTime;
|
||||||
public int processTime;
|
public int processTime;
|
||||||
public int fuelUsetime;
|
public int totalTime;
|
||||||
|
public int currentFuelBuffer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
boolean flag = this.fuelTime > 0;
|
boolean isBurning = this.isUsingFuel();
|
||||||
boolean flag1 = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
--this.fuelTime;
|
--this.fuelTime;
|
||||||
|
|
@ -51,15 +52,19 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
{
|
{
|
||||||
if (this.fuelTime == 0 && this.canProcess())
|
if (this.fuelTime == 0 && this.canProcess())
|
||||||
{
|
{
|
||||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = this.fuelTime = getFuelAmount(this.ItemStacks[1]);
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
|
|
||||||
if (this.ItemStacks[1] != null)
|
if (this.ItemStacks[1] != null)
|
||||||
|
{
|
||||||
|
--this.ItemStacks[1].stackSize;
|
||||||
|
|
||||||
if (this.ItemStacks[1].stackSize == 0)
|
if (this.ItemStacks[1].stackSize == 0)
|
||||||
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
this.ItemStacks[1] = ItemStacks[1].getItem().getContainerItem(ItemStacks[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,25 +75,29 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
if (this.processTime == proTicks)
|
if (this.processTime == proTicks)
|
||||||
{
|
{
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
|
this.totalTime = this.getFuelAmount(this.ItemStacks[0]);
|
||||||
this.processItem();
|
this.processItem();
|
||||||
flag1 = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
}
|
}
|
||||||
|
else if (!this.isUsingFuel() && this.processTime > 0)
|
||||||
|
this.processTime = MathHelper.clamp_int(this.processTime - 2, 0, this.totalTime);
|
||||||
|
|
||||||
if (flag != this.fuelTime > 0)
|
if (isBurning != this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
BlockCobblegen.updateBlockState(this.isUsingFuel(), this.worldObj, this.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag1)
|
if (flag)
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static ArrayList<ItemStack> getFuels()
|
public static ArrayList<ItemStack> getFuels()
|
||||||
{
|
{
|
||||||
return fuelItems;
|
return fuelItems;
|
||||||
|
|
@ -190,10 +199,11 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
|
|
||||||
this.fuelTime = tag.getShort("FuelTime");
|
this.fuelTime = tag.getShort("FuelTime");
|
||||||
this.processTime = tag.getShort("WorkTime");
|
this.processTime = tag.getShort("WorkTime");
|
||||||
if (this.ItemStacks[1] != null)
|
this.totalTime = tag.getShort("WorkTimeTotal");
|
||||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = getFuelAmount(this.ItemStacks[1]);
|
||||||
else
|
|
||||||
this.fuelUsetime = 0;
|
if (tag.hasKey("CustomName", 8))
|
||||||
|
this.customName = tag.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -202,6 +212,8 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||||
tag.setShort("WorkTime", (short) this.processTime);
|
tag.setShort("WorkTime", (short) this.processTime);
|
||||||
|
tag.setShort("WorkTimeTotal", (short) this.totalTime);
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||||
|
|
@ -214,6 +226,9 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag("Items", nbttaglist);
|
tag.setTag("Items", nbttaglist);
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
tag.setString("CustomName", this.customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -231,10 +246,10 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getBurnTimeRemainingScaled(int par1)
|
public int getBurnTimeRemainingScaled(int par1)
|
||||||
{
|
{
|
||||||
if (this.fuelUsetime == 0)
|
if (this.currentFuelBuffer == 0)
|
||||||
this.fuelUsetime = proTicks;
|
this.currentFuelBuffer = proTicks;
|
||||||
|
|
||||||
return this.fuelTime * par1 / this.fuelUsetime;
|
return this.fuelTime * par1 / this.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingFuel()
|
public boolean isUsingFuel()
|
||||||
|
|
@ -300,8 +315,10 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getItemBurnTime(ItemStack itemstack)
|
public static int getFuelAmount(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
|
if(itemstack == null)
|
||||||
|
return 0;
|
||||||
return isItemFuel(itemstack) ? proTicks : 0;
|
return isItemFuel(itemstack) ? proTicks : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -345,9 +362,11 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
case 0:
|
case 0:
|
||||||
return this.fuelTime;
|
return this.fuelTime;
|
||||||
case 1:
|
case 1:
|
||||||
return this.fuelUsetime;
|
return this.currentFuelBuffer;
|
||||||
case 2:
|
case 2:
|
||||||
return this.processTime;
|
return this.processTime;
|
||||||
|
case 3:
|
||||||
|
return this.totalTime;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -362,18 +381,20 @@ public class TileCobblegen extends TileEntityLockable implements ITickable, ISid
|
||||||
this.fuelTime = value;
|
this.fuelTime = value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.fuelUsetime = value;
|
this.currentFuelBuffer = value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.processTime = value;
|
this.processTime = value;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
this.totalTime = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFieldCount()
|
public int getFieldCount()
|
||||||
{
|
{
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
|
import com.oitsjustjose.criss_cross.blocks.BlockCropomator;
|
||||||
import com.oitsjustjose.criss_cross.container.ContainerCropomator;
|
import com.oitsjustjose.criss_cross.container.ContainerCropomator;
|
||||||
import com.oitsjustjose.criss_cross.lib.Config;
|
import com.oitsjustjose.criss_cross.lib.Config;
|
||||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||||
|
|
@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntityLockable;
|
import net.minecraft.tileentity.TileEntityLockable;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
@ -30,33 +31,32 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
private static final int[] slotsSides = new int[] { 1 };
|
private static final int[] slotsSides = new int[] { 1 };
|
||||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||||
private static String customName;
|
private static String customName;
|
||||||
|
|
||||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||||
|
public int fuelTime;
|
||||||
public int catalystTime;
|
|
||||||
public int processTime;
|
public int processTime;
|
||||||
public int catalystInUseTime;
|
public int totalTime;
|
||||||
|
public int currentFuelBuffer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
boolean flag = this.catalystTime > 0;
|
boolean isBurning = this.isUsingFuel();
|
||||||
boolean flag1 = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if (this.catalystTime > 0)
|
if (this.fuelTime > 0)
|
||||||
--this.catalystTime;
|
--this.fuelTime;
|
||||||
|
|
||||||
if (!this.worldObj.isRemote)
|
if (!this.worldObj.isRemote)
|
||||||
{
|
{
|
||||||
if (this.catalystTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
if (this.fuelTime != 0 || this.ItemStacks[1] != null && this.ItemStacks[0] != null)
|
||||||
{
|
{
|
||||||
if (this.catalystTime == 0 && this.canProcess())
|
if (this.fuelTime == 0 && this.canProcess())
|
||||||
{
|
{
|
||||||
this.catalystInUseTime = this.catalystTime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
||||||
|
|
||||||
if (this.catalystTime > 0)
|
if (this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
|
|
||||||
if (this.ItemStacks[1] != null)
|
if (this.ItemStacks[1] != null)
|
||||||
{
|
{
|
||||||
|
|
@ -75,22 +75,25 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
if (this.processTime == proTicks)
|
if (this.processTime == proTicks)
|
||||||
{
|
{
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
|
this.totalTime = this.getItemBurnTime(this.ItemStacks[0]);
|
||||||
this.processItem();
|
this.processItem();
|
||||||
flag1 = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
}
|
}
|
||||||
|
else if (!this.isUsingFuel() && this.processTime > 0)
|
||||||
|
this.processTime = MathHelper.clamp_int(this.processTime - 2, 0, this.totalTime);
|
||||||
|
|
||||||
if (flag != this.catalystTime > 0)
|
if (isBurning != this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
BlockMachineBase.updateBlockState(this.catalystTime > 0, this.worldObj, this.pos);
|
BlockCropomator.updateBlockState(this.isUsingFuel(), this.worldObj, this.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag1)
|
if (flag)
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -188,20 +191,23 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.catalystTime = tag.getShort("BonemealTime");
|
this.fuelTime = tag.getShort("FuelTime");
|
||||||
this.processTime = tag.getShort("ProcessTime");
|
this.processTime = tag.getShort("WorkTime");
|
||||||
if (this.ItemStacks[1] != null)
|
this.totalTime = tag.getShort("WorkTimeTotal");
|
||||||
this.catalystInUseTime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = getItemBurnTime(this.ItemStacks[1]);
|
||||||
else
|
|
||||||
this.catalystInUseTime = 0;
|
if (tag.hasKey("CustomName", 8))
|
||||||
|
this.customName = tag.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound tag)
|
public void writeToNBT(NBTTagCompound tag)
|
||||||
{
|
{
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
tag.setShort("BonemealTime", (short) this.catalystTime);
|
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||||
tag.setShort("ProcessTime", (short) this.processTime);
|
tag.setShort("WorkTime", (short) this.processTime);
|
||||||
|
tag.setShort("WorkTimeTotal", (short) this.totalTime);
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||||
|
|
@ -214,6 +220,9 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag("Items", nbttaglist);
|
tag.setTag("Items", nbttaglist);
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
tag.setString("CustomName", this.customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -231,15 +240,15 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getBurnTimeRemainingScaled(int par1)
|
public int getBurnTimeRemainingScaled(int par1)
|
||||||
{
|
{
|
||||||
if (this.catalystInUseTime == 0)
|
if (this.currentFuelBuffer == 0)
|
||||||
this.catalystInUseTime = proTicks;
|
this.currentFuelBuffer = proTicks;
|
||||||
|
|
||||||
return this.catalystTime * par1 / this.catalystInUseTime;
|
return this.fuelTime * par1 / this.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingFuel()
|
public boolean isUsingFuel()
|
||||||
{
|
{
|
||||||
return this.catalystTime > 0;
|
return this.fuelTime > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canProcess()
|
private boolean canProcess()
|
||||||
|
|
@ -305,6 +314,8 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
|
|
||||||
public static int getItemBurnTime(ItemStack itemstack)
|
public static int getItemBurnTime(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
|
if (itemstack == null)
|
||||||
|
return 0;
|
||||||
return isItemCatalyst(itemstack) ? proTicks : 0;
|
return isItemCatalyst(itemstack) ? proTicks : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,11 +352,13 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return this.catalystTime;
|
return this.fuelTime;
|
||||||
case 1:
|
case 1:
|
||||||
return this.catalystInUseTime;
|
return this.currentFuelBuffer;
|
||||||
case 2:
|
case 2:
|
||||||
return this.processTime;
|
return this.processTime;
|
||||||
|
case 3:
|
||||||
|
return this.totalTime;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -357,21 +370,23 @@ public class TileCropomator extends TileEntityLockable implements ITickable, ISi
|
||||||
switch (id)
|
switch (id)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
this.catalystTime = value;
|
this.fuelTime = value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.catalystInUseTime = value;
|
this.currentFuelBuffer = value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.processTime = value;
|
this.processTime = value;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
this.totalTime = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFieldCount()
|
public int getFieldCount()
|
||||||
{
|
{
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
|
import com.oitsjustjose.criss_cross.blocks.BlockElectroextractor;
|
||||||
import com.oitsjustjose.criss_cross.container.ContainerElectroextractor;
|
import com.oitsjustjose.criss_cross.container.ContainerElectroextractor;
|
||||||
import com.oitsjustjose.criss_cross.lib.Config;
|
import com.oitsjustjose.criss_cross.lib.Config;
|
||||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||||
|
|
@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntityLockable;
|
import net.minecraft.tileentity.TileEntityLockable;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
@ -31,16 +32,16 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||||
private static String customName;
|
private static String customName;
|
||||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||||
|
|
||||||
public int fuelTime;
|
public int fuelTime;
|
||||||
public int crushTime;
|
public int processTime;
|
||||||
public int fuelInUseTime;
|
public int totalTime;
|
||||||
|
public int currentFuelBuffer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
boolean flag = this.fuelTime > 0;
|
boolean isBurning = this.isUsingFuel();
|
||||||
boolean flag1 = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
--this.fuelTime;
|
--this.fuelTime;
|
||||||
|
|
@ -51,11 +52,11 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
{
|
{
|
||||||
if (this.fuelTime == 0 && this.canProcess())
|
if (this.fuelTime == 0 && this.canProcess())
|
||||||
{
|
{
|
||||||
this.fuelInUseTime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = this.fuelTime = getFuelAmount(this.ItemStacks[1]);
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
|
|
||||||
if (this.ItemStacks[1] != null)
|
if (this.ItemStacks[1] != null)
|
||||||
{
|
{
|
||||||
|
|
@ -69,27 +70,30 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
|
|
||||||
if (this.isUsingFuel() && this.canProcess())
|
if (this.isUsingFuel() && this.canProcess())
|
||||||
{
|
{
|
||||||
++this.crushTime;
|
++this.processTime;
|
||||||
|
|
||||||
if (this.crushTime == proTicks)
|
if (this.processTime == proTicks)
|
||||||
{
|
{
|
||||||
this.crushTime = 0;
|
this.processTime = 0;
|
||||||
|
this.totalTime = this.getFuelAmount(this.ItemStacks[0]);
|
||||||
this.processItem();
|
this.processItem();
|
||||||
flag1 = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.crushTime = 0;
|
this.processTime = 0;
|
||||||
}
|
}
|
||||||
|
else if (!this.isUsingFuel() && this.processTime > 0)
|
||||||
|
this.processTime = MathHelper.clamp_int(this.processTime - 2, 0, this.totalTime);
|
||||||
|
|
||||||
if (flag != this.fuelTime > 0)
|
if (isBurning != this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
BlockElectroextractor.updateBlockState(this.isUsingFuel(), this.worldObj, this.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag1)
|
if (flag)
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -170,20 +174,23 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
this.ItemStacks[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fuelTime = tag.getShort("Energy");
|
this.fuelTime = tag.getShort("FuelTime");
|
||||||
this.crushTime = tag.getShort("CrushTime");
|
this.processTime = tag.getShort("WorkTime");
|
||||||
if (this.ItemStacks[1] != null)
|
this.totalTime = tag.getShort("WorkTimeTotal");
|
||||||
this.fuelInUseTime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = getFuelAmount(this.ItemStacks[1]);
|
||||||
else
|
|
||||||
this.fuelInUseTime = 0;
|
if (tag.hasKey("CustomName", 8))
|
||||||
|
this.customName = tag.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound tag)
|
public void writeToNBT(NBTTagCompound tag)
|
||||||
{
|
{
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
tag.setShort("Energy", (short) this.fuelTime);
|
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||||
tag.setShort("CrushTime", (short) this.crushTime);
|
tag.setShort("WorkTime", (short) this.processTime);
|
||||||
|
tag.setShort("WorkTimeTotal", (short) this.totalTime);
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||||
|
|
@ -196,6 +203,9 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag("Items", nbttaglist);
|
tag.setTag("Items", nbttaglist);
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
tag.setString("CustomName", this.customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -207,16 +217,16 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getProgressScaled(int par1)
|
public int getProgressScaled(int par1)
|
||||||
{
|
{
|
||||||
return this.crushTime * par1 / proTicks;
|
return this.processTime * par1 / proTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getBurnTimeRemainingScaled(int par1)
|
public int getBurnTimeRemainingScaled(int par1)
|
||||||
{
|
{
|
||||||
if (this.fuelInUseTime == 0)
|
if (this.currentFuelBuffer == 0)
|
||||||
this.fuelInUseTime = proTicks;
|
this.currentFuelBuffer = proTicks;
|
||||||
|
|
||||||
return this.fuelTime * par1 / this.fuelInUseTime;
|
return this.fuelTime * par1 / this.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingFuel()
|
public boolean isUsingFuel()
|
||||||
|
|
@ -291,8 +301,10 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getItemBurnTime(ItemStack itemstack)
|
public static int getFuelAmount(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
|
if (itemstack == null)
|
||||||
|
return 0;
|
||||||
return isItemEnergetic(itemstack) ? proTicks : 0;
|
return isItemEnergetic(itemstack) ? proTicks : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -338,9 +350,11 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
case 0:
|
case 0:
|
||||||
return this.fuelTime;
|
return this.fuelTime;
|
||||||
case 1:
|
case 1:
|
||||||
return this.fuelInUseTime;
|
return this.currentFuelBuffer;
|
||||||
case 2:
|
case 2:
|
||||||
return this.crushTime;
|
return this.processTime;
|
||||||
|
case 3:
|
||||||
|
return this.totalTime;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -355,18 +369,20 @@ public class TileElectroextractor extends TileEntityLockable implements ITickabl
|
||||||
this.fuelTime = value;
|
this.fuelTime = value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.fuelInUseTime = value;
|
this.currentFuelBuffer = value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.crushTime = value;
|
this.processTime = value;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
this.totalTime = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFieldCount()
|
public int getFieldCount()
|
||||||
{
|
{
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package com.oitsjustjose.criss_cross.tileentity;
|
package com.oitsjustjose.criss_cross.tileentity;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
|
import com.oitsjustjose.criss_cross.blocks.BlockScribe;
|
||||||
import com.oitsjustjose.criss_cross.container.ContainerScribe;
|
import com.oitsjustjose.criss_cross.container.ContainerScribe;
|
||||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||||
import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes;
|
import com.oitsjustjose.criss_cross.recipes.machine.ScribeRecipes;
|
||||||
|
|
@ -16,6 +16,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntityLockable;
|
import net.minecraft.tileentity.TileEntityLockable;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
@ -25,14 +26,15 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
private static String customName;
|
private static String customName;
|
||||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||||
public int fuelTime;
|
public int fuelTime;
|
||||||
public int writingTime;
|
public int processTime;
|
||||||
public int fuelUsetime;
|
public int totalTime;
|
||||||
|
public int currentFuelBuffer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
boolean flag = this.fuelTime > 0;
|
boolean isBurning = this.isUsingFuel();
|
||||||
boolean flag1 = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
--this.fuelTime;
|
--this.fuelTime;
|
||||||
|
|
@ -43,11 +45,11 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
{
|
{
|
||||||
if (this.fuelTime == 0 && this.canProcess())
|
if (this.fuelTime == 0 && this.canProcess())
|
||||||
{
|
{
|
||||||
this.fuelUsetime = this.fuelTime = getBookUseTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = this.fuelTime = getBookUseTime(this.ItemStacks[1]);
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
|
|
||||||
if (this.ItemStacks[1] != null)
|
if (this.ItemStacks[1] != null)
|
||||||
{
|
{
|
||||||
|
|
@ -61,28 +63,31 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
|
|
||||||
if (this.isUsingFuel() && this.canProcess())
|
if (this.isUsingFuel() && this.canProcess())
|
||||||
{
|
{
|
||||||
++this.writingTime;
|
++this.processTime;
|
||||||
|
|
||||||
if (this.writingTime == proTicks)
|
if (this.processTime == proTicks)
|
||||||
{
|
{
|
||||||
this.worldObj.playSoundEffect(this.pos.getX(), this.pos.getY(), this.pos.getZ(), "random.levelup", 0.5F, 1.0F);
|
this.worldObj.playSoundEffect(this.pos.getX(), this.pos.getY(), this.pos.getZ(), "random.levelup", 0.5F, 1.0F);
|
||||||
this.writingTime = 0;
|
this.processTime = 0;
|
||||||
|
this.totalTime = this.getBookUseTime(this.ItemStacks[0]);
|
||||||
this.processItem();
|
this.processItem();
|
||||||
flag1 = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.writingTime = 0;
|
this.processTime = 0;
|
||||||
}
|
}
|
||||||
|
else if (!this.isUsingFuel() && this.processTime > 0)
|
||||||
|
this.processTime = MathHelper.clamp_int(this.processTime - 2, 0, this.totalTime);
|
||||||
|
|
||||||
if (flag != this.fuelTime > 0)
|
if (isBurning != this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
BlockScribe.updateBlockState(this.isUsingFuel(), this.worldObj, this.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag1)
|
if (flag)
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -176,11 +181,12 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
}
|
}
|
||||||
|
|
||||||
this.fuelTime = tag.getShort("FuelTime");
|
this.fuelTime = tag.getShort("FuelTime");
|
||||||
this.writingTime = tag.getShort("WorkTime");
|
this.processTime = tag.getShort("WorkTime");
|
||||||
if (this.ItemStacks[1] != null)
|
this.totalTime = tag.getShort("WorkTimeTotal");
|
||||||
this.fuelUsetime = getBookUseTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = getBookUseTime(this.ItemStacks[1]);
|
||||||
else
|
|
||||||
this.fuelUsetime = 0;
|
if (tag.hasKey("CustomName", 8))
|
||||||
|
this.customName = tag.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -188,7 +194,9 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
{
|
{
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||||
tag.setShort("WorkTime", (short) this.writingTime);
|
tag.setShort("WorkTime", (short) this.processTime);
|
||||||
|
tag.setShort("WorkTimeTotal", (short) this.totalTime);
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||||
|
|
@ -201,6 +209,9 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag("Items", nbttaglist);
|
tag.setTag("Items", nbttaglist);
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
tag.setString("CustomName", this.customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -212,16 +223,16 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getProgressScaled(int par1)
|
public int getProgressScaled(int par1)
|
||||||
{
|
{
|
||||||
return this.writingTime * par1 / proTicks;
|
return this.processTime * par1 / proTicks;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getBurnTimeRemainingScaled(int par1)
|
public int getBurnTimeRemainingScaled(int par1)
|
||||||
{
|
{
|
||||||
if (this.fuelUsetime == 0)
|
if (this.currentFuelBuffer == 0)
|
||||||
this.fuelUsetime = proTicks;
|
this.currentFuelBuffer = proTicks;
|
||||||
|
|
||||||
return this.fuelTime * par1 / this.fuelUsetime;
|
return this.fuelTime * par1 / this.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingFuel()
|
public boolean isUsingFuel()
|
||||||
|
|
@ -272,6 +283,8 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
|
|
||||||
public static int getBookUseTime(ItemStack itemstack)
|
public static int getBookUseTime(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
|
if (itemstack == null)
|
||||||
|
return 0;
|
||||||
return isBook(itemstack) ? proTicks : 0;
|
return isBook(itemstack) ? proTicks : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,9 +325,11 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
case 0:
|
case 0:
|
||||||
return this.fuelTime;
|
return this.fuelTime;
|
||||||
case 1:
|
case 1:
|
||||||
return this.fuelUsetime;
|
return this.currentFuelBuffer;
|
||||||
case 2:
|
case 2:
|
||||||
return this.writingTime;
|
return this.processTime;
|
||||||
|
case 3:
|
||||||
|
return this.totalTime;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -329,18 +344,20 @@ public class TileScribe extends TileEntityLockable implements ITickable, ISidedI
|
||||||
this.fuelTime = value;
|
this.fuelTime = value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.fuelUsetime = value;
|
this.currentFuelBuffer = value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.writingTime = value;
|
this.processTime = value;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
this.totalTime = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFieldCount()
|
public int getFieldCount()
|
||||||
{
|
{
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
|
import com.oitsjustjose.criss_cross.blocks.BlockStonegen;
|
||||||
import com.oitsjustjose.criss_cross.container.ContainerStonegen;
|
import com.oitsjustjose.criss_cross.container.ContainerStonegen;
|
||||||
import com.oitsjustjose.criss_cross.lib.Config;
|
import com.oitsjustjose.criss_cross.lib.Config;
|
||||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||||
|
|
@ -19,6 +19,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntityLockable;
|
import net.minecraft.tileentity.TileEntityLockable;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
@ -31,16 +32,16 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||||
private static String customName;
|
private static String customName;
|
||||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||||
|
|
||||||
public int fuelTime;
|
public int fuelTime;
|
||||||
public int processTime;
|
public int processTime;
|
||||||
public int fuelUsetime;
|
public int totalTime;
|
||||||
|
public int currentFuelBuffer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
boolean flag = this.fuelTime > 0;
|
boolean isBurning = this.isUsingFuel();
|
||||||
boolean flag1 = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
--this.fuelTime;
|
--this.fuelTime;
|
||||||
|
|
@ -51,11 +52,11 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
{
|
{
|
||||||
if (this.fuelTime == 0 && this.canProcess())
|
if (this.fuelTime == 0 && this.canProcess())
|
||||||
{
|
{
|
||||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = this.fuelTime = getFuelAmount(this.ItemStacks[1]);
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
|
|
||||||
if (this.ItemStacks[1] != null)
|
if (this.ItemStacks[1] != null)
|
||||||
{
|
{
|
||||||
|
|
@ -74,22 +75,25 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
if (this.processTime == proTicks)
|
if (this.processTime == proTicks)
|
||||||
{
|
{
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
|
this.totalTime = this.getFuelAmount(this.ItemStacks[0]);
|
||||||
this.processItem();
|
this.processItem();
|
||||||
flag1 = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
}
|
}
|
||||||
|
else if (!this.isUsingFuel() && this.processTime > 0)
|
||||||
|
this.processTime = MathHelper.clamp_int(this.processTime - 2, 0, this.totalTime);
|
||||||
|
|
||||||
if (flag != this.fuelTime > 0)
|
if (isBurning != this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
BlockStonegen.updateBlockState(this.isUsingFuel(), this.worldObj, this.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag1)
|
if (flag)
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,10 +198,11 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
|
|
||||||
this.fuelTime = tag.getShort("FuelTime");
|
this.fuelTime = tag.getShort("FuelTime");
|
||||||
this.processTime = tag.getShort("WorkTime");
|
this.processTime = tag.getShort("WorkTime");
|
||||||
if (this.ItemStacks[1] != null)
|
this.totalTime = tag.getShort("WorkTimeTotal");
|
||||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = getFuelAmount(this.ItemStacks[1]);
|
||||||
else
|
|
||||||
this.fuelUsetime = 0;
|
if (tag.hasKey("CustomName", 8))
|
||||||
|
this.customName = tag.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -206,6 +211,8 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||||
tag.setShort("WorkTime", (short) this.processTime);
|
tag.setShort("WorkTime", (short) this.processTime);
|
||||||
|
tag.setShort("WorkTimeTotal", (short) this.totalTime);
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||||
|
|
@ -218,6 +225,9 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag("Items", nbttaglist);
|
tag.setTag("Items", nbttaglist);
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
tag.setString("CustomName", this.customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -235,10 +245,10 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getBurnTimeRemainingScaled(int par1)
|
public int getBurnTimeRemainingScaled(int par1)
|
||||||
{
|
{
|
||||||
if (this.fuelUsetime == 0)
|
if (this.currentFuelBuffer == 0)
|
||||||
this.fuelUsetime = proTicks;
|
this.currentFuelBuffer = proTicks;
|
||||||
|
|
||||||
return this.fuelTime * par1 / this.fuelUsetime;
|
return this.fuelTime * par1 / this.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingFuel()
|
public boolean isUsingFuel()
|
||||||
|
|
@ -290,7 +300,6 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
{
|
{
|
||||||
if (this.canProcess())
|
if (this.canProcess())
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemStack input = ItemStacks[0];
|
ItemStack input = ItemStacks[0];
|
||||||
ItemStack output = new ItemStack(Blocks.stone);
|
ItemStack output = new ItemStack(Blocks.stone);
|
||||||
ItemStack outputSlot = ItemStacks[2];
|
ItemStack outputSlot = ItemStacks[2];
|
||||||
|
|
@ -304,8 +313,10 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getItemBurnTime(ItemStack itemstack)
|
public static int getFuelAmount(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
|
if (itemstack == null)
|
||||||
|
return 0;
|
||||||
return isItemFuel(itemstack) ? proTicks : 0;
|
return isItemFuel(itemstack) ? proTicks : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -349,9 +360,11 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
case 0:
|
case 0:
|
||||||
return this.fuelTime;
|
return this.fuelTime;
|
||||||
case 1:
|
case 1:
|
||||||
return this.fuelUsetime;
|
return this.currentFuelBuffer;
|
||||||
case 2:
|
case 2:
|
||||||
return this.processTime;
|
return this.processTime;
|
||||||
|
case 3:
|
||||||
|
return this.totalTime;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -366,18 +379,20 @@ public class TileStonegen extends TileEntityLockable implements ITickable, ISide
|
||||||
this.fuelTime = value;
|
this.fuelTime = value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.fuelUsetime = value;
|
this.currentFuelBuffer = value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.processTime = value;
|
this.processTime = value;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
this.totalTime = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFieldCount()
|
public int getFieldCount()
|
||||||
{
|
{
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package com.oitsjustjose.criss_cross.tileentity;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import com.oitsjustjose.criss_cross.blocks.BlockMachineBase;
|
import com.oitsjustjose.criss_cross.blocks.BlockWoodchipper;
|
||||||
import com.oitsjustjose.criss_cross.container.ContainerWoodchipper;
|
import com.oitsjustjose.criss_cross.container.ContainerWoodchipper;
|
||||||
import com.oitsjustjose.criss_cross.lib.Config;
|
import com.oitsjustjose.criss_cross.lib.Config;
|
||||||
import com.oitsjustjose.criss_cross.lib.Lib;
|
import com.oitsjustjose.criss_cross.lib.Lib;
|
||||||
|
|
@ -18,6 +18,7 @@ import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntityLockable;
|
import net.minecraft.tileentity.TileEntityLockable;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.ITickable;
|
import net.minecraft.util.ITickable;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraftforge.fml.relauncher.Side;
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
@ -31,16 +32,16 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
private static ArrayList<ItemStack> fuelItems = new ArrayList<ItemStack>();
|
||||||
private static String customName;
|
private static String customName;
|
||||||
private ItemStack[] ItemStacks = new ItemStack[3];
|
private ItemStack[] ItemStacks = new ItemStack[3];
|
||||||
|
|
||||||
public int fuelTime;
|
public int fuelTime;
|
||||||
public int processTime;
|
public int processTime;
|
||||||
public int fuelUsetime;
|
public int totalTime;
|
||||||
|
public int currentFuelBuffer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
boolean flag = this.fuelTime > 0;
|
boolean isBurning = this.isUsingFuel();
|
||||||
boolean flag1 = false;
|
boolean flag = false;
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
--this.fuelTime;
|
--this.fuelTime;
|
||||||
|
|
@ -51,11 +52,11 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
{
|
{
|
||||||
if (this.fuelTime == 0 && this.canProcess())
|
if (this.fuelTime == 0 && this.canProcess())
|
||||||
{
|
{
|
||||||
this.fuelUsetime = this.fuelTime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = this.fuelTime = getFuelAmount(this.ItemStacks[1]);
|
||||||
|
|
||||||
if (this.fuelTime > 0)
|
if (this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
|
|
||||||
if (this.ItemStacks[1] != null)
|
if (this.ItemStacks[1] != null)
|
||||||
{
|
{
|
||||||
|
|
@ -74,22 +75,25 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
if (this.processTime == proTicks)
|
if (this.processTime == proTicks)
|
||||||
{
|
{
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
|
this.totalTime = this.getFuelAmount(this.ItemStacks[0]);
|
||||||
this.processItem();
|
this.processItem();
|
||||||
flag1 = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
this.processTime = 0;
|
this.processTime = 0;
|
||||||
}
|
}
|
||||||
|
else if (!this.isUsingFuel() && this.processTime > 0)
|
||||||
|
this.processTime = MathHelper.clamp_int(this.processTime - 2, 0, this.totalTime);
|
||||||
|
|
||||||
if (flag != this.fuelTime > 0)
|
if (isBurning != this.fuelTime > 0)
|
||||||
{
|
{
|
||||||
flag1 = true;
|
flag = true;
|
||||||
BlockMachineBase.updateBlockState(this.fuelTime > 0, this.worldObj, this.pos);
|
BlockWoodchipper.updateBlockState(this.isUsingFuel(), this.worldObj, this.pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flag1)
|
if (flag)
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,10 +193,11 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
|
|
||||||
this.fuelTime = tag.getShort("FuelTime");
|
this.fuelTime = tag.getShort("FuelTime");
|
||||||
this.processTime = tag.getShort("WorkTime");
|
this.processTime = tag.getShort("WorkTime");
|
||||||
if (this.ItemStacks[1] != null)
|
this.totalTime = tag.getShort("WorkTimeTotal");
|
||||||
this.fuelUsetime = getItemBurnTime(this.ItemStacks[1]);
|
this.currentFuelBuffer = getFuelAmount(this.ItemStacks[1]);
|
||||||
else
|
|
||||||
this.fuelUsetime = 0;
|
if (tag.hasKey("CustomName", 8))
|
||||||
|
this.customName = tag.getString("CustomName");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -201,6 +206,8 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
tag.setShort("FuelTime", (short) this.fuelTime);
|
tag.setShort("FuelTime", (short) this.fuelTime);
|
||||||
tag.setShort("WorkTime", (short) this.processTime);
|
tag.setShort("WorkTime", (short) this.processTime);
|
||||||
|
tag.setShort("WorkTimeTotal", (short) this.totalTime);
|
||||||
|
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < this.ItemStacks.length; ++i)
|
for (int i = 0; i < this.ItemStacks.length; ++i)
|
||||||
|
|
@ -213,6 +220,9 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag("Items", nbttaglist);
|
tag.setTag("Items", nbttaglist);
|
||||||
|
|
||||||
|
if (this.hasCustomName())
|
||||||
|
tag.setString("CustomName", this.customName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -230,10 +240,10 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getBurnTimeRemainingScaled(int par1)
|
public int getBurnTimeRemainingScaled(int par1)
|
||||||
{
|
{
|
||||||
if (this.fuelUsetime == 0)
|
if (this.currentFuelBuffer == 0)
|
||||||
this.fuelUsetime = proTicks;
|
this.currentFuelBuffer = proTicks;
|
||||||
|
|
||||||
return this.fuelTime * par1 / this.fuelUsetime;
|
return this.fuelTime * par1 / this.currentFuelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isUsingFuel()
|
public boolean isUsingFuel()
|
||||||
|
|
@ -302,8 +312,10 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getItemBurnTime(ItemStack itemstack)
|
public static int getFuelAmount(ItemStack itemstack)
|
||||||
{
|
{
|
||||||
|
if(itemstack == null)
|
||||||
|
return 0;
|
||||||
return isItemFuel(itemstack) ? proTicks : 0;
|
return isItemFuel(itemstack) ? proTicks : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -347,9 +359,11 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
case 0:
|
case 0:
|
||||||
return this.fuelTime;
|
return this.fuelTime;
|
||||||
case 1:
|
case 1:
|
||||||
return this.fuelUsetime;
|
return this.currentFuelBuffer;
|
||||||
case 2:
|
case 2:
|
||||||
return this.processTime;
|
return this.processTime;
|
||||||
|
case 3:
|
||||||
|
return this.totalTime;
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -364,18 +378,20 @@ public class TileWoodchipper extends TileEntityLockable implements ITickable, IS
|
||||||
this.fuelTime = value;
|
this.fuelTime = value;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
this.fuelUsetime = value;
|
this.currentFuelBuffer = value;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
this.processTime = value;
|
this.processTime = value;
|
||||||
break;
|
break;
|
||||||
|
case 3:
|
||||||
|
this.totalTime = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFieldCount()
|
public int getFieldCount()
|
||||||
{
|
{
|
||||||
return 3;
|
return 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -30,9 +30,6 @@ public class ClientProxy extends CommonProxy
|
||||||
register(i, "");
|
register(i, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
// WARNING: The following code is BULLSHIT and should be handled by FORGE. But it isn't. So sorry if you can't understand much. Just remember
|
|
||||||
// kids:
|
|
||||||
// EVERYTHING HAS TO BE IN LOWER CASE. NOTHING YOU LEARNED IN SCHOOL ABOUT CAPITALIZATION MATTERS ANYMORE.
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private static void register(Item item, String customName)
|
private static void register(Item item, String customName)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue