More porting to 1.9

This commit is contained in:
mezz committed 2016-05-04 01:02:43 -07:00
1 parent 73c2608848
commit a0cdaf1e1a
143 files changed
+991 -835

No files matched your search

@@ -5,6 +5,7 @@
******************************************************************************/
package forestry.api.apiculture.hives;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -25,6 +26,6 @@ public interface IHiveGen {
/**
* returns true if the hive can safely replace the block at this location.
*/
boolean canReplace(World world, BlockPos pos);
boolean canReplace(IBlockState blockState, World world, BlockPos pos);
}
@@ -64,7 +64,7 @@ public enum EnumTemperature {
if (BiomeHelper.isBiomeHellish(biomeGenBase)) {
return HELLISH;
}
return getFromValue(biomeGenBase.temperature);
return getFromValue(biomeGenBase.getTemperature());
}
public static EnumTemperature getFromBiome(BiomeGenBase biomeGenBase, World world, BlockPos pos) {
@@ -16,7 +16,7 @@ import net.minecraft.block.material.Material;
public class MaterialBeehive extends Material {
public MaterialBeehive(boolean noHarvest) {
super(MapColor.stoneColor);
super(MapColor.STONE);
if (noHarvest) {
this.setRequiresTool();
}
@@ -29,7 +29,7 @@ public class VillageHandlerApiculture /*implements IVillageCreationHandler, IVil
recipeList.add(new MerchantRecipe(wildcardPrincess, new ItemStack(Items.emerald, 1)));
ItemStack randomComb = PluginApiculture.items.beeComb.getRandomComb(1, random, false);
recipeList.add(new MerchantRecipe(new ItemStack(Items.wheat, 2), randomComb));
recipeList.add(new MerchantRecipe(new ItemStack(Items.WHEAT, 2), randomComb));
ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockTypeApiculture.APIARY);
recipeList.add(new MerchantRecipe(new ItemStack(Blocks.log, 24, OreDictionary.WILDCARD_VALUE), apiary));
@@ -67,14 +67,14 @@ public class CommandBeeGive extends SubCommand {
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws SpeciesNotFoundException, TemplateNotFoundException, PlayerNotFoundException {
if (args.length < 2) {
printHelp(, sender);
printHelp(sender);
return;
}
IBeeGenome beeGenome = getBeeGenome(args[0]);
EnumBeeType beeType = getBeeType(args[1]);
if (beeType == null) {
printHelp(, sender);
printHelp(sender);
return;
}
@@ -85,7 +85,7 @@ public class CommandBeeGive extends SubCommand {
player = CommandBase.getPlayer(server, sender, sender.getName());
}
if (player == null) {
printHelp(, sender);
printHelp(sender);
return;
}
@@ -27,7 +27,7 @@ public class GrowthRuleDirtGrass implements IFlowerGrowthRule {
}
Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
if (ground != Blocks.dirt && ground != Blocks.grass) {
if (ground != Blocks.DIRT && ground != Blocks.GRASS) {
return false;
}
@@ -27,7 +27,7 @@ public class GrowthRuleMycelium implements IFlowerGrowthRule {
}
Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
if (ground != Blocks.mycelium) {
if (ground != Blocks.MYCELIUM) {
return false;
}
@@ -22,12 +22,12 @@ public class GrowthRuleSnow implements IFlowerGrowthRule {
@Override
public boolean growFlower(IFlowerGrowthHelper helper, String flowerType, World world, BlockPos pos) {
if (world.getBlockState(pos).getBlock() != Blocks.snow) {
if (world.getBlockState(pos).getBlock() != Blocks.SNOW) {
return false;
}
Block ground = world.getBlockState(new BlockPos(pos.getX(), pos.getY() - 1, pos.getZ())).getBlock();
if (ground != Blocks.dirt && ground != Blocks.grass) {
if (ground != Blocks.DIRT && ground != Blocks.GRASS) {
return false;
}
@@ -259,7 +259,7 @@ public enum BeeDefinition implements IBeeDefinition {
@Override
protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) {
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.COCOA, 1), 0.30f)
.addSpecialty(new ItemStack(Items.sugar), 0.15f);
.addSpecialty(new ItemStack(Items.SUGAR), 0.15f);
}
@Override
@@ -350,7 +350,7 @@ public enum BeeDefinition implements IBeeDefinition {
@Override
protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) {
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SIMMERING, 1), 0.45f)
.addProduct(new ItemStack(Items.glowstone_dust), 0.15f)
.addProduct(new ItemStack(Items.GLOWSTONE_DUST), 0.15f)
.setHasEffect()
.setTemperature(EnumTemperature.HELLISH)
.setHumidity(EnumHumidity.ARID);
@@ -684,7 +684,7 @@ public enum BeeDefinition implements IBeeDefinition {
@Override
protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) {
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.SILKY, 1), 0.30f)
.addProduct(new ItemStack(Items.egg), 0.10f)
.addProduct(new ItemStack(Items.EGG), 0.10f)
.setHasEffect()
.setIsNotCounted();
}
@@ -770,11 +770,11 @@ public enum BeeDefinition implements IBeeDefinition {
@Override
protected void setSpeciesProperties(IAlleleBeeSpeciesBuilder beeSpecies) {
beeSpecies.addProduct(PluginApiculture.items.beeComb.get(EnumHoneyComb.HONEY, 1), 0.40f)
.addProduct(new ItemStack(Items.cookie), 0.15f)
.addSpecialty(new ItemStack(Items.skull, 1, 0), 0.02f)
.addSpecialty(new ItemStack(Items.skull, 1, 2), 0.02f)
.addSpecialty(new ItemStack(Items.skull, 1, 3), 0.02f)
.addSpecialty(new ItemStack(Items.skull, 1, 4), 0.02f)
.addProduct(new ItemStack(Items.COOKIE), 0.15f)
.addSpecialty(new ItemStack(Items.SKULL, 1, 0), 0.02f)
.addSpecialty(new ItemStack(Items.SKULL, 1, 2), 0.02f)
.addSpecialty(new ItemStack(Items.SKULL, 1, 3), 0.02f)
.addSpecialty(new ItemStack(Items.SKULL, 1, 4), 0.02f)
.setHasEffect()
.setIsNotCounted();
}
@@ -35,7 +35,7 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
World world = housing.getWorld();
BlockPos housingCoords = housing.getCoordinates();
IBlockState state = world.getBlockState(housingCoords.add(0, -1, 0));
IBlockState state = world.getBlockState(housingCoords.down());
return ItemStackUtil.equals(state, blockRequired);
}
@@ -49,23 +49,23 @@ public class AlleleEffectResurrection extends AlleleEffectThrottled {
public static List<Resurrectable> getReanimationList() {
ArrayList<Resurrectable> list = new ArrayList<>();
list.add(new Resurrectable(new ItemStack(Items.bone), EntitySkeleton.class));
list.add(new Resurrectable(new ItemStack(Items.arrow), EntitySkeleton.class));
list.add(new Resurrectable(new ItemStack(Items.rotten_flesh), EntityZombie.class));
list.add(new Resurrectable(new ItemStack(Items.blaze_rod), EntityBlaze.class));
list.add(new Resurrectable(new ItemStack(Items.BONE), EntitySkeleton.class));
list.add(new Resurrectable(new ItemStack(Items.ARROW), EntitySkeleton.class));
list.add(new Resurrectable(new ItemStack(Items.ROTTEN_FLESH), EntityZombie.class));
list.add(new Resurrectable(new ItemStack(Items.BLAZE_ROD), EntityBlaze.class));
return list;
}
public static List<Resurrectable> getResurrectionList() {
ArrayList<Resurrectable> list = new ArrayList<>();
list.add(new Resurrectable(new ItemStack(Items.gunpowder), EntityCreeper.class));
list.add(new Resurrectable(new ItemStack(Items.ender_pearl), EntityEnderman.class));
list.add(new Resurrectable(new ItemStack(Items.string), EntitySpider.class));
list.add(new Resurrectable(new ItemStack(Items.spider_eye), EntitySpider.class));
list.add(new Resurrectable(new ItemStack(Items.string), EntityCaveSpider.class));
list.add(new Resurrectable(new ItemStack(Items.spider_eye), EntityCaveSpider.class));
list.add(new Resurrectable(new ItemStack(Items.ghast_tear), EntityGhast.class));
list.add(new Resurrectable(new ItemStack(Blocks.dragon_egg), EntityDragon.class));
list.add(new Resurrectable(new ItemStack(Items.GUNPOWDER), EntityCreeper.class));
list.add(new Resurrectable(new ItemStack(Items.ENDER_PEARL), EntityEnderman.class));
list.add(new Resurrectable(new ItemStack(Items.STRING), EntitySpider.class));
list.add(new Resurrectable(new ItemStack(Items.SPIDER_EYE), EntitySpider.class));
list.add(new Resurrectable(new ItemStack(Items.STRING), EntityCaveSpider.class));
list.add(new Resurrectable(new ItemStack(Items.SPIDER_EYE), EntityCaveSpider.class));
list.add(new Resurrectable(new ItemStack(Items.GHAST_TEAR), EntityGhast.class));
list.add(new Resurrectable(new ItemStack(Blocks.DRAGON_EGG), EntityDragon.class));
return list;
}
@@ -64,13 +64,13 @@ public class AlleleEffectSnowing extends AlleleEffectThrottled {
IBlockState state = world.getBlockState(posBlock);
Block block = state.getBlock();
if (block == Blocks.snow_layer) {
if (block == Blocks.SNOW_LAYER) {
int meta = block.getMetaFromState(state);
if (meta < 7) {
world.setBlockState(posBlock, block.getStateFromMeta(meta + 1), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
}
} else if (block.isReplaceable(world, posBlock)) {
world.setBlockState(posBlock, Blocks.snow_layer.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
world.setBlockState(posBlock, Blocks.SNOW_LAYER.getDefaultState(), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
}
}
@@ -27,6 +27,6 @@ public class ContainerAlveary extends ContainerTile<TileAlveary> {
public void detectAndSendChanges() {
super.detectAndSendChanges();
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
}
@@ -34,7 +34,7 @@ public class ContainerBeeHousing extends ContainerTile<TileBeeHousingBase> imple
if (this.beeProgress != beeProgress) {
this.beeProgress = beeProgress;
IForestryPacketClient packet = new PacketGuiUpdate(tile);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
}
@@ -33,7 +33,7 @@ public class ContainerMinecartBeehouse extends ContainerEntity<EntityMinecartBee
if (this.beeProgress != beeProgress) {
this.beeProgress = beeProgress;
IForestryPacketClient packet = new PacketGuiUpdateEntity(entity, entity);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
}
@@ -13,6 +13,7 @@ package forestry.apiculture.items;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
@@ -30,14 +31,14 @@ import forestry.core.config.Constants;
public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArmorNaturalist, IItemModelRegister {
public ItemArmorApiarist(int slot) {
super(ArmorMaterial.LEATHER, 0, slot);
public ItemArmorApiarist(EntityEquipmentSlot equipmentSlotIn) {
super(ArmorMaterial.LEATHER, 0, equipmentSlotIn);
this.setMaxDamage(100);
setCreativeTab(Tabs.tabApiculture);
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
if (stack != null && stack.getItem() == PluginApiculture.items.apiaristLegs) {
return Constants.RESOURCE_ID + ":" + Constants.TEXTURE_APIARIST_ARMOR_SECONDARY;
} else {
@@ -51,11 +52,6 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm
manager.registerItemModel(item, 0);
}
@Override
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
return 0xffffff;
}
@Override
public boolean hasColor(ItemStack itemstack) {
return false;
@@ -68,7 +64,7 @@ public class ItemArmorApiarist extends ItemArmor implements IArmorApiarist, IArm
@Override
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
return armorType == 0;
return armorType == EntityEquipmentSlot.HEAD;
}
}
@@ -75,7 +75,7 @@ public class ItemHabitatLocator extends ItemWithGui implements ISpriteRegister {
EnumTemperature temperature = EnumTemperature.getFromValue(temperatureValue);
EnumHumidity humidity = EnumHumidity.getFromValue(ForestryAPI.climateManager.getHumidity(player.worldObj, player.getPosition()));
list.add(Translator.translateToLocal("for.gui.currentBiome") + ": " + currentBiome.biomeName);
list.add(Translator.translateToLocal("for.gui.currentBiome") + ": " + currentBiome.getBiomeName());
list.add(Translator.translateToLocal("for.gui.temperature") + ": " + AlleleManager.climateHelper.toDisplay(temperature));
list.add(Translator.translateToLocal("for.gui.humidity") + ": " + AlleleManager.climateHelper.toDisplay(humidity));
}
@@ -57,16 +57,6 @@ public class ItemHoneyComb extends ItemForestry {
return super.getUnlocalizedName(stack) + "." + honeyComb.name;
}
@Override
public int getColorFromItemStack(ItemStack itemstack, int j) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[itemstack.getItemDamage()];
if (j == 1) {
return honeyComb.primaryColor;
} else {
return honeyComb.secondaryColor;
}
}
@Override
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
for (int i = 0; i < EnumHoneyComb.VALUES.length; i++) {
@@ -21,8 +21,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemMinecart;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -48,33 +50,33 @@ public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegi
super(null);
setMaxDamage(0);
setHasSubtypes(true);
BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior);
BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(this, dispenserMinecartBehavior);
}
@Override
public boolean onItemUse(ItemStack itemStack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!BlockRailBase.isRailBlock(world.getBlockState(pos))) {
return false;
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!BlockRailBase.isRailBlock(worldIn.getBlockState(pos))) {
return EnumActionResult.PASS;
}
if (!world.isRemote) {
if (!worldIn.isRemote) {
EntityMinecartBeeHousingBase entityMinecart;
if (itemStack.getItemDamage() == 0) {
entityMinecart = new EntityMinecartBeehouse(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F);
if (stack.getItemDamage() == 0) {
entityMinecart = new EntityMinecartBeehouse(worldIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F);
} else {
entityMinecart = new EntityMinecartApiary(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F);
entityMinecart = new EntityMinecartApiary(worldIn, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F);
}
entityMinecart.setOwner(player.getGameProfile());
entityMinecart.setOwner(playerIn.getGameProfile());
if (itemStack.hasDisplayName()) {
entityMinecart.setCustomNameTag(itemStack.getDisplayName());
if (stack.hasDisplayName()) {
entityMinecart.setCustomNameTag(stack.getDisplayName());
}
world.spawnEntityInWorld(entityMinecart);
worldIn.spawnEntityInWorld(entityMinecart);
}
--itemStack.stackSize;
return true;
--stack.stackSize;
return EnumActionResult.SUCCESS;
}
@Override
@@ -10,6 +10,8 @@
******************************************************************************/
package forestry.apiculture.items;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraftforge.oredict.OreDictionary;
import forestry.api.apiculture.EnumBeeType;
@@ -91,10 +93,10 @@ public class ItemRegistryApiculture extends ItemRegistry {
OreDictionary.registerOre("beeComb", beeComb.getWildcard());
// / APIARIST'S CLOTHES
apiaristHat = registerItem(new ItemArmorApiarist(0), "apiaristHelmet");
apiaristChest = registerItem(new ItemArmorApiarist(1), "apiaristChest");
apiaristLegs = registerItem(new ItemArmorApiarist(2), "apiaristLegs");
apiaristBoots = registerItem(new ItemArmorApiarist(3), "apiaristBoots");
apiaristHat = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.HEAD), "apiaristHelmet");
apiaristChest = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.CHEST), "apiaristChest");
apiaristLegs = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.LEGS), "apiaristLegs");
apiaristBoots = registerItem(new ItemArmorApiarist(EntityEquipmentSlot.FEET), "apiaristBoots");
// TOOLS
scoop = registerItem(new ItemScoop(), "scoop");
@@ -7,6 +7,9 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.Vec3d;
@@ -36,7 +39,7 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist {
}
@Override
public void onUsingTick(ItemStack stack, EntityPlayer player, int count) {
public void onUsingTick(ItemStack stack, EntityLivingBase player, int count) {
super.onUsingTick(stack, player, count);
World worldObj = player.worldObj;
addSmoke(worldObj, player, count % RANGE);
@@ -57,19 +60,19 @@ public class ItemSmoker extends ItemForestry implements IArmorApiarist {
}
@Override
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
return itemStackIn;
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
playerIn.setActiveHand(hand);
return new ActionResult<>(EnumActionResult.SUCCESS, itemStackIn);
}
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
TileEntity tileEntity = world.getTileEntity(pos);
if (tileEntity instanceof IHiveTile) {
IHiveTile hive = (IHiveTile) tileEntity;
hive.calmBees();
}
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ);
return super.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
}
@Override
@@ -22,7 +22,10 @@ import net.minecraft.world.IBlockAccess;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.apiculture.PluginApiculture;
import forestry.apiculture.blocks.BlockRegistryApiculture;
import forestry.apiculture.genetics.BeeGenome;
import forestry.apiculture.items.EnumHoneyComb;
import forestry.apiculture.items.ItemRegistryApiculture;
import forestry.apiculture.tiles.TileCandle;
import forestry.core.tiles.TileUtil;
@@ -30,30 +33,42 @@ public class ProxyApicultureClient extends ProxyApiculture {
@Override
public void initializeRendering() {
/*if (PluginApiculture.fancyRenderedBees) {
RenderingRegistry.registerEntityRenderingHandler(EntityBee.class, new RenderBeeEntity());
MinecraftForgeClient.registerItemRenderer(PluginApiculture.items.beeDroneGE, new RenderBeeItem());
MinecraftForgeClient.registerItemRenderer(PluginApiculture.items.beePrincessGE, new RenderBeeItem());
MinecraftForgeClient.registerItemRenderer(PluginApiculture.items.beeQueenGE, new RenderBeeItem());
}*/
Minecraft minecraft = Minecraft.getMinecraft();
ItemColors itemColors = minecraft.getItemColors();
BlockColors blockColors = minecraft.getBlockColors();
ItemRegistryApiculture items = PluginApiculture.items;
BlockRegistryApiculture blocks = PluginApiculture.blocks;
itemColors.registerItemColorHandler(new BeeItemColor(),
PluginApiculture.items.beeQueenGE,
PluginApiculture.items.beeDroneGE,
PluginApiculture.items.beeLarvaeGE,
PluginApiculture.items.beePrincessGE
items.beeQueenGE,
items.beeDroneGE,
items.beeLarvaeGE,
items.beePrincessGE
);
itemColors.registerItemColorHandler(new HoneyCombItemColor(),
items.beeComb
);
BlockColors blockColors = minecraft.getBlockColors();
blockColors.registerBlockColorHandler(new CandleBlockColor(),
PluginApiculture.blocks.candle,
PluginApiculture.blocks.stump
blocks.candle,
blocks.stump
);
}
private static class HoneyCombItemColor implements IItemColor {
@Override
public int getColorFromItemstack(ItemStack itemstack, int tintIndex) {
EnumHoneyComb honeyComb = EnumHoneyComb.VALUES[itemstack.getItemDamage()];
if (tintIndex == 1) {
return honeyComb.primaryColor;
} else {
return honeyComb.secondaryColor;
}
}
}
private static class BeeItemColor implements IItemColor {
@Override
public int getColorFromItemstack(ItemStack itemstack, int tintIndex) {
@@ -302,7 +302,7 @@ public class ComponentVillageBeeHouse extends StructureVillagePieces.House1 {
}
IBlockState blockState = world.getBlockState(posNew);
if (PluginApiculture.blocks.apiculture == blockState.getBlock() || !world.isBlockLoaded(posNew.add(0, -1, 0))) {
if (PluginApiculture.blocks.apiculture == blockState.getBlock() || !world.isBlockLoaded(posNew.down())) {
return;
}
@@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
@@ -76,7 +77,8 @@ public final class Hive {
}
public boolean canReplace(World world, BlockPos pos) {
return hiveDescription.getHiveGen().canReplace(world, pos);
IBlockState blockState = world.getBlockState(pos);
return hiveDescription.getHiveGen().canReplace(blockState, world, pos);
}
public int getYForHive(World world, int x, int z) {
@@ -46,14 +46,14 @@ public enum HiveDescription implements IHiveDescription {
postGenFlowers(world, pos, flowerStates);
}
},
MEADOWS(1, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)) {
MEADOWS(1, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
postGenFlowers(world, pos, flowerStates);
}
},
DESERT(2, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.sand, Blocks.sandstone)) {
DESERT(2, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SAND, Blocks.SANDSTONE)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
@@ -61,23 +61,23 @@ public enum HiveDescription implements IHiveDescription {
}
},
JUNGLE(3, 6.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
END(4, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.end_stone)) {
END(4, 6.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.END_STONE, Blocks.END_BRICKS)) {
@Override
public boolean isGoodBiome(BiomeGenBase biome) {
return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END);
}
},
SNOW(5, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow)) {
SNOW(5, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW)) {
@Override
public void postGen(World world, BlockPos pos) {
if (world.isAirBlock(pos.add(0, 1, 0))) {
world.setBlockState(pos.add(0, 1, 0), Blocks.snow_layer.getDefaultState(), 0);
world.setBlockState(pos.add(0, 1, 0), Blocks.SNOW_LAYER.getDefaultState(), 0);
}
postGenFlowers(world, pos, flowerStates);
}
},
SWAMP(6, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)) {
SWAMP(6, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS)) {
@Override
public void postGen(World world, BlockPos pos) {
super.postGen(world, pos);
@@ -86,16 +86,16 @@ public enum HiveDescription implements IHiveDescription {
}
};
private static final IHiveGen groundGen = HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow, Blocks.sand, Blocks.sandstone);
private static final IHiveGen groundGen = HiveManager.genHelper.ground(Blocks.DIRT, Blocks.GRASS, Blocks.SNOW, Blocks.SAND, Blocks.SANDSTONE);
private static final List<IBlockState> flowerStates = new ArrayList<>();
private static final List<IBlockState> mushroomStates = new ArrayList<>();
private static final List<IBlockState> cactusStates = Collections.singletonList(Blocks.cactus.getDefaultState());
private static final List<IBlockState> cactusStates = Collections.singletonList(Blocks.CACTUS.getDefaultState());
static {
flowerStates.addAll(Blocks.red_flower.getBlockState().getValidStates());
flowerStates.addAll(Blocks.yellow_flower.getBlockState().getValidStates());
mushroomStates.add(Blocks.red_mushroom.getDefaultState());
mushroomStates.add(Blocks.brown_mushroom.getDefaultState());
flowerStates.addAll(Blocks.RED_FLOWER.getBlockState().getValidStates());
flowerStates.addAll(Blocks.YELLOW_FLOWER.getBlockState().getValidStates());
mushroomStates.add(Blocks.RED_MUSHROOM.getDefaultState());
mushroomStates.add(Blocks.BROWN_MUSHROOM.getDefaultState());
}
private final int meta;
@@ -183,8 +183,9 @@ public enum HiveDescription implements IHiveDescription {
IPlantable plantable = (IPlantable) block;
BlockPos groundPos = blockPos.down();
Block ground = world.getBlockState(groundPos).getBlock();
if (!ground.canSustainPlant(world, groundPos, EnumFacing.UP, plantable)) {
IBlockState blockState = world.getBlockState(groundPos);
Block ground = blockState.getBlock();
if (!ground.canSustainPlant(blockState, world, groundPos, EnumFacing.UP, plantable)) {
world.setBlockToAir(blockPos);
plantedCount--;
}
@@ -38,7 +38,7 @@ public class HiveDescriptionSwarmer implements IHiveDescription {
@Override
public IHiveGen getHiveGen() {
return new HiveGenGround(Blocks.dirt, Blocks.grass);
return new HiveGenGround(Blocks.DIRT, Blocks.GRASS);
}
@Override
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.apiculture.worldgen;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -19,7 +20,7 @@ import forestry.core.utils.BlockUtil;
public abstract class HiveGen implements IHiveGen {
@Override
public boolean canReplace(World world, BlockPos pos) {
return BlockUtil.canReplace(world, pos);
public boolean canReplace(IBlockState blockState, World world, BlockPos pos) {
return BlockUtil.canReplace(blockState, world, pos);
}
}
@@ -15,25 +15,28 @@ import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.core.utils.BlockUtil;
public class HiveGenGround extends HiveGen {
private final Set<Material> groundMaterials = new HashSet<>();
public HiveGenGround(Block... groundBlocks) {
for (Block block : groundBlocks) {
groundMaterials.add(block.getMaterial());
IBlockState blockState = block.getDefaultState();
Material blockMaterial = block.getMaterial(blockState);
groundMaterials.add(blockMaterial);
}
}
@Override
public boolean isValidLocation(World world, BlockPos pos) {
Block ground = BlockUtil.getBlock(world, pos.add(0, -1, 0));
return groundMaterials.contains(ground.getMaterial());
IBlockState groundBlockState = world.getBlockState(pos.down());
Block groundBlock = groundBlockState.getBlock();
Material groundBlockMaterial = groundBlock.getMaterial(groundBlockState);
return groundMaterials.contains(groundBlockMaterial);
}
@Override
@@ -41,8 +44,12 @@ public class HiveGenGround extends HiveGen {
// get to the ground
BlockPos pos = world.getHeight(new BlockPos(x, 0, z));
while (pos.getY() >= 0 && (world.getBlockState(pos.down()).getBlock().isLeaves(world, pos.down()) || canReplace(world, pos.down()))) {
pos = pos.add(0, -1, 0);
IBlockState blockState = world.getBlockState(pos.down());
Block block = blockState.getBlock();
while (pos.getY() >= 0 && (block.isLeaves(blockState, world, pos.down()) || canReplace(blockState, world, pos.down()))) {
pos = pos.down();
blockState = world.getBlockState(pos);
block = blockState.getBlock();
}
return pos.getY();
@@ -11,6 +11,7 @@
package forestry.apiculture.worldgen;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -18,27 +19,31 @@ public class HiveGenTree extends HiveGen {
@Override
public boolean isValidLocation(World world, BlockPos pos) {
Block blockAbove = world.getBlockState(pos.add(0, 1, 0)).getBlock();
if (!blockAbove.isLeaves(world, pos.add(0, 1, 0))) {
IBlockState blockState = world.getBlockState(pos.up());
Block blockAbove = blockState.getBlock();
if (!blockAbove.isLeaves(blockState, world, pos.up())) {
return false;
}
// not a good location if right on top of something
return canReplace(world, pos.add(0, -1, 0));
return canReplace(blockState, world, pos.down());
}
@Override
public int getYForHive(World world, int x, int z) {
// get top leaf block
int y = world.getHeight(new BlockPos(x, 0, z)).getY() - 1;
if (!world.getBlockState(new BlockPos(x, y, z)).getBlock().isLeaves(world, new BlockPos(x, y, z))) {
BlockPos pos = new BlockPos(x, y, z);
IBlockState blockState = world.getBlockState(pos);
if (!blockState.getBlock().isLeaves(blockState, world, pos)) {
return -1;
}
// get to the bottom of the leaves
do {
y--;
} while (world.getBlockState(new BlockPos(x, y, z)).getBlock().isLeaves(world, new BlockPos(x, y, z)));
pos = pos.down();
blockState = world.getBlockState(pos);
} while (blockState.getBlock().isLeaves(blockState, world, pos));
return y;
}
@@ -28,6 +28,7 @@ import forestry.arboriculture.WoodHelper.WoodMeshDefinition;
import forestry.core.proxy.Proxies;
import net.minecraft.block.BlockFenceGate;
import net.minecraft.block.BlockPlanks.EnumType;
import net.minecraft.block.SoundType;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@@ -65,7 +65,7 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I
}
@Override
public ItemStack getPickBlock(RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) {
TileFruitPod tile = TileUtil.getTile(world, pos, TileFruitPod.class);
if (tile == null) {
return null;
@@ -88,9 +88,9 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I
tile.onBlockTick();
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
if (!world.isRemote) {
TileFruitPod tile = TileUtil.getTile(world, pos, TileFruitPod.class);
if (tile != null) {
@@ -100,7 +100,7 @@ public class BlockFruitPod extends BlockCocoa implements IStateMapperRegister, I
}
}
return super.removedByPlayer(world, pos, player, willHarvest);
return super.removedByPlayer(state, world, pos, player, willHarvest);
}
@Override
@@ -11,6 +11,7 @@
package forestry.arboriculture.blocks.property;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import java.util.ArrayList;
import java.util.List;
@@ -41,7 +41,7 @@ public final class TreeGenHelper {
public static void generateTree(WorldGenerator gen, EntityPlayer player, BlockPos pos) {
World world = player.worldObj;
if(world.isAirBlock(pos.add(0, -1, 0))){
if(world.isAirBlock(pos.down())){
pos = BlockUtil.getNextSolidDownPos(world, pos);
}else{
pos = BlockUtil.getNextReplaceableUpPos(world, pos);
@@ -156,7 +156,7 @@ public class Tree extends Individual implements ITree, IPlantable {
@Override
public boolean canStay(IBlockAccess world, BlockPos pos) {
BlockPos blockPos = pos.add(0, -1, 0);
BlockPos blockPos = pos.down();
IBlockState blockState = world.getBlockState(blockPos);
if (blockState == null) {
return false;
@@ -93,7 +93,7 @@ import forestry.core.tiles.TileUtil;
import forestry.core.utils.BlockUtil;
public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSerializable {
Oak(TreeBranchDefinition.QUERCUS, "appleOak", "robur", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 0, new ItemStack(Blocks.log, 1, 0)) {
Oak(TreeBranchDefinition.QUERCUS, "appleOak", "robur", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 0, new ItemStack(Blocks.LOG, 1, 0)) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenOak(tree);
@@ -116,7 +116,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
// vanilla
}
},
DarkOak(TreeBranchDefinition.QUERCUS, "darkOak", "velutina", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 5, new ItemStack(Blocks.log2, 1, 1)) {
DarkOak(TreeBranchDefinition.QUERCUS, "darkOak", "velutina", false, EnumLeafType.DECIDUOUS, new Color(4764952), new Color(4764952).brighter(), 5, new ItemStack(Blocks.LOG2, 1, 1)) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenDarkOak(tree);
@@ -139,7 +139,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
// vanilla
}
},
Birch(TreeBranchDefinition.BETULA, "silverBirch", "pendula", false, EnumLeafType.DECIDUOUS, new Color(8431445), new Color(0xb0c648), 2, new ItemStack(Blocks.log, 1, 2)) {
Birch(TreeBranchDefinition.BETULA, "silverBirch", "pendula", false, EnumLeafType.DECIDUOUS, new Color(8431445), new Color(0xb0c648), 2, new ItemStack(Blocks.LOG, 1, 2)) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenBirch(tree);
@@ -344,7 +344,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
registerMutation(Spruce, Larch, 5);
}
},
Spruce(TreeBranchDefinition.PICEA, "redSpruce", "abies", false, EnumLeafType.CONIFERS, new Color(6396257), new Color(0x539d12), 1, new ItemStack(Blocks.log, 1, 1)) {
Spruce(TreeBranchDefinition.PICEA, "redSpruce", "abies", false, EnumLeafType.CONIFERS, new Color(6396257), new Color(0x539d12), 1, new ItemStack(Blocks.LOG, 1, 1)) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenSpruce(tree);
@@ -464,7 +464,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
// only available by rare villager trade
}
},
Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x658917), 3, new ItemStack(Blocks.log, 1, 3)) {
Jungle(TreeBranchDefinition.TROPICAL, "jungle", "tectona", false, EnumLeafType.JUNGLE, new Color(4764952), new Color(0x658917), 3, new ItemStack(Blocks.LOG, 1, 3)) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenJungle(tree);
@@ -626,7 +626,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
registerMutation(Kapok, Ebony, 10);
}
},
AcaciaVanilla(TreeBranchDefinition.ACACIA, "acacia", "aneura", true, EnumLeafType.DECIDUOUS, new Color(0x616101), new Color(0xb3b302), 4, new ItemStack(Blocks.log2, 1, 0)) {
AcaciaVanilla(TreeBranchDefinition.ACACIA, "acacia", "aneura", true, EnumLeafType.DECIDUOUS, new Color(0x616101), new Color(0xb3b302), 4, new ItemStack(Blocks.LOG2, 1, 0)) {
@Override
public WorldGenerator getWorldGenerator(ITreeGenData tree) {
return new WorldGenAcaciaVanilla(tree);
@@ -1056,7 +1056,7 @@ public enum TreeDefinition implements ITreeDefinition, ITreeGenerator, IStringSe
tileLeaves.setOwner(owner);
tileLeaves.setTree(new Tree(genome));
world.markBlockForUpdate(pos);
world.markBlockRangeForRenderUpdate(pos, pos);
}
public static void initTrees() {
@@ -73,7 +73,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot {
private final ArrayList<ITreekeepingMode> treekeepingModes = new ArrayList<>();
public TreeRoot() {
setResearchSuitability(new ItemStack(Blocks.sapling, 1, OreDictionary.WILDCARD_VALUE), 1.0f);
setResearchSuitability(new ItemStack(Blocks.SAPLING, 1, OreDictionary.WILDCARD_VALUE), 1.0f);
}
@Override
@@ -260,7 +260,7 @@ public class TreeRoot extends SpeciesRoot implements ITreeRoot {
return false;
}
pod.setProperties(allele, sappiness);
world.markBlockForUpdate(pos);
world.markBlockRangeForRenderUpdate(pos, pos);
return true;
}
@@ -55,10 +55,10 @@ public class AlleleFruit extends AlleleCategorized implements IAlleleFruit {
public static void createAlleles() {
List<IAlleleFruit> fruitAlleles = Arrays.asList(
fruitNone = new AlleleFruit("none", new FruitProviderNone("for.fruits.none", null)),
fruitApple = new AlleleFruit("apple", new FruitProviderRandom("for.fruits.apple", EnumFruitFamily.POMES, new ItemStack(Items.apple), 1.0f)
fruitApple = new AlleleFruit("apple", new FruitProviderRandom("for.fruits.apple", EnumFruitFamily.POMES, new ItemStack(Items.APPLE), 1.0f)
.setColour(new Color(0xff2e2e))
.setOverlay("pomes")),
fruitCocoa = new AlleleFruit("cocoa", new FruitProviderPod("for.fruits.cocoa", EnumFruitFamily.JUNGLE, FruitProviderPod.EnumPodType.COCOA, new ItemStack(Items.dye, 1, EnumDyeColor.BROWN.getDyeDamage()))),
fruitCocoa = new AlleleFruit("cocoa", new FruitProviderPod("for.fruits.cocoa", EnumFruitFamily.JUNGLE, FruitProviderPod.EnumPodType.COCOA, new ItemStack(Items.DYE, 1, EnumDyeColor.BROWN.getDyeDamage()))),
// .setColours(0xecdca5, 0xc4d24a), true);
fruitChestnut = new AlleleFruit("chestnut", new FruitProviderRipening("for.fruits.chestnut", EnumFruitFamily.NUX, ItemFruit.EnumFruit.CHESTNUT.getStack(), 1.0f)
.setRipeningPeriod(6)
@@ -1,12 +1,16 @@
package forestry.arboriculture.items;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import forestry.arboriculture.blocks.BlockArbDoor;
@@ -17,26 +21,31 @@ public class ItemBlockWoodDoor extends ItemBlockWood<BlockArbDoor> {
super(block);
}
/** Copy of {@link ItemDoor#onItemUse} */
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
if (side != EnumFacing.UP) {
return false;
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (facing != EnumFacing.UP) {
return EnumActionResult.FAIL;
} else {
IBlockState iblockstate = worldIn.getBlockState(pos);
Block block = iblockstate.getBlock();
if (!block.isReplaceable(worldIn, pos)) {
pos = pos.offset(side);
pos = pos.offset(facing);
}
if (!playerIn.canPlayerEdit(pos, side, stack)) {
return false;
} else if (!this.block.canPlaceBlockAt(worldIn, pos)) {
return false;
} else {
ItemDoor.placeDoor(worldIn, pos, EnumFacing.fromAngle(playerIn.rotationYaw), this.block);
if (playerIn.canPlayerEdit(pos, facing, stack) && this.block.canPlaceBlockAt(worldIn, pos)) {
EnumFacing enumfacing = EnumFacing.fromAngle((double) playerIn.rotationYaw);
int x = enumfacing.getFrontOffsetX();
int z = enumfacing.getFrontOffsetZ();
boolean isRightHinge = x < 0 && hitZ < 0.5F || x > 0 && hitZ > 0.5F || z < 0 && hitX > 0.5F || z > 0 && hitX < 0.5F;
ItemDoor.placeDoor(worldIn, pos, enumfacing, this.block, isRightHinge);
SoundType soundtype = this.block.getSoundType();
worldIn.playSound(playerIn, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
--stack.stackSize;
return true;
return EnumActionResult.SUCCESS;
} else {
return EnumActionResult.FAIL;
}
}
}
@@ -12,14 +12,21 @@ package forestry.arboriculture.items;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -109,7 +116,6 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
}
@SideOnly(Side.CLIENT)
@Override
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
return getSpeciesOrDefault(itemstack).getGermlingColour(type, renderPass);
}
@@ -138,68 +144,65 @@ public class ItemGermlingGE extends ItemGE implements IVariableFermentable {
}
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) {
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
ITree tree = TreeManager.treeRoot.getMember(stack);
if (tree == null) {
return false;
return EnumActionResult.PASS;
}
if (type == EnumGermlingType.SAPLING) {
// x, y, z are the coordinates of the block "hit", can thus either be the soil or tall grass, etc.
int yShift;
if (!BlockUtil.isReplaceableBlock(world, pos)) {
if (!world.isAirBlock(new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()))) {
return false;
IBlockState hitBlock = worldIn.getBlockState(pos);
if (!BlockUtil.isReplaceableBlock(hitBlock, hitBlock.getBlock())) {
if (!worldIn.isAirBlock(pos.up())) {
return EnumActionResult.FAIL;
}
yShift = 1;
} else {
yShift = 0;
}
BlockPos posS = pos.add(0, yShift, 0);
if (!tree.canStay(world, posS)) {
return false;
pos = pos.up();
}
if (TreeManager.treeRoot.plantSapling(world, tree, player.getGameProfile(), posS)) {
Proxies.common.addBlockPlaceEffects(world, pos, world.getBlockState(posS));
if (!player.capabilities.isCreativeMode) {
if (!tree.canStay(worldIn, pos)) {
return EnumActionResult.FAIL;
}
if (TreeManager.treeRoot.plantSapling(worldIn, tree, playerIn.getGameProfile(), pos)) {
Proxies.common.addBlockPlaceEffects(worldIn, pos, worldIn.getBlockState(pos));
if (!playerIn.capabilities.isCreativeMode) {
stack.stackSize--;
}
return true;
return EnumActionResult.SUCCESS;
} else {
return false;
return EnumActionResult.FAIL;
}
} else if (type == EnumGermlingType.POLLEN) {
ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(world, pos);
ICheckPollinatable checkPollinatable = GeneticsUtil.getCheckPollinatable(worldIn, pos);
if (checkPollinatable == null) {
return false;
return EnumActionResult.PASS;
}
if (!checkPollinatable.canMateWith(tree)) {
return false;
return EnumActionResult.FAIL;
}
IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(player.getGameProfile(), world, pos);
IPollinatable pollinatable = GeneticsUtil.getOrCreatePollinatable(playerIn.getGameProfile(), worldIn, pos);
if (!pollinatable.canMateWith(tree)) {
return false;
return EnumActionResult.FAIL;
}
pollinatable.mateWith(tree);
Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, world, pos,
world.getBlockState(pos));
if (!player.capabilities.isCreativeMode) {
Proxies.common.sendFXSignal(PacketFXSignal.VisualFXType.BLOCK_DESTROY, PacketFXSignal.SoundFXType.LEAF, worldIn, pos,
worldIn.getBlockState(pos));
if (!playerIn.capabilities.isCreativeMode) {
stack.stackSize--;
}
return true;
return EnumActionResult.SUCCESS;
} else {
return false;
return EnumActionResult.PASS;
}
}
@@ -13,6 +13,7 @@ package forestry.arboriculture.items;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -34,15 +35,16 @@ public class ItemGrafter extends ItemForestryTool implements IToolGrafter {
}
@Override
public boolean canHarvestBlock(Block block, ItemStack itemStack) {
if (block instanceof BlockLeaves || block.getMaterial() == Material.leaves) {
public boolean canHarvestBlock(IBlockState state, ItemStack stack) {
Block block = state.getBlock();
if (block instanceof BlockLeaves || block.getMaterial(state) == Material.LEAVES) {
return true;
}
return super.canHarvestBlock(block, itemStack);
return super.canHarvestBlock(state, stack);
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLivingBase player) {
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) {
return true;
}
@@ -16,6 +16,10 @@ import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.BlockColors;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess;
@@ -26,6 +30,7 @@ import forestry.arboriculture.PluginArboriculture;
import forestry.arboriculture.blocks.BlockDecorativeLeaves;
import forestry.arboriculture.blocks.property.PropertyTreeType;
import forestry.arboriculture.genetics.TreeDefinition;
import forestry.arboriculture.items.ItemGermlingGE;
import forestry.arboriculture.models.ModelDecorativeLeaves;
import forestry.arboriculture.models.ModelLeaves;
import forestry.arboriculture.tiles.TileLeaves;
@@ -54,6 +59,9 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
Minecraft minecraft = Minecraft.getMinecraft();
BlockColors blockColors = minecraft.getBlockColors();
ItemColors itemColors = minecraft.getItemColors();
itemColors.registerItemColorHandler(new SaplingItemColor(), PluginArboriculture.items.sapling);
blockColors.registerBlockColorHandler(new LeavesBlockColor(), PluginArboriculture.blocks.leaves);
@@ -118,4 +126,15 @@ public class ProxyArboricultureClient extends ProxyArboriculture {
}
}
}
private static class SaplingItemColor implements IItemColor {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
Item item = stack.getItem();
if (item instanceof ItemGermlingGE) {
return ((ItemGermlingGE) item).getColorFromItemStack(stack, tintIndex);
}
return 0xffffff;
}
}
}
@@ -107,7 +107,7 @@ public abstract class TileTreeContainer extends TileEntity implements IStreamabl
public void setTree(ITree tree) {
this.containedTree = tree;
if (worldObj != null && worldObj.isRemote) {
worldObj.markBlockForUpdate(getPos());
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
}
}
@@ -15,6 +15,7 @@ import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
@@ -56,10 +57,10 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
}
}
private static final ITreeBlockType vineNorth = new TreeBlockType(Blocks.vine, 1);
private static final ITreeBlockType vineSouth = new TreeBlockType(Blocks.vine, 4);
private static final ITreeBlockType vineWest = new TreeBlockType(Blocks.vine, 8);
private static final ITreeBlockType vineEast = new TreeBlockType(Blocks.vine, 2);
private static final ITreeBlockType vineNorth = new TreeBlockType(Blocks.VINE, 1);
private static final ITreeBlockType vineSouth = new TreeBlockType(Blocks.VINE, 4);
private static final ITreeBlockType vineWest = new TreeBlockType(Blocks.VINE, 8);
private static final ITreeBlockType vineEast = new TreeBlockType(Blocks.VINE, 2);
private static final int minPodHeight = 3;
private static final BlockType air = new BlockTypeVoid();
@@ -198,8 +199,10 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
}
private void trySpawnFruitBlock(World world, BlockPos pos) {
if (BlockUtil.isReplaceableBlock(world, pos.add(startPos)) || world.isAirBlock(pos.add(startPos))) {
tree.trySpawnFruitBlock(world, pos.add(startPos));
pos = pos.add(startPos);
IBlockState blockState = world.getBlockState(pos);
if (BlockUtil.isReplaceableBlock(blockState, world, pos) || world.isAirBlock(pos)) {
tree.trySpawnFruitBlock(world, pos);
}
}
@@ -308,10 +311,12 @@ public abstract class WorldGenArboriculture extends WorldGenBase {
@Override
protected boolean addBlock(World world, BlockPos pos, ITreeBlockType type, EnumReplaceMode replace) {
pos = pos.add(startPos);
IBlockState blockState = world.getBlockState(pos);
if (replace == EnumReplaceMode.ALL
|| replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(world, startPos.add(pos))
|| world.isAirBlock(startPos.add(pos))) {
type.setBlock(world, tree, startPos.add(pos));
|| replace == EnumReplaceMode.SOFT && BlockUtil.isReplaceableBlock(blockState, world, pos)
|| world.isAirBlock(pos)) {
type.setBlock(world, tree, pos);
return true;
}
return false;
+61 -58
View File
@@ -58,6 +58,7 @@ import forestry.core.models.ModelManager;
import forestry.core.multiblock.MultiblockLogicFactory;
import forestry.core.network.IPacketRegistry;
import forestry.core.network.PacketRegistryCore;
import forestry.core.proxy.Proxies;
import forestry.core.recipes.RecipeUtil;
import forestry.core.render.TextureManager;
import forestry.core.utils.ClimateUtil;
@@ -127,6 +128,8 @@ public class PluginCore extends BlankForestryPlugin {
ForestryModEnvWarningCallable.register();
AlleleHelper.instance.init();
Proxies.render.initRendering();
}
@Override
@@ -154,55 +157,55 @@ public class PluginCore extends BlankForestryPlugin {
crateRegistry.registerCrate(blocks.soil.get(BlockSoil.SoilType.BOG_EARTH, 1));
// vanilla items
crateRegistry.registerCrate(Items.wheat);
crateRegistry.registerCrate(Items.cookie);
crateRegistry.registerCrate(Items.redstone);
crateRegistry.registerCrate(new ItemStack(Items.dye, 1, 4));
crateRegistry.registerCrate(Items.reeds);
crateRegistry.registerCrate(Items.clay_ball);
crateRegistry.registerCrate(Items.glowstone_dust);
crateRegistry.registerCrate(Items.apple);
crateRegistry.registerCrate(new ItemStack(Items.nether_wart));
crateRegistry.registerCrate(new ItemStack(Items.coal, 1, 1));
crateRegistry.registerCrate(new ItemStack(Items.coal, 1, 0));
crateRegistry.registerCrate(Items.wheat_seeds);
crateRegistry.registerCrate(Items.potato);
crateRegistry.registerCrate(Items.carrot);
crateRegistry.registerCrate(Items.WHEAT);
crateRegistry.registerCrate(Items.COOKIE);
crateRegistry.registerCrate(Items.REDSTONE);
crateRegistry.registerCrate(new ItemStack(Items.DYE, 1, 4));
crateRegistry.registerCrate(Items.REEDS);
crateRegistry.registerCrate(Items.CLAY_BALL);
crateRegistry.registerCrate(Items.GLOWSTONE_DUST);
crateRegistry.registerCrate(Items.APPLE);
crateRegistry.registerCrate(new ItemStack(Items.NETHER_WART));
crateRegistry.registerCrate(new ItemStack(Items.COAL, 1, 1));
crateRegistry.registerCrate(new ItemStack(Items.COAL, 1, 0));
crateRegistry.registerCrate(Items.WHEAT_SEEDS);
crateRegistry.registerCrate(Items.POTATO);
crateRegistry.registerCrate(Items.CARROT);
// vanilla blocks
crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 2));
crateRegistry.registerCrate(new ItemStack(Blocks.log, 1, 3));
crateRegistry.registerCrate(new ItemStack(Blocks.log2, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.log2, 1, 1));
crateRegistry.registerCrate(Blocks.cobblestone);
crateRegistry.registerCrate(new ItemStack(Blocks.dirt, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.dirt, 1, 2));
crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 3));
crateRegistry.registerCrate(new ItemStack(Blocks.stone, 1, 5));
crateRegistry.registerCrate(new ItemStack(Blocks.prismarine, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.prismarine, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.prismarine, 1, 2));
crateRegistry.registerCrate(Blocks.brick_block);
crateRegistry.registerCrate(Blocks.cactus);
crateRegistry.registerCrate(new ItemStack(Blocks.sand, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.sand, 1, 1));
crateRegistry.registerCrate(Blocks.obsidian);
crateRegistry.registerCrate(Blocks.netherrack);
crateRegistry.registerCrate(Blocks.soul_sand);
crateRegistry.registerCrate(Blocks.sandstone);
crateRegistry.registerCrate(Blocks.nether_brick);
crateRegistry.registerCrate(Blocks.mycelium);
crateRegistry.registerCrate(Blocks.gravel);
crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 2));
crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 3));
crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 4));
crateRegistry.registerCrate(new ItemStack(Blocks.sapling, 1, 5));
crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 2));
crateRegistry.registerCrate(new ItemStack(Blocks.LOG, 1, 3));
crateRegistry.registerCrate(new ItemStack(Blocks.LOG2, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.LOG2, 1, 1));
crateRegistry.registerCrate(Blocks.COBBLESTONE);
crateRegistry.registerCrate(new ItemStack(Blocks.DIRT, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.DIRT, 1, 2));
crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 3));
crateRegistry.registerCrate(new ItemStack(Blocks.STONE, 1, 5));
crateRegistry.registerCrate(new ItemStack(Blocks.PRISMARINE, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.PRISMARINE, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.PRISMARINE, 1, 2));
crateRegistry.registerCrate(Blocks.BRICK_BLOCK);
crateRegistry.registerCrate(Blocks.CACTUS);
crateRegistry.registerCrate(new ItemStack(Blocks.SAND, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.SAND, 1, 1));
crateRegistry.registerCrate(Blocks.OBSIDIAN);
crateRegistry.registerCrate(Blocks.NETHERRACK);
crateRegistry.registerCrate(Blocks.SOUL_SAND);
crateRegistry.registerCrate(Blocks.SANDSTONE);
crateRegistry.registerCrate(Blocks.NETHER_BRICK);
crateRegistry.registerCrate(Blocks.MYCELIUM);
crateRegistry.registerCrate(Blocks.GRAVEL);
crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 0));
crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 1));
crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 2));
crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 3));
crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 4));
crateRegistry.registerCrate(new ItemStack(Blocks.SAPLING, 1, 5));
}
@Override
@@ -255,13 +258,13 @@ public class PluginCore extends BlankForestryPlugin {
int compostWheatAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.wheat");
if (compostWheatAmount > 0) {
ItemStack compost = items.fertilizerBio.getItemStack(compostWheatAmount);
RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.dirt, 'X', "cropWheat");
RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', "cropWheat");
}
int compostAshAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.compost.ash");
if (compostAshAmount > 0) {
ItemStack compost = items.fertilizerBio.getItemStack(compostAshAmount);
RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.dirt, 'X', "dustAsh");
RecipeUtil.addRecipe(compost, " X ", "X#X", " X ", '#', Blocks.DIRT, 'X', "dustAsh");
}
int fertilizerApatiteAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.fertilizer.apatite");
@@ -280,20 +283,20 @@ public class PluginCore extends BlankForestryPlugin {
int humusCompostAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.humus.compost");
if (humusCompostAmount > 0) {
ItemStack humus = blocks.soil.get(BlockSoil.SoilType.HUMUS, humusCompostAmount);
RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.dirt, 'X', items.fertilizerBio);
RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.fertilizerBio);
}
int humusFertilizerAmount = ForestryAPI.activeMode.getIntegerSetting("recipe.output.humus.fertilizer");
if (humusFertilizerAmount > 0) {
ItemStack humus = blocks.soil.get(BlockSoil.SoilType.HUMUS, humusFertilizerAmount);
RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.dirt, 'X', items.fertilizerCompound);
RecipeUtil.addRecipe(humus, "###", "#X#", "###", '#', Blocks.DIRT, 'X', items.fertilizerCompound);
}
// Bog earth
int bogEarthOutputBucket = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.bucket");
if (bogEarthOutputBucket > 0) {
ItemStack bogEarth = blocks.soil.get(BlockSoil.SoilType.BOG_EARTH, bogEarthOutputBucket);
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', Items.water_bucket, 'Y', "sand");
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', Items.WATER_BUCKET, 'Y', "sand");
}
int bogEarthOutputCan = ForestryAPI.activeMode.getIntegerSetting("recipe.output.bogearth.can");
@@ -302,16 +305,16 @@ public class PluginCore extends BlankForestryPlugin {
ItemStack canWater = PluginFluids.items.getContainer(EnumContainerType.CAN, Fluids.WATER).getItemStack();
ItemStack waxCapsuleWater = PluginFluids.items.getContainer(EnumContainerType.CAPSULE, Fluids.WATER).getItemStack();
ItemStack refractoryWater = PluginFluids.items.getContainer(EnumContainerType.REFRACTORY, Fluids.WATER).getItemStack();
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', canWater, 'Y', "sand");
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', waxCapsuleWater, 'Y', "sand");
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.dirt, 'X', refractoryWater, 'Y', "sand");
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', canWater, 'Y', "sand");
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', waxCapsuleWater, 'Y', "sand");
RecipeUtil.addRecipe(bogEarth, "#Y#", "YXY", "#Y#", '#', Blocks.DIRT, 'X', refractoryWater, 'Y', "sand");
}
// Crafting Material
RecipeUtil.addRecipe(new ItemStack(Items.string), "#", "#", "#", '#', items.craftingMaterial.getSilkWisp());
RecipeUtil.addRecipe(new ItemStack(Items.STRING), "#", "#", "#", '#', items.craftingMaterial.getSilkWisp());
// / Pipette
RecipeUtil.addRecipe(items.pipette, " #", " X ", "X ", 'X', "paneGlass", '#', new ItemStack(Blocks.wool, 1, OreDictionary.WILDCARD_VALUE));
RecipeUtil.addRecipe(items.pipette, " #", " X ", "X ", 'X', "paneGlass", '#', new ItemStack(Blocks.WOOL, 1, OreDictionary.WILDCARD_VALUE));
// Storage Blocks
RecipeUtil.addRecipe(blocks.resourceStorage.get(EnumResourceType.APATITE), "###", "###", "###", '#', "gemApatite");
@@ -328,7 +331,7 @@ public class PluginCore extends BlankForestryPlugin {
// alternate recipes
if (!ForestryAPI.enabledPlugins.contains(ForestryPluginUids.APICULTURE)) {
RecipeManagers.centrifugeManager.addRecipe(5, new ItemStack(Items.string), ImmutableMap.of(
RecipeManagers.centrifugeManager.addRecipe(5, new ItemStack(Items.STRING), ImmutableMap.of(
items.craftingMaterial.getSilkWisp(), 0.15f
));
}
@@ -341,7 +341,7 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, EffectRenderer effectRenderer) {
P property = state.getValue(TYPE);
if(property.getMachineProperties() instanceof IMachinePropertiesTesr){
return ParticleHelper.addHitEffects(worldObj, this, target, effectRenderer, particleCallback);
return ParticleHelper.addBlockHitEffects(worldObj, target.getBlockPos(), target.sideHit, effectRenderer, particleCallback);
}
return false;
}
@@ -39,7 +39,7 @@ public abstract class BlockForestry extends Block implements IItemModelRegister,
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof IRestrictedAccess) {
@@ -49,7 +49,7 @@ public abstract class BlockForestry extends Block implements IItemModelRegister,
}
}
return super.removedByPlayer(world, pos, player, willHarvest);
return super.removedByPlayer(state, world, pos, player, willHarvest);
}
@Override
@@ -10,14 +10,18 @@
******************************************************************************/
package forestry.core.blocks.propertys;
import com.google.common.base.Optional;
import net.minecraft.block.properties.IProperty;
import java.util.List;
import forestry.api.arboriculture.IAlleleTreeSpecies;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IAllele;
import forestry.api.genetics.IAlleleProperty;
public abstract class PropertyAllele<A extends IAlleleProperty<A>> implements IProperty<A> {
protected final String name;
public PropertyAllele(String name) {
@@ -29,6 +33,17 @@ public abstract class PropertyAllele<A extends IAlleleProperty<A>> implements IP
return this.name;
}
@Override
public Optional<A> parseValue(String value) {
IAllele allele = AlleleManager.alleleRegistry.getAllele(value);
Class<A> valueClass = getValueClass();
if (valueClass.isInstance(allele)) {
A alleleValue = valueClass.cast(allele);
return Optional.of(alleleValue);
}
return Optional.absent();
}
@Override
public boolean equals(Object object) {
if (this == object) {
@@ -102,7 +102,7 @@ public class CommandHelpers {
public static boolean processStandardCommands(MinecraftServer server, ICommandSender sender, IForestryCommand command, String[] args) throws CommandException {
if (args.length >= 1) {
if (args[0].equals("help")) {
command.printHelp(, sender);
command.printHelp(sender);
return true;
}
for (SubCommand child : command.getChildren()) {
@@ -38,7 +38,7 @@ public class CommandModeInfo extends SubCommand {
@Override
public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
if (args.length <= 0) {
printHelp(, sender);
printHelp(sender);
return;
}
@@ -46,7 +46,7 @@ public class CommandModeInfo extends SubCommand {
if (modeName == null) {
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.info.error", args[0]);
printHelp(, sender);
printHelp(sender);
return;
}
@@ -34,7 +34,7 @@ public final class CommandModeSet extends SubCommand {
@Override
public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws WrongUsageException {
if (args.length == 0 || args.length > 2) {
printHelp(, sender);
printHelp(sender);
return;
}
@@ -45,7 +45,7 @@ public final class CommandModeSet extends SubCommand {
String modeName = modeSetter.getModeNameMatching(desired);
if (modeName == null) {
CommandHelpers.sendLocalizedChatMessage(sender, "for.chat.command.forestry.mode.set.error", desired);
printHelp(, sender);
printHelp(sender);
return;
}
@@ -18,6 +18,7 @@ import java.util.TreeSet;
import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import forestry.core.config.Constants;
@@ -50,8 +51,8 @@ public class RootCommand extends CommandBase implements IForestryCommand {
}
@Override
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
if (!CommandHelpers.processStandardCommands(sender, this, args)) {
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
if (!CommandHelpers.processStandardCommands(server, sender, this, args)) {
CommandHelpers.throwWrongUsage(sender, this);
}
}
@@ -73,8 +74,8 @@ public class RootCommand extends CommandBase implements IForestryCommand {
}
@Override
public List<String> addTabCompletionOptions(ICommandSender sender, String[] incomplete, BlockPos pos) {
return CommandHelpers.addStandardTabCompletionOptions(this, sender, incomplete, pos);
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) {
return CommandHelpers.addStandardTabCompletionOptions(server, this, sender, args, pos);
}
/* IForestryCommand */
@@ -95,7 +96,7 @@ public class RootCommand extends CommandBase implements IForestryCommand {
}
@Override
public void printHelp(MinecraftServer server, ICommandSender sender) {
public void printHelp(ICommandSender sender) {
CommandHelpers.printHelp(sender, this);
}
@@ -91,7 +91,7 @@ public abstract class SubCommand implements IForestryCommand {
}
public void executeSubCommand(MinecraftServer server, ICommandSender sender, String[] args) throws WrongUsageException, CommandException {
printHelp(, sender);
printHelp(sender);
}
public SubCommand setPermLevel(PermLevel permLevel) {
@@ -32,7 +32,7 @@ public class LocalizedConfiguration extends Configuration {
@Override
public boolean getBoolean(String category, String name, boolean defaultValue, String comment) {
Property prop = this.get(category, name, defaultValue);
prop.comment = comment + " [default: " + defaultValue + "]";
prop.setComment(comment + " [default: " + defaultValue + "]");
return prop.getBoolean(defaultValue);
}
@@ -67,7 +67,7 @@ public class LocalizedConfiguration extends Configuration {
Property prop = this.get(category, name, defaultValue);
prop.setValidValues(validValues);
prop.setLanguageKey(langKey);
prop.comment = comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]";
prop.setComment(comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]");
return prop.getString();
}
@@ -89,7 +89,7 @@ public class LocalizedConfiguration extends Configuration {
prop.setValidValues(validValues);
prop.setLanguageKey(langKey);
prop.comment = comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]";
prop.setComment(comment + " [default: " + defaultValue + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]");
String stringValue = prop.getString();
T enumValue = defaultValue;
@@ -123,7 +123,7 @@ public class LocalizedConfiguration extends Configuration {
Property prop = this.get(category, name, defaultValue);
prop.setLanguageKey(langKey);
prop.setValidValues(validValues);
prop.comment = comment + " [default: " + Arrays.toString(defaultValue) + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]";
prop.setComment(comment + " [default: " + Arrays.toString(defaultValue) + "] [valid: " + Arrays.toString(prop.getValidValues()) + "]");
return prop.getStringList();
}
@@ -65,7 +65,7 @@ public final class FluidHelper {
if (current.stackSize > 1) {
player.inventory.decrStackSize(player.inventory.currentItem, 1);
if (drainedContainer != null && !player.inventory.addItemStackToInventory(drainedContainer)) {
player.dropPlayerItemWithRandomChoice(drainedContainer, false);
player.dropItem(drainedContainer, false);
}
} else {
player.inventory.setInventorySlotContents(player.inventory.currentItem, drainedContainer);
@@ -155,7 +155,7 @@ public enum Fluids {
@Override
public List<ItemStack> getOtherContainers() {
return Collections.singletonList(
new ItemStack(Items.milk_bucket)
new ItemStack(Items.MILK_BUCKET)
);
}
},
@@ -18,6 +18,9 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
@@ -278,24 +281,23 @@ public class ItemResearchNote extends ItemForestry {
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (world.isRemote) {
return itemstack;
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
if (worldIn.isRemote) {
return ActionResult.newResult(EnumActionResult.PASS, itemStackIn);
}
ResearchNote note = new ResearchNote(itemstack.getTagCompound());
if (note.registerResults(world, entityplayer)) {
entityplayer.inventory.decrStackSize(entityplayer.inventory.currentItem, 1);
ResearchNote note = new ResearchNote(itemStackIn.getTagCompound());
if (note.registerResults(worldIn, playerIn)) {
playerIn.inventory.decrStackSize(playerIn.inventory.currentItem, 1);
// Notify player that his inventory has changed.
Proxies.net.inventoryChangeNotify(entityplayer);
Proxies.net.inventoryChangeNotify(playerIn);
}
return itemstack;
return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn);
}
@Override
public int getColorFromItemStack(ItemStack itemstack, int j) {
return 0xffe8a5;
}
// @Override
// public int getColorFromItemStack(ItemStack itemstack, int j) {
// return 0xffe8a5;
// }
}
@@ -69,7 +69,7 @@ public class ContainerEntity<T extends Entity & IInventory> extends ContainerFor
if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) {
PacketErrorUpdateEntity packet = new PacketErrorUpdateEntity(entity, errorLogicSource);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
previousErrorStates = errorStates;
@@ -81,7 +81,7 @@ public class ContainerEntity<T extends Entity & IInventory> extends ContainerFor
EnumAccess access = accessHandler.getAccess();
if (access != previousAccess) {
IForestryPacketClient packet = new PacketAccessUpdateEntity(restrictedAccess, entity);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
previousAccess = access;
}
@@ -18,7 +18,9 @@ import java.util.Map;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@@ -57,29 +59,29 @@ public abstract class ContainerForestry extends Container {
}
@Override
public ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) {
public ItemStack slotClick(int slotId, int dragType_or_button, ClickType clickTypeIn, EntityPlayer player) {
if (!canAccess(player)) {
return null;
}
if (modifier == 2 && button >= 0 && button < 9) {
if (clickTypeIn == ClickType.QUICK_MOVE && dragType_or_button >= 0 && dragType_or_button < 9) {
// hotkey used to move item from slot to hotbar
int hotbarSlotIndex = 27 + button;
int hotbarSlotIndex = 27 + dragType_or_button;
Slot hotbarSlot = getSlot(hotbarSlotIndex);
if (hotbarSlot instanceof SlotLocked) {
return null;
}
}
Slot slot = slotIndex < 0 ? null : getSlot(slotIndex);
Slot slot = slotId < 0 ? null : getSlot(slotId);
if (slot instanceof SlotForestry) {
SlotForestry slotForestry = (SlotForestry) slot;
if (slotForestry.isPhantom()) {
return SlotUtil.slotClickPhantom(slotForestry, button, modifier, player);
return SlotUtil.slotClickPhantom(slotForestry, dragType_or_button, clickTypeIn, player);
}
}
return super.slotClick(slotIndex, button, modifier, player);
return super.slotClick(slotId, dragType_or_button, clickTypeIn, player);
}
@Override
@@ -93,10 +95,10 @@ public abstract class ContainerForestry extends Container {
protected abstract boolean canAccess(EntityPlayer player);
protected final void sendPacketToCrafters(IForestryPacketClient packet) {
for (Object crafter : crafters) {
if (crafter instanceof EntityPlayer) {
Proxies.net.sendToPlayer(packet, (EntityPlayer) crafter);
protected final void sendPacketToListeners(IForestryPacketClient packet) {
for (ICrafting listener : listeners) {
if (listener instanceof EntityPlayer) {
Proxies.net.sendToPlayer(packet, (EntityPlayer) listener);
}
}
}
@@ -12,6 +12,7 @@ package forestry.core.gui;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@@ -50,8 +51,8 @@ public abstract class ContainerItemInventory<I extends ItemInventory> extends Co
}
@Override
public final ItemStack slotClick(int slotIndex, int button, int modifier, EntityPlayer player) {
ItemStack result = super.slotClick(slotIndex, button, modifier, player);
public ItemStack slotClick(int slotId, int dragType_or_button, ClickType clickTypeIn, EntityPlayer player) {
ItemStack result = super.slotClick(slotId, dragType_or_button, clickTypeIn, player);
inventory.onSlotClick(player);
return result;
}
@@ -42,7 +42,7 @@ public abstract class ContainerLiquidTanks<T extends TileEntity & ILiquidTankTil
@Override
public void detectAndSendChanges() {
super.detectAndSendChanges();
tile.getTankManager().updateGuiData(this, crafters);
tile.getTankManager().updateGuiData(this, listeners);
}
@Override
@@ -79,7 +79,7 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
if (previousErrorStates == null || !errorStates.equals(previousErrorStates)) {
PacketErrorUpdate packet = new PacketErrorUpdate(tile, errorLogicSource);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
previousErrorStates = errorStates;
@@ -90,7 +90,7 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
int energyManagerData = energyManager.toGuiInt();
if (energyManagerData != previousEnergyManagerData) {
PacketGuiEnergy packet = new PacketGuiEnergy(windowId, energyManagerData);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
previousEnergyManagerData = energyManagerData;
}
@@ -102,7 +102,7 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
EnumAccess access = accessHandler.getAccess();
if (access != previousAccess) {
IForestryPacketClient packet = new PacketAccessUpdate(restrictedAccess, tile);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
previousAccess = access;
}
@@ -127,7 +127,7 @@ public abstract class ContainerTile<T extends TileEntity> extends ContainerFores
if (guiNeedsUpdate) {
PacketGuiUpdate packet = new PacketGuiUpdate(tilePowered);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
}
}
@@ -26,7 +26,7 @@ import forestry.core.tiles.TileEscritoire;
import forestry.core.utils.Translator;
public class GuiEscritoire extends GuiForestry<ContainerEscritoire, TileEscritoire> {
private final ItemStack LEVEL_ITEM = new ItemStack(Items.paper);
private final ItemStack LEVEL_ITEM = new ItemStack(Items.PAPER);
private final EscritoireTextSource textSource = new EscritoireTextSource();
public GuiEscritoire(EntityPlayer player, TileEscritoire tile) {
+15 -10
View File
@@ -15,6 +15,7 @@ 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.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@@ -76,11 +77,13 @@ public class GuiHandler implements IGuiHandler {
switch (guiId.getGuiType()) {
case Item: {
ItemStack heldItem = player.getCurrentEquippedItem();
if (heldItem != null) {
Item item = heldItem.getItem();
if (guiId.getGuiHandlerClass().isInstance(item)) {
return ((IGuiHandlerItem) item).getGui(player, heldItem, data);
for (EnumHand hand : EnumHand.values()) {
ItemStack heldItem = player.getHeldItem(hand);
if (heldItem != null) {
Item item = heldItem.getItem();
if (guiId.getGuiHandlerClass().isInstance(item)) {
return ((IGuiHandlerItem) item).getGui(player, heldItem, data);
}
}
}
break;
@@ -114,11 +117,13 @@ public class GuiHandler implements IGuiHandler {
switch (guiId.getGuiType()) {
case Item: {
ItemStack heldItem = player.getCurrentEquippedItem();
if (heldItem != null) {
Item item = heldItem.getItem();
if (guiId.getGuiHandlerClass().isInstance(item)) {
return ((IGuiHandlerItem) item).getContainer(player, heldItem, data);
for (EnumHand hand : EnumHand.values()) {
ItemStack heldItem = player.getHeldItem(hand);
if (heldItem != null) {
Item item = heldItem.getItem();
if (guiId.getGuiHandlerClass().isInstance(item)) {
return ((IGuiHandlerItem) item).getContainer(player, heldItem, data);
}
}
}
break;
@@ -25,7 +25,7 @@ import forestry.core.tiles.EscritoireGame;
import forestry.core.tiles.EscritoireGameToken;
public class GameTokenWidget extends Widget {
private final ItemStack HIDDEN_TOKEN = new ItemStack(Items.book);
private final ItemStack HIDDEN_TOKEN = new ItemStack(Items.BOOK);
private final EscritoireGame game;
private final int index;
@@ -45,7 +45,7 @@ public enum StandardStackFilters implements IStackFilter {
FEED {
@Override
public boolean apply(ItemStack stack) {
return stack.getItem() instanceof ItemFood || stack.getItem() == Items.wheat || stack.getItem() instanceof ItemSeeds;
return stack.getItem() instanceof ItemFood || stack.getItem() == Items.WHEAT || stack.getItem() instanceof ItemSeeds;
}
};
@@ -14,7 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.text.ITextComponent;
/**
* @author CovertJaguar <http://www.railcraft.info/>
@@ -12,6 +12,7 @@ package forestry.core.items;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
@@ -28,13 +29,13 @@ import forestry.core.config.Constants;
public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist, IItemModelRegister {
public ItemArmorNaturalist() {
super(ArmorMaterial.LEATHER, 0, 0);
super(ArmorMaterial.LEATHER, 0, EntityEquipmentSlot.HEAD);
this.setMaxDamage(100);
setCreativeTab(CreativeTabForestry.tabForestry);
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot slot, String type) {
return Constants.RESOURCE_ID + ":" + Constants.TEXTURE_NATURALIST_ARMOR_PRIMARY;
}
@@ -44,11 +45,6 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist,
manager.registerItemModel(item, 0);
}
@Override
public int getColorFromItemStack(ItemStack itemstack, int renderPass) {
return 0xffffff;
}
@Override
public boolean hasColor(ItemStack itemstack) {
return false;
@@ -56,7 +52,7 @@ public class ItemArmorNaturalist extends ItemArmor implements IArmorNaturalist,
@Override
public boolean canSeePollination(EntityPlayer player, ItemStack armor, boolean doSee) {
return armorType == 0;
return armorType == EntityEquipmentSlot.HEAD;
}
}
@@ -43,22 +43,22 @@ public class ItemForestryTool extends ItemForestry {
}
@Override
public float getDigSpeed(ItemStack itemstack, IBlockState state) {
public float getStrVsBlock(ItemStack itemstack, IBlockState state) {
for (String type : getToolClasses(itemstack)) {
if (state.getBlock().isToolEffective(type, state)) {
return efficiencyOnProperMaterial;
}
}
return super.getDigSpeed(itemstack, state);
return super.getStrVsBlock(itemstack, state);
}
@SubscribeEvent
public void onDestroyCurrentItem(PlayerDestroyItemEvent event) {
if (event.original == null || event.original.getItem() != this) {
if (event.getOriginal() == null || event.getOriginal().getItem() != this) {
return;
}
EntityPlayer player = event.entityPlayer;
EntityPlayer player = event.getEntityPlayer();
World world = player.worldObj;
if (!world.isRemote && remnants != null) {
@@ -67,9 +67,10 @@ public class ItemForestryTool extends ItemForestry {
}
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, BlockPos pos, EntityLivingBase player) {
if (block.getBlockHardness(world, pos) != 0) {
stack.damageItem(1, player);
public boolean onBlockDestroyed(ItemStack stack, World worldIn, IBlockState state, BlockPos pos, EntityLivingBase entityLiving) {
Block block = state.getBlock();
if (block.getBlockHardness(state, worldIn, pos) != 0) {
stack.damageItem(1, entityLiving);
}
return true;
}
@@ -80,7 +80,6 @@ public class ItemOverlay extends ItemForestry {
return super.getUnlocalizedName(stack) + "." + overlays[stack.getItemDamage()].getUid();
}
@Override
public int getColorFromItemStack(ItemStack itemstack, int j) {
IOverlayInfo overlayInfo = overlays[itemstack.getItemDamage()];
if (j == 0 || overlayInfo.getSecondaryColor() == 0) {
@@ -13,6 +13,9 @@ package forestry.core.items;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.world.World;
import forestry.core.gui.ContainerItemInventory;
@@ -25,12 +28,12 @@ public abstract class ItemWithGui extends ItemForestry implements IGuiHandlerIte
}
@Override
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer) {
if (!world.isRemote) {
openGui(entityplayer);
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
if (!worldIn.isRemote) {
openGui(playerIn);
}
return itemstack;
return ActionResult.newResult(EnumActionResult.SUCCESS, itemStackIn);
}
protected void openGui(EntityPlayer entityplayer) {
@@ -23,41 +23,43 @@ import javax.vecmath.Vector4f;
import java.util.EnumMap;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.block.model.ItemOverrideList;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.renderer.vertex.VertexFormatElement;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.client.model.IFlexibleBakedModel;
import net.minecraftforge.client.model.TRSRTransformation;
import net.minecraftforge.client.model.pipeline.UnpackedBakedQuad;
import net.minecraftforge.client.model.pipeline.VertexTransformer;
import net.minecraftforge.common.model.TRSRTransformation;
// for those wondering TRSR stands for Translation Rotation Scale Rotation
public class TRSRBakedModel implements IFlexibleBakedModel {
public class TRSRBakedModel implements IBakedModel {
protected final ImmutableList<BakedQuad> general;
protected final ImmutableMap<EnumFacing, ImmutableList<BakedQuad>> faces;
protected final IFlexibleBakedModel original;
protected final IBakedModel original;
public TRSRBakedModel(IFlexibleBakedModel original, float x, float y, float z, float scale) {
public TRSRBakedModel(IBakedModel original, float x, float y, float z, float scale) {
this(original, x, y, z, 0, 0, 0, scale, scale, scale);
}
public TRSRBakedModel(IFlexibleBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scale) {
public TRSRBakedModel(IBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scale) {
this(original, x, y, z, rotX, rotY, rotZ, scale, scale, scale);
}
public TRSRBakedModel(IFlexibleBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ) {
public TRSRBakedModel(IBakedModel original, float x, float y, float z, float rotX, float rotY, float rotZ, float scaleX, float scaleY, float scaleZ) {
this(original, new TRSRTransformation(new Vector3f(x, y, z),
null,
new Vector3f(scaleX, scaleY, scaleZ),
TRSRTransformation.quatFromYXZ(rotY, rotX, rotZ)));
}
public TRSRBakedModel(IFlexibleBakedModel original, TRSRTransformation transform) {
public TRSRBakedModel(IBakedModel original, TRSRTransformation transform) {
this.original = original;
ImmutableList.Builder<BakedQuad> builder;
@@ -69,8 +71,8 @@ public class TRSRBakedModel implements IFlexibleBakedModel {
EnumMap<EnumFacing, ImmutableList<BakedQuad>> faces = Maps.newEnumMap(EnumFacing.class);
for (EnumFacing face : EnumFacing.values()) {
if (!original.isBuiltInRenderer()) {
for (BakedQuad quad : original.getFaceQuads(face)) {
Transformer transformer = new Transformer(transform, original.getFormat());
for (BakedQuad quad : original.getQuads(null, face, 0)) {
Transformer transformer = new Transformer(transform, quad.getFormat());
quad.pipe(transformer);
builder.add(transformer.build());
}
@@ -82,8 +84,8 @@ public class TRSRBakedModel implements IFlexibleBakedModel {
// general quads
//builder = ImmutableList.builder();
if (!original.isBuiltInRenderer()) {
for (BakedQuad quad : original.getGeneralQuads()) {
Transformer transformer = new Transformer(transform, original.getFormat());
for (BakedQuad quad : original.getQuads(null, null, 0)) {
Transformer transformer = new Transformer(transform, quad.getFormat());
quad.pipe(transformer);
builder.add(transformer.build());
}
@@ -94,12 +96,10 @@ public class TRSRBakedModel implements IFlexibleBakedModel {
}
@Override
public List<BakedQuad> getFaceQuads(EnumFacing side) {
return faces.get(side);
}
@Override
public List<BakedQuad> getGeneralQuads() {
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
if (side != null) {
return faces.get(side);
}
return general;
}
@@ -129,8 +129,8 @@ public class TRSRBakedModel implements IFlexibleBakedModel {
}
@Override
public VertexFormat getFormat() {
return original.getFormat();
public ItemOverrideList getOverrides() {
return null;
}
public static class Transformer extends VertexTransformer {
@@ -18,13 +18,13 @@ public class MultiblockEventHandler {
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onChunkLoad(ChunkEvent.Load loadEvent) {
Chunk chunk = loadEvent.getChunk();
World world = loadEvent.world;
World world = loadEvent.getWorld();
MultiblockRegistry.onChunkLoaded(world, chunk.xPosition, chunk.zPosition);
}
// Cleanup, for nice memory usageness
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onWorldUnload(WorldEvent.Unload unloadWorldEvent) {
MultiblockRegistry.onWorldUnloaded(unloadWorldEvent.world);
MultiblockRegistry.onWorldUnloaded(unloadWorldEvent.getWorld());
}
}
@@ -31,7 +31,7 @@ public class ProxyNetwork {
}
WorldServer worldServer = (WorldServer) world;
PlayerManager playerManager = worldServer.getPlayerManager();
PlayerManager playerManager = worldServer.getPlayerChunkMap();
int chunkX = packet.getPos().getX() >> 4;
int chunkZ = packet.getPos().getZ() >> 4;
@@ -45,6 +45,10 @@ public class ProxyRender {
return false;
}
public void initRendering() {
}
@Nullable
public TileEntitySpecialRenderer<TileBase> getRenderDefaultMachine(String gfxBase) {
return null;
@@ -103,9 +107,9 @@ public class ProxyRender {
public void registerModels() {
}
public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters){
return null;
}
// public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters){
// return null;
// }
/* FX */
@@ -25,6 +25,8 @@ import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.statemap.IStateMapper;
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.client.resources.IResourceManager;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
@@ -44,6 +46,7 @@ import net.minecraftforge.common.model.animation.IAnimationStateMachine;
import forestry.apiculture.entities.EntityFXBee;
import forestry.apiculture.render.ParticleRenderer;
import forestry.apiculture.render.TextureHabitatLocator;
import forestry.core.PluginCore;
import forestry.core.config.Config;
import forestry.core.config.Constants;
import forestry.core.entities.EntityFXHoneydust;
@@ -52,6 +55,7 @@ import forestry.core.entities.EntityFXSmoke;
import forestry.core.entities.EntityFXSnow;
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemCrated;
import forestry.core.items.ItemOverlay;
import forestry.core.models.BlockModelIndex;
import forestry.core.models.ModelIndex;
import forestry.core.models.ModelManager;
@@ -147,6 +151,28 @@ public class ProxyRenderClient extends ProxyRender {
// registerModel(new ModelIndex(modelLocation, new ModelCrate()));
}
@Override
public void initRendering() {
Minecraft minecraft = Minecraft.getMinecraft();
ItemColors itemColors = minecraft.getItemColors();
// itemColors.registerItemColorHandler(new ItemOverlayColor(),
// PluginCore.items.
// );
}
private static class ItemOverlayColor implements IItemColor {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
Item item = stack.getItem();
if (item instanceof ItemOverlay) {
return ((ItemOverlay) item).getColorFromItemStack(stack, tintIndex);
}
return 0xffffff;
}
}
@Override
public void registerFluidStateMapper(Block block, final Fluids forestryFluid) {
final ModelResourceLocation fluidLocation = new ModelResourceLocation("forestry:blockforestryfluid",
@@ -167,10 +193,10 @@ public class ProxyRenderClient extends ProxyRender {
ModelManager.registerModels();
}
@Override
public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters){
return Animation.INSTANCE.load(location, parameters);
}
// @Override
// public IAnimationStateMachine loadAnimationState(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters){
// return Animation.INSTANCE.load(location, parameters);
// }
private static boolean shouldSpawnParticle(World world) {
if (!Config.enableParticleFX) {
@@ -12,12 +12,16 @@ package forestry.core.render;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.IStringSerializable;
import forestry.core.blocks.BlockBase;
import forestry.core.blocks.IBlockType;
import forestry.core.blocks.IMachineProperties;
import forestry.core.blocks.IMachinePropertiesTesr;
import forestry.core.proxy.Proxies;
@@ -32,9 +36,15 @@ public class MachineParticleCallback<P extends Enum<P> & IBlockType & IStringSer
@Override
protected void setTexture(EntityDiggingFX fx, BlockPos pos, IBlockState state) {
P protety = state.getValue(TYPE);
if(protety.getMachineProperties() instanceof IMachinePropertiesTesr){
fx.setParticleIcon(Proxies.common.getClientInstance().getTextureMapBlocks().getAtlasSprite(((IMachinePropertiesTesr)protety.getMachineProperties()).getParticleTextureLocation()));
P property = state.getValue(TYPE);
IMachineProperties<?> machineProperties = property.getMachineProperties();
if(machineProperties instanceof IMachinePropertiesTesr){
Minecraft minecraft = Proxies.common.getClientInstance();
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
IMachinePropertiesTesr machinePropertiesTesr = (IMachinePropertiesTesr) machineProperties;
String particleTextureLocation = machinePropertiesTesr.getParticleTextureLocation();
TextureAtlasSprite particleTexture = textureMapBlocks.getAtlasSprite(particleTextureLocation);
fx.setParticleTexture(particleTexture);
}
}
@@ -14,8 +14,14 @@ import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityDiggingFX;
import net.minecraft.client.renderer.BlockModelShapes;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
@@ -35,42 +41,45 @@ public class ParticleHelper {
private static final Random rand = new Random();
@SideOnly(Side.CLIENT)
public static boolean addHitEffects(World world, Block block, RayTraceResult target, EffectRenderer effectRenderer, Callback callback) {
int x = target.getBlockPos().getX();
int y = target.getBlockPos().getY();
int z = target.getBlockPos().getZ();
public static boolean addBlockHitEffects(World world, BlockPos pos, EnumFacing side, EffectRenderer effectRenderer, Callback callback) {
IBlockState iblockstate = world.getBlockState(pos);
if(iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) {
int x = pos.getX();
int y = pos.getY();
int z = pos.getZ();
float f = 0.1F;
AxisAlignedBB axisalignedbb = iblockstate.getBoundingBox(world, pos);
double px = (double)x + world.rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - (double)(f * 2.0F)) + (double)f + axisalignedbb.minX;
double py = (double)y + world.rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - (double)(f * 2.0F)) + (double)f + axisalignedbb.minY;
double pz = (double)z + world.rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - (double)(f * 2.0F)) + (double)f + axisalignedbb.minZ;
if(side == EnumFacing.DOWN) {
py = (double)y + axisalignedbb.minY - (double)f;
}
EnumFacing sideHit = target.sideHit;
IBlockState state = world.getBlockState(target.getBlockPos());
if(side == EnumFacing.UP) {
py = (double)y + axisalignedbb.maxY + (double)f;
}
if (block != state.getBlock()) {
return true;
if(side == EnumFacing.NORTH) {
pz = (double)z + axisalignedbb.minZ - (double)f;
}
if(side == EnumFacing.SOUTH) {
pz = (double)z + axisalignedbb.maxZ + (double)f;
}
if(side == EnumFacing.WEST) {
px = (double)x + axisalignedbb.minX - (double)f;
}
if(side == EnumFacing.EAST) {
px = (double)x + axisalignedbb.maxX + (double)f;
}
EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, 0.0D, 0.0D, 0.0D, Block.getStateId(iblockstate));
callback.addHitEffects(fx, pos, iblockstate);
effectRenderer.addEffect(fx.setBlockPos(new BlockPos(x, y, z)).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
float b = 0.1F;
double px = x + rand.nextDouble() * (block.getBlockBoundsMaxX() - block.getBlockBoundsMinX() - b * 2.0F) + b + block.getBlockBoundsMinX();
double py = y + rand.nextDouble() * (block.getBlockBoundsMaxY() - block.getBlockBoundsMinY() - b * 2.0F) + b + block.getBlockBoundsMinY();
double pz = z + rand.nextDouble() * (block.getBlockBoundsMaxZ() - block.getBlockBoundsMinZ() - b * 2.0F) + b + block.getBlockBoundsMinZ();
if (sideHit == EnumFacing.DOWN) {
py = y + block.getBlockBoundsMinY() - b;
} else if (sideHit == EnumFacing.UP) {
py = y + block.getBlockBoundsMaxY() + b;
} else if (sideHit == EnumFacing.NORTH) {
pz = z + block.getBlockBoundsMinZ() - b;
} else if (sideHit == EnumFacing.SOUTH) {
pz = z + block.getBlockBoundsMaxZ() + b;
} else if (sideHit == EnumFacing.WEST) {
px = x + block.getBlockBoundsMinX() - b;
} else if (sideHit == EnumFacing.EAST) {
px = x + block.getBlockBoundsMaxX() + b;
}
EntityDiggingFX fx = (EntityDiggingFX) effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), px, py, pz, 0.0D, 0.0D, 0.0D, Block.getStateId(state));
callback.addHitEffects(fx, target.getBlockPos(), state);
effectRenderer.addEffect(fx.setBlockPos(new BlockPos(x, y, z)).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
return true;
}
@@ -138,7 +147,11 @@ public class ParticleHelper {
@SideOnly(Side.CLIENT)
protected void setTexture(EntityDiggingFX fx, BlockPos pos, IBlockState state) {
fx.setParticleIcon(Proxies.common.getClientInstance().getBlockRendererDispatcher().getBlockModelShapes().getTexture(state));
Minecraft minecraft = Proxies.common.getClientInstance();
BlockRendererDispatcher blockRendererDispatcher = minecraft.getBlockRendererDispatcher();
BlockModelShapes blockModelShapes = blockRendererDispatcher.getBlockModelShapes();
TextureAtlasSprite texture = blockModelShapes.getTexture(state);
fx.setParticleTexture(texture);
}
}
}
@@ -162,7 +162,7 @@ public class TileAnalyzer extends TilePowered implements ISidedInventory, ILiqui
public void handleItemStackForDisplay(ItemStack itemStack) {
if (!ItemStack.areItemStacksEqual(itemStack, individualOnDisplayClient)) {
individualOnDisplayClient = itemStack;
worldObj.markBlockForUpdate(getPos());
worldObj.markBlockRangeForRenderUpdate(getPos(), getPos());
}
}
@@ -307,8 +307,10 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
}
/* SMP GUI */
@Deprecated //use packets
public abstract void getGUINetworkData(int i, int j);
@Deprecated //use packets
public abstract void sendGUINetworkData(Container containerEngine, ICrafting iCrafting);
@Override
@@ -397,9 +397,9 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if(capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && inventory != null){
//noinspection unchecked
return (T) new SidedInvWrapper(inventory, facing);
if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && inventory != null){
SidedInvWrapper sidedInvWrapper = new SidedInvWrapper(inventory, facing);
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(sidedInvWrapper);
}
return super.getCapability(capability, facing);
}
@@ -13,6 +13,8 @@ package forestry.core.tiles;
import java.io.IOException;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.AxisAlignedBB;
import forestry.api.genetics.ISpeciesRoot;
@@ -87,7 +89,7 @@ public abstract class TileNaturalistChest extends TileBase implements IPagedInve
}
private void playLidSound(String sound) {
worldObj.playSoundEffect(getPos().getX() + 0.5, getPos().getY() + 0.5, getPos().getZ() + 0.5, sound, 0.5F, worldObj.rand.nextFloat() * 0.1F + 0.9F);
this.worldObj.playSound((EntityPlayer)null, getPos(), SoundEvents.BLOCK_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
}
@Override
@@ -297,7 +297,7 @@ public abstract class BlockUtil {
}
public static boolean canReplace(IBlockState blockState, World world, BlockPos pos) {
Block block = getBlock(world, pos);
Block block = blockState.getBlock();
Material material = block.getMaterial(blockState);
return material.isReplaceable() && block.isReplaceable(world, pos) && !material.isLiquid() || block.isAir(blockState, world, pos) || material == Material.PLANTS;
}
@@ -150,7 +150,7 @@ public class GeneticsUtil {
if (block == Blocks.leaves2) {
meta = meta + 4; //Dark Oak and Acacia are their own leaf block, but added on the end of sapling
}
block = Blocks.sapling;
block = Blocks.SAPLING;
}
ItemStack itemStack = new ItemStack(block, 1, meta);
IIndividual tree = getGeneticEquivalent(itemStack);
@@ -14,6 +14,7 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
@@ -26,7 +27,7 @@ public abstract class SlotUtil {
return slotIndex >= start && slotIndex < start + count;
}
public static ItemStack slotClickPhantom(SlotForestry slot, int mouseButton, int modifier, EntityPlayer player) {
public static ItemStack slotClickPhantom(SlotForestry slot, int mouseButton, ClickType clickTypeIn, EntityPlayer player) {
ItemStack stack = null;
ItemStack stackSlot = slot.getStack();
@@ -46,10 +47,10 @@ public abstract class SlotUtil {
fillPhantomSlot(slot, stackHeld, mouseButton);
}
} else if (stackHeld == null) {
adjustPhantomSlot(slot, mouseButton, modifier);
adjustPhantomSlot(slot, mouseButton, clickTypeIn);
} else if (slot.isItemValid(stackHeld)) {
if (ItemStackUtil.isIdenticalItem(stackSlot, stackHeld)) {
adjustPhantomSlot(slot, mouseButton, modifier);
adjustPhantomSlot(slot, mouseButton, clickTypeIn);
} else {
fillPhantomSlot(slot, stackHeld, mouseButton);
}
@@ -116,13 +117,13 @@ public abstract class SlotUtil {
}
}
private static void adjustPhantomSlot(SlotForestry slot, int mouseButton, int modifier) {
private static void adjustPhantomSlot(SlotForestry slot, int mouseButton, ClickType clickTypeIn) {
if (!slot.canAdjustPhantom()) {
return;
}
ItemStack stackSlot = slot.getStack();
int stackSize;
if (modifier == 1) {
if (clickTypeIn == ClickType.QUICK_MOVE) {
stackSize = mouseButton == 0 ? (stackSlot.stackSize + 1) / 2 : stackSlot.stackSize * 2;
} else {
stackSize = mouseButton == 0 ? stackSlot.stackSize - 1 : stackSlot.stackSize + 1;
@@ -14,43 +14,44 @@ import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@Deprecated
public final class VectUtil {
@Deprecated
public static boolean isAirBlock(World world, IVect position) {
public static boolean isAirBlock(World world, BlockPos position) {
return world.isAirBlock(position);
}
@Deprecated
public static boolean isWoodBlock(World world, IVect position) {
public static boolean isWoodBlock(World world, BlockPos position) {
Block block = getBlock(world, position);
return block.isWood(world, position);
}
@Deprecated
public static TileEntity getTile(World world, IVect position) {
public static TileEntity getTile(World world, BlockPos position) {
return world.getTileEntity(position);
}
@Deprecated
public static IBlockState getBlockState(World world, IVect position) {
public static IBlockState getBlockState(World world, BlockPos position) {
return world.getBlockState(position);
}
@Deprecated
public static Block getBlock(World world, IVect position) {
public static Block getBlock(World world, BlockPos position) {
return getBlockState(world, position).getBlock();
}
@Deprecated
public static int getBlockMeta(World world, IVect position) {
public static int getBlockMeta(World world, BlockPos position) {
return getBlock(world, position).getMetaFromState(getBlockState(world, position));
}
@Deprecated
public static ItemStack getAsItemStack(World world, IVect position) {
public static ItemStack getAsItemStack(World world, BlockPos position) {
return new ItemStack(getBlock(world, position), 1, getBlockMeta(world, position));
}
}
@@ -37,7 +37,7 @@ public class ContainerEngineBiogas extends ContainerLiquidTanks<TileEngineBiogas
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (ICrafting crafter : crafters) {
for (ICrafting crafter : listeners) {
tile.sendGUINetworkData(this, crafter);
}
}
@@ -39,7 +39,7 @@ public class ContainerEngineElectric extends ContainerSocketed<TileEngineElectri
if (tile != null) {
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
}
@@ -42,7 +42,7 @@ public class ContainerEnginePeat extends ContainerTile<TileEnginePeat> {
public void detectAndSendChanges() {
super.detectAndSendChanges();
for (ICrafting crafter : crafters) {
for (ICrafting crafter : listeners) {
tile.sendGUINetworkData(this, crafter);
}
}
@@ -135,7 +135,7 @@ public class PluginFactory extends BlankForestryPlugin {
FuelManager.fermenterFuel.put(mulch, new FermenterFuel(mulch, valueCompost, cyclesCompost));
// Add moistener resources
ItemStack wheat = new ItemStack(Items.wheat);
ItemStack wheat = new ItemStack(Items.WHEAT);
ItemStack mouldyWheat = coreItems.mouldyWheat.getItemStack();
ItemStack decayingWheat = coreItems.decayingWheat.getItemStack();
FuelManager.moistenerResource.put(wheat, new MoistenerFuel(wheat, mouldyWheat, 0, 300));
@@ -221,17 +221,17 @@ public class PluginFactory extends BlankForestryPlugin {
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.DIAMOND, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemDiamond"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.OBSIDIAN, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', Blocks.obsidian});
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', Blocks.OBSIDIAN});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.BLAZE, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', Items.blaze_powder});
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', Items.BLAZE_POWDER});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.EMERALD, 4), new Object[]{
" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemEmerald"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.APATITE, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', "gemApatite"});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.LAPIS, 4),
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', new ItemStack(Items.dye, 1, 4)});
new Object[]{" X ", "#X#", "XXX", '#', "dustRedstone", 'X', new ItemStack(Items.DYE, 1, 4)});
RecipeManagers.fabricatorManager.addRecipe(null, Fluids.GLASS.getFluid(500), electronTube.get(EnumElectronTube.ENDER, 4),
new Object[]{" X ", "#X#", "XXX", '#', new ItemStack(Items.ender_eye, 1, 0), 'X', new ItemStack(Blocks.end_stone, 1, 0)});
new Object[]{" X ", "#X#", "XXX", '#', new ItemStack(Items.ENDER_EYE, 1, 0), 'X', new ItemStack(Blocks.END_STONE, 1, 0)});
String[] dyes = {"dyeBlack", "dyeRed", "dyeGreen", "dyeBrown", "dyeBlue", "dyePurple", "dyeCyan", "dyeLightGray", "dyeGray", "dyePink", "dyeLime",
"dyeYellow", "dyeLightBlue", "dyeMagenta", "dyeOrange", "dyeWhite"};
@@ -241,12 +241,12 @@ public class PluginFactory extends BlankForestryPlugin {
FluidStack liquidGlass = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME);
FluidStack liquidGlassX4 = Fluids.GLASS.getFluid(Constants.BUCKET_VOLUME * 4);
for (int i = 0; i < 16; i++) {
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlass, new ItemStack(Blocks.stained_glass, 4, 15 - i), new Object[]{
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlass, new ItemStack(Blocks.STAINED_GLASS, 4, 15 - i), new Object[]{
"#", "X",
'#', dyes[i],
'X', beeItems.propolis.getWildcard()});
}
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.glass, 1, 0), new Object[]{
RecipeManagers.fabricatorManager.addRecipe(beeItems.waxCast.getWildcard(), liquidGlassX4, new ItemStack(Blocks.GLASS, 1, 0), new Object[]{
"#", "X",
'X', beeItems.propolis.getWildcard()});
}
@@ -254,52 +254,52 @@ public class PluginFactory extends BlankForestryPlugin {
// / SQUEEZER
int appleMulchAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.mulch.apple");
int appleJuiceAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.apple");
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.apple)}, Fluids.JUICE.getFluid(appleJuiceAmount),
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.APPLE)}, Fluids.JUICE.getFluid(appleJuiceAmount),
PluginCore.items.mulch.getItemStack(), appleMulchAmount);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.carrot)}, Fluids.JUICE.getFluid(appleJuiceAmount),
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.CARROT)}, Fluids.JUICE.getFluid(appleJuiceAmount),
PluginCore.items.mulch.getItemStack(), appleMulchAmount);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.carrot)}, Fluids.JUICE.getFluid(appleJuiceAmount),
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.CARROT)}, Fluids.JUICE.getFluid(appleJuiceAmount),
PluginCore.items.mulch.getItemStack(), appleMulchAmount);
int seedOilAmount = ForestryAPI.activeMode.getIntegerSetting("squeezer.liquid.seed");
FluidStack seedOil = Fluids.SEED_OIL.getFluid(seedOilAmount);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.wheat_seeds)}, seedOil);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.pumpkin_seeds)}, seedOil);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.melon_seeds)}, seedOil);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{PluginCore.items.phosphor.getItemStack(2), new ItemStack(Blocks.cobblestone)}, Fluids.LAVA.getFluid(1600));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.cactus)}, Fluids.WATER.getFluid(500));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.snowball), PluginCore.items.craftingMaterial.getIceShard(4)}, Fluids.ICE.getFluid(4000));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.WHEAT_SEEDS)}, seedOil);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.PUMPKIN_SEEDS)}, seedOil);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.MELON_SEEDS)}, seedOil);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{PluginCore.items.phosphor.getItemStack(2), new ItemStack(Blocks.COBBLESTONE)}, Fluids.LAVA.getFluid(1600));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Blocks.CACTUS)}, Fluids.WATER.getFluid(500));
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{new ItemStack(Items.SNOWBALL), PluginCore.items.craftingMaterial.getIceShard(4)}, Fluids.ICE.getFluid(4000));
// STILL
RecipeManagers.stillManager.addRecipe(Constants.STILL_DESTILLATION_DURATION, Fluids.BIOMASS.getFluid(Constants.STILL_DESTILLATION_INPUT),
Fluids.BIO_ETHANOL.getFluid(Constants.STILL_DESTILLATION_OUTPUT));
// MOISTENER
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Items.wheat_seeds), new ItemStack(Blocks.mycelium), 5000);
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.mossy_cobblestone), 20000);
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.stonebrick), new ItemStack(Blocks.stonebrick, 1, 1), 20000);
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Items.WHEAT_SEEDS), new ItemStack(Blocks.MYCELIUM), 5000);
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.COBBLESTONE), new ItemStack(Blocks.MOSSY_COBBLESTONE), 20000);
RecipeManagers.moistenerManager.addRecipe(new ItemStack(Blocks.STONEBRICK), new ItemStack(Blocks.STONEBRICK, 1, 1), 20000);
// FERMENTER
for (int i = 0; i < 6; i++) {
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.sapling, 1, i), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.SAPLING, 1, i), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.sapling"), Fluids.BIOMASS);
}
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.cactus), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cactus"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.wheat), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.potato), 2 * ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.reeds), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cane"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.brown_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.red_mushroom), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.CACTUS), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cactus"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.WHEAT), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.POTATO), 2 * ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.wheat"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Items.REEDS), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.cane"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.BROWN_MUSHROOM), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
RecipeUtil.addFermenterRecipes(new ItemStack(Blocks.RED_MUSHROOM), ForestryAPI.activeMode.getIntegerSetting("fermenter.yield.mushroom"), Fluids.BIOMASS);
// FABRICATOR
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.glass), Fluids.GLASS.getFluid(1000), 1000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.glass_pane), Fluids.GLASS.getFluid(375), 1000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sand), Fluids.GLASS.getFluid(1000), 3000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sand, 1, 1), Fluids.GLASS.getFluid(1000), 3000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone), Fluids.GLASS.getFluid(4000), 4800);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone, 1, 1), Fluids.GLASS.getFluid(4000), 4800);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.sandstone, 1, 2), Fluids.GLASS.getFluid(4000), 4800);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.GLASS), Fluids.GLASS.getFluid(1000), 1000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.GLASS_PANE), Fluids.GLASS.getFluid(375), 1000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SAND), Fluids.GLASS.getFluid(1000), 3000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SAND, 1, 1), Fluids.GLASS.getFluid(1000), 3000);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SANDSTONE), Fluids.GLASS.getFluid(4000), 4800);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SANDSTONE, 1, 1), Fluids.GLASS.getFluid(4000), 4800);
RecipeManagers.fabricatorSmeltingManager.addSmelting(new ItemStack(Blocks.SANDSTONE, 1, 2), Fluids.GLASS.getFluid(4000), 4800);
// / CARPENTER
RecipeManagers.carpenterManager.addRecipe(50, Fluids.SEED_OIL.getFluid(250), null, PluginCore.items.impregnatedCasing.getItemStack(),
@@ -325,7 +325,7 @@ public class PluginFactory extends BlankForestryPlugin {
"#",
'#', "logWood");
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(250), null,
new ItemStack(Items.paper, 1),
new ItemStack(Items.PAPER, 1),
"#",
"#",
'#', "pulpWood");
@@ -334,13 +334,13 @@ public class PluginFactory extends BlankForestryPlugin {
"###",
"#X#",
"###",
'#', Blocks.dirt,
'#', Blocks.DIRT,
'X', PluginCore.items.mulch);
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null,
PluginCore.blocks.soil.get(BlockSoil.SoilType.BOG_EARTH, 8),
"#X#",
"XYX", "#X#",
'#', Blocks.dirt,
'#', Blocks.DIRT,
'X', "sand",
'Y', PluginCore.items.mulch);
RecipeManagers.carpenterManager.addRecipe(75, Fluids.WATER.getFluid(5000), null, PluginCore.items.hardenedCasing.getItemStack(),
@@ -371,7 +371,7 @@ public class PluginFactory extends BlankForestryPlugin {
"#Y#",
"X#X",
'#', beeItems.pollenCluster.getWildcard(),
'X', Items.gunpowder,
'X', Items.GUNPOWDER,
'Y', PluginFluids.items.canEmpty,
'Z', beeItems.honeyDrop);
RecipeManagers.carpenterManager.addRecipe(5, Fluids.WATER.getFluid(1000), null, PluginCore.items.craftingMaterial.getDissipationCharge(),
@@ -379,13 +379,13 @@ public class PluginFactory extends BlankForestryPlugin {
"#Y#",
"X#X",
'#', beeItems.royalJelly,
'X', Items.gunpowder,
'X', Items.GUNPOWDER,
'Y', PluginFluids.items.canEmpty,
'Z', beeItems.honeydew);
}
// Ender pearl
RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ender_pearl, 1), " # ", "###", " # ", '#',
RecipeManagers.carpenterManager.addRecipe(100, null, new ItemStack(Items.ENDER_PEARL, 1), " # ", "###", " # ", '#',
PluginCore.items.craftingMaterial.getPulsatingMesh());
// Woven Silk
@@ -511,7 +511,7 @@ public class PluginFactory extends BlankForestryPlugin {
"B",
"W",
"C",
'B', Items.book,
'B', Items.BOOK,
'W', "craftingTableWood",
'C', "chestWood");
}
@@ -73,7 +73,7 @@ public class ContainerCarpenter extends ContainerLiquidTanks<TileCarpenter> impl
oldCraftPreview = newCraftPreview;
PacketItemStackDisplay packet = new PacketItemStackDisplay(tile, newCraftPreview);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
}
@@ -72,14 +72,14 @@ public class ContainerWorktable extends ContainerTile<TileWorktable> implements
if (craftMatrixChanged) {
craftMatrixChanged = false;
tile.setCurrentRecipe(craftMatrix);
sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile));
sendPacketToListeners(new PacketWorktableRecipeUpdate(tile));
}
super.detectAndSendChanges();
if (lastMemoryUpdate != tile.getMemory().getLastUpdate()) {
lastMemoryUpdate = tile.getMemory().getLastUpdate();
sendPacketToCrafters(new PacketWorktableMemoryUpdate(tile));
sendPacketToListeners(new PacketWorktableMemoryUpdate(tile));
}
}
@@ -130,13 +130,13 @@ public class ContainerWorktable extends ContainerTile<TileWorktable> implements
case -1: { // clicked clear button
tile.clearCraftMatrix();
updateCraftMatrix();
sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile));
sendPacketToListeners(new PacketWorktableRecipeUpdate(tile));
break;
}
case 0: { // clicked a memorized recipe
tile.chooseRecipeMemory(secondary);
updateCraftMatrix();
sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile));
sendPacketToListeners(new PacketWorktableRecipeUpdate(tile));
break;
}
case 1: { // right clicked a memorized recipe
@@ -147,12 +147,12 @@ public class ContainerWorktable extends ContainerTile<TileWorktable> implements
}
case 100: { // clicked previous recipe conflict button
tile.choosePreviousConflictRecipe();
sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile));
sendPacketToListeners(new PacketWorktableRecipeUpdate(tile));
break;
}
case 101: { // clicked next recipe conflict button
tile.chooseNextConflictRecipe();
sendPacketToCrafters(new PacketWorktableRecipeUpdate(tile));
sendPacketToListeners(new PacketWorktableRecipeUpdate(tile));
break;
}
}
@@ -11,7 +11,10 @@
package forestry.factory.tiles;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.SoundCategory;
import forestry.api.fuels.FuelManager;
import forestry.api.fuels.RainSubstrate;
@@ -30,21 +33,21 @@ public class TileMillRainmaker extends TileMill {
}
@Override
public void openGui(EntityPlayer player) {
public void openGui(EntityPlayer player, ItemStack heldItem) {
if (player.worldObj.isRemote) {
return;
}
if (player.inventory.getCurrentItem() == null) {
if (heldItem == null) {
return;
}
// We don't have a gui, but we can be activated
if (FuelManager.rainSubstrate.containsKey(player.inventory.getCurrentItem()) && charge == 0) {
RainSubstrate substrate = FuelManager.rainSubstrate.get(player.inventory.getCurrentItem());
if (substrate.getItem().isItemEqual(player.inventory.getCurrentItem())) {
if (FuelManager.rainSubstrate.containsKey(heldItem) && charge == 0) {
RainSubstrate substrate = FuelManager.rainSubstrate.get(heldItem);
if (substrate.getItem().isItemEqual(heldItem)) {
addCharge(substrate);
player.inventory.getCurrentItem().stackSize--;
heldItem.stackSize--;
}
}
sendNetworkUpdate();
@@ -83,8 +86,7 @@ public class TileMillRainmaker extends TileMill {
@Override
public void activate() {
if (Proxies.render.hasRendering()) {
worldObj.playSoundEffect(getPos().getX(), getPos().getY(), getPos().getZ(), "ambient.weather.thunder", 4F,
(1.0F + (worldObj.rand.nextFloat() - worldObj.rand.nextFloat()) * 0.2F) * 0.7F);
worldObj.playSound((EntityPlayer)null, getPos(), SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + worldObj.rand.nextFloat() * 0.2F);
float f = getPos().getX() + 0.5F;
float f1 = getPos().getY() + 0.0F + worldObj.rand.nextFloat() * 6F / 16F;
@@ -18,6 +18,7 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
@@ -165,7 +166,7 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
ItemStack container = null;
if (itemStack.getItem().hasContainerItem(itemStack)) {
container = itemStack.getItem().getContainerItem(itemStack);
container = ForgeHooks.getContainerItem(itemStack);
} else if (itemStack.stackSize > 1) {
// TerraFirmaCraft's crafting event handler does some tricky stuff with its tools.
// It sets the tool's stack size to 2 instead of using a container.
@@ -177,13 +178,8 @@ public class TileWorktable extends TileBase implements ICrafterWorktable {
continue;
}
if (container != null && container.isItemStackDamageable() && container.getItemDamage() > container.getMaxDamage()) {
MinecraftForge.EVENT_BUS.post(new PlayerDestroyItemEvent(player, container));
continue;
}
if (!InventoryUtil.tryAddStack(this, container, true)) {
player.dropPlayerItemWithRandomChoice(container, false);
player.dropItem(container, false);
}
}
@@ -26,11 +26,11 @@ import forestry.core.utils.vect.VectUtil;
public class FarmHelper {
public static final ImmutableSet<Block> bricks = ImmutableSet.of(
Blocks.brick_block,
Blocks.stonebrick,
Blocks.sandstone,
Blocks.nether_brick,
Blocks.quartz_block
Blocks.BRICK_BLOCK,
Blocks.STONEBRICK,
Blocks.SANDSTONE,
Blocks.NETHER_BRICK,
Blocks.QUARTZ_BLOCK
);
private static FarmDirection getOpposite(FarmDirection farmDirection) {
@@ -113,16 +113,16 @@ public class PluginFarming extends BlankForestryPlugin {
Farmables.farmables.get("farmOrchard").add(new FarmableBasicFruit(Blocks.carrots, 7));
Farmables.farmables.put("farmShroom", new ArrayList<>());
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.brown_mushroom, 0));
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.red_mushroom, 0));
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.BROWN_MUSHROOM, 0));
Farmables.farmables.get("farmShroom").add(new FarmableVanillaMushroom(Blocks.RED_MUSHROOM, 0));
Farmables.farmables.put("farmWheat", new ArrayList<>());
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.wheat_seeds), Blocks.wheat, 7));
Farmables.farmables.get("farmWheat").add(new FarmableGenericCrop(new ItemStack(Items.WHEAT_SEEDS), Blocks.wheat, 7));
Farmables.farmables.put("farmGourd", new ArrayList<>());
Farmables.farmables.get("farmGourd").add(
new FarmableGourd(new ItemStack(Items.pumpkin_seeds), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin)));
Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.melon_seeds), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block)));
new FarmableGourd(new ItemStack(Items.PUMPKIN_SEEDS), new ItemStack(Blocks.pumpkin_stem), new ItemStack(Blocks.pumpkin)));
Farmables.farmables.get("farmGourd").add(new FarmableGourd(new ItemStack(Items.MELON_SEEDS), new ItemStack(Blocks.melon_stem), new ItemStack(Blocks.melon_block)));
Farmables.farmables.put("farmInfernal", new ArrayList<>());
Farmables.farmables.get("farmInfernal").add(new FarmableGenericCrop(new ItemStack(Items.nether_wart), Blocks.nether_wart, 3));
@@ -131,11 +131,11 @@ public class PluginFarming extends BlankForestryPlugin {
Farmables.farmables.get("farmPoales").add(new FarmableStacked(Blocks.reeds, 3, 0));
Farmables.farmables.put("farmSucculentes", new ArrayList<>());
Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.cactus, 3, 0));
Farmables.farmables.get("farmSucculentes").add(new FarmableStacked(Blocks.CACTUS, 3, 0));
Farmables.farmables.put("farmVegetables", new ArrayList<>());
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.potato), Blocks.potatoes, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.carrot), Blocks.carrots, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.POTATO), Blocks.potatoes, 7));
Farmables.farmables.get("farmVegetables").add(new FarmableGenericCrop(new ItemStack(Items.CARROT), Blocks.carrots, 7));
proxy.initializeModels();
@@ -128,9 +128,9 @@ public class BlockFarm extends BlockStructure {
TileFarm tile = (TileFarm) world.getTileEntity(pos);
tile.setFarmBlockTexture(EnumFarmBlockTexture.getFromCompound(stack.getTagCompound()));
}
@Override
public boolean removedByPlayer(World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
if (!world.isRemote && canHarvestBlock(world, pos, player)) {
List<ItemStack> drops = getDrops(world, pos, BlockUtil.getBlockState(world, pos), 0);
for (ItemStack drop : drops) {
@@ -64,7 +64,7 @@ public class ContainerFarm extends ContainerSocketed<TileFarm> {
public void detectAndSendChanges() {
super.detectAndSendChanges();
PacketGuiUpdate packet = new PacketGuiUpdate(tile);
sendPacketToCrafters(packet);
sendPacketToListeners(packet);
}
public IFluidTank getTank(int slot) {
@@ -56,7 +56,7 @@ public class CropBasicGrowthCraft extends Crop {
}
if (isRice) {
world.setBlockState(pos.add(0, -1, 0), block.getStateFromMeta(7), Constants.FLAG_BLOCK_SYNCH);
world.setBlockState(pos.down(), block.getStateFromMeta(7), Constants.FLAG_BLOCK_SYNCH);
}
return harvest;
@@ -46,7 +46,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
}
public FarmLogicArboreal(IFarmHousing housing) {
super(housing, new ItemStack(Blocks.dirt), PluginCore.blocks.soil.get(BlockSoil.SoilType.HUMUS, 1), Farmables.farmables.get("farmArboreal"));
super(housing, new ItemStack(Blocks.DIRT), PluginCore.blocks.soil.get(BlockSoil.SoilType.HUMUS, 1), Farmables.farmables.get("farmArboreal"));
}
@Override
@@ -71,7 +71,7 @@ public class FarmLogicArboreal extends FarmLogicHomogeneous {
@SideOnly(Side.CLIENT)
@Override
public Item getItem() {
return Item.getItemFromBlock(Blocks.sapling);
return Item.getItemFromBlock(Blocks.SAPLING);
}
@Override
@@ -37,7 +37,7 @@ public class FarmLogicCereal extends FarmLogicCrops {
@Override
@SideOnly(Side.CLIENT)
public Item getItem() {
return Items.wheat;
return Items.WHEAT;
}
}
Loaded 100 of 143 files, more files were not shown because too many files have changed in this diff. Show more