From bbcf9bd05d36d4d2668d0457a26a2f8af3b62a93 Mon Sep 17 00:00:00 2001 From: canitzp Date: Tue, 16 Feb 2016 20:14:28 +0100 Subject: [PATCH 1/3] Updated Forge to 1747 --- .gitignore | 1 + build.gradle | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 5fabe22c3..ae3937ec4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/rebuild.bat /doAllTheThings.bat /.gradle /build diff --git a/build.gradle b/build.gradle index 922d1dfb2..fe7e280ec 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ group = "de.ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" minecraft { - version = "1.8.9-11.15.1.1732" + version = "1.8.9-11.15.1.1747" runDir = "idea" mappings = "stable_20" From 8bdf350a4d002ef2bee02a88ef0b701c3515fa60 Mon Sep 17 00:00:00 2001 From: canitzp Date: Tue, 16 Feb 2016 21:38:11 +0100 Subject: [PATCH 2/3] Updated JEI to 26.0.154 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index fe7e280ec..d0df01af3 100644 --- a/build.gradle +++ b/build.gradle @@ -42,7 +42,7 @@ dependencies { //compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev" //compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev" - deobfCompile "mezz.jei:jei_1.8.9:2.25.6.140" + deobfCompile "mezz.jei:jei_1.8.9:2.26.0.154" } processResources { From 6819c6b34b90ebf5108c153b10483311c50afcd6 Mon Sep 17 00:00:00 2001 From: canitzp Date: Tue, 16 Feb 2016 21:49:44 +0100 Subject: [PATCH 3/3] Updated to the official RF-Api for 1.8 --- src/main/java/cofh/api/CoFHAPIProps.java | 2 +- .../java/cofh/api/energy/EnergyStorage.java | 14 ++++--- .../cofh/api/energy/IEnergyConnection.java | 1 + .../java/cofh/api/energy/IEnergyHandler.java | 37 ++----------------- .../java/cofh/api/energy/IEnergyProvider.java | 13 +------ .../java/cofh/api/energy/IEnergyReceiver.java | 13 +------ .../cofh/api/energy/ItemEnergyContainer.java | 11 ++++-- .../cofh/api/energy/TileEnergyHandler.java | 8 ++-- .../java/cofh/api/energy/package-info.java | 4 +- src/main/java/cofh/api/package-info.java | 5 ++- .../mod/tile/TileEntityPhantomEnergyface.java | 3 +- 11 files changed, 36 insertions(+), 75 deletions(-) diff --git a/src/main/java/cofh/api/CoFHAPIProps.java b/src/main/java/cofh/api/CoFHAPIProps.java index 9b528304a..eb2e05ade 100644 --- a/src/main/java/cofh/api/CoFHAPIProps.java +++ b/src/main/java/cofh/api/CoFHAPIProps.java @@ -6,6 +6,6 @@ public class CoFHAPIProps { } - public static final String VERSION = "1.7.10R1.0.2"; + public static final String VERSION = "1.8.9R1.2.0B1"; } diff --git a/src/main/java/cofh/api/energy/EnergyStorage.java b/src/main/java/cofh/api/energy/EnergyStorage.java index 25e0126ab..dd7dd3e02 100644 --- a/src/main/java/cofh/api/energy/EnergyStorage.java +++ b/src/main/java/cofh/api/energy/EnergyStorage.java @@ -51,29 +51,33 @@ public class EnergyStorage implements IEnergyStorage { return nbt; } - public void setCapacity(int capacity) { + public EnergyStorage setCapacity(int capacity) { this.capacity = capacity; if (energy > capacity) { energy = capacity; } + return this; } - public void setMaxTransfer(int maxTransfer) { + public EnergyStorage setMaxTransfer(int maxTransfer) { setMaxReceive(maxTransfer); setMaxExtract(maxTransfer); + return this; } - public void setMaxReceive(int maxReceive) { + public EnergyStorage setMaxReceive(int maxReceive) { this.maxReceive = maxReceive; + return this; } - public void setMaxExtract(int maxExtract) { + public EnergyStorage setMaxExtract(int maxExtract) { this.maxExtract = maxExtract; + return this; } public int getMaxReceive() { @@ -87,7 +91,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 + * This function is included to allow for server to client sync. Do not call this externally to the containing Tile Entity, as not all IEnergyHandlers * are guaranteed to have it. * * @param energy diff --git a/src/main/java/cofh/api/energy/IEnergyConnection.java b/src/main/java/cofh/api/energy/IEnergyConnection.java index 268721a92..29ef0a1ce 100644 --- a/src/main/java/cofh/api/energy/IEnergyConnection.java +++ b/src/main/java/cofh/api/energy/IEnergyConnection.java @@ -2,6 +2,7 @@ package cofh.api.energy; import net.minecraft.util.EnumFacing; + /** * Implement this interface on TileEntities which should connect to energy transportation blocks. This is intended for blocks which generate energy but do not * accept it; otherwise just use IEnergyHandler. diff --git a/src/main/java/cofh/api/energy/IEnergyHandler.java b/src/main/java/cofh/api/energy/IEnergyHandler.java index 1f8967bea..16b236e7a 100644 --- a/src/main/java/cofh/api/energy/IEnergyHandler.java +++ b/src/main/java/cofh/api/energy/IEnergyHandler.java @@ -6,53 +6,22 @@ import net.minecraft.util.EnumFacing; * Implement this interface on Tile Entities which should handle energy, generally storing it in one or more internal {@link IEnergyStorage} objects. *

* A reference implementation is provided {@link TileEnergyHandler}. + *

+ * Note that {@link IEnergyReceiver} and {@link IEnergyProvider} are extensions of this. * * @author King Lemming * */ -public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { - - // merely a convenience interface (remove these methods in 1.8; provided here for back-compat via compiler doing things) - - /** - * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. - * - * @param from - * Orientation the energy is received from. - * @param maxReceive - * Maximum amount of energy to receive. - * @param simulate - * If TRUE, the charge will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) received. - */ - @Override - int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate); - - /** - * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. - * - * @param from - * Orientation the energy is extracted from. - * @param maxExtract - * Maximum amount of energy to extract. - * @param simulate - * If TRUE, the extraction will only be simulated. - * @return Amount of energy that was (or would have been, if simulated) extracted. - */ - @Override - int extractEnergy(EnumFacing from, int maxExtract, boolean simulate); - +public interface IEnergyHandler extends IEnergyConnection { /** * Returns the amount of energy currently stored. */ - @Override int getEnergyStored(EnumFacing from); /** * Returns the maximum amount of energy that can be stored. */ - @Override int getMaxEnergyStored(EnumFacing from); } diff --git a/src/main/java/cofh/api/energy/IEnergyProvider.java b/src/main/java/cofh/api/energy/IEnergyProvider.java index 584c1ebcf..ef0e09d06 100644 --- a/src/main/java/cofh/api/energy/IEnergyProvider.java +++ b/src/main/java/cofh/api/energy/IEnergyProvider.java @@ -2,6 +2,7 @@ package cofh.api.energy; import net.minecraft.util.EnumFacing; + /** * Implement this interface on Tile Entities which should provide energy, generally storing it in one or more internal {@link IEnergyStorage} objects. *

@@ -10,7 +11,7 @@ import net.minecraft.util.EnumFacing; * @author King Lemming * */ -public interface IEnergyProvider extends IEnergyConnection { +public interface IEnergyProvider extends IEnergyHandler { /** * Remove energy from an IEnergyProvider, internal distribution is left entirely to the IEnergyProvider. @@ -25,14 +26,4 @@ public interface IEnergyProvider extends IEnergyConnection { */ int extractEnergy(EnumFacing from, int maxExtract, boolean simulate); - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(EnumFacing from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(EnumFacing from); - } diff --git a/src/main/java/cofh/api/energy/IEnergyReceiver.java b/src/main/java/cofh/api/energy/IEnergyReceiver.java index 775cc11b6..989e9baa5 100644 --- a/src/main/java/cofh/api/energy/IEnergyReceiver.java +++ b/src/main/java/cofh/api/energy/IEnergyReceiver.java @@ -2,6 +2,7 @@ package cofh.api.energy; import net.minecraft.util.EnumFacing; + /** * Implement this interface on Tile Entities which should receive energy, generally storing it in one or more internal {@link IEnergyStorage} objects. *

@@ -10,7 +11,7 @@ import net.minecraft.util.EnumFacing; * @author King Lemming * */ -public interface IEnergyReceiver extends IEnergyConnection { +public interface IEnergyReceiver extends IEnergyHandler { /** * Add energy to an IEnergyReceiver, internal distribution is left entirely to the IEnergyReceiver. @@ -25,14 +26,4 @@ public interface IEnergyReceiver extends IEnergyConnection { */ int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate); - /** - * Returns the amount of energy currently stored. - */ - int getEnergyStored(EnumFacing from); - - /** - * Returns the maximum amount of energy that can be stored. - */ - int getMaxEnergyStored(EnumFacing from); - } diff --git a/src/main/java/cofh/api/energy/ItemEnergyContainer.java b/src/main/java/cofh/api/energy/ItemEnergyContainer.java index 5fee42639..0fb36dab6 100644 --- a/src/main/java/cofh/api/energy/ItemEnergyContainer.java +++ b/src/main/java/cofh/api/energy/ItemEnergyContainer.java @@ -43,27 +43,30 @@ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { return this; } - public void setMaxTransfer(int maxTransfer) { + public ItemEnergyContainer setMaxTransfer(int maxTransfer) { setMaxReceive(maxTransfer); setMaxExtract(maxTransfer); + return this; } - public void setMaxReceive(int maxReceive) { + public ItemEnergyContainer setMaxReceive(int maxReceive) { this.maxReceive = maxReceive; + return this; } - public void setMaxExtract(int maxExtract) { + public ItemEnergyContainer setMaxExtract(int maxExtract) { this.maxExtract = maxExtract; + return this; } /* IEnergyContainerItem */ @Override public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) { - if (container.getTagCompound() == null) { + if (!container.hasTagCompound()) { container.setTagCompound(new NBTTagCompound()); } int energy = container.getTagCompound().getInteger("Energy"); diff --git a/src/main/java/cofh/api/energy/TileEnergyHandler.java b/src/main/java/cofh/api/energy/TileEnergyHandler.java index 175ee6676..3ba60a664 100644 --- a/src/main/java/cofh/api/energy/TileEnergyHandler.java +++ b/src/main/java/cofh/api/energy/TileEnergyHandler.java @@ -5,12 +5,14 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; /** - * Reference implementation of {@link IEnergyHandler}. Use/extend this or implement your own. + * Reference implementation of {@link IEnergyReceiver} and {@link IEnergyProvider}. Use/extend this or implement your own. + * + * This class is really meant to summarize how each interface is properly used. * * @author King Lemming * */ -public class TileEnergyHandler extends TileEntity implements IEnergyHandler { +public class TileEnergyHandler extends TileEntity implements IEnergyReceiver, IEnergyProvider { protected EnergyStorage storage = new EnergyStorage(32000); @@ -49,7 +51,7 @@ public class TileEnergyHandler extends TileEntity implements IEnergyHandler { return storage.extractEnergy(maxExtract, simulate); } - /* IEnergyReceiver and IEnergyProvider */ + /* IEnergyHandler */ @Override public int getEnergyStored(EnumFacing from) { diff --git a/src/main/java/cofh/api/energy/package-info.java b/src/main/java/cofh/api/energy/package-info.java index 880844fca..da8566735 100644 --- a/src/main/java/cofh/api/energy/package-info.java +++ b/src/main/java/cofh/api/energy/package-info.java @@ -1,10 +1,10 @@ /** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub + * (C) 2014-2016 Team CoFH / CoFH / Cult of the Full Hub * http://www.teamcofh.com */ @API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHAPI", provides = "CoFHAPI|energy") package cofh.api.energy; -import cofh.api.CoFHAPIProps; import net.minecraftforge.fml.common.API; +import cofh.api.CoFHAPIProps; diff --git a/src/main/java/cofh/api/package-info.java b/src/main/java/cofh/api/package-info.java index 25e1ecc5d..e2847daad 100644 --- a/src/main/java/cofh/api/package-info.java +++ b/src/main/java/cofh/api/package-info.java @@ -1,8 +1,9 @@ /** - * (C) 2014 Team CoFH / CoFH / Cult of the Full Hub + * (C) 2014-2016 Team CoFH / CoFH / Cult of the Full Hub * http://www.teamcofh.com */ @API(apiVersion = CoFHAPIProps.VERSION, owner = "CoFHLib", provides = "CoFHAPI") package cofh.api; -import net.minecraftforge.fml.common.API; \ No newline at end of file +import net.minecraftforge.fml.common.API; + diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java index 7d4599288..4c740631c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomEnergyface.java @@ -10,7 +10,6 @@ package de.ellpeck.actuallyadditions.mod.tile; -import cofh.api.energy.IEnergyHandler; import cofh.api.energy.IEnergyProvider; import cofh.api.energy.IEnergyReceiver; import de.ellpeck.actuallyadditions.mod.blocks.BlockPhantom; @@ -18,7 +17,7 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -public class TileEntityPhantomEnergyface extends TileEntityPhantomface implements IEnergyHandler{ +public class TileEntityPhantomEnergyface extends TileEntityPhantomface implements IEnergyReceiver, IEnergyProvider{ public TileEntityPhantomEnergyface(){ super("energyface");