mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-26 14:53:05 +00:00
Update for 1.11. Missing assets, unstable.
This commit is contained in:
1 parent
30d7365518
commit
9611ae08ae
1145 files changed
+15561
-18107
No files matched your search
+1
-1
@@ -63,7 +63,7 @@ dependencies {
|
||||
deobfCompile "net.darkhax.tesla:Tesla:${tesla_version}"
|
||||
deobfCompile "mezz.jei:jei_${mcversion}:${jei_version}:api"
|
||||
runtime "mezz.jei:jei_${mcversion}:${jei_version}"
|
||||
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
// deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
||||
+8
-8
@@ -1,11 +1,11 @@
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.2.2125
|
||||
mcp_mappings=snapshot_20161111
|
||||
mcversion=1.11
|
||||
forgeversion=13.19.1.2198
|
||||
mcp_mappings=snapshot_20161220
|
||||
|
||||
tesla_version=1.10.2-1.2.1.49
|
||||
jei_version=3.13.2.349
|
||||
ic2_version=2.6.76-ex110
|
||||
tesla_version=1.11-1.3.0.51
|
||||
jei_version=4.1.1.207
|
||||
#ic2_version=2.6.76-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=2
|
||||
version_patch=16
|
||||
version_minor=3
|
||||
version_patch=0
|
||||
@@ -1,165 +0,0 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -1,11 +0,0 @@
|
||||
Redstone Flux API
|
||||
====================================
|
||||
This is the standalone CoFH Energy API - also known as the "Redstone Flux" API.
|
||||
|
||||
Make great use of it.
|
||||
|
||||
You are of course free to modify any/all of this code and even repackage it, but then it wouldn't be an awesome crossmod API anymore, now would it?
|
||||
|
||||
Don't be a jerk.
|
||||
|
||||
~Team CoFH
|
||||
@@ -1,11 +0,0 @@
|
||||
package cofh.api;
|
||||
|
||||
public class CoFHAPIProps {
|
||||
|
||||
private CoFHAPIProps() {
|
||||
|
||||
}
|
||||
|
||||
public static final String VERSION = "1.8.9R1.2.0B1";
|
||||
|
||||
}
|
||||
@@ -1,162 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
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 {
|
||||
|
||||
protected int energy;
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public EnergyStorage(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public EnergyStorage(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public EnergyStorage readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
this.energy = nbt.getInteger("Energy");
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
|
||||
if (energy < 0) {
|
||||
energy = 0;
|
||||
}
|
||||
nbt.setInteger("Energy", energy);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public EnergyStorage setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
|
||||
if (energy > capacity) {
|
||||
energy = capacity;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public EnergyStorage setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public EnergyStorage setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public EnergyStorage setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMaxReceive() {
|
||||
|
||||
return maxReceive;
|
||||
}
|
||||
|
||||
public int getMaxExtract() {
|
||||
|
||||
return maxExtract;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public void setEnergyStored(int energy) {
|
||||
|
||||
this.energy = energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
|
||||
this.energy += energy;
|
||||
|
||||
if (this.energy > capacity) {
|
||||
this.energy = capacity;
|
||||
} else if (this.energy < 0) {
|
||||
this.energy = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* IEnergyStorage */
|
||||
@Override
|
||||
public int receiveEnergy(int maxReceive, boolean simulate) {
|
||||
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(int maxExtract, boolean simulate) {
|
||||
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored() {
|
||||
|
||||
return energy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored() {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
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.
|
||||
* <p>
|
||||
* Note that {@link IEnergyHandler} is an extension of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyConnection {
|
||||
|
||||
/**
|
||||
* Returns TRUE if the TileEntity can connect on a given side.
|
||||
*/
|
||||
boolean canConnectEnergy(EnumFacing from);
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
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
|
||||
* Maximum amount of energy to be sent into the item.
|
||||
* @param simulate
|
||||
* If TRUE, the charge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) received by the item.
|
||||
*/
|
||||
int receiveEnergy(ItemStack container, int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Maximum amount of energy to be extracted from the item.
|
||||
* @param simulate
|
||||
* If TRUE, the discharge will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the item.
|
||||
*/
|
||||
int extractEnergy(ItemStack container, int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Get the amount of energy currently stored in the container item.
|
||||
*/
|
||||
int getEnergyStored(ItemStack container);
|
||||
|
||||
/**
|
||||
* Get the max amount of energy that can be stored in the container item.
|
||||
*/
|
||||
int getMaxEnergyStored(ItemStack container);
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
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.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
* <p>
|
||||
* Note that {@link IEnergyReceiver} and {@link IEnergyProvider} are extensions of this.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyHandler extends IEnergyConnection {
|
||||
|
||||
/**
|
||||
* 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);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
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.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyProvider extends IEnergyHandler {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
int extractEnergy(EnumFacing from, int maxExtract, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
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.
|
||||
* <p>
|
||||
* A reference implementation is provided {@link TileEnergyHandler}.
|
||||
*
|
||||
* @author King Lemming
|
||||
*
|
||||
*/
|
||||
public interface IEnergyReceiver extends IEnergyHandler {
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate);
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
/**
|
||||
* An energy storage is the unit of interaction with Energy inventories.<br>
|
||||
* 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
|
||||
* If TRUE, the insertion will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) accepted by the storage.
|
||||
*/
|
||||
int receiveEnergy(int maxReceive, boolean simulate);
|
||||
|
||||
/**
|
||||
* Removes energy from the storage. Returns quantity of energy that was removed.
|
||||
*
|
||||
* @param maxExtract
|
||||
* Maximum amount of energy to be extracted.
|
||||
* @param simulate
|
||||
* If TRUE, the extraction will only be simulated.
|
||||
* @return Amount of energy that was (or would have been, if simulated) extracted from the storage.
|
||||
*/
|
||||
int extractEnergy(int maxExtract, boolean simulate);
|
||||
|
||||
/**
|
||||
* Returns the amount of energy currently stored.
|
||||
*/
|
||||
int getEnergyStored();
|
||||
|
||||
/**
|
||||
* Returns the maximum amount of energy that can be stored.
|
||||
*/
|
||||
int getMaxEnergyStored();
|
||||
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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 {
|
||||
|
||||
protected int capacity;
|
||||
protected int maxReceive;
|
||||
protected int maxExtract;
|
||||
|
||||
public ItemEnergyContainer() {
|
||||
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity) {
|
||||
|
||||
this(capacity, capacity, capacity);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxTransfer) {
|
||||
|
||||
this(capacity, maxTransfer, maxTransfer);
|
||||
}
|
||||
|
||||
public ItemEnergyContainer(int capacity, int maxReceive, int maxExtract) {
|
||||
|
||||
this.capacity = capacity;
|
||||
this.maxReceive = maxReceive;
|
||||
this.maxExtract = maxExtract;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setCapacity(int capacity) {
|
||||
|
||||
this.capacity = capacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setMaxTransfer(int maxTransfer) {
|
||||
|
||||
setMaxReceive(maxTransfer);
|
||||
setMaxExtract(maxTransfer);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setMaxReceive(int maxReceive) {
|
||||
|
||||
this.maxReceive = maxReceive;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemEnergyContainer setMaxExtract(int maxExtract) {
|
||||
|
||||
this.maxExtract = maxExtract;
|
||||
return this;
|
||||
}
|
||||
|
||||
/* IEnergyContainerItem */
|
||||
@Override
|
||||
public int receiveEnergy(ItemStack container, int maxReceive, boolean simulate) {
|
||||
|
||||
if (!container.hasTagCompound()) {
|
||||
container.setTagCompound(new NBTTagCompound());
|
||||
}
|
||||
int energy = container.getTagCompound().getInteger("Energy");
|
||||
int energyReceived = Math.min(capacity - energy, Math.min(this.maxReceive, maxReceive));
|
||||
|
||||
if (!simulate) {
|
||||
energy += energyReceived;
|
||||
container.getTagCompound().setInteger("Energy", energy);
|
||||
}
|
||||
return energyReceived;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ItemStack container, int maxExtract, boolean simulate) {
|
||||
|
||||
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
int energy = container.getTagCompound().getInteger("Energy");
|
||||
int energyExtracted = Math.min(energy, Math.min(this.maxExtract, maxExtract));
|
||||
|
||||
if (!simulate) {
|
||||
energy -= energyExtracted;
|
||||
container.getTagCompound().setInteger("Energy", energy);
|
||||
}
|
||||
return energyExtracted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ItemStack container) {
|
||||
|
||||
if (container.getTagCompound() == null || !container.getTagCompound().hasKey("Energy")) {
|
||||
return 0;
|
||||
}
|
||||
return container.getTagCompound().getInteger("Energy");
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ItemStack container) {
|
||||
|
||||
return capacity;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package cofh.api.energy;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
/**
|
||||
* 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 IEnergyReceiver, IEnergyProvider {
|
||||
|
||||
protected EnergyStorage storage = new EnergyStorage(32000);
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
|
||||
super.readFromNBT(nbt);
|
||||
storage.readFromNBT(nbt);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||
nbt = super.writeToNBT(nbt);
|
||||
storage.writeToNBT(nbt);
|
||||
return nbt;
|
||||
}
|
||||
|
||||
/* IEnergyConnection */
|
||||
@Override
|
||||
public boolean canConnectEnergy(EnumFacing from) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* IEnergyReceiver */
|
||||
@Override
|
||||
public int receiveEnergy(EnumFacing from, int maxReceive, boolean simulate) {
|
||||
|
||||
return storage.receiveEnergy(maxReceive, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyProvider */
|
||||
@Override
|
||||
public int extractEnergy(EnumFacing from, int maxExtract, boolean simulate) {
|
||||
|
||||
return storage.extractEnergy(maxExtract, simulate);
|
||||
}
|
||||
|
||||
/* IEnergyHandler */
|
||||
@Override
|
||||
public int getEnergyStored(EnumFacing from) {
|
||||
|
||||
return storage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(EnumFacing from) {
|
||||
|
||||
return storage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
/**
|
||||
* (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 net.minecraftforge.fml.common.API;
|
||||
import cofh.api.CoFHAPIProps;
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
/**
|
||||
* (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;
|
||||
|
||||
@@ -10,8 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.File;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.EventHandlerCore;
|
||||
import forestry.core.climate.ClimateEventHandler;
|
||||
@@ -26,7 +28,6 @@ import forestry.core.network.PacketHandler;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.worldgen.WorldGenerator;
|
||||
import forestry.plugins.PluginManager;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
@@ -50,14 +51,16 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
name = "Forestry",
|
||||
version = Constants.VERSION,
|
||||
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
|
||||
acceptedMinecraftVersions = "[1.10]",
|
||||
dependencies = "required-after:Forge@[12.18.1.2080,);"
|
||||
+ "after:JEI@[3.11.2.278,);"
|
||||
+ "after:" + PluginIC2.modId + ";")
|
||||
acceptedMinecraftVersions = "[1.11]",
|
||||
dependencies = "required-after:forge@[13.19.1.2189,);"
|
||||
+ "after:JEI@[4.1.1,);")
|
||||
// + "after:" + PluginIC2.modId + ";")
|
||||
public class Forestry {
|
||||
|
||||
@SuppressWarnings("NullableProblems")
|
||||
@Mod.Instance(Constants.MOD_ID)
|
||||
public static Forestry instance;
|
||||
@Nullable
|
||||
private File configFolder;
|
||||
|
||||
public Forestry() {
|
||||
@@ -68,6 +71,7 @@ public class Forestry {
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static PacketHandler packetHandler;
|
||||
|
||||
@EventHandler
|
||||
@@ -85,10 +89,12 @@ public class Forestry {
|
||||
|
||||
PluginManager.runSetup(event);
|
||||
|
||||
ForestryAPI.activeMode = new GameMode(Config.gameMode);
|
||||
String gameMode = Config.gameMode;
|
||||
Preconditions.checkState(gameMode != null);
|
||||
ForestryAPI.activeMode = new GameMode(gameMode);
|
||||
|
||||
PluginManager.runPreInit();
|
||||
|
||||
|
||||
Proxies.render.registerModels();
|
||||
}
|
||||
|
||||
@@ -122,6 +128,7 @@ public class Forestry {
|
||||
PluginManager.serverStarting(event.getServer());
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public File getConfigFolder() {
|
||||
return configFolder;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public enum EnumBeeType implements ISpeciesType {
|
||||
|
||||
public static final EnumBeeType[] VALUES = values();
|
||||
|
||||
String name;
|
||||
private final String name;
|
||||
|
||||
EnumBeeType() {
|
||||
this.name = this.toString().toLowerCase(Locale.ENGLISH);
|
||||
|
||||
@@ -5,18 +5,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
import forestry.api.core.IErrorState;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.IIndividualLiving;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
/**
|
||||
* Other implementations than Forestry's default one are not supported.
|
||||
@@ -28,7 +26,6 @@ public interface IBee extends IIndividualLiving {
|
||||
/**
|
||||
* @return Bee's genetic information.
|
||||
*/
|
||||
@Nonnull
|
||||
@Override
|
||||
IBeeGenome getGenome();
|
||||
|
||||
@@ -51,6 +48,7 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
/**
|
||||
* Set the natural flag on this bee.
|
||||
*
|
||||
* @param flag
|
||||
*/
|
||||
void setIsNatural(boolean flag);
|
||||
@@ -66,6 +64,7 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
/**
|
||||
* Determines whether the queen can work.
|
||||
*
|
||||
* @param housing the {@link IBeeHousing} the bee currently resides in.
|
||||
* @return an empty set if the queen can work, a set of error states if the queen can not work
|
||||
*/
|
||||
@@ -77,14 +76,16 @@ public interface IBee extends IIndividualLiving {
|
||||
|
||||
ItemStack[] getSpecialtyList();
|
||||
|
||||
ItemStack[] produceStacks(IBeeHousing housing);
|
||||
List<ItemStack> produceStacks(IBeeHousing housing);
|
||||
|
||||
@Nullable
|
||||
IBee spawnPrincess(IBeeHousing housing);
|
||||
|
||||
IBee[] spawnDrones(IBeeHousing housing);
|
||||
|
||||
void plantFlowerRandom(IBeeHousing housing);
|
||||
|
||||
@Nullable
|
||||
IIndividual retrievePollen(IBeeHousing housing);
|
||||
|
||||
boolean pollinateRandom(IBeeHousing housing, IIndividual pollen);
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
import forestry.api.genetics.EnumTolerance;
|
||||
@@ -22,11 +20,9 @@ import forestry.api.genetics.IGenome;
|
||||
public interface IBeeGenome extends IGenome {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleBeeSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleBeeSpecies getSecondary();
|
||||
|
||||
float getSpeed();
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import forestry.api.climate.IClimateProvider;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
@@ -38,6 +40,7 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvid
|
||||
|
||||
boolean isRaining();
|
||||
|
||||
@Nullable
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -53,7 +52,7 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
* @return {@link IApiaristTracker} associated with the passed world.
|
||||
*/
|
||||
@Override
|
||||
IApiaristTracker getBreedingTracker(World world, GameProfile player);
|
||||
IApiaristTracker getBreedingTracker(World world, @Nullable GameProfile player);
|
||||
|
||||
/* BEE SPECIFIC */
|
||||
|
||||
@@ -75,8 +74,7 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
boolean isMated(ItemStack stack);
|
||||
|
||||
/**
|
||||
* @param genome
|
||||
* Valid {@link IBeeGenome}
|
||||
* @param genome Valid {@link IBeeGenome}
|
||||
* @return {@link IBee} from the passed genome
|
||||
*/
|
||||
IBee getBee(IBeeGenome genome);
|
||||
@@ -84,17 +82,16 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
/**
|
||||
* Creates an IBee suitable for a queen containing the necessary second genome for the mate.
|
||||
*
|
||||
* @param genome
|
||||
* Valid {@link IBeeGenome}
|
||||
* @param mate
|
||||
* Valid {@link IBee} representing the mate.
|
||||
* @param genome Valid {@link IBeeGenome}
|
||||
* @param mate Valid {@link IBee} representing the mate.
|
||||
* @return Mated {@link IBee} from the passed genomes.
|
||||
*/
|
||||
IBee getBee(World world, IBeeGenome genome, IBee mate);
|
||||
|
||||
/* TEMPLATES */
|
||||
|
||||
@Override
|
||||
ArrayList<IBee> getIndividualTemplates();
|
||||
List<IBee> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
@@ -103,10 +100,11 @@ public interface IBeeRoot extends ISpeciesRoot {
|
||||
/* GAME MODE */
|
||||
void resetBeekeepingMode();
|
||||
|
||||
ArrayList<IBeekeepingMode> getBeekeepingModes();
|
||||
List<IBeekeepingMode> getBeekeepingModes();
|
||||
|
||||
IBeekeepingMode getBeekeepingMode(World world);
|
||||
|
||||
@Nullable
|
||||
IBeekeepingMode getBeekeepingMode(String name);
|
||||
|
||||
void registerBeekeepingMode(IBeekeepingMode mode);
|
||||
|
||||
@@ -5,17 +5,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* Stores beekeeping logic for bee housings.
|
||||
* Get one with BeeManager.beeRoot.createBeekeepingLogic(IBeeHousing housing)
|
||||
@@ -27,6 +25,7 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
|
||||
|
||||
/**
|
||||
* Checks that the bees can work, setting error conditions on the housing where needed
|
||||
*
|
||||
* @return true if no errors are present and doWork should be called
|
||||
*/
|
||||
boolean canWork();
|
||||
@@ -75,6 +74,5 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
|
||||
* Used by bee fx to direct bees to nearby flowers.
|
||||
* These positions are synced to the client from the server.
|
||||
*/
|
||||
@Nonnull
|
||||
List<BlockPos> getFlowerPositions();
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -20,7 +20,7 @@ public interface IBeekeepingMode {
|
||||
/**
|
||||
* @return Localized list of strings outlining the behaviour of this beekeeping mode.
|
||||
*/
|
||||
ArrayList<String> getDescription();
|
||||
List<String> getDescription();
|
||||
|
||||
/**
|
||||
* @return Float used to modify the wear on comb frames.
|
||||
@@ -47,7 +47,6 @@ public interface IBeekeepingMode {
|
||||
boolean isOverworked(IBee queen, IBeeHousing housing);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param queen
|
||||
* @param offspring
|
||||
* @param housing
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IHiveFrame {
|
||||
@@ -18,6 +20,7 @@ public interface IHiveFrame {
|
||||
* @param wear Integer denoting the amount worn out. The wear modifier of the current beekeeping mode has already been taken into account.
|
||||
* @return ItemStack containing the actual frame with adjusted damage, or null if it has been broken.
|
||||
*/
|
||||
@Nullable
|
||||
ItemStack frameUsed(IBeeHousing housing, ItemStack frame, IBee queen, int wear);
|
||||
|
||||
IBeeModifier getBeeModifier();
|
||||
|
||||
@@ -5,13 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
|
||||
public interface IHiveRegistry {
|
||||
|
||||
@@ -25,25 +23,23 @@ public interface IHiveRegistry {
|
||||
SNOW("forestry:snow", "forestry.speciesWintry"),
|
||||
SWAMP("forestry:swamp", "forestry.speciesMarshy"),
|
||||
SWARM("forestry:swarm", "forestry.speciesForest");
|
||||
|
||||
|
||||
public static final HiveType[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final String hiveUid;
|
||||
@Nonnull
|
||||
private final String speciesUid;
|
||||
|
||||
HiveType(@Nonnull String hiveUid, @Nonnull String speciesUid) {
|
||||
HiveType(String hiveUid, String speciesUid) {
|
||||
this.hiveUid = hiveUid;
|
||||
this.speciesUid = speciesUid;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
public String getHiveUid() {
|
||||
return hiveUid;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
public String getSpeciesUid() {
|
||||
return speciesUid;
|
||||
}
|
||||
@@ -56,7 +52,6 @@ public interface IHiveRegistry {
|
||||
public int getMeta() {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "4.1.0", owner = "ForestryAPI|apiculture", provides = "ForestryAPI|hives")
|
||||
package forestry.api.apiculture.hives;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -5,7 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -62,7 +61,7 @@ public enum EnumForestryWoodType implements IWoodType {
|
||||
public float getHardness() {
|
||||
return hardness;
|
||||
}
|
||||
|
||||
|
||||
public static EnumForestryWoodType getRandom(Random random) {
|
||||
return VALUES[random.nextInt(VALUES.length)];
|
||||
}
|
||||
@@ -71,7 +70,7 @@ public enum EnumForestryWoodType implements IWoodType {
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return toString();
|
||||
@@ -82,7 +81,6 @@ public enum EnumForestryWoodType implements IWoodType {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static EnumForestryWoodType byMetadata(int meta) {
|
||||
if (meta < 0 || meta >= VALUES.length) {
|
||||
meta = 0;
|
||||
@@ -94,14 +92,14 @@ public enum EnumForestryWoodType implements IWoodType {
|
||||
public int getCarbonization() {
|
||||
return carbonization;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getCharcoalChance(int numberOfCharcoal) {
|
||||
if(numberOfCharcoal == 3){
|
||||
if (numberOfCharcoal == 3) {
|
||||
return 0.75F;
|
||||
}else if(numberOfCharcoal == 4){
|
||||
} else if (numberOfCharcoal == 4) {
|
||||
return 0.5F;
|
||||
}else if(numberOfCharcoal == 5){
|
||||
} else if (numberOfCharcoal == 5) {
|
||||
return 0.25F;
|
||||
}
|
||||
return 0.15F;
|
||||
|
||||
@@ -14,7 +14,8 @@ public enum EnumFruitFamily implements IFruitFamily {
|
||||
PRUNES("prunes", "Prunus domestica"),
|
||||
POMES("pomes", "Pomum"),
|
||||
JUNGLE("jungle", "Tropicus"),
|
||||
NUX("nuts", "Nux");
|
||||
NUX("nuts", "Nux"),
|
||||
NONE("none", "None");
|
||||
|
||||
private final String uid;
|
||||
private final String scientific;
|
||||
|
||||
@@ -8,11 +8,9 @@ package forestry.api.arboriculture;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleArea;
|
||||
import forestry.api.genetics.IAlleleBoolean;
|
||||
import forestry.api.genetics.IAlleleFloat;
|
||||
import forestry.api.genetics.IAlleleInteger;
|
||||
import forestry.api.genetics.IAllelePlantType;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
@@ -25,12 +23,6 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
* will actually yield fruit with this species. - Native {@link EnumPlantType} for this tree. Combines with the PLANT chromosome.
|
||||
*/
|
||||
SPECIES(IAlleleTreeSpecies.class),
|
||||
/**
|
||||
* {@link IGrowthProvider}, determines conditions required by the tree to grow.
|
||||
* @deprecated unused
|
||||
*/
|
||||
@Deprecated
|
||||
GROWTH(IAlleleGrowth.class),
|
||||
/**
|
||||
* A float modifying the height of the tree. Taken into account at worldgen.
|
||||
*/
|
||||
@@ -47,22 +39,10 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
* Chance for fruit leaves and/or drops.
|
||||
*/
|
||||
YIELD(IAlleleFloat.class),
|
||||
/**
|
||||
* May add additional tolerances for {@link EnumPlantType}.
|
||||
* @deprecated this is tied to species directly
|
||||
*/
|
||||
@Deprecated
|
||||
PLANT(IAllelePlantType.class),
|
||||
/**
|
||||
* Determines the speed at which fruit will ripen on this tree.
|
||||
*/
|
||||
SAPPINESS(IAlleleFloat.class),
|
||||
/**
|
||||
* Territory for leaf effects.
|
||||
* @deprecated unused
|
||||
*/
|
||||
@Deprecated
|
||||
TERRITORY(IAlleleArea.class),
|
||||
/**
|
||||
* Leaf effect. Unused.
|
||||
*/
|
||||
@@ -73,24 +53,12 @@ public enum EnumTreeChromosome implements IChromosomeType {
|
||||
MATURATION(IAlleleInteger.class),
|
||||
|
||||
GIRTH(IAlleleInteger.class),
|
||||
/**
|
||||
* The combustibility of the wood, when it burn to charcoal and the combustibility of the charcoal.
|
||||
* @deprecated this is tied to species directly
|
||||
*/
|
||||
@Deprecated
|
||||
COMBUSTIBILITY(IAlleleInteger.class),
|
||||
/**
|
||||
* The amount of charcoal that a wood pile ash drop;
|
||||
* @deprecated this is tied to species directly
|
||||
*/
|
||||
@Deprecated
|
||||
CARBONIZATION(IAlleleInteger.class),
|
||||
/**
|
||||
* Determines if the tree can burn.
|
||||
*/
|
||||
FIREPROOF(IAlleleBoolean.class),;
|
||||
|
||||
Class<? extends IAllele> alleleClass;
|
||||
private final Class<? extends IAllele> alleleClass;
|
||||
|
||||
EnumTreeChromosome(Class<? extends IAllele> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -47,7 +46,6 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
return ordinal();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static EnumVanillaWoodType byMetadata(int meta) {
|
||||
if (meta < 0 || meta >= VALUES.length) {
|
||||
meta = 0;
|
||||
@@ -64,14 +62,14 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
public int getCarbonization() {
|
||||
return carbonization;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public float getCharcoalChance(int numberOfCharcoal) {
|
||||
if(numberOfCharcoal == 3){
|
||||
if (numberOfCharcoal == 3) {
|
||||
return 0.75F;
|
||||
}else if(numberOfCharcoal == 4){
|
||||
} else if (numberOfCharcoal == 4) {
|
||||
return 0.5F;
|
||||
}else if(numberOfCharcoal == 5){
|
||||
} else if (numberOfCharcoal == 5) {
|
||||
return 0.25F;
|
||||
}
|
||||
return 0.15F;
|
||||
@@ -79,7 +77,7 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
|
||||
@Override
|
||||
public String getPlankTexture() {
|
||||
if(this == DARK_OAK){
|
||||
if (this == DARK_OAK) {
|
||||
return "blocks/planks_big_oak";
|
||||
}
|
||||
return "blocks/planks_" + getName();
|
||||
@@ -87,7 +85,7 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
|
||||
@Override
|
||||
public String getDoorLowerTexture() {
|
||||
if(this == OAK){
|
||||
if (this == OAK) {
|
||||
return "blocks/door_wood_lower";
|
||||
}
|
||||
return "blocks/door_wood_lower";
|
||||
@@ -95,7 +93,7 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
|
||||
@Override
|
||||
public String getDoorUpperTexture() {
|
||||
if(this == OAK){
|
||||
if (this == OAK) {
|
||||
return "blocks/door_wood_upper";
|
||||
}
|
||||
return "blocks/door_" + getName() + "_upper";
|
||||
@@ -103,7 +101,7 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
|
||||
@Override
|
||||
public String getBarkTexture() {
|
||||
if(this == DARK_OAK){
|
||||
if (this == DARK_OAK) {
|
||||
return "blocks/log_big_oak";
|
||||
}
|
||||
return "blocks/log_" + getName();
|
||||
@@ -111,7 +109,7 @@ public enum EnumVanillaWoodType implements IWoodType {
|
||||
|
||||
@Override
|
||||
public String getHeartTexture() {
|
||||
if(this == DARK_OAK){
|
||||
if (this == DARK_OAK) {
|
||||
return "blocks/log_big_oak_top";
|
||||
}
|
||||
return "blocks/log_" + getName() + "_top";
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import forestry.api.genetics.IAlleleProperty;
|
||||
@@ -15,13 +14,11 @@ import forestry.api.genetics.IAlleleProperty;
|
||||
*/
|
||||
public interface IAlleleFruit extends IAlleleProperty<IAlleleFruit> {
|
||||
|
||||
@Nonnull
|
||||
IFruitProvider getProvider();
|
||||
|
||||
@Nullable
|
||||
String getModelName();
|
||||
|
||||
@Nonnull
|
||||
String getModID();
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
|
||||
/**
|
||||
* Simple allele encapsulating an {@link IGrowthProvider}.
|
||||
*/
|
||||
public interface IAlleleGrowth extends IAllele {
|
||||
|
||||
IGrowthProvider getProvider();
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
@@ -21,47 +20,40 @@ import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public interface IAlleleTreeSpecies extends IAlleleSpecies, IAlleleProperty<IAlleleTreeSpecies> {
|
||||
|
||||
@Nonnull
|
||||
|
||||
@Override
|
||||
ITreeRoot getRoot();
|
||||
|
||||
/**
|
||||
* @return Native plant type of this species.
|
||||
*/
|
||||
@Nonnull
|
||||
EnumPlantType getPlantType();
|
||||
|
||||
/**
|
||||
* @return List of all {@link IFruitFamily}s which can grow on leaves generated by this species.
|
||||
*/
|
||||
@Nonnull
|
||||
Collection<IFruitFamily> getSuitableFruit();
|
||||
|
||||
/**
|
||||
* @return Tree generator for this species.
|
||||
*/
|
||||
@Nonnull
|
||||
ITreeGenerator getGenerator();
|
||||
|
||||
/**
|
||||
* @return The modid from the mod of the species.
|
||||
*/
|
||||
@Nonnull
|
||||
String getModID();
|
||||
|
||||
IWoodProvider getWoodProvider();
|
||||
|
||||
/* MODELS AND OVERRIDES */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
ILeafSpriteProvider getLeafSpriteProvider();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
int getGermlingColour(EnumGermlingType type, int renderPass);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
ModelResourceLocation getGermlingModel(EnumGermlingType type);
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
@@ -23,7 +22,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.api.genetics.IFruitFamily;
|
||||
|
||||
public interface IFruitProvider {
|
||||
|
||||
IFruitFamily getFamily();
|
||||
|
||||
int getColour(ITreeGenome genome, IBlockAccess world, BlockPos pos, int ripeningTime);
|
||||
@@ -36,15 +34,12 @@ public interface IFruitProvider {
|
||||
int getRipeningPeriod();
|
||||
|
||||
// / Products, Chance
|
||||
@Nonnull
|
||||
Map<ItemStack, Float> getProducts();
|
||||
|
||||
// / Specialty, Chance
|
||||
@Nonnull
|
||||
Map<ItemStack, Float> getSpecialty();
|
||||
|
||||
@Nonnull
|
||||
List<ItemStack> getFruits(ITreeGenome genome, World world, BlockPos pos, int ripeningTime);
|
||||
NonNullList<ItemStack> getFruits(ITreeGenome genome, World world, BlockPos pos, int ripeningTime);
|
||||
|
||||
/**
|
||||
* @return Short, human-readable identifier used in the treealyzer.
|
||||
@@ -54,7 +49,6 @@ public interface IFruitProvider {
|
||||
@Nullable
|
||||
String getModelName();
|
||||
|
||||
@Nonnull
|
||||
String getModID();
|
||||
|
||||
/* TEXTURE OVERLAY */
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
@@ -23,8 +21,7 @@ import forestry.api.core.IModelManager;
|
||||
public interface IGermlingModelProvider {
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerModels(Item item, IModelManager manager, EnumGermlingType type);
|
||||
|
||||
@Nonnull
|
||||
|
||||
ModelResourceLocation getModel(EnumGermlingType type);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
* @deprecated this is being removed to simplify trees
|
||||
*/
|
||||
@Deprecated
|
||||
public interface IGrowthProvider {
|
||||
|
||||
/**
|
||||
* Check to see whether a sapling at the given location with the given genome can grow into a tree.
|
||||
*
|
||||
* @param genome Genome of the tree this is called for.
|
||||
* @param world Minecraft world the tree will inhabit.
|
||||
* @param pos Coordinates to attempt growth at.
|
||||
* @param expectedGirth Trunk size of the tree to generate.
|
||||
* @param expectedHeight Height of the tree to generate.
|
||||
* @return position that the tree can grow, null otherwise.
|
||||
*/
|
||||
@Nullable
|
||||
BlockPos canGrow(ITreeGenome genome, World world, BlockPos pos, int expectedGirth, int expectedHeight);
|
||||
|
||||
/**
|
||||
* @return Short, human-readable identifier used in the treealyzer.
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
/**
|
||||
* @return Detailed description of growth behaviour used in the treealyzer.
|
||||
*/
|
||||
String[] getInfo();
|
||||
|
||||
}
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
@@ -17,7 +15,6 @@ import net.minecraft.util.ResourceLocation;
|
||||
* Icon registration is not done here because these icons are heavily reused.
|
||||
*/
|
||||
public interface ILeafSpriteProvider {
|
||||
@Nonnull
|
||||
ResourceLocation getSprite(boolean pollinated, boolean fancy);
|
||||
|
||||
int getColor(boolean pollinated);
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -15,6 +13,7 @@ import forestry.api.genetics.IEffectData;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.world.ITreeGenData;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
@@ -28,10 +27,10 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
|
||||
IEffectData[] doFX(IEffectData[] storedData, World world, BlockPos pos);
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
ITreeGenome getGenome();
|
||||
|
||||
@Nullable
|
||||
ITreeGenome getMate();
|
||||
|
||||
/**
|
||||
@@ -40,15 +39,12 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
ITree[] getSaplings(World world, GameProfile playerProfile, BlockPos pos, float modifier);
|
||||
|
||||
// Products, Chance
|
||||
@Nonnull
|
||||
Map<ItemStack, Float> getProducts();
|
||||
|
||||
// Specialties, Chance
|
||||
@Nonnull
|
||||
Map<ItemStack, Float> getSpecialties();
|
||||
|
||||
@Nonnull
|
||||
List<ItemStack> produceStacks(World world, BlockPos pos, int ripeningTime);
|
||||
NonNullList<ItemStack> produceStacks(World world, BlockPos pos, int ripeningTime);
|
||||
|
||||
/**
|
||||
* @return Boolean indicating whether a sapling can stay planted at the given position.
|
||||
@@ -72,7 +68,7 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
* @return Integer denoting how resilient leaf blocks are against adverse influences (i.e. caterpillars).
|
||||
*/
|
||||
int getResilience();
|
||||
|
||||
|
||||
/**
|
||||
* @return Integer denoting the size of the tree trunk.
|
||||
*/
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -22,5 +24,5 @@ public interface ITreeGenerator {
|
||||
|
||||
boolean setLogBlock(ITreeGenome genome, World world, BlockPos pos, EnumFacing facing);
|
||||
|
||||
boolean setLeaves(ITreeGenome genome, World world, GameProfile owner, BlockPos pos);
|
||||
boolean setLeaves(ITreeGenome genome, World world, @Nullable GameProfile owner, BlockPos pos);
|
||||
}
|
||||
@@ -5,21 +5,16 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.genetics.IGenome;
|
||||
|
||||
public interface ITreeGenome extends IGenome {
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleTreeSpecies getPrimary();
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
IAlleleTreeSpecies getSecondary();
|
||||
|
||||
@Nonnull
|
||||
|
||||
IFruitProvider getFruitProvider();
|
||||
|
||||
float getHeight();
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@@ -48,12 +46,13 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
* @return {@link IArboristTracker} associated with the passed world.
|
||||
*/
|
||||
@Override
|
||||
IArboristTracker getBreedingTracker(World world, GameProfile player);
|
||||
IArboristTracker getBreedingTracker(World world, @Nullable GameProfile player);
|
||||
|
||||
/* TREE SPECIFIC */
|
||||
|
||||
/**
|
||||
* Register a leaf tick handler.
|
||||
*
|
||||
* @param handler the {@link ILeafTickHandler} to register.
|
||||
*/
|
||||
void registerLeafTickHandler(ILeafTickHandler handler);
|
||||
@@ -67,6 +66,7 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
@Override
|
||||
EnumGermlingType getType(ItemStack stack);
|
||||
|
||||
@Nullable
|
||||
ITree getTree(World world, BlockPos pos);
|
||||
|
||||
ITree getTree(World world, ITreeGenome genome);
|
||||
@@ -79,7 +79,7 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
@Override
|
||||
IChromosome[] templateAsChromosomes(IAllele[] templateActive, IAllele[] templateInactive);
|
||||
|
||||
boolean setFruitBlock(@Nonnull World world, @Nonnull IAlleleFruit allele, float sappiness, BlockPos pos);
|
||||
boolean setFruitBlock(World world, ITreeGenome genome, IAlleleFruit allele, float sappiness, BlockPos pos);
|
||||
|
||||
/* GAME MODE */
|
||||
List<ITreekeepingMode> getTreekeepingModes();
|
||||
@@ -93,8 +93,9 @@ public interface ITreeRoot extends ISpeciesRootPollinatable {
|
||||
void setTreekeepingMode(World world, String name);
|
||||
|
||||
/* TEMPLATES */
|
||||
|
||||
@Override
|
||||
ArrayList<ITree> getIndividualTemplates();
|
||||
List<ITree> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
@Override
|
||||
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.ITextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -19,13 +17,11 @@ public interface IWoodProvider {
|
||||
void registerSprites(Item item, ITextureManager manager);
|
||||
|
||||
/**
|
||||
*
|
||||
* @return The texture sprite of the wood.
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Nonnull
|
||||
TextureAtlasSprite getSprite(boolean isTop);
|
||||
|
||||
|
||||
/**
|
||||
* @return A stack of wood from the tree to craft wood pile's or other things.
|
||||
*/
|
||||
@@ -35,7 +31,7 @@ public interface IWoodProvider {
|
||||
* The amount of charcoal dropped from a charcoal pile of this wood.
|
||||
*/
|
||||
int getCarbonization();
|
||||
|
||||
|
||||
/**
|
||||
* The chance that a pile has to drop a extra charcoal
|
||||
*/
|
||||
|
||||
@@ -3,8 +3,8 @@ package forestry.api.arboriculture;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import net.minecraftforge.client.model.IModel;
|
||||
import net.minecraftforge.client.model.ModelProcessingHelper;
|
||||
|
||||
@@ -12,55 +12,55 @@ public enum WoodBlockKind {
|
||||
LOG, PLANKS, SLAB, FENCE, FENCE_GATE, STAIRS, DOOR(false);
|
||||
|
||||
public final boolean retextureItem;
|
||||
|
||||
private WoodBlockKind() {
|
||||
|
||||
WoodBlockKind() {
|
||||
this(true);
|
||||
}
|
||||
|
||||
private WoodBlockKind(boolean retextureItem) {
|
||||
|
||||
WoodBlockKind(boolean retextureItem) {
|
||||
this.retextureItem = retextureItem;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
public IModel retextureModel(IModel model, IWoodType type, ImmutableMap<String, String> customTextures){
|
||||
|
||||
public IModel retextureModel(IModel model, IWoodType type, ImmutableMap<String, String> customTextures) {
|
||||
Map<String, String> textures = new HashMap<>();
|
||||
switch (this) {
|
||||
case SLAB:
|
||||
case STAIRS:
|
||||
String textureLocation = type.getPlankTexture();
|
||||
textures.put("particle", textureLocation);
|
||||
textures.put("side", textureLocation);
|
||||
textures.put("top", textureLocation);
|
||||
textures.put("bottom", textureLocation);
|
||||
textures.put("all", textureLocation);
|
||||
break;
|
||||
case PLANKS:
|
||||
textures.put("particle", type.getPlankTexture());
|
||||
textures.put("all", type.getPlankTexture());
|
||||
break;
|
||||
case FENCE_GATE:
|
||||
case FENCE:
|
||||
textures.put("particle", type.getPlankTexture());
|
||||
textures.put("side", type.getPlankTexture());
|
||||
textures.put("texture", type.getPlankTexture());
|
||||
break;
|
||||
case DOOR:
|
||||
textures.put("particle", type.getDoorLowerTexture());
|
||||
textures.put("bottom", type.getDoorLowerTexture());
|
||||
textures.put("top", type.getDoorUpperTexture());
|
||||
break;
|
||||
case LOG:
|
||||
textures.put("particle", type.getBarkTexture());
|
||||
textures.put("side", type.getBarkTexture());
|
||||
textures.put("all", type.getBarkTexture());
|
||||
textures.put("end", type.getHeartTexture());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case SLAB:
|
||||
case STAIRS:
|
||||
String textureLocation = type.getPlankTexture();
|
||||
textures.put("particle", textureLocation);
|
||||
textures.put("side", textureLocation);
|
||||
textures.put("top", textureLocation);
|
||||
textures.put("bottom", textureLocation);
|
||||
textures.put("all", textureLocation);
|
||||
break;
|
||||
case PLANKS:
|
||||
textures.put("particle", type.getPlankTexture());
|
||||
textures.put("all", type.getPlankTexture());
|
||||
break;
|
||||
case FENCE_GATE:
|
||||
case FENCE:
|
||||
textures.put("particle", type.getPlankTexture());
|
||||
textures.put("side", type.getPlankTexture());
|
||||
textures.put("texture", type.getPlankTexture());
|
||||
break;
|
||||
case DOOR:
|
||||
textures.put("particle", type.getDoorLowerTexture());
|
||||
textures.put("bottom", type.getDoorLowerTexture());
|
||||
textures.put("top", type.getDoorUpperTexture());
|
||||
break;
|
||||
case LOG:
|
||||
textures.put("particle", type.getBarkTexture());
|
||||
textures.put("side", type.getBarkTexture());
|
||||
textures.put("all", type.getBarkTexture());
|
||||
textures.put("end", type.getHeartTexture());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
textures.putAll(customTextures);
|
||||
return ModelProcessingHelper.retexture(model, new ImmutableMap.Builder<String, String>().putAll(textures).build());
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "4.2.1", owner = "ForestryAPI|core", provides = "ForestryAPI|arboriculture")
|
||||
package forestry.api.arboriculture;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -5,7 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
@@ -26,13 +25,11 @@ public interface ICircuitBoard extends INbtWritable {
|
||||
|
||||
void onTick(Object tile);
|
||||
|
||||
@Nonnull
|
||||
ICircuit[] getCircuits();
|
||||
|
||||
/**
|
||||
* Specifies where a circuit can be used.
|
||||
*/
|
||||
@Nonnull
|
||||
ICircuitSocketType getSocketType();
|
||||
|
||||
}
|
||||
@@ -5,26 +5,20 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface ICircuitLayout {
|
||||
|
||||
/** unique ID for this circuit layout */
|
||||
@Nonnull
|
||||
String getUID();
|
||||
|
||||
/** localized name for this circuit layout */
|
||||
@Nonnull
|
||||
String getName();
|
||||
|
||||
/** localized string for how this circuit layout is used */
|
||||
@Nonnull
|
||||
String getUsage();
|
||||
|
||||
/**
|
||||
* Specifies where a circuit layout is used.
|
||||
*/
|
||||
@Nonnull
|
||||
ICircuitSocketType getSocketType();
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.circuits;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -30,6 +31,7 @@ public interface ICircuitRegistry {
|
||||
|
||||
ICircuitLayout getDefaultLayout();
|
||||
|
||||
@Nullable
|
||||
ICircuitBoard getCircuitBoard(ItemStack itemstack);
|
||||
|
||||
boolean isChipset(ItemStack itemstack);
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "3.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|circuits")
|
||||
package forestry.api.circuits;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -5,39 +5,35 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateManager {
|
||||
|
||||
float getTemperature(World world, BlockPos pos);
|
||||
|
||||
|
||||
float getHumidity(World world, BlockPos pos);
|
||||
|
||||
@Nonnull
|
||||
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
|
||||
void addRegion(IClimateRegion region);
|
||||
|
||||
|
||||
void removeRegion(IClimateRegion region);
|
||||
|
||||
|
||||
void addSource(IClimateSourceProvider source);
|
||||
|
||||
|
||||
void removeSource(IClimateSourceProvider source);
|
||||
|
||||
|
||||
@Nullable
|
||||
IClimatePosition getPosition(World world, BlockPos pos);
|
||||
|
||||
|
||||
@Nullable
|
||||
IClimateRegion getRegionForPos(World world, BlockPos pos);
|
||||
|
||||
@Nonnull
|
||||
|
||||
Map<Integer, List<IClimateRegion>> getRegions();
|
||||
|
||||
|
||||
}
|
||||
@@ -5,18 +5,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IClimatePosition extends INbtReadable, INbtWritable {
|
||||
|
||||
@Nonnull
|
||||
|
||||
IClimateRegion getClimateRegion();
|
||||
|
||||
@Nonnull
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
void setTemperature(float temperature);
|
||||
|
||||
@@ -8,38 +8,34 @@ package forestry.api.climate;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.INbtReadable;
|
||||
import forestry.api.core.INbtWritable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IClimateRegion extends INbtReadable, INbtWritable {
|
||||
|
||||
@Nonnull
|
||||
|
||||
World getWorld();
|
||||
|
||||
|
||||
/**
|
||||
* Update the climate in a region.
|
||||
*/
|
||||
void updateClimate(int ticks);
|
||||
|
||||
|
||||
int getTicksPerUpdate();
|
||||
|
||||
@Nonnull
|
||||
|
||||
Map<BlockPos, IClimatePosition> getPositions();
|
||||
|
||||
|
||||
void addSource(IClimateSource source);
|
||||
|
||||
|
||||
void removeSource(IClimateSource source);
|
||||
|
||||
|
||||
Collection<IClimateSource> getSources();
|
||||
|
||||
|
||||
Collection<BlockPos> getOtherPositions();
|
||||
|
||||
|
||||
float getTemperature();
|
||||
|
||||
|
||||
float getHumidity();
|
||||
|
||||
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* A climate source is used to change the climate in a region.
|
||||
*/
|
||||
@@ -21,7 +23,8 @@ public interface IClimateSource {
|
||||
* @return The ticks that are required for one change.
|
||||
*/
|
||||
int getTicksForChange(IClimateRegion region);
|
||||
|
||||
|
||||
@Nullable
|
||||
IClimateSourceProvider getProvider();
|
||||
|
||||
}
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.1.0", owner = "Forestry", provides = "ForestryAPI|climate")
|
||||
package forestry.api.climate;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -22,7 +22,7 @@ public class BiomeHelper {
|
||||
return isBiomeHellishCache.get(biomeGen);
|
||||
}
|
||||
|
||||
boolean isBiomeHellish = BiomeDictionary.isBiomeOfType(biomeGen, BiomeDictionary.Type.NETHER);
|
||||
boolean isBiomeHellish = BiomeDictionary.hasType(biomeGen, BiomeDictionary.Type.NETHER);
|
||||
isBiomeHellishCache.put(biomeGen, isBiomeHellish);
|
||||
return isBiomeHellish;
|
||||
}
|
||||
|
||||
@@ -5,33 +5,33 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface ICamouflageAccess {
|
||||
|
||||
|
||||
/**
|
||||
* Register a item camouflage handler for a type.
|
||||
*
|
||||
* @param type The camouflage type for of handler.
|
||||
*
|
||||
* @param itemHandler The handler that is to register.
|
||||
*/
|
||||
void registerCamouflageItemHandler(@Nonnull ICamouflageItemHandler itemHandler);
|
||||
|
||||
void registerCamouflageItemHandler(ICamouflageItemHandler itemHandler);
|
||||
|
||||
/**
|
||||
* @return A list of all item camouflage handler's that are registered for that camouflage type.
|
||||
*/
|
||||
List<ICamouflageItemHandler> getCamouflageItemHandler(@Nonnull String type);
|
||||
|
||||
void addItemToBlackList(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
|
||||
|
||||
void addModIdToBlackList(@Nonnull String type, @Nonnull String modID);
|
||||
|
||||
boolean isItemBlackListed(@Nonnull String type, @Nonnull ItemStack camouflageBlock);
|
||||
|
||||
@Nullable
|
||||
List<ICamouflageItemHandler> getCamouflageItemHandler(String type);
|
||||
|
||||
void addItemToBlackList(String type, ItemStack camouflageBlock);
|
||||
|
||||
void addModIdToBlackList(String type, String modID);
|
||||
|
||||
boolean isItemBlackListed(String type, ItemStack camouflageBlock);
|
||||
|
||||
@Nullable
|
||||
ICamouflageItemHandler getHandlerFromItem(ItemStack stack);
|
||||
|
||||
|
||||
}
|
||||
@@ -5,23 +5,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
public interface ICamouflageItemHandler {
|
||||
|
||||
boolean canHandle(ItemStack stack);
|
||||
|
||||
|
||||
String getType();
|
||||
|
||||
|
||||
float getLightTransmittance(ItemStack stack, ICamouflageHandler camouflageHandler);
|
||||
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
Pair<IBlockState, IBakedModel> getModel(ItemStack stack, ICamouflageHandler camouflageHandler, ICamouflagedTile camouflageTile);
|
||||
|
||||
|
||||
}
|
||||
@@ -5,10 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
|
||||
/**
|
||||
* Keeps track of all the IErrorStates for an object.
|
||||
* Create a new IErrorLogic instance for your object with ForestryAPI.errorStateRegistry.createErrorLogic().
|
||||
@@ -39,7 +39,7 @@ public interface IErrorLogic extends IErrorSource {
|
||||
/**
|
||||
* Network serialization for syncing errors to the client from the server.
|
||||
*/
|
||||
void writeData(DataOutputStream data) throws IOException;
|
||||
void writeData(PacketBuffer data);
|
||||
|
||||
void readData(DataInputStream data) throws IOException;
|
||||
void readData(PacketBuffer data);
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -25,28 +24,28 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelBaker {
|
||||
|
||||
void setRenderBounds(@Nonnull AxisAlignedBB renderBounds);
|
||||
void setRenderBounds(AxisAlignedBB renderBounds);
|
||||
|
||||
void setRenderBounds(double d, double e, double f, double g, double h, double i);
|
||||
|
||||
void setColorIndex(int color);
|
||||
|
||||
void addBlockModel(@Nonnull Block block, @Nonnull AxisAlignedBB renderBounds, @Nullable BlockPos pos, @Nonnull TextureAtlasSprite[] sprites, int colorIndex);
|
||||
|
||||
void addBlockModel(@Nonnull Block block, @Nonnull AxisAlignedBB renderBounds, @Nullable BlockPos pos, @Nonnull TextureAtlasSprite sprites, int colorIndex);
|
||||
|
||||
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite[] textures, int colorIndex);
|
||||
|
||||
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite texture, int colorIndex);
|
||||
|
||||
void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model);
|
||||
|
||||
void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite);
|
||||
|
||||
void addBlockModel(Block block, AxisAlignedBB renderBounds, @Nullable BlockPos pos, TextureAtlasSprite[] sprites, int colorIndex);
|
||||
|
||||
void addBlockModel(Block block, AxisAlignedBB renderBounds, @Nullable BlockPos pos, TextureAtlasSprite sprites, int colorIndex);
|
||||
|
||||
void addModel(AxisAlignedBB renderBounds, TextureAtlasSprite[] textures, int colorIndex);
|
||||
|
||||
void addModel(AxisAlignedBB renderBounds, TextureAtlasSprite texture, int colorIndex);
|
||||
|
||||
void addBakedModel(@Nullable IBlockState state, IBakedModel model);
|
||||
|
||||
void addFace(EnumFacing facing, TextureAtlasSprite sprite);
|
||||
|
||||
void setModelState(@Nullable IModelState modelState);
|
||||
|
||||
void setParticleSprite(@Nullable TextureAtlasSprite particleSprite);
|
||||
|
||||
|
||||
void setParticleSprite(TextureAtlasSprite particleSprite);
|
||||
|
||||
IModelBakerModel bakeModel(boolean flip);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
@@ -18,23 +17,21 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public interface IModelBakerModel extends IPerspectiveAwareModel {
|
||||
|
||||
|
||||
void setGui3d(boolean gui3d);
|
||||
|
||||
|
||||
void setAmbientOcclusion(boolean ambientOcclusion);
|
||||
|
||||
void setParticleSprite(@Nullable TextureAtlasSprite particleSprite);
|
||||
|
||||
void addQuad(@Nullable EnumFacing facing, @Nonnull BakedQuad quad);
|
||||
|
||||
|
||||
void setParticleSprite(TextureAtlasSprite particleSprite);
|
||||
|
||||
void addQuad(@Nullable EnumFacing facing, BakedQuad quad);
|
||||
|
||||
void setRotation(float[] rotation);
|
||||
|
||||
void setTranslation(float[] translation);
|
||||
|
||||
void setScale(float[] scale);
|
||||
|
||||
IModelState getModelState();
|
||||
|
||||
|
||||
float[] getRotation();
|
||||
|
||||
float[] getTranslation();
|
||||
|
||||
@@ -12,43 +12,12 @@ package forestry.api.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
|
||||
/**
|
||||
* Taken from BuildCraft 5.0.x
|
||||
*/
|
||||
public interface IToolPipette {
|
||||
|
||||
/**
|
||||
* @param pipette
|
||||
* ItemStack of the pipette.
|
||||
* @return Capacity of the pipette.
|
||||
*/
|
||||
int getCapacity(ItemStack pipette);
|
||||
|
||||
/**
|
||||
* @param pipette
|
||||
* @return true if the pipette can pipette.
|
||||
*/
|
||||
boolean canPipette(ItemStack pipette);
|
||||
|
||||
/**
|
||||
* Fills the pipette with the given liquid stack.
|
||||
*
|
||||
* @param pipette
|
||||
* @param liquid
|
||||
* @param doFill
|
||||
* @return Amount of liquid used in filling the pipette.
|
||||
*/
|
||||
int fill(ItemStack pipette, FluidStack liquid, boolean doFill);
|
||||
|
||||
/**
|
||||
* Drains liquid from the pipette
|
||||
*
|
||||
* @param pipette
|
||||
* @param maxDrain
|
||||
* @param doDrain
|
||||
* @return Fluid stack representing the liquid and amount drained from the pipette.
|
||||
*/
|
||||
FluidStack drain(ItemStack pipette, int maxDrain, boolean doDrain);
|
||||
}
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "5.1.0", owner = "Forestry", provides = "ForestryAPI|core")
|
||||
package forestry.api.core;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -8,6 +8,7 @@ package forestry.api.farming;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
/**
|
||||
@@ -27,7 +28,7 @@ public class DefaultFarmListener implements IFarmListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hasCollected(Collection<ItemStack> collected, IFarmLogic logic) {
|
||||
public void hasCollected(NonNullList<ItemStack> collected, IFarmLogic logic) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ public enum FarmDirection {
|
||||
return forgeDirection;
|
||||
}
|
||||
|
||||
@SuppressWarnings("incomplete-switch")
|
||||
public static FarmDirection getFarmDirection(EnumFacing forgeDirection) {
|
||||
switch (forgeDirection) {
|
||||
case NORTH:
|
||||
@@ -34,7 +33,8 @@ public enum FarmDirection {
|
||||
return SOUTH;
|
||||
case WEST:
|
||||
return WEST;
|
||||
default:
|
||||
throw new IllegalArgumentException("Farm directios can only be NORTH, EAST, SOUTH, or WEST. Got: " + forgeDirection);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -11,19 +11,16 @@ import com.google.common.collect.Multimap;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Map;
|
||||
|
||||
public class Farmables {
|
||||
/**
|
||||
* Can be used to add IFarmables to some of the vanilla farm logics.
|
||||
*
|
||||
* <p>
|
||||
* Identifiers: farmArboreal farmWheat farmGourd farmInfernal farmPoales farmSucculentes farmVegetables farmShroom
|
||||
*/
|
||||
@Nonnull
|
||||
public static final Multimap<String, IFarmable> farmables = HashMultimap.create();
|
||||
|
||||
@Nonnull
|
||||
public static final LinkedHashMap<ItemStack, Integer> fertilizers = new LinkedHashMap();
|
||||
public static final Map<ItemStack, Integer> fertilizers = new LinkedHashMap<>();
|
||||
|
||||
}
|
||||
@@ -5,11 +5,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface ICrop {
|
||||
@@ -17,11 +16,10 @@ public interface ICrop {
|
||||
/**
|
||||
* Harvests this crop. Performs the necessary manipulations to set the crop into a "harvested" state.
|
||||
*
|
||||
* @return Products harvested.
|
||||
* @return Products harvested. Null if this crop cannot be harvested
|
||||
*/
|
||||
@Nullable
|
||||
Collection<ItemStack> harvest();
|
||||
NonNullList<ItemStack> harvest();
|
||||
|
||||
@Nonnull
|
||||
BlockPos getPosition();
|
||||
}
|
||||
@@ -7,11 +7,12 @@ package forestry.api.farming;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public interface IFarmInventory {
|
||||
boolean hasResources(ItemStack[] resources);
|
||||
boolean hasResources(NonNullList<ItemStack> resources);
|
||||
|
||||
void removeResources(ItemStack[] resources);
|
||||
void removeResources(NonNullList<ItemStack> resources);
|
||||
|
||||
boolean acceptsAsGermling(ItemStack itemstack);
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ package forestry.api.farming;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IFarmListener {
|
||||
@@ -33,7 +34,7 @@ public interface IFarmListener {
|
||||
*
|
||||
* @param collected Collection of collected stacks. May be manipulated. Ensure removal of stacks with 0 or less items!
|
||||
*/
|
||||
void hasCollected(Collection<ItemStack> collected, IFarmLogic logic);
|
||||
void hasCollected(NonNullList<ItemStack> collected, IFarmLogic logic);
|
||||
|
||||
/**
|
||||
* Called after farmland has successfully been cultivated by a farm logic.
|
||||
|
||||
@@ -8,6 +8,7 @@ package forestry.api.farming;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -25,7 +26,7 @@ public interface IFarmLogic {
|
||||
|
||||
boolean isAcceptedGermling(ItemStack itemstack);
|
||||
|
||||
Collection<ItemStack> collect(World world, IFarmHousing farmHousing);
|
||||
NonNullList<ItemStack> collect(World world, IFarmHousing farmHousing);
|
||||
|
||||
boolean cultivate(World world, IFarmHousing farmHousing, BlockPos pos, FarmDirection direction, int extent);
|
||||
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "2.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|farming")
|
||||
package forestry.api.farming;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -6,7 +6,7 @@
|
||||
package forestry.api.food;
|
||||
|
||||
public class BeverageManager {
|
||||
public static IBeverageEffect[] effectList = new IBeverageEffect[128];
|
||||
public static final IBeverageEffect[] effectList = new IBeverageEffect[128];
|
||||
|
||||
public static IInfuserManager infuserManager;
|
||||
public static IIngredientManager ingredientManager;
|
||||
|
||||
@@ -6,19 +6,20 @@
|
||||
package forestry.api.food;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
public interface IInfuserManager {
|
||||
|
||||
void addMixture(int meta, ItemStack ingredient, IBeverageEffect effect);
|
||||
|
||||
void addMixture(int meta, ItemStack[] ingredients, IBeverageEffect effect);
|
||||
void addMixture(int meta, NonNullList<ItemStack> ingredients, IBeverageEffect effect);
|
||||
|
||||
ItemStack getSeasoned(ItemStack base, ItemStack[] ingredients);
|
||||
ItemStack getSeasoned(ItemStack base, NonNullList<ItemStack> ingredients);
|
||||
|
||||
boolean hasMixtures(ItemStack[] ingredients);
|
||||
boolean hasMixtures(NonNullList<ItemStack> ingredients);
|
||||
|
||||
boolean isIngredient(ItemStack itemstack);
|
||||
|
||||
ItemStack[] getRequired(ItemStack[] ingredients);
|
||||
NonNullList<ItemStack> getRequired(NonNullList<ItemStack> ingredients);
|
||||
|
||||
}
|
||||
@@ -5,10 +5,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.food;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IIngredientManager {
|
||||
|
||||
@Nullable
|
||||
String getDescription(ItemStack itemstack);
|
||||
|
||||
void addIngredient(ItemStack ingredient, String description);
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "1.1.0", owner = "ForestryAPI|core", provides = "ForestryAPI|food")
|
||||
package forestry.api.food;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.fuels;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class MoistenerFuel {
|
||||
@@ -14,6 +15,10 @@ public class MoistenerFuel {
|
||||
private final int stage;
|
||||
|
||||
public MoistenerFuel(ItemStack item, ItemStack product, int stage, int moistenerValue) {
|
||||
Preconditions.checkNotNull(item);
|
||||
Preconditions.checkNotNull(product);
|
||||
Preconditions.checkArgument(!item.isEmpty());
|
||||
Preconditions.checkArgument(!product.isEmpty());
|
||||
this.item = item;
|
||||
this.product = product;
|
||||
this.stage = stage;
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|fuels")
|
||||
package forestry.api.fuels;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -23,12 +23,12 @@ public class AlleleManager {
|
||||
/**
|
||||
* Translates plain leaf blocks into genetic data. Used by bees and butterflies to convert and pollinate foreign leaf blocks.
|
||||
*/
|
||||
public static Map<Block, ILeafTranslator> leafTranslators = new HashMap<>();
|
||||
public static final Map<Block, ILeafTranslator> leafTranslators = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Translates plain saplings into genetic data. Used by the treealyzer and the farm to convert foreign saplings.
|
||||
*/
|
||||
public static Map<Item, ISaplingTranslator> saplingTranslation = new HashMap<>();
|
||||
public static final Map<Item, ISaplingTranslator> saplingTranslation = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Queryable instance of an {@link IClimateHelper} for easier implementation.
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Basic effect allele.
|
||||
*/
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright 2011-2014 SirSengir
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public interface IAllelePlantType extends IAllele {
|
||||
|
||||
EnumSet<EnumPlantType> getPlantTypes();
|
||||
|
||||
}
|
||||
@@ -1,13 +1,11 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public interface IAlleleProperty<A extends IAlleleProperty<A>> extends IAllele, Comparable<A> {
|
||||
|
||||
/**
|
||||
* To compare the allele for the properties
|
||||
*/
|
||||
@Override
|
||||
int compareTo(@Nonnull A o);
|
||||
int compareTo(A o);
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -39,6 +40,7 @@ public interface IAlleleRegistry {
|
||||
* @param uid Unique id for the species class, i.e. "rootBees", "rootTrees", "rootButterflies".
|
||||
* @return {@link ISpeciesRoot} if it exists, null otherwise.
|
||||
*/
|
||||
@Nullable
|
||||
ISpeciesRoot getSpeciesRoot(String uid);
|
||||
|
||||
/**
|
||||
@@ -46,6 +48,7 @@ public interface IAlleleRegistry {
|
||||
* @param stack An itemstack possibly containing NBT data which can be converted by a species root.
|
||||
* @return {@link ISpeciesRoot} if found, null otherwise.
|
||||
*/
|
||||
@Nullable
|
||||
ISpeciesRoot getSpeciesRoot(ItemStack stack);
|
||||
|
||||
/**
|
||||
@@ -53,8 +56,14 @@ public interface IAlleleRegistry {
|
||||
* @param clz Class extending {@link IIndividual}.
|
||||
* @return {@link ISpeciesRoot} if found, null otherwise.
|
||||
*/
|
||||
@Nullable
|
||||
ISpeciesRoot getSpeciesRoot(Class<? extends IIndividual> clz);
|
||||
|
||||
/**
|
||||
* Retrieve a matching {@link ISpeciesRoot} for the given {@link IIndividual}
|
||||
*/
|
||||
ISpeciesRoot getSpeciesRoot(IIndividual individual);
|
||||
|
||||
/* INDIVIDUAL */
|
||||
|
||||
/**
|
||||
@@ -72,6 +81,7 @@ public interface IAlleleRegistry {
|
||||
* Stack to retrieve genetic information for.
|
||||
* @return IIndividual containing genetic information, null if none could be extracted.
|
||||
*/
|
||||
@Nullable
|
||||
IIndividual getIndividual(ItemStack stack);
|
||||
|
||||
/* ALLELES */
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -20,6 +22,7 @@ public interface IBreedingTracker {
|
||||
/**
|
||||
* @return Name of the current {@link IBeekeepingMode}.
|
||||
*/
|
||||
@Nullable
|
||||
String getModeName();
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Biological classifications from domain down to genus.
|
||||
*
|
||||
@@ -62,12 +64,12 @@ public interface IClassification {
|
||||
/**
|
||||
* A branch approximates a "genus" in real life. Real life examples: "Micrapis", "Megapis"
|
||||
*
|
||||
* @return flavour text (may be null)
|
||||
* @return flavour text
|
||||
*/
|
||||
String getScientific();
|
||||
|
||||
/**
|
||||
* @return Localized description of this branch. (May be null.)
|
||||
* @return Localized description of this branch.
|
||||
*/
|
||||
String getDescription();
|
||||
|
||||
@@ -96,12 +98,11 @@ public interface IClassification {
|
||||
/**
|
||||
* @return Parent classification, null if this is root.
|
||||
*/
|
||||
@Nullable
|
||||
IClassification getParent();
|
||||
|
||||
/**
|
||||
* Only used internally by the AlleleRegistry if this classification has been added to another one.
|
||||
*
|
||||
* @param parent
|
||||
*/
|
||||
void setParent(IClassification parent);
|
||||
}
|
||||
@@ -16,13 +16,9 @@ import forestry.api.core.INbtWritable;
|
||||
public interface IEffectData extends INbtWritable, INbtReadable {
|
||||
void setInteger(int index, int val);
|
||||
|
||||
void setFloat(int index, float val);
|
||||
|
||||
void setBoolean(int index, boolean val);
|
||||
|
||||
int getInteger(int index);
|
||||
|
||||
float getFloat(int index);
|
||||
|
||||
boolean getBoolean(int index);
|
||||
}
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
@@ -29,5 +31,5 @@ public interface IFlowerProvider {
|
||||
* If this flowerProvider does not affect the products, it should return the products unchanged.
|
||||
* @return Array of itemstacks being the (modified or unmodified) produce.
|
||||
*/
|
||||
ItemStack[] affectProducts(World world, IIndividual individual, BlockPos pos, ItemStack[] products);
|
||||
List<ItemStack> affectProducts(World world, IIndividual individual, BlockPos pos, List<ItemStack> products);
|
||||
}
|
||||
@@ -5,17 +5,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
|
||||
// See {@link forestry.api.apiculture.FlowerManager}.FlowerType___ for basic Forestry flower types.
|
||||
// Each IFlowerProvider has one flower type, and multiple IFlowerProviders may share one type.
|
||||
// "Acceptable flowers" allow nearby bees to do work.
|
||||
@@ -43,6 +41,7 @@ public interface IFlowerRegistry {
|
||||
* Registers custom logic for accepted flowers.
|
||||
* These rules are inefficient compared to ones made with registerAcceptableFlower, but may be necessary for tile entity flowers.
|
||||
* The flower types built into Forestry can not be used here.
|
||||
*
|
||||
* @since Forestry 4.0.8
|
||||
*/
|
||||
void registerAcceptableFlowerRule(IFlowerAcceptableRule flowerAcceptableRule, String... flowerTypes);
|
||||
@@ -51,7 +50,7 @@ public interface IFlowerRegistry {
|
||||
* Registers a plantable flower.
|
||||
* The distribution is based on its own weight and the total number of plants for this flowerType.
|
||||
*
|
||||
* @param weight Weight for the Flower (Vanilla = 1.0, Modded flowers < 1.0)
|
||||
* @param weight Weight for the Flower (Vanilla = 1.0, Modded flowers < 1.0)
|
||||
* @param flowerTypes See {@link forestry.api.apiculture.FlowerManager}.FlowerTypeXXX
|
||||
*/
|
||||
void registerPlantableFlower(IBlockState blockState, double weight, String... flowerTypes);
|
||||
@@ -63,12 +62,11 @@ public interface IFlowerRegistry {
|
||||
|
||||
/**
|
||||
* @param beeHousing The bee housing that will help determine the size of the area to check.
|
||||
* @param bee The bee that will help determine the size of the area to check.
|
||||
* @param bee The bee that will help determine the size of the area to check.
|
||||
* @param flowerType See {@link forestry.api.apiculture.FlowerManager}.FlowerTypeXXX
|
||||
* @param maxFlowers the largest number of flowers to check for before returning. Use 1 if you only need 1.
|
||||
* @return the coordinates of nearby accepted flowers, with size from 0 to maxFlowers.
|
||||
*/
|
||||
@Nonnull
|
||||
List<BlockPos> getAcceptedFlowerCoordinates(IBeeHousing beeHousing, IBee bee, String flowerType, int maxFlowers);
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
|
||||
/**
|
||||
* Can be implemented by tile entities which can bear fruit.
|
||||
@@ -30,10 +29,10 @@ public interface IFruitBearer {
|
||||
* Picks the fruits of this tile, resetting it to unripe fruits.
|
||||
*
|
||||
* @param tool
|
||||
* Tool used in picking the fruits. May be null.
|
||||
* Tool used in picking the fruits. May be empty.
|
||||
* @return Picked fruits.
|
||||
*/
|
||||
Collection<ItemStack> pickFruit(ItemStack tool);
|
||||
NonNullList<ItemStack> pickFruit(ItemStack tool);
|
||||
|
||||
/**
|
||||
* @return float indicating the ripeness of the fruit with >= 1.0f indicating full ripeness.
|
||||
|
||||
@@ -5,34 +5,26 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
|
||||
/**
|
||||
* Holds the {@link IChromosome}s which comprise the traits of a given individual.
|
||||
*
|
||||
* <p>
|
||||
* Only the default implementation is supported.
|
||||
*/
|
||||
public interface IGenome extends INbtWritable {
|
||||
|
||||
@Nonnull
|
||||
IAlleleSpecies getPrimary();
|
||||
|
||||
@Nonnull
|
||||
IAlleleSpecies getSecondary();
|
||||
|
||||
@Nonnull
|
||||
IChromosome[] getChromosomes();
|
||||
|
||||
@Nonnull
|
||||
IAllele getActiveAllele(IChromosomeType chromosomeType);
|
||||
|
||||
@Nonnull
|
||||
IAllele getInactiveAllele(IChromosomeType chromosomeType);
|
||||
|
||||
boolean isGeneticEqual(IGenome other);
|
||||
|
||||
@Nonnull
|
||||
ISpeciesRoot getSpeciesRoot();
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
@@ -35,7 +34,6 @@ public interface IIndividual extends INbtWritable {
|
||||
|
||||
boolean isSecret();
|
||||
|
||||
@Nonnull
|
||||
IGenome getGenome();
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IIndividualLiving extends IIndividual {
|
||||
@@ -12,6 +14,7 @@ public interface IIndividualLiving extends IIndividual {
|
||||
/**
|
||||
* @return Genetic information of the mate, null if unmated.
|
||||
*/
|
||||
@Nullable
|
||||
IGenome getMate();
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -39,6 +38,7 @@ public interface ISpeciesRoot {
|
||||
|
||||
/**
|
||||
* Used to check whether a given itemstack contains genetic data corresponding to an {@link IIndividual} of this class.
|
||||
*
|
||||
* @param stack itemstack to check.
|
||||
* @return true if the itemstack contains an {@link IIndividual} of this class, false otherwise.
|
||||
*/
|
||||
@@ -46,14 +46,16 @@ public interface ISpeciesRoot {
|
||||
|
||||
/**
|
||||
* Used to check whether a given itemstack contains genetic data corresponding to an {@link IIndividual} of this class and matches the given type.
|
||||
*
|
||||
* @param stack itemstack to check.
|
||||
* @param type Integer denoting the type needed to match. (i.e. butterfly vs. butterfly serum; bee queens, princesses, drones; etc.)
|
||||
* @param type Integer denoting the type needed to match. (i.e. butterfly vs. butterfly serum; bee queens, princesses, drones; etc.)
|
||||
* @return true if the itemstack contains an {@link IIndividual} of this class, false otherwise.
|
||||
*/
|
||||
boolean isMember(ItemStack stack, ISpeciesType type);
|
||||
|
||||
/**
|
||||
* Used to check whether the given {@link IIndividual} is member of this class.
|
||||
*
|
||||
* @param individual {@link IIndividual} to check.
|
||||
* @return true if the individual is member of this class, false otherwise.
|
||||
*/
|
||||
@@ -66,13 +68,15 @@ public interface ISpeciesRoot {
|
||||
@Nullable
|
||||
ISpeciesType getType(ItemStack itemStack);
|
||||
|
||||
/** Species type used to represent this species in icons */
|
||||
/**
|
||||
* Species type used to represent this species in icons
|
||||
*/
|
||||
ISpeciesType getIconType();
|
||||
|
||||
ItemStack getMemberStack(IIndividual individual, ISpeciesType type);
|
||||
|
||||
/* BREEDING TRACKER */
|
||||
IBreedingTracker getBreedingTracker(World world, GameProfile player);
|
||||
IBreedingTracker getBreedingTracker(World world, @Nullable GameProfile player);
|
||||
|
||||
/* GENOME MANIPULATION */
|
||||
IIndividual templateAsIndividual(IAllele[] template);
|
||||
@@ -109,6 +113,7 @@ public interface ISpeciesRoot {
|
||||
* @param identifier species UID
|
||||
* @return Array of {@link IAllele} representing a genome.
|
||||
*/
|
||||
@Nullable
|
||||
IAllele[] getTemplate(String identifier);
|
||||
|
||||
/**
|
||||
@@ -124,7 +129,7 @@ public interface ISpeciesRoot {
|
||||
|
||||
Map<String, IAllele[]> getGenomeTemplates();
|
||||
|
||||
ArrayList<? extends IIndividual> getIndividualTemplates();
|
||||
List<? extends IIndividual> getIndividualTemplates();
|
||||
|
||||
/* MUTATIONS */
|
||||
|
||||
@@ -147,8 +152,8 @@ public interface ISpeciesRoot {
|
||||
List<? extends IMutation> getCombinations(IAllele other);
|
||||
|
||||
/**
|
||||
* @since Forestry 3.7
|
||||
* @return all possible mutations that result from breeding two species
|
||||
* @since Forestry 3.7
|
||||
*/
|
||||
List<IMutation> getCombinations(IAlleleSpecies parentSpecies0, IAlleleSpecies parentSpecies1, boolean shuffle);
|
||||
|
||||
@@ -163,7 +168,8 @@ public interface ISpeciesRoot {
|
||||
|
||||
/**
|
||||
* Sets an item stack as a valid (generic) research catalyst for this class.
|
||||
* @param itemstack ItemStack to set as suitable.
|
||||
*
|
||||
* @param itemstack ItemStack to set as suitable.
|
||||
* @param suitability Float between 0 and 1 to indicate suitability.
|
||||
*/
|
||||
void setResearchSuitability(ItemStack itemstack, float suitability);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -12,7 +14,8 @@ import net.minecraft.world.World;
|
||||
public interface ISpeciesRootPollinatable extends ISpeciesRoot {
|
||||
|
||||
ICheckPollinatable createPollinatable(IIndividual individual);
|
||||
|
||||
IPollinatable tryConvertToPollinatable(GameProfile owner, World world, final BlockPos pos, final IIndividual pollen);
|
||||
|
||||
@Nullable
|
||||
IPollinatable tryConvertToPollinatable(@Nullable GameProfile owner, World world, final BlockPos pos, final IIndividual pollen);
|
||||
|
||||
}
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "4.7.1", owner = "ForestryAPI|core", provides = "ForestryAPI|genetics")
|
||||
package forestry.api.genetics;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -5,71 +5,64 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import forestry.api.core.ICamouflageHandler;
|
||||
import forestry.api.core.ICamouflagedTile;
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class GreenhouseEvents extends Event {
|
||||
|
||||
|
||||
@Nullable
|
||||
public final IGreenhouseController controller;
|
||||
|
||||
|
||||
public GreenhouseEvents(@Nullable IGreenhouseController state) {
|
||||
this.controller = state;
|
||||
}
|
||||
|
||||
public static class CamouflageChangeEvent extends GreenhouseEvents{
|
||||
|
||||
public static class CamouflageChangeEvent extends GreenhouseEvents {
|
||||
|
||||
@Nullable
|
||||
public ICamouflagedTile camouflagedBlock;
|
||||
@Nonnull
|
||||
public ICamouflageHandler camouflageHandler;
|
||||
@Nonnull
|
||||
public final ICamouflagedTile camouflagedBlock;
|
||||
|
||||
public final ICamouflageHandler camouflageHandler;
|
||||
|
||||
public final String camouflageType;
|
||||
|
||||
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, @Nonnull ICamouflageHandler camouflageHandler, @Nonnull String camouflageType) {
|
||||
|
||||
public CamouflageChangeEvent(IGreenhouseController controller, @Nullable ICamouflagedTile camouflagedBlock, ICamouflageHandler camouflageHandler, String camouflageType) {
|
||||
super(controller);
|
||||
|
||||
|
||||
this.camouflagedBlock = camouflagedBlock;
|
||||
this.camouflageHandler = camouflageHandler;
|
||||
this.camouflageType = camouflageType;
|
||||
}
|
||||
}
|
||||
|
||||
public static class InternalBlockEvent extends GreenhouseEvents{
|
||||
|
||||
@Nonnull
|
||||
public IInternalBlock internalBlock;
|
||||
|
||||
public InternalBlockEvent(IGreenhouseController controller, @Nonnull IInternalBlock internalBlock) {
|
||||
public static class InternalBlockEvent extends GreenhouseEvents {
|
||||
public final IInternalBlock internalBlock;
|
||||
|
||||
public InternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
|
||||
super(controller);
|
||||
|
||||
this.internalBlock = internalBlock;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CreateInternalBlockEvent extends InternalBlockEvent{
|
||||
|
||||
this.internalBlock = internalBlock;
|
||||
}
|
||||
}
|
||||
|
||||
public static class CreateInternalBlockEvent extends InternalBlockEvent {
|
||||
public CreateInternalBlockEvent(IGreenhouseController controller, IInternalBlock internalBlock) {
|
||||
super(controller, internalBlock);
|
||||
}
|
||||
}
|
||||
|
||||
public static class CheckInternalBlockFaceEvent extends InternalBlockEvent{
|
||||
|
||||
@Nonnull
|
||||
public static class CheckInternalBlockFaceEvent extends InternalBlockEvent {
|
||||
public final IInternalBlockFace face;
|
||||
|
||||
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, @Nonnull IInternalBlockFace face) {
|
||||
|
||||
public CheckInternalBlockFaceEvent(IGreenhouseController controller, IInternalBlock internalBlock, IInternalBlockFace face) {
|
||||
super(controller, internalBlock);
|
||||
|
||||
|
||||
this.face = face;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.api.multiblock.IGreenhouseController;
|
||||
@@ -16,6 +17,7 @@ public interface IGreenhouseHelper {
|
||||
/**
|
||||
* @return A {@link IGreenhouseController} of a greenhouse, when the pos is a greenhouse
|
||||
*/
|
||||
@Nullable
|
||||
IGreenhouseController getGreenhouseController(World world, BlockPos pos);
|
||||
|
||||
void addGreenhouseLogic(Class<? extends IGreenhouseLogic> logic);
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -13,14 +12,12 @@ import java.util.Collection;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IInternalBlock {
|
||||
|
||||
@Nonnull
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
@Nullable
|
||||
IInternalBlock getRoot();
|
||||
|
||||
@Nonnull
|
||||
|
||||
Collection<IInternalBlockFace> getFaces();
|
||||
|
||||
}
|
||||
@@ -5,8 +5,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
@@ -15,11 +13,9 @@ public interface IInternalBlockFace {
|
||||
boolean isTested();
|
||||
|
||||
void setTested(boolean tested);
|
||||
|
||||
@Nonnull
|
||||
|
||||
EnumFacing getFace();
|
||||
|
||||
@Nonnull
|
||||
|
||||
BlockPos getPos();
|
||||
|
||||
}
|
||||
@@ -3,7 +3,12 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@API(apiVersion = "5.2.0", owner = "ForestryAPI|core", provides = "ForestryAPI|greenhouse")
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -72,15 +72,15 @@ public enum EnumButterflyChromosome implements IChromosomeType {
|
||||
|
||||
COCOON(IAlleleButterflyCocoon.class);
|
||||
|
||||
Class<? extends IAllele> clss;
|
||||
private final Class<? extends IAllele> alleleClass;
|
||||
|
||||
EnumButterflyChromosome(Class<? extends IAllele> clss) {
|
||||
this.clss = clss;
|
||||
EnumButterflyChromosome(Class<? extends IAllele> alleleClass) {
|
||||
this.alleleClass = alleleClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends IAllele> getAlleleClass() {
|
||||
return clss;
|
||||
return alleleClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Loaded 100 of 1145 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user