mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Cleanup!
This commit is contained in:
parent
21646c9c68
commit
df551d5518
30 changed files with 300 additions and 288 deletions
|
@ -401,6 +401,28 @@ public class GuiBooklet extends GuiScreen{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BookletPage getNextPage(BookletChapter chapter, BookletPage currentPage){
|
||||||
|
for(int i = 0; i < chapter.pages.length; i++){
|
||||||
|
if(chapter.pages[i] == currentPage){
|
||||||
|
if(i+1 < chapter.pages.length){
|
||||||
|
return chapter.pages[i+1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BookletPage getPrevPage(BookletChapter chapter, BookletPage currentPage){
|
||||||
|
for(int i = 0; i < chapter.pages.length; i++){
|
||||||
|
if(chapter.pages[i] == currentPage){
|
||||||
|
if(i-1 >= 0){
|
||||||
|
return chapter.pages[i-1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public void openChapter(BookletChapter chapter, BookletPage page){
|
public void openChapter(BookletChapter chapter, BookletPage page){
|
||||||
if(chapter == null){
|
if(chapter == null){
|
||||||
return;
|
return;
|
||||||
|
@ -432,28 +454,6 @@ public class GuiBooklet extends GuiScreen{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private BookletPage getNextPage(BookletChapter chapter, BookletPage currentPage){
|
|
||||||
for(int i = 0; i < chapter.pages.length; i++){
|
|
||||||
if(chapter.pages[i] == currentPage){
|
|
||||||
if(i+1 < chapter.pages.length){
|
|
||||||
return chapter.pages[i+1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private BookletPage getPrevPage(BookletChapter chapter, BookletPage currentPage){
|
|
||||||
for(int i = 0; i < chapter.pages.length; i++){
|
|
||||||
if(chapter.pages[i] == currentPage){
|
|
||||||
if(i-1 >= 0){
|
|
||||||
return chapter.pages[i-1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void openIndexEntry(BookletIndexEntry entry, int page, boolean resetTextField){
|
public void openIndexEntry(BookletIndexEntry entry, int page, boolean resetTextField){
|
||||||
if(resetTextField){
|
if(resetTextField){
|
||||||
|
|
|
@ -42,26 +42,6 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateScreen(int ticksElapsed){
|
|
||||||
if(ticksElapsed%5 == 0){
|
|
||||||
if(this.inputPos+1 < this.recipe.getRecipeInputs().size()){
|
|
||||||
this.inputPos++;
|
|
||||||
}
|
|
||||||
else if(this.outOnePos+1 < this.recipe.getRecipeOutputOnes().size()){
|
|
||||||
this.outOnePos++;
|
|
||||||
}
|
|
||||||
else if(this.outTwoPos+1 < this.recipe.getRecipeOutputTwos().size()){
|
|
||||||
this.outTwoPos++;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
this.inputPos = 0;
|
|
||||||
this.outOnePos = 0;
|
|
||||||
this.outTwoPos = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
public void render(GuiBooklet gui, int mouseX, int mouseY, boolean mouseClick, int ticksElapsed){
|
||||||
|
@ -121,6 +101,26 @@ public class PageCrusherRecipe extends BookletPage{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateScreen(int ticksElapsed){
|
||||||
|
if(ticksElapsed%5 == 0){
|
||||||
|
if(this.inputPos+1 < this.recipe.getRecipeInputs().size()){
|
||||||
|
this.inputPos++;
|
||||||
|
}
|
||||||
|
else if(this.outOnePos+1 < this.recipe.getRecipeOutputOnes().size()){
|
||||||
|
this.outOnePos++;
|
||||||
|
}
|
||||||
|
else if(this.outTwoPos+1 < this.recipe.getRecipeOutputTwos().size()){
|
||||||
|
this.outTwoPos++;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
this.inputPos = 0;
|
||||||
|
this.outOnePos = 0;
|
||||||
|
this.outTwoPos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack[] getItemStacksForPage(){
|
public ItemStack[] getItemStacksForPage(){
|
||||||
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
|
return this.recipe == null ? new ItemStack[0] : this.recipe.getRecipeOutputOnes().toArray(new ItemStack[this.recipe.getRecipeOutputOnes().size()]);
|
||||||
|
|
|
@ -105,6 +105,18 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{
|
||||||
return this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
|
return this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasExtraWhitelist(Block block){
|
||||||
|
String name = Block.blockRegistry.getNameForObject(block);
|
||||||
|
if(name != null){
|
||||||
|
for(String list : ConfigValues.paxelExtraMiningWhitelist){
|
||||||
|
if(list.equals(name)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName(){
|
public String getName(){
|
||||||
return name;
|
return name;
|
||||||
|
@ -134,16 +146,4 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{
|
||||||
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
public float getDigSpeed(ItemStack stack, Block block, int meta){
|
||||||
return this.hasExtraWhitelist(block) || block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.efficiencyOnProperMaterial : 1.0F;
|
return this.hasExtraWhitelist(block) || block.getHarvestTool(meta) == null || block.getHarvestTool(meta).isEmpty() || this.getToolClasses(stack).contains(block.getHarvestTool(meta)) ? this.efficiencyOnProperMaterial : 1.0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasExtraWhitelist(Block block){
|
|
||||||
String name = Block.blockRegistry.getNameForObject(block);
|
|
||||||
if(name != null){
|
|
||||||
for(String list : ConfigValues.paxelExtraMiningWhitelist){
|
|
||||||
if(list.equals(name)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -142,13 +142,19 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<? extends GuiContainer> getGuiClass(){
|
public String getGuiTexture(){
|
||||||
return GuiGrinder.GuiGrinderDouble.class;
|
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getGuiTexture(){
|
public void drawExtras(int recipe){
|
||||||
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png";
|
drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1);
|
||||||
|
this.drawChanceString(66, 93, recipe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<? extends GuiContainer> getGuiClass(){
|
||||||
|
return GuiGrinder.GuiGrinderDouble.class;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -157,12 +163,6 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR
|
||||||
GuiDraw.changeTexture(getGuiTexture());
|
GuiDraw.changeTexture(getGuiTexture());
|
||||||
GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70);
|
GuiDraw.drawTexturedModalRect(33, 20, 33, 20, 110, 70);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void drawExtras(int recipe){
|
|
||||||
drawProgressBar(51, 40, 176, 0, 24, 23, 48, 1);
|
|
||||||
this.drawChanceString(66, 93, recipe);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CachedCrush extends CachedRecipe{
|
public class CachedCrush extends CachedRecipe{
|
||||||
|
|
|
@ -28,10 +28,6 @@ public class CrusherRecipeRegistry{
|
||||||
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
|
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, outputTwo, outputTwoAmount, outputTwoChance));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addRecipe(String input, String outputOne, int outputOneAmount){
|
|
||||||
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, "", 0, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void registerFinally(){
|
public static void registerFinally(){
|
||||||
ArrayList<String> oresNoResult = new ArrayList<String>();
|
ArrayList<String> oresNoResult = new ArrayList<String>();
|
||||||
int recipesAdded = 0;
|
int recipesAdded = 0;
|
||||||
|
@ -88,6 +84,15 @@ public class CrusherRecipeRegistry{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addRecipe(String input, String outputOne, int outputOneAmount){
|
||||||
|
recipes.add(new CrusherRecipe(input, outputOne, outputOneAmount, "", 0, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<ItemStack> getOutputOnes(ItemStack input){
|
||||||
|
CrusherRecipe recipe = getRecipeFromInput(input);
|
||||||
|
return recipe == null ? null : recipe.getRecipeOutputOnes();
|
||||||
|
}
|
||||||
|
|
||||||
public static CrusherRecipe getRecipeFromInput(ItemStack input){
|
public static CrusherRecipe getRecipeFromInput(ItemStack input){
|
||||||
for(CrusherRecipe recipe : recipes){
|
for(CrusherRecipe recipe : recipes){
|
||||||
if(ItemUtil.contains(recipe.getRecipeInputs(), input, true)){
|
if(ItemUtil.contains(recipe.getRecipeInputs(), input, true)){
|
||||||
|
@ -97,11 +102,6 @@ public class CrusherRecipeRegistry{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ArrayList<ItemStack> getOutputOnes(ItemStack input){
|
|
||||||
CrusherRecipe recipe = getRecipeFromInput(input);
|
|
||||||
return recipe == null ? null : recipe.getRecipeOutputOnes();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ArrayList<ItemStack> getOutputTwos(ItemStack input){
|
public static ArrayList<ItemStack> getOutputTwos(ItemStack input){
|
||||||
CrusherRecipe recipe = getRecipeFromInput(input);
|
CrusherRecipe recipe = getRecipeFromInput(input);
|
||||||
return recipe == null ? null : recipe.getRecipeOutputTwos();
|
return recipe == null ? null : recipe.getRecipeOutputTwos();
|
||||||
|
@ -133,7 +133,9 @@ public class CrusherRecipeRegistry{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<ItemStack> getRecipeOutputOnes(){
|
public ArrayList<ItemStack> getRecipeOutputOnes(){
|
||||||
if(this.outputOne == null || this.outputOne.isEmpty()) return null;
|
if(this.outputOne == null || this.outputOne.isEmpty()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.outputOne);
|
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.outputOne);
|
||||||
for(ItemStack stack : stacks){
|
for(ItemStack stack : stacks){
|
||||||
|
@ -143,7 +145,9 @@ public class CrusherRecipeRegistry{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<ItemStack> getRecipeOutputTwos(){
|
public ArrayList<ItemStack> getRecipeOutputTwos(){
|
||||||
if(this.outputTwo == null || this.outputTwo.isEmpty()) return null;
|
if(this.outputTwo == null || this.outputTwo.isEmpty()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.outputTwo);
|
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.outputTwo);
|
||||||
for(ItemStack stack : stacks){
|
for(ItemStack stack : stacks){
|
||||||
|
@ -153,7 +157,9 @@ public class CrusherRecipeRegistry{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrayList<ItemStack> getRecipeInputs(){
|
public ArrayList<ItemStack> getRecipeInputs(){
|
||||||
if(this.input == null || this.input.isEmpty()) return null;
|
if(this.input == null || this.input.isEmpty()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.input);
|
ArrayList<ItemStack> stacks = OreDictionary.getOres(this.input);
|
||||||
for(ItemStack stack : stacks){
|
for(ItemStack stack : stacks){
|
||||||
|
@ -169,15 +175,15 @@ public class CrusherRecipeRegistry{
|
||||||
int resultAmount;
|
int resultAmount;
|
||||||
String resultPreString;
|
String resultPreString;
|
||||||
|
|
||||||
|
public SearchCase(String theCase, int resultAmount){
|
||||||
|
this(theCase, resultAmount, "dust");
|
||||||
|
}
|
||||||
|
|
||||||
public SearchCase(String theCase, int resultAmount, String resultPreString){
|
public SearchCase(String theCase, int resultAmount, String resultPreString){
|
||||||
this.theCase = theCase;
|
this.theCase = theCase;
|
||||||
this.resultAmount = resultAmount;
|
this.resultAmount = resultAmount;
|
||||||
this.resultPreString = resultPreString;
|
this.resultPreString = resultPreString;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SearchCase(String theCase, int resultAmount){
|
|
||||||
this(theCase, resultAmount, "dust");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,18 +76,18 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
compound.setInteger("CurrentTime", this.currentTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.currentTime = compound.getInteger("CurrentTime");
|
this.currentTime = compound.getInteger("CurrentTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
compound.setInteger("CurrentTime", this.currentTime);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return this.isPlacer;
|
return this.isPlacer;
|
||||||
|
|
|
@ -105,14 +105,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
||||||
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
return this.storage.getEnergyStored()*i/this.storage.getMaxEnergyStored();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
compound.setInteger("ProcessTime", this.currentProcessTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
this.tank.writeToNBT(compound);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||||
|
@ -121,6 +113,14 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
compound.setInteger("ProcessTime", this.currentProcessTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
this.tank.writeToNBT(compound);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
return (i == 0 && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CANOLA.ordinal()) || (i == 1 && stack.getItem() == Items.bucket);
|
||||||
|
|
|
@ -100,14 +100,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
||||||
return this.currentBurnTime*i/this.maxBurnTime;
|
return this.currentBurnTime*i/this.maxBurnTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
|
||||||
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||||
|
@ -116,6 +108,14 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||||
|
compound.setInteger("MaxBurnTime", this.maxBurnTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
return TileEntityFurnace.getItemBurnTime(stack) > 0;
|
||||||
|
|
|
@ -141,15 +141,6 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
return this.brewTime*i/ConfigIntValues.COFFEE_MACHINE_TIME_USED.getValue();
|
return this.brewTime*i/ConfigIntValues.COFFEE_MACHINE_TIME_USED.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
this.tank.writeToNBT(compound);
|
|
||||||
compound.setInteger("Cache", this.coffeeCacheAmount);
|
|
||||||
compound.setInteger("Time", this.brewTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
|
@ -159,6 +150,15 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
||||||
this.brewTime = compound.getInteger("Time");
|
this.brewTime = compound.getInteger("Time");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
this.tank.writeToNBT(compound);
|
||||||
|
compound.setInteger("Cache", this.coffeeCacheAmount);
|
||||||
|
compound.setInteger("Time", this.brewTime);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal());
|
return (i >= 3 && ItemCoffee.getIngredientFromStack(stack) != null) || (i == SLOT_COFFEE_BEANS && stack.getItem() == InitItems.itemCoffeeBean) || (i == SLOT_INPUT && stack.getItem() == InitItems.itemMisc && stack.getItemDamage() == TheMiscItems.CUP.ordinal());
|
||||||
|
|
|
@ -56,18 +56,18 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
compound.setInteger("ConversionTime", this.conversionTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.conversionTime = compound.getInteger("ConversionTime");
|
this.conversionTime = compound.getInteger("ConversionTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
compound.setInteger("ConversionTime", this.conversionTime);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit(){
|
public int getInventoryStackLimit(){
|
||||||
return ConfigIntValues.COMPOST_AMOUNT.getValue();
|
return ConfigIntValues.COMPOST_AMOUNT.getValue();
|
||||||
|
|
|
@ -62,18 +62,18 @@ public class TileEntityDropper extends TileEntityInventoryBase{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
compound.setInteger("CurrentTime", this.currentTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.currentTime = compound.getInteger("CurrentTime");
|
this.currentTime = compound.getInteger("CurrentTime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
compound.setInteger("CurrentTime", this.currentTime);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -55,18 +55,18 @@ public class TileEntityEnergizer extends TileEntityInventoryBase implements IEne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||||
|
|
|
@ -65,18 +65,18 @@ public class TileEntityEnervator extends TileEntityInventoryBase implements IEne
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
return i == 0 && stack.getItem() instanceof IEnergyContainerItem;
|
||||||
|
|
|
@ -100,18 +100,18 @@ public class TileEntityFeeder extends TileEntityInventoryBase implements IPacket
|
||||||
return this.currentTimer*i/ConfigIntValues.FEEDER_TIME.getValue();
|
return this.currentTimer*i/ConfigIntValues.FEEDER_TIME.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
compound.setInteger("Timer", this.currentTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.currentTimer = compound.getInteger("Timer");
|
this.currentTimer = compound.getInteger("Timer");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
compound.setInteger("Timer", this.currentTimer);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -131,14 +131,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
|
||||||
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
|
@ -147,6 +139,14 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
compound.setInteger("FirstSmeltTime", this.firstSmeltTime);
|
||||||
|
compound.setInteger("SecondSmeltTime", this.secondSmeltTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && FurnaceRecipes.smelting().getSmeltingResult(stack) != null;
|
||||||
|
|
|
@ -215,14 +215,6 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
|
||||||
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||||
|
@ -231,6 +223,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
compound.setInteger("FirstCrushTime", this.firstCrushTime);
|
||||||
|
compound.setInteger("SecondCrushTime", this.secondCrushTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && CrusherRecipeRegistry.getRecipeFromInput(stack) != null;
|
||||||
|
|
|
@ -424,19 +424,6 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
compound.setInteger("SideToPut", this.sideToPut);
|
|
||||||
compound.setInteger("SlotToPut", this.slotToPutStart);
|
|
||||||
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
|
|
||||||
compound.setInteger("SideToPull", this.sideToPull);
|
|
||||||
compound.setInteger("SlotToPull", this.slotToPullStart);
|
|
||||||
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
|
|
||||||
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
|
|
||||||
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.sideToPut = compound.getInteger("SideToPut");
|
this.sideToPut = compound.getInteger("SideToPut");
|
||||||
|
@ -450,6 +437,19 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
compound.setInteger("SideToPut", this.sideToPut);
|
||||||
|
compound.setInteger("SlotToPut", this.slotToPutStart);
|
||||||
|
compound.setInteger("SlotToPutEnd", this.slotToPutEnd);
|
||||||
|
compound.setInteger("SideToPull", this.sideToPull);
|
||||||
|
compound.setInteger("SlotToPull", this.slotToPullStart);
|
||||||
|
compound.setInteger("SlotToPullEnd", this.slotToPullEnd);
|
||||||
|
compound.setBoolean("PullWhitelist", this.isPullWhitelist);
|
||||||
|
compound.setBoolean("PutWhitelist", this.isPutWhitelist);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == 0;
|
return i == 0;
|
||||||
|
|
|
@ -61,9 +61,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
}
|
}
|
||||||
compound.setTag("Items", tagList);
|
compound.setTag("Items", tagList);
|
||||||
}
|
}
|
||||||
} @Override
|
|
||||||
public int getInventoryStackLimit(){
|
|
||||||
return 64;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -79,6 +76,13 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
return new int[0];
|
return new int[0];
|
||||||
}
|
}
|
||||||
} @Override
|
} @Override
|
||||||
|
public int getInventoryStackLimit(){
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean isUseableByPlayer(EntityPlayer player){
|
public boolean isUseableByPlayer(EntityPlayer player){
|
||||||
return player.getDistanceSq(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) <= 64;
|
return player.getDistanceSq(xCoord+0.5D, yCoord+0.5D, zCoord+0.5D) <= 64;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +139,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInventoryName(){
|
public String getInventoryName(){
|
||||||
return this.name;
|
return this.name;
|
||||||
|
|
|
@ -70,13 +70,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
||||||
return stack != null && stack.getItem().isRepairable();
|
return stack != null && stack.getItem().isRepairable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||||
|
@ -84,6 +77,13 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return i == SLOT_INPUT;
|
return i == SLOT_INPUT;
|
||||||
|
|
|
@ -103,14 +103,6 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
||||||
return this.currentBurnTime*i/ConfigIntValues.OIL_GEN_BURN_TIME.getValue();
|
return this.currentBurnTime*i/ConfigIntValues.OIL_GEN_BURN_TIME.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
this.tank.writeToNBT(compound);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||||
|
@ -119,6 +111,14 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
this.tank.writeToNBT(compound);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, FluidContainerRegistry.BUCKET_VOLUME)) && i == 0;
|
||||||
|
|
|
@ -181,14 +181,6 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
||||||
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
return this.tank.getFluidAmount()*i/this.tank.getCapacity();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
this.storage.writeToNBT(compound);
|
|
||||||
this.tank.writeToNBT(compound);
|
|
||||||
compound.setInteger("CurrentWorkTimer", this.currentWorkTimer);
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
this.storage.readFromNBT(compound);
|
this.storage.readFromNBT(compound);
|
||||||
|
@ -197,6 +189,14 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
this.storage.writeToNBT(compound);
|
||||||
|
this.tank.writeToNBT(compound);
|
||||||
|
compound.setInteger("CurrentWorkTimer", this.currentWorkTimer);
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, 1)) && i == SLOT_OIL_INPUT;
|
return FluidContainerRegistry.containsFluid(stack, new FluidStack(InitBlocks.fluidOil, 1)) && i == SLOT_OIL_INPUT;
|
||||||
|
|
|
@ -130,17 +130,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
return this.range;
|
return this.range;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
if(this.hasBoundPosition()){
|
|
||||||
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
|
||||||
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
|
||||||
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
|
||||||
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
|
@ -154,6 +143,17 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
if(this.hasBoundPosition()){
|
||||||
|
compound.setInteger("XCoordOfTileStored", boundPosition.getX());
|
||||||
|
compound.setInteger("YCoordOfTileStored", boundPosition.getY());
|
||||||
|
compound.setInteger("ZCoordOfTileStored", boundPosition.getZ());
|
||||||
|
compound.setInteger("WorldOfTileStored", boundPosition.getWorld().provider.dimensionId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||||
return false;
|
return false;
|
||||||
|
@ -214,9 +214,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} @Override
|
|
||||||
public boolean isBoundThingInRange(){
|
|
||||||
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -225,6 +222,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
return this.getHandler().fill(from, resource, doFill);
|
return this.getHandler().fill(from, resource, doFill);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
} @Override
|
||||||
|
public boolean isBoundThingInRange(){
|
||||||
|
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -262,6 +262,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TileEntityPhantomEnergyface extends TileEntityPhantomface implements IEnergyHandler{
|
public static class TileEntityPhantomEnergyface extends TileEntityPhantomface implements IEnergyHandler{
|
||||||
|
@ -274,14 +276,40 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
@Override
|
@Override
|
||||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||||
return this.isBoundThingInRange() && this.getReceiver() != null ? this.getReceiver().receiveEnergy(from, maxReceive, simulate) : 0;
|
return this.isBoundThingInRange() && this.getReceiver() != null ? this.getReceiver().receiveEnergy(from, maxReceive, simulate) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||||
|
return this.isBoundThingInRange() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0;
|
||||||
} @Override
|
} @Override
|
||||||
public boolean isBoundThingInRange(){
|
public boolean isBoundThingInRange(){
|
||||||
return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider);
|
return super.isBoundThingInRange() && (this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyReceiver || this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IEnergyProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
public int getEnergyStored(ForgeDirection from){
|
||||||
return this.isBoundThingInRange() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0;
|
if(this.isBoundThingInRange()){
|
||||||
|
if(this.getProvider() != null){
|
||||||
|
return this.getProvider().getEnergyStored(from);
|
||||||
|
}
|
||||||
|
if(this.getReceiver() != null){
|
||||||
|
return this.getReceiver().getEnergyStored(from);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxEnergyStored(ForgeDirection from){
|
||||||
|
if(this.isBoundThingInRange()){
|
||||||
|
if(this.getProvider() != null){
|
||||||
|
return this.getProvider().getMaxEnergyStored(from);
|
||||||
|
}
|
||||||
|
if(this.getReceiver() != null){
|
||||||
|
return this.getReceiver().getMaxEnergyStored(from);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
} @Override
|
} @Override
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
|
@ -298,49 +326,6 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getEnergyStored(ForgeDirection from){
|
|
||||||
if(this.isBoundThingInRange()){
|
|
||||||
if(this.getProvider() != null){
|
|
||||||
return this.getProvider().getEnergyStored(from);
|
|
||||||
}
|
|
||||||
if(this.getReceiver() != null){
|
|
||||||
return this.getReceiver().getEnergyStored(from);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} private void pushEnergy(ForgeDirection side){
|
|
||||||
TileEntity tile = WorldUtil.getTileEntityFromSide(side, worldObj, xCoord, yCoord, zCoord);
|
|
||||||
if(tile != null && tile instanceof IEnergyReceiver && this.getProvider().getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
|
||||||
if(((IEnergyReceiver)tile).canConnectEnergy(side.getOpposite()) && this.canConnectEnergy(side)){
|
|
||||||
int receive = this.extractEnergy(side, Math.min(((IEnergyReceiver)tile).getMaxEnergyStored(ForgeDirection.UNKNOWN)-((IEnergyReceiver)tile).getEnergyStored(ForgeDirection.UNKNOWN), this.getEnergyStored(ForgeDirection.UNKNOWN)), true);
|
|
||||||
int actualReceive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), receive, false);
|
|
||||||
this.extractEnergy(side, actualReceive, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxEnergyStored(ForgeDirection from){
|
|
||||||
if(this.isBoundThingInRange()){
|
|
||||||
if(this.getProvider() != null){
|
|
||||||
return this.getProvider().getMaxEnergyStored(from);
|
|
||||||
}
|
|
||||||
if(this.getReceiver() != null){
|
|
||||||
return this.getReceiver().getMaxEnergyStored(from);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
} public IEnergyProvider getProvider(){
|
|
||||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
|
||||||
TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
|
||||||
if(tile instanceof IEnergyProvider){
|
|
||||||
return (IEnergyProvider)tile;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnergyReceiver getReceiver(){
|
public IEnergyReceiver getReceiver(){
|
||||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||||
TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||||
|
@ -351,10 +336,28 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void pushEnergy(ForgeDirection side){
|
||||||
|
TileEntity tile = WorldUtil.getTileEntityFromSide(side, worldObj, xCoord, yCoord, zCoord);
|
||||||
|
if(tile != null && tile instanceof IEnergyReceiver && this.getProvider().getEnergyStored(ForgeDirection.UNKNOWN) > 0){
|
||||||
|
if(((IEnergyReceiver)tile).canConnectEnergy(side.getOpposite()) && this.canConnectEnergy(side)){
|
||||||
|
int receive = this.extractEnergy(side, Math.min(((IEnergyReceiver)tile).getMaxEnergyStored(ForgeDirection.UNKNOWN)-((IEnergyReceiver)tile).getEnergyStored(ForgeDirection.UNKNOWN), this.getEnergyStored(ForgeDirection.UNKNOWN)), true);
|
||||||
|
int actualReceive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), receive, false);
|
||||||
|
this.extractEnergy(side, actualReceive, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public IEnergyProvider getProvider(){
|
||||||
|
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||||
|
TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||||
|
if(tile instanceof IEnergyProvider){
|
||||||
|
return (IEnergyProvider)tile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -55,18 +55,18 @@ public class TileEntityXPSolidifier extends TileEntityInventoryBase implements I
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNBT(NBTTagCompound compound){
|
|
||||||
super.writeToNBT(compound);
|
|
||||||
compound.setShort("Amount", this.amount);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound compound){
|
public void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
this.amount = compound.getShort("Amount");
|
this.amount = compound.getShort("Amount");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNBT(NBTTagCompound compound){
|
||||||
|
super.writeToNBT(compound);
|
||||||
|
compound.setShort("Amount", this.amount);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -61,13 +61,6 @@ public class ItemUtil{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if list contains stack or if both contain null
|
|
||||||
*/
|
|
||||||
public static boolean contains(List<ItemStack> list, ItemStack stack, boolean checkWildcard){
|
|
||||||
return !(list == null || list.isEmpty()) && getPlaceAt(list.toArray(new ItemStack[list.size()]), stack, checkWildcard) != -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if array contains stack or if both contain null
|
* Returns true if array contains stack or if both contain null
|
||||||
*/
|
*/
|
||||||
|
@ -93,6 +86,13 @@ public class ItemUtil{
|
||||||
return stack1 != null && stack2 != null && (stack1.isItemEqual(stack2) || (checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD)));
|
return stack1 != null && stack2 != null && (stack1.isItemEqual(stack2) || (checkWildcard && stack1.getItem() == stack2.getItem() && (stack1.getItemDamage() == Util.WILDCARD || stack2.getItemDamage() == Util.WILDCARD)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if list contains stack or if both contain null
|
||||||
|
*/
|
||||||
|
public static boolean contains(List<ItemStack> list, ItemStack stack, boolean checkWildcard){
|
||||||
|
return !(list == null || list.isEmpty()) && getPlaceAt(list.toArray(new ItemStack[list.size()]), stack, checkWildcard) != -1;
|
||||||
|
}
|
||||||
|
|
||||||
public static void addEnchantment(ItemStack stack, Enchantment e, int level){
|
public static void addEnchantment(ItemStack stack, Enchantment e, int level){
|
||||||
if(!hasEnchantment(stack, e)){
|
if(!hasEnchantment(stack, e)){
|
||||||
stack.addEnchantment(e, level);
|
stack.addEnchantment(e, level);
|
||||||
|
|
Loading…
Reference in a new issue