Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
05c6f4effa | ||
|
|
b9c36df910 | ||
|
|
d2fe7ac8a4 | ||
|
|
2bdca1266a | ||
|
|
dd3cc6aef9 | ||
|
|
41c20ea97a | ||
|
|
2dbc507486 | ||
|
|
a56200228f | ||
|
|
951d38abfa | ||
|
|
542cbab826 | ||
|
|
17237e41f8 | ||
|
|
c7f268f200 | ||
|
|
645dba903d | ||
|
|
1ac4acdb47 | ||
|
|
74aa33e80c |
No files matched your search
@@ -7,4 +7,4 @@ ic2_version=2.5.5-ex19
|
||||
|
||||
version_major=5
|
||||
version_minor=0
|
||||
version_patch=22
|
||||
version_patch=24
|
||||
@@ -5,6 +5,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -32,6 +34,7 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
*/
|
||||
Iterable<IBeeListener> getBeeListeners();
|
||||
|
||||
@Nonnull
|
||||
IBeeHousingInventory getBeeInventory();
|
||||
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
|
||||
@@ -84,7 +84,7 @@ public interface ITree extends IIndividual, ITreeGenData {
|
||||
* @return Integer denoting the size of the tree trunk.
|
||||
*/
|
||||
@Override
|
||||
int getGirth(World world, BlockPos pos);
|
||||
int getGirth();
|
||||
|
||||
/**
|
||||
* @return Growth conditions at the given position.
|
||||
|
||||
@@ -18,7 +18,7 @@ import forestry.api.arboriculture.ITreeGenome;
|
||||
|
||||
public interface ITreeGenData {
|
||||
|
||||
int getGirth(World world, BlockPos pos);
|
||||
int getGirth();
|
||||
|
||||
float getHeightModifier();
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@@ -233,18 +234,20 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
if (beeType == EnumBeeType.PRINCESS) {
|
||||
tickBreed();
|
||||
} else if (beeType == EnumBeeType.QUEEN) {
|
||||
queenWorkTick(queen);
|
||||
queenWorkTick(queen, queenStack);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearCachedValues() {
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
canWork();
|
||||
if (!housing.getWorldObj().isRemote) {
|
||||
hasFlowersCache.clear();
|
||||
queenCanWorkCache.clear();
|
||||
canWork();
|
||||
}
|
||||
}
|
||||
|
||||
private void queenWorkTick(IBee queen) {
|
||||
private void queenWorkTick(@Nullable IBee queen, @Nonnull ItemStack queenStack) {
|
||||
if (queen == null) {
|
||||
beeProgress = 0;
|
||||
beeProgressMax = 0;
|
||||
@@ -270,7 +273,8 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
// Write the changed queen back into the item stack.
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
queen.writeToNBT(nbttagcompound);
|
||||
housing.getBeeInventory().getQueen().setTagCompound(nbttagcompound);
|
||||
queenStack.setTagCompound(nbttagcompound);
|
||||
housing.getBeeInventory().setQueen(queenStack);
|
||||
}
|
||||
|
||||
beeProgress = queen.getHealth();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -36,8 +37,11 @@ import forestry.core.config.Config;
|
||||
import forestry.core.inventory.IInventoryAdapter;
|
||||
|
||||
public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implements IApiary {
|
||||
@Nonnull
|
||||
private static final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
@Nonnull
|
||||
private final IBeeListener beeListener = new ApiaryBeeListener(this);
|
||||
@Nonnull
|
||||
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@@ -64,6 +68,7 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.entities;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@@ -72,6 +73,7 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
return Collections.singleton(beeListener);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return beeInventory;
|
||||
|
||||
@@ -53,6 +53,7 @@ import forestry.core.utils.Translator;
|
||||
|
||||
public class AlvearyController extends RectangularMultiblockControllerBase implements IAlvearyControllerInternal, IClimateControlled {
|
||||
|
||||
@Nonnull
|
||||
private final InventoryBeeHousing inventory;
|
||||
private final IBeekeepingLogic beekeepingLogic;
|
||||
|
||||
@@ -77,6 +78,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
this.beeModifiers.add(new AlvearyBeeModifier());
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
@@ -45,6 +46,7 @@ public class FakeAlvearyController extends FakeMultiblockController implements I
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return FakeBeeHousingInventory.instance;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -99,6 +100,7 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
|
||||
return getMultiblockLogic().getController().getBeeListeners();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return getMultiblockLogic().getController().getBeeInventory();
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
|
||||
public class FakeBeeHousingInventory implements IBeeHousingInventory {
|
||||
@Nonnull
|
||||
public static final FakeBeeHousingInventory instance = new FakeBeeHousingInventory();
|
||||
|
||||
private FakeBeeHousingInventory() {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -30,8 +31,11 @@ import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
|
||||
public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
@Nonnull
|
||||
private final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
@Nonnull
|
||||
private final IBeeListener beeListener = new ApiaryBeeListener(this);
|
||||
@Nonnull
|
||||
private final InventoryApiary inventory = new InventoryApiary(getAccessHandler());
|
||||
|
||||
public TileApiary() {
|
||||
@@ -39,6 +43,7 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
setInternalInventory(inventory);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.tiles;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -24,9 +25,12 @@ import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
|
||||
public class TileBeeHouse extends TileBeeHousingBase {
|
||||
@Nonnull
|
||||
private static final IBeeModifier beeModifier = new BeehouseBeeModifier();
|
||||
|
||||
@Nonnull
|
||||
private final IBeeListener beeListener;
|
||||
@Nonnull
|
||||
private final InventoryBeeHousing beeInventory;
|
||||
|
||||
public TileBeeHouse() {
|
||||
@@ -38,6 +42,7 @@ public class TileBeeHouse extends TileBeeHousingBase {
|
||||
setInternalInventory(beeInventory);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return beeInventory;
|
||||
|
||||
@@ -293,6 +293,7 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IBeeHousingInventory getBeeInventory() {
|
||||
return inventory;
|
||||
|
||||
@@ -101,7 +101,6 @@ public class BlockArbDoor extends BlockDoor implements IWoodTyped, IItemModelReg
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) {
|
||||
return new ItemStack(getItem());
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class Tree extends Individual implements ITree, IPlantable {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGirth(World world, BlockPos pos) {
|
||||
public int getGirth() {
|
||||
return genome.getGirth();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.arboriculture.blocks.BlockSapling;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -61,6 +62,7 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
}
|
||||
|
||||
if (genPos != null) {
|
||||
clearSaplings(world, genPos);
|
||||
List<BlockPos> branchEnds = new ArrayList<>(generateTrunk(world, rand, wood, genPos));
|
||||
Collections.sort(branchEnds, TopDownBlockPosComparator.INSTANCE);
|
||||
generateLeaves(world, rand, leaf, branchEnds, genPos);
|
||||
@@ -96,6 +98,18 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
|
||||
@Nullable
|
||||
public abstract BlockPos getValidGrowthPos(World world, BlockPos pos);
|
||||
|
||||
public void clearSaplings(World world, BlockPos genPos) {
|
||||
int treeGirth = tree.getGirth();
|
||||
for (int x = 0; x < treeGirth; x++) {
|
||||
for (int z = 0; z < treeGirth; z++) {
|
||||
BlockPos saplingPos = genPos.add(x, 0, z);
|
||||
if (world.getBlockState(saplingPos).getBlock() instanceof BlockSapling) {
|
||||
world.setBlockToAir(saplingPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasPods() {
|
||||
return tree.allowsFruitBlocks();
|
||||
}
|
||||
|
||||
@@ -47,12 +47,13 @@ public class WorldGenCherry extends WorldGenTree {
|
||||
|
||||
@Override
|
||||
protected void generateLeaves(World world, Random rand, TreeBlockTypeLeaf leaf, List<BlockPos> branchEnds, BlockPos startPos) {
|
||||
int leafSpawn = height + 1;
|
||||
int leafSpawn = height + 2;
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn--, 0), girth, girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn, 0), girth, (float) 1 + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
|
||||
WorldGenHelper.generateCylinderFromTreeStartPos(world, leaf, startPos.add(0, leafSpawn, 0), girth, 1 + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
|
||||
|
||||
for (BlockPos branchEnd : branchEnds) {
|
||||
WorldGenHelper.generateCircle(world, rand, branchEnd, 4, 3, 2, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
|
||||
WorldGenHelper.generateCircle(world, rand, branchEnd.up(), 3, 3, 1, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
|
||||
WorldGenHelper.generateCircle(world, rand, branchEnd, 4, 3, 1, leaf, 1.0f, WorldGenHelper.EnumReplaceMode.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,11 +31,10 @@ public class WorldGenEbony extends WorldGenTree {
|
||||
@Nonnull
|
||||
@Override
|
||||
public Set<BlockPos> generateTrunk(World world, Random rand, TreeBlockTypeLog wood, BlockPos startPos) {
|
||||
int offset = (girth - 1) / 2;
|
||||
int trunksGenerated = 0;
|
||||
|
||||
for (int x = -offset; x < -offset + girth; x++) {
|
||||
for (int z = -offset; z < -offset + girth; z++) {
|
||||
for (int x = 0; x < girth; x++) {
|
||||
for (int z = 0; z < girth; z++) {
|
||||
if (rand.nextFloat() < 0.6f) {
|
||||
for (int y = 0; y < height; y++) {
|
||||
WorldGenHelper.addBlock(world, startPos.add(x, y, z), wood, WorldGenHelper.EnumReplaceMode.ALL);
|
||||
@@ -68,8 +67,8 @@ public class WorldGenEbony extends WorldGenTree {
|
||||
h = height / 2 + rand.nextInt(height / 2);
|
||||
}
|
||||
|
||||
int x_off = -girth + rand.nextInt(2 * girth);
|
||||
int y_off = -girth + rand.nextInt(2 * girth);
|
||||
int x_off = rand.nextInt(girth);
|
||||
int y_off = rand.nextInt(girth);
|
||||
|
||||
BlockPos center = startPos.add(x_off, h, y_off);
|
||||
int radius = 1 + rand.nextInt(girth);
|
||||
|
||||
@@ -74,7 +74,7 @@ public abstract class WorldGenTree extends WorldGenArboriculture {
|
||||
public final void preGenerate(World world, Random rand, BlockPos startPos) {
|
||||
super.preGenerate(world, rand, startPos);
|
||||
height = determineHeight(world, rand, baseHeight, heightVariation);
|
||||
girth = tree.getGirth(world, startPos);
|
||||
girth = tree.getGirth();
|
||||
}
|
||||
|
||||
protected int modifyByHeight(World world, int val, int min, int max) {
|
||||
|
||||
@@ -23,16 +23,11 @@ import forestry.core.tiles.EscritoireGame;
|
||||
import forestry.core.tiles.TileEscritoire;
|
||||
|
||||
public class ContainerEscritoire extends ContainerTile<TileEscritoire> implements IGuiSelectable {
|
||||
|
||||
private final EntityPlayer player;
|
||||
|
||||
private long lastUpdate;
|
||||
|
||||
public ContainerEscritoire(EntityPlayer player, TileEscritoire tile) {
|
||||
super(tile, player.inventory, 34, 153);
|
||||
|
||||
this.player = player;
|
||||
|
||||
// Analyze slot
|
||||
addSlotToContainer(new SlotFiltered(this.tile, InventoryEscritoire.SLOT_ANALYZE, 97, 67).setPickupWatcher(this.tile).setStackLimit(1));
|
||||
|
||||
@@ -54,7 +49,7 @@ public class ContainerEscritoire extends ContainerTile<TileEscritoire> implement
|
||||
long gameLastUpdate = tile.getGame().getLastUpdate();
|
||||
if (lastUpdate != gameLastUpdate) {
|
||||
lastUpdate = gameLastUpdate;
|
||||
Proxies.net.sendToPlayer(new PacketGuiUpdate(tile), player);
|
||||
sendPacketToListeners(new PacketGuiUpdate(tile));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -91,6 +91,7 @@ public class GameTokenWidget extends Widget {
|
||||
|
||||
@Override
|
||||
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
|
||||
game.choose(index);
|
||||
Proxies.net.sendToServer(new PacketGuiSelectRequest(index, 0));
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ public class ProxyCommon {
|
||||
public boolean isOp(EntityPlayer player) {
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
UserListOpsEntry userlistopsentry = server.getPlayerList().getOppedPlayers().getEntry(player.getGameProfile());
|
||||
return userlistopsentry.getPermissionLevel() >= server.getOpPermissionLevel();
|
||||
return userlistopsentry != null && userlistopsentry.getPermissionLevel() >= server.getOpPermissionLevel();
|
||||
}
|
||||
|
||||
public double getBlockReachDistance(EntityPlayer entityplayer) {
|
||||
|
||||
@@ -104,6 +104,8 @@ public class RenderEscritoire extends TileEntitySpecialRenderer<TileEscritoire>
|
||||
rendermanager.doRenderEntity(dummyEntityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
dummyEntityItem.worldObj = null; // prevent leaking the world object
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.genetics.IAllele;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
@@ -72,10 +73,10 @@ public class EscritoireGameBoard implements INbtWritable, IStreamable {
|
||||
tokenCount = getTokenCount(genome);
|
||||
|
||||
for (int i = 0; i < tokenCount / 2; i++) {
|
||||
IIndividual token = root.templateAsIndividual(root.getRandomTemplate(rand));
|
||||
ItemStack pair = root.getMemberStack(token, root.getIconType());
|
||||
gameTokens.add(new EscritoireGameToken(pair));
|
||||
gameTokens.add(new EscritoireGameToken(pair));
|
||||
IAllele[] randomTemplate = root.getRandomTemplate(rand);
|
||||
String speciesUid = randomTemplate[root.getSpeciesChromosomeType().ordinal()].getUID();
|
||||
gameTokens.add(new EscritoireGameToken(speciesUid));
|
||||
gameTokens.add(new EscritoireGameToken(speciesUid));
|
||||
}
|
||||
Collections.shuffle(gameTokens);
|
||||
return true;
|
||||
|
||||
@@ -14,17 +14,19 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import forestry.api.core.INbtWritable;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.utils.ColourUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
|
||||
@@ -41,6 +43,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
private static final String[] OVERLAY_FAILED = new String[]{"errors/errored"};
|
||||
private static final String[] OVERLAY_SELECTED = new String[]{"errors/unknown"};
|
||||
|
||||
@Nullable
|
||||
private IIndividual tokenIndividual;
|
||||
@Nullable
|
||||
private ItemStack tokenStack;
|
||||
@Nonnull
|
||||
@@ -51,8 +55,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
// required for IStreamable serialization
|
||||
}
|
||||
|
||||
public EscritoireGameToken(@Nullable ItemStack tokenStack) {
|
||||
this.tokenStack = tokenStack;
|
||||
public EscritoireGameToken(@Nullable String speciesUid) {
|
||||
setTokenSpecies(speciesUid);
|
||||
}
|
||||
|
||||
public EscritoireGameToken(@Nonnull NBTTagCompound nbttagcompound) {
|
||||
@@ -61,8 +65,29 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
state = State.values()[stateOrdinal];
|
||||
}
|
||||
|
||||
// legacy
|
||||
if (nbttagcompound.hasKey("tokenStack")) {
|
||||
tokenStack = ItemStack.loadItemStackFromNBT(nbttagcompound.getCompoundTag("tokenStack"));
|
||||
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(tokenStack);
|
||||
tokenIndividual = speciesRoot.getMember(tokenStack);
|
||||
}
|
||||
|
||||
if (nbttagcompound.hasKey("tokenSpecies")) {
|
||||
String speciesUid = nbttagcompound.getString("tokenSpecies");
|
||||
setTokenSpecies(speciesUid);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTokenSpecies(String speciesUid) {
|
||||
IAllele allele = AlleleManager.alleleRegistry.getAllele(speciesUid);
|
||||
if (allele instanceof IAlleleSpecies) {
|
||||
IAlleleSpecies species = (IAlleleSpecies) allele;
|
||||
ISpeciesRoot root = species.getRoot();
|
||||
IAllele[] template = root.getTemplate(speciesUid);
|
||||
if (template != null) {
|
||||
this.tokenIndividual = root.templateAsIndividual(template);
|
||||
this.tokenStack = root.getMemberStack(this.tokenIndividual, root.getIconType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,12 +133,11 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
}
|
||||
|
||||
public int getTokenColour() {
|
||||
if (tokenStack == null || !isVisible()) {
|
||||
if (tokenIndividual == null || !isVisible()) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
IIndividual individual = AlleleManager.alleleRegistry.getIndividual(tokenStack);
|
||||
int iconColor = individual.getGenome().getPrimary().getSpriteColour(0);
|
||||
int iconColor = tokenIndividual.getGenome().getPrimary().getSpriteColour(0);
|
||||
|
||||
if (state == State.MATCHED) {
|
||||
return ColourUtil.multiplyRGBComponents(iconColor, 0.7f);
|
||||
@@ -146,10 +170,8 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setInteger("state", state.ordinal());
|
||||
|
||||
if (tokenStack != null) {
|
||||
NBTTagCompound stackcompound = new NBTTagCompound();
|
||||
tokenStack.writeToNBT(stackcompound);
|
||||
nbttagcompound.setTag("tokenStack", stackcompound);
|
||||
if (tokenIndividual != null) {
|
||||
nbttagcompound.setString("tokenSpecies", tokenIndividual.getGenome().getPrimary().getUID());
|
||||
}
|
||||
return nbttagcompound;
|
||||
}
|
||||
@@ -158,12 +180,20 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
|
||||
@Override
|
||||
public void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeEnum(state, State.VALUES);
|
||||
data.writeItemStack(tokenStack);
|
||||
if (tokenIndividual != null) {
|
||||
data.writeBoolean(true);
|
||||
data.writeUTF(tokenIndividual.getGenome().getPrimary().getUID());
|
||||
} else {
|
||||
data.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
state = data.readEnum(State.VALUES);
|
||||
tokenStack = data.readItemStack();
|
||||
if (data.readBoolean()) {
|
||||
String speciesUid = data.readUTF();
|
||||
setTokenSpecies(speciesUid);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
|
||||
|
||||
BlockPos posBelow = pos.down();
|
||||
IBlockState blockStateBelow = worldObj.getBlockState(posBelow);
|
||||
Block blockBelow = blockState.getBlock();
|
||||
Block blockBelow = blockStateBelow.getBlock();
|
||||
if (blockBelow.isLeaves(blockStateBelow, worldObj, posBelow)) {
|
||||
weight += 2.5f;
|
||||
} else if (blockBelow instanceof BlockFence) {
|
||||
|
||||
@@ -33,7 +33,7 @@ import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
|
||||
|
||||
public enum MothDefinition implements IButterflyDefinition {
|
||||
Brimstone(ButterflyBranchDefinition.Opisthograptis, "brimstone", "luteolata", new Color(0xffea40), true, 1.0f),
|
||||
LatticedHeath(ButterflyBranchDefinition.Chiasmia, "latticeHeath", "clathrata", new Color(0xf2f0be), true, 0.5f) {
|
||||
LatticedHeath(ButterflyBranchDefinition.Chiasmia, "latticedHeath", "clathrata", new Color(0xf2f0be), true, 0.5f) {
|
||||
@Override
|
||||
protected void setAlleles(IAllele[] alleles) {
|
||||
AlleleHelper.instance.set(alleles, EnumButterflyChromosome.SIZE, EnumAllele.Size.SMALLEST);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ModelButterflyItem extends BlankItemModel {
|
||||
ImmutableMap.Builder<String, String> textures = ImmutableMap.builder();
|
||||
textures.put("butterfly", butterfly.getGenome().getSecondary().getItemTexture());
|
||||
IModel retexturedModel = ModelProcessingHelper.retexture(modelButterfly, textures.build());
|
||||
return new TRSRBakedModel(retexturedModel.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.03125F, 0.0F, -0.03125F, butterfly.getSize() * 1.5F);
|
||||
return new TRSRBakedModel(retexturedModel.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.03125F, 0.5F, -0.03125F, butterfly.getSize() * 1.5F);
|
||||
}
|
||||
|
||||
private class ButterflyItemOverrideList extends ItemOverrideList {
|
||||
|
||||
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 195 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 236 B |