mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 14:24:42 +00:00
Fix #1153 crash from interface methods named getWorld
This commit is contained in:
1 parent
0ae2e36e90
commit
5cc181d4c7
43 files changed
+92
-133
No files matched your search
@@ -44,7 +44,8 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
|
||||
World getWorld();
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
|
||||
BiomeGenBase getBiome();
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ICamouflageHandler{
|
||||
|
||||
@@ -29,10 +29,5 @@ public interface ICamouflageHandler{
|
||||
* @return The coordinates of the handler as a BlockPos.
|
||||
*/
|
||||
BlockPos getCoordinates();
|
||||
|
||||
/**
|
||||
* @return The world of the handler.
|
||||
*/
|
||||
World getWorld();
|
||||
|
||||
}
|
||||
@@ -6,14 +6,11 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ICamouflagedTile {
|
||||
|
||||
EnumCamouflageType getCamouflageType();
|
||||
|
||||
BlockPos getCoordinates();
|
||||
|
||||
World getWorld();
|
||||
|
||||
}
|
||||
@@ -21,7 +21,8 @@ public interface IFarmHousing extends IErrorLogicSource {
|
||||
|
||||
Vec3i getOffset();
|
||||
|
||||
World getWorld();
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
|
||||
/**
|
||||
* @return true if any work was done, false otherwise.
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IGreenhouseHousing extends IErrorLogicSource {
|
||||
|
||||
@@ -21,8 +22,9 @@ public interface IGreenhouseHousing extends IErrorLogicSource {
|
||||
float getExactHumidity();
|
||||
|
||||
/**
|
||||
* Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12
|
||||
* @return The world in that the housing is.
|
||||
*/
|
||||
World getWorld();
|
||||
World getWorldObj();
|
||||
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import java.util.List;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.multiblock.IMultiblockComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IGreenhouseState {
|
||||
|
||||
@@ -26,10 +25,5 @@ public interface IGreenhouseState {
|
||||
List<IInternalBlock> getInternalBlocks();
|
||||
|
||||
Collection<IMultiblockComponent> getGreenhouseComponents();
|
||||
|
||||
/**
|
||||
* @return The world in that the greenhouse standing
|
||||
*/
|
||||
World getWorld();
|
||||
|
||||
}
|
||||
@@ -5,18 +5,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.greenhouse;
|
||||
|
||||
import java.util.Collection;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IInternalBlock {
|
||||
|
||||
@Nonnull
|
||||
World getWorld();
|
||||
|
||||
@Nonnull
|
||||
BlockPos getPos();
|
||||
|
||||
|
||||
@@ -243,7 +243,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
// Age the queen
|
||||
float lifespanModifier = beeModifier.getLifespanModifier(queen.getGenome(), queen.getMate(), 1.0f);
|
||||
queen.age(housing.getWorld(), lifespanModifier);
|
||||
queen.age(housing.getWorldObj(), lifespanModifier);
|
||||
|
||||
// Write the changed queen back into the item stack.
|
||||
NBTTagCompound nbttagcompound = new NBTTagCompound();
|
||||
@@ -335,7 +335,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
beeInventory.setQueen(queenStack);
|
||||
|
||||
// Register the new queen with the breeding tracker
|
||||
BeeManager.beeRoot.getBreedingTracker(housing.getWorld(), housing.getOwner()).registerQueen(princess);
|
||||
BeeManager.beeRoot.getBreedingTracker(housing.getWorldObj(), housing.getOwner()).registerQueen(princess);
|
||||
|
||||
// Remove drone
|
||||
beeInventory.getDrone().stackSize--;
|
||||
@@ -383,7 +383,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
*/
|
||||
private static Collection<ItemStack> spawnOffspring(IBee queen, IBeeHousing beeHousing) {
|
||||
|
||||
World world = beeHousing.getWorld();
|
||||
World world = beeHousing.getWorldObj();
|
||||
|
||||
Stack<ItemStack> offspring = new Stack<>();
|
||||
IApiaristTracker breedingTracker = BeeManager.beeRoot.getBreedingTracker(world, beeHousing.getOwner());
|
||||
@@ -427,7 +427,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
@Override
|
||||
public void syncToClient() {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
if (world != null && !world.isRemote) {
|
||||
if (housing instanceof Entity) {
|
||||
Proxies.net.sendNetworkPacket(new PacketBeeLogicActiveEntity(housing, (Entity) housing), world);
|
||||
@@ -439,7 +439,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
|
||||
|
||||
@Override
|
||||
public void syncToClient(EntityPlayerMP player) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
if (world != null && !world.isRemote) {
|
||||
if (housing instanceof TileEntity) {
|
||||
Proxies.net.sendToPlayer(new PacketBeeLogicActive(housing), player);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable {
|
||||
public boolean hasFlowers(IBee queen, IBeeHousing beeHousing) {
|
||||
IFlowerProvider flowerProvider = queen.getGenome().getFlowerProvider();
|
||||
String flowerType = flowerProvider.getFlowerType();
|
||||
World world = beeHousing.getWorld();
|
||||
World world = beeHousing.getWorldObj();
|
||||
|
||||
if (flowerCoords != null) {
|
||||
if (world.getTotalWorldTime() % flowerCheckInterval != flowerCheckTime) {
|
||||
|
||||
@@ -100,7 +100,7 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
public World getWorldObj() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
|
||||
Set<IFlowerAcceptableRule> acceptableRules = this.registeredRules.get(flowerType);
|
||||
Set<Block> acceptedBlocks = this.registeredBlocks.get(flowerType);
|
||||
Set<Flower> acceptedFlowers = this.registeredFlowers.get(flowerType);
|
||||
World world = beeHousing.getWorld();
|
||||
World world = beeHousing.getWorldObj();
|
||||
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(beeHousing);
|
||||
|
||||
|
||||
@@ -247,7 +247,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
@Override
|
||||
public Set<IErrorState> getCanWork(IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
BiomeGenBase biome = housing.getBiome();
|
||||
BlockPos housingCoords = housing.getCoordinates();
|
||||
|
||||
@@ -481,7 +481,8 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
Log.warning("Failed to produce in an apiary because the beehousing was null.");
|
||||
return null;
|
||||
}
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(housing.getWorld());
|
||||
World world = housing.getWorldObj();
|
||||
IBeekeepingMode mode = BeeManager.beeRoot.getBeekeepingMode(world);
|
||||
if (mode == null) {
|
||||
Log.warning("Failed to produce in an apiary because the beekeeping mode was null.");
|
||||
return null;
|
||||
@@ -505,13 +506,13 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
// / Primary Products
|
||||
for (Map.Entry<ItemStack, Float> entry : primary.getProductChances().entrySet()) {
|
||||
if (housing.getWorld().rand.nextFloat() < entry.getValue() * speed) {
|
||||
if (world.rand.nextFloat() < entry.getValue() * speed) {
|
||||
products.add(entry.getKey().copy());
|
||||
}
|
||||
}
|
||||
// / Secondary Products
|
||||
for (Map.Entry<ItemStack, Float> entry : secondary.getProductChances().entrySet()) {
|
||||
if (housing.getWorld().rand.nextFloat() < Math.round(entry.getValue() / 2) * speed) {
|
||||
if (world.rand.nextFloat() < Math.round(entry.getValue() / 2) * speed) {
|
||||
products.add(entry.getKey().copy());
|
||||
}
|
||||
}
|
||||
@@ -519,7 +520,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
// / Specialty products
|
||||
if (primary.isJubilant(genome, housing) && secondary.isJubilant(genome, housing)) {
|
||||
for (Map.Entry<ItemStack, Float> entry : primary.getSpecialtyChances().entrySet()) {
|
||||
if (housing.getWorld().rand.nextFloat() < entry.getValue() * speed) {
|
||||
if (world.rand.nextFloat() < entry.getValue() * speed) {
|
||||
products.add(entry.getKey().copy());
|
||||
}
|
||||
}
|
||||
@@ -527,7 +528,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
ItemStack[] productsArray = products.toArray(new ItemStack[products.size()]);
|
||||
BlockPos housingCoordinates = housing.getCoordinates();
|
||||
return genome.getFlowerProvider().affectProducts(housing.getWorld(), this, housingCoordinates, productsArray);
|
||||
return genome.getFlowerProvider().affectProducts(world, this, housingCoordinates, productsArray);
|
||||
}
|
||||
|
||||
/* REPRODUCTION */
|
||||
@@ -540,7 +541,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
}
|
||||
|
||||
// Fatigued queens do not produce princesses.
|
||||
if (BeeManager.beeRoot.getBeekeepingMode(housing.getWorld()).isFatigued(this, housing)) {
|
||||
if (BeeManager.beeRoot.getBeekeepingMode(housing.getWorldObj()).isFatigued(this, housing)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -550,7 +551,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
@Override
|
||||
public IBee[] spawnDrones(IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
|
||||
// We need a mated queen to produce offspring.
|
||||
if (mate == null) {
|
||||
@@ -583,7 +584,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
private IBee createOffspring(IBeeHousing housing, int generation) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
|
||||
IChromosome[] chromosomes = new IChromosome[genome.getChromosomes().length];
|
||||
IChromosome[] parent1 = genome.getChromosomes();
|
||||
@@ -612,7 +613,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
private static IChromosome[] mutateSpecies(IBeeHousing housing, IBeeGenome genomeOne, IBeeGenome genomeTwo) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
|
||||
IChromosome[] parent1 = genomeOne.getChromosomes();
|
||||
IChromosome[] parent2 = genomeTwo.getChromosomes();
|
||||
@@ -673,7 +674,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
Random random = world.rand;
|
||||
|
||||
// Correct speed
|
||||
@@ -716,7 +717,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
int chance = (int) (genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
Random random = world.rand;
|
||||
|
||||
// Correct speed
|
||||
@@ -763,7 +764,7 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
int chance = Math.round(genome.getFlowering() * beeModifier.getFloweringModifier(getGenome(), 1f));
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
Random random = world.rand;
|
||||
|
||||
// Correct speed
|
||||
|
||||
@@ -36,7 +36,7 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
|
||||
@Override
|
||||
public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingPos = housing.getCoordinates();
|
||||
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
float productionModifier = beeModifier.getProductionModifier(queen.getGenome(), 1f);
|
||||
if (productionModifier > 16) {
|
||||
if (housing.getWorld().rand.nextFloat() * 100 < 0.01 * (productionModifier * productionModifier - 100)) {
|
||||
if (housing.getWorldObj().rand.nextFloat() * 100 < 0.01 * (productionModifier * productionModifier - 100)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class BeekeepingMode implements IBeekeepingMode {
|
||||
|
||||
float mutationModifier = beeModifier.getMutationModifier(queen.getGenome(), queen.getMate(), 1.0f);
|
||||
if (mutationModifier > 10) {
|
||||
if (housing.getWorld().rand.nextFloat() * 100 < 0.4 * (mutationModifier * mutationModifier - 100)) {
|
||||
if (housing.getWorldObj().rand.nextFloat() * 100 < 0.4 * (mutationModifier * mutationModifier - 100)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
|
||||
|
||||
@Override
|
||||
public boolean isJubilant(IAlleleBeeSpecies species, IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoords = housing.getCoordinates();
|
||||
|
||||
IBlockState state = world.getBlockState(housingCoords.down());
|
||||
|
||||
@@ -105,7 +105,7 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
Vec3d beeFXCoordinates = housing.getBeeFXCoordinates();
|
||||
Proxies.render.addBeeHiveFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord, beeFXCoordinates.zCoord, genome.getPrimary().getSpriteColour(0));
|
||||
Proxies.render.addBeeHiveFX(housing.getWorldObj(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord, beeFXCoordinates.zCoord, genome.getPrimary().getSpriteColour(0));
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,6 @@ public abstract class AlleleEffect extends AlleleCategorized implements IAlleleB
|
||||
|
||||
public static <T extends Entity> List<T> getEntitiesInRange(IBeeGenome genome, IBeeHousing housing, Class<T> entityClass) {
|
||||
AxisAlignedBB boundingBox = getBounding(genome, housing);
|
||||
return housing.getWorld().getEntitiesWithinAABB(entityClass, boundingBox);
|
||||
return housing.getWorldObj().getEntitiesWithinAABB(entityClass, boundingBox);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class AlleleEffectCreeper extends AlleleEffectThrottled {
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoords = housing.getCoordinates();
|
||||
|
||||
// If we are already triggered, we continue the explosion sequence.
|
||||
|
||||
@@ -35,7 +35,7 @@ public class AlleleEffectFertile extends AlleleEffectThrottled {
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoordinates = housing.getCoordinates();
|
||||
Vec3i area = getModifiedArea(genome, housing);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
}
|
||||
|
||||
private void doBlockEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoordinates = housing.getCoordinates();
|
||||
Vec3i area = getModifiedArea(genome, housing);
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled {
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
EnumTemperature temp = housing.getTemperature();
|
||||
|
||||
switch (temp) {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
List<EntityLivingBase> entities = getEntitiesInRange(genome, housing, EntityLivingBase.class);
|
||||
for (EntityLivingBase entity : entities) {
|
||||
int chance = ignitionChance;
|
||||
@@ -65,11 +65,12 @@ public class AlleleEffectIgnition extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
if (housing.getWorld().rand.nextInt(2) != 0) {
|
||||
World world = housing.getWorldObj();
|
||||
if (world.rand.nextInt(2) != 0) {
|
||||
super.doFX(genome, storedData, housing);
|
||||
} else {
|
||||
Vec3d beeFXCoordinates = housing.getBeeFXCoordinates();
|
||||
Proxies.render.addEntityIgnitionFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord);
|
||||
Proxies.render.addEntityIgnitionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
List<EntityLivingBase> entities = getEntitiesInRange(genome, housing, EntityLivingBase.class);
|
||||
for (EntityLivingBase entity : entities) {
|
||||
if (world.rand.nextFloat() >= chance) {
|
||||
@@ -86,11 +86,12 @@ public class AlleleEffectPotion extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
if (housing.getWorld().rand.nextBoolean()) {
|
||||
World world = housing.getWorldObj();
|
||||
if (world.rand.nextBoolean()) {
|
||||
super.doFX(genome, storedData, housing);
|
||||
} else {
|
||||
Vec3d beeFXCoordinates = housing.getBeeFXCoordinates();
|
||||
Proxies.render.addEntityPotionFX(housing.getWorld(), beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord, potionFXColor);
|
||||
Proxies.render.addEntityPotionFX(world, beeFXCoordinates.xCoord, beeFXCoordinates.yCoord + 0.5, beeFXCoordinates.zCoord, potionFXColor);
|
||||
}
|
||||
return storedData;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
}
|
||||
|
||||
private static IEffectData destroyEnvironment(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
Random rand = world.rand;
|
||||
|
||||
Vec3i area = VectUtil.scale(genome.getTerritory(), 2);
|
||||
@@ -74,7 +74,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
BlockPos posBlock = randomPos.add(posHousing);
|
||||
posBlock = posBlock.add(offset);
|
||||
|
||||
if (posBlock.getY() <= 1 || posBlock.getY() >= housing.getWorld().getActualHeight()) {
|
||||
if (posBlock.getY() <= 1 || posBlock.getY() >= world.getActualHeight()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
@Override
|
||||
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
|
||||
EnumTemperature temp = housing.getTemperature();
|
||||
|
||||
@@ -80,12 +80,12 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
|
||||
|
||||
@Override
|
||||
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
|
||||
if (housing.getWorld().rand.nextInt(3) == 0) {
|
||||
if (housing.getWorldObj().rand.nextInt(3) == 0) {
|
||||
Vec3i area = getModifiedArea(genome, housing);
|
||||
Vec3i offset = VectUtil.scale(area, -0.5F);
|
||||
|
||||
BlockPos coordinates = housing.getCoordinates();
|
||||
World world = housing.getWorld();
|
||||
World world = housing.getWorldObj();
|
||||
|
||||
BlockPos spawn = VectUtil.getRandomPositionInArea(world.rand, area).add(coordinates).add(offset);
|
||||
Proxies.render.addEntitySnowFX(world, spawn.getX(), spawn.getY(), spawn.getZ());
|
||||
|
||||
@@ -71,7 +71,7 @@ public class InventoryApiary extends InventoryBeeHousing implements IApiaryInven
|
||||
|
||||
@Override
|
||||
public void wearOutFrames(IBeeHousing beeHousing, int amount) {
|
||||
IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorld());
|
||||
IBeekeepingMode beekeepingMode = BeeManager.beeRoot.getBeekeepingMode(beeHousing.getWorldObj());
|
||||
int wear = Math.round(amount * beekeepingMode.getWearModifier());
|
||||
|
||||
for (int i = SLOT_FRAMES_1; i < SLOT_FRAMES_1 + SLOT_FRAMES_COUNT; i++) {
|
||||
|
||||
@@ -355,13 +355,13 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
BlockPos coords = getReferenceCoord();
|
||||
return ForestryAPI.climateManager.getTemperature(getWorld(), coords) + tempChange;
|
||||
return ForestryAPI.climateManager.getTemperature(getWorldObj(), coords) + tempChange;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactHumidity() {
|
||||
BlockPos coords = getReferenceCoord();
|
||||
return ForestryAPI.climateManager.getHumidity(getWorld(), coords) + humidChange;
|
||||
return ForestryAPI.climateManager.getHumidity(getWorldObj(), coords) + humidChange;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -384,11 +384,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
return getAccessHandler().getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedType() {
|
||||
return "for.multiblock.alveary.type";
|
||||
@@ -417,8 +412,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
|
||||
@Override
|
||||
public void addTemperatureChange(float change, float boundaryDown, float boundaryUp) {
|
||||
BlockPos coordinates = getCoordinates();
|
||||
|
||||
float temperature = ForestryAPI.climateManager.getTemperature(worldObj, getReferenceCoord());
|
||||
|
||||
tempChange += change;
|
||||
|
||||
@@ -22,10 +22,10 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.EnumSkyBlock;
|
||||
import net.minecraft.world.World;
|
||||
@@ -299,6 +299,11 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
|
||||
return true; // hives may have the sky obstructed but should still be active
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorldObj() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BiomeGenBase getBiome() {
|
||||
return getWorld().getBiomeGenForCoords(getPos());
|
||||
|
||||
@@ -244,7 +244,7 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
|
||||
tankLevels.set(tankIndex, tankLevel);
|
||||
if (sendUpdate) {
|
||||
PacketTankLevelUpdate tankLevelUpdate = new PacketTankLevelUpdate(tile, tankIndex, tank.getFluid());
|
||||
Proxies.net.sendNetworkPacket(tankLevelUpdate, tile.getWorld());
|
||||
Proxies.net.sendNetworkPacket(tankLevelUpdate, tile.getWorldObj());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public abstract class FakeMultiblockController implements IMultiblockControllerI
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
public World getWorldObj() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public interface IMultiblockControllerInternal extends IMultiblockController, IN
|
||||
*/
|
||||
void decodeDescriptionPacket(NBTTagCompound data);
|
||||
|
||||
World getWorld();
|
||||
World getWorldObj();
|
||||
|
||||
/**
|
||||
* @return True if this controller has no associated blocks, false otherwise
|
||||
|
||||
@@ -57,6 +57,11 @@ public abstract class MultiblockControllerForestry extends MultiblockControllerB
|
||||
return errorLogic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorldObj() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMachineAssembled() {
|
||||
super.onMachineAssembled();
|
||||
|
||||
@@ -187,7 +187,7 @@ public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> e
|
||||
|
||||
/* ILocatable */
|
||||
@Override
|
||||
public final World getWorld() {
|
||||
public final World getWorldObj() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class MultiblockWorldRegistry {
|
||||
public void tickStart() {
|
||||
if (!controllers.isEmpty()) {
|
||||
for (IMultiblockControllerInternal controller : controllers) {
|
||||
if (controller.getWorld() == worldObj && controller.getWorld().isRemote == worldObj.isRemote) {
|
||||
if (controller.getWorldObj() == worldObj && controller.getWorldObj().isRemote == worldObj.isRemote) {
|
||||
if (controller.isEmpty()) {
|
||||
// This happens on the server when the user breaks the last block. It's fine.
|
||||
// Mark 'er dead and move on.
|
||||
|
||||
@@ -16,5 +16,6 @@ import net.minecraft.world.World;
|
||||
public interface ILocatable {
|
||||
BlockPos getCoordinates();
|
||||
|
||||
World getWorld();
|
||||
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
|
||||
World getWorldObj();
|
||||
}
|
||||
@@ -186,7 +186,7 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
public World getWorldObj() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public abstract class FarmLogic implements IFarmLogic {
|
||||
}
|
||||
|
||||
protected World getWorld() {
|
||||
return housing.getWorld();
|
||||
return housing.getWorldObj();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -116,7 +116,7 @@ public abstract class FarmLogic implements IFarmLogic {
|
||||
protected List<ItemStack> collectEntityItems(boolean toWorldHeight) {
|
||||
AxisAlignedBB harvestBox = getHarvestBox(housing, toWorldHeight);
|
||||
|
||||
List<EntityItem> entityItems = housing.getWorld().getEntitiesWithinAABB(entitySelectorFarm.getEntityClass(), harvestBox, entitySelectorFarm);
|
||||
List<EntityItem> entityItems = housing.getWorldObj().getEntitiesWithinAABB(entitySelectorFarm.getEntityClass(), harvestBox, entitySelectorFarm);
|
||||
List<ItemStack> stacks = new ArrayList<>();
|
||||
for (EntityItem entity : entityItems) {
|
||||
ItemStack contained = entity.getEntityItem();
|
||||
|
||||
@@ -401,13 +401,13 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
|
||||
@Override
|
||||
public float getExactTemperature() {
|
||||
BlockPos coords = getReferenceCoord();
|
||||
return ForestryAPI.climateManager.getTemperature(getWorld(), coords);
|
||||
return ForestryAPI.climateManager.getTemperature(getWorldObj(), coords);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getExactHumidity() {
|
||||
BlockPos coords = getReferenceCoord();
|
||||
return ForestryAPI.climateManager.getHumidity(getWorld(), coords);
|
||||
return ForestryAPI.climateManager.getHumidity(getWorldObj(), coords);
|
||||
}
|
||||
|
||||
private Vec3i offset;
|
||||
@@ -435,11 +435,6 @@ public class FarmController extends RectangularMultiblockControllerBase implemen
|
||||
return area;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedType() {
|
||||
return "for.multiblock.farm.type";
|
||||
|
||||
@@ -16,8 +16,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class InventoryFarm extends InventoryAdapterRestricted implements IFarmIn
|
||||
|
||||
@Override
|
||||
public void removeResources(ItemStack[] resources) {
|
||||
EntityPlayer player = PlayerUtil.getPlayer(farmController.getWorld(), farmController.getAccessHandler().getOwner());
|
||||
EntityPlayer player = PlayerUtil.getPlayer(farmController.getWorldObj(), farmController.getAccessHandler().getOwner());
|
||||
InventoryUtil.removeSets(resourcesInventory, 1, resources, player, false, true, false, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.greenhouse.IGreenhouseState;
|
||||
@@ -56,9 +54,4 @@ public class FakeGreenhouseState implements IGreenhouseState {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ public final class GreenhouseState implements IGreenhouseState {
|
||||
}
|
||||
|
||||
public GreenhouseState(GreenhouseController controller) {
|
||||
this(controller.getWorld(), controller.getExactHumidity(), controller.getExactTemperature(), controller.getInternalBlocks(), controller.getComponents());
|
||||
this(controller.getWorldObj(), controller.getExactHumidity(), controller.getExactTemperature(), controller.getInternalBlocks(), controller.getComponents());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -62,11 +62,6 @@ public final class GreenhouseState implements IGreenhouseState {
|
||||
return humidity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IInternalBlock> getInternalBlocks() {
|
||||
return internalBlocks;
|
||||
|
||||
@@ -39,7 +39,7 @@ public class GreenhouseLogicGreenhouseEffect extends DefaultGreenhouseLogic impl
|
||||
if (controller == null || !controller.isAssembled()) {
|
||||
return;
|
||||
}
|
||||
if (controller.getWorld().isDaytime()) {
|
||||
if (controller.getWorldObj().isDaytime()) {
|
||||
if (workTimer++ > 20) {
|
||||
controller.addTemperatureChange(lightTransmittance / 100, 0F, 2.5F);
|
||||
workTimer = 0;
|
||||
@@ -68,7 +68,7 @@ public class GreenhouseLogicGreenhouseEffect extends DefaultGreenhouseLogic impl
|
||||
float lightTransmittance = 0F;
|
||||
int i = 0;
|
||||
|
||||
World world = controller.getWorld();
|
||||
World world = controller.getWorldObj();
|
||||
for (IMultiblockComponent component : controller.getComponents()) {
|
||||
if (component instanceof ICamouflagedTile) {
|
||||
ICamouflagedTile block = (ICamouflagedTile) component;
|
||||
|
||||
@@ -171,12 +171,6 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
}
|
||||
return change;
|
||||
}
|
||||
|
||||
/* LOCATION */
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return worldObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedType() {
|
||||
@@ -641,7 +635,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
internalBlocks.clear();
|
||||
|
||||
if (isNextRoof) {
|
||||
checkInternalBlock(createInternalBlock(new InternalBlock(worldObj, getMinimumCoord().add(1, 1, 1))));
|
||||
checkInternalBlock(createInternalBlock(new InternalBlock(getMinimumCoord().add(1, 1, 1))));
|
||||
}
|
||||
if (internalBlocks.isEmpty()) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocalFormatted("for.multiblock.error.space.closed"));
|
||||
@@ -692,7 +686,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
|
||||
faceToCheck.setTested(true);
|
||||
}
|
||||
} else {
|
||||
IInternalBlock internalBlock = createInternalBlock(new InternalBlock(worldObj, posFacing, face.getOpposite(), blockToCheck));
|
||||
IInternalBlock internalBlock = createInternalBlock(new InternalBlock(posFacing, face.getOpposite(), blockToCheck));
|
||||
|
||||
// Check is the internal block in the list
|
||||
if (internalBlocks.contains(internalBlock)) {
|
||||
|
||||
@@ -16,9 +16,8 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.api.greenhouse.IInternalBlock;
|
||||
import forestry.api.greenhouse.IInternalBlockFace;
|
||||
@@ -27,14 +26,11 @@ public class InternalBlock implements IInternalBlock {
|
||||
@Nonnull
|
||||
private final BlockPos pos;
|
||||
@Nonnull
|
||||
private final World world;
|
||||
@Nonnull
|
||||
private final List<IInternalBlockFace> faces = new ArrayList<>(6);
|
||||
@Nullable
|
||||
private final IInternalBlock root;
|
||||
|
||||
public InternalBlock(@Nonnull World world, @Nonnull BlockPos pos) {
|
||||
this.world = world;
|
||||
public InternalBlock(@Nonnull BlockPos pos) {
|
||||
this.pos = pos;
|
||||
this.root = null;
|
||||
|
||||
@@ -43,8 +39,7 @@ public class InternalBlock implements IInternalBlock {
|
||||
}
|
||||
}
|
||||
|
||||
public InternalBlock(@Nonnull World world, @Nonnull BlockPos pos, EnumFacing rootFace, @Nonnull IInternalBlock root) {
|
||||
this.world = world;
|
||||
public InternalBlock(@Nonnull BlockPos pos, EnumFacing rootFace, @Nonnull IInternalBlock root) {
|
||||
this.pos = pos;
|
||||
this.root = root;
|
||||
|
||||
@@ -53,12 +48,6 @@ public class InternalBlock implements IInternalBlock {
|
||||
}
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public World getWorld() {
|
||||
return world;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public BlockPos getPos() {
|
||||
|
||||
Reference in new issue
Block a user