mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 03:59:45 +00:00
Fix #901 Fix some stuff for WAILAPlugins
This commit is contained in:
1 parent
4716f8daf7
commit
07defbeec3
9 files changed
+112
-81
No files matched your search
@@ -10,14 +10,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.apiculture.blocks.BlockAlveary;
|
||||
import forestry.core.multiblock.MultiblockControllerBase;
|
||||
import forestry.core.multiblock.MultiblockValidationException;
|
||||
import forestry.core.multiblock.rectangular.RectangularMultiblockTileEntityBase;
|
||||
|
||||
public abstract class TileAlveary extends RectangularMultiblockTileEntityBase {
|
||||
public abstract class TileAlveary extends RectangularMultiblockTileEntityBase implements IBeeHousing {
|
||||
|
||||
public static final int PLAIN_META = 0;
|
||||
public static final int ENTRANCE_META = 1;
|
||||
@@ -95,4 +106,67 @@ public abstract class TileAlveary extends RectangularMultiblockTileEntityBase {
|
||||
}
|
||||
}
|
||||
|
||||
/* IHousing */
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return getAlvearyController().getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getCoordinates() {
|
||||
return getAlvearyController().getCoordinates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return getAlvearyController().getBiome();
|
||||
}
|
||||
|
||||
/* IBeeHousing */
|
||||
@Override
|
||||
public Iterable<IBeeModifier> getBeeModifiers() {
|
||||
return getAlvearyController().getBeeModifiers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return getAlvearyController().getBeeListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return getAlvearyController().getBeeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeekeepingLogic getBeekeepingLogic() {
|
||||
return getAlvearyController().getBeekeepingLogic();
|
||||
}
|
||||
|
||||
/* IClimatised */
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return getAlvearyController().getTemperature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return getAlvearyController().getHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightValue() {
|
||||
return getAlvearyController().getBlockLightValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return getAlvearyController().canBlockSeeTheSky();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorLogic getErrorLogic() {
|
||||
return getAlvearyController().getErrorLogic();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,23 +16,12 @@ import java.util.Collection;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.gui.IHintSource;
|
||||
@@ -53,7 +42,7 @@ import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class TileAlvearyPlain extends TileAlveary implements IBeeHousing, IClimatised, IHintSource, IStreamableGui, ITitled, ITriggerProvider {
|
||||
public class TileAlvearyPlain extends TileAlveary implements IClimatised, IHintSource, IStreamableGui, ITitled, ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public void onMachineAssembled(MultiblockControllerBase controller) {
|
||||
@@ -139,64 +128,7 @@ public class TileAlvearyPlain extends TileAlveary implements IBeeHousing, IClima
|
||||
return res;
|
||||
}
|
||||
|
||||
/* IHousing */
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return getAlvearyController().getWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getCoordinates() {
|
||||
return getAlvearyController().getCoordinates();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return getAlvearyController().getBiome();
|
||||
}
|
||||
|
||||
/* IBeeHousing */
|
||||
@Override
|
||||
public Iterable<IBeeModifier> getBeeModifiers() {
|
||||
return getAlvearyController().getBeeModifiers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return getAlvearyController().getBeeListeners();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return getAlvearyController().getBeeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeekeepingLogic getBeekeepingLogic() {
|
||||
return getAlvearyController().getBeekeepingLogic();
|
||||
}
|
||||
|
||||
/* IClimatised */
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return getAlvearyController().getTemperature();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return getAlvearyController().getHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightValue() {
|
||||
return getAlvearyController().getBlockLightValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return getAlvearyController().canBlockSeeTheSky();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
return getAlvearyController().getExactTemperature();
|
||||
@@ -206,10 +138,4 @@ public class TileAlvearyPlain extends TileAlveary implements IBeeHousing, IClima
|
||||
public float getExactHumidity() {
|
||||
return getAlvearyController().getExactHumidity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorLogic getErrorLogic() {
|
||||
return getAlvearyController().getErrorLogic();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,4 +39,9 @@ public class CheckPollinatable implements ICheckPollinatable {
|
||||
public boolean canMateWith(IIndividual pollen) {
|
||||
return pollinatable.canMateWith(pollen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPollinated() {
|
||||
return pollinatable.isPollinated();
|
||||
}
|
||||
}
|
||||
@@ -47,4 +47,8 @@ public class CheckPollinatableTree implements ICheckPollinatable {
|
||||
return !tree.isGeneticEqual(pollen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPollinated() {
|
||||
return tree.getMate() != null;
|
||||
}
|
||||
}
|
||||
@@ -34,4 +34,9 @@ public class FakePollinatable implements IPollinatable {
|
||||
public void mateWith(IIndividual pollen) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPollinated() {
|
||||
return checkPollinatable.isPollinated();
|
||||
}
|
||||
}
|
||||
@@ -38,4 +38,6 @@ public interface ICheckPollinatable {
|
||||
* @return true if mating is possible, false otherwise.
|
||||
*/
|
||||
boolean canMateWith(IIndividual pollen);
|
||||
|
||||
boolean isPollinated();
|
||||
}
|
||||
@@ -258,7 +258,8 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
return damage > tree.getResilience();
|
||||
}
|
||||
|
||||
private boolean isPollinated() {
|
||||
@Override
|
||||
public boolean isPollinated() {
|
||||
ITree tree = getTree();
|
||||
return tree != null && !isDestroyed(tree, damage) && tree.getMate() != null;
|
||||
}
|
||||
@@ -576,5 +577,4 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
ITree tree = getTree();
|
||||
return !isDecorative && !isDestroyed(tree, damage) && caterpillar == null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -13,6 +13,7 @@ package forestry.arboriculture.tiles;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTUtil;
|
||||
import net.minecraft.network.Packet;
|
||||
@@ -25,17 +26,19 @@ import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.arboriculture.genetics.Tree;
|
||||
import forestry.core.access.IOwnable;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.network.PacketTileStream;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
|
||||
/**
|
||||
* This is the base TE class for any block that needs to contain tree genome information.
|
||||
*
|
||||
* @author SirSengir
|
||||
*/
|
||||
public abstract class TileTreeContainer extends TileEntity implements IStreamable {
|
||||
public abstract class TileTreeContainer extends TileEntity implements IStreamable, IOwnable {
|
||||
|
||||
private ITree containedTree;
|
||||
private GameProfile owner;
|
||||
@@ -108,15 +111,27 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl
|
||||
return this.containedTree;
|
||||
}
|
||||
|
||||
/* Owner */
|
||||
/* IOwnable */
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOwner(GameProfile owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOwned() {
|
||||
return owner != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOwner(EntityPlayer player) {
|
||||
return player != null && PlayerUtil.isSameGameProfile(player.getGameProfile(), owner);
|
||||
}
|
||||
|
||||
/* UPDATING */
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user