diff --git a/build.gradle b/build.gradle index f8b87bd8..34e6002a 100644 --- a/build.gradle +++ b/build.gradle @@ -5,16 +5,27 @@ buildscript { name = "forge" url = "http://files.minecraftforge.net/maven" } + maven { + name = "gt" + url = "https://gregtech.overminddl1.com/" + } maven { name = "sonatype" url = "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { + url = "https://jitpack.io" + } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:1.2-SNAPSHOT' + classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.11' } } +plugins { + id 'idea' +} + apply plugin: 'forge' ext.buildnumber="" @@ -33,17 +44,25 @@ minecraft { repositories { maven { - name = "chickenbones" - url = "http://chickenbones.net/maven/" + name 'Overmind forge repo mirror' + url 'https://gregtech.overminddl1.com/' + } + maven { + name = "OpenComputers mirror for ChickenBones mods" + url = "https://maven.cil.li/" + metadataSources { + mavenPom() + artifact() + } } } dependencies { - compile fileTree(dir: 'libs', include: '*.jar') + compileOnly fileTree(dir: 'libs', include: '*.jar') - compile "codechicken:CodeChickenLib:${minecraft_version}-1.1.3.127:dev" - compile "codechicken:CodeChickenCore:${minecraft_version}-1.0.4.35:dev" - compile "codechicken:NotEnoughItems:${minecraft_version}-1.0.4.90:dev" + compileOnly "codechicken:CodeChickenLib:${minecraft_version}-1.1.3.136:dev" + compileOnly "codechicken:CodeChickenCore:${minecraft_version}-1.0.4.35:dev" + compileOnly "codechicken:NotEnoughItems:${minecraft_version}-1.0.4.107:dev" } processResources { @@ -70,6 +89,13 @@ processResources { } } +runClient { + jvmArgs '-Dfml.coreMods.load=mariculture.fishery.VanillaOverride' +} +runServer { + jvmArgs '-Dfml.coreMods.load=mariculture.fishery.VanillaOverride' +} + jar { manifest { attributes 'FMLCorePlugin': 'mariculture.fishery.VanillaOverride' @@ -118,4 +144,11 @@ artifacts { archives marinotechJar archives deobfJar archives sourceJar -} \ No newline at end of file +} + +// this is needed for IntelliJ so we don't have to copy over the assets manually every time +idea { + module { + inheritOutputDirs = true + } +} diff --git a/gradle.properties b/gradle.properties index 7977c219..c82a6c2d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,3 @@ minecraft_version=1.7.10 -forge_version=10.13.2.1291 -mod_version=1.2.4.2a \ No newline at end of file +forge_version=10.13.4.1614-1.7.10 +mod_version=1.2.5.0 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b7612167..fd7e590e 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 678d9d8d..02e638ce 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jul 02 15:54:47 CDT 2014 +#Mon Sep 14 16:20:35 CEST 2015 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/api/java/cofh/api/CoFHAPIProps.java b/src/api/java/cofh/api/CoFHAPIProps.java index 9b528304..5d21f636 100644 --- a/src/api/java/cofh/api/CoFHAPIProps.java +++ b/src/api/java/cofh/api/CoFHAPIProps.java @@ -6,6 +6,6 @@ private CoFHAPIProps() { } - public static final String VERSION = "1.7.10R1.0.2"; + public static final String VERSION = "1.7.10R1.3.1"; } diff --git a/src/api/java/cofh/api/energy/EnergyStorage.java b/src/api/java/cofh/api/energy/EnergyStorage.java index 1674c189..25e0126a 100644 --- a/src/api/java/cofh/api/energy/EnergyStorage.java +++ b/src/api/java/cofh/api/energy/EnergyStorage.java @@ -4,9 +4,9 @@ /** * 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 int getMaxExtract() { /** * 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 void setEnergyStored(int energy) { /** * 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) { diff --git a/src/api/java/cofh/api/energy/IEnergyConnection.java b/src/api/java/cofh/api/energy/IEnergyConnection.java index 79bdf77a..301271e5 100644 --- a/src/api/java/cofh/api/energy/IEnergyConnection.java +++ b/src/api/java/cofh/api/energy/IEnergyConnection.java @@ -7,9 +7,9 @@ * accept it; otherwise just use IEnergyHandler. *

* Note that {@link IEnergyHandler} is an extension of this. - * + * * @author King Lemming - * + * */ public interface IEnergyConnection { diff --git a/src/api/java/cofh/api/energy/IEnergyContainerItem.java b/src/api/java/cofh/api/energy/IEnergyContainerItem.java index c28455b1..3ef72576 100644 --- a/src/api/java/cofh/api/energy/IEnergyContainerItem.java +++ b/src/api/java/cofh/api/energy/IEnergyContainerItem.java @@ -6,15 +6,15 @@ * Implement this interface on Item classes that support external manipulation of their internal energy storages. *

* 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 diff --git a/src/api/java/cofh/api/energy/IEnergyHandler.java b/src/api/java/cofh/api/energy/IEnergyHandler.java index 22f2dbc6..6a4600a4 100644 --- a/src/api/java/cofh/api/energy/IEnergyHandler.java +++ b/src/api/java/cofh/api/energy/IEnergyHandler.java @@ -42,7 +42,6 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { @Override int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - /** * Returns the amount of energy currently stored. */ diff --git a/src/api/java/cofh/api/energy/IEnergyStorage.java b/src/api/java/cofh/api/energy/IEnergyStorage.java index bc206560..414b2656 100644 --- a/src/api/java/cofh/api/energy/IEnergyStorage.java +++ b/src/api/java/cofh/api/energy/IEnergyStorage.java @@ -5,15 +5,15 @@ * This is not to be implemented on TileEntities. This is for internal use only. *

* 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 diff --git a/src/api/java/cofh/api/energy/IEnergyTransport.java b/src/api/java/cofh/api/energy/IEnergyTransport.java new file mode 100644 index 00000000..ab45e04f --- /dev/null +++ b/src/api/java/cofh/api/energy/IEnergyTransport.java @@ -0,0 +1,109 @@ +package cofh.api.energy; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Implement this interface on Tile Entities which transport energy. + *

+ * This is used to "negotiate" connection types between two separate IEnergyTransports, allowing users to set flow direction and allowing for networks Of + * IEnergyTransports to intelligently transfer energy to other networks. + */ +public interface IEnergyTransport extends IEnergyProvider, IEnergyReceiver { + + /** + * The type of interface for a given side of a {@link IEnergyTransport}. + *

+ * Values are:
+ * {@link SEND} for sending only
+ * {@link RECEIVE} for receiving only
+ * {@link BALANCE} for sending and receiving, and the default state + */ + public enum InterfaceType { + /** + * Indicates that this {@link IEnergyTransport} is only sending power on this side. + */ + SEND, + /** + * Indicates that this {@link IEnergyTransport} is only receiving power on this side. + */ + RECEIVE, + /** + * Indicates that this {@link IEnergyTransport} wants to balance power between itself and the + * senders/receivers on this side. This is the default state.
+ * To block any connection, use {@link IEnergyConnection#canConnectEnergy} + *

+ * IEnergyTransport based senders should check that the total power in the destination IEnergyTransport is less than the power in themselves before sending. + *
+ * Active IEnergyTransport receivers (i.e., those that call {@link IEnergyProvider#extractEnergy}) should check that they contain less power than the + * source IEnergyTransport. + */ + BALANCE; + + /** + * Returns the opposite state to this InterfaceType. + *

+ * {@link #BALANCE} is considered its own opposite.
+ * {@link #SEND} is the opposite of {@link #RECEIVE} and visa versa. + */ + public InterfaceType getOpposite() { + + return this == BALANCE ? BALANCE : this == SEND ? RECEIVE : SEND; + } + + /** + * Returns the next InterfaceType as described in {@link IEnergyTransport#getTransportState} + */ + public InterfaceType rotate() { + + return rotate(true); + } + + /** + * Returns the next InterfaceType as described in {@link IEnergyTransport#getTransportState} + * + * @param forward + * Whether to step in the order specified by {@link IEnergyTransport#getTransportState} (true) or to step in the opposite direction + */ + public InterfaceType rotate(boolean forward) { + + if (forward) { + return this == BALANCE ? RECEIVE : this == RECEIVE ? SEND : BALANCE; + } else { + return this == BALANCE ? SEND : this == SEND ? RECEIVE : BALANCE; + } + } + } + + /** + * {@inheritDoc}
+ * This method cannot be a no-op for IEnergyTransport. + */ + @Override + int getEnergyStored(ForgeDirection from); + + /** + * Indicates to other IEnergyTransports the state of the given side. See {@link #InterfaceType} for details. + *

+ * For clarity of state tracking, on a tile update from another IEnergyTransport, if its mode has changed from the opposite of your own mode on that side, you + * should change your mode to the opposite of its mode. + *

+ * When the user alters your mode and your state is:
+ * BALANCE, your mode should change to {@link InterFaceType#RECEIVE}.
+ * RECEIVE, your mode should change to {@link InterFaceType#SEND}.
+ * SEND, your mode should change to {@link InterFaceType#BALANCE}.
+ * This is not required, but will be easier for users. + * + * @return The type of connection to establish on this side. null is NOT a valid value + */ + InterfaceType getTransportState(ForgeDirection from); + + /** + * This method is provided primarily for the purposes of automation tools, and should not need to be called by another IEnergyTransport. + *

+ * Calls to this method may fail if this IEnergyTransport has been secured by a user. + * + * @return Whether or not state was successfully altered. + */ + boolean setTransportState(InterfaceType state, ForgeDirection from); + +} diff --git a/src/api/java/cofh/api/energy/ItemEnergyContainer.java b/src/api/java/cofh/api/energy/ItemEnergyContainer.java index 055ae45b..2d3659cb 100644 --- a/src/api/java/cofh/api/energy/ItemEnergyContainer.java +++ b/src/api/java/cofh/api/energy/ItemEnergyContainer.java @@ -6,9 +6,9 @@ /** * Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { diff --git a/src/main/java/cofh/api/CoFHAPIProps.java b/src/main/java/cofh/api/CoFHAPIProps.java index 9b528304..5d21f636 100644 --- a/src/main/java/cofh/api/CoFHAPIProps.java +++ b/src/main/java/cofh/api/CoFHAPIProps.java @@ -6,6 +6,6 @@ private CoFHAPIProps() { } - public static final String VERSION = "1.7.10R1.0.2"; + public static final String VERSION = "1.7.10R1.3.1"; } diff --git a/src/main/java/cofh/api/energy/EnergyStorage.java b/src/main/java/cofh/api/energy/EnergyStorage.java index 1674c189..25e0126a 100644 --- a/src/main/java/cofh/api/energy/EnergyStorage.java +++ b/src/main/java/cofh/api/energy/EnergyStorage.java @@ -4,9 +4,9 @@ /** * 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 int getMaxExtract() { /** * 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 void setEnergyStored(int energy) { /** * 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) { diff --git a/src/main/java/cofh/api/energy/IEnergyConnection.java b/src/main/java/cofh/api/energy/IEnergyConnection.java index 79bdf77a..301271e5 100644 --- a/src/main/java/cofh/api/energy/IEnergyConnection.java +++ b/src/main/java/cofh/api/energy/IEnergyConnection.java @@ -7,9 +7,9 @@ * accept it; otherwise just use IEnergyHandler. *

* Note that {@link IEnergyHandler} is an extension of this. - * + * * @author King Lemming - * + * */ public interface IEnergyConnection { diff --git a/src/main/java/cofh/api/energy/IEnergyContainerItem.java b/src/main/java/cofh/api/energy/IEnergyContainerItem.java index c28455b1..3ef72576 100644 --- a/src/main/java/cofh/api/energy/IEnergyContainerItem.java +++ b/src/main/java/cofh/api/energy/IEnergyContainerItem.java @@ -6,15 +6,15 @@ * Implement this interface on Item classes that support external manipulation of their internal energy storages. *

* 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 diff --git a/src/main/java/cofh/api/energy/IEnergyHandler.java b/src/main/java/cofh/api/energy/IEnergyHandler.java index 22f2dbc6..6a4600a4 100644 --- a/src/main/java/cofh/api/energy/IEnergyHandler.java +++ b/src/main/java/cofh/api/energy/IEnergyHandler.java @@ -42,7 +42,6 @@ public interface IEnergyHandler extends IEnergyProvider, IEnergyReceiver { @Override int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate); - /** * Returns the amount of energy currently stored. */ diff --git a/src/main/java/cofh/api/energy/IEnergyStorage.java b/src/main/java/cofh/api/energy/IEnergyStorage.java index bc206560..414b2656 100644 --- a/src/main/java/cofh/api/energy/IEnergyStorage.java +++ b/src/main/java/cofh/api/energy/IEnergyStorage.java @@ -5,15 +5,15 @@ * This is not to be implemented on TileEntities. This is for internal use only. *

* 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 diff --git a/src/main/java/cofh/api/energy/IEnergyTransport.java b/src/main/java/cofh/api/energy/IEnergyTransport.java new file mode 100644 index 00000000..ab45e04f --- /dev/null +++ b/src/main/java/cofh/api/energy/IEnergyTransport.java @@ -0,0 +1,109 @@ +package cofh.api.energy; + +import net.minecraftforge.common.util.ForgeDirection; + +/** + * Implement this interface on Tile Entities which transport energy. + *

+ * This is used to "negotiate" connection types between two separate IEnergyTransports, allowing users to set flow direction and allowing for networks Of + * IEnergyTransports to intelligently transfer energy to other networks. + */ +public interface IEnergyTransport extends IEnergyProvider, IEnergyReceiver { + + /** + * The type of interface for a given side of a {@link IEnergyTransport}. + *

+ * Values are:
+ * {@link SEND} for sending only
+ * {@link RECEIVE} for receiving only
+ * {@link BALANCE} for sending and receiving, and the default state + */ + public enum InterfaceType { + /** + * Indicates that this {@link IEnergyTransport} is only sending power on this side. + */ + SEND, + /** + * Indicates that this {@link IEnergyTransport} is only receiving power on this side. + */ + RECEIVE, + /** + * Indicates that this {@link IEnergyTransport} wants to balance power between itself and the + * senders/receivers on this side. This is the default state.
+ * To block any connection, use {@link IEnergyConnection#canConnectEnergy} + *

+ * IEnergyTransport based senders should check that the total power in the destination IEnergyTransport is less than the power in themselves before sending. + *
+ * Active IEnergyTransport receivers (i.e., those that call {@link IEnergyProvider#extractEnergy}) should check that they contain less power than the + * source IEnergyTransport. + */ + BALANCE; + + /** + * Returns the opposite state to this InterfaceType. + *

+ * {@link #BALANCE} is considered its own opposite.
+ * {@link #SEND} is the opposite of {@link #RECEIVE} and visa versa. + */ + public InterfaceType getOpposite() { + + return this == BALANCE ? BALANCE : this == SEND ? RECEIVE : SEND; + } + + /** + * Returns the next InterfaceType as described in {@link IEnergyTransport#getTransportState} + */ + public InterfaceType rotate() { + + return rotate(true); + } + + /** + * Returns the next InterfaceType as described in {@link IEnergyTransport#getTransportState} + * + * @param forward + * Whether to step in the order specified by {@link IEnergyTransport#getTransportState} (true) or to step in the opposite direction + */ + public InterfaceType rotate(boolean forward) { + + if (forward) { + return this == BALANCE ? RECEIVE : this == RECEIVE ? SEND : BALANCE; + } else { + return this == BALANCE ? SEND : this == SEND ? RECEIVE : BALANCE; + } + } + } + + /** + * {@inheritDoc}
+ * This method cannot be a no-op for IEnergyTransport. + */ + @Override + int getEnergyStored(ForgeDirection from); + + /** + * Indicates to other IEnergyTransports the state of the given side. See {@link #InterfaceType} for details. + *

+ * For clarity of state tracking, on a tile update from another IEnergyTransport, if its mode has changed from the opposite of your own mode on that side, you + * should change your mode to the opposite of its mode. + *

+ * When the user alters your mode and your state is:
+ * BALANCE, your mode should change to {@link InterFaceType#RECEIVE}.
+ * RECEIVE, your mode should change to {@link InterFaceType#SEND}.
+ * SEND, your mode should change to {@link InterFaceType#BALANCE}.
+ * This is not required, but will be easier for users. + * + * @return The type of connection to establish on this side. null is NOT a valid value + */ + InterfaceType getTransportState(ForgeDirection from); + + /** + * This method is provided primarily for the purposes of automation tools, and should not need to be called by another IEnergyTransport. + *

+ * Calls to this method may fail if this IEnergyTransport has been secured by a user. + * + * @return Whether or not state was successfully altered. + */ + boolean setTransportState(InterfaceType state, ForgeDirection from); + +} diff --git a/src/main/java/cofh/api/energy/ItemEnergyContainer.java b/src/main/java/cofh/api/energy/ItemEnergyContainer.java index 055ae45b..2d3659cb 100644 --- a/src/main/java/cofh/api/energy/ItemEnergyContainer.java +++ b/src/main/java/cofh/api/energy/ItemEnergyContainer.java @@ -6,9 +6,9 @@ /** * Reference implementation of {@link IEnergyContainerItem}. Use/extend this or implement your own. - * + * * @author King Lemming - * + * */ public class ItemEnergyContainer extends Item implements IEnergyContainerItem { diff --git a/src/main/java/mariculture/core/config/FishMechanics.java b/src/main/java/mariculture/core/config/FishMechanics.java index ebcf52fa..2519277c 100644 --- a/src/main/java/mariculture/core/config/FishMechanics.java +++ b/src/main/java/mariculture/core/config/FishMechanics.java @@ -19,6 +19,8 @@ public class FishMechanics { public static boolean FIX_FISH; public static double SPEED_MULTIPLIER; public static boolean SQUID_DROP_CALAMARI; + + public static boolean EXTRA_FISH_BREEDING_RECIPES; public static void init(Configuration config) { setConfig(config); @@ -34,7 +36,7 @@ public static void init(Configuration config) { FishMechanics.FIX_FISH = getBoolean("Fix Fish", true, "Will automatically fix any broken fish in a fish feeder. Disable once your fish are fixed. As this can make the fish feeder laggier."); FishMechanics.SPEED_MULTIPLIER = getInt("Give me fish NAOW", 50, "Increasing this gives you faster fishing overall, Set to 0 for normal speed"); FishMechanics.SQUID_DROP_CALAMARI = getBoolean("Squid Drop Calamari", true); - + FishMechanics.EXTRA_FISH_BREEDING_RECIPES = getBoolean("Extra Fish Breeding Recipes (Whitemargin Stargazer and Perch)", false); setCategory("Less Fussy Fish"); FussyFish.IGNORE_ALL_REQUIREMENTS = getBoolean("Ignore All Requirements", false, "Setting this to true, will mean fish will work under any conditions"); diff --git a/src/main/java/mariculture/core/gui/GuiCrucible.java b/src/main/java/mariculture/core/gui/GuiCrucible.java index b9f21c66..111e49b3 100644 --- a/src/main/java/mariculture/core/gui/GuiCrucible.java +++ b/src/main/java/mariculture/core/gui/GuiCrucible.java @@ -61,7 +61,7 @@ public void addItemToolTip(ItemStack stack, List currenttip) { if (result.rands != null) { currenttip.add(Text.INDIGO + MCTranslate.translate("randomMetal")); } else { - currenttip.add(Text.INDIGO + FluidHelper.getName(result.fluid.getFluid()) + ": " + result.fluid.amount + "mB"); + currenttip.add(Text.INDIGO + FluidHelper.getName(result.fluid) + ": " + result.fluid.amount + "mB"); } } diff --git a/src/main/java/mariculture/core/gui/feature/FeatureTank.java b/src/main/java/mariculture/core/gui/feature/FeatureTank.java index a6fa8689..724d468a 100644 --- a/src/main/java/mariculture/core/gui/feature/FeatureTank.java +++ b/src/main/java/mariculture/core/gui/feature/FeatureTank.java @@ -2,6 +2,8 @@ import java.util.List; +import org.lwjgl.opengl.GL11; + import mariculture.core.gui.GuiMariculture; import mariculture.core.util.ITank; import net.minecraft.client.renderer.texture.TextureMap; @@ -81,6 +83,11 @@ public void draw(GuiMariculture gui, int x, int y, int mouseX, int mouseY) { } tm.bindTexture(texture); + int colour = fluid.getColor(liquid); + float red = (colour >> 16 & 255) / 255.0F; + float green = (colour >> 8 & 255) / 255.0F; + float blue = (colour & 255) / 255.0F; + GL11.glColor3f(red, green, blue); int width = size.equals(TankSize.DOUBLE) ? 34 : 16; int xStart = size.equals(TankSize.DOUBLE) ? 16 : 0; gui.drawTexturedModalRect(x + xPoz, y + yPoz, xStart, 0, width, 60); diff --git a/src/main/java/mariculture/core/helpers/FluidHelper.java b/src/main/java/mariculture/core/helpers/FluidHelper.java index ac246286..a2d686dd 100644 --- a/src/main/java/mariculture/core/helpers/FluidHelper.java +++ b/src/main/java/mariculture/core/helpers/FluidHelper.java @@ -197,11 +197,11 @@ public static boolean matches(ItemStack top, ItemStack bottom, ItemStack result) return bottom.isItemEqual(result) && bottom.stackSize < 64 && bottom.stackSize < bottom.getMaxStackSize(); } - public static String getName(Fluid fluid) { - if (fluid == null) return null; + public static String getName(FluidStack fluidStack) { + if (fluidStack == null || fluidStack.getFluid() == null) return null; - if (fluid.getID() > 0) { - String name = fluid.getLocalizedName(); + if (fluidStack.getFluid().getID() > 0) { + String name = fluidStack.getLocalizedName(); if (name.startsWith("fluid.")) { name = name.substring(6); if (name.startsWith("tile.")) { diff --git a/src/main/java/mariculture/core/network/PacketAirPump.java b/src/main/java/mariculture/core/network/PacketAirPump.java index 4135ddbf..b58aafc2 100644 --- a/src/main/java/mariculture/core/network/PacketAirPump.java +++ b/src/main/java/mariculture/core/network/PacketAirPump.java @@ -5,6 +5,7 @@ import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.MessageContext; +import net.minecraft.tileentity.TileEntity; public class PacketAirPump extends PacketCoords implements IMessageHandler { public PacketAirPump() {} @@ -15,7 +16,10 @@ public PacketAirPump(int x, int y, int z) { @Override public IMessage onMessage(PacketCoords message, MessageContext ctx) { - ((TileAirPump) ClientHelper.getPlayer().worldObj.getTileEntity(message.x, message.y, message.z)).isAnimating = true; + TileEntity tile = ClientHelper.getPlayer().worldObj.getTileEntity(message.x, message.y, message.z); + if (tile instanceof TileAirPump) { + ((TileAirPump) tile).isAnimating = true; + } return null; } } diff --git a/src/main/java/mariculture/core/network/PacketClick.java b/src/main/java/mariculture/core/network/PacketClick.java index c557290e..a4ed516d 100644 --- a/src/main/java/mariculture/core/network/PacketClick.java +++ b/src/main/java/mariculture/core/network/PacketClick.java @@ -32,7 +32,7 @@ public void fromBytes(ByteBuf buffer) { @Override public IMessage onMessage(PacketClick message, MessageContext ctx) { TileEntity tile = ctx.getServerHandler().playerEntity.worldObj.getTileEntity(message.x, message.y, message.z); - if (tile != null && tile instanceof IHasClickableButton) { + if (tile instanceof IHasClickableButton) { ((IHasClickableButton) tile).handleButtonClick(message.id); } diff --git a/src/main/java/mariculture/core/network/PacketEnchant.java b/src/main/java/mariculture/core/network/PacketEnchant.java index d2fa9c5e..5f76c561 100644 --- a/src/main/java/mariculture/core/network/PacketEnchant.java +++ b/src/main/java/mariculture/core/network/PacketEnchant.java @@ -33,7 +33,7 @@ public void fromBytes(ByteBuf buffer) { @Override public IMessage onMessage(PacketEnchant message, MessageContext ctx) { EntityPlayer player = ctx.getServerHandler().playerEntity; - if (player.openContainer.windowId == message.windowID && player.openContainer.isPlayerNotUsingContainer(player)) { + if (player.openContainer != null && player.openContainer.windowId == message.windowID && player.openContainer.isPlayerNotUsingContainer(player)) { ContainerMirror mirror = (ContainerMirror) player.openContainer; mirror.windowId = message.windowID; mirror.enchantItem(player, message.level); diff --git a/src/main/java/mariculture/core/network/PacketGUIUpdate.java b/src/main/java/mariculture/core/network/PacketGUIUpdate.java index 47d917ab..b127236b 100644 --- a/src/main/java/mariculture/core/network/PacketGUIUpdate.java +++ b/src/main/java/mariculture/core/network/PacketGUIUpdate.java @@ -49,7 +49,7 @@ public void toBytes(ByteBuf buf) { @Override public IMessage onMessage(PacketGUIUpdate message, MessageContext ctx) { EntityPlayer player = ClientHelper.getPlayer(); - if (player.openContainer.windowId == message.id && player.openContainer.isPlayerNotUsingContainer(player)) { + if (player.openContainer != null && player.openContainer.windowId == message.id && player.openContainer.isPlayerNotUsingContainer(player)) { if (player.openContainer instanceof ContainerMariculture) { ContainerMariculture container = (ContainerMariculture) player.openContainer; for (int i = 0; i < message.size; i++) { diff --git a/src/main/java/mariculture/core/network/PacketInventorySync.java b/src/main/java/mariculture/core/network/PacketInventorySync.java index 10c7785c..edb0d173 100644 --- a/src/main/java/mariculture/core/network/PacketInventorySync.java +++ b/src/main/java/mariculture/core/network/PacketInventorySync.java @@ -28,17 +28,17 @@ public IMessage onMessage(PacketNBT message, MessageContext ctx) { int length = message.nbt.getInteger("length"); TileEntity tile = world.getTileEntity(x, y, z); + if (!(tile instanceof IInventory)) return null; ItemStack[] inventory = new ItemStack[length]; - IInventory block = (IInventory) world.getTileEntity(x, y, z); - if (block == null || tile == null) return null; + IInventory tileInventory = (IInventory) tile; NBTTagList tagList = message.nbt.getTagList("Inventory", 10); for (int i = 0; i < tagList.tagCount(); i++) { NBTTagCompound tag = tagList.getCompoundTagAt(i); byte slot = tag.getByte("Slot"); - if (tag.getBoolean("NULLItemStack") == true) { - block.setInventorySlotContents(slot, null); + if (tag.getBoolean("NULLItemStack")) { + tileInventory.setInventorySlotContents(slot, null); } else if (slot >= 0 && slot < inventory.length) { - block.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tag)); + tileInventory.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tag)); } } diff --git a/src/main/java/mariculture/core/network/PacketOrientationSync.java b/src/main/java/mariculture/core/network/PacketOrientationSync.java index 55eb910a..bbf9756d 100644 --- a/src/main/java/mariculture/core/network/PacketOrientationSync.java +++ b/src/main/java/mariculture/core/network/PacketOrientationSync.java @@ -4,6 +4,7 @@ import mariculture.core.util.IFaceable; import mariculture.lib.helpers.ClientHelper; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.util.ForgeDirection; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; @@ -34,8 +35,9 @@ public void fromBytes(ByteBuf buffer) { @Override public IMessage onMessage(PacketOrientationSync message, MessageContext ctx) { EntityPlayer player = ClientHelper.getPlayer(); - if (player.worldObj.getTileEntity(message.x, message.y, message.z) instanceof IFaceable) { - ((IFaceable) player.worldObj.getTileEntity(message.x, message.y, message.z)).setFacing(message.dir); + TileEntity tile = player.worldObj.getTileEntity(message.x, message.y, message.z); + if (tile instanceof IFaceable) { + ((IFaceable) tile).setFacing(message.dir); ClientHelper.updateRender(message.x, message.y, message.z); } diff --git a/src/main/java/mariculture/core/util/Tank.java b/src/main/java/mariculture/core/util/Tank.java index c745c0c9..2821cd01 100644 --- a/src/main/java/mariculture/core/util/Tank.java +++ b/src/main/java/mariculture/core/util/Tank.java @@ -61,7 +61,7 @@ public void setFluidAmount(int amount) { public int getFluidID() { if (fluid == null) return -1; - return fluid.fluidID; + return fluid.getFluidID(); } public void setFluidID(int id) { diff --git a/src/main/java/mariculture/fishery/Fish.java b/src/main/java/mariculture/fishery/Fish.java index a4a71841..c61472c3 100644 --- a/src/main/java/mariculture/fishery/Fish.java +++ b/src/main/java/mariculture/fishery/Fish.java @@ -9,6 +9,7 @@ import mariculture.api.fishery.fish.FishDNABase; import mariculture.api.fishery.fish.FishSpecies; import mariculture.core.Core; +import mariculture.core.config.FishMechanics; import mariculture.core.helpers.RecipeHelper; import mariculture.core.lib.FoodMeta; import mariculture.core.lib.MCLib; @@ -331,6 +332,11 @@ private static void addMutations() { Fishing.mutation.addMutation(cod, minnow, gold, 25D); Fishing.mutation.addMutation(stingRay, cod, damsel, 10D); Fishing.mutation.addMutation(stingRay, minnow, tetra, 10D); + if (FishMechanics.EXTRA_FISH_BREEDING_RECIPES) { + Fishing.mutation.addMutation(spider, blaasop, stargazer, 7.5); + Fishing.mutation.addMutation(night, blaasop, stargazer, 7.5); + Fishing.mutation.addMutation(damsel, gold, perch, 10.0); + } } private static void addRecipe(FishSpecies species) { diff --git a/src/main/java/mariculture/magic/JewelryHandler.java b/src/main/java/mariculture/magic/JewelryHandler.java index 319edbc3..44c8f466 100644 --- a/src/main/java/mariculture/magic/JewelryHandler.java +++ b/src/main/java/mariculture/magic/JewelryHandler.java @@ -93,6 +93,10 @@ public static int getLevel(JewelryType type, JewelryMaterial mat, JewelryBinding } public static boolean canApply(ItemStack stack) { + if (stack == null) { + return true; + } + if (Enchantments.DISABLE_BOOKS_ON_PEARLS) { if (stack.getItem() == Core.pearls) { return false; diff --git a/src/main/java/maritech/extensions/modules/ExtensionFishery.java b/src/main/java/maritech/extensions/modules/ExtensionFishery.java index 97060904..de547ae3 100644 --- a/src/main/java/maritech/extensions/modules/ExtensionFishery.java +++ b/src/main/java/maritech/extensions/modules/ExtensionFishery.java @@ -62,7 +62,7 @@ public void init() { ItemStack turbine = Modules.isActive(Modules.factory)? asStack(ExtensionFactory.turbineTitanium): MCLib.ironWheel; ItemStack gold = Modules.isActive(Modules.factory)? MTLib.goldPlastic: goldSilk; addShaped(MTLib.extractor, new Object[] { " H ", "PSP", "TBT", 'H', life, 'P', titaniumRod, 'S', Fishery.scanner, 'T', turbine, 'B', "blockTitanium" }); - addShaped(MTLib.injector, new Object[] { " S ", "GTG", "BEB", 'S', scuba, 'G', gold, 'T', thermometer, 'B', ExtensionCore.batteryTitanium, 'E', MTLib.extractor }); + addShaped(MTLib.injector, new Object[] { " S ", "GTG", "BEB", 'S', scuba, 'G', gold, 'T', thermometer, 'B', MTLib.titaniumBattery, 'E', MTLib.extractor }); Fishing.fishing.registerRod(rodFlux, RodType.FLUX); }