Merge branch 'dev' of github.com:ForestryMC/ForestryMC into dev

This commit is contained in:
MysteriousAges committed 2014-12-04 01:37:01 -08:00
commit 4ab3e7ddb4
11 files changed
+92 -66

No files matched your search

@@ -105,13 +105,13 @@ public class BlockAlveary extends BlockStructure {
public static final int BOTTOM = 2;
public static final int LEFT = 3;
public static final int RIGHT = 4;
public static final int TX_55_SWOF = 5;
public static final int TX_56_SWON = 6;
public static final int TX_57_HTOF = 7;
public static final int TX_58_HTON = 8;
public static final int TX_71_FNOF = 9;
public static final int TX_72_FNON = 10;
public static final int TX_73_VLVE = 11;
public static final int ALVEARY_SWARMER_OFF = 5;
public static final int ALVEARY_SWARMER_ON = 6;
public static final int ALVEARY_HEATER_OFF = 7;
public static final int ALVEARY_HEATER_ON = 8;
public static final int ALVEARY_FAN_OFF = 9;
public static final int ALVEARY_FAN_ON = 10;
public static final int ALVEARY_HYGRO = 11;
public static final int STABILISER = 12;
public static final int SIEVE = 13;
@@ -152,13 +152,13 @@ public class BlockAlveary extends BlockStructure {
case 1:
return icons[ENTRANCE];
case TileAlvearySwarmer.BLOCK_META:
return icons[TX_55_SWOF];
return icons[ALVEARY_SWARMER_OFF];
case TileAlvearyFan.BLOCK_META:
return icons[TX_71_FNOF];
return icons[ALVEARY_FAN_OFF];
case TileAlvearyHeater.BLOCK_META:
return icons[TX_57_HTOF];
return icons[ALVEARY_HEATER_OFF];
case TileAlvearyHygroregulator.BLOCK_META:
return icons[TX_73_VLVE];
return icons[ALVEARY_HYGRO];
case TileAlvearyStabiliser.BLOCK_META:
return icons[STABILISER];
case TileAlvearySieve.BLOCK_META:
@@ -34,15 +34,14 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
}
protected final EnergyManager energyManager;
private final ClimateControl climateControl;
private int transferTime = 0;
private int animationDelay = 0;
private int workingTime = 0;
private final int textureOff;
private final int textureOn;
public TileAlvearyClimatiser(ClimateControl control, int textureOff, int textureOn, int componentBlockMeta) {
super(componentBlockMeta);
this.climateControl = control;
energyManager = new EnergyManager(1000, 250, 2000);
energyManager = new EnergyManager(1000, 50, 2000);
energyManager.setReceiveOnly();
this.textureOff = textureOff;
this.textureOn = textureOn;
@@ -60,28 +59,22 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
if (!this.hasMaster())
return;
if (energyManager.consumeEnergyToDoWork()) {
boolean wasInactive = (workingTime == 0);
transferTime = energyManager.getEnergyPerWork();
if (animationDelay <= 0) {
animationDelay = 100;
sendNetworkUpdate();
} else
animationDelay = 100;
if (workingTime < 20 && energyManager.consumeEnergyToDoWork()) {
// consume 10 RF per tick of work
workingTime += energyManager.getEnergyPerWork() / 10;
}
if (transferTime > 0) {
transferTime--;
if (workingTime > 0) {
workingTime--;
IAlvearyComponent component = (IAlvearyComponent) this.getCentralTE();
if (component != null)
component.addTemperatureChange(climateControl.changePerTransfer, climateControl.boundaryDown, climateControl.boundaryUp);
}
if (animationDelay > 0) {
animationDelay--;
if (animationDelay <= 0)
sendNetworkUpdate();
if ((wasInactive && workingTime > 0) || (!wasInactive && workingTime == 0)) {
sendNetworkUpdate();
}
}
@@ -93,7 +86,7 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
/* TEXTURES */
@Override
public int getIcon(int side, int metadata) {
if (animationDelay > 0)
if (workingTime > 0)
return textureOn;
else
return textureOff;
@@ -104,23 +97,23 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
public void readFromNBT(NBTTagCompound nbttagcompound) {
super.readFromNBT(nbttagcompound);
energyManager.readFromNBT(nbttagcompound);
transferTime = nbttagcompound.getInteger("Heating");
workingTime = nbttagcompound.getInteger("Heating");
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
energyManager.writeToNBT(nbttagcompound);
nbttagcompound.setInteger("Heating", transferTime);
nbttagcompound.setInteger("Heating", workingTime);
}
/* NETWORK */
@Override
public void fromPacketPayload(PacketPayload payload) {
short delay = payload.shortPayload[0];
if (animationDelay != delay) {
animationDelay = delay;
short workingTime = payload.shortPayload[0];
if (this.workingTime != workingTime) {
this.workingTime = workingTime;
worldObj.func_147479_m(xCoord, yCoord, zCoord);
}
}
@@ -128,7 +121,7 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
@Override
public PacketPayload getPacketPayload() {
PacketPayload payload = new PacketPayload(0, 1);
payload.shortPayload[0] = (short) animationDelay;
payload.shortPayload[0] = (short) workingTime;
return payload;
}
@@ -16,7 +16,7 @@ public class TileAlvearyFan extends TileAlvearyClimatiser {
public static final int BLOCK_META = 3;
public TileAlvearyFan() {
super(new ClimateControl(-0.01f, 0.05f, 2.5f), BlockAlveary.TX_71_FNOF, BlockAlveary.TX_72_FNON, BLOCK_META);
super(new ClimateControl(-0.01f, 0.05f, 2.5f), BlockAlveary.ALVEARY_FAN_OFF, BlockAlveary.ALVEARY_FAN_ON, BLOCK_META);
}
}
@@ -12,14 +12,11 @@ package forestry.apiculture.gadgets;
public class TileAlvearyHeater extends TileAlvearyClimatiser {
public static final int TEXTURE_OFF = 57;
public static final int TEXTURE_ON = 58;
/* CONSTANTS */
public static final int BLOCK_META = 4;
public TileAlvearyHeater() {
super(new ClimateControl(0.01f, 0.0f, 2.5f), BlockAlveary.TX_57_HTOF, BlockAlveary.TX_58_HTON, BLOCK_META);
super(new ClimateControl(0.01f, 0.0f, 2.5f), BlockAlveary.ALVEARY_HEATER_OFF, BlockAlveary.ALVEARY_HEATER_ON, BLOCK_META);
}
}
@@ -187,7 +187,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
/* TEXTURES */
@Override
public int getIcon(int side, int metadata) {
return BlockAlveary.TX_73_VLVE;
return BlockAlveary.ALVEARY_HYGRO;
}
@Override
@@ -47,7 +47,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.LinkedHashSet;
@@ -82,6 +81,17 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
player.openGui(ForestryAPI.instance, GuiId.AlvearyGUI.ordinal(), worldObj, masterX, masterY, masterZ);
}
@Override
public void validate() {
super.validate();
setBiomeInformation();
}
private void setBiomeInformation() {
this.biome = Utils.getBiomeAt(worldObj, xCoord, zCoord);
setErrorState(EnumErrorCode.OK);
}
/* LOADING & SAVING */
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
@@ -115,8 +125,7 @@ public class TileAlvearyPlain extends TileAlveary implements ISidedInventory, IS
@Override
public void initialize() {
super.initialize();
this.biome = Utils.getBiomeAt(worldObj, xCoord, zCoord);
setErrorState(EnumErrorCode.OK);
setBiomeInformation();
}
@Override
@@ -158,9 +158,9 @@ public class TileAlvearySwarmer extends TileAlveary implements ISpecialInventory
return BlockAlveary.BOTTOM;
if (pendingSpawns.size() > 0)
return BlockAlveary.TX_56_SWON;
return BlockAlveary.ALVEARY_SWARMER_ON;
else
return BlockAlveary.TX_55_SWOF;
return BlockAlveary.ALVEARY_SWARMER_OFF;
}
/* SAVING & LOADING */
@@ -10,25 +10,25 @@
******************************************************************************/
package forestry.apiculture.genetics;
import java.util.List;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import forestry.apiculture.items.ItemArmorApiarist;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.genetics.IEffectData;
import java.util.List;
public class AlleleEffectPotion extends AlleleEffectThrottled {
private int potionId = 0;
private final Potion potion;
private final int duration;
public AlleleEffectPotion(String uid, String name, boolean isDominant, Potion potion, int duration, boolean requiresWorking) {
super(uid, name, isDominant, 200, requiresWorking, false);
potionId = potion.getId();
this.potion = potion;
this.duration = duration;
}
@@ -39,12 +39,29 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
return storedData;
AxisAlignedBB beatifyBox = getBounding(genome, housing, 1.0f);
@SuppressWarnings("rawtypes")
List list = housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, beatifyBox);
for (Object obj : list) {
EntityPlayer player = (EntityPlayer) obj;
player.addPotionEffect(new PotionEffect(potionId, duration, 0));
for (Object entity : list) {
if (!(entity instanceof EntityPlayer))
continue;
EntityPlayer player = (EntityPlayer) entity;
int duration = this.duration;
if (potion.isBadEffect()) {
// Players are not attacked if they wear a full set of apiarist's armor.
int count = ItemArmorApiarist.wearsItems((EntityPlayer) entity, getUID(), true);
if (count >= 4)
continue; // Full set, no damage/effect
else if (count == 3)
duration = this.duration / 4;
else if (count == 2)
duration = this.duration / 2;
else if (count == 1)
duration = this.duration * 3 / 4;
}
player.addPotionEffect(new PotionEffect(potion.getId(), duration, 0));
}
return storedData;
@@ -101,4 +101,9 @@ public class BlockStainedGlass extends BlockBreakable {
return false;
}
@Override
protected boolean canSilkHarvest() {
return true;
}
}
@@ -43,6 +43,7 @@ public class TileWorktable extends TileBase implements ICrafter {
/* CONSTANTS */
public final static int SLOT_CRAFTING_1 = 0;
public final static int SLOT_CRAFTING_COUNT = 9;
public final static int SLOT_CRAFTING_RESULT = 9;
public final static short SLOT_INVENTORY_1 = 0;
public final static short SLOT_INVENTORY_COUNT = 18;
@@ -135,7 +136,7 @@ public class TileWorktable extends TileBase implements ICrafter {
return false;
ItemStack recipeOutput = RECIPE_BRIDGE.findMatchingRecipe(crafting, world);
return recipeOutput != null && cachedRecipeOutput.isItemEqual(recipeOutput);
return ItemStack.areItemStacksEqual(cachedRecipeOutput, recipeOutput);
}
@Override
@@ -447,7 +448,7 @@ public class TileWorktable extends TileBase implements ICrafter {
return false;
// Need at least one matched set
ItemStack[] set = craftingInventory.getStacks(SLOT_CRAFTING_1, 9);
ItemStack[] set = craftingInventory.getStacks(SLOT_CRAFTING_1, SLOT_CRAFTING_COUNT);
ItemStack[] stock = accessibleInventory.getStacks(SLOT_INVENTORY_1, SLOT_INVENTORY_COUNT);
if (StackUtils.containsSets(set, stock, true, true) == 0)
return false;
@@ -495,7 +496,7 @@ public class TileWorktable extends TileBase implements ICrafter {
if (recipeOutput == null)
return false;
return recipeOutput.isItemEqual(currentRecipe.getRecipeOutput());
return ItemStack.areItemStacksEqual(recipeOutput, currentRecipe.getRecipeOutput());
}
private boolean removeResources(EntityPlayer player) {
+10 -6
View File
@@ -173,12 +173,6 @@ public class PluginIC2 extends ForestryPlugin {
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_EFFICIENCY_I, "forestry.energyEfficiency1");
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_BOOST_I, "forestry.energyBoost1");
ChipsetManager.circuitRegistry.registerLegacyMapping(CircuitId.ELECTRIC_BOOST_II, "forestry.energyBoost2");
// Remove some items from the recycler
if (PluginManager.Module.APICULTURE.isEnabled()) {
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beeQueenGE.getItemStack()));
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beePrincessGE.getItemStack()));
}
}
@Override
@@ -188,6 +182,16 @@ public class PluginIC2 extends ForestryPlugin {
config = Config.config;
// Remove some items from the recycler
if (Recipes.recyclerBlacklist != null) {
if (PluginManager.Module.APICULTURE.isEnabled()) {
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beeQueenGE.getItemStack()));
Recipes.recyclerBlacklist.add(new RecipeInputItemStack(ForestryItem.beePrincessGE.getItemStack()));
}
} else {
Proxies.log.severe("IC2 Recipes.recyclerBlacklist not found.");
}
definitionEngineTin.register();
definitionGenerator.register();