More porting to 1.9

This commit is contained in:
mezz committed 2016-05-04 21:15:23 -07:00
1 parent a0cdaf1e1a
commit 5d74c1254b
49 files changed
+295 -375

No files matched your search

@@ -9,7 +9,7 @@ import forestry.api.genetics.IFlowerRegistry;
public class FlowerManager {
/**
* <blockquote><pre>e.g. FlowerManager.flowerRegister.registerPlantableFlower(new ItemStack(Blocks.red_flower), 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);</pre></blockquote>
* <blockquote><pre>e.g. FlowerManager.flowerRegister.registerPlantableFlower(new ItemStack(Blocks.RED_FLOWER), 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);</pre></blockquote>
*/
public static IFlowerRegistry flowerRegistry;
@@ -911,9 +911,9 @@ public class PluginApiculture extends BlankForestryPlugin {
}
@Override
public void populateChunk(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
if (Config.getBeehivesAmount() > 0.0) {
HiveDecorator.decorateHives(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
HiveDecorator.decorateHives(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
}
}
@@ -26,19 +26,19 @@ public class VillageHandlerApiculture /*implements IVillageCreationHandler, IVil
@Override
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random random) {
ItemStack wildcardPrincess = new ItemStack(PluginApiculture.items.beePrincessGE, 1, OreDictionary.WILDCARD_VALUE);
recipeList.add(new MerchantRecipe(wildcardPrincess, new ItemStack(Items.emerald, 1)));
recipeList.add(new MerchantRecipe(wildcardPrincess, new ItemStack(Items.EMERALD, 1)));
ItemStack randomComb = PluginApiculture.items.beeComb.getRandomComb(1, random, false);
recipeList.add(new MerchantRecipe(new ItemStack(Items.WHEAT, 2), randomComb));
ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockTypeApiculture.APIARY);
recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), apiary));
recipeList.add(new MerchantRecipe(new ItemStack(Blocks.LOG, 24, OreDictionary.WILDCARD_VALUE), apiary));
ItemStack provenFrames = PluginApiculture.items.frameProven.getItemStack(6);
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), provenFrames));
recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, 1), provenFrames));
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 12), wildcardPrincess, monasticDrone));
recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, 12), wildcardPrincess, monasticDrone));
}
@Override
@@ -27,6 +27,7 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@@ -55,7 +56,7 @@ import forestry.apiculture.tiles.TileCandle;
import forestry.core.tiles.TileUtil;
import forestry.core.utils.ItemStackUtil;
public class BlockCandle extends BlockTorch implements IItemModelRegister, ITileEntityProvider {
public class BlockCandle extends BlockTorch implements IItemModelRegister, ITileEntityProvider, IBlockColor {
private static final ImmutableMap<String, Integer> colours;
public static final Set<Item> lightingItems;
@@ -321,4 +322,13 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
public ItemStack getLitCandle(int amount) {
return new ItemStack(this, amount, 1);
}
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
TileCandle tileCandle = TileUtil.getTile(worldIn, pos, TileCandle.class);
if (tileCandle != null) {
return tileCandle.getColour();
}
return 0xffffff;
}
}
@@ -76,7 +76,7 @@ public abstract class EntityMinecartBeeHousingBase extends EntityMinecartContain
@Override
public EnumHumidity getHumidity() {
return EnumHumidity.getFromValue(getBiome().rainfall);
return EnumHumidity.getFromValue(getBiome().getRainfall());
}
@Override
@@ -277,8 +277,8 @@ public final class FlowerRegistry implements IFlowerRegistry, IFlowerGrowthHelpe
FlowerManager.FlowerTypeJungle);
registerGrowthRule(new GrowthRuleMycelium(), FlowerManager.FlowerTypeMushrooms);
registerGrowthRule(new GrowthRuleNone(), FlowerManager.FlowerTypeEnd);
registerGrowthRule(new GrowthRuleFertilize(Blocks.melon_stem, Blocks.pumpkin_stem), FlowerManager.FlowerTypeGourd);
registerGrowthRule(new GrowthRuleFertilize(Blocks.wheat), FlowerManager.FlowerTypeWheat);
registerGrowthRule(new GrowthRuleFertilize(Blocks.MELON_STEM, Blocks.PUMPKIN_STEM), FlowerManager.FlowerTypeGourd);
registerGrowthRule(new GrowthRuleFertilize(Blocks.WHEAT), FlowerManager.FlowerTypeWheat);
}
@Override
@@ -62,7 +62,7 @@ public class AlleleEffectGlacial extends AlleleEffectThrottled {
continue;
}
world.setBlockState(posBlock, Blocks.ice.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
world.setBlockState(posBlock, Blocks.ICE.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
}
return storedData;
@@ -12,11 +12,9 @@ package forestry.apiculture.items;
import java.util.List;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@@ -41,7 +39,7 @@ import forestry.core.config.Config;
import forestry.core.genetics.ItemGE;
import forestry.core.utils.Translator;
public class ItemBeeGE extends ItemGE {
public class ItemBeeGE extends ItemGE implements IItemColor {
private final EnumBeeType type;
@@ -118,9 +116,22 @@ public class ItemBeeGE extends ItemGE {
}
}
@SideOnly(Side.CLIENT)
public void registerItemColors() {
@Override
public int getColorFromItemstack(ItemStack itemstack, int tintIndex) {
if (!itemstack.hasTagCompound()) {
if (tintIndex == 1) {
return 0xffdc16;
} else {
return 0xffffff;
}
}
IAlleleBeeSpecies species = BeeGenome.getSpecies(itemstack);
if (species instanceof IAlleleBeeSpecies) {
return species.getSpriteColour(tintIndex);
} else {
return 0xffffff;
}
}
/* MODELS */
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -26,7 +27,7 @@ import forestry.api.core.Tabs;
import forestry.core.config.Config;
import forestry.core.items.ItemForestry;
public class ItemHoneyComb extends ItemForestry {
public class ItemHoneyComb extends ItemForestry implements IItemColor {
public ItemHoneyComb() {
setMaxDamage(0);
setHasSubtypes(true);
@@ -91,4 +92,14 @@ public class ItemHoneyComb extends ItemForestry {
public ItemStack get(EnumHoneyComb honeyComb, int amount) {
return new ItemStack(this, amount, honeyComb.ordinal());
}
@Override
public int getColorFromItemstack(ItemStack itemstack, int tintIndex) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[itemstack.getItemDamage()];
if (tintIndex == 1) {
return honeyComb.primaryColor;
} else {
return honeyComb.secondaryColor;
}
}
}
@@ -10,93 +10,10 @@
******************************************************************************/
package forestry.apiculture.proxy;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.apiculture.PluginApiculture;
import forestry.apiculture.blocks.BlockRegistryApiculture;
import forestry.apiculture.genetics.BeeGenome;
import forestry.apiculture.items.EnumHoneyComb;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.apiculture.tiles.TileCandle;
import forestry.core.tiles.TileUtil;
public class ProxyApicultureClient extends ProxyApiculture {
@Override
public void initializeRendering() {
Minecraft minecraft = Minecraft.getMinecraft();
ItemColors itemColors = minecraft.getItemColors();
BlockColors blockColors = minecraft.getBlockColors();
ItemRegistryApiculture items = PluginApiculture.items;
BlockRegistryApiculture blocks = PluginApiculture.blocks;
itemColors.registerItemColorHandler(new BeeItemColor(),
items.beeQueenGE,
items.beeDroneGE,
items.beeLarvaeGE,
items.beePrincessGE
);
itemColors.registerItemColorHandler(new HoneyCombItemColor(),
items.beeComb
);
blockColors.registerBlockColorHandler(new CandleBlockColor(),
blocks.candle,
blocks.stump
);
}
private static class HoneyCombItemColor implements IItemColor {
@Override
public int getColorFromItemstack(ItemStack itemstack, int tintIndex) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[itemstack.getItemDamage()];
if (tintIndex == 1) {
return honeyComb.primaryColor;
} else {
return honeyComb.secondaryColor;
}
}
}
private static class BeeItemColor implements IItemColor {
@Override
public int getColorFromItemstack(ItemStack itemstack, int tintIndex) {
if (!itemstack.hasTagCompound()) {
if (tintIndex == 1) {
return 0xffdc16;
} else {
return 0xffffff;
}
}
IAlleleBeeSpecies species = BeeGenome.getSpecies(itemstack);
if (species instanceof IAlleleBeeSpecies) {
return species.getSpriteColour(tintIndex);
} else {
return 0xffffff;
}
}
}
private static class CandleBlockColor implements IBlockColor {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
TileCandle tileCandle = TileUtil.getTile(worldIn, pos, TileCandle.class);
if (tileCandle != null) {
return tileCandle.getColour();
}
return 0xffffff;
}
// TODO: remove unused bee entity model completely
}
}
@@ -26,14 +26,14 @@ public class VillageHandlerArboriculture /*implements IVillageTradeHandler*/ {
ITree randomTree = TreeManager.treeRoot.getTree(villager.worldObj, randomGenome);
ItemStack randomTreeStack = TreeManager.treeRoot.getMemberStack(randomTree, EnumGermlingType.SAPLING.ordinal());
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 8), randomTreeStack));
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 2), PluginArboriculture.items.grafterProven.getItemStack()));
recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, 8), randomTreeStack));
recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, 2), PluginArboriculture.items.grafterProven.getItemStack()));
EnumWoodType randomWoodType = EnumWoodType.getRandom(random);
ItemStack planks = TreeManager.woodItemAccess.getPlanks(randomWoodType, false);
planks.stackSize = 32;
recipeList.add(new MerchantRecipe(new ItemStack(Items.emerald, 1), planks));
recipeList.add(new MerchantRecipe(new ItemStack(Items.EMERALD, 1), planks));
}*/
}
@@ -10,7 +10,10 @@ import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -31,11 +34,14 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import forestry.api.core.IItemModelRegister;
import forestry.api.core.IModelManager;
import forestry.api.core.Tabs;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.blocks.property.PropertyTreeType;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
public abstract class BlockDecorativeLeaves extends Block implements IShearable, IItemModelRegister {
public abstract class BlockDecorativeLeaves extends Block implements IShearable, IItemModelRegister, IBlockColor {
private static final int VARIANTS_PER_BLOCK = 16;
private static final int VARIANTS_META_MASK = VARIANTS_PER_BLOCK - 1;
@@ -194,4 +200,19 @@ public abstract class BlockDecorativeLeaves extends Block implements IShearable,
return 5;
}
}
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
TileLeaves leaves = TileUtil.getTile(worldIn, pos, TileLeaves.class);
if (leaves == null) {
return PluginArboriculture.proxy.getFoliageColorBasic();
}
if (tintIndex == 0) {
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
return leaves.getFoliageColour(thePlayer);
} else {
return leaves.getFruitColour();
}
}
}
@@ -23,7 +23,10 @@ import net.minecraft.block.ITileEntityProvider;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
@@ -72,7 +75,7 @@ import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.ItemStackUtil;
public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvider, IGrowable, IItemModelRegister {
public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvider, IGrowable, IItemModelRegister, IBlockColor {
public BlockForestryLeaves() {
setCreativeTab(Tabs.tabArboriculture);
@@ -340,4 +343,19 @@ public class BlockForestryLeaves extends BlockLeaves implements ITileEntityProvi
leafTile.addRipeness(0.5f);
}
}
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
TileLeaves leaves = TileUtil.getTile(worldIn, pos, TileLeaves.class);
if (leaves == null) {
return PluginArboriculture.proxy.getFoliageColorBasic();
}
if (tintIndex == 0) {
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
return leaves.getFoliageColour(thePlayer);
} else {
return leaves.getFruitColour();
}
}
}
@@ -15,7 +15,6 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.PlayerNotFoundException;
import net.minecraft.entity.player.EntityPlayer;
@@ -41,38 +40,29 @@ public final class CommandTreeSpawn extends SubCommand {
}
@Override
public final void processSubCommand(ICommandSender sender, String[] arguments) throws PlayerNotFoundException, SpeciesNotFoundException, TemplateNotFoundException {
if (arguments.length < 1 || arguments.length > 2) {
public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws PlayerNotFoundException, SpeciesNotFoundException, TemplateNotFoundException {
if (args.length < 1 || args.length > 2) {
printHelp(sender);
return;
}
EntityPlayer player;
String treeName;
try {
player = CommandBase.getPlayer((MinecraftServer) sender, (ICommandSender) arguments[arguments.length - 1], null);
String[] argumentsWithoutPlayer = new String[arguments.length - 1];
System.arraycopy(arguments, 0, argumentsWithoutPlayer, 0, arguments.length - 1);
treeName = StringUtils.join(argumentsWithoutPlayer, " ");
} catch (PlayerNotFoundException e) {
player = CommandBase.getPlayer((MinecraftServer) sender, (ICommandSender) sender.getName(), null);
treeName = StringUtils.join(arguments, " ");
}
if (sender instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) sender;
String treeName = StringUtils.join(args, " ");
boolean success = treeSpawner.spawn(sender, treeName, player);
if (!success) {
printHelp(sender);
boolean success = treeSpawner.spawn(sender, treeName, player);
if (!success) {
printHelp(sender);
}
}
}
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] parameters, BlockPos pos) {
if (parameters.length == 1) {
List<String> tabCompletion = CommandHelpers.getListOfStringsMatchingLastWord(parameters, getSpecies());
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) {
if (args.length == 1) {
List<String> tabCompletion = CommandHelpers.getListOfStringsMatchingLastWord(args, getSpecies());
tabCompletion.add("help");
return tabCompletion;
} else if (parameters.length == 2) {
return CommandHelpers.getListOfStringsMatchingLastWord(parameters, CommandHelpers.getPlayers());
}
return null;
}
@@ -12,6 +12,7 @@ package forestry.arboriculture.genetics;
import java.util.EnumSet;
import net.minecraft.init.Biomes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@@ -25,10 +26,10 @@ public class GrowthProviderTropical extends GrowthProvider {
@Override
public EnumGrowthConditions getGrowthConditions(ITreeGenome genome, World world, BlockPos pos) {
EnumGrowthConditions light = getConditionFromLight(world, pos);
EnumGrowthConditions moisture = getConditionsFromRainfall(world, pos, BiomeGenBase.jungle.rainfall, 2.0f);
EnumGrowthConditions moisture = getConditionsFromRainfall(world, pos, Biomes.JUNGLE.getRainfall(), 2.0f);
float jungleTemperature = BiomeGenBase.jungle.getFloatTemperature(pos);
float desertTemperature = BiomeGenBase.desert.getFloatTemperature(pos);
float jungleTemperature = Biomes.JUNGLE.getFloatTemperature(pos);
float desertTemperature = Biomes.DESERT.getFloatTemperature(pos);
EnumGrowthConditions temperature = getConditionsFromTemperature(world, pos, jungleTemperature, desertTemperature - 0.1f);
EnumSet<EnumGrowthConditions> conditions = EnumSet.of(light, moisture, temperature);
@@ -1,6 +1,7 @@
package forestry.arboriculture.items;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.item.ItemStack;
import forestry.api.arboriculture.IFruitProvider;
@@ -12,7 +13,7 @@ import forestry.core.items.ItemBlockForestry;
import forestry.core.utils.ColourUtil;
import forestry.core.utils.Translator;
public class ItemBlockDecorativeLeaves extends ItemBlockForestry<BlockDecorativeLeaves> {
public class ItemBlockDecorativeLeaves extends ItemBlockForestry<BlockDecorativeLeaves> implements IItemColor {
public ItemBlockDecorativeLeaves(Block block) {
super(block);
}
@@ -31,7 +32,7 @@ public class ItemBlockDecorativeLeaves extends ItemBlockForestry<BlockDecorative
}
@Override
public int getColorFromItemStack(ItemStack itemStack, int renderPass) {
public int getColorFromItemstack(ItemStack itemStack, int renderPass) {
int meta = itemStack.getMetadata();
BlockDecorativeLeaves block = getBlock();
TreeDefinition treeDefinition = block.getTreeType(meta);
@@ -12,6 +12,7 @@ package forestry.arboriculture.items;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
@@ -25,7 +26,7 @@ import forestry.core.items.ItemBlockForestry;
import forestry.core.proxy.Proxies;
import forestry.core.utils.Translator;
public class ItemBlockLeaves extends ItemBlockForestry<BlockForestryLeaves> {
public class ItemBlockLeaves extends ItemBlockForestry<BlockForestryLeaves> implements IItemColor {
public ItemBlockLeaves(Block block) {
super(block);
@@ -58,7 +59,7 @@ public class ItemBlockLeaves extends ItemBlockForestry<BlockForestryLeaves> {
}
@Override
public int getColorFromItemStack(ItemStack itemStack, int renderPass) {
public int getColorFromItemstack(ItemStack itemStack, int renderPass) {
if (!itemStack.hasTagCompound()) {
return PluginArboriculture.proxy.getFoliageColorBasic();
}
@@ -12,20 +12,17 @@ package forestry.arboriculture.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -56,7 +53,7 @@ import forestry.core.utils.BlockUtil;
import forestry.core.utils.GeneticsUtil;
import forestry.core.utils.Translator;
public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
public class ItemGermlingGE extends ItemGE implements IVariableFermentable, IItemColor {
private final EnumGermlingType type;
@@ -115,8 +112,9 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
}
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
public int getColorFromItemstack(ItemStack itemstack, int renderPass) {
return getSpeciesOrDefault(itemstack).getGermlingColour(type, renderPass);
}
@@ -10,33 +10,15 @@
******************************************************************************/
package forestry.arboriculture.proxy;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess;
import forestry.api.arboriculture.IFruitProvider;
import forestry.api.arboriculture.ITreeGenome;
import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.blocks.BlockDecorativeLeaves;
import forestry.arboriculture.blocks.property.PropertyTreeType;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.items.ItemGermlingGE;
import forestry.arboriculture.models.ModelDecorativeLeaves;
import forestry.arboriculture.models.ModelLeaves;
import forestry.arboriculture.tiles.TileLeaves;
import forestry.core.models.BlockModelIndex;
import forestry.core.proxy.Proxies;
import forestry.core.tiles.TileUtil;
@SuppressWarnings("unused")
public class ProxyArboricultureClient extends ProxyArboriculture {
@@ -56,18 +38,6 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
BlockModelIndex blockModelIndex = new BlockModelIndex(blockModelLocation, itemModeLocation, new ModelDecorativeLeaves(), leaves);
Proxies.render.registerBlockModel(blockModelIndex);
}
Minecraft minecraft = Minecraft.getMinecraft();
BlockColors blockColors = minecraft.getBlockColors();
ItemColors itemColors = minecraft.getItemColors();
itemColors.registerItemColorHandler(new SaplingItemColor(), PluginArboriculture.items.sapling);
blockColors.registerBlockColorHandler(new LeavesBlockColor(), PluginArboriculture.blocks.leaves);
for (BlockDecorativeLeaves leaves : PluginArboriculture.blocks.leavesDecorative) {
blockColors.registerBlockColorHandler(new DecorativeLeavesBlockColor(leaves.getVariant()), leaves);
}
}
@Override
@@ -84,57 +54,4 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
public int getFoliageColorPine() {
return ColorizerFoliage.getFoliageColorPine();
}
private static class LeavesBlockColor implements IBlockColor {
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
TileLeaves leaves = TileUtil.getTile(worldIn, pos, TileLeaves.class);
if (leaves == null) {
return PluginArboriculture.proxy.getFoliageColorBasic();
}
if (tintIndex == 0) {
EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
return leaves.getFoliageColour(thePlayer);
} else {
return leaves.getFruitColour();
}
}
}
private static class DecorativeLeavesBlockColor implements IBlockColor {
private final PropertyTreeType variant;
public DecorativeLeavesBlockColor(PropertyTreeType variant) {
this.variant = variant;
}
@Override
public int colorMultiplier(IBlockState state, IBlockAccess worldIn, BlockPos pos, int tintIndex) {
TreeDefinition treeDefinition = state.getValue(variant);
if (treeDefinition == null) {
return PluginArboriculture.proxy.getFoliageColorBasic();
}
ITreeGenome genome = treeDefinition.getGenome();
if (tintIndex == 0) {
return genome.getPrimary().getLeafSpriteProvider().getColor(false);
} else {
IFruitProvider fruitProvider = genome.getFruitProvider();
return fruitProvider.getDecorativeColor();
}
}
}
private static class SaplingItemColor implements IItemColor {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
Item item = stack.getItem();
if (item instanceof ItemGermlingGE) {
return ((ItemGermlingGE) item).getColorFromItemStack(stack, tintIndex);
}
return 0xffffff;
}
}
}
@@ -17,7 +17,7 @@ import forestry.core.worldgen.BlockType;
public class BlockTypeVanillaStairs extends BlockType {
public BlockTypeVanillaStairs(int meta) {
super(Blocks.oak_stairs, meta);
super(Blocks.OAK_STAIRS, meta);
}
@Override
@@ -27,7 +27,7 @@ public class ClimateManager implements IClimateManager{
if(state != null){
return state.getExactTemperature();
}
return biome.temperature;
return biome.getTemperature();
}
@Override
@@ -38,7 +38,7 @@ public class ClimateManager implements IClimateManager{
if(state != null){
return state.getExactHumidity();
}
return biome.rainfall;
return biome.getRainfall();
}
}
@@ -166,7 +166,7 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
if (block.getMaterial() == Material.air) {
if (isNeighborFlammable(world, x, y, z)) {
world.setBlockState(new BlockPos(x, y, z), Blocks.fire.getDefaultState());
world.setBlockState(new BlockPos(x, y, z), Blocks.FIRE.getDefaultState());
return;
}
} else if (block.getMaterial().blocksMovement()) {
@@ -183,7 +183,7 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
z = startZ + rand.nextInt(3) - 1;
if (world.isAirBlock(new BlockPos(pos.getX(), y + 1, z)) && isFlammable(world, new BlockPos(x, y, z))) {
world.setBlockState(new BlockPos(pos.getX(), y + 1, z), Blocks.fire.getDefaultState());
world.setBlockState(new BlockPos(pos.getX(), y + 1, z), Blocks.FIRE.getDefaultState());
}
}
}
@@ -195,7 +195,7 @@ public class BlockForestryFluid extends BlockFluidClassic implements IItemModelR
// Explosion size is determined by flammability, up to size 4.
float explosionSize = 4F * flammability / 300F;
if (explosionSize > 1.0 && isNearFire(world, pos.getX(), pos.getY(), pos.getZ())) {
world.setBlockState(pos, Blocks.fire.getDefaultState());
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
world.newExplosion(null, pos.getX(), pos.getY(), pos.getZ(), explosionSize, true, true);
}
}
@@ -41,7 +41,7 @@ public class LiquidRegistryHelper {
ItemStack empty = null;
if (item.getContainerItem() instanceof ItemBucket) {
empty = new ItemStack(Items.bucket);
empty = new ItemStack(Items.BUCKET);
} else if (item instanceof ItemLiquidContainer) {
ItemLiquidContainer liquidContainer = (ItemLiquidContainer) item;
EnumContainerType containerType = liquidContainer.getType();
@@ -297,7 +297,7 @@ public class ItemResearchNote extends ItemForestry {
}
// @Override
// public int getColorFromItemStack(ItemStack itemstack, int j) {
// public int getColorFromItemstack(ItemStack itemstack, int j) {
// return 0xffe8a5;
// }
}
@@ -73,7 +73,7 @@ public class SlotCrafter extends Slot {
this.amountCrafted = 0;
if (stack.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) {
if (stack.getItem() == Item.getItemFromBlock(Blocks.CRAFTING_TABLE)) {
this.thePlayer.triggerAchievement(AchievementList.buildWorkBench);
}
@@ -81,7 +81,7 @@ public class SlotCrafter extends Slot {
this.thePlayer.triggerAchievement(AchievementList.buildPickaxe);
}
if (stack.getItem() == Item.getItemFromBlock(Blocks.furnace)) {
if (stack.getItem() == Item.getItemFromBlock(Blocks.FURNACE)) {
this.thePlayer.triggerAchievement(AchievementList.buildFurnace);
}
@@ -89,11 +89,11 @@ public class SlotCrafter extends Slot {
this.thePlayer.triggerAchievement(AchievementList.buildHoe);
}
if (stack.getItem() == Items.bread) {
if (stack.getItem() == Items.BREAD) {
this.thePlayer.triggerAchievement(AchievementList.makeBread);
}
if (stack.getItem() == Items.cake) {
if (stack.getItem() == Items.CAKE) {
this.thePlayer.triggerAchievement(AchievementList.bakeCake);
}
@@ -105,15 +105,15 @@ public class SlotCrafter extends Slot {
this.thePlayer.triggerAchievement(AchievementList.buildSword);
}
if (stack.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) {
if (stack.getItem() == Item.getItemFromBlock(Blocks.ENCHANTING_TABLE)) {
this.thePlayer.triggerAchievement(AchievementList.enchantments);
}
if (stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) {
if (stack.getItem() == Item.getItemFromBlock(Blocks.BOOKSHELF)) {
this.thePlayer.triggerAchievement(AchievementList.bookcase);
}
if (stack.getItem() == Items.golden_apple && stack.getMetadata() == 1) {
if (stack.getItem() == Items.GOLDEN_APPLE && stack.getMetadata() == 1) {
this.thePlayer.triggerAchievement(AchievementList.overpowered);
}
}
@@ -89,11 +89,11 @@ public class ItemCrated extends ItemForestry {
// TODO: crate rendering
// @Override
// public int getColorFromItemStack(ItemStack stack, int renderPass) {
// public int getColorFromItemstack(ItemStack stack, int renderPass) {
// if (getContained() == null || renderPass == 100) {
// return super.getColorFromItemStack(stack, renderPass);
// return super.getColorFromItemstack(stack, renderPass);
// }
// return getContained().getItem().getColorFromItemStack(getContained(), renderPass);
// return getContained().getItem().getColorFromItemstack(getContained(), renderPass);
// }
}
@@ -141,7 +141,7 @@ public class ItemLiquidContainer extends ItemForestry {
// TODO: liquid container coloring
// @Override
// public int getColorFromItemStack(ItemStack itemstack, int j) {
// public int getColorFromItemstack(ItemStack itemstack, int j) {
// if (j > 0) {
// return color;
// } else {
@@ -14,10 +14,15 @@ import javax.annotation.Nonnull;
import java.util.ArrayList;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.registry.IRegistry;
@@ -92,8 +97,16 @@ public class ModelManager implements IModelManager {
return new ModelResourceLocation(modID + ":" + identifier, "inventory");
}
/**
* TODO: keep lists of each type of block and item to be registered.
* Iterating over GameData.getBlockRegistry() and GameData.getItemRegistry() will be VERY slow on a big pack.
*/
@SideOnly(Side.CLIENT)
public static void registerModels() {
Minecraft minecraft = Minecraft.getMinecraft();
BlockColors blockColors = minecraft.getBlockColors();
ItemColors itemColors = minecraft.getItemColors();
for (Block block : GameData.getBlockRegistry()) {
if (block instanceof IItemModelRegister) {
((IItemModelRegister) block).registerModel(Item.getItemFromBlock(block), getInstance());
@@ -101,11 +114,17 @@ public class ModelManager implements IModelManager {
if (block instanceof IStateMapperRegister) {
((IStateMapperRegister) block).registerStateMapper();
}
if (block instanceof IBlockColor) {
blockColors.registerBlockColorHandler((IBlockColor) block, block);
}
}
for (Item item : GameData.getItemRegistry()) {
if (item instanceof IItemModelRegister) {
((IItemModelRegister) item).registerModel(item, getInstance());
}
if (item instanceof IItemColor) {
itemColors.registerItemColorHandler((IItemColor) item, item);
}
}
}
@@ -141,13 +141,13 @@ public class GeneticsUtil {
int meta = block.getMetaFromState(blockState);
if (Blocks.leaves == block || Blocks.leaves2 == block) {
if (Blocks.LEAVES == block || Blocks.LEAVES2 == block) {
if ((meta & 4) != 0) {
// no-decay vanilla leaves. http://minecraft.gamepedia.com/Data_values#Leaves
// Treat them as decorative and don't pollinate.
return null;
}
if (block == Blocks.leaves2) {
if (block == Blocks.LEAVES2) {
meta = meta + 4; //Dark Oak and Acacia are their own leaf block, but added on the end of sapling
}
block = Blocks.SAPLING;
@@ -17,7 +17,7 @@ import net.minecraft.world.World;
public class BlockTypeVoid extends BlockType {
public BlockTypeVoid() {
super(Blocks.air, 0);
super(Blocks.AIR, 0);
}
@Override
@@ -66,7 +66,7 @@ public class PluginEnergy extends BlankForestryPlugin {
'#', "ingotCopper",
'X', "blockGlass",
'Y', "gearCopper",
'V', Blocks.piston);
'V', Blocks.PISTON);
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.BIOGAS),
"###",
@@ -75,7 +75,7 @@ public class PluginEnergy extends BlankForestryPlugin {
'#', "ingotBronze",
'X', "blockGlass",
'Y', "gearBronze",
'V', Blocks.piston);
'V', Blocks.PISTON);
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.CLOCKWORK),
@@ -84,9 +84,9 @@ public class PluginEnergy extends BlankForestryPlugin {
"ZVY",
'#', "plankWood",
'X', "blockGlass",
'Y', Items.clock,
'Y', Items.CLOCK,
'Z', "gearCopper",
'V', Blocks.piston);
'V', Blocks.PISTON);
}
}
}
@@ -108,34 +108,34 @@ public class PluginFarming extends BlankForestryPlugin {
}
Farmables.farmables.put("farmOrchard", new ArrayList<>());
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.wheat, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.potatoes, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.carrots, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.WHEAT, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.POTATOES, 7));
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.CARROTS, 7));
Farmables.farmables.put("farmShroom", new ArrayList<>());
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.BROWN_MUSHROOM, 0));
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.RED_MUSHROOM, 0));
Farmables.farmables.put("farmWheat", new ArrayList<>());
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.wheat, 7));
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.WHEAT, 7));
Farmables.farmables.put("farmGourd", new ArrayList<>());
Farmables.farmables.get("farmGourd").add(
new FarmableGourd(new ItemStack(Items.PUMPKIN_SEEDS), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin)));
Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.MELON_SEEDS), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block)));
new FarmableGourd(new ItemStack(Items.PUMPKIN_SEEDS), new ItemStack(Blocks.PUMPKIN_STEM), new ItemStack(Blocks.PUMPKIN)));
Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.MELON_SEEDS), new ItemStack(Blocks.MELON_STEM), new ItemStack(Blocks.MELON_BLOCK)));
Farmables.farmables.put("farmInfernal", new ArrayList<>());
Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3));
Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.NETHER_WART), Blocks.NETHER_WART, 3));
Farmables.farmables.put("farmPoales", new ArrayList<>());
Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3, 0));
Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.REEDS, 3, 0));
Farmables.farmables.put("farmSucculentes", new ArrayList<>());
Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.CACTUS, 3, 0));
Farmables.farmables.put("farmVegetables", new ArrayList<>());
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.POTATO), Blocks.potatoes, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.CARROT), Blocks.carrots, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.POTATO), Blocks.POTATOES, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.CARROT), Blocks.CARROTS, 7));
proxy.initializeModels();
@@ -318,7 +318,7 @@ public class PluginFarming extends BlankForestryPlugin {
"TDT",
'#', basic,
'T', "gearTin",
'D', Blocks.trapdoor);
'D', Blocks.TRAPDOOR);
RecipeUtil.addRecipe(valve,
" # ",
@@ -31,11 +31,11 @@ import forestry.core.utils.vect.Vect;
import forestry.core.utils.vect.VectUtil;
public abstract class FarmLogicCrops extends FarmLogicWatered {
private static final ItemStack farmland = new ItemStack(Blocks.farmland, 1, OreDictionary.WILDCARD_VALUE);
private static final ItemStack farmland = new ItemStack(Blocks.FARMLAND, 1, OreDictionary.WILDCARD_VALUE);
private final Iterable<IFarmable> seeds;
protected FarmLogicCrops(IFarmHousing housing, Iterable<IFarmable> seeds) {
super(housing, new ItemStack(Blocks.DIRT), new ItemStack(Blocks.farmland));
super(housing, new ItemStack(Blocks.DIRT), new ItemStack(Blocks.FARMLAND));
this.seeds = seeds;
}
@@ -42,7 +42,7 @@ public class FarmLogicGourd extends FarmLogic {
@Override
@SideOnly(Side.CLIENT)
public Item getItem() {
return Items.melon;
return Items.MELON;
}
@Override
@@ -35,7 +35,7 @@ import forestry.core.utils.vect.VectUtil;
public class FarmLogicInfernal extends FarmLogicHomogeneous {
public FarmLogicInfernal(IFarmHousing housing) {
super(housing, new ItemStack(Blocks.soul_sand), new ItemStack(Blocks.soul_sand), Farmables.farmables.get("farmInfernal"));
super(housing, new ItemStack(Blocks.SOUL_SAND), new ItemStack(Blocks.SOUL_SAND), Farmables.farmables.get("farmInfernal"));
}
@Override
@@ -46,7 +46,7 @@ public class FarmLogicInfernal extends FarmLogicHomogeneous {
@Override
@SideOnly(Side.CLIENT)
public Item getItem() {
return Items.nether_wart;
return Items.NETHER_WART;
}
@Override
@@ -52,7 +52,7 @@ public class FarmLogicOrchard extends FarmLogic {
ImmutableList.Builder<Block> traversalBlocksBuilder = ImmutableList.builder();
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.AGRICRAFT) || ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) {
// traversalBlocksBuilder.add(Blocks.farmland);
// traversalBlocksBuilder.add(Blocks.FARMLAND);
// }
// if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.INDUSTRIALCRAFT)) {
// traversalBlocksBuilder.add(Blocks.DIRT);
+1 -1
View File
@@ -48,7 +48,7 @@ public class PluginFood extends BlankForestryPlugin {
@Override
public void preInit() {
LiquidRegistryHelper.registerLiquidContainer(Fluids.SHORT_MEAD, Constants.BUCKET_VOLUME, items.beverage.get(EnumBeverage.MEAD_SHORT, 1), new ItemStack(Items.glass_bottle));
LiquidRegistryHelper.registerLiquidContainer(Fluids.SHORT_MEAD, Constants.BUCKET_VOLUME, items.beverage.get(EnumBeverage.MEAD_SHORT, 1), new ItemStack(Items.GLASS_BOTTLE));
ItemRegistryApiculture beeItems = PluginApiculture.items;
if (beeItems != null) {
@@ -91,7 +91,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
"TXT",
"#H#",
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
'H', Blocks.trapdoor,
'H', Blocks.TRAPDOOR,
'#', "gearTin",
'T', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1));
@@ -100,7 +100,7 @@ public class PluginGreenhouse extends BlankForestryPlugin {
"#H#",
"TXT",
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
'H', Blocks.trapdoor,
'H', Blocks.TRAPDOOR,
'#', "gearTin",
'T', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1));
@@ -137,7 +137,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
@Override
public float getExactHumidity() {
return getBiome().rainfall + tempChange;
return getBiome().getRainfall() + tempChange;
}
@Override
@@ -153,7 +153,7 @@ public class GreenhouseController extends RectangularMultiblockControllerBase im
@Override
public void addHumidityChange(float change, float boundaryDown, float boundaryUp) {
float humidity = getBiome().rainfall;
float humidity = getBiome().getRainfall();
humidChange += change;
humidChange = Math.max(boundaryDown - humidity, humidChange);
@@ -27,6 +27,7 @@ import java.util.Set;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.common.config.Property;
@@ -150,12 +151,12 @@ public class PluginLepidopterology extends BlankForestryPlugin {
File configFile = new File(Forestry.instance.getConfigFolder(), CONFIG_CATEGORY + ".cfg");
loadConfig(configFile);
}
@Override
public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
if(generateCocoons){
if (generateCocoonsAmount > 0.0) {
CocoonDecorator.decorateCocoons(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
CocoonDecorator.decorateCocoons(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
}
}
}
@@ -201,7 +202,7 @@ public class PluginLepidopterology extends BlankForestryPlugin {
String[] defaultRaritys = butterflyRarity.toArray(new String[butterflyRarity.size()]);
Property rarityConf = config.get("butterfly.alleles", "rarity", defaultRaritys);
rarityConf.comment = Translator.translateToLocal("for.config.butterfly.alleles.rarity");
rarityConf.setComment(Translator.translateToLocal("for.config.butterfly.alleles.rarity"));
String[] configRaritys = rarityConf.getStringList();
for(String rarity : configRaritys){
@@ -240,7 +241,7 @@ public class PluginLepidopterology extends BlankForestryPlugin {
String[] defaultLoot = lootList.toArray(new String[lootList.size()]);
Property lootConf = config.get("butterfly.cocoons.alleles.loot", cocoon.getUID(), defaultLoot);
lootConf.comment = Translator.translateToLocal("for.config.butterfly.alleles.loot");
lootConf.setComment(Translator.translateToLocal("for.config.butterfly.alleles.loot"));
String[] configLoot = lootConf.getStringList();
for(String loot : configLoot){
@@ -134,7 +134,7 @@ public class AlleleButterflySpecies extends AlleleSpecies implements IAlleleButt
return 0f;
}
if (itemstack.getItem() == Items.glass_bottle) {
if (itemstack.getItem() == Items.GLASS_BOTTLE) {
return 0.9f;
}
@@ -21,7 +21,7 @@ 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.chunk.IChunkProvider;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
@@ -40,7 +40,7 @@ public abstract class CocoonDecorator {
private static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_COCOONS", new Class[0], new Object[0]);
public static void decorateCocoons(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
public static void decorateCocoons(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
if (!TerrainGen.populate(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated, EVENT_TYPE)) {
return;
}
@@ -130,30 +130,36 @@ public abstract class CocoonDecorator {
}
cocoonBlock.onBlockAdded(world, pos, state);
world.markBlockForUpdate(pos);
world.markBlockRangeForRenderUpdate(pos, pos);
return true;
}
private static int getYForCocoon(World world, int x, int z) {
int y = world.getHeight(new BlockPos(x, 0, z)).getY() - 1;
if (!world.getBlockState(new BlockPos(x, y, z)).getBlock().isLeaves(world, new BlockPos(x, y, z))) {
BlockPos pos = new BlockPos(x, y, z);
IBlockState blockState = world.getBlockState(pos);
if (!blockState.getBlock().isLeaves(blockState, world, pos)) {
return -1;
}
do {
y--;
} while (world.getBlockState(new BlockPos(x, y, z)).getBlock().isLeaves(world, new BlockPos(x, y, z)));
pos.down();
blockState = world.getBlockState(pos);
} while (blockState.getBlock().isLeaves(blockState, world, pos));
return y;
}
public static boolean isValidLocation(World world, BlockPos pos) {
Block blockAbove = world.getBlockState(pos.up()).getBlock();
if (!blockAbove.isLeaves(world, pos.up())) {
BlockPos posAbove = pos.up();
IBlockState blockStateAbove = world.getBlockState(posAbove);
Block blockAbove = blockStateAbove.getBlock();
if (!blockAbove.isLeaves(blockStateAbove, world, posAbove)) {
return false;
}
return BlockUtil.canReplace(world, pos.down());
BlockPos posBelow = pos.down();
IBlockState blockStateBelow = world.getBlockState(posBelow);
return BlockUtil.canReplace(blockStateBelow, world, posBelow);
}
}
+2 -2
View File
@@ -98,8 +98,8 @@ public class PluginMail extends BlankForestryPlugin {
stampGlue = beeItems.honeyDrop;
letterGlue = beeItems.propolis.getWildcard();
} else {
stampGlue = Items.slime_ball;
letterGlue = Items.slime_ball;
stampGlue = Items.SLIME_BALL;
letterGlue = Items.SLIME_BALL;
}
RecipeUtil.addShapelessRecipe(items.letters.getItemStack(), Items.PAPER, letterGlue);
@@ -26,8 +26,8 @@ public enum EnumStampDefinition implements ItemOverlay.IOverlayInfo {
P_10("10n", EnumPostage.P_10, "ingotGold", new Color(0x7bd1b8), new Color(0xffffff)),
P_20("20n", EnumPostage.P_20, "gemDiamond", new Color(0xff9031), new Color(0xfff7dd)),
P_50("50n", EnumPostage.P_50, "gemEmerald", new Color(0x6431d7), new Color(0xfff7dd)),
P_100("100n", EnumPostage.P_100, Items.nether_star, new Color(0xd731ba), new Color(0xfff7dd)),
// P_200("200n", EnumPostage.P_200, Items.nether_star, new Color(0xcd9831), new Color(0xfff7dd)),
P_100("100n", EnumPostage.P_100, Items.NETHER_STAR, new Color(0xd731ba), new Color(0xfff7dd)),
// P_200("200n", EnumPostage.P_200, Items.NETHER_STAR, new Color(0xcd9831), new Color(0xfff7dd)),
;
public static final EnumStampDefinition[] VALUES = values();
@@ -102,7 +102,7 @@ public abstract class BlankForestryPlugin implements IForestryPlugin {
}
@Override
public void populateChunk(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ) {
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
}
@Override
@@ -10,7 +10,6 @@ import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkGenerator;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.common.event.FMLInterModComms;
@@ -55,7 +54,7 @@ public interface IForestryPlugin {
boolean processIMCMessage(FMLInterModComms.IMCMessage message);
void populateChunk(IChunkGenerator chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ);
void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated);
void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ);
@@ -309,7 +309,7 @@ public class PluginIC2 extends BlankForestryPlugin {
'#', "ingotTin",
'X', "blockGlass",
'Y', "gearTin",
'V', Blocks.piston);
'V', Blocks.PISTON);
}
}
}
@@ -53,7 +53,6 @@ import forestry.core.config.Constants;
import forestry.core.config.LocalizedConfiguration;
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemCrated;
import forestry.core.models.ModelCrate;
import forestry.core.recipes.RecipeUtil;
import forestry.core.utils.IMCUtil;
import forestry.core.utils.ItemStackUtil;
@@ -199,8 +198,8 @@ public class PluginStorage extends BlankForestryPlugin {
backpackItemDefaults.get(BackpackManager.MINER_UID).addAll(getItemStrings(Arrays.asList(
new ItemStack(Blocks.OBSIDIAN),
new ItemStack(Blocks.coal_ore),
new ItemStack(Items.coal),
new ItemStack(Blocks.COAL_ORE),
new ItemStack(Items.COAL),
PluginCore.items.bronzePickaxe.getItemStack(),
PluginCore.items.kitPickaxe.getItemStack(),
PluginCore.items.brokenBronzePickaxe.getItemStack()
@@ -208,12 +207,12 @@ public class PluginStorage extends BlankForestryPlugin {
backpackItemDefaults.get(BackpackManager.DIGGER_UID).addAll(getItemStrings(Arrays.asList(
new ItemStack(Blocks.DIRT, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.gravel),
new ItemStack(Items.flint),
new ItemStack(Blocks.netherrack),
new ItemStack(Blocks.GRAVEL),
new ItemStack(Items.FLINT),
new ItemStack(Blocks.NETHERRACK),
new ItemStack(Blocks.SANDSTONE, 1, 0),
new ItemStack(Items.clay_ball),
new ItemStack(Blocks.soul_sand),
new ItemStack(Items.CLAY_BALL),
new ItemStack(Blocks.SOUL_SAND),
PluginCore.items.bronzeShovel.getItemStack(),
PluginCore.items.kitShovel.getItemStack(),
PluginCore.items.brokenBronzeShovel.getItemStack()
@@ -222,20 +221,20 @@ public class PluginStorage extends BlankForestryPlugin {
backpackItemDefaults.get(BackpackManager.FORESTER_UID).addAll(getItemStrings(Arrays.asList(
new ItemStack(Blocks.RED_MUSHROOM),
new ItemStack(Blocks.BROWN_MUSHROOM),
new ItemStack(Blocks.red_flower),
new ItemStack(Blocks.yellow_flower),
new ItemStack(Blocks.RED_FLOWER),
new ItemStack(Blocks.YELLOW_FLOWER),
new ItemStack(Blocks.CACTUS),
new ItemStack(Blocks.tallgrass, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.pumpkin),
new ItemStack(Blocks.melon_block),
new ItemStack(Items.golden_apple),
new ItemStack(Items.nether_wart),
new ItemStack(Blocks.TALLGRASS, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.PUMPKIN),
new ItemStack(Blocks.MELON_BLOCK),
new ItemStack(Items.GOLDEN_APPLE),
new ItemStack(Items.NETHER_WART),
new ItemStack(Items.PUMPKIN_SEEDS),
new ItemStack(Items.MELON_SEEDS)
)));
backpackItemDefaults.get(BackpackManager.HUNTER_UID).addAll(getItemStrings(Arrays.asList(
new ItemStack(Items.feather),
new ItemStack(Items.FEATHER),
new ItemStack(Items.GUNPOWDER),
new ItemStack(Items.BLAZE_POWDER),
new ItemStack(Items.BLAZE_ROD),
@@ -243,75 +242,75 @@ public class PluginStorage extends BlankForestryPlugin {
new ItemStack(Items.STRING),
new ItemStack(Items.ROTTEN_FLESH),
new ItemStack(Items.GHAST_TEAR),
new ItemStack(Items.gold_nugget),
new ItemStack(Items.GOLD_NUGGET),
new ItemStack(Items.ARROW),
new ItemStack(Items.porkchop),
new ItemStack(Items.cooked_porkchop),
new ItemStack(Items.beef),
new ItemStack(Items.cooked_beef),
new ItemStack(Items.chicken),
new ItemStack(Items.cooked_chicken),
new ItemStack(Items.leather),
new ItemStack(Items.egg),
new ItemStack(Items.PORKCHOP),
new ItemStack(Items.COOKED_PORKCHOP),
new ItemStack(Items.BEEF),
new ItemStack(Items.COOKED_BEEF),
new ItemStack(Items.CHICKEN),
new ItemStack(Items.COOKED_CHICKEN),
new ItemStack(Items.LEATHER),
new ItemStack(Items.EGG),
new ItemStack(Items.ENDER_PEARL),
new ItemStack(Items.SPIDER_EYE),
new ItemStack(Items.fermented_spider_eye),
new ItemStack(Items.slime_ball),
new ItemStack(Items.FERMENTED_SPIDER_EYE),
new ItemStack(Items.SLIME_BALL),
new ItemStack(Items.DYE, 1, 0),
new ItemStack(Blocks.hay_block),
new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.HAY_BLOCK),
new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Items.ENDER_EYE),
new ItemStack(Items.magma_cream),
new ItemStack(Items.speckled_melon),
new ItemStack(Items.fish),
new ItemStack(Items.cooked_fish),
new ItemStack(Items.lead),
new ItemStack(Items.fishing_rod),
new ItemStack(Items.name_tag),
new ItemStack(Items.saddle),
new ItemStack(Items.diamond_horse_armor),
new ItemStack(Items.golden_horse_armor),
new ItemStack(Items.iron_horse_armor)
new ItemStack(Items.MAGMA_CREAM),
new ItemStack(Items.SPECKLED_MELON),
new ItemStack(Items.FISH),
new ItemStack(Items.COOKED_FISH),
new ItemStack(Items.LEAD),
new ItemStack(Items.FISHING_ROD),
new ItemStack(Items.NAME_TAG),
new ItemStack(Items.SADDLE),
new ItemStack(Items.DIAMOND_HORSE_ARMOR),
new ItemStack(Items.GOLDEN_HORSE_ARMOR),
new ItemStack(Items.IRON_HORSE_ARMOR)
)));
backpackItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
new ItemStack(Blocks.redstone_torch),
new ItemStack(Blocks.redstone_lamp),
new ItemStack(Blocks.REDSTONE_TORCH),
new ItemStack(Blocks.REDSTONE_LAMP),
new ItemStack(Blocks.STONEBRICK, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.SANDSTONE, 1, 1),
new ItemStack(Blocks.SANDSTONE, 1, 2),
new ItemStack(Blocks.BRICK_BLOCK),
new ItemStack(Blocks.clay),
new ItemStack(Blocks.hardened_clay, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.stained_hardened_clay, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.packed_ice),
new ItemStack(Blocks.CLAY),
new ItemStack(Blocks.HARDENED_CLAY, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.STAINED_HARDENED_CLAY, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.PACKED_ICE),
new ItemStack(Blocks.NETHER_BRICK),
new ItemStack(Blocks.crafting_table),
new ItemStack(Blocks.furnace),
new ItemStack(Blocks.lever),
new ItemStack(Blocks.dispenser),
new ItemStack(Blocks.dropper),
new ItemStack(Blocks.ladder),
new ItemStack(Blocks.iron_bars),
new ItemStack(Blocks.CRAFTING_TABLE),
new ItemStack(Blocks.FURNACE),
new ItemStack(Blocks.LEVER),
new ItemStack(Blocks.DISPENSER),
new ItemStack(Blocks.DROPPER),
new ItemStack(Blocks.LADDER),
new ItemStack(Blocks.IRON_BARS),
new ItemStack(Blocks.QUARTZ_BLOCK, 1, OreDictionary.WILDCARD_VALUE),
new ItemStack(Blocks.COBBLESTONE_wall),
new ItemStack(Blocks.stone_button),
new ItemStack(Blocks.wooden_button),
new ItemStack(Blocks.stone_slab),
new ItemStack(Blocks.wooden_slab),
new ItemStack(Blocks.trapdoor),
new ItemStack(Blocks.iron_trapdoor),
new ItemStack(Blocks.stone_pressure_plate),
new ItemStack(Blocks.wooden_pressure_plate),
new ItemStack(Items.sign),
new ItemStack(Items.item_frame),
new ItemStack(Items.acacia_door),
new ItemStack(Items.birch_door),
new ItemStack(Items.dark_oak_door),
new ItemStack(Items.iron_door),
new ItemStack(Items.jungle_door),
new ItemStack(Items.oak_door),
new ItemStack(Items.spruce_door)
new ItemStack(Blocks.COBBLESTONE_WALL),
new ItemStack(Blocks.STONE_BUTTON),
new ItemStack(Blocks.WOODEN_BUTTON),
new ItemStack(Blocks.STONE_SLAB),
new ItemStack(Blocks.WOODEN_SLAB),
new ItemStack(Blocks.TRAPDOOR),
new ItemStack(Blocks.IRON_TRAPDOOR),
new ItemStack(Blocks.STONE_PRESSURE_PLATE),
new ItemStack(Blocks.WOODEN_PRESSURE_PLATE),
new ItemStack(Items.SIGN),
new ItemStack(Items.ITEM_FRAME),
new ItemStack(Items.ACACIA_DOOR),
new ItemStack(Items.BIRCH_DOOR),
new ItemStack(Items.DARK_OAK_DOOR),
new ItemStack(Items.IRON_DOOR),
new ItemStack(Items.JUNGLE_DOOR),
new ItemStack(Items.OAK_DOOR),
new ItemStack(Items.SPRUCE_DOOR)
)));
BlockRegistryApiculture beeBlocks = PluginApiculture.blocks;
@@ -343,7 +342,7 @@ public class PluginStorage extends BlankForestryPlugin {
String[] defaultValidItems = defaultItemNames.toArray(new String[defaultItemNames.size()]);
Property backpackConf = config.get("backpacks." + backpackUid, "item.stacks", defaultValidItems);
backpackConf.comment = Translator.translateToLocalFormatted("for.config.backpacks.item.stacks.format", backpackUid);
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.item.stacks.format", backpackUid));
String[] backpackItemList = backpackConf.getStringList();
List<ItemStack> backpackItems = ItemStackUtil.parseItemStackStrings(backpackItemList, OreDictionary.WILDCARD_VALUE);
@@ -357,7 +356,7 @@ public class PluginStorage extends BlankForestryPlugin {
String[] defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
Property backpackConf = config.get("backpacks." + backpackUid, "ore.dict", defaultOreRegexpNames);
backpackConf.comment = Translator.translateToLocalFormatted("for.config.backpacks.ore.dict.format", backpackUid);
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.ore.dict.format", backpackUid));
List<String> oreDictNameList = new ArrayList<>();
for (String name : OreDictionary.getOreNames()) {
@@ -453,9 +452,9 @@ public class PluginStorage extends BlankForestryPlugin {
addBackpackRecipe(items.minerBackpack, "ingotIron");
addBackpackRecipe(items.diggerBackpack, "stone");
addBackpackRecipe(items.foresterBackpack, "logWood");
addBackpackRecipe(items.hunterBackpack, Items.feather);
addBackpackRecipe(items.hunterBackpack, Items.FEATHER);
addBackpackRecipe(items.adventurerBackpack, Items.BONE);
addBackpackRecipe(items.builderBackpack, Items.clay_ball);
addBackpackRecipe(items.builderBackpack, Items.CLAY_BALL);
// / CARPENTER
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
@@ -482,7 +481,7 @@ public class PluginStorage extends BlankForestryPlugin {
"X#X",
"VYV",
"X#X",
'#', Blocks.wool,
'#', Blocks.WOOL,
'X', Items.STRING,
'V', material,
'Y', chest);
@@ -502,6 +501,6 @@ public class PluginStorage extends BlankForestryPlugin {
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onBakeModel(ModelBakeEvent event) {
ModelCrate.initModel(event);
// ModelCrate.initModel(event);
}
}