Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a3a1f7720e | ||
|
|
89cfbfca9c | ||
|
|
e0676030d6 | ||
|
|
0c76e22b8a | ||
|
|
1a8f1751d9 | ||
|
|
b95bb8315f | ||
|
|
2cc2540bdc | ||
|
|
84af238d82 | ||
|
|
89960db2bd | ||
|
|
c5f53bda3e | ||
|
|
2e1b62e58d | ||
|
|
982aefa165 | ||
|
|
2cccf95775 | ||
|
|
1969ed8b09 | ||
|
|
c3fc490fac | ||
|
|
59687329fb | ||
|
|
94f751d78a | ||
|
|
f6feca096f | ||
|
|
649f38efb8 | ||
|
|
e4e221b9fd | ||
|
|
d7f063eec8 | ||
|
|
aa988a3be7 | ||
|
|
18f2a027bc | ||
|
|
7ca34e52d6 | ||
|
|
7f83b5b909 |
No files matched your search
@@ -1,11 +1,11 @@
|
||||
mcversion=1.10.2
|
||||
forgeversion=12.18.0.2005-1.10.0
|
||||
forgeversion=12.18.1.2044
|
||||
mcp_mappings=snapshot_20160525
|
||||
|
||||
tesla_version=1.9.4-1.1.0.24
|
||||
tesla_version=1.10.2-1.2.1.41
|
||||
jei_version=3.7.3.221
|
||||
ic2_version=2.6.5-ex110
|
||||
ic2_version=2.6.15-ex110
|
||||
|
||||
version_major=5
|
||||
version_minor=1
|
||||
version_patch=12
|
||||
version_minor=2
|
||||
version_patch=6
|
||||
@@ -7,6 +7,7 @@ package forestry.api.apiculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -18,7 +19,7 @@ import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.api.genetics.IHousing;
|
||||
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
public interface IBeeHousing extends IHousing, IErrorLogicSource, IClimateProvider {
|
||||
|
||||
/**
|
||||
* Used by BeeManager.beeRoot.createBeeHousingModifier(IBeeHousing housing)
|
||||
@@ -39,10 +40,6 @@ public interface IBeeHousing extends IHousing, IErrorLogicSource {
|
||||
|
||||
IBeekeepingLogic getBeekeepingLogic();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
|
||||
int getBlockLightValue();
|
||||
|
||||
boolean canBlockSeeTheSky();
|
||||
@@ -50,8 +47,6 @@ 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();
|
||||
|
||||
Biome getBiome();
|
||||
|
||||
GameProfile getOwner();
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "4.8.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
|
||||
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|apiculture")
|
||||
package forestry.api.apiculture;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -13,5 +13,7 @@ public interface IClimateManager {
|
||||
float getTemperature(World world, BlockPos pos);
|
||||
|
||||
float getHumidity(World world, BlockPos pos);
|
||||
|
||||
|
||||
IClimateProvider getDefaultClimate(World world, BlockPos pos);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package forestry.api.core;
|
||||
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public interface IClimateProvider {
|
||||
Biome getBiome();
|
||||
|
||||
EnumTemperature getTemperature();
|
||||
|
||||
EnumHumidity getHumidity();
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -38,7 +39,7 @@ public interface IModelBaker {
|
||||
|
||||
void addModel(@Nonnull AxisAlignedBB renderBounds, @Nonnull TextureAtlasSprite texture, int colorIndex);
|
||||
|
||||
void addBakedModel(@Nonnull IBakedModel model);
|
||||
void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model);
|
||||
|
||||
void addFace(@Nonnull EnumFacing facing, @Nonnull TextureAtlasSprite sprite);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.genetics;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -15,7 +16,7 @@ public interface IMutationCondition {
|
||||
* Most will return 1 if the condition is met and 0 otherwise,
|
||||
* but the float offers flexibility for more advanced conditions.
|
||||
*/
|
||||
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1);
|
||||
float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate);
|
||||
|
||||
/**
|
||||
* A localized description of the mutation condition. (i.e. "A temperature of HOT is required.")
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.lepidopterology;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IHousing;
|
||||
import forestry.api.genetics.IIndividual;
|
||||
|
||||
public interface IButterflyNursery extends IHousing {
|
||||
public interface IButterflyNursery extends IHousing, IClimateProvider {
|
||||
|
||||
IButterfly getCaterpillar();
|
||||
|
||||
|
||||
@@ -5,43 +5,42 @@
|
||||
******************************************************************************/
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public interface IBackpackDefinition extends Predicate<ItemStack> {
|
||||
|
||||
/**
|
||||
* To make your own backpack, create a backpack definition and register it with
|
||||
* {@link IBackpackInterface#registerBackpackDefinition(String, IBackpackDefinition)}.
|
||||
*/
|
||||
public interface IBackpackDefinition {
|
||||
/**
|
||||
* @return Human-readable name of the backpack.
|
||||
*/
|
||||
@Nonnull
|
||||
String getName(ItemStack backpack);
|
||||
|
||||
/**
|
||||
* @return Primary colour for the backpack icon.
|
||||
* @return Primary color for the backpack icon.
|
||||
*/
|
||||
int getPrimaryColour();
|
||||
|
||||
/**
|
||||
* @return Secondary colour for backpack icon.
|
||||
* @return Secondary color for backpack icon, normally white.
|
||||
*/
|
||||
int getSecondaryColour();
|
||||
|
||||
/**
|
||||
* Adds an item as valid for this backpack.
|
||||
* Filters items that can be put into a backpack.
|
||||
*
|
||||
* @param validItem
|
||||
* For Backpack Implementers: you can create a new filter with
|
||||
* {@link IBackpackInterface#createBackpackFilter()} or
|
||||
* {@link IBackpackInterface#createNaturalistBackpackFilter(String)}
|
||||
* or implement your own.
|
||||
*
|
||||
* @return the backpack's item filter.
|
||||
*/
|
||||
void addValidItem(ItemStack validItem);
|
||||
|
||||
void addValidItems(List<ItemStack> validItems);
|
||||
|
||||
void addValidOreDictName(String oreDictName);
|
||||
|
||||
/**
|
||||
* Returns true if the ItemStack is a valid item for this backpack type.
|
||||
*/
|
||||
@Override
|
||||
boolean test(ItemStack itemstack);
|
||||
|
||||
@Nonnull
|
||||
Predicate<ItemStack> getFilter();
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package forestry.api.storage;
|
||||
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* A configurable backpack filter. Useful for implementers of {@link IBackpackDefinition}.
|
||||
* Get a new instance from {@link IBackpackInterface#createBackpackFilter()}.
|
||||
*/
|
||||
public interface IBackpackFilterConfigurable extends Predicate<ItemStack> {
|
||||
/**
|
||||
* Adds an item as valid for this backpack to pick up.
|
||||
*/
|
||||
void acceptItem(ItemStack validItem);
|
||||
|
||||
/**
|
||||
* Adds an item as invalid for this backpack, used to make exceptions to oreDictionary matches.
|
||||
*
|
||||
* @see #acceptOreDictName(String)
|
||||
*/
|
||||
void rejectItem(ItemStack invalidItem);
|
||||
|
||||
/**
|
||||
* Adds an ore dictionary name as valid for this backpack.
|
||||
* The backpack will pick up any item that has this oreDictName.
|
||||
*
|
||||
* @see OreDictionary
|
||||
*/
|
||||
void acceptOreDictName(String oreDictName);
|
||||
|
||||
/**
|
||||
* Removes an ore dictionary name as valid for this backpack.
|
||||
* The backpack will not pick up any item that has this oreDictName.
|
||||
*
|
||||
* @see OreDictionary
|
||||
*/
|
||||
void rejectOreDictName(String oreDictName);
|
||||
|
||||
/**
|
||||
* Clear all the rules from this filter.
|
||||
*/
|
||||
void clear();
|
||||
}
|
||||
@@ -7,32 +7,83 @@ package forestry.api.storage;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
/**
|
||||
* The Backpack Interface allows you to add items to Forestry backpacks or create your own backpacks.
|
||||
* <p>
|
||||
* To create your own backpack, create an {@link IBackpackDefinition}.
|
||||
* Backpack definitions have a filter, which you can create here with
|
||||
* {@link #createBackpackFilter()}
|
||||
* or {@link #createNaturalistBackpackFilter(String)}
|
||||
* or create your own.
|
||||
* <p>
|
||||
* After you've registered your backpack definition, create the item with
|
||||
* {@link #createBackpack(String, EnumBackpackType)}
|
||||
* or {@link #createNaturalistBackpack(String, ISpeciesRoot)}
|
||||
* and then register the returned item with {@link GameRegistry#register(IForgeRegistryEntry)} like any other item.
|
||||
*/
|
||||
public interface IBackpackInterface {
|
||||
/**
|
||||
* Get a backpack with a given uid so you can add items to it or get information about it.
|
||||
* returns null if there is no backpack for the given uid.
|
||||
* Add an accepted item to a Forestry backpack.
|
||||
*
|
||||
* @param backpackUid The unique ID of the Forestry backpack. See {@link BackpackManager} for valid UIDs.
|
||||
* @param itemStack The itemStack that the backpack should accept.
|
||||
* {@link OreDictionary#WILDCARD_VALUE} can be used for meta value.
|
||||
*/
|
||||
void addItemToForestryBackpack(@Nonnull String backpackUid, @Nonnull ItemStack itemStack);
|
||||
|
||||
/**
|
||||
* Register a backpack definition with a given uid.
|
||||
*/
|
||||
void registerBackpackDefinition(@Nonnull String backpackUid, @Nonnull IBackpackDefinition definition);
|
||||
|
||||
/**
|
||||
* Get a backpack definition with a given uid.
|
||||
*/
|
||||
@Nullable
|
||||
IBackpackDefinition getBackpack(@Nonnull String uid);
|
||||
IBackpackDefinition getBackpackDefinition(@Nonnull String backpackUid);
|
||||
|
||||
/**
|
||||
* Register a backpack with a given uid
|
||||
*/
|
||||
void registerBackpack(@Nonnull String uid, @Nonnull IBackpackDefinition definition);
|
||||
|
||||
/**
|
||||
* Adds a backpack with the given definition and type, returning the item.
|
||||
* Creates a backpack with the given UID and type, returning the item.
|
||||
* The backpack's definition must first be registered with {@link #registerBackpackDefinition(String, IBackpackDefinition)}.
|
||||
*
|
||||
* @param definition
|
||||
* Definition of backpack behaviour.
|
||||
* @param type
|
||||
* Type of backpack.
|
||||
* @param backpackUid The unique ID of the backpack.
|
||||
* @param type Type of backpack.
|
||||
* @return Created backpack item.
|
||||
*/
|
||||
@Nonnull
|
||||
Item createBackpack(@Nonnull IBackpackDefinition definition, @Nonnull EnumBackpackType type);
|
||||
Item createBackpack(@Nonnull String backpackUid, @Nonnull EnumBackpackType type);
|
||||
|
||||
/**
|
||||
* Create a backpack that can hold items from a specific {@link ISpeciesRoot}.
|
||||
* The backpack's definition must first be registered with {@link #registerBackpackDefinition(String, IBackpackDefinition)}.
|
||||
*
|
||||
* @param backpackUid The unique ID of the backpack.
|
||||
* @param speciesRoot The species root.
|
||||
* @return Created backpack item.
|
||||
*/
|
||||
Item createNaturalistBackpack(@Nonnull String backpackUid, @Nonnull ISpeciesRoot speciesRoot);
|
||||
|
||||
/**
|
||||
* Makes a new configurable backpack filter. Useful for implementing {@link IBackpackDefinition}.
|
||||
*/
|
||||
IBackpackFilterConfigurable createBackpackFilter();
|
||||
|
||||
/**
|
||||
* Makes a new naturalist backpack filter. Only accepts items from a specific {@link ISpeciesRoot}.
|
||||
* Useful for implementing {@link IBackpackDefinition} for naturalist's backpacks.
|
||||
*
|
||||
* @param speciesRootUid The species root's unique ID. See {@link ISpeciesRoot#getUID()}.
|
||||
* @return a new backpack filter for the specified species root
|
||||
* @see #createNaturalistBackpack(String, ISpeciesRoot)
|
||||
*/
|
||||
Predicate<ItemStack> createNaturalistBackpackFilter(String speciesRootUid);
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* This work (the API) is licensed under the "MIT" License, see LICENSE.txt for details.
|
||||
******************************************************************************/
|
||||
@API(apiVersion = "3.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|storage")
|
||||
@API(apiVersion = "5.0.0", owner = "ForestryAPI|core", provides = "ForestryAPI|storage")
|
||||
package forestry.api.storage;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
@@ -12,10 +12,11 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockApiculture extends BlockBase<BlockTypeApiculture> {
|
||||
public BlockApiculture(BlockTypeApiculture type) {
|
||||
super(type);
|
||||
super(type, Material.WOOD);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.apiculture.blocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
@@ -36,7 +37,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
beeHouse = new BlockApiculture(BlockTypeApiculture.BEE_HOUSE);
|
||||
registerBlock(beeHouse, new ItemBlockForestry(beeHouse), "bee_house");
|
||||
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST);
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST, Material.WOOD);
|
||||
registerBlock(beeChest, new ItemBlockForestry(beeChest), "bee_chest");
|
||||
beeChest.setCreativeTab(Tabs.tabApiculture);
|
||||
beeChest.setHarvestLevel("axe", 0);
|
||||
|
||||
@@ -45,7 +45,7 @@ public class BeeMutation extends Mutation implements IBeeMutation, IBeeMutationB
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingPos = housing.getCoordinates();
|
||||
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, housingPos, allele0, allele1, genome0, genome1, housing);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
package forestry.apiculture.genetics.alleles;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.EffectData;
|
||||
import forestry.core.utils.VectUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockMushroom;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.passive.EntityCow;
|
||||
import net.minecraft.entity.passive.EntityMooshroom;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -11,12 +17,6 @@ import net.minecraft.util.EnumParticleTypes;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenBigMushroom;
|
||||
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
import forestry.core.genetics.EffectData;
|
||||
|
||||
public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
|
||||
@@ -24,7 +24,7 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
private static final int ENTITY_THROTTLE = 6;
|
||||
|
||||
public AlleleEffectFungification() {
|
||||
super("mycophilic", true, 10, false, false);
|
||||
super("mycophilic", true, 20, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,50 +57,51 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
World world = housing.getWorldObj();
|
||||
BlockPos housingCoordinates = housing.getCoordinates();
|
||||
Vec3i area = getModifiedArea(genome, housing);
|
||||
|
||||
int blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
|
||||
int blockY = getRandomOffset(world.rand, housingCoordinates.getY(), area.getY());
|
||||
int blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
BlockPos pos = new BlockPos(blockX, blockY, blockZ);
|
||||
Block block = world.getBlockState(pos).getBlock();
|
||||
if (isSuitableForMycelium(world, block, pos)) {
|
||||
world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
|
||||
break;
|
||||
} else if (isSuitableForGrowth(block)) {
|
||||
doMushroomGrowth(block, world, pos);
|
||||
break;
|
||||
}
|
||||
blockX = getRandomOffset(world.rand, housingCoordinates.getX(), area.getX());
|
||||
blockY = getRandomOffset(world.rand, housingCoordinates.getY(), area.getY());
|
||||
blockZ = getRandomOffset(world.rand, housingCoordinates.getZ(), area.getZ());
|
||||
}
|
||||
Vec3i halfArea = new Vec3i(area.getX() / 2, area.getY() / 2, area.getZ() / 2);
|
||||
|
||||
for (int attempt = 0; attempt < MAX_BLOCK_FIND_TRIES; ++attempt) {
|
||||
BlockPos pos = VectUtil.getRandomPositionInArea(world.rand, area).subtract(halfArea).add(housingCoordinates);
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
|
||||
if (convertToMycelium(world, blockState, pos)) {
|
||||
return;
|
||||
} else if (growGiantMushroom(world, blockState, pos)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void doEntityEffect(IBeeGenome genome, IBeeHousing housing) {
|
||||
List<EntityCow> cows = getEntitiesInRange(genome, housing, EntityCow.class);
|
||||
for (EntityCow cow : cows) {
|
||||
convertCowToMooshroom(cow);
|
||||
if (convertCowToMooshroom(cow)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static int getRandomOffset(Random random, int centrePos, int offset) {
|
||||
return centrePos + random.nextInt(offset) - offset / 2;
|
||||
}
|
||||
|
||||
private static boolean isSuitableForMycelium(World world, Block block, BlockPos pos) {
|
||||
return block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos);
|
||||
|
||||
private static boolean convertToMycelium(World world, IBlockState blockState, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
if (block == Blocks.GRASS || block == Blocks.DIRT && world.canBlockSeeSky(pos)) {
|
||||
world.setBlockState(pos, Blocks.MYCELIUM.getDefaultState());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isSuitableForGrowth(Block block) {
|
||||
return block == Blocks.RED_MUSHROOM || block == Blocks.BROWN_MUSHROOM;
|
||||
private static boolean growGiantMushroom(World world, IBlockState blockState, BlockPos pos) {
|
||||
Block block = blockState.getBlock();
|
||||
if (block instanceof BlockMushroom) {
|
||||
BlockMushroom mushroom = (BlockMushroom) block;
|
||||
mushroom.generateBigMushroom(world, pos, blockState, world.rand);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void convertCowToMooshroom(EntityCow cow) {
|
||||
|
||||
private static boolean convertCowToMooshroom(EntityCow cow) {
|
||||
if (cow instanceof EntityMooshroom) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
World worldObj = cow.worldObj;
|
||||
cow.setDead();
|
||||
@@ -110,14 +111,6 @@ public class AlleleEffectFungification extends AlleleEffectThrottled {
|
||||
mooshroom.renderYawOffset = cow.renderYawOffset;
|
||||
worldObj.spawnEntityInWorld(mooshroom);
|
||||
worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_LARGE, cow.posX, cow.posY + cow.height / 2.0F, cow.posZ, 0.0D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
private static void doMushroomGrowth(Block block, World world, BlockPos pos) {
|
||||
WorldGenBigMushroom giantMushroomGenerator;
|
||||
|
||||
giantMushroomGenerator = new WorldGenBigMushroom(block);
|
||||
|
||||
world.setBlockToAir(pos);
|
||||
giantMushroomGenerator.generate(world, world.rand, pos);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -15,21 +15,13 @@ import java.io.IOException;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
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.Biome;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.api.apiculture.IBeekeepingLogic;
|
||||
import forestry.api.core.BiomeHelper;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
@@ -48,6 +40,13 @@ import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
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.Biome;
|
||||
|
||||
public class AlvearyController extends RectangularMultiblockControllerBase implements IAlvearyControllerInternal, IClimateControlled {
|
||||
|
||||
@@ -355,8 +354,11 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(this);
|
||||
if (beeModifier.isHellish() && tempChange >= 0) {
|
||||
return EnumTemperature.HELLISH;
|
||||
Biome biome = getBiome();
|
||||
if (beeModifier.isHellish() || BiomeHelper.isBiomeHellish(biome)) {
|
||||
if (tempChange >= 0) {
|
||||
return EnumTemperature.HELLISH;
|
||||
}
|
||||
}
|
||||
|
||||
return EnumTemperature.getFromValue(getExactTemperature());
|
||||
|
||||
@@ -12,10 +12,12 @@ package forestry.arboriculture.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockArboriculture extends BlockBase<BlockTypeArboricultureTesr> {
|
||||
public BlockArboriculture(BlockTypeArboricultureTesr type) {
|
||||
super(type);
|
||||
super(type, Material.WOOD);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
}
|
||||
@@ -531,7 +531,7 @@ public abstract class BlockPile extends BlockStructure implements ITileEntityPro
|
||||
}
|
||||
|
||||
public static IAlleleTreeSpecies getTreeSpecies(ItemStack stack) {
|
||||
if (stack != null) {
|
||||
if (stack != null && stack.hasTagCompound()) {
|
||||
NBTTagCompound tagCompound = stack.getTagCompound();
|
||||
|
||||
// legacy
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.arboriculture.genetics;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.DefaultClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -40,7 +42,7 @@ public class TreeMutation extends Mutation implements ITreeMutation, ITreeMutati
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAlleleTreeSpecies allele0, IAlleleTreeSpecies allele1, ITreeGenome genome0, ITreeGenome genome1) {
|
||||
float processedChance = super.getChance(world, pos, allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, pos, allele0, allele1, genome0, genome1, ForestryAPI.climateManager.getDefaultClimate(world, pos));
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ import forestry.api.arboriculture.ITree;
|
||||
import forestry.api.arboriculture.ITreeGenome;
|
||||
import forestry.api.arboriculture.ITreekeepingMode;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IEffectData;
|
||||
@@ -55,6 +58,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraftforge.common.EnumPlantType;
|
||||
|
||||
public class TileLeaves extends TileTreeContainer implements IPollinatable, IFruitBearer, IButterflyNursery, IRipeningPacketReceiver {
|
||||
@@ -495,4 +499,19 @@ public class TileLeaves extends TileTreeContainer implements IPollinatable, IFru
|
||||
ITree tree = getTree();
|
||||
return !isDestroyed(tree, damage) && caterpillar == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
return worldObj.getBiome(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromBiome(worldObj.getBiome(pos), worldObj, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(worldObj, pos));
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -42,4 +43,8 @@ public class ClimateManager implements IClimateManager{
|
||||
return biome.getRainfall();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IClimateProvider getDefaultClimate(World world, BlockPos pos) {
|
||||
return new DefaultClimateProvider(world, pos);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package forestry.core;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
|
||||
public class DefaultClimateProvider implements IClimateProvider {
|
||||
private World world;
|
||||
private BlockPos pos;
|
||||
|
||||
public DefaultClimateProvider(World world, BlockPos pos) {
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Biome getBiome() {
|
||||
return world.getBiome(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumTemperature getTemperature() {
|
||||
return EnumTemperature.getFromBiome(world.getBiome(pos), world, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumHumidity getHumidity() {
|
||||
return EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(world, pos));
|
||||
}
|
||||
}
|
||||
@@ -74,8 +74,8 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
|
||||
protected final BlockStateContainer blockState;
|
||||
|
||||
public BlockBase(@Nonnull P blockType) {
|
||||
super(Material.IRON);
|
||||
public BlockBase(@Nonnull P blockType, Material material) {
|
||||
super(material);
|
||||
|
||||
this.blockType = blockType;
|
||||
blockType.getMachineProperties().setBlock(this);
|
||||
@@ -90,6 +90,10 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
|
||||
particleCallback = new MachineParticleCallback<>(this, blockType);
|
||||
}
|
||||
|
||||
public BlockBase(@Nonnull P blockType) {
|
||||
this(blockType, Material.IRON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state) {
|
||||
|
||||
@@ -13,5 +13,6 @@ package forestry.core.blocks;
|
||||
public class BlockCore extends BlockBase<BlockTypeCoreTesr> {
|
||||
public BlockCore(BlockTypeCoreTesr blockType) {
|
||||
super(blockType);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
@@ -23,6 +23,8 @@ public class Constants implements IForestryConstants {
|
||||
public static final String VERSION = "@VERSION@";
|
||||
public static final String BUILD_NUMBER = "@BUILD_NUMBER@";
|
||||
|
||||
public static final String TESLA_MOD_ID = "tesla";
|
||||
|
||||
public static final int FLAG_BLOCK_UPDATE = 1;
|
||||
public static final int FLAG_BLOCK_SYNC = 2;
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.List;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IAlleleSpecies;
|
||||
import forestry.api.genetics.IGenome;
|
||||
@@ -124,10 +125,10 @@ public abstract class Mutation implements IMutation, IMutationBuilder {
|
||||
return this;
|
||||
}
|
||||
|
||||
protected float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
protected float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
float mutationChance = chance;
|
||||
for (IMutationCondition mutationCondition : mutationConditions) {
|
||||
mutationChance *= mutationCondition.getChance(world, pos, allele0, allele1, genome0, genome1);
|
||||
mutationChance *= mutationCondition.getChance(world, pos, allele0, allele1, genome0, genome1, climate);
|
||||
if (mutationChance == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -34,8 +35,8 @@ public class MutationConditionBiome implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
Biome biome = world.getBiome(pos);
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
Biome biome = climate.getBiome();
|
||||
for (BiomeDictionary.Type type : validBiomeTypes) {
|
||||
if (BiomeDictionary.isBiomeOfType(biome, type)) {
|
||||
return 1;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -27,7 +28,7 @@ public class MutationConditionDaytime implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
if (world.isDaytime() == daytime) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -31,8 +32,8 @@ public class MutationConditionHumidity implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
EnumHumidity biomeHumidity = EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(world, pos));
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
EnumHumidity biomeHumidity = climate.getHumidity();
|
||||
|
||||
if (biomeHumidity.ordinal() < minHumidity.ordinal() || biomeHumidity.ordinal() > maxHumidity.ordinal()) {
|
||||
return 0;
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousing;
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.api.genetics.IGenome;
|
||||
import forestry.api.genetics.IMutationCondition;
|
||||
@@ -54,7 +55,7 @@ public class MutationConditionRequiresResource implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
TileEntity tile;
|
||||
do {
|
||||
pos = pos.down();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -32,9 +33,9 @@ public class MutationConditionTemperature implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
Biome biome = world.getBiomeProvider().getBiome(pos);
|
||||
EnumTemperature biomeTemperature = EnumTemperature.getFromBiome(biome, world, pos);
|
||||
EnumTemperature biomeTemperature = climate.getTemperature();
|
||||
|
||||
if (biomeTemperature.ordinal() < minTemperature.ordinal() || biomeTemperature.ordinal() > maxTemperature.ordinal()) {
|
||||
return 0;
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.core.genetics.mutations;
|
||||
|
||||
import java.util.Calendar;
|
||||
|
||||
import forestry.api.core.IClimateProvider;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -32,7 +33,7 @@ public class MutationConditionTimeLimited implements IMutationCondition {
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
public float getChance(World world, BlockPos pos, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
|
||||
DayMonth now = new DayMonth();
|
||||
|
||||
// If we are equal to start day, return 1.
|
||||
|
||||
@@ -17,7 +17,9 @@ import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.ItemPickaxe;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
@@ -48,6 +50,15 @@ public class ItemForestryTool extends ItemForestry {
|
||||
public void setEfficiencyOnProperMaterial(float efficiencyOnProperMaterial) {
|
||||
this.efficiencyOnProperMaterial = efficiencyOnProperMaterial;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(IBlockState block) {
|
||||
if(this == PluginCore.items.bronzePickaxe){
|
||||
Material material = block.getMaterial();
|
||||
return material == Material.ROCK ? true : (material == Material.IRON ? true : material == Material.ANVIL);
|
||||
}
|
||||
return super.canHarvestBlock(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getStrVsBlock(ItemStack itemstack, IBlockState state) {
|
||||
@@ -56,6 +67,10 @@ public class ItemForestryTool extends ItemForestry {
|
||||
return efficiencyOnProperMaterial;
|
||||
}
|
||||
}
|
||||
if(this == PluginCore.items.bronzePickaxe){
|
||||
Material material = state.getMaterial();
|
||||
return material != Material.IRON && material != Material.ANVIL && material != Material.ROCK ? super.getStrVsBlock(itemstack, state) : this.efficiencyOnProperMaterial;
|
||||
}
|
||||
return super.getStrVsBlock(itemstack, state);
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -60,6 +61,7 @@ import gnu.trove.map.hash.TIntObjectHashMap;
|
||||
public class ModelCrate extends BlankItemModel {
|
||||
|
||||
private static final Map<String, IBakedModel> cache = Maps.newHashMap();
|
||||
private static final String CUSTOM_CRATES = "forestry:item/crates/";
|
||||
|
||||
private static IModel crateModel;
|
||||
private static ModelBlock MODEL_GENERATED;
|
||||
@@ -174,6 +176,24 @@ public class ModelCrate extends BlankItemModel {
|
||||
return new CrateOverrideList();
|
||||
}
|
||||
|
||||
private static IModel getCustomContentModel(ItemCrated crateItem){
|
||||
ItemStack contained = crateItem.getContained();
|
||||
if(contained != null){
|
||||
try {
|
||||
return ModelLoaderRegistry.getModel(getCustomContentModelLocation(crateItem));
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static ResourceLocation getCustomContentModelLocation(ItemCrated crateItem){
|
||||
String containedName = crateItem.getRegistryName().getResourcePath().replace("crated.", "");
|
||||
return new ResourceLocation(CUSTOM_CRATES + containedName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Bake the crate model.
|
||||
*/
|
||||
@@ -181,6 +201,7 @@ public class ModelCrate extends BlankItemModel {
|
||||
List<IBakedModel> models = new ArrayList<>();
|
||||
|
||||
IBakedModel containedModel = getModel(crateItem.getContained());
|
||||
IModel customContentModel = getCustomContentModel(crateItem);
|
||||
|
||||
IdentityHashMap<Item, TIntObjectHashMap<ModelResourceLocation>> modelResourceLocations = ObfuscationReflectionHelper.getPrivateValue(ItemModelMesherForge.class, (ItemModelMesherForge) Minecraft.getMinecraft().getRenderItem().getItemModelMesher(), 0);
|
||||
|
||||
@@ -189,6 +210,11 @@ public class ModelCrate extends BlankItemModel {
|
||||
|
||||
models.add(crateModel);
|
||||
|
||||
if(customContentModel != null){
|
||||
containedModel = customContentModel.bake(ModelManager.getInstance().DEFAULT_ITEM, DefaultVertexFormats.ITEM, new DefaultTextureGetter());
|
||||
location = getCustomContentModelLocation(crateItem);
|
||||
}
|
||||
|
||||
if (hasItemModel(location)) {
|
||||
models.add(new TRSRBakedModel(containedModel, -0.0625F, 0, 0.0625F, 0.5F));
|
||||
models.add(new TRSRBakedModel(containedModel, -0.0625F, 0, -0.0625F, 0.5F));
|
||||
|
||||
@@ -13,6 +13,7 @@ package forestry.core.models.baker;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -48,7 +49,7 @@ public class ModelBaker implements IModelBaker {
|
||||
|
||||
private static final float quadsUV[] = new float[]{0, 0, 1, 1, 0, 0, 1, 1};
|
||||
private final List<ModelBakerFace> faces = new ArrayList<>();
|
||||
private final List<IBakedModel> bakedModels = new ArrayList<>();
|
||||
private final List<Pair<IBlockState, IBakedModel>> bakedModels = new ArrayList<>();
|
||||
|
||||
protected AxisAlignedBB renderBounds;
|
||||
|
||||
@@ -126,8 +127,10 @@ public class ModelBaker implements IModelBaker {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBakedModel(@Nonnull IBakedModel model) {
|
||||
this.bakedModels.add(model);
|
||||
public void addBakedModel(@Nullable IBlockState state, @Nonnull IBakedModel model) {
|
||||
if(model != null){
|
||||
this.bakedModels.add(Pair.of(state, model));
|
||||
}
|
||||
}
|
||||
|
||||
protected static float[] getFaceUvs(final EnumFacing face, final Vector3f to_16, final Vector3f from_16) {
|
||||
@@ -217,7 +220,7 @@ public class ModelBaker implements IModelBaker {
|
||||
}
|
||||
|
||||
//Add baked models to the current model.
|
||||
for(IBakedModel bakedModel : bakedModels){
|
||||
for(Pair<IBlockState, IBakedModel> bakedModel : bakedModels){
|
||||
currentModel.addModelQuads(bakedModel);
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
|
||||
private final Map<EnumFacing, List<BakedQuad>> faceQuads;
|
||||
private final List<BakedQuad> generalQuads;
|
||||
private final List<IBakedModel> models;
|
||||
private final List<Pair<IBlockState, IBakedModel>> models;
|
||||
|
||||
private float[] rotation = getDefaultRotation();
|
||||
private float[] translation = getDefaultTranslation();
|
||||
@@ -68,7 +68,7 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
}
|
||||
}
|
||||
|
||||
private ModelBakerModel(List<IBakedModel> models, Map<EnumFacing, List<BakedQuad>> faceQuads, List<BakedQuad> generalQuads, boolean isGui3d, boolean isAmbientOcclusion, IModelState modelState, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) {
|
||||
private ModelBakerModel(List<Pair<IBlockState, IBakedModel>> models, Map<EnumFacing, List<BakedQuad>> faceQuads, List<BakedQuad> generalQuads, boolean isGui3d, boolean isAmbientOcclusion, IModelState modelState, float[] rotation, float[] translation, float[] scale, TextureAtlasSprite particleSprite) {
|
||||
this.models = models;
|
||||
this.faceQuads = faceQuads;
|
||||
this.generalQuads = generalQuads;
|
||||
@@ -178,8 +178,10 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
return modelState;
|
||||
}
|
||||
|
||||
public void addModelQuads(IBakedModel model) {
|
||||
this.models.add(model);
|
||||
public void addModelQuads(Pair<IBlockState, IBakedModel> model) {
|
||||
if(model != null){
|
||||
this.models.add(model);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -194,8 +196,11 @@ public class ModelBakerModel implements IModelBakerModel {
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
|
||||
List<BakedQuad> quads = new ArrayList<>();
|
||||
for (IBakedModel model : this.models) {
|
||||
quads.addAll(model.getQuads(state, side, rand));
|
||||
for (Pair<IBlockState, IBakedModel> model : this.models) {
|
||||
List<BakedQuad> modelQuads = model.getRight().getQuads(model.getLeft(), side, rand);
|
||||
if(modelQuads != null && !modelQuads.isEmpty()){
|
||||
quads.addAll(modelQuads);
|
||||
}
|
||||
}
|
||||
if(side != null){
|
||||
quads.addAll(faceQuads.get(side));
|
||||
|
||||
@@ -104,6 +104,8 @@ public class RenderEscritoire extends TileEntitySpecialRenderer<TileEscritoire>
|
||||
rendermanager.doRenderEntity(dummyEntityItem, 0.0D, 0.0D, 0.0D, 0.0F, 0.0F, false);
|
||||
}
|
||||
GlStateManager.popMatrix();
|
||||
|
||||
dummyEntityItem.worldObj = null; // prevent leaking the world object
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,8 +50,8 @@ public class TextureManager implements ITextureManager {
|
||||
|
||||
public static void initDefaultSprites() {
|
||||
String[] defaultIconNames = new String[]{"habitats/desert", "habitats/end", "habitats/forest", "habitats/hills", "habitats/jungle", "habitats/mushroom",
|
||||
"habitats/nether", "habitats/ocean", "habitats/plains", "habitats/snow", "habitats/swamp", "habitats/taiga", "misc/access.private",
|
||||
"misc/access.viewable", "misc/access.shared", "misc/energy", "misc/hint",
|
||||
"habitats/nether", "habitats/ocean", "habitats/plains", "habitats/snow", "habitats/swamp", "habitats/taiga",
|
||||
"misc/access.shared", "misc/energy", "misc/hint",
|
||||
"analyzer/anything", "analyzer/bee", "analyzer/cave", "analyzer/closed", "analyzer/drone", "analyzer/flyer",
|
||||
"analyzer/item", "analyzer/nocturnal", "analyzer/princess", "analyzer/pure_breed", "analyzer/pure_cave",
|
||||
"analyzer/pure_flyer", "analyzer/pure_nocturnal", "analyzer/queen",
|
||||
|
||||
@@ -64,15 +64,15 @@ public class CamouflageUtil {
|
||||
}
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
|
||||
if(tile instanceof ICamouflageHandler){
|
||||
return (ICamouflageHandler) tile;
|
||||
}
|
||||
if(tile instanceof IMultiblockComponent){
|
||||
IMultiblockComponent component = (IMultiblockComponent) tile;
|
||||
if(component.getMultiblockLogic().getController() instanceof ICamouflageHandler){
|
||||
return (ICamouflageHandler) component.getMultiblockLogic().getController();
|
||||
}
|
||||
}
|
||||
if(tile instanceof ICamouflageHandler){
|
||||
return (ICamouflageHandler) tile;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package forestry.energy;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import net.darkhax.tesla.api.ITeslaConsumer;
|
||||
import net.darkhax.tesla.api.ITeslaHolder;
|
||||
import net.darkhax.tesla.api.ITeslaProducer;
|
||||
@@ -14,7 +15,6 @@ import forestry.core.network.DataInputStreamForestry;
|
||||
import forestry.core.network.DataOutputStreamForestry;
|
||||
import forestry.core.network.IStreamable;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
import cofh.api.energy.IEnergyProvider;
|
||||
import cofh.api.energy.IEnergyReceiver;
|
||||
@@ -23,9 +23,9 @@ import net.minecraftforge.common.capabilities.CapabilityInject;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = "Tesla"),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaProducer", modid = "Tesla"),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaHolder", modid = "Tesla")
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaConsumer", modid = Constants.TESLA_MOD_ID),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaProducer", modid = Constants.TESLA_MOD_ID),
|
||||
@Optional.Interface(iface = "net.darkhax.tesla.api.ITeslaHolder", modid = Constants.TESLA_MOD_ID)
|
||||
})
|
||||
public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaProducer, ITeslaHolder, IEnergyProvider, IStreamable {
|
||||
@CapabilityInject(ITeslaConsumer.class)
|
||||
@@ -259,13 +259,13 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return null;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
public static int sendEnergyTesla(TileEntity tile, EnumFacing side, int amount, boolean simulate) {
|
||||
ITeslaConsumer consumer = tile.getCapability(TESLA_CONSUMER, side);
|
||||
return (int) consumer.givePower(amount, simulate);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long givePower(long power, boolean simulated) {
|
||||
if (!canReceive()) {
|
||||
@@ -274,7 +274,7 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return energyStorage.receiveEnergy(power, simulated);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long takePower(long power, boolean simulated) {
|
||||
if (!canExtract()) {
|
||||
@@ -283,13 +283,13 @@ public class EnergyManager implements IEnergyReceiver, ITeslaConsumer, ITeslaPro
|
||||
return energyStorage.extractEnergy(power, simulated);
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long getStoredPower() {
|
||||
return energyStorage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "Tesla")
|
||||
@Optional.Method(modid = Constants.TESLA_MOD_ID)
|
||||
@Override
|
||||
public long getCapacity() {
|
||||
return energyStorage.getMaxEnergyStored();
|
||||
|
||||
@@ -56,6 +56,7 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
|
||||
public BlockEngine(BlockTypeEngine blockType) {
|
||||
super(blockType);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -15,5 +15,6 @@ import forestry.core.blocks.BlockBase;
|
||||
public class BlockFactoryPlain extends BlockBase<BlockTypeFactoryPlain> {
|
||||
public BlockFactoryPlain(BlockTypeFactoryPlain type) {
|
||||
super(type);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ import forestry.core.blocks.BlockBase;
|
||||
public class BlockFactoryTESR extends BlockBase<BlockTypeFactoryTesr> {
|
||||
public BlockFactoryTESR(BlockTypeFactoryTesr type) {
|
||||
super(type);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
@@ -10,20 +10,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.ImmutableCollection;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.network.packets.PacketFXSignal;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
|
||||
public class CropRubber extends CropDestroy {
|
||||
|
||||
public CropRubber(World world, IBlockState blockState, BlockPos position) {
|
||||
@@ -34,10 +39,44 @@ public class CropRubber extends CropDestroy {
|
||||
* Convert a "wet" rubber log blockstate into the dry version.
|
||||
* Total hack since we don't have access to the blockstates.
|
||||
*/
|
||||
private static IBlockState getReplantState(IBlockState sappyState) {
|
||||
Block block = sappyState.getBlock();
|
||||
int sappyMeta = block.getMetaFromState(sappyState);
|
||||
return block.getStateFromMeta(sappyMeta - 4);
|
||||
private static <T extends Comparable<T>> IBlockState getReplantState(IBlockState sappyState) {
|
||||
if (hasRubberToHarvest(sappyState)) {
|
||||
for (Map.Entry<IProperty<?>, Comparable<?>> wetPropertyEntry : sappyState.getProperties().entrySet()) {
|
||||
String valueWetString = wetPropertyEntry.getValue().toString();
|
||||
String valueDryString = valueWetString.replace("wet", "dry");
|
||||
IProperty<?> property = wetPropertyEntry.getKey();
|
||||
|
||||
IBlockState baseState = sappyState.getBlock().getBlockState().getBaseState();
|
||||
IBlockState dryState = getStateWithValue(baseState, property, valueDryString);
|
||||
if (dryState != null) {
|
||||
return dryState;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sappyState.getBlock().getDefaultState();
|
||||
}
|
||||
|
||||
public static boolean hasRubberToHarvest(IBlockState blockState) {
|
||||
Block block = blockState.getBlock();
|
||||
if (ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
ImmutableCollection<Comparable<?>> propertyValues = blockState.getProperties().values();
|
||||
for (Comparable<?> propertyValue : propertyValues) {
|
||||
if (propertyValue.toString().contains("wet")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static <T extends Comparable<T>> IBlockState getStateWithValue(IBlockState baseState, IProperty<T> property, String valueString) {
|
||||
Optional<T> value = property.parseValue(valueString);
|
||||
if (value.isPresent()) {
|
||||
return baseState.withProperty(property, value.get());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -10,27 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.logic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.farming.FarmDirection;
|
||||
import forestry.api.farming.ICrop;
|
||||
import forestry.api.farming.IFarmHousing;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.plugins.compat.PluginIC2;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class FarmLogicRubber extends FarmLogic {
|
||||
|
||||
@@ -114,63 +109,24 @@ public class FarmLogicRubber extends FarmLogic {
|
||||
}
|
||||
|
||||
private Collection<ICrop> getHarvestBlocks(World world, BlockPos position) {
|
||||
Set<BlockPos> seen = new HashSet<>();
|
||||
Stack<ICrop> crops = new Stack<>();
|
||||
|
||||
// Determine what type we want to harvest.
|
||||
IBlockState blockState = world.getBlockState(position);
|
||||
Block block = blockState.getBlock();
|
||||
if (!ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
return crops;
|
||||
}
|
||||
for (int j = 0; j < 10; j++) {
|
||||
BlockPos candidate = position.add(0, j, 0);
|
||||
|
||||
int meta = block.getMetaFromState(blockState);
|
||||
if (meta >= 7 && meta <= 10) {
|
||||
crops.push(new CropDestroy(world, blockState, position, null));
|
||||
}
|
||||
|
||||
List<BlockPos> candidates = processHarvestBlock(world, crops, seen, position);
|
||||
List<BlockPos> temp = new ArrayList<>();
|
||||
while (!candidates.isEmpty() && crops.size() < 100) {
|
||||
for (BlockPos candidate : candidates) {
|
||||
temp.addAll(processHarvestBlock(world, crops, seen, candidate));
|
||||
IBlockState blockState = world.getBlockState(candidate);
|
||||
Block block = blockState.getBlock();
|
||||
if (!ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (CropRubber.hasRubberToHarvest(blockState)) {
|
||||
crops.push(new CropRubber(world, blockState, candidate));
|
||||
break;
|
||||
}
|
||||
candidates.clear();
|
||||
candidates.addAll(temp);
|
||||
temp.clear();
|
||||
}
|
||||
|
||||
return crops;
|
||||
}
|
||||
|
||||
private List<BlockPos> processHarvestBlock(World world, Stack<ICrop> crops, Set<BlockPos> seen, BlockPos position) {
|
||||
List<BlockPos> candidates = new ArrayList<>();
|
||||
|
||||
// Get additional candidates to return
|
||||
for (int j = 0; j < 2; j++) {
|
||||
BlockPos candidate = position.add(0, j, 0);
|
||||
if (candidate.equals(position)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// See whether the given position has already been processed
|
||||
if (seen.contains(candidate)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
IBlockState blockState = world.getBlockState(candidate);
|
||||
Block block = blockState.getBlock();
|
||||
if (ItemStackUtil.equals(block, PluginIC2.rubberWood)) {
|
||||
int meta = block.getMetaFromState(blockState);
|
||||
if (meta >= 7 && meta <= 10) {
|
||||
crops.push(new CropRubber(world, blockState, candidate));
|
||||
}
|
||||
candidates.add(candidate);
|
||||
seen.add(candidate);
|
||||
}
|
||||
}
|
||||
|
||||
return candidates;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.greenhouse;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -71,23 +72,23 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
@Override
|
||||
public void registerRecipes() {
|
||||
|
||||
ItemStack greenhousePlainBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN);
|
||||
Block greenhousePlainBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN);
|
||||
RecipeUtil.addRecipe(greenhousePlainBlock,
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'X', Blocks.BRICK_BLOCK,
|
||||
'#', PluginCore.items.craftingMaterial.getCamouflagedPaneling());
|
||||
|
||||
ItemStack greenhouseGlassBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.GLASS);
|
||||
|
||||
Block greenhouseGlassBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.GLASS);
|
||||
RecipeUtil.addRecipe(greenhouseGlassBlock,
|
||||
"###",
|
||||
"#X#",
|
||||
"###",
|
||||
'X', "blockGlass",
|
||||
'#', PluginCore.items.craftingMaterial.getCamouflagedPaneling());
|
||||
|
||||
ItemStack greenhouseHatchInputBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HATCH_INPUT);
|
||||
|
||||
Block greenhouseHatchInputBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HATCH_INPUT);
|
||||
RecipeUtil.addRecipe(greenhouseHatchInputBlock,
|
||||
"TXT",
|
||||
"#H#",
|
||||
@@ -95,8 +96,8 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'H', OreDictUtil.TRAPDOOR_WOOD,
|
||||
'#', "gearTin",
|
||||
'T', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1));
|
||||
|
||||
ItemStack greenhouseHatchOutputBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HATCH_OUTPUT);
|
||||
|
||||
Block greenhouseHatchOutputBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HATCH_OUTPUT);
|
||||
RecipeUtil.addRecipe(greenhouseHatchOutputBlock,
|
||||
"#H#",
|
||||
"TXT",
|
||||
@@ -104,31 +105,31 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'H', OreDictUtil.TRAPDOOR_WOOD,
|
||||
'#', "gearTin",
|
||||
'T', PluginCore.items.tubes.get(EnumElectronTube.BRONZE, 1));
|
||||
|
||||
ItemStack greenhouseControlBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.CONTROL);
|
||||
|
||||
Block greenhouseControlBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.CONTROL);
|
||||
RecipeUtil.addRecipe(greenhouseControlBlock,
|
||||
" X ",
|
||||
"#T#",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
'#', "dustRedstone",
|
||||
'T', PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1));
|
||||
|
||||
ItemStack greenhouseGearBoxBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.GEARBOX);
|
||||
|
||||
Block greenhouseGearBoxBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.GEARBOX);
|
||||
RecipeUtil.addRecipe(greenhouseGearBoxBlock,
|
||||
" X ",
|
||||
"###",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
'#', "gearTin");
|
||||
|
||||
ItemStack greenhouseValveBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.VALVE);
|
||||
|
||||
Block greenhouseValveBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.VALVE);
|
||||
RecipeUtil.addRecipe(greenhouseValveBlock,
|
||||
" X ",
|
||||
"#G#",
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
'#', "blockGlass",
|
||||
'G', "gearTin");
|
||||
|
||||
ItemStack greenhouseHeaterBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HEATER);
|
||||
|
||||
Block greenhouseHeaterBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.HEATER);
|
||||
RecipeUtil.addRecipe(greenhouseHeaterBlock,
|
||||
"T#T",
|
||||
"#X#",
|
||||
@@ -136,8 +137,8 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
'#', "ingotGold",
|
||||
'T', PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1));
|
||||
|
||||
ItemStack greenhouseFanlock = blocks.getGreenhouseBlock(BlockGreenhouseType.FAN);
|
||||
|
||||
Block greenhouseFanlock = blocks.getGreenhouseBlock(BlockGreenhouseType.FAN);
|
||||
RecipeUtil.addRecipe(greenhouseFanlock,
|
||||
"T#T",
|
||||
"#X#",
|
||||
@@ -145,8 +146,8 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
'#', "ingotTin",
|
||||
'T', PluginCore.items.tubes.get(EnumElectronTube.TIN, 1));
|
||||
|
||||
ItemStack greenhouseDryerBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.DRYER);
|
||||
|
||||
Block greenhouseDryerBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.DRYER);
|
||||
RecipeUtil.addRecipe(greenhouseDryerBlock,
|
||||
"T#T",
|
||||
"#X#",
|
||||
@@ -154,8 +155,8 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.PLAIN),
|
||||
'#', "ingotBronze",
|
||||
'T', PluginCore.items.tubes.get(EnumElectronTube.BLAZE, 1));
|
||||
|
||||
ItemStack greenhouseSprinklerBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.SPRINKLER);
|
||||
|
||||
Block greenhouseSprinklerBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.SPRINKLER);
|
||||
RecipeUtil.addRecipe(greenhouseSprinklerBlock,
|
||||
"TXT",
|
||||
" I ",
|
||||
@@ -163,14 +164,15 @@ public class PluginGreenhouse extends BlankForestryPlugin {
|
||||
'X', blocks.getGreenhouseBlock(BlockGreenhouseType.GLASS),
|
||||
'I', "ingotIron",
|
||||
'T', PluginCore.items.tubes.get(EnumElectronTube.LAPIS, 1));
|
||||
|
||||
ItemStack greenhouseDoorBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.DOOR);
|
||||
|
||||
Block greenhouseDoorBlock = blocks.getGreenhouseBlock(BlockGreenhouseType.DOOR);
|
||||
RecipeUtil.addRecipe(greenhouseDoorBlock,
|
||||
true,
|
||||
"GG ",
|
||||
"GG ",
|
||||
"GG ",
|
||||
'G', blocks.getGreenhouseBlock(BlockGreenhouseType.GLASS));
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.FACTORY)) {
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.BIOMASS.getFluid(500), null, PluginCore.items.craftingMaterial.getCamouflagedPaneling(),
|
||||
" A ", "###", "RPR",
|
||||
|
||||
@@ -140,7 +140,7 @@ public abstract class BlockGreenhouse extends BlockStructure implements ISpriteR
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
|
||||
if (getGreenhouseType() == BlockGreenhouseType.SPRINKLER) {
|
||||
return SPRINKLER_BOUNDS;
|
||||
return SPRINKLER_BOUNDS.offset(pos);
|
||||
}
|
||||
return super.getSelectedBoundingBox(state, worldIn, pos);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package forestry.greenhouse.blocks;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
@@ -24,9 +24,8 @@ public class BlockRegistryGreenhouse extends BlockRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getGreenhouseBlock(BlockGreenhouseType type) {
|
||||
BlockGreenhouse greenhouseBlock = greenhouseBlockMap.get(type);
|
||||
return new ItemStack(greenhouseBlock);
|
||||
public BlockGreenhouse getGreenhouseBlock(BlockGreenhouseType type) {
|
||||
return greenhouseBlockMap.get(type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockModelShapes;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -51,8 +52,9 @@ public class ModelGreenhouse extends ModelBlockDefault<BlockGreenhouse> {
|
||||
private static void bakeBlockModel(@Nonnull BlockGreenhouse block, @Nullable IBlockAccess world, @Nullable BlockPos pos, @Nullable IExtendedBlockState stateExtended, @Nonnull IModelBaker baker, @Nullable ItemStack camouflageStack) {
|
||||
if (camouflageStack != null) {
|
||||
BlockModelShapes modelShapes = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
|
||||
IBlockState state = Block.getBlockFromItem(camouflageStack.getItem()).getStateFromMeta(camouflageStack.getItemDamage());
|
||||
|
||||
baker.addBakedModel(modelShapes.getModelForState(Block.getBlockFromItem(camouflageStack.getItem()).getStateFromMeta(camouflageStack.getItemDamage())));
|
||||
baker.addBakedModel(state, modelShapes.getModelForState(state));
|
||||
baker.setParticleSprite(modelShapes.getModelForState(Block.getBlockFromItem(camouflageStack.getItem()).getStateFromMeta(camouflageStack.getItemDamage())).getParticleTexture());
|
||||
}
|
||||
|
||||
|
||||
@@ -34,9 +34,14 @@ public class ProxyGreenhouseClient extends ProxyGreenhouse {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileGreenhouseSprinkler.class, new AnimationTESR<>());
|
||||
continue;
|
||||
}
|
||||
Proxies.render.registerBlockModel(new BlockModelIndex(new ModelResourceLocation("forestry:greenhouse." + greenhouseType),
|
||||
new ModelResourceLocation("forestry:greenhouse", "inventory"), new ModelGreenhouse(),
|
||||
Block.getBlockFromItem(PluginGreenhouse.blocks.getGreenhouseBlock(greenhouseType).getItem())));
|
||||
|
||||
Block greenhouseBlock = PluginGreenhouse.blocks.getGreenhouseBlock(greenhouseType);
|
||||
if (greenhouseBlock != null) {
|
||||
ModelResourceLocation blockModelLocation = new ModelResourceLocation("forestry:greenhouse." + greenhouseType);
|
||||
ModelResourceLocation itemModelLocation = new ModelResourceLocation("forestry:greenhouse", "inventory");
|
||||
BlockModelIndex blockModelIndex = new BlockModelIndex(blockModelLocation, itemModelLocation, new ModelGreenhouse(), greenhouseBlock);
|
||||
Proxies.render.registerBlockModel(blockModelIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class BlockCocoon extends Block implements ITileEntityProvider, IStateMap
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) {
|
||||
return BOUNDING_BOX;
|
||||
return BOUNDING_BOX.offset(pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,10 +12,12 @@ package forestry.lepidopterology.blocks;
|
||||
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
||||
public class BlockLepidopterology extends BlockBase<BlockTypeLepidopterologyTesr> {
|
||||
public BlockLepidopterology(BlockTypeLepidopterologyTesr type) {
|
||||
super(type);
|
||||
super(type, Material.WOOD);
|
||||
setCreativeTab(Tabs.tabLepidopterology);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ public class EntityButterfly extends EntityCreature implements IEntityButterfly
|
||||
|
||||
BlockPos posBelow = pos.down();
|
||||
IBlockState blockStateBelow = worldObj.getBlockState(posBelow);
|
||||
Block blockBelow = blockState.getBlock();
|
||||
Block blockBelow = blockStateBelow.getBlock();
|
||||
if (blockBelow.isLeaves(blockStateBelow, worldObj, posBelow)) {
|
||||
weight += 2.5f;
|
||||
} else if (blockBelow instanceof BlockFence) {
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ButterflyMutation extends Mutation implements IButterflyMutation, I
|
||||
|
||||
@Override
|
||||
public float getChance(World world, IButterflyNursery housing, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1) {
|
||||
float processedChance = super.getChance(world, housing.getCoordinates(), allele0, allele1, genome0, genome1);
|
||||
float processedChance = super.getChance(world, housing.getCoordinates(), allele0, allele1, genome0, genome1, housing);
|
||||
if (processedChance <= 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ModelButterflyItem extends BlankItemModel {
|
||||
ImmutableMap.Builder<String, String> textures = ImmutableMap.builder();
|
||||
textures.put("butterfly", butterfly.getGenome().getSecondary().getItemTexture());
|
||||
IModel retexturedModel = ModelProcessingHelper.retexture(modelButterfly, textures.build());
|
||||
return new TRSRBakedModel(retexturedModel.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.03125F, 0.0F, -0.03125F, butterfly.getSize() * 1.5F);
|
||||
return new TRSRBakedModel(retexturedModel.bake(ModelRotation.X0_Y0, DefaultVertexFormats.ITEM, textureGetter), -0.03125F, 0.5F, -0.03125F, butterfly.getSize() * 1.5F);
|
||||
}
|
||||
|
||||
private class ButterflyItemOverrideList extends ItemOverrideList {
|
||||
|
||||
@@ -15,5 +15,6 @@ import forestry.core.blocks.BlockBase;
|
||||
public class BlockMail extends BlockBase<BlockTypeMail> {
|
||||
public BlockMail(BlockTypeMail blockType) {
|
||||
super(blockType);
|
||||
setHarvestLevel("pickaxe", 0);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,17 @@
|
||||
package forestry.plugins.compat;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.energy.blocks.BlockEngine;
|
||||
import forestry.energy.blocks.BlockTypeEngine;
|
||||
import forestry.energy.items.ItemEngine;
|
||||
|
||||
public class BlockRegistryIC2 extends BlockRegistry {
|
||||
public final BlockEngine electricalEngine;
|
||||
public final BlockBase electricalEngine;
|
||||
public final BlockEngine generator;
|
||||
|
||||
public BlockRegistryIC2() {
|
||||
electricalEngine = new BlockEngine(BlockTypeEngine.ELECTRICAL);
|
||||
electricalEngine = new BlockBase(BlockTypeEngine.ELECTRICAL);
|
||||
registerBlock(electricalEngine, new ItemEngine(electricalEngine), "engine_electrical");
|
||||
|
||||
generator = new BlockEngine(BlockTypeEngine.GENERATOR);
|
||||
|
||||
@@ -13,19 +13,7 @@ package forestry.plugins.compat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.farming.Farmables;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.core.PluginCore;
|
||||
@@ -35,11 +23,17 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.ModUtil;
|
||||
import forestry.farming.logic.FarmableBasicAgricraft;
|
||||
import forestry.farming.logic.FarmableGE;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.BIOMES_O_PLENTY, name = "BiomesOPlenty", author = "Nirek", url = Constants.URL, unlocalizedDescription = "for.plugin.biomesoplenty.description")
|
||||
public class PluginBiomesOPlenty extends BlankForestryPlugin {
|
||||
@@ -235,10 +229,15 @@ public class PluginBiomesOPlenty extends BlankForestryPlugin {
|
||||
for (String blockName : blockNames) {
|
||||
Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BoP, blockName));
|
||||
if (block != null) {
|
||||
ItemStack blockStack = new ItemStack(block, 1, OreDictionary.WILDCARD_VALUE);
|
||||
BackpackManager.backpackInterface.getBackpack(backpackUid).addValidItem(blockStack);
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
if (item != null) {
|
||||
ItemStack blockStack = new ItemStack(item, 1, OreDictionary.WILDCARD_VALUE);
|
||||
BackpackManager.backpackInterface.addItemToForestryBackpack(backpackUid, blockStack);
|
||||
} else {
|
||||
Log.warning("Could not find an item for block: {}", blockName);
|
||||
}
|
||||
} else {
|
||||
Log.warning("Missing block: ", blockName);
|
||||
Log.warning("Missing block: {}", blockName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,19 +10,10 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins.compat;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import forestry.api.circuits.ChipsetManager;
|
||||
import forestry.api.circuits.CircuitSocketType;
|
||||
import forestry.api.circuits.ICircuitLayout;
|
||||
@@ -32,7 +23,6 @@ import forestry.api.fuels.EngineBronzeFuel;
|
||||
import forestry.api.fuels.FuelManager;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
@@ -61,10 +51,15 @@ import forestry.farming.logic.FarmableBasicIC2Crop;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
|
||||
import ic2.api.item.IC2Items;
|
||||
import ic2.api.recipe.RecipeInputItemStack;
|
||||
import ic2.api.recipe.Recipes;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.INDUSTRIALCRAFT2, name = "IndustrialCraft2", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.ic2.description")
|
||||
public class PluginIC2 extends BlankForestryPlugin {
|
||||
@@ -153,21 +148,18 @@ public class PluginIC2 extends BlankForestryPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
IBackpackDefinition forester = BackpackManager.backpackInterface.getBackpack(BackpackManager.FORESTER_UID);
|
||||
if (forester != null) {
|
||||
if (resin != null) {
|
||||
forester.addValidItem(resin);
|
||||
}
|
||||
if (rubber != null) {
|
||||
forester.addValidItem(rubber);
|
||||
}
|
||||
if (rubberSapling != null) {
|
||||
forester.addValidItem(rubberSapling);
|
||||
}
|
||||
ItemStack rubberLeaves = IC2Items.getItem("leaves");
|
||||
if (rubberLeaves != null) {
|
||||
forester.addValidItem(rubberLeaves);
|
||||
}
|
||||
if (resin != null) {
|
||||
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, resin);
|
||||
}
|
||||
if (rubber != null) {
|
||||
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubber);
|
||||
}
|
||||
if (rubberSapling != null) {
|
||||
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubberSapling);
|
||||
}
|
||||
ItemStack rubberLeaves = IC2Items.getItem("leaves");
|
||||
if (rubberLeaves != null) {
|
||||
BackpackManager.backpackInterface.addItemToForestryBackpack(BackpackManager.FORESTER_UID, rubberLeaves);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,55 +11,47 @@
|
||||
package forestry.storage;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Color;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.awt.*;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.utils.Translator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Translator;
|
||||
|
||||
public class BackpackDefinition implements IBackpackDefinition {
|
||||
|
||||
private final int primaryColor;
|
||||
private final int secondaryColor;
|
||||
|
||||
private final Set<String> validItemStacks = new HashSet<>();
|
||||
private final Set<Integer> validOreIds = new HashSet<>();
|
||||
|
||||
public BackpackDefinition(@Nonnull Color primaryColor) {
|
||||
this(primaryColor, new Color(0xffffff));
|
||||
}
|
||||
@Nonnull
|
||||
private final Predicate<ItemStack> filter;
|
||||
|
||||
public BackpackDefinition(@Nonnull Color primaryColor, @Nonnull Color secondaryColor) {
|
||||
this(primaryColor, secondaryColor, BackpackManager.backpackInterface.createBackpackFilter());
|
||||
}
|
||||
|
||||
public BackpackDefinition(@Nonnull Color primaryColor, @Nonnull Color secondaryColor, @Nonnull Predicate<ItemStack> filter) {
|
||||
this.primaryColor = primaryColor.getRGB();
|
||||
this.secondaryColor = secondaryColor.getRGB();
|
||||
this.filter = filter;
|
||||
}
|
||||
|
||||
public Set<Integer> getValidOreIds() {
|
||||
return validOreIds;
|
||||
}
|
||||
|
||||
public Set<String> getValidItemStacks() {
|
||||
return validItemStacks;
|
||||
@Override
|
||||
@Nonnull
|
||||
public Predicate<ItemStack> getFilter() {
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getName(ItemStack backpack) {
|
||||
Item item = backpack.getItem();
|
||||
String display = Translator.translateToLocal(item.getUnlocalizedNameInefficiently(backpack) + ".name").trim();
|
||||
|
||||
if (backpack.hasTagCompound() && backpack.getTagCompound().hasKey("display", 10)) {
|
||||
NBTTagCompound nbt = backpack.getTagCompound().getCompoundTag("display");
|
||||
NBTTagCompound tagCompound = backpack.getTagCompound();
|
||||
if (tagCompound != null && tagCompound.hasKey("display", 10)) {
|
||||
NBTTagCompound nbt = tagCompound.getCompoundTag("display");
|
||||
|
||||
if (nbt.hasKey("Name", 8)) {
|
||||
display = nbt.getString("Name");
|
||||
@@ -78,89 +70,4 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
public int getSecondaryColour() {
|
||||
return secondaryColor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addValidItem(ItemStack validItem) {
|
||||
String itemStackString = ItemStackUtil.getStringForItemStack(validItem);
|
||||
if (itemStackString != null) {
|
||||
this.validItemStacks.add(itemStackString);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearAllValid() {
|
||||
validItemStacks.clear();
|
||||
validOreIds.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addValidItems(List<ItemStack> validItems) {
|
||||
for (ItemStack validItem : validItems) {
|
||||
addValidItem(validItem);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addValidOreDictName(String oreDictName) {
|
||||
if (OreDictionary.doesOreNameExist(oreDictName)) {
|
||||
int oreId = OreDictionary.getOreID(oreDictName);
|
||||
validOreIds.add(oreId);
|
||||
}
|
||||
}
|
||||
|
||||
public void addValidOreDictNames(List<String> oreDictNames) {
|
||||
for (String oreDictName : oreDictNames) {
|
||||
addValidOreDictName(oreDictName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = itemStack.getItem();
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String itemStackStringWild = ItemStackUtil.getItemNameFromRegistryAsString(item);
|
||||
if (validItemStacks.contains(itemStackStringWild)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int meta = itemStack.getItemDamage();
|
||||
if (meta != OreDictionary.WILDCARD_VALUE) {
|
||||
String itemStackString = itemStackStringWild + ':' + meta;
|
||||
if (validItemStacks.contains(itemStackString)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int[] oreIds = OreDictionary.getOreIDs(itemStack);
|
||||
for (int oreId : oreIds) {
|
||||
if (validOreIds.contains(oreId)) {
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static class BackpackDefinitionNaturalist extends BackpackDefinition {
|
||||
@Nonnull
|
||||
private final String speciesRootUid;
|
||||
|
||||
public BackpackDefinitionNaturalist(@Nonnull Color primaryColor, @Nonnull String speciesRootUid) {
|
||||
super(primaryColor);
|
||||
this.speciesRootUid = speciesRootUid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(ItemStack itemStack) {
|
||||
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUid);
|
||||
return speciesRoot.isMember(itemStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package forestry.storage;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import forestry.api.storage.IBackpackFilterConfigurable;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class BackpackFilter implements IBackpackFilterConfigurable {
|
||||
private final Set<String> acceptedItemStacks = new HashSet<>();
|
||||
private final Set<String> rejectedItemStacks = new HashSet<>();
|
||||
private final Set<Integer> validOreIds = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public void acceptItem(ItemStack validItem) {
|
||||
String itemStackString = ItemStackUtil.getStringForItemStack(validItem);
|
||||
if (itemStackString != null) {
|
||||
this.acceptedItemStacks.add(itemStackString);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void acceptOreDictName(String oreDictName) {
|
||||
if (OreDictionary.doesOreNameExist(oreDictName)) {
|
||||
int oreId = OreDictionary.getOreID(oreDictName);
|
||||
this.validOreIds.add(oreId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rejectOreDictName(String oreDictName) {
|
||||
if (OreDictionary.doesOreNameExist(oreDictName)) {
|
||||
int oreId = OreDictionary.getOreID(oreDictName);
|
||||
this.validOreIds.remove(oreId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rejectItem(ItemStack invalidItem) {
|
||||
String itemStackString = ItemStackUtil.getStringForItemStack(invalidItem);
|
||||
if (itemStackString != null) {
|
||||
this.rejectedItemStacks.add(itemStackString);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
acceptedItemStacks.clear();
|
||||
rejectedItemStacks.clear();
|
||||
validOreIds.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(ItemStack itemStack) {
|
||||
if (itemStack == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Item item = itemStack.getItem();
|
||||
if (item == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String itemStackStringWild = ItemStackUtil.getItemNameFromRegistryAsString(item);
|
||||
if (rejectedItemStacks.contains(itemStackStringWild)) {
|
||||
return false;
|
||||
}
|
||||
if (acceptedItemStacks.contains(itemStackStringWild)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
int meta = itemStack.getMetadata();
|
||||
if (meta != OreDictionary.WILDCARD_VALUE) {
|
||||
String itemStackString = itemStackStringWild + ':' + meta;
|
||||
if (rejectedItemStacks.contains(itemStackString)) {
|
||||
return false;
|
||||
}
|
||||
if (acceptedItemStacks.contains(itemStackString)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
int[] oreIds = OreDictionary.getOreIDs(itemStack);
|
||||
for (int oreId : oreIds) {
|
||||
if (validOreIds.contains(oreId)) {
|
||||
acceptedItemStacks.add(itemStackStringWild);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Set<Integer> getValidOreIds() {
|
||||
return validOreIds;
|
||||
}
|
||||
|
||||
public Set<String> getAcceptedItemStacks() {
|
||||
return acceptedItemStacks;
|
||||
}
|
||||
|
||||
public Set<String> getRejectedItemStacks() {
|
||||
return rejectedItemStacks;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package forestry.storage;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BackpackFilterNaturalist implements Predicate<ItemStack> {
|
||||
@Nonnull
|
||||
private final String speciesRootUid;
|
||||
|
||||
public BackpackFilterNaturalist(@Nonnull String speciesRootUid) {
|
||||
this.speciesRootUid = speciesRootUid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean test(ItemStack itemStack) {
|
||||
ISpeciesRoot speciesRoot = AlleleManager.alleleRegistry.getSpeciesRoot(speciesRootUid);
|
||||
return speciesRoot.isMember(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -14,34 +14,109 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.api.storage.IBackpackFilterConfigurable;
|
||||
import forestry.api.storage.IBackpackInterface;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
import forestry.storage.items.ItemBackpackNaturalist;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class BackpackInterface implements IBackpackInterface {
|
||||
/**
|
||||
* Only use this if you know what you are doing. Prefer backpackInterface.
|
||||
*/
|
||||
public final Map<String, IBackpackDefinition> definitions = new HashMap<>();
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBackpackDefinition getBackpack(@Nonnull String uid) {
|
||||
return definitions.get(uid);
|
||||
private final Map<String, IBackpackDefinition> definitions = new HashMap<>();
|
||||
private final Multimap<String, String> backpackAcceptedItems = HashMultimap.create();
|
||||
|
||||
public Multimap<String, String> getBackpackAcceptedItems() {
|
||||
return backpackAcceptedItems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBackpack(@Nonnull String uid, @Nonnull IBackpackDefinition definition) {
|
||||
definitions.put(uid, definition);
|
||||
public void addItemToForestryBackpack(@Nullable String backpackUid, @Nullable ItemStack itemStack) {
|
||||
if (backpackUid == null) {
|
||||
throw new NullPointerException("backpackUid must not be null");
|
||||
}
|
||||
if (itemStack == null) {
|
||||
throw new NullPointerException("itemStack must not be null");
|
||||
}
|
||||
if (itemStack.getItem() == null) {
|
||||
throw new NullPointerException("itemStack.getItem() must not be null");
|
||||
}
|
||||
|
||||
String stringForItemStack = ItemStackUtil.getStringForItemStack(itemStack);
|
||||
backpackAcceptedItems.put(backpackUid, stringForItemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBackpackDefinition(@Nullable String backpackUid, @Nullable IBackpackDefinition definition) {
|
||||
if (backpackUid == null) {
|
||||
throw new NullPointerException("backpackUid must not be null");
|
||||
}
|
||||
if (definition == null) {
|
||||
throw new NullPointerException("definition must not be null");
|
||||
}
|
||||
definitions.put(backpackUid, definition);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public IBackpackDefinition getBackpackDefinition(@Nullable String backpackUid) {
|
||||
if (backpackUid == null) {
|
||||
throw new NullPointerException("backpackUid must not be null");
|
||||
}
|
||||
return definitions.get(backpackUid);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public Item createBackpack(@Nonnull IBackpackDefinition definition, @Nonnull EnumBackpackType type) {
|
||||
public Item createBackpack(@Nullable String backpackUid, @Nullable EnumBackpackType type) {
|
||||
if (backpackUid == null) {
|
||||
throw new NullPointerException("backpackUid must not be null");
|
||||
}
|
||||
if (type == null) {
|
||||
throw new NullPointerException("type must not be null");
|
||||
}
|
||||
if (type == EnumBackpackType.NATURALIST) {
|
||||
throw new IllegalArgumentException("type must not be NATURALIST. Use createNaturalistBackpack instead.");
|
||||
}
|
||||
|
||||
IBackpackDefinition definition = definitions.get(backpackUid);
|
||||
if (definition == null) {
|
||||
throw new IllegalArgumentException("No backpack definition was registered for UID: " + backpackUid);
|
||||
}
|
||||
return new ItemBackpack(definition, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item createNaturalistBackpack(@Nullable String backpackUid, @Nullable ISpeciesRoot speciesRoot) {
|
||||
if (backpackUid == null) {
|
||||
throw new NullPointerException("backpackUid must not be null");
|
||||
}
|
||||
if (speciesRoot == null) {
|
||||
throw new NullPointerException("speciesRoot must not be null");
|
||||
}
|
||||
|
||||
IBackpackDefinition definition = definitions.get(backpackUid);
|
||||
if (definition == null) {
|
||||
throw new IllegalArgumentException("No backpack definition was registered for UID: " + backpackUid);
|
||||
}
|
||||
return new ItemBackpackNaturalist(speciesRoot, definition);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBackpackFilterConfigurable createBackpackFilter() {
|
||||
return new BackpackFilter();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Predicate<ItemStack> createNaturalistBackpackFilter(String speciesRootUid) {
|
||||
return new BackpackFilterNaturalist(speciesRootUid);
|
||||
}
|
||||
}
|
||||
@@ -10,15 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.storage;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.IPickupHandler;
|
||||
import forestry.storage.gui.ContainerBackpack;
|
||||
import forestry.storage.gui.ContainerNaturalistBackpack;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class PickupHandlerStorage implements IPickupHandler {
|
||||
|
||||
@@ -54,7 +53,7 @@ public class PickupHandlerStorage implements IPickupHandler {
|
||||
|
||||
ItemBackpack backpack = (ItemBackpack) pack.getItem();
|
||||
IBackpackDefinition backpackDefinition = backpack.getDefinition();
|
||||
if (backpackDefinition.test(itemstack)) {
|
||||
if (backpackDefinition.getFilter().test(itemstack)) {
|
||||
ItemBackpack.tryStowing(player, pack, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,43 +10,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.storage;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Color;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import com.google.common.collect.HashMultimap;
|
||||
import com.google.common.collect.Multimap;
|
||||
import forestry.Forestry;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.recipes.RecipeManagers;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.api.storage.IBackpackFilterConfigurable;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
@@ -70,6 +52,22 @@ import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import forestry.storage.items.ItemRegistryStorage;
|
||||
import forestry.storage.proxy.ProxyStorage;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.ModelBakeEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
@ForestryPlugin(pluginID = ForestryPluginUids.STORAGE, name = "Storage", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.storage.description")
|
||||
public class PluginStorage extends BlankForestryPlugin {
|
||||
@@ -82,8 +80,10 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
public static ItemRegistryStorage items;
|
||||
|
||||
private final Multimap<String, String> backpackOreDictRegexpDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackItemDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackAcceptedOreDictRegexpDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackRejectedOreDictRegexpDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackAcceptedItemDefaults = HashMultimap.create();
|
||||
private final Multimap<String, String> backpackRejectedItemDefaults = HashMultimap.create();
|
||||
|
||||
private final List<String> forestryBackpackUids = Arrays.asList(
|
||||
BackpackManager.MINER_UID,
|
||||
@@ -105,32 +105,34 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
BackpackDefinition definition;
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
definition = new BackpackDefinition.BackpackDefinitionNaturalist(new Color(0xc4923d), "rootBees");
|
||||
BackpackManager.backpackInterface.registerBackpack("apiarist", definition);
|
||||
Predicate<ItemStack> filter = BackpackManager.backpackInterface.createNaturalistBackpackFilter("rootBees");
|
||||
definition = new BackpackDefinition(new Color(0xc4923d), Color.WHITE, filter);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition("apiarist", definition);
|
||||
}
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
definition = new BackpackDefinition.BackpackDefinitionNaturalist(new Color(0x995b31), "rootButterflies");
|
||||
BackpackManager.backpackInterface.registerBackpack("lepidopterist", definition);
|
||||
Predicate<ItemStack> filter = BackpackManager.backpackInterface.createNaturalistBackpackFilter("rootButterflies");
|
||||
definition = new BackpackDefinition(new Color(0x995b31), Color.WHITE, filter);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition("lepidopterist", definition);
|
||||
}
|
||||
|
||||
definition = new BackpackDefinition(new Color(0x36187d));
|
||||
BackpackManager.backpackInterface.registerBackpack(BackpackManager.MINER_UID, definition);
|
||||
definition = new BackpackDefinition(new Color(0x36187d), Color.WHITE);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition(BackpackManager.MINER_UID, definition);
|
||||
|
||||
definition = new BackpackDefinition(new Color(0x363cc5));
|
||||
BackpackManager.backpackInterface.registerBackpack(BackpackManager.DIGGER_UID, definition);
|
||||
definition = new BackpackDefinition(new Color(0x363cc5), Color.WHITE);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition(BackpackManager.DIGGER_UID, definition);
|
||||
|
||||
definition = new BackpackDefinition(new Color(0x347427));
|
||||
BackpackManager.backpackInterface.registerBackpack(BackpackManager.FORESTER_UID, definition);
|
||||
definition = new BackpackDefinition(new Color(0x347427), Color.WHITE);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition(BackpackManager.FORESTER_UID, definition);
|
||||
|
||||
definition = new BackpackDefinition(new Color(0x412215));
|
||||
BackpackManager.backpackInterface.registerBackpack(BackpackManager.HUNTER_UID, definition);
|
||||
definition = new BackpackDefinition(new Color(0x412215), Color.WHITE);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition(BackpackManager.HUNTER_UID, definition);
|
||||
|
||||
definition = new BackpackDefinition(new Color(0x7fb8c2));
|
||||
BackpackManager.backpackInterface.registerBackpack(BackpackManager.ADVENTURER_UID, definition);
|
||||
definition = new BackpackDefinition(new Color(0x7fb8c2), Color.WHITE);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition(BackpackManager.ADVENTURER_UID, definition);
|
||||
|
||||
definition = new BackpackDefinition(new Color(0xdd3a3a));
|
||||
BackpackManager.backpackInterface.registerBackpack(BackpackManager.BUILDER_UID, definition);
|
||||
definition = new BackpackDefinition(new Color(0xdd3a3a), Color.WHITE);
|
||||
BackpackManager.backpackInterface.registerBackpackDefinition(BackpackManager.BUILDER_UID, definition);
|
||||
|
||||
proxy.registerCrateModel();
|
||||
}
|
||||
@@ -151,7 +153,13 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
final String newConfig = CONFIG_CATEGORY + ".cfg";
|
||||
|
||||
File configFile = new File(Forestry.instance.getConfigFolder(), newConfig);
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "1.0.0");
|
||||
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "2.0.0");
|
||||
if (!config.getDefinedConfigVersion().equals(config.getLoadedConfigVersion())) {
|
||||
boolean deleted = configFile.delete();
|
||||
if (deleted) {
|
||||
config = new LocalizedConfiguration(configFile, "2.0.0");
|
||||
}
|
||||
}
|
||||
|
||||
setDefaultsForConfig();
|
||||
|
||||
@@ -163,7 +171,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
private void setDefaultsForConfig() {
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.MINER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.MINER_UID).addAll(Arrays.asList(
|
||||
"obsidian",
|
||||
"ore[A-Z].*",
|
||||
"dust[A-Z].*",
|
||||
@@ -175,7 +183,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"denseore[A-Z].*"
|
||||
));
|
||||
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.DIGGER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.DIGGER_UID).addAll(Arrays.asList(
|
||||
"cobblestone",
|
||||
"dirt",
|
||||
"gravel",
|
||||
@@ -185,7 +193,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"sand"
|
||||
));
|
||||
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.HUNTER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.HUNTER_UID).addAll(Arrays.asList(
|
||||
"bone",
|
||||
"egg",
|
||||
"enderpearl",
|
||||
@@ -197,7 +205,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"string"
|
||||
));
|
||||
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.FORESTER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.FORESTER_UID).addAll(Arrays.asList(
|
||||
"logWood",
|
||||
"stickWood",
|
||||
"woodStick",
|
||||
@@ -211,7 +219,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"tree[A-Z].*"
|
||||
));
|
||||
|
||||
backpackOreDictRegexpDefaults.get(BackpackManager.BUILDER_UID).addAll(Arrays.asList(
|
||||
backpackAcceptedOreDictRegexpDefaults.get(BackpackManager.BUILDER_UID).addAll(Arrays.asList(
|
||||
"block[A-Z].*",
|
||||
"paneGlass[A-Z].*",
|
||||
"slabWood[A-Z].*",
|
||||
@@ -234,7 +242,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
"doorWood"
|
||||
));
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.MINER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.MINER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.COAL_ORE),
|
||||
new ItemStack(Items.COAL),
|
||||
PluginCore.items.bronzePickaxe.getItemStack(),
|
||||
@@ -242,7 +250,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
PluginCore.items.brokenBronzePickaxe.getItemStack()
|
||||
)));
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.DIGGER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.DIGGER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.DIRT, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(Items.FLINT),
|
||||
new ItemStack(Blocks.SANDSTONE, 1, 0),
|
||||
@@ -254,7 +262,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
PluginCore.items.brokenBronzeShovel.getItemStack()
|
||||
)));
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.FORESTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.FORESTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.RED_MUSHROOM),
|
||||
new ItemStack(Blocks.BROWN_MUSHROOM),
|
||||
new ItemStack(Blocks.RED_FLOWER, 1, OreDictionary.WILDCARD_VALUE),
|
||||
@@ -274,7 +282,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
new ItemStack(Items.APPLE)
|
||||
)));
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.HUNTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.HUNTER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Items.BLAZE_POWDER),
|
||||
new ItemStack(Items.BLAZE_ROD),
|
||||
new ItemStack(Items.ROTTEN_FLESH),
|
||||
@@ -315,7 +323,7 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
new ItemStack(Items.IRON_HORSE_ARMOR)
|
||||
)));
|
||||
|
||||
backpackItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(Blocks.REDSTONE_TORCH),
|
||||
new ItemStack(Blocks.REDSTONE_LAMP),
|
||||
new ItemStack(Blocks.SEA_LANTERN),
|
||||
@@ -369,24 +377,15 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
|
||||
BlockRegistryApiculture beeBlocks = PluginApiculture.blocks;
|
||||
if (beeBlocks != null) {
|
||||
backpackItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
backpackAcceptedItemDefaults.get(BackpackManager.BUILDER_UID).addAll(getItemStrings(Arrays.asList(
|
||||
new ItemStack(beeBlocks.candle, 1, OreDictionary.WILDCARD_VALUE),
|
||||
new ItemStack(beeBlocks.stump, 1, OreDictionary.WILDCARD_VALUE)
|
||||
)));
|
||||
}
|
||||
|
||||
// include everything added via the API
|
||||
for (String backpackUid : forestryBackpackUids) {
|
||||
BackpackDefinition backpackDefinition = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(backpackUid);
|
||||
|
||||
Collection<String> oreDictDefaults = backpackOreDictRegexpDefaults.get(backpackUid);
|
||||
for (int oreId : backpackDefinition.getValidOreIds()) {
|
||||
String oreName = OreDictionary.getOreName(oreId);
|
||||
oreDictDefaults.add(oreName);
|
||||
}
|
||||
|
||||
backpackItemDefaults.get(backpackUid).addAll(backpackDefinition.getValidItemStacks());
|
||||
}
|
||||
BackpackInterface backpackInterface = (BackpackInterface) BackpackManager.backpackInterface;
|
||||
backpackAcceptedItemDefaults.putAll(backpackInterface.getBackpackAcceptedItems());
|
||||
}
|
||||
|
||||
// Should be ore dicted in Forge at some point.
|
||||
@@ -416,45 +415,91 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
private void handleBackpackConfig(LocalizedConfiguration config, String backpackUid) {
|
||||
BackpackDefinition backpackDefinition = (BackpackDefinition) BackpackManager.backpackInterface.getBackpack(backpackUid);
|
||||
backpackDefinition.clearAllValid();
|
||||
|
||||
{
|
||||
List<String> defaultItemNames = new ArrayList<>(backpackItemDefaults.get(backpackUid));
|
||||
Collections.sort(defaultItemNames);
|
||||
String[] defaultValidItems = defaultItemNames.toArray(new String[defaultItemNames.size()]);
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "item.stacks", defaultValidItems);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.item.stacks.format", backpackUid));
|
||||
|
||||
String[] backpackItemList = backpackConf.getStringList();
|
||||
List<ItemStack> backpackItems = ItemStackUtil.parseItemStackStrings(backpackItemList, OreDictionary.WILDCARD_VALUE);
|
||||
backpackDefinition.addValidItems(backpackItems);
|
||||
BackpackDefinition backpackDefinition = (BackpackDefinition) BackpackManager.backpackInterface.getBackpackDefinition(backpackUid);
|
||||
if (backpackDefinition == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
Predicate<ItemStack> filter = backpackDefinition.getFilter();
|
||||
if (filter instanceof IBackpackFilterConfigurable) {
|
||||
IBackpackFilterConfigurable backpackFilter = (IBackpackFilterConfigurable) filter;
|
||||
backpackFilter.clear();
|
||||
|
||||
List<String> defaultOreRegexpList = new ArrayList<>(backpackOreDictRegexpDefaults.get(backpackUid));
|
||||
Collections.sort(defaultOreRegexpList);
|
||||
String[] defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
|
||||
// accepted items
|
||||
{
|
||||
List<String> defaultAcceptedItemNames = new ArrayList<>(backpackAcceptedItemDefaults.get(backpackUid));
|
||||
Collections.sort(defaultAcceptedItemNames);
|
||||
String[] defaultValidItems = defaultAcceptedItemNames.toArray(new String[defaultAcceptedItemNames.size()]);
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "ore.dict", defaultOreRegexpNames);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.ore.dict.format", backpackUid));
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "item.stacks.accepted", defaultValidItems);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.item.stacks.format", backpackUid));
|
||||
|
||||
List<String> oreDictNameList = new ArrayList<>();
|
||||
for (String name : OreDictionary.getOreNames()) {
|
||||
if (name == null) {
|
||||
Log.error("Found a null oreName in the ore dictionary");
|
||||
} else {
|
||||
for (String regex : backpackConf.getStringList()) {
|
||||
if (name.matches(regex)) {
|
||||
oreDictNameList.add(name);
|
||||
String[] backpackItemList = backpackConf.getStringList();
|
||||
List<ItemStack> backpackItems = ItemStackUtil.parseItemStackStrings(backpackItemList, OreDictionary.WILDCARD_VALUE);
|
||||
for (ItemStack backpackItem : backpackItems) {
|
||||
backpackFilter.acceptItem(backpackItem);
|
||||
}
|
||||
}
|
||||
|
||||
// rejected items
|
||||
{
|
||||
List<String> defaultRejectedItemNames = new ArrayList<>(backpackRejectedItemDefaults.get(backpackUid));
|
||||
Collections.sort(defaultRejectedItemNames);
|
||||
String[] defaultRejectedItems = defaultRejectedItemNames.toArray(new String[defaultRejectedItemNames.size()]);
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "item.stacks.rejected", defaultRejectedItems);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.item.stacks.format", backpackUid));
|
||||
|
||||
String[] backpackItemList = backpackConf.getStringList();
|
||||
List<ItemStack> backpackItems = ItemStackUtil.parseItemStackStrings(backpackItemList, OreDictionary.WILDCARD_VALUE);
|
||||
for (ItemStack backpackItem : backpackItems) {
|
||||
backpackFilter.rejectItem(backpackItem);
|
||||
}
|
||||
}
|
||||
|
||||
// accepted oreDict
|
||||
{
|
||||
List<String> defaultOreRegexpList = new ArrayList<>(backpackAcceptedOreDictRegexpDefaults.get(backpackUid));
|
||||
Collections.sort(defaultOreRegexpList);
|
||||
String[] defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "ore.dict.accepted", defaultOreRegexpNames);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.ore.dict.format", backpackUid));
|
||||
|
||||
for (String name : OreDictionary.getOreNames()) {
|
||||
if (name == null) {
|
||||
Log.error("Found a null oreName in the ore dictionary");
|
||||
} else {
|
||||
for (String regex : backpackConf.getStringList()) {
|
||||
if (name.matches(regex)) {
|
||||
backpackFilter.acceptOreDictName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
backpackDefinition.addValidOreDictNames(oreDictNameList);
|
||||
// rejected oreDict
|
||||
{
|
||||
List<String> defaultOreRegexpList = new ArrayList<>(backpackRejectedOreDictRegexpDefaults.get(backpackUid));
|
||||
Collections.sort(defaultOreRegexpList);
|
||||
String[] defaultOreRegexpNames = defaultOreRegexpList.toArray(new String[defaultOreRegexpList.size()]);
|
||||
|
||||
Property backpackConf = config.get("backpacks." + backpackUid, "ore.dict.rejected", defaultOreRegexpNames);
|
||||
backpackConf.setComment(Translator.translateToLocalFormatted("for.config.backpacks.ore.dict.format", backpackUid));
|
||||
|
||||
for (String name : OreDictionary.getOreNames()) {
|
||||
if (name == null) {
|
||||
Log.error("Found a null oreName in the ore dictionary");
|
||||
} else {
|
||||
for (String regex : backpackConf.getStringList()) {
|
||||
if (name.matches(regex)) {
|
||||
backpackFilter.rejectOreDictName(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -497,14 +542,20 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
IBackpackDefinition backpackDefinition = BackpackManager.backpackInterface.getBackpack(tokens[0]);
|
||||
IBackpackDefinition backpackDefinition = BackpackManager.backpackInterface.getBackpackDefinition(tokens[0]);
|
||||
if (backpackDefinition == null) {
|
||||
String errorMessage = IMCUtil.getInvalidIMCMessageText(message);
|
||||
Log.warning("%s For non-existent backpack %s.", errorMessage, tokens[0]);
|
||||
Log.warning("{} For non-existent backpack {}.", errorMessage, tokens[0]);
|
||||
return true;
|
||||
}
|
||||
List<ItemStack> itemStacks = ItemStackUtil.parseItemStackStrings(tokens[1], 0);
|
||||
backpackDefinition.addValidItems(itemStacks);
|
||||
Predicate<ItemStack> filter = backpackDefinition.getFilter();
|
||||
if (filter instanceof IBackpackFilterConfigurable) {
|
||||
IBackpackFilterConfigurable backpackFilter = (IBackpackFilterConfigurable) filter;
|
||||
for (ItemStack itemStack : itemStacks) {
|
||||
backpackFilter.acceptItem(itemStack);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
package forestry.storage.inventory;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.inventory.ItemInventory;
|
||||
import forestry.storage.items.ItemBackpack;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemInventoryBackpack extends ItemInventory {
|
||||
|
||||
@@ -33,6 +32,6 @@ public class ItemInventoryBackpack extends ItemInventory {
|
||||
|
||||
@Override
|
||||
public boolean canSlotAccept(int slotIndex, ItemStack itemStack) {
|
||||
return backpackDefinition.test(itemStack);
|
||||
return backpackDefinition.getFilter().test(itemStack);
|
||||
}
|
||||
}
|
||||
@@ -14,26 +14,6 @@ import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.api.storage.BackpackStowEvent;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
@@ -53,6 +33,24 @@ import forestry.storage.gui.ContainerBackpack;
|
||||
import forestry.storage.gui.GuiBackpack;
|
||||
import forestry.storage.gui.GuiBackpackT2;
|
||||
import forestry.storage.inventory.ItemInventoryBackpack;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public class ItemBackpack extends ItemWithGui implements IColoredItem {
|
||||
private final IBackpackDefinition definition;
|
||||
@@ -179,7 +177,7 @@ public class ItemBackpack extends ItemWithGui implements IColoredItem {
|
||||
|
||||
private void receiveFromChest(ItemInventoryBackpack backpackInventory, IItemHandler target) {
|
||||
ItemHandlerInventoryManipulator manipulator = new ItemHandlerInventoryManipulator(target);
|
||||
manipulator.transferStacks(backpackInventory.getItemHandler(), definition);
|
||||
manipulator.transferStacks(backpackInventory.getItemHandler(), definition.getFilter());
|
||||
}
|
||||
|
||||
public int getBackpackSize() {
|
||||
|
||||
@@ -12,9 +12,6 @@ package forestry.storage.items;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
@@ -23,13 +20,15 @@ import forestry.core.gui.GuiHandler;
|
||||
import forestry.core.gui.GuiNaturalistInventory;
|
||||
import forestry.storage.gui.ContainerNaturalistBackpack;
|
||||
import forestry.storage.inventory.ItemInventoryBackpackPaged;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ItemBackpackNaturalist extends ItemBackpack {
|
||||
@Nonnull
|
||||
private final ISpeciesRoot speciesRoot;
|
||||
|
||||
public ItemBackpackNaturalist(@Nonnull ISpeciesRoot speciesRoot, IBackpackDefinition definition, EnumBackpackType type) {
|
||||
super(definition, type);
|
||||
public ItemBackpackNaturalist(@Nonnull ISpeciesRoot speciesRoot, IBackpackDefinition definition) {
|
||||
super(definition, EnumBackpackType.NATURALIST);
|
||||
this.speciesRoot = speciesRoot;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,23 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.storage.items;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.core.Tabs;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.storage.BackpackManager;
|
||||
import forestry.api.storage.EnumBackpackType;
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.api.storage.IBackpackInterface;
|
||||
import forestry.core.items.ItemCrated;
|
||||
import forestry.core.items.ItemRegistry;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
public class ItemRegistryStorage extends ItemRegistry {
|
||||
public final ItemCrated crate;
|
||||
public final ItemBackpackNaturalist apiaristBackpack;
|
||||
public final ItemBackpackNaturalist lepidopteristBackpack;
|
||||
public final Item apiaristBackpack;
|
||||
public final Item lepidopteristBackpack;
|
||||
public final Item minerBackpack;
|
||||
public final Item minerBackpackT2;
|
||||
public final Item diggerBackpack;
|
||||
@@ -45,48 +44,38 @@ public class ItemRegistryStorage extends ItemRegistry {
|
||||
crate = registerItem(new ItemCrated(null, null), "crate");
|
||||
|
||||
// BACKPACKS
|
||||
IBackpackDefinition definition;
|
||||
|
||||
IBackpackInterface backpackInterface = BackpackManager.backpackInterface;
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
|
||||
definition = BackpackManager.backpackInterface.getBackpack("apiarist");
|
||||
apiaristBackpack = new ItemBackpackNaturalist(BeeManager.beeRoot, definition, EnumBackpackType.NATURALIST);
|
||||
apiaristBackpack = registerItem(backpackInterface.createNaturalistBackpack("apiarist", BeeManager.beeRoot), "apiaristBag");
|
||||
apiaristBackpack.setCreativeTab(Tabs.tabApiculture);
|
||||
registerItem(apiaristBackpack, "apiaristBag");
|
||||
} else {
|
||||
apiaristBackpack = null;
|
||||
}
|
||||
|
||||
if (ForestryAPI.enabledPlugins.contains(ForestryPluginUids.LEPIDOPTEROLOGY)) {
|
||||
definition = BackpackManager.backpackInterface.getBackpack("lepidopterist");
|
||||
lepidopteristBackpack = new ItemBackpackNaturalist(ButterflyManager.butterflyRoot, definition, EnumBackpackType.NATURALIST);
|
||||
lepidopteristBackpack = registerItem(backpackInterface.createNaturalistBackpack("lepidopterist", ButterflyManager.butterflyRoot), "lepidopteristBag");
|
||||
lepidopteristBackpack.setCreativeTab(Tabs.tabLepidopterology);
|
||||
registerItem(lepidopteristBackpack, "lepidopteristBag");
|
||||
} else {
|
||||
lepidopteristBackpack = null;
|
||||
}
|
||||
|
||||
definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.MINER_UID);
|
||||
minerBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "minerBag");
|
||||
minerBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "minerBagT2");
|
||||
|
||||
definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.DIGGER_UID);
|
||||
diggerBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "diggerBag");
|
||||
diggerBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "diggerBagT2");
|
||||
|
||||
definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.FORESTER_UID);
|
||||
foresterBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "foresterBag");
|
||||
foresterBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "foresterBagT2");
|
||||
|
||||
definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.HUNTER_UID);
|
||||
hunterBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "hunterBag");
|
||||
hunterBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "hunterBagT2");
|
||||
|
||||
definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.ADVENTURER_UID);
|
||||
adventurerBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "adventurerBag");
|
||||
adventurerBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "adventurerBagT2");
|
||||
|
||||
definition = BackpackManager.backpackInterface.getBackpack(BackpackManager.BUILDER_UID);
|
||||
builderBackpack = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.NORMAL), "builderBag");
|
||||
builderBackpackT2 = registerItem(BackpackManager.backpackInterface.createBackpack(definition, EnumBackpackType.WOVEN), "builderBagT2");
|
||||
|
||||
minerBackpack = registerItem(backpackInterface.createBackpack(BackpackManager.MINER_UID, EnumBackpackType.NORMAL), "minerBag");
|
||||
minerBackpackT2 = registerItem(backpackInterface.createBackpack(BackpackManager.MINER_UID, EnumBackpackType.WOVEN), "minerBagT2");
|
||||
|
||||
diggerBackpack = registerItem(backpackInterface.createBackpack(BackpackManager.DIGGER_UID, EnumBackpackType.NORMAL), "diggerBag");
|
||||
diggerBackpackT2 = registerItem(backpackInterface.createBackpack(BackpackManager.DIGGER_UID, EnumBackpackType.WOVEN), "diggerBagT2");
|
||||
|
||||
foresterBackpack = registerItem(backpackInterface.createBackpack(BackpackManager.FORESTER_UID, EnumBackpackType.NORMAL), "foresterBag");
|
||||
foresterBackpackT2 = registerItem(backpackInterface.createBackpack(BackpackManager.FORESTER_UID, EnumBackpackType.WOVEN), "foresterBagT2");
|
||||
|
||||
hunterBackpack = registerItem(backpackInterface.createBackpack(BackpackManager.HUNTER_UID, EnumBackpackType.NORMAL), "hunterBag");
|
||||
hunterBackpackT2 = registerItem(backpackInterface.createBackpack(BackpackManager.HUNTER_UID, EnumBackpackType.WOVEN), "hunterBagT2");
|
||||
|
||||
adventurerBackpack = registerItem(backpackInterface.createBackpack(BackpackManager.ADVENTURER_UID, EnumBackpackType.NORMAL), "adventurerBag");
|
||||
adventurerBackpackT2 = registerItem(backpackInterface.createBackpack(BackpackManager.ADVENTURER_UID, EnumBackpackType.WOVEN), "adventurerBagT2");
|
||||
|
||||
builderBackpack = registerItem(backpackInterface.createBackpack(BackpackManager.BUILDER_UID, EnumBackpackType.NORMAL), "builderBag");
|
||||
builderBackpackT2 = registerItem(backpackInterface.createBackpack(BackpackManager.BUILDER_UID, EnumBackpackType.WOVEN), "builderBagT2");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"textures": {
|
||||
"particle": "forestry:blocks/lepidopterology/cocoons/cocoon_early",
|
||||
"0": "forestry:blocks/lepidopterology/cocoons/cocoon_early"
|
||||
},
|
||||
"elements": [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"textures": {
|
||||
"particle": "forestry:blocks/lepidopterology/cocoons/cocoon_late",
|
||||
"0": "forestry:blocks/lepidopterology/cocoons/cocoon_late"
|
||||
},
|
||||
"elements": [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"textures": {
|
||||
"particle": "forestry:blocks/lepidopterology/cocoons/cocoon_middle",
|
||||
"0": "forestry:blocks/lepidopterology/cocoons/cocoon_middle"
|
||||
},
|
||||
"elements": [
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"textures": {
|
||||
"particle": "forestry:blocks/lepidopterology/cocoons/cocoon_silk_late",
|
||||
"0": "forestry:blocks/lepidopterology/cocoons/cocoon_silk_late"
|
||||
},
|
||||
"elements": [
|
||||
|
||||
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 221 B |
|
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 194 B |
|
Before Width: | Height: | Size: 176 B After Width: | Height: | Size: 193 B |
|
Before Width: | Height: | Size: 252 B After Width: | Height: | Size: 243 B |
|
Before Width: | Height: | Size: 198 B After Width: | Height: | Size: 195 B |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 236 B |