mirror of
https://github.com/GTNewHorizons/MagicBees.git
synced 2026-11-18 19:39:06 +00:00
Fully Fleshed out Functionality and GUI. Having some small issues with the paritcleFX, but not huge deal right now. Would be nice to have, but crashes make people even sadder.
This commit is contained in:
1 parent
e5cea4e3dd
commit
729908b1b0
6 files changed
+542
-82
No files matched your search
@@ -0,0 +1,231 @@
|
||||
package magicbees.tileentity;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import magicbees.bees.BeeManager;
|
||||
import magicbees.itemInventories.InventoryBeeRing;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.*;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.api.core.IErrorState;
|
||||
|
||||
public class RingHousing implements IBeeHousing {
|
||||
|
||||
EntityPlayer player;
|
||||
BiomeGenBase biome;
|
||||
IBeeHousingInventory inventory;
|
||||
IBeekeepingLogic beekeepingLogic;
|
||||
|
||||
private static final IErrorLogic errorLogic = new RingHousing.RingErrorLogic();
|
||||
private static final Iterable<IBeeListener> beeListeners = ImmutableSet.of(new DefaultBeeListener());
|
||||
private static final Iterable<IBeeModifier> beeModifiers = ImmutableSet.of(new RingHousing.RingHousingModifier());
|
||||
|
||||
public RingHousing(EntityPlayer player, InventoryBeeRing IBR) {
|
||||
this.player = player;
|
||||
this.biome = player.getEntityWorld().getBiomeGenForCoords((int) player.posX, (int) player.posY);
|
||||
this.inventory = new RingBeeHousingInventory(IBR);
|
||||
this.beekeepingLogic = BeeManager.beeRoot.createBeekeepingLogic(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IBeeModifier> getBeeModifiers() {
|
||||
return beeModifiers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IBeeListener> getBeeListeners() {
|
||||
return beeListeners;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBeekeepingLogic getBeekeepingLogic() {
|
||||
return beekeepingLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockLightValue() {
|
||||
return player.getEntityWorld()
|
||||
.getBlockLightValue((int) player.posX, ((int) player.posY) + 1, (int) player.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBlockSeeTheSky() {
|
||||
return player.getEntityWorld().canBlockSeeTheSky((int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return player.getEntityWorld();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameProfile getOwner() {
|
||||
return player.getGameProfile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Vec3 getBeeFXCoordinates() {
|
||||
return Vec3.createVectorHelper(player.posX, player.posY + 0.5, player.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return this.biome;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromBiome(biome, (int) player.posX, (int) player.posY, (int) player.posZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(biome.rainfall);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IErrorLogic getErrorLogic() {
|
||||
return errorLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkCoordinates getCoordinates() {
|
||||
return player.getPlayerCoordinates();
|
||||
}
|
||||
|
||||
private static class RingBeeHousingInventory implements IBeeHousingInventory {
|
||||
|
||||
private final InventoryBeeRing IBR;
|
||||
|
||||
public RingBeeHousingInventory(InventoryBeeRing IBR) {
|
||||
this.IBR = IBR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getQueen() {
|
||||
return IBR.getStackInSlot(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDrone() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setQueen(ItemStack itemStack) {
|
||||
IBR.setInventorySlotContents(1, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDrone(ItemStack itemstack) {}
|
||||
|
||||
@Override
|
||||
public boolean addProduct(ItemStack product, boolean all) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static class RingErrorLogic implements IErrorLogic {
|
||||
|
||||
@Override
|
||||
public boolean setCondition(boolean condition, IErrorState errorState) {
|
||||
return condition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(IErrorState state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasErrors() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearErrors() {}
|
||||
|
||||
@Override
|
||||
public void writeData(DataOutputStream data) throws IOException {}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStream data) throws IOException {}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<IErrorState> getErrorStates() {
|
||||
return ImmutableSet.of();
|
||||
}
|
||||
}
|
||||
|
||||
private static class RingHousingModifier implements IBeeModifier {
|
||||
|
||||
@Override
|
||||
public float getTerritoryModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0.9f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getMutationModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getLifespanModifier(IBeeGenome genome, IBeeGenome mate, float currentModifier) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getProductionModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getFloweringModifier(IBeeGenome genome, float currentModifier) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGeneticDecay(IBeeGenome genome, float currentModifier) {
|
||||
return 0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSealed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfLighted() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSunlightSimulated() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHellish() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user