mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Cleanup!
This commit is contained in:
parent
21646c9c68
commit
df551d5518
30 changed files with 300 additions and 288 deletions
|
@ -52,10 +52,10 @@ processResources{
|
|||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include 'mcmod.info'
|
||||
|
||||
|
||||
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||
}
|
||||
|
||||
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyStorage}. Use/extend this or implement your own.
|
||||
*
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class EnergyStorage implements IEnergyStorage {
|
||||
|
||||
|
@ -89,7 +89,7 @@ public class EnergyStorage implements IEnergyStorage {
|
|||
/**
|
||||
* This function is included to allow for server -> client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers
|
||||
* are guaranteed to have it.
|
||||
*
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void setEnergyStored(int energy) {
|
||||
|
@ -106,7 +106,7 @@ public class EnergyStorage implements IEnergyStorage {
|
|||
/**
|
||||
* This function is included to allow the containing tile to directly and efficiently modify the energy contained in the EnergyStorage. Do not rely on this
|
||||
* externally, as not all IEnergyHandlers are guaranteed to have it.
|
||||
*
|
||||
*
|
||||
* @param energy
|
||||
*/
|
||||
public void modifyEnergyStored(int energy) {
|
||||
|
|
|
@ -7,9 +7,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||
* accept it; otherwise just use IEnergyHandler.
|
||||
* <p>
|
||||
* Note that {@link IEnergyHandler} is an extension of this.
|
||||
*
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface IEnergyConnection {
|
||||
|
||||
|
|
|
@ -6,15 +6,15 @@ import net.minecraft.item.ItemStack;
|
|||
* Implement this interface on Item classes that support external manipulation of their internal energy storages.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link ItemEnergyContainer}.
|
||||
*
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface IEnergyContainerItem {
|
||||
|
||||
/**
|
||||
* Adds energy to a container item. Returns the quantity of energy that was accepted. This should always return 0 if the item cannot be externally charged.
|
||||
*
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be charged.
|
||||
* @param maxReceive
|
||||
|
@ -28,7 +28,7 @@ public interface IEnergyContainerItem {
|
|||
/**
|
||||
* Removes energy from a container item. Returns the quantity of energy that was removed. This should always return 0 if the item cannot be externally
|
||||
* discharged.
|
||||
*
|
||||
*
|
||||
* @param container
|
||||
* ItemStack to be discharged.
|
||||
* @param maxExtract
|
||||
|
|
|
@ -5,15 +5,15 @@ package cofh.api.energy;
|
|||
* This is not to be implemented on TileEntities. This is for internal use only.
|
||||
* <p>
|
||||
* A reference implementation can be found at {@link EnergyStorage}.
|
||||
*
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*
|
||||
*/
|
||||
public interface IEnergyStorage {
|
||||
|
||||
/**
|
||||
* Adds energy to the storage. Returns quantity of energy that was accepted.
|
||||
*
|
||||
*
|
||||
* @param maxReceive
|
||||
* Maximum amount of energy to be inserted.
|
||||
* @param simulate
|
||||
|
@ -24,7 +24,7 @@ public interface IEnergyStorage {
|
|||
|
||||
/**
|
||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||
*
|
||||
*
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted.
|
||||
* @param simulate
|
||||
|
|
|
@ -6,9 +6,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||
|
||||
/**
|
||||
* Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own.
|
||||
*
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class ItemEnergyContainer extends Item implements IEnergyContainerItem {
|
||||
|
||||
|
|
|
@ -401,6 +401,28 @@ public class GuiBooklet extends GuiScreen{
|
|||
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){
|
||||
if(chapter == null){
|
||||
return;
|
||||
|
@ -432,28 +454,6 @@ public class GuiBooklet extends GuiScreen{
|
|||
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")
|
||||
public void openIndexEntry(BookletIndexEntry entry, int page, boolean 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")
|
||||
@Override
|
||||
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
|
||||
public ItemStack[] getItemStacksForPage(){
|
||||
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)));
|
||||
}
|
||||
|
||||
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
|
||||
public String getName(){
|
||||
return name;
|
||||
|
@ -134,16 +146,4 @@ public class ItemAllToolAA extends ItemTool implements IActAddItemOrBlock{
|
|||
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;
|
||||
}
|
||||
|
||||
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
|
||||
public Class<? extends GuiContainer> getGuiClass(){
|
||||
return GuiGrinder.GuiGrinderDouble.class;
|
||||
public String getGuiTexture(){
|
||||
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture(){
|
||||
return ModUtil.MOD_ID_LOWER+":textures/gui/guiGrinderDouble.png";
|
||||
public void drawExtras(int recipe){
|
||||
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
|
||||
|
@ -157,12 +163,6 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler implements INeiR
|
|||
GuiDraw.changeTexture(getGuiTexture());
|
||||
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{
|
||||
|
|
|
@ -28,10 +28,6 @@ public class CrusherRecipeRegistry{
|
|||
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(){
|
||||
ArrayList<String> oresNoResult = new ArrayList<String>();
|
||||
int recipesAdded = 0;
|
||||
|
@ -88,6 +84,15 @@ public class CrusherRecipeRegistry{
|
|||
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){
|
||||
for(CrusherRecipe recipe : recipes){
|
||||
if(ItemUtil.contains(recipe.getRecipeInputs(), input, true)){
|
||||
|
@ -97,11 +102,6 @@ public class CrusherRecipeRegistry{
|
|||
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){
|
||||
CrusherRecipe recipe = getRecipeFromInput(input);
|
||||
return recipe == null ? null : recipe.getRecipeOutputTwos();
|
||||
|
@ -133,7 +133,9 @@ public class CrusherRecipeRegistry{
|
|||
}
|
||||
|
||||
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);
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -143,7 +145,9 @@ public class CrusherRecipeRegistry{
|
|||
}
|
||||
|
||||
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);
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -153,7 +157,9 @@ public class CrusherRecipeRegistry{
|
|||
}
|
||||
|
||||
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);
|
||||
for(ItemStack stack : stacks){
|
||||
|
@ -169,15 +175,15 @@ public class CrusherRecipeRegistry{
|
|||
int resultAmount;
|
||||
String resultPreString;
|
||||
|
||||
public SearchCase(String theCase, int resultAmount){
|
||||
this(theCase, resultAmount, "dust");
|
||||
}
|
||||
|
||||
public SearchCase(String theCase, int resultAmount, String resultPreString){
|
||||
this.theCase = theCase;
|
||||
this.resultAmount = resultAmount;
|
||||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return this.isPlacer;
|
||||
|
|
|
@ -105,14 +105,6 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.currentProcessTime = compound.getInteger("ProcessTime");
|
||||
|
@ -121,6 +113,14 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IE
|
|||
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
|
||||
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);
|
||||
|
|
|
@ -100,14 +100,6 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
|
@ -116,6 +108,14 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
|
|||
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
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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();
|
||||
}
|
||||
|
||||
@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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
|
@ -159,6 +150,15 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements
|
|||
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
|
||||
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());
|
||||
|
|
|
@ -56,18 +56,18 @@ public class TileEntityCompost extends TileEntityInventoryBase{
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("ConversionTime", this.conversionTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.conversionTime = compound.getInteger("ConversionTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("ConversionTime", this.conversionTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit(){
|
||||
return ConfigIntValues.COMPOST_AMOUNT.getValue();
|
||||
|
|
|
@ -62,18 +62,18 @@ public class TileEntityDropper extends TileEntityInventoryBase{
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.currentTime = compound.getInteger("CurrentTime");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("CurrentTime", this.currentTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.storage.readFromNBT(compound);
|
||||
super.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
this.storage.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("Timer", this.currentTimer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.currentTimer = compound.getInteger("Timer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setInteger("Timer", this.currentTimer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
|
@ -147,6 +139,14 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
|
|||
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
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.firstCrushTime = compound.getInteger("FirstCrushTime");
|
||||
|
@ -231,6 +223,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
|
|||
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
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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();
|
||||
}
|
||||
|
||||
@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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.sideToPut = compound.getInteger("SideToPut");
|
||||
|
@ -450,6 +437,19 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
|||
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
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return i == 0;
|
||||
|
|
|
@ -61,9 +61,6 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
}
|
||||
compound.setTag("Items", tagList);
|
||||
}
|
||||
} @Override
|
||||
public int getInventoryStackLimit(){
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,6 +76,13 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements
|
|||
return new int[0];
|
||||
}
|
||||
} @Override
|
||||
public int getInventoryStackLimit(){
|
||||
return 64;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player){
|
||||
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
|
||||
public String getInventoryName(){
|
||||
return this.name;
|
||||
|
|
|
@ -70,13 +70,6 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.nextRepairTick = compound.getInteger("NextRepairTick");
|
||||
|
@ -84,6 +77,13 @@ public class TileEntityItemRepairer extends TileEntityInventoryBase implements I
|
|||
this.storage.readFromNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("NextRepairTick", this.nextRepairTick);
|
||||
super.writeToNBT(compound);
|
||||
this.storage.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
compound.setInteger("BurnTime", this.currentBurnTime);
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.currentBurnTime = compound.getInteger("BurnTime");
|
||||
|
@ -119,6 +111,14 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
|
|||
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
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
this.storage.writeToNBT(compound);
|
||||
this.tank.writeToNBT(compound);
|
||||
compound.setInteger("CurrentWorkTimer", this.currentWorkTimer);
|
||||
super.writeToNBT(compound);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
this.storage.readFromNBT(compound);
|
||||
|
@ -197,6 +189,14 @@ public class TileEntityOreMagnet extends TileEntityInventoryBase implements IEne
|
|||
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
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
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;
|
||||
}
|
||||
|
||||
@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
|
||||
public void readFromNBT(NBTTagCompound 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
|
||||
public boolean canInsertItem(int slot, ItemStack stack, int side){
|
||||
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
|
||||
|
@ -225,6 +222,9 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
return this.getHandler().fill(from, resource, doFill);
|
||||
}
|
||||
return 0;
|
||||
} @Override
|
||||
public boolean isBoundThingInRange(){
|
||||
return super.isBoundThingInRange() && this.boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ()) instanceof IFluidHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -262,6 +262,8 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static class TileEntityPhantomEnergyface extends TileEntityPhantomface implements IEnergyHandler{
|
||||
|
@ -274,14 +276,40 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
|
||||
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
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
|
||||
return this.isBoundThingInRange() && this.getProvider() != null ? this.getProvider().extractEnergy(from, maxExtract, simulate) : 0;
|
||||
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;
|
||||
}
|
||||
|
||||
@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
|
||||
public void 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(){
|
||||
if(this.boundPosition != null && this.boundPosition.getWorld() != null){
|
||||
TileEntity tile = boundPosition.getWorld().getTileEntity(boundPosition.getX(), boundPosition.getY(), boundPosition.getZ());
|
||||
|
@ -351,10 +336,28 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP
|
|||
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
|
||||
public void readFromNBT(NBTTagCompound compound){
|
||||
super.readFromNBT(compound);
|
||||
this.amount = compound.getShort("Amount");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound compound){
|
||||
super.writeToNBT(compound);
|
||||
compound.setShort("Amount", this.amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack){
|
||||
return false;
|
||||
|
|
|
@ -61,13 +61,6 @@ public class ItemUtil{
|
|||
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
|
||||
*/
|
||||
|
@ -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)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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){
|
||||
if(!hasEnchantment(stack, e)){
|
||||
stack.addEnchantment(e, level);
|
||||
|
|
Loading…
Reference in a new issue