Update for Minecraft 1.9.4

This commit is contained in:
mezz committed 2016-05-26 01:42:46 -07:00
1 parent da486ee941
commit b444994b81
163 files changed
+939 -641

No files matched your search

+1 -1
View File
@@ -49,7 +49,7 @@ import forestry.plugins.PluginManager;
name = Constants.MOD_ID,
version = Constants.VERSION,
guiFactory = "forestry.core.config.ForestryGuiConfigFactory",
dependencies = "required-after:Forge@[12.16.1.1892,);"
dependencies = "required-after:Forge@[12.17.0.1922,);"
+ "after:Buildcraft|Core@[7.2,);"
+ "after:BuildCraft|Energy@[7.2,);"
+ "after:ExtrabiomesXL;"
@@ -11,7 +11,7 @@ import java.util.List;
import java.util.Set;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import forestry.api.arboriculture.ITree;
import forestry.api.core.IErrorState;
@@ -71,7 +71,7 @@ public interface IBee extends IIndividualLiving {
*/
Set<IErrorState> getCanWork(IBeeHousing housing);
List<BiomeGenBase> getSuitableBiomes();
List<Biome> getSuitableBiomes();
ItemStack[] getProduceList();
@@ -7,7 +7,7 @@ package forestry.api.apiculture;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
@@ -47,7 +47,7 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
/** Must not be named "getWorld" to avoid SpecialSource issue https://github.com/md-5/SpecialSource/issues/12 */
World getWorldObj();
BiomeGenBase getBiome();
Biome getBiome();
GameProfile getOwner();
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import forestry.api.core.INbtReadable;
@@ -39,7 +40,7 @@ public interface IBeekeepingLogic extends INbtWritable, INbtReadable {
/**
* Call this when the housing comes into view of the client.
* (i.e. when tile.getDescriptionPacket() is called)
* (i.e. when {@link TileEntity#getUpdateTag()} is called)
*/
void syncToClient();
@@ -8,7 +8,7 @@ package forestry.api.apiculture.hives;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
@@ -29,7 +29,7 @@ public interface IHiveDescription {
* returns true if the hive can be generated in these conditions.
* Used as a fast early-elimination check for hives that have no hope of spawning in the area.
*/
boolean isGoodBiome(BiomeGenBase biome);
boolean isGoodBiome(Biome biome);
boolean isGoodHumidity(EnumHumidity humidity);
@@ -3,21 +3,21 @@ package forestry.api.core;
import java.util.HashMap;
import java.util.Map;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
public class BiomeHelper {
private static final Map<BiomeGenBase, Boolean> isBiomeHellishCache = new HashMap<>();
private static final Map<Biome, Boolean> isBiomeHellishCache = new HashMap<>();
/**
* Determines if a given BiomeGenBase is of HELLISH temperature, since it is treated separately from actual temperature values.
* Determines if a given Biome is of HELLISH temperature, since it is treated separately from actual temperature values.
* Uses the BiomeDictionary.
* @param biomeGen BiomeGenBase of the biome in question
* @return true, if the BiomeGenBase is a Nether-type biome; false otherwise.
* @param biomeGen Biome of the biome in question
* @return true, if the Biome is a Nether-type biome; false otherwise.
*/
public static boolean isBiomeHellish(BiomeGenBase biomeGen) {
public static boolean isBiomeHellish(Biome biomeGen) {
if (isBiomeHellishCache.containsKey(biomeGen)) {
return isBiomeHellishCache.get(biomeGen);
}
@@ -5,13 +5,18 @@
******************************************************************************/
package forestry.api.core;
import net.minecraft.world.biome.Biome;
/**
* Many things Forestry use temperature and humidity of a biome to determine whether they can or how they can work or spawn at a given location.
*
* This enum concerns humidity.
*/
public enum EnumHumidity {
ARID("Arid"), NORMAL("Normal"), DAMP("Damp");
ARID("Arid"),
NORMAL("Normal"),
/** matches {@link Biome#isHighHumidity()} */
DAMP("Damp");
public final String name;
@@ -25,12 +30,13 @@ public enum EnumHumidity {
/**
* Determines the EnumHumidity given a floating point representation of Minecraft Rainfall.
* To check if rainfall is possible in a biome, use BiomeHelper.canRainOrSnow().
* To check if rainfall is possible in a biome, use {@link Biome#canRain()}.
*
* @param rawHumidity raw rainfall value
* @return EnumHumidity corresponding to rainfall value
*/
public static EnumHumidity getFromValue(float rawHumidity) {
if (rawHumidity > 0.85f) { // matches BiomeGenBase.isHighHumidity()
if (rawHumidity > 0.85f) {
return DAMP;
} else if (rawHumidity >= 0.3f) {
return NORMAL;
@@ -8,7 +8,7 @@ package forestry.api.core;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -60,15 +60,15 @@ public enum EnumTemperature {
}
}
public static EnumTemperature getFromBiome(BiomeGenBase biomeGenBase) {
if (BiomeHelper.isBiomeHellish(biomeGenBase)) {
public static EnumTemperature getFromBiome(Biome Biome) {
if (BiomeHelper.isBiomeHellish(Biome)) {
return HELLISH;
}
return getFromValue(biomeGenBase.getTemperature());
return getFromValue(Biome.getTemperature());
}
public static EnumTemperature getFromBiome(BiomeGenBase biomeGenBase, World world, BlockPos pos) {
if (BiomeHelper.isBiomeHellish(biomeGenBase)) {
public static EnumTemperature getFromBiome(Biome Biome, World world, BlockPos pos) {
if (BiomeHelper.isBiomeHellish(Biome)) {
return HELLISH;
}
float temperature = ForestryAPI.climateManager.getTemperature(world, pos);
@@ -8,5 +8,5 @@ package forestry.api.core;
import net.minecraft.nbt.NBTTagCompound;
public interface INbtWritable {
void writeToNBT(NBTTagCompound nbt);
NBTTagCompound writeToNBT(NBTTagCompound nbt);
}
@@ -5,9 +5,10 @@
******************************************************************************/
package forestry.api.greenhouse;
import forestry.api.multiblock.IGreenhouseController;
import net.minecraft.nbt.NBTTagCompound;
import forestry.api.multiblock.IGreenhouseController;
public class DefaultGreenhouseLogic implements IGreenhouseLogic {
public final IGreenhouseController controller;
@@ -19,7 +20,8 @@ public class DefaultGreenhouseLogic implements IGreenhouseLogic {
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
return nbt;
}
@Override
@@ -69,5 +69,5 @@ public interface IMultiblockLogic extends INbtWritable {
* Use this in Tile.writeToNBT()
*/
@Override
void writeToNBT(NBTTagCompound nbttagcompound);
NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound);
}
@@ -5,9 +5,10 @@
******************************************************************************/
package forestry.api.multiblock;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@@ -46,10 +47,12 @@ public abstract class MultiblockTileEntityBase<T extends IMultiblockLogic> exten
multiblockLogic.readFromNBT(data);
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
public NBTTagCompound writeToNBT(NBTTagCompound data) {
data = super.writeToNBT(data);
multiblockLogic.writeToNBT(data);
return data;
}
@Override
@@ -72,21 +75,36 @@ public abstract class MultiblockTileEntityBase<T extends IMultiblockLogic> exten
/* Network Communication */
@Nonnull
@Override
public final Packet getDescriptionPacket() {
NBTTagCompound packetData = new NBTTagCompound();
multiblockLogic.encodeDescriptionPacket(packetData);
this.encodeDescriptionPacket(packetData);
return new SPacketUpdateTileEntity(getPos(), 0, packetData);
public SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(getPos(), 0, getUpdateTag());
}
@Nonnull
@Override
public NBTTagCompound getUpdateTag() {
NBTTagCompound updateTag = super.getUpdateTag();
multiblockLogic.encodeDescriptionPacket(updateTag);
this.encodeDescriptionPacket(updateTag);
return updateTag;
}
@Override
public final void onDataPacket(NetworkManager network, SPacketUpdateTileEntity packet) {
super.onDataPacket(network, packet);
NBTTagCompound nbtData = packet.getNbtCompound();
multiblockLogic.decodeDescriptionPacket(nbtData);
this.decodeDescriptionPacket(nbtData);
}
@Override
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
super.handleUpdateTag(tag);
multiblockLogic.decodeDescriptionPacket(tag);
this.decodeDescriptionPacket(tag);
}
/**
* Used to write tileEntity-specific data to the descriptionPacket
*/
@@ -103,7 +103,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("BreedingTime", beeProgress);
nbttagcompound.setInteger("Throttle", queenWorkCycleThrottle);
@@ -126,6 +126,7 @@ public class BeekeepingLogic implements IBeekeepingLogic, IStreamable {
nbttaglist.appendTag(nbttagcompound1);
}
nbttagcompound.setTag("Offspring", nbttaglist);
return nbttagcompound;
}
@Override
@@ -74,7 +74,7 @@ public class FakeBeekeepingLogic implements IBeekeepingLogic {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
return nbttagcompound;
}
}
@@ -136,7 +136,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
NBTTagCompound hasFlowerCacheNBT = new NBTTagCompound();
if (!flowerCoords.isEmpty()) {
@@ -155,6 +155,7 @@ public class HasFlowersCache implements INbtWritable, INbtReadable, IStreamable
hasFlowerCacheNBT.setInteger(nbtKeyCooldown, cooldown);
nbttagcompound.setTag(nbtKey, hasFlowerCacheNBT);
return nbttagcompound;
}
@Override
@@ -30,7 +30,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.storage.loot.LootTableList;
@@ -107,7 +107,7 @@ import forestry.core.PluginFluids;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.config.LocalizedConfiguration;
import forestry.core.entities.EntityFXSnow;
import forestry.core.entities.ParticleSnow;
import forestry.core.fluids.Fluids;
import forestry.core.items.EnumElectronTube;
import forestry.core.network.IPacketRegistry;
@@ -937,9 +937,9 @@ public class PluginApiculture extends BlankForestryPlugin {
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Pre event) {
EntityFXSnow.sprites = new TextureAtlasSprite[3];
for (int i = 0; i < EntityFXSnow.sprites.length; i++) {
EntityFXSnow.sprites[i] = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1)));
ParticleSnow.sprites = new TextureAtlasSprite[3];
for (int i = 0; i < ParticleSnow.sprites.length; i++) {
ParticleSnow.sprites[i] = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/snow." + (i + 1)));
}
ParticleBee.beeSprite = event.getMap().registerSprite(new ResourceLocation("forestry:entity/particles/swarm_bee"));
}
@@ -947,7 +947,7 @@ public class PluginApiculture extends BlankForestryPlugin {
private static class EndFlowerAcceptableRule implements IFlowerAcceptableRule {
@Override
public boolean isAcceptableFlower(String flowerType, World world, BlockPos pos) {
BiomeGenBase biomeGenForCoords = world.getBiomeGenForCoords(pos);
Biome biomeGenForCoords = world.getBiome(pos);
return BiomeDictionary.isBiomeOfType(biomeGenForCoords, BiomeDictionary.Type.END);
}
}
@@ -249,10 +249,8 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock) {
super.onNeighborBlockChange(world, pos, state, neighborBlock);
TileEntity tileEntity = world.getTileEntity(pos);
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) {
TileEntity tileEntity = worldIn.getTileEntity(pos);
if (tileEntity instanceof TileAlveary) {
TileAlveary tileAlveary = (TileAlveary) tileEntity;
@@ -260,7 +258,7 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
IAlvearyControllerInternal alveary = tileAlveary.getMultiblockLogic().getController();
alveary.reassemble();
if(alveary.getReferenceCoord() != null){
Proxies.net.sendNetworkPacket(new PacketAlveryChange(alveary), world);
Proxies.net.sendNetworkPacket(new PacketAlveryChange(alveary), worldIn);
}
}
}
@@ -14,7 +14,7 @@ import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.ai.EntityAIBase;
import net.minecraft.entity.ai.RandomPositionGenerator;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.pathfinding.PathEntity;
import net.minecraft.pathfinding.Path;
import net.minecraft.pathfinding.PathNavigate;
import net.minecraft.util.math.Vec3d;
@@ -26,7 +26,7 @@ public class AIAvoidPlayers extends EntityAIBase {
private final float nearSpeed;
private final float minDistance;
private PathEntity pathing;
private Path path;
private final PathNavigate pathNavigator;
@@ -65,8 +65,8 @@ public class AIAvoidPlayers extends EntityAIBase {
return false;
}
pathing = pathNavigator.getPathToXYZ(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord);
return pathing != null && pathing.isDestinationSame(randomTarget);
path = pathNavigator.getPathToXYZ(randomTarget.xCoord, randomTarget.yCoord, randomTarget.zCoord);
return path != null && path.isDestinationSame(randomTarget);
}
@Override
@@ -76,7 +76,7 @@ public class AIAvoidPlayers extends EntityAIBase {
@Override
public void startExecuting() {
this.pathNavigator.setPath(pathing, farSpeed);
this.pathNavigator.setPath(path, farSpeed);
}
@Override
@@ -17,7 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
@@ -105,8 +105,8 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
}
@Override
public BiomeGenBase getBiome() {
return worldObj.getBiomeGenForCoords(getPosition());
public Biome getBiome() {
return worldObj.getBiome(getPosition());
}
@Override
@@ -10,14 +10,14 @@
******************************************************************************/
package forestry.apiculture.entities;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class ParticleBee extends EntityFX {
public class ParticleBee extends Particle {
private final double originX;
private final double originY;
private final double originZ;
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.apiculture.genetics;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
@@ -33,7 +35,7 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
private int princessesTotal = 0;
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
public void readFromNBT(@Nonnull NBTTagCompound nbttagcompound) {
queensTotal = nbttagcompound.getInteger("QueensTotal");
princessesTotal = nbttagcompound.getInteger("PrincessesTotal");
@@ -43,15 +45,16 @@ public class ApiaristTracker extends BreedingTracker implements IApiaristTracker
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("QueensTotal", queensTotal);
nbttagcompound.setInteger("PrincessesTotal", princessesTotal);
nbttagcompound.setInteger("DronesTotal", dronesTotal);
super.writeToNBT(nbttagcompound);
nbttagcompound = super.writeToNBT(nbttagcompound);
return nbttagcompound;
}
@Override
@@ -27,7 +27,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3i;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
@@ -120,9 +120,9 @@ public class Bee extends IndividualLiving implements IBee {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
nbttagcompound = super.writeToNBT(nbttagcompound);
if (!isNatural) {
nbttagcompound.setBoolean("NA", false);
@@ -131,6 +131,7 @@ public class Bee extends IndividualLiving implements IBee {
if (generation > 0) {
nbttagcompound.setInteger("GEN", generation);
}
return nbttagcompound;
}
@Override
@@ -247,7 +248,7 @@ public class Bee extends IndividualLiving implements IBee {
@Override
public Set<IErrorState> getCanWork(IBeeHousing housing) {
World world = housing.getWorldObj();
BiomeGenBase biome = housing.getBiome();
Biome biome = housing.getBiome();
BlockPos housingCoords = housing.getCoordinates();
Set<IErrorState> errorStates = new HashSet<>();
@@ -336,7 +337,7 @@ public class Bee extends IndividualLiving implements IBee {
return genome.getToleratesRain() || beeModifier.isSealed();
}
private boolean isSuitableBiome(BiomeGenBase biome) {
private boolean isSuitableBiome(Biome biome) {
if (biome == null) {
return false;
}
@@ -353,9 +354,9 @@ public class Bee extends IndividualLiving implements IBee {
}
@Override
public ArrayList<BiomeGenBase> getSuitableBiomes() {
ArrayList<BiomeGenBase> suitableBiomes = new ArrayList<>();
for (BiomeGenBase biome : BiomeGenBase.REGISTRY) {
public ArrayList<Biome> getSuitableBiomes() {
ArrayList<Biome> suitableBiomes = new ArrayList<>();
for (Biome biome : Biome.REGISTRY) {
if (isSuitableBiome(biome)) {
suitableBiomes.add(biome);
}
@@ -22,7 +22,7 @@ import java.util.Set;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
@@ -89,7 +89,7 @@ public class GuiHabitatLocator extends GuiForestry<ContainerHabitatLocator, Item
// Set active according to valid biomes.
Set<BiomeDictionary.Type> activeBiomeTypes = EnumSet.noneOf(BiomeDictionary.Type.class);
for (BiomeGenBase biome : inventory.getBiomesToSearch()) {
for (Biome biome : inventory.getBiomesToSearch()) {
Collections.addAll(activeBiomeTypes, BiomeDictionary.getTypesForBiome(biome));
}
@@ -18,7 +18,7 @@ import java.util.Set;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.IBee;
@@ -85,7 +85,7 @@ public class ItemInventoryHabitatLocator extends ItemInventory implements IError
locatorLogic.startBiomeSearch(bee, player);
}
public Set<BiomeGenBase> getBiomesToSearch() {
public Set<Biome> getBiomesToSearch() {
return locatorLogic.getTargetBiomes();
}
@@ -20,7 +20,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
@@ -34,9 +34,9 @@ public class HabitatLocatorLogic {
private static final int spacing = 20;
private static final int minBiomeRadius = 8;
private static final Set<BiomeGenBase> waterBiomes = new HashSet<>();
private static final Set<BiomeGenBase> netherBiomes = new HashSet<>();
private static final Set<BiomeGenBase> endBiomes = new HashSet<>();
private static final Set<Biome> waterBiomes = new HashSet<>();
private static final Set<Biome> netherBiomes = new HashSet<>();
private static final Set<Biome> endBiomes = new HashSet<>();
static {
Collections.addAll(waterBiomes, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.BEACH));
@@ -48,7 +48,7 @@ public class HabitatLocatorLogic {
Collections.addAll(endBiomes, BiomeDictionary.getBiomesForType(BiomeDictionary.Type.END));
}
private Set<BiomeGenBase> targetBiomes = new HashSet<>();
private Set<Biome> targetBiomes = new HashSet<>();
private boolean biomeFound = false;
private int searchRadiusIteration = 0;
private int searchAngleIteration = 0;
@@ -58,7 +58,7 @@ public class HabitatLocatorLogic {
return biomeFound;
}
public Set<BiomeGenBase> getTargetBiomes() {
public Set<Biome> getTargetBiomes() {
return targetBiomes;
}
@@ -69,7 +69,7 @@ public class HabitatLocatorLogic {
this.biomeFound = false;
this.searchCenter = player.getPosition();
BiomeGenBase currentBiome = player.worldObj.getBiomeGenForCoords(searchCenter);
Biome currentBiome = player.worldObj.getBiome(searchCenter);
removeInvalidBiomes(currentBiome, targetBiomes);
// reset the locator coordinates
@@ -99,7 +99,7 @@ public class HabitatLocatorLogic {
}
}
private BlockPos findNearestBiome(Entity player, Collection<BiomeGenBase> biomesToSearch) {
private BlockPos findNearestBiome(Entity player, Collection<Biome> biomesToSearch) {
BlockPos playerPos = player.getPosition();
// If we are in a valid spot, we point to ourselves.
@@ -150,30 +150,30 @@ public class HabitatLocatorLogic {
return null;
}
private static BlockPos getChunkCoordinates(BlockPos pos, World world, Collection<BiomeGenBase> biomesToSearch) {
BiomeGenBase biome;
private static BlockPos getChunkCoordinates(BlockPos pos, World world, Collection<Biome> biomesToSearch) {
Biome biome;
biome = world.getBiomeGenForCoords(pos);
biome = world.getBiome(pos);
if (!biomesToSearch.contains(biome)) {
return null;
}
biome = world.getBiomeGenForCoords(pos.add(-minBiomeRadius, 0, 0));
biome = world.getBiome(pos.add(-minBiomeRadius, 0, 0));
if (!biomesToSearch.contains(biome)) {
return null;
}
biome = world.getBiomeGenForCoords(pos.add(minBiomeRadius, 0, 0));
biome = world.getBiome(pos.add(minBiomeRadius, 0, 0));
if (!biomesToSearch.contains(biome)) {
return null;
}
biome = world.getBiomeGenForCoords(pos.add(0, 0, -minBiomeRadius));
biome = world.getBiome(pos.add(0, 0, -minBiomeRadius));
if (!biomesToSearch.contains(biome)) {
return null;
}
biome = world.getBiomeGenForCoords(pos.add(0, 0, minBiomeRadius));
biome = world.getBiome(pos.add(0, 0, minBiomeRadius));
if (!biomesToSearch.contains(biome)) {
return null;
}
@@ -181,7 +181,7 @@ public class HabitatLocatorLogic {
return pos;
}
private static void removeInvalidBiomes(BiomeGenBase currentBiome, Set<BiomeGenBase> biomesToSearch) {
private static void removeInvalidBiomes(Biome currentBiome, Set<Biome> biomesToSearch) {
biomesToSearch.removeAll(waterBiomes);
@@ -18,7 +18,7 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -69,7 +69,7 @@ public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List<String> list, boolean flag) {
BiomeGenBase currentBiome = player.worldObj.getBiomeGenForCoords(player.getPosition());
Biome currentBiome = player.worldObj.getBiome(player.getPosition());
float temperatureValue = ForestryAPI.climateManager.getTemperature(player.worldObj, player.getPosition());
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
@@ -22,7 +22,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
@@ -56,7 +56,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
private final InventoryBeeHousing inventory;
private final IBeekeepingLogic beekeepingLogic;
private BiomeGenBase cachedBiome;
private Biome cachedBiome;
private float tempChange = 0.0f;
private float humidChange = 0.0f;
@@ -292,14 +292,15 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
}
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
public NBTTagCompound writeToNBT(NBTTagCompound data) {
data = super.writeToNBT(data);
data.setFloat("TempChange", tempChange);
data.setFloat("HumidChange", humidChange);
beekeepingLogic.writeToNBT(data);
inventory.writeToNBT(data);
return data;
}
@Override
@@ -390,10 +391,10 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
}
@Override
public BiomeGenBase getBiome() {
public Biome getBiome() {
if (cachedBiome == null) {
BlockPos coords = getReferenceCoord();
cachedBiome = worldObj.getBiomeGenForCoords(coords);
cachedBiome = worldObj.getBiome(coords);
}
return cachedBiome;
}
@@ -14,7 +14,7 @@ import java.util.Collections;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
@@ -81,7 +81,7 @@ public class FakeAlvearyController extends FakeMultiblockController implements I
}
@Override
public BiomeGenBase getBiome() {
public Biome getBiome() {
return null;
}
@@ -18,7 +18,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IBeeHousingInventory;
@@ -84,7 +84,7 @@ public abstract class TileAlveary extends MultiblockTileEntityForestry<Multibloc
/* IHousing */
@Override
public BiomeGenBase getBiome() {
public Biome getBiome() {
return getMultiblockLogic().getController().getBiome();
}
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.apiculture.multiblock;
import javax.annotation.Nonnull;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
@@ -75,11 +77,13 @@ public abstract class TileAlvearyClimatiser extends TileAlveary implements IEner
setActive(workingTime > 0);
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
energyManager.writeToNBT(nbttagcompound);
nbttagcompound.setInteger("Heating", workingTime);
return nbttagcompound;
}
/* Network */
@@ -127,9 +127,10 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
}
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
tankManager.writeToNBT(nbttagcompound);
nbttagcompound.setInteger("TransferTime", transferTime);
@@ -138,6 +139,7 @@ public class TileAlvearyHygroregulator extends TileAlveary implements IInventory
currentRecipe.liquid.writeToNBT(subcompound);
nbttagcompound.setTag("CurrentLiquid", subcompound);
}
return nbttagcompound;
}
/* ILIQUIDTANKCONTAINER */
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.multiblock;
import javax.annotation.Nonnull;
import java.util.Map.Entry;
import java.util.Stack;
@@ -168,9 +169,10 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
}
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
nbttagcompound.setBoolean("Active", active);
NBTTagList nbttaglist = new NBTTagList();
@@ -184,6 +186,7 @@ public class TileAlvearySwarmer extends TileAlveary implements ISidedInventory,
}
}
nbttagcompound.setTag("PendingSpawns", nbttaglist);
return nbttagcompound;
}
@Override
@@ -10,13 +10,13 @@
******************************************************************************/
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import java.io.IOException;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
@@ -36,7 +36,7 @@ import forestry.core.tiles.TileBase;
public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing, IClimatised, IGuiBeeHousingInventory, IStreamableGui {
private final IBeekeepingLogic beeLogic;
private BiomeGenBase cachedBiome;
private Biome cachedBiome;
// CLIENT
private int breedingProgressPercent = 0;
@@ -52,10 +52,12 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
}
/* LOADING & SAVING */
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
beeLogic.writeToNBT(nbttagcompound);
return nbttagcompound;
}
@Override
@@ -64,10 +66,11 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
beeLogic.readFromNBT(nbttagcompound);
}
@Nonnull
@Override
public Packet getDescriptionPacket() {
public NBTTagCompound getUpdateTag() {
beeLogic.syncToClient();
return super.getDescriptionPacket();
return super.getUpdateTag();
}
/* ICLIMATISED */
@@ -142,9 +145,9 @@ public abstract class TileBeeHousingBase extends TileBase implements IBeeHousing
// / IBEEHOUSING
@Override
public BiomeGenBase getBiome() {
public Biome getBiome() {
if (cachedBiome == null) {
cachedBiome = worldObj.getBiomeGenForCoordsBody(getPos());
cachedBiome = worldObj.getBiome(getPos());
}
return cachedBiome;
}
@@ -10,20 +10,41 @@
******************************************************************************/
package forestry.apiculture.tiles;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import javax.annotation.Nonnull;
import forestry.apiculture.network.packets.PacketCandleUpdate;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
public class TileCandle extends TileEntity {
private int colour;
private boolean lit;
@Nonnull
@Override
public Packet getDescriptionPacket() {
PacketCandleUpdate updateCandle = new PacketCandleUpdate(this);
return updateCandle.getPacket();
public SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(getPos(), 0, getUpdateTag());
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
super.onDataPacket(net, pkt);
NBTTagCompound nbt = pkt.getNbtCompound();
handleUpdateTag(nbt);
}
@Nonnull
@Override
public NBTTagCompound getUpdateTag() {
NBTTagCompound tag = super.getUpdateTag();
return writeToNBT(tag);
}
@Override
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
super.handleUpdateTag(tag);
readFromNBT(tag);
}
public void onPacketUpdate(int colour, boolean isLit) {
@@ -38,11 +59,13 @@ public class TileCandle extends TileEntity {
lit = tagRoot.getBoolean("lit");
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound tagRoot) {
super.writeToNBT(tagRoot);
public NBTTagCompound writeToNBT(NBTTagCompound tagRoot) {
tagRoot = super.writeToNBT(tagRoot);
tagRoot.setInteger("colour", this.colour);
tagRoot.setBoolean("lit", this.lit);
return tagRoot;
}
public boolean isLit() {
@@ -11,6 +11,7 @@
package forestry.apiculture.tiles;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
@@ -20,7 +21,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ITickable;
@@ -29,7 +30,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import com.mojang.authlib.GameProfile;
@@ -186,11 +187,13 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
beeLogic.readFromNBT(nbttagcompound);
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
contained.writeToNBT(nbttagcompound);
beeLogic.writeToNBT(nbttagcompound);
return nbttagcompound;
}
@Override
@@ -252,10 +255,11 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
}
}
@Nullable
@Override
public Packet getDescriptionPacket() {
public SPacketUpdateTileEntity getUpdatePacket() {
beeLogic.syncToClient();
return super.getDescriptionPacket();
return super.getUpdatePacket();
}
@Override
@@ -305,8 +309,8 @@ public class TileHive extends TileEntity implements ITickable, IHiveTile, IActiv
}
@Override
public BiomeGenBase getBiome() {
return getWorld().getBiomeGenForCoords(getPos());
public Biome getBiome() {
return getWorld().getBiome(getPos());
}
@Override
@@ -13,10 +13,11 @@ package forestry.apiculture.worldgen;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import forestry.api.apiculture.IHiveDrop;
import forestry.api.apiculture.hives.IHiveDescription;
@@ -55,7 +56,7 @@ public final class Hive {
hiveDescription.postGen(world, pos);
}
public boolean isGoodBiome(BiomeGenBase biome) {
public boolean isGoodBiome(Biome biome) {
return hiveDescription.isGoodBiome(biome);
}
@@ -18,7 +18,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.common.util.EnumHelper;
@@ -66,7 +66,7 @@ public abstract class HiveDecorator {
Log.error("tried to generate a hive in an unloaded area.");
return;
}
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
Biome biome = world.getBiome(pos);
EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall());
for (Hive hive : hives) {
@@ -84,7 +84,7 @@ public abstract class HiveDecorator {
private static void decorateHivesDebug(World world, int chunkX, int chunkZ, List<Hive> hives) {
int worldX = (chunkX << 4) + 8;
int worldZ = (chunkZ << 4) + 8;
BiomeGenBase biome = world.getBiomeGenForCoords(new BlockPos(chunkX, 0, chunkZ));
Biome biome = world.getBiome(new BlockPos(chunkX, 0, chunkZ));
EnumHumidity humidity = EnumHumidity.getFromValue(biome.getRainfall());
for (int x = 0; x < 16; x++) {
@@ -113,7 +113,7 @@ public abstract class HiveDecorator {
return false;
}
BiomeGenBase biome = world.getBiomeGenForCoords(hivePos);
Biome biome = world.getBiome(hivePos);
EnumTemperature temperature = EnumTemperature.getFromValue(biome.getFloatTemperature(hivePos));
if (!hive.isGoodTemperature(temperature)) {
return false;
@@ -19,7 +19,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
@@ -63,7 +63,7 @@ public enum HiveDescription implements IHiveDescription {
JUNGLE(IHiveRegistry.HiveType.JUNGLE, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
END(IHiveRegistry.HiveType.END, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
@Override
public boolean isGoodBiome(BiomeGenBase biome) {
public boolean isGoodBiome(Biome biome) {
return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END);
}
},
@@ -122,7 +122,7 @@ public enum HiveDescription implements IHiveDescription {
}
@Override
public boolean isGoodBiome(BiomeGenBase biome) {
public boolean isGoodBiome(Biome biome) {
return !BiomeHelper.isBiomeHellish(biome);
}
@@ -19,7 +19,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import forestry.api.apiculture.hives.IHiveDescription;
import forestry.api.apiculture.hives.IHiveGen;
@@ -48,7 +48,7 @@ public class HiveDescriptionSwarmer implements IHiveDescription {
}
@Override
public boolean isGoodBiome(BiomeGenBase biome) {
public boolean isGoodBiome(Biome biome) {
return true;
}
@@ -52,7 +52,7 @@ public class HiveGenGround extends HiveGen {
IBlockState blockState = world.getBlockState(pos);
while (isTreeBlock(blockState, world, pos) || canReplace(blockState, world, pos)) {
pos.offsetMutable(EnumFacing.DOWN);
pos.move(EnumFacing.DOWN);
if (pos.getY() <= 0) {
return null;
}
@@ -47,7 +47,7 @@ public class HiveGenTree extends HiveGen {
// get to the bottom of the leaves
final BlockPos.MutableBlockPos pos = new BlockPos.MutableBlockPos(topPos);
do {
pos.offsetMutable(EnumFacing.DOWN);
pos.move(EnumFacing.DOWN);
blockState = world.getBlockState(pos);
} while (isTreeBlock(blockState, world, pos));
@@ -28,7 +28,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
@@ -337,7 +337,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
private static IBee getRandomVillageBee(World world, BlockPos pos) {
// Get current biome
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
Biome biome = world.getBiome(pos);
List<IBeeGenome> candidates;
if (BeeManager.uncommonVillageBees != null && !BeeManager.uncommonVillageBees.isEmpty() && world.rand.nextDouble() < 0.2) {
@@ -1,12 +1,48 @@
package forestry.arboriculture.blocks;
import com.google.common.collect.Lists;
import java.util.ArrayList;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import com.google.common.collect.Lists;
import net.minecraft.block.Block;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.EnumGermlingType;
import forestry.api.arboriculture.EnumPileType;
@@ -31,51 +67,12 @@ import forestry.arboriculture.render.PileStateMapper;
import forestry.arboriculture.tiles.TilePile;
import forestry.core.PluginCore;
import forestry.core.blocks.BlockStructure;
import forestry.core.blocks.IMachinePropertiesTesr;
import forestry.core.blocks.propertys.UnlistedBlockAccess;
import forestry.core.blocks.propertys.UnlistedBlockPos;
import forestry.core.multiblock.MultiblockLogic;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleHelper;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockDirt;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public abstract class BlockPile extends BlockStructure implements ITileEntityProvider, IStateMapperRegister, ISpriteRegister {
@@ -506,13 +503,13 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, EffectRenderer effectRenderer) {
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager effectRenderer) {
return ParticleHelper.addBlockHitEffects(worldObj, target.getBlockPos(), target.sideHit, effectRenderer, particleCallback);
}
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effectRenderer) {
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
IBlockState blockState = world.getBlockState(pos);
return ParticleHelper.addDestroyEffects(world, this, blockState, pos, effectRenderer, particleCallback);
}
@@ -147,13 +147,13 @@ public class BlockSapling extends BlockTreeContainer implements IGrowable, IStat
return tree.canStay(world, pos);
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock) {
super.onNeighborBlockChange(world, pos, state, neighborBlock);
if (!world.isRemote && !canBlockStay(world, pos)) {
dropAsSapling(world, pos);
world.setBlockToAir(pos);
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) {
super.neighborChanged(state, worldIn, pos, blockIn);
if (!worldIn.isRemote && !canBlockStay(worldIn, pos)) {
dropAsSapling(worldIn, pos);
worldIn.setBlockToAir(pos);
}
}
@@ -92,8 +92,8 @@ public class Tree extends Individual implements ITree, IPlantable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
NBTTagCompound nbtGenome = new NBTTagCompound();
genome.writeToNBT(nbtGenome);
@@ -104,6 +104,7 @@ public class Tree extends Individual implements ITree, IPlantable {
mate.writeToNBT(nbtMate);
nbttagcompound.setTag("Mate", nbtMate);
}
return nbttagcompound;
}
/* INTERACTION */
@@ -4,6 +4,12 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.arboriculture.EnumPileType;
import forestry.api.core.EnumHumidity;
import forestry.api.core.EnumTemperature;
@@ -22,11 +28,6 @@ import forestry.core.network.DataOutputStreamForestry;
import forestry.core.proxy.Proxies;
import forestry.core.utils.Log;
import forestry.core.utils.Translator;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class CharcoalPileController extends RectangularMultiblockControllerBase implements ICharcoalPileControllerInternal {
@@ -334,10 +335,11 @@ public class CharcoalPileController extends RectangularMultiblockControllerBase
}*/
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
public NBTTagCompound writeToNBT(NBTTagCompound data) {
data = super.writeToNBT(data);
data.setInteger("BurnTime", burnTime);
data.setBoolean("IsActive", active);
return data;
}
@Override
@@ -1,24 +1,18 @@
package forestry.arboriculture.render;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.ParticleDigging;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.api.arboriculture.EnumPileType;
import forestry.arboriculture.blocks.BlockPile;
import forestry.arboriculture.tiles.TilePile;
import forestry.core.blocks.BlockBase;
import forestry.core.proxy.Proxies;
import forestry.core.render.ParticleHelper;
import forestry.core.render.TextureManager;
import forestry.core.render.ParticleHelper.Callback;
import forestry.core.tiles.TileUtil;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class PileParticleCallback extends ParticleHelper.DefaultCallback<BlockPile>{
@@ -27,7 +21,7 @@ public class PileParticleCallback extends ParticleHelper.DefaultCallback<BlockPi
}
@Override
protected void setTexture(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state) {
protected void setTexture(ParticleDigging fx, World world, BlockPos pos, IBlockState state) {
EnumPileType type = block.getPileType();
TilePile pile = TileUtil.getTile(world, pos, TilePile.class);
TextureAtlasSprite texture;
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.arboriculture.tiles;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Collection;
@@ -21,7 +22,7 @@ import net.minecraft.block.BlockCocoa;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -35,9 +36,9 @@ import forestry.core.config.Constants;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IStreamable;
import forestry.core.network.packets.PacketTileStream;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.Log;
import forestry.core.utils.NBTUtilForestry;
public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamable {
@@ -74,8 +75,8 @@ public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamabl
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
if (allele != null) {
nbttagcompound.setString("UID", allele.getUID());
@@ -83,6 +84,7 @@ public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamabl
nbttagcompound.setShort("MT", maturity);
nbttagcompound.setFloat("SP", sappiness);
return nbttagcompound;
}
/* UPDATING */
@@ -122,9 +124,23 @@ public class TileFruitPod extends TileEntity implements IFruitBearer, IStreamabl
}
/* NETWORK */
@Nullable
@Override
public Packet getDescriptionPacket() {
return new PacketTileStream(this).getPacket();
public SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(this.getPos(), 0, getUpdateTag());
}
@Nonnull
@Override
public NBTTagCompound getUpdateTag() {
NBTTagCompound tag = super.getUpdateTag();
return NBTUtilForestry.writeStreamableToNbt(this, tag);
}
@Override
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
super.handleUpdateTag(tag);
NBTUtilForestry.readStreamableFromNbt(this, tag);
}
/* IFRUITBEARER */
@@ -97,9 +97,10 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
}
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbtTagCompound) {
super.writeToNBT(nbtTagCompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound) {
nbtTagCompound = super.writeToNBT(nbtTagCompound);
nbtTagCompound.setInteger("RT", getRipeningTime());
nbtTagCompound.setInteger("ENC", damage);
@@ -111,6 +112,7 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
caterpillar.writeToNBT(caterpillarNbt);
nbtTagCompound.setTag("CATER", caterpillarNbt);
}
return nbtTagCompound;
}
@Override
@@ -1,6 +1,17 @@
package forestry.arboriculture.tiles;
import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.arboriculture.EnumPileType;
import forestry.api.arboriculture.ITree;
import forestry.api.arboriculture.TreeManager;
@@ -14,14 +25,6 @@ import forestry.arboriculture.multiblock.EnumPilePosition;
import forestry.arboriculture.multiblock.MultiblockLogicCharcoalPile;
import forestry.core.multiblock.MultiblockTileEntityForestry;
import forestry.core.tiles.TileUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class TilePile extends MultiblockTileEntityForestry<MultiblockLogicCharcoalPile> implements ICharcoalPileComponent<MultiblockLogicCharcoalPile>{
@@ -145,16 +148,17 @@ public class TilePile extends MultiblockTileEntityForestry<MultiblockLogicCharco
}
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
public NBTTagCompound writeToNBT(NBTTagCompound data) {
data = super.writeToNBT(data);
if (containedTree != null) {
NBTTagCompound subcompound = new NBTTagCompound();
containedTree.writeToNBT(subcompound);
data.setTag("ContainedTree", subcompound);
}
return data;
}
@Override
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.arboriculture.tiles;
import javax.annotation.Nonnull;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
@@ -37,11 +38,13 @@ public class TileSapling extends TileTreeContainer {
timesTicked = nbttagcompound.getInteger("TT");
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
nbttagcompound.setInteger("TT", timesTicked);
return nbttagcompound;
}
@Override
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.arboriculture.tiles;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Random;
@@ -18,7 +19,8 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -33,7 +35,7 @@ import forestry.core.access.IOwnable;
import forestry.core.network.DataInputStreamForestry;
import forestry.core.network.DataOutputStreamForestry;
import forestry.core.network.IStreamable;
import forestry.core.network.packets.PacketTileStream;
import forestry.core.utils.NBTUtilForestry;
import forestry.core.utils.PlayerUtil;
/**
@@ -61,9 +63,10 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl
}
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound = super.writeToNBT(nbttagcompound);
if (containedTree != null) {
NBTTagCompound subcompound = new NBTTagCompound();
@@ -75,6 +78,8 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl
PlayerUtil.writeGameProfile(nbt, owner);
nbttagcompound.setTag("owner", nbt);
}
return nbttagcompound;
}
@Override
@@ -155,10 +160,30 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl
return !Block.isEqualTo(oldState.getBlock(), newSate.getBlock());
}
/* INETWORKEDENTITY */
@Nonnull
@Override
public Packet getDescriptionPacket() {
return new PacketTileStream(this).getPacket();
public SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(this.getPos(), 0, getUpdateTag());
}
@Override
public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
super.onDataPacket(net, pkt);
NBTTagCompound nbt = pkt.getNbtCompound();
handleUpdateTag(nbt);
}
@Nonnull
@Override
public NBTTagCompound getUpdateTag() {
NBTTagCompound tag = super.getUpdateTag();
return NBTUtilForestry.writeStreamableToNbt(this, tag);
}
@Override
public void handleUpdateTag(@Nonnull NBTTagCompound tag) {
super.handleUpdateTag(tag);
NBTUtilForestry.readStreamableFromNbt(this, tag);
}
}
@@ -42,18 +42,18 @@ public class WorldGenBalsa extends WorldGenTree {
float leafRadius = (girth - 1.0f) / 2.0f;
WorldGenHelper.addBlock(world, leafCenter, leaf, WorldGenHelper.EnumReplaceMode.AIR);
leafCenter.offsetMutable(EnumFacing.DOWN);
leafCenter.move(EnumFacing.DOWN);
WorldGenHelper.generateCylinderFromPos(world, leaf, leafCenter, leafRadius + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
leafCenter.offsetMutable(EnumFacing.DOWN);
leafCenter.move(EnumFacing.DOWN);
if (height > 10) {
WorldGenHelper.generateCylinderFromPos(world, leaf, leafCenter, leafRadius + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
leafCenter.offsetMutable(EnumFacing.DOWN);
leafCenter.move(EnumFacing.DOWN);
}
while (leafCenter.getY() > 6) {
WorldGenHelper.generateCylinderFromPos(world, leaf, leafCenter, leafRadius + girth, 1, WorldGenHelper.EnumReplaceMode.SOFT);
leafCenter.offsetMutable(EnumFacing.DOWN);
leafCenter.move(EnumFacing.DOWN);
}
}
}
@@ -10,19 +10,20 @@
******************************************************************************/
package forestry.core;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import forestry.api.core.IClimateManager;
import forestry.api.greenhouse.GreenhouseManager;
import forestry.api.greenhouse.IGreenhouseState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
public class ClimateManager implements IClimateManager{
@Override
public float getTemperature(World world, BlockPos pos) {
IGreenhouseState state = GreenhouseManager.greenhouseHelper.getGreenhouseState(world, pos);
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
Biome biome = world.getBiome(pos);
if(state != null){
return state.getExactTemperature();
@@ -33,7 +34,7 @@ public class ClimateManager implements IClimateManager{
@Override
public float getHumidity(World world, BlockPos pos) {
IGreenhouseState state = GreenhouseManager.greenhouseHelper.getGreenhouseState(world, pos);
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
Biome biome = world.getBiome(pos);
if(state != null){
return state.getExactHumidity();
@@ -176,7 +176,7 @@ public final class AccessHandler implements IAccessHandler {
}
@Override
public void writeToNBT(NBTTagCompound data) {
public NBTTagCompound writeToNBT(NBTTagCompound data) {
data.setInteger("Access", access.ordinal());
if (this.owner != null) {
@@ -184,5 +184,6 @@ public final class AccessHandler implements IAccessHandler {
PlayerUtil.writeGameProfile(nbt, owner);
data.setTag("owner", nbt);
}
return data;
}
}
@@ -105,8 +105,8 @@ public class FakeAccessHandler implements IAccessHandler {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
return nbttagcompound;
}
@Override
@@ -17,7 +17,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
@@ -271,7 +271,7 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
/* Particles */
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, EffectRenderer effectRenderer) {
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager effectRenderer) {
if (blockType.getMachineProperties() instanceof IMachinePropertiesTesr) {
return ParticleHelper.addBlockHitEffects(worldObj, target.getBlockPos(), target.sideHit, effectRenderer, particleCallback);
}
@@ -280,7 +280,7 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effectRenderer) {
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
if (blockType.getMachineProperties() instanceof IMachinePropertiesTesr) {
IBlockState blockState = world.getBlockState(pos);
return ParticleHelper.addDestroyEffects(world, this, blockState, pos, effectRenderer, particleCallback);
@@ -78,9 +78,9 @@ public abstract class BlockForestry extends Block implements IItemModelRegister,
}
@Override
public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighborBlock) {
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) {
try {
TileEntity tile = world.getTileEntity(pos);
TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileForestry) {
((TileForestry) tile).onNeighborBlockChange(state.getBlock());
}
@@ -97,7 +97,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("T", (short) type.ordinal());
@@ -115,7 +115,7 @@ public class CircuitBoard<T> implements ICircuitBoard {
nbttagcompound.setString("CA.I" + i, circuit.getUID());
}
return nbttagcompound;
}
@Override
@@ -22,11 +22,12 @@ public class CircuitLibrary extends WorldSavedData implements ICircuitLibrary {
}
@Override
public void readFromNBT(NBTTagCompound var1) {
public void readFromNBT(NBTTagCompound nbt) {
}
@Override
public void writeToNBT(NBTTagCompound var1) {
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
return nbt;
}
}
@@ -14,19 +14,19 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.Particle;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class EntityFXColoredDripParticle extends EntityFX {
public class ParticleColoredDripParticle extends Particle {
/**
* The height of the current bob
*/
private int bobTimer;
public EntityFXColoredDripParticle(World world, double x, double y, double z, float red, float green, float blue) {
public ParticleColoredDripParticle(World world, double x, double y, double z, float red, float green, float blue) {
super(world, x, y, z);
this.particleRed = red;
this.particleGreen = green;
@@ -10,12 +10,12 @@
******************************************************************************/
package forestry.core.entities;
import net.minecraft.client.particle.EntityReddustFX;
import net.minecraft.client.particle.ParticleRedstone;
import net.minecraft.world.World;
public class EntityFXHoneydust extends EntityReddustFX {
public class ParticleHoneydust extends ParticleRedstone {
public EntityFXHoneydust(World world, double x, double y, double z, float f1, float f2, float f3) {
public ParticleHoneydust(World world, double x, double y, double z, float f1, float f2, float f3) {
super(world, x, y, z, 1.0F, f1, f2, f3);
particleRed = 0.9F + world.rand.nextFloat() * 0.1F;
particleGreen = 0.75F + world.rand.nextFloat() * 0.2F;
@@ -1,84 +1,84 @@
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.entities;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityFXIgnition extends EntityFX {
private final float ignitionParticleScale;
public EntityFXIgnition(World world, double x, double y, double z) {
super(world, x, y, z, 0, 0, 0);
this.motionX *= 0.8;
this.motionY *= 0.8;
this.motionZ *= 0.8;
this.motionY = this.rand.nextFloat() * 0.4F + 0.05F;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
this.particleScale *= this.rand.nextFloat() / 2 + 0.3F;
this.ignitionParticleScale = this.particleScale;
this.particleMaxAge = (int) (16.0 / (Math.random() * 0.8 + 0.2));
this.setParticleTextureIndex(49);
}
@Override
public int getBrightnessForRender(float p_70070_1_) {
int i = super.getBrightnessForRender(p_70070_1_);
short short1 = 240;
int j = i >> 16 & 255;
return short1 | j << 16;
}
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
float f6 = (this.particleAge + partialTicks) / this.particleMaxAge;
this.particleScale = this.ignitionParticleScale * (1.0F - f6 * f6);
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
this.setExpired();
}
float f = (float) this.particleAge / (float) this.particleMaxAge;
if (this.rand.nextFloat() > f * 2) {
this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ);
}
this.motionY -= 0.03D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.999D;
this.motionY *= 0.999D;
this.motionZ *= 0.999D;
if (this.isCollided) {
this.motionX *= 0.7;
this.motionZ *= 0.7;
}
}
/*******************************************************************************
* Copyright (c) 2011-2014 SirSengir.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v3
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
******************************************************************************/
package forestry.core.entities;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ParticleIgnition extends Particle {
private final float ignitionParticleScale;
public ParticleIgnition(World world, double x, double y, double z) {
super(world, x, y, z, 0, 0, 0);
this.motionX *= 0.8;
this.motionY *= 0.8;
this.motionZ *= 0.8;
this.motionY = this.rand.nextFloat() * 0.4F + 0.05F;
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
this.particleScale *= this.rand.nextFloat() / 2 + 0.3F;
this.ignitionParticleScale = this.particleScale;
this.particleMaxAge = (int) (16.0 / (Math.random() * 0.8 + 0.2));
this.setParticleTextureIndex(49);
}
@Override
public int getBrightnessForRender(float p_70070_1_) {
int i = super.getBrightnessForRender(p_70070_1_);
short short1 = 240;
int j = i >> 16 & 255;
return short1 | j << 16;
}
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) {
float f6 = (this.particleAge + partialTicks) / this.particleMaxAge;
this.particleScale = this.ignitionParticleScale * (1.0F - f6 * f6);
super.renderParticle(worldRendererIn, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);
}
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge) {
this.setExpired();
}
float f = (float) this.particleAge / (float) this.particleMaxAge;
if (this.rand.nextFloat() > f * 2) {
this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ);
}
this.motionY -= 0.03D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.999D;
this.motionY *= 0.999D;
this.motionZ *= 0.999D;
if (this.isCollided) {
this.motionX *= 0.7;
this.motionZ *= 0.7;
}
}
}
@@ -10,7 +10,7 @@
******************************************************************************/
package forestry.core.entities;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.entity.Entity;
import net.minecraft.util.EnumParticleTypes;
@@ -20,10 +20,10 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class EntityFXSmoke extends EntityFX {
public class ParticleSmoke extends Particle {
private final float ignitionParticleScale;
public EntityFXSmoke(World world, double x, double y, double z) {
public ParticleSmoke(World world, double x, double y, double z) {
super(world, x, y, z, 0, 0, 0);
this.motionX *= 0.8;
this.motionY *= 0.8;
@@ -10,17 +10,17 @@
******************************************************************************/
package forestry.core.entities;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.entity.Entity;
import net.minecraft.world.World;
public class EntityFXSnow extends EntityFX {
public class ParticleSnow extends Particle {
public static TextureAtlasSprite sprites[];
public EntityFXSnow(World world, double x, double y, double z) {
public ParticleSnow(World world, double x, double y, double z) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
this.setParticleTexture(sprites[rand.nextInt(sprites.length)]);
@@ -17,7 +17,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockLiquid;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.Particle;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
@@ -38,7 +38,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.core.entities.EntityFXColoredDripParticle;
import forestry.core.entities.ParticleColoredDripParticle;
public class BlockForestryFluid extends BlockFluidClassic implements IItemModelRegister {
@@ -120,7 +120,7 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
double py = d1 - 1.05D;
double pz = d2 + rand.nextFloat();
EntityFX fx = new EntityFXColoredDripParticle(worldIn, px, py, pz, color.getRed(), color.getGreen(), color.getBlue());
Particle fx = new ParticleColoredDripParticle(worldIn, px, py, pz, color.getRed(), color.getGreen(), color.getBlue());
FMLClientHandler.instance().getClient().effectRenderer.addEffect(fx);
}
}
@@ -13,7 +13,7 @@ package forestry.core.fluids;
import java.util.List;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fluids.Fluid;
@@ -31,12 +31,12 @@ public class FakeTankManager implements ITankManager {
}
@Override
public void containerAdded(Container container, ICrafting player) {
public void containerAdded(Container container, IContainerListener player) {
}
@Override
public void updateGuiData(Container container, List<ICrafting> crafters) {
public void updateGuiData(Container container, List<IContainerListener> crafters) {
}
@@ -13,16 +13,16 @@ package forestry.core.fluids;
import java.util.List;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IContainerListener;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import net.minecraftforge.fluids.IFluidTank;
public interface ITankManager extends IFluidHandler {
void containerAdded(Container container, ICrafting crafter);
void containerAdded(Container container, IContainerListener crafter);
void updateGuiData(Container container, List<ICrafting> crafters);
void updateGuiData(Container container, List<IContainerListener> crafters);
void containerRemoved(Container container);
@@ -59,7 +59,8 @@ public class PipetteContents implements INbtWritable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
contents.writeToNBT(nbttagcompound);
return nbttagcompound;
}
}
@@ -23,7 +23,7 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
@@ -90,7 +90,7 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
}
@Override
public void writeToNBT(NBTTagCompound data) {
public NBTTagCompound writeToNBT(NBTTagCompound data) {
NBTTagList tagList = new NBTTagList();
for (byte slot = 0; slot < tanks.size(); slot++) {
StandardTank tank = tanks.get(slot);
@@ -102,6 +102,7 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
}
}
data.setTag("tanks", tagList);
return data;
}
@Override
@@ -132,12 +133,12 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
}
@Override
public void containerAdded(Container container, ICrafting player) {
public void containerAdded(Container container, IContainerListener player) {
if (!(player instanceof EntityPlayerMP)) {
return;
}
List<ICrafting> crafters = Collections.singletonList(player);
List<IContainerListener> crafters = Collections.singletonList(player);
for (StandardTank tank : tanks) {
sendTankUpdate(container, tank, crafters);
@@ -152,13 +153,13 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
}
@Override
public void updateGuiData(Container container, List<ICrafting> crafters) {
public void updateGuiData(Container container, List<IContainerListener> crafters) {
for (StandardTank tank : tanks) {
updateGuiData(container, crafters, tank.getTankIndex());
}
}
private void updateGuiData(Container container, List<ICrafting> crafters, int tankIndex) {
private void updateGuiData(Container container, List<IContainerListener> crafters, int tankIndex) {
StandardTank tank = tanks.get(tankIndex);
if (tank == null) {
return;
@@ -173,11 +174,11 @@ public class TankManager implements ITankManager, ITankUpdateHandler, IStreamabl
sendTankUpdate(container, tank, crafters);
}
private void sendTankUpdate(Container container, StandardTank tank, Iterable<ICrafting> crafters) {
private void sendTankUpdate(Container container, StandardTank tank, Iterable<IContainerListener> crafters) {
int tankIndex = tank.getTankIndex();
FluidStack fluid = tank.getFluid();
IForestryPacketClient packet = new PacketTankLevelUpdate(tile, tankIndex, fluid);
for (ICrafting crafter : crafters) {
for (IContainerListener crafter : crafters) {
if (crafter instanceof EntityPlayerMP) {
Proxies.net.sendToPlayer(packet, (EntityPlayerMP) crafter);
}
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.core.genetics;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
@@ -140,7 +141,7 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
public void readFromNBT(@Nonnull NBTTagCompound nbttagcompound) {
if (nbttagcompound.hasKey(MODE_NAME_KEY)) {
modeName = nbttagcompound.getString(MODE_NAME_KEY);
@@ -151,9 +152,11 @@ public abstract class BreedingTracker extends WorldSavedData implements IBreedin
readValuesFromNBT(nbttagcompound, researchedMutations, RESEARCHED_COUNT_KEY, RESEARCHED_KEY);
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbttagcompound) {
writeToNBT(nbttagcompound, discoveredSpecies, discoveredMutations, researchedMutations);
return nbttagcompound;
}
private void writeToNBT(NBTTagCompound nbtTagCompound, Collection<String> discoveredSpecies, Collection<String> discoveredMutations, Collection<String> researchedMutations) {
@@ -46,9 +46,10 @@ public class Chromosome implements IChromosome {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setString(UID0_TAG, primary.getUID());
nbttagcompound.setString(UID1_TAG, secondary.getUID());
return nbttagcompound;
}
@Override
@@ -64,6 +64,7 @@ public class EffectData implements IEffectData {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
return nbttagcompound;
}
}
@@ -18,6 +18,7 @@ import java.util.Arrays;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleSpecies;
import forestry.api.genetics.IChromosome;
@@ -198,7 +199,7 @@ public abstract class Genome implements IGenome {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < chromosomes.length; i++) {
@@ -210,6 +211,7 @@ public abstract class Genome implements IGenome {
}
}
nbttagcompound.setTag("Chromosomes", nbttaglist);
return nbttagcompound;
}
// / INFORMATION RETRIEVAL
@@ -45,8 +45,9 @@ public abstract class Individual implements IIndividual {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setBoolean("IsAnalyzed", isAnalyzed);
return nbttagcompound;
}
/* IDENTIFICATION */
@@ -37,9 +37,9 @@ public abstract class IndividualLiving extends Individual implements IIndividual
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
nbttagcompound = super.writeToNBT(nbttagcompound);
nbttagcompound.setInteger("Health", health);
nbttagcompound.setInteger("MaxH", maxHealth);
@@ -54,7 +54,7 @@ public abstract class IndividualLiving extends Individual implements IIndividual
getMate().writeToNBT(nbtMate);
nbttagcompound.setTag("Mate", nbtMate);
}
return nbttagcompound;
}
/* GENERATION */
@@ -232,7 +232,7 @@ public class ItemResearchNote extends ItemForestry {
}
}
public void writeToNBT(NBTTagCompound compound) {
public NBTTagCompound writeToNBT(NBTTagCompound compound) {
if (this.researcher != null) {
NBTTagCompound nbt = new NBTTagCompound();
PlayerUtil.writeGameProfile(nbt, researcher);
@@ -240,6 +240,7 @@ public class ItemResearchNote extends ItemForestry {
}
compound.setByte("TYP", (byte) type.ordinal());
compound.setTag("INN", inner);
return compound;
}
public void addTooltip(List<String> list) {
@@ -16,7 +16,7 @@ import java.util.Locale;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
@@ -35,7 +35,7 @@ public class MutationConditionBiome implements IMutationCondition {
@Override
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getBiomeGenForCoords(pos);
Biome biome = world.getBiome(pos);
for (BiomeDictionary.Type type : validBiomeTypes) {
if (BiomeDictionary.isBiomeOfType(biome, type)) {
return 1;
@@ -12,7 +12,7 @@ package forestry.core.genetics.mutations;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.biome.Biome;
import forestry.api.core.EnumTemperature;
import forestry.api.genetics.AlleleManager;
@@ -33,7 +33,7 @@ public class MutationConditionTemperature implements IMutationCondition {
@Override
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
BiomeGenBase biome = world.getBiomeProvider().getBiomeGenerator(pos);
Biome biome = world.getBiomeProvider().getBiome(pos);
EnumTemperature biomeTemperature = EnumTemperature.getFromBiome(biome, world, pos);
if (biomeTemperature.ordinal() < minTemperature.ordinal() || biomeTemperature.ordinal() > maxTemperature.ordinal()) {
@@ -20,7 +20,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@@ -97,7 +97,7 @@ public abstract class ContainerForestry extends Container {
protected abstract boolean canAccess(EntityPlayer player);
protected final void sendPacketToListeners(IForestryPacketClient packet) {
for (ICrafting listener : listeners) {
for (IContainerListener listener : listeners) {
if (listener instanceof EntityPlayer) {
Proxies.net.sendToPlayer(packet, (EntityPlayer) listener);
} else {
@@ -13,7 +13,7 @@ package forestry.core.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.fluids.IFluidTank;
@@ -46,7 +46,7 @@ public abstract class ContainerLiquidTanks<T extends TileEntity & ILiquidTankTil
}
@Override
public void addListener(ICrafting crafting) {
public void addListener(IContainerListener crafting) {
super.addListener(crafting);
tile.getTankManager().containerAdded(this, crafting);
}
@@ -13,7 +13,7 @@ package forestry.core.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -51,7 +51,7 @@ public abstract class ContainerLiquidTanksSocketed<T extends TileEntity & ILiqui
}
@Override
public void addListener(ICrafting crafting) {
public void addListener(IContainerListener crafting) {
super.addListener(crafting);
tile.getTankManager().containerAdded(this, crafting);
}
@@ -13,7 +13,7 @@ package forestry.core.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.IInventory;
import forestry.core.gui.slots.SlotFilteredInventory;
@@ -50,7 +50,7 @@ public class ContainerNaturalistInventory extends ContainerTile<TileNaturalistCh
}
@Override
public void addListener(ICrafting listener) {
public void addListener(IContainerListener listener) {
super.addListener(listener);
tile.increaseNumPlayersUsing();
@@ -134,8 +134,8 @@ public class FakeInventoryAdapter implements IInventoryAdapter {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
return nbttagcompound;
}
@Override
@@ -195,8 +195,9 @@ public class InventoryAdapter implements IInventoryAdapter, IStreamable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
InventoryUtil.writeToNBT(this, nbttagcompound);
return nbttagcompound;
}
@Override
@@ -142,8 +142,9 @@ public class InventoryPlain implements IInventory, INbtWritable, INbtReadable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
InventoryUtil.writeToNBT(this, nbttagcompound);
return nbttagcompound;
}
/* Fields */
@@ -151,8 +151,8 @@ public abstract class FakeMultiblockController implements IMultiblockControllerI
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
return nbttagcompound;
}
@Override
@@ -95,8 +95,9 @@ public abstract class MultiblockControllerForestry extends MultiblockControllerB
/* INbtWritable */
@Override
public void writeToNBT(NBTTagCompound data) {
public NBTTagCompound writeToNBT(NBTTagCompound data) {
accessHandler.writeToNBT(data);
return data;
}
@Override
@@ -112,12 +112,13 @@ public abstract class MultiblockLogic<T extends IMultiblockControllerInternal> i
}
@Override
public void writeToNBT(NBTTagCompound data) {
public NBTTagCompound writeToNBT(NBTTagCompound data) {
if (isMultiblockSaveDelegate() && isConnected()) {
NBTTagCompound multiblockData = new NBTTagCompound();
this.controller.writeToNBT(multiblockData);
data.setTag("multiblockData", multiblockData);
}
return data;
}
public final void assertDetached(IMultiblockComponent part) {
@@ -61,9 +61,10 @@ public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> e
getInternalInventory().readFromNBT(data);
}
@Nonnull
@Override
public void writeToNBT(NBTTagCompound data) {
super.writeToNBT(data);
public NBTTagCompound writeToNBT(NBTTagCompound data) {
data = super.writeToNBT(data);
if (this.owner != null) {
NBTTagCompound nbt = new NBTTagCompound();
@@ -72,6 +73,7 @@ public abstract class MultiblockTileEntityForestry<T extends IMultiblockLogic> e
}
getInternalInventory().writeToNBT(data);
return data;
}
/* INVENTORY */
@@ -10,7 +10,7 @@ import java.util.Set;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
@@ -315,7 +315,7 @@ public class MultiblockWorldRegistry {
if (worldObj.getChunkProvider().getLoadedChunk(worldLocation.getX() >> 4, worldLocation.getZ() >> 4) == null) {
// Part goes into the waiting-for-chunk-load list
Set<IMultiblockComponent> partSet;
long chunkHash = ChunkCoordIntPair.chunkXZ2Int(worldLocation.getX() >> 4, worldLocation.getZ() >> 4);
long chunkHash = ChunkPos.chunkXZ2Int(worldLocation.getX() >> 4, worldLocation.getZ() >> 4);
synchronized (partsAwaitingChunkLoadMutex) {
if (!partsAwaitingChunkLoad.containsKey(chunkHash)) {
partSet = new HashSet<>();
@@ -340,7 +340,7 @@ public class MultiblockWorldRegistry {
public void onPartRemovedFromWorld(IMultiblockComponent part) {
BlockPos coord = part.getCoordinates();
if (coord != null) {
long hash = ChunkCoordIntPair.chunkXZ2Int(coord.getX() >> 4, coord.getZ() >> 4);
long hash = ChunkPos.chunkXZ2Int(coord.getX() >> 4, coord.getZ() >> 4);
if (partsAwaitingChunkLoad.containsKey(hash)) {
synchronized (partsAwaitingChunkLoadMutex) {
@@ -396,7 +396,7 @@ public class MultiblockWorldRegistry {
* @param chunkZ Chunk Z coordinate (world coordate >> 4) of the chunk that was loaded
*/
public void onChunkLoaded(int chunkX, int chunkZ) {
long chunkHash = ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ);
long chunkHash = ChunkPos.chunkXZ2Int(chunkX, chunkZ);
if (partsAwaitingChunkLoad.containsKey(chunkHash)) {
synchronized (partsAwaitingChunkLoadMutex) {
if (partsAwaitingChunkLoad.containsKey(chunkHash)) {
@@ -12,7 +12,7 @@ package forestry.core.proxy;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.management.PlayerManager;
import net.minecraft.server.management.PlayerChunkMap;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
@@ -31,7 +31,7 @@ public class ProxyNetwork {
}
WorldServer worldServer = (WorldServer) world;
PlayerManager playerManager = worldServer.getPlayerChunkMap();
PlayerChunkMap playerManager = worldServer.getPlayerChunkMap();
int chunkX = packet.getPos().getX() >> 4;
int chunkZ = packet.getPos().getZ() >> 4;
@@ -18,9 +18,9 @@ public class ProxyNetworkClient extends ProxyNetwork {
@Override
public void sendToServer(IForestryPacketServer packet) {
NetHandlerPlayClient netHandler = Proxies.common.getClientInstance().getNetHandler();
NetHandlerPlayClient netHandler = Proxies.common.getClientInstance().getConnection();
if (netHandler != null) {
netHandler.addToSendQueue(packet.getPacket());
netHandler.sendPacket(packet.getPacket());
}
}
}
@@ -31,6 +31,7 @@ import net.minecraftforge.common.model.animation.IAnimationStateMachine;
import forestry.core.fluids.Fluids;
import forestry.core.models.BlockModelIndex;
import forestry.core.models.ModelIndex;
import forestry.core.tiles.TileAnalyzer;
import forestry.core.tiles.TileBase;
import forestry.core.tiles.TileEscritoire;
import forestry.core.tiles.TileMill;
@@ -71,7 +72,7 @@ public class ProxyRender {
}
@Nullable
public TileEntitySpecialRenderer getRendererAnalyzer() {
public TileEntitySpecialRenderer<TileAnalyzer> getRendererAnalyzer() {
return null;
}
@@ -18,8 +18,8 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@@ -44,10 +44,10 @@ import forestry.apiculture.entities.ParticleBee;
import forestry.apiculture.render.TextureHabitatLocator;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.entities.EntityFXHoneydust;
import forestry.core.entities.EntityFXIgnition;
import forestry.core.entities.EntityFXSmoke;
import forestry.core.entities.EntityFXSnow;
import forestry.core.entities.ParticleHoneydust;
import forestry.core.entities.ParticleIgnition;
import forestry.core.entities.ParticleSmoke;
import forestry.core.entities.ParticleSnow;
import forestry.core.fluids.Fluids;
import forestry.core.models.BlockModelIndex;
import forestry.core.models.ModelIndex;
@@ -195,8 +195,8 @@ public class ProxyRenderClient extends ProxyRender {
if (!flowerPositions.isEmpty()) {
BlockPos destination = flowerPositions.get(world.rand.nextInt(flowerPositions.size()));
EntityFX particle = new ParticleBee(world, x, y, z, color, destination);
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle particle = new ParticleBee(world, x, y, z, color, destination);
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(particle);
}
}
@@ -207,8 +207,8 @@ public class ProxyRenderClient extends ProxyRender {
return;
}
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new EntityFXHoneydust(world, x, y, z, 0, 0, 0));
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleHoneydust(world, x, y, z, 0, 0, 0));
}
@Override
@@ -217,9 +217,9 @@ public class ProxyRenderClient extends ProxyRender {
return;
}
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
EntityFX entityfx = effectRenderer.spawnEffectParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), x, y, z, 0, 0, 0);
effectRenderer.addEffect(entityfx);
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle Particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), x, y, z, 0, 0, 0);
effectRenderer.addEffect(Particle);
}
@Override
@@ -228,8 +228,8 @@ public class ProxyRenderClient extends ProxyRender {
return;
}
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new EntityFXSnow(world, x + world.rand.nextGaussian(), y, z + world.rand.nextGaussian()));
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleSnow(world, x + world.rand.nextGaussian(), y, z + world.rand.nextGaussian()));
}
@Override
@@ -238,8 +238,8 @@ public class ProxyRenderClient extends ProxyRender {
return;
}
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new EntityFXIgnition(world, x, y, z));
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleIgnition(world, x, y, z));
}
@Override
@@ -248,8 +248,8 @@ public class ProxyRenderClient extends ProxyRender {
return;
}
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new EntityFXSmoke(world, x, y, z));
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
effectRenderer.addEffect(new ParticleSmoke(world, x, y, z));
}
@Override
@@ -262,11 +262,11 @@ public class ProxyRenderClient extends ProxyRender {
float green = (color >> 8 & 255) / 255.0F;
float blue = (color & 255) / 255.0F;
EffectRenderer effectRenderer = Minecraft.getMinecraft().effectRenderer;
EntityFX entityfx = effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), x, y, z, 0, 0, 0);
entityfx.setRBGColorF(red, green, blue);
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle Particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), x, y, z, 0, 0, 0);
Particle.setRBGColorF(red, green, blue);
effectRenderer.addEffect(entityfx);
effectRenderer.addEffect(Particle);
}
private static class BlockModeStateMapper extends StateMapperBase {
@@ -12,12 +12,13 @@ package forestry.core.render;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.particle.ParticleDigging;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.core.blocks.BlockBase;
import forestry.core.blocks.IBlockType;
import forestry.core.blocks.IMachineProperties;
@@ -34,7 +35,7 @@ public class MachineParticleCallback<P extends Enum<P> & IBlockType & IStringSer
}
@Override
protected void setTexture(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state) {
protected void setTexture(ParticleDigging fx, World world, BlockPos pos, IBlockState state) {
IMachineProperties<?> machineProperties = blockType.getMachineProperties();
if(machineProperties instanceof IMachinePropertiesTesr){
Minecraft minecraft = Proxies.common.getClientInstance();
@@ -10,21 +10,19 @@
******************************************************************************/
package forestry.core.render;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.particle.ParticleDigging;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -37,10 +35,8 @@ import forestry.core.proxy.Proxies;
*/
public class ParticleHelper {
private static final Random rand = new Random();
@SideOnly(Side.CLIENT)
public static boolean addBlockHitEffects(World world, BlockPos pos, EnumFacing side, EffectRenderer effectRenderer, Callback callback) {
public static boolean addBlockHitEffects(World world, BlockPos pos, EnumFacing side, ParticleManager effectRenderer, Callback callback) {
IBlockState iblockstate = world.getBlockState(pos);
if(iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) {
int x = pos.getX();
@@ -75,7 +71,7 @@ public class ParticleHelper {
px = x + axisalignedbb.maxX + f;
}
EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, 0.0D, 0.0D, 0.0D, Block.getStateId(iblockstate));
ParticleDigging fx = (ParticleDigging) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, 0.0D, 0.0D, 0.0D, Block.getStateId(iblockstate));
callback.addHitEffects(fx, world, pos, iblockstate);
effectRenderer.addEffect(fx.setBlockPos(new BlockPos(x, y, z)).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
@@ -91,7 +87,7 @@ public class ParticleHelper {
* @return True to prevent vanilla break particles from spawning.
*/
@SideOnly(Side.CLIENT)
public static boolean addDestroyEffects(World world, Block block, IBlockState state, BlockPos pos, EffectRenderer effectRenderer, Callback callback) {
public static boolean addDestroyEffects(World world, Block block, IBlockState state, BlockPos pos, ParticleManager effectRenderer, Callback callback) {
if (block != state.getBlock()) {
return true;
}
@@ -103,9 +99,8 @@ public class ParticleHelper {
double px = pos.getX() + (i + 0.5D) / iterations;
double py = pos.getY() + (j + 0.5D) / iterations;
double pz = pos.getZ() + (k + 0.5D) / iterations;
int random = rand.nextInt(6);
EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), px, py, pz, px - pos.getX() - 0.5D, py - pos.getY() - 0.5D, pz - pos.getZ() - 0.5D, Block.getStateId(state));
ParticleDigging fx = (ParticleDigging) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), px, py, pz, px - pos.getX() - 0.5D, py - pos.getY() - 0.5D, pz - pos.getZ() - 0.5D, Block.getStateId(state));
callback.addDestroyEffects(fx, world, pos, state);
effectRenderer.addEffect(fx.setBlockPos(pos));
}
@@ -118,10 +113,10 @@ public class ParticleHelper {
public interface Callback {
@SideOnly(Side.CLIENT)
void addHitEffects(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state);
void addHitEffects(ParticleDigging fx, World world, BlockPos pos, IBlockState state);
@SideOnly(Side.CLIENT)
void addDestroyEffects(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state);
void addDestroyEffects(ParticleDigging fx, World world, BlockPos pos, IBlockState state);
}
public static class DefaultCallback<B extends Block> implements ParticleHelper.Callback {
@@ -134,18 +129,18 @@ public class ParticleHelper {
@Override
@SideOnly(Side.CLIENT)
public void addHitEffects(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state) {
public void addHitEffects(ParticleDigging fx, World world, BlockPos pos, IBlockState state) {
setTexture(fx, world, pos, state);
}
@Override
@SideOnly(Side.CLIENT)
public void addDestroyEffects(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state) {
public void addDestroyEffects(ParticleDigging fx, World world, BlockPos pos, IBlockState state) {
setTexture(fx, world, pos, state);
}
@SideOnly(Side.CLIENT)
protected void setTexture(EntityDiggingFX fx, World world, BlockPos pos, IBlockState state) {
protected void setTexture(ParticleDigging fx, World world, BlockPos pos, IBlockState state) {
Minecraft minecraft = Proxies.common.getClientInstance();
BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher();
BlockModelShapes blockModelShapes = blockRendererDispatcher.getBlockModelShapes();
@@ -59,12 +59,13 @@ public class EscritoireGame implements INbtWritable, INbtReadable, IStreamable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("bountyLevel", bountyLevel);
nbttagcompound.setLong("lastUpdate", lastUpdate);
gameBoard.writeToNBT(nbttagcompound);
nbttagcompound.setInteger("Status", status.ordinal());
return nbttagcompound;
}
@Override
@@ -190,7 +190,7 @@ public class EscritoireGameBoard implements INbtWritable, IStreamable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
if (tokenCount > 0) {
nbttagcompound.setInteger("TokenCount", tokenCount);
NBTTagList nbttaglist = new NBTTagList();
@@ -211,6 +211,7 @@ public class EscritoireGameBoard implements INbtWritable, IStreamable {
} else {
nbttagcompound.setInteger("TokenCount", 0);
}
return nbttagcompound;
}
/* IStreamable */
@@ -143,7 +143,7 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
public NBTTagCompound writeToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("state", state.ordinal());
if (tokenStack != null) {
@@ -151,6 +151,7 @@ public class EscritoireGameToken implements INbtWritable, IStreamable {
tokenStack.writeToNBT(stackcompound);
nbttagcompound.setTag("tokenStack", stackcompound);
}
return nbttagcompound;
}
/* IStreamable */
Loaded 100 of 163 files, more files were not shown because too many files have changed in this diff. Show more