-Update 0.0.6.0

This commit is contained in:
Ellpeck 2015-06-21 02:28:49 +02:00
parent ec8d5303e5
commit fb535bb9ec
57 changed files with 1687 additions and 354 deletions

View file

@ -18,7 +18,7 @@ buildscript {
apply plugin: 'forge'
apply plugin: 'maven'
version = "1.7.10-0.0.5.7"
version = "1.7.10-0.0.6.0"
group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions"

View file

@ -13,6 +13,7 @@ import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.config.ConfigurationHandler;
import ellpeck.actuallyadditions.crafting.GrinderCrafting;
import ellpeck.actuallyadditions.crafting.InitCrafting;
import ellpeck.actuallyadditions.crafting.ItemCrafting;
import ellpeck.actuallyadditions.event.InitEvents;
import ellpeck.actuallyadditions.gen.InitVillager;
import ellpeck.actuallyadditions.gen.OreGen;
@ -36,7 +37,7 @@ public class ActuallyAdditions{
@SidedProxy(clientSide = "ellpeck.actuallyadditions.proxy.ClientProxy", serverSide = "ellpeck.actuallyadditions.proxy.ServerProxy")
public static IProxy proxy;
@EventHandler()
@EventHandler
public void preInit(FMLPreInitializationEvent event){
Util.logInfo("Starting PreInitialization Phase...");
@ -52,8 +53,7 @@ public class ActuallyAdditions{
Util.logInfo("PreInitialization Finished.");
}
@SuppressWarnings("unused")
@EventHandler()
@EventHandler
public void init(FMLInitializationEvent event){
Util.logInfo("Starting Initialization Phase...");
@ -69,13 +69,13 @@ public class ActuallyAdditions{
Util.logInfo("Initialization Finished.");
}
@SuppressWarnings("unused")
@EventHandler()
@EventHandler
public void postInit(FMLPostInitializationEvent event){
Util.logInfo("Starting PostInitialization Phase...");
GrinderCrafting.init();
ItemCoffee.initIngredients();
GrinderCrafting.init();
ItemCrafting.initMashedFoodRecipes();
proxy.postInit();
Util.logInfo("PostInitialization Finished.");

View file

@ -97,3 +97,15 @@
-XP Solidifier
-Block that creates Solidified Experience from Player's Levels
-Has a GUI with Buttons
-Alarm
-Gets triggered when Mobs are in the Area
-Configurable Range
-Configurable Mobs
-Industrial Fertilizer
-Grows the whole Plant with one Click
-Dog Bones
-Breed Dogs faster
-Makes them have Babies too

View file

@ -20,6 +20,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class BlockCoalGenerator extends BlockContainerBase implements INameableItem{
@ -30,6 +31,19 @@ public class BlockCoalGenerator extends BlockContainerBase implements INameableI
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
this.setTickRandomly(true);
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
int meta = world.getBlockMetadata(x, y, z);
if (meta == 1){
for(int i = 0; i < 5; i++){
world.spawnParticle("smoke", (double)x+0.5F, (double)y + 1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
}
}
}
@Override

View file

@ -0,0 +1,122 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityEnergizer;
import ellpeck.actuallyadditions.tile.TileEntityEnervator;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
public class BlockEnergizer extends BlockContainerBase implements INameableItem{
private IIcon topIcon;
private IIcon sideIcon;
private boolean isEnergizer;
public BlockEnergizer(boolean isEnergizer){
super(Material.rock);
this.isEnergizer = isEnergizer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(2.0F);
this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return this.isEnergizer ? new TileEntityEnergizer() : new TileEntityEnervator();
}
@Override
public IIcon getIcon(int side, int meta){
return side == 1 ? this.topIcon : (side == 0 ? this.blockIcon : this.sideIcon);
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
this.sideIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Side");
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){
if(!world.isRemote){
if(this.isEnergizer){
TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(x, y, z);
if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.ENERGIZER_ID, world, x, y, z);
}
else{
TileEntityEnervator energizer = (TileEntityEnervator)world.getTileEntity(x, y, z);
if(energizer != null) player.openGui(ActuallyAdditions.instance, GuiHandler.ENERVATOR_ID, world, x, y, z);
}
return true;
}
return true;
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z);
super.breakBlock(world, x, y, z, block, par6);
}
@Override
public String getName(){
return this.isEnergizer ? "blockEnergizer" : "blockEnervator";
}
public static class TheItemBlock extends ItemBlock{
private Block theBlock;
public TheItemBlock(Block block){
super(block);
this.theBlock = block;
this.setHasSubtypes(false);
this.setMaxDamage(0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.uncommon;
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
BlockUtil.addInformation(theBlock, list, 2, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble;
import ellpeck.actuallyadditions.util.BlockUtil;
@ -171,7 +172,7 @@ public class BlockFurnaceDouble extends BlockContainerBase implements INameableI
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
BlockUtil.addInformation(theBlock, list, 1, "");
BlockUtil.addPowerUsageInfo(list, TileEntityFurnaceDouble.energyUsePerTick);
BlockUtil.addPowerUsageInfo(list, ConfigIntValues.FURNACE_ENERGY_USED.getValue());
}
@Override

View file

@ -21,12 +21,10 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class BlockItemRepairer extends BlockContainerBase implements INameableItem{
private IIcon topIcon;
private IIcon onIcon;
private IIcon bottomIcon;
public BlockItemRepairer(){
@ -54,24 +52,16 @@ public class BlockItemRepairer extends BlockContainerBase implements INameableIt
@Override
public IIcon getIcon(int side, int meta){
if(side == 1 && meta != 1) return this.topIcon;
if(side == 1) return this.onIcon;
if(side == 1) return this.topIcon;
if(side == 0) return this.bottomIcon;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
this.onIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "On");
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Bottom");
}

View file

@ -20,6 +20,7 @@ import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
import java.util.Random;
public class BlockOilGenerator extends BlockContainerBase implements INameableItem{
@ -30,6 +31,19 @@ public class BlockOilGenerator extends BlockContainerBase implements INameableIt
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
this.setTickRandomly(true);
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand){
int meta = world.getBlockMetadata(x, y, z);
if (meta == 1){
for(int i = 0; i < 5; i++){
world.spawnParticle("smoke", (double)x+0.5F, (double)y + 1.0F, (double)z+0.5F, 0.0D, 0.0D, 0.0D);
}
}
}
@Override

View file

@ -21,7 +21,6 @@ import powercrystals.minefactoryreloaded.api.HarvestType;
import powercrystals.minefactoryreloaded.api.IFactoryFertilizable;
import powercrystals.minefactoryreloaded.api.IFactoryHarvestable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Random;
@ -31,7 +30,8 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar
private IIcon[] textures;
private String name;
public Item seedItem;
public ItemStack returnItem;
public Item returnItem;
public int returnMeta;
private int minDropAmount;
private int addDropAmount;
@ -48,25 +48,8 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar
}
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune){
ArrayList<ItemStack> ret = super.getDrops(world, x, y, z, metadata, fortune);
if(metadata >= 7){
for(int i = 0; i < 3; ++i){
if(world.rand.nextInt(6) == 0) ret.add(new ItemStack(this.seedItem));
}
ItemStack stack = this.returnItem.copy();
stack.stackSize = new Random().nextInt(addDropAmount)+minDropAmount;
ret.add(stack);
}
else ret.add(new ItemStack(this.seedItem));
return ret;
}
@Override
public Item getItemDropped(int meta, Random rand, int i){
return null;
public int quantityDropped(int meta, int fortune, Random random){
return random.nextInt(addDropAmount)+minDropAmount;
}
@Override
@ -89,9 +72,24 @@ public class BlockPlant extends BlockCrops implements INameableItem, IFactoryHar
return this.seedItem;
}
@Override
public Item getItemDropped(int meta, Random rand, int par3){
return meta >= 7 ? this.func_149865_P() : this.func_149866_i();
}
@Override
public Item func_149865_P(){
return this.returnItem.getItem();
return this.returnItem;
}
@Override
public int damageDropped(int meta){
return this.returnMeta;
}
@Override
public int getDamageValue(World world, int x, int y, int z){
return 0;
}
@Override

View file

@ -64,9 +64,18 @@ public class InitBlocks{
public static Block blockPhantomBooster;
public static Block blockEnergizer;
public static Block blockEnervator;
public static void init(){
Util.logInfo("Initializing Blocks...");
blockEnergizer = new BlockEnergizer(true);
BlockUtil.register(blockEnergizer, BlockEnergizer.TheItemBlock.class);
blockEnervator = new BlockEnergizer(false);
BlockUtil.register(blockEnervator, BlockEnergizer.TheItemBlock.class);
blockLavaFactoryController = new BlockLavaFactoryController();
BlockUtil.register(blockLavaFactoryController, BlockLavaFactoryController.TheItemBlock.class);

View file

@ -12,7 +12,8 @@ public enum ConfigCategories{
WORLD_GEN("world gen"),
POTION_RING_CRAFTING("ring crafting"),
OTHER("other"),
FLUIDS("fluids");
FLUIDS("fluids"),
DRILL_VALUES("drill values");
public final String name;

View file

@ -94,7 +94,18 @@ public enum ConfigCrafting{
ENDER_CASING("Ender Casing", ConfigCategories.BLOCKS_CRAFTING),
PHANTOM_BOOSTER("Phantom Booster", ConfigCategories.BLOCKS_CRAFTING),
COFFEE_MACHINE("Coffee Machine", ConfigCategories.BLOCKS_CRAFTING),
LAVA_FACTORY("Lava Factory", ConfigCategories.BLOCKS_CRAFTING);
LAVA_FACTORY("Lava Factory", ConfigCategories.BLOCKS_CRAFTING),
DRILL("Drill", ConfigCategories.ITEMS_CRAFTING),
DRILL_SPEED("Drill Speed Upgrades", ConfigCategories.ITEMS_CRAFTING),
DRILL_FORTUNE("Drill Fortune Upgrades", ConfigCategories.ITEMS_CRAFTING),
DRILL_SIZE("Drill Size Upgrades", ConfigCategories.ITEMS_CRAFTING),
DRILL_PLACING("Drill Placing Upgrade", ConfigCategories.ITEMS_CRAFTING),
DRILL_SILK_TOUCH("Drill Silk Touch Upgrade", ConfigCategories.ITEMS_CRAFTING),
BATTERY("Battery", ConfigCategories.ITEMS_CRAFTING),
ENERGIZER("Energizer", ConfigCategories.BLOCKS_CRAFTING),
ENERVATOR("Enervator", ConfigCategories.BLOCKS_CRAFTING);
public final String name;
public final String category;

View file

@ -9,7 +9,9 @@ public enum ConfigFloatValues{
EMERALD_MAX_DAMAGE("Emerald: Damage", ConfigCategories.TOOL_VALUES, 5.0F, 0.1F, 50.0F, "How much damage an Emerald Tool deals"),
OBSIDIAN_SPEED("Obsidian: Efficiency", ConfigCategories.TOOL_VALUES, 4.0F, 1.0F, 20.0F, "How fast Obsidian Tools are"),
OBSIDIAN_MAX_DAMAGE("Obsidian: Damage", ConfigCategories.TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals");
OBSIDIAN_MAX_DAMAGE("Obsidian: Damage", ConfigCategories.TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals"),
DRILL_DAMAGE("Drill: Default Damage", ConfigCategories.DRILL_VALUES, 8.0F, 1.0F, 30.0F, "How much Damage the Drill does to an Entity");
public final String name;
public final String category;

View file

@ -41,7 +41,7 @@ public enum ConfigIntValues{
REPAIRER_SPEED_SLOWDOWN("Repairer: Speed Slowdown", ConfigCategories.MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs"),
HEAT_COLLECTOR_BLOCKS("Heat Collector: Blocks Needed", ConfigCategories.MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it"),
HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"),
HEAT_COLLECTOR_LAVA_CHANCE("Heat Collector: Random Chance", ConfigCategories.MACHINE_VALUES, 15000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)"),
GLASS_TIME_NEEDED("Greenhouse Glass: Time", ConfigCategories.MACHINE_VALUES, 300, 1, 10000, "Time Needed for the Greenhouse Glass to grow a Plant below it"),
@ -53,12 +53,12 @@ public enum ConfigIntValues{
RICE_AMOUNT("Rice Amount", ConfigCategories.WORLD_GEN, 15, 1, 100, "The Chance of Rice generating"),
CANOLA_AMOUNT("Canola Amount", ConfigCategories.WORLD_GEN, 10, 1, 50, "The Chance of Canola generating"),
FLAX_AMOUNT("Flax Amount", ConfigCategories.WORLD_GEN, 8, 1, 50, "The Chance of Flax generating"),
COFFEE_AMOUNT("Coffee Amount", ConfigCategories.WORLD_GEN, 4, 1, 50, "The Chance of Coffee generating"),
COFFEE_AMOUNT("Coffee Amount", ConfigCategories.WORLD_GEN, 6, 1, 50, "The Chance of Coffee generating"),
GRINDER_ENERGY_USED("Energy Use: Crusher", ConfigCategories.MACHINE_VALUES, 40, 1, 500, "The Amount of Energy used by the Crusher per Tick"),
GRINDER_DOUBLE_ENERGY_USED("Energy Use: Double Crusher", ConfigCategories.MACHINE_VALUES, 60, 1, 500, "The Amount of Energy used by the Double Crusher per Tick"),
FURNACE_SOLAR_ENERGY_PRODUCED("Energy Production: Furnace Solar", ConfigCategories.MACHINE_VALUES, 15, 1, 500, "The Amount of Energy produced by the Solar per Tick"),
HEAT_COLLECTOR_ENERGY_PRODUCED("Energy Production: Heat Collector", ConfigCategories.MACHINE_VALUES, 30, 1, 500, "The Amount of Energy produced by the Heat Collector per Tick"),
HEAT_COLLECTOR_ENERGY_PRODUCED("Energy Production: Heat Collectors", ConfigCategories.MACHINE_VALUES, 60, 1, 500, "The Amount of Energy produced by the Heat Collector per Tick"),
REPAIRER_ENERGY_USED("Energy Use: Repairer", ConfigCategories.MACHINE_VALUES, 1250, 1, 5000, "The Amount of Energy used by the Repairer per Tick"),
FURNACE_ENERGY_USED("Energy Use: Double Furnace", ConfigCategories.MACHINE_VALUES, 25, 1, 500, "The Amount of Energy used by the Double Furnace per Tick"),
@ -87,7 +87,18 @@ public enum ConfigIntValues{
COFFEE_CACHE_USED_PER_ITEM("Coffee Machine: Coffee used per Cup", ConfigCategories.MACHINE_VALUES, 10, 1, 300, "The amount of Coffee used to brew one Coffee in the Coffee Machine"),
COFFEE_MACHINE_TIME_USED("Coffee Machine: Time to Brew", ConfigCategories.MACHINE_VALUES, 500, 10, 10000, "The amount of time the Coffee Machine takes to brew a Coffee"),
COFFEE_DRINK_AMOUNT("Coffee: Drink Amount", ConfigCategories.OTHER, 4, 1, 100, "How often a Coffee can be drunk from");
COFFEE_DRINK_AMOUNT("Coffee: Drink Amount", ConfigCategories.OTHER, 4, 1, 100, "How often a Coffee can be drunk from"),
DRILL_ENERGY_USE("Drill: Energy Use Per Block or Hit", ConfigCategories.DRILL_VALUES, 100, 5, 10000, "How much Energy the Drill uses per Block"),
DRILL_SPEED_EXTRA_USE("Speed Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 50, 0, 10000, "How much extra Energy the Speed Upgrade uses"),
DRILL_SPEED_II_EXTRA_USE("Speed II Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 75, 0, 10000, "How much extra Energy the Speed II Upgrade uses"),
DRILL_SPEED_III_EXTRA_USE("Speed III Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 175, 0, 10000, "How much extra Energy the Speed III Upgrade uses"),
DRILL_SILK_EXTRA_USE("Silk Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 30, 0, 10000, "How much extra Energy the Silk Upgrade uses"),
DRILL_FORTUNE_EXTRA_USE("Fortune Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 40, 0, 10000, "How much extra Energy the Fortune Upgrade uses"),
DRILL_FORTUNE_II_EXTRA_USE("Fortune II Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 60, 0, 10000, "How much extra Energy the Fortune II Upgrade uses"),
DRILL_THREE_BY_THREE_EXTRA_USE("3x3 Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 10, 0, 10000, "How much extra Energy the 3x3 Upgrade uses"),
DRILL_FIVE_BY_FIVE_EXTRA_USE("5x5 Upgrade: Extra Energy Use", ConfigCategories.DRILL_VALUES, 30, 0, 10000, "How much extra Energy the 5x5 Upgrade uses");
public final String name;
public final String category;

View file

@ -64,6 +64,22 @@ public class BlockCrafting{
'S', TheMiscBlocks.STONE_CASING.getOredictName(),
'A', TheMiscItems.COIL.getOredictName()));
//Energizer
if(ConfigCrafting.ENERGIZER.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockEnergizer),
"I I", "CAC", "I I",
'I', "ingotIron",
'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
'A', TheMiscBlocks.STONE_CASING.getOredictName()));
//Energizer
if(ConfigCrafting.ENERVATOR.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockEnervator),
" I ", "CAC", " I ",
'I', "ingotIron",
'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
'A', TheMiscBlocks.STONE_CASING.getOredictName()));
//Lava Factory
if(ConfigCrafting.LAVA_FACTORY.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockLavaFactoryController),

View file

@ -13,34 +13,31 @@ import net.minecraft.item.ItemStack;
public class GrinderCrafting{
private static GrinderRecipeRegistry grindRecReg = GrinderRecipeRegistry.instance();
private static GrinderRecipes grindRec = GrinderRecipes.instance();
public static void init(){
Util.logInfo("Initializing Crusher Recipes...");
grindRec.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10));
grindRec.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()));
grindRec.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()));
grindRec.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal()));
GrinderRecipes.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10));
GrinderRecipes.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()));
GrinderRecipes.registerRecipe(new ItemStack(Items.coal), new ItemStack(InitItems.itemDust, 1, TheDusts.COAL.ordinal()));
GrinderRecipes.registerRecipe(new ItemStack(Blocks.coal_block), new ItemStack(InitItems.itemDust, 9, TheDusts.COAL.ordinal()));
grindRec.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand));
grindRec.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint));
grindRec.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
grindRec.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
GrinderRecipes.registerRecipe(new ItemStack(Blocks.cobblestone), new ItemStack(Blocks.sand));
GrinderRecipes.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint));
GrinderRecipes.registerRecipe(new ItemStack(Blocks.stone), new ItemStack(Blocks.cobblestone));
GrinderRecipes.registerRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.RICE.ordinal()), new ItemStack(Items.sugar, 2));
grindRec.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2);
grindRec.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2);
GrinderRecipes.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2);
GrinderRecipes.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2);
grindRecReg.searchCases.add(new SearchCase("oreNether", 6));
grindRecReg.searchCases.add(new SearchCase("denseore", 8));
grindRecReg.searchCases.add(new SearchCase("ingot", 1));
grindRecReg.searchCases.add(new SearchCase("gem", 1));
grindRecReg.searchCases.add(new SearchCase("ore", 2));
GrinderRecipeRegistry.searchCases.add(new SearchCase("oreNether", 6));
GrinderRecipeRegistry.searchCases.add(new SearchCase("denseore", 8));
GrinderRecipeRegistry.searchCases.add(new SearchCase("gem", 1));
GrinderRecipeRegistry.searchCases.add(new SearchCase("ingot", 1));
GrinderRecipeRegistry.searchCases.add(new SearchCase("ore", 2));
grindRecReg.exceptions.add("ingotBrick");
grindRecReg.exceptions.add("ingotBrickNether");
GrinderRecipeRegistry.exceptions.add("ingotBrick");
GrinderRecipeRegistry.exceptions.add("ingotBrickNether");
grindRecReg.registerFinally();
GrinderRecipeRegistry.registerFinally();
}
}

View file

@ -8,11 +8,13 @@ import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.*;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.IGrowable;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
@ -44,6 +46,91 @@ public class ItemCrafting{
'P', new ItemStack(Blocks.piston),
'C', TheMiscItems.COIL_ADVANCED.getOredictName()));
//Drill
if(ConfigCrafting.DRILL.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrill),
"DDD", "CRC", "III",
'D', "gemDiamond",
'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
'R', "dustRedstone",
'I', "blockIron"));
//Drill Speed
if(ConfigCrafting.DRILL_SPEED.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeed),
"ISI", "SRS", "ISI",
'I', "ingotIron",
'S', Items.sugar,
'R', "dustRedstone"));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedII),
"ISI", "SCS", "ISI",
'I', "ingotIron",
'S', Items.sugar,
'C', Items.cake));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSpeedIII),
"ISI", "SFS", "ISI",
'I', "ingotIron",
'S', Items.sugar,
'F', "gemDiamond"));
}
//Drill Fortune
if(ConfigCrafting.DRILL_FORTUNE.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFortune),
"ISI", "SRS", "ISI",
'I', Blocks.glowstone,
'S', Items.redstone,
'R', Blocks.diamond_block));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFortuneII),
"ISI", "SRS", "ISI",
'I', Blocks.glowstone,
'S', Items.redstone,
'R', TheMiscBlocks.ENDER_CASING.getOredictName()));
}
//Drill Size
if(ConfigCrafting.DRILL_SIZE.isEnabled()){
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeThreeByThree),
"DID", "ICI", "DID",
'I', "ingotIron",
'D', "gemDiamond",
'C', TheMiscItems.COIL.getOredictName()));
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeFiveByFive),
"DID", "ICI", "DID",
'I', "ingotIron",
'D', "gemDiamond",
'C', TheMiscItems.COIL_ADVANCED.getOredictName()));
}
//Drill Silk Touch
if(ConfigCrafting.DRILL_SILK_TOUCH.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeSilkTouch),
"DSD", "SCS", "DSD",
'D', "gemEmerald",
'S', "gemDiamond",
'C', TheMiscItems.COIL_ADVANCED.getOredictName()));
//Drill Placing
if(ConfigCrafting.DRILL_PLACING.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemDrillUpgradeBlockPlacing),
"CEC", "RAR", "CEC",
'C', "cobblestone",
'E', Items.ender_pearl,
'A', TheMiscItems.COIL.getOredictName(),
'R', "ingotIron"));
//Battery
if(ConfigCrafting.BATTERY.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemBattery),
" R ", "ICI", "III",
'R', "dustRedstone",
'I', "ingotIron",
'C', TheMiscItems.COIL_ADVANCED.getOredictName()));
//Coil
if(ConfigCrafting.COIL.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
@ -174,10 +261,6 @@ public class ItemCrafting{
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCanolaSeed),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.CANOLA.ordinal()));
//Mashed Food
if(ConfigCrafting.MASHED_FOOD.isEnabled())
initMashedFoodRecipes();
//Rings
initPotionRingRecipes();
@ -226,10 +309,12 @@ public class ItemCrafting{
}
public static void initMashedFoodRecipes(){
for(Object nextIterator : Item.itemRegistry){
if(nextIterator instanceof ItemFood){
ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD);
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 12, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
if(ConfigCrafting.MASHED_FOOD.isEnabled()){
for(Object nextIterator : Item.itemRegistry){
if(nextIterator instanceof ItemFood || nextIterator instanceof IPlantable || nextIterator instanceof IGrowable){
ItemStack ingredient = new ItemStack((Item)nextIterator, 1, Util.WILDCARD);
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 8, TheMiscItems.MASHED_FOOD.ordinal()), ingredient, ingredient, ingredient, ingredient, new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD));
}
}
}
}

View file

@ -26,89 +26,103 @@ public class CreativeTab extends CreativeTabs{
public void displayAllReleventItems(List list){
this.list = list;
addBlock(InitBlocks.blockPhantomface);
addBlock(InitBlocks.blockPhantomEnergyface);
addBlock(InitBlocks.blockPhantomLiquiface);
addBlock(InitBlocks.blockPhantomPlacer);
addBlock(InitBlocks.blockPhantomBreaker);
addBlock(InitBlocks.blockPhantomBooster);
addBlock(InitBlocks.blockCoffeeMachine);
addBlock(InitBlocks.blockInputter);
addBlock(InitBlocks.blockInputterAdvanced);
add(InitBlocks.blockPhantomface);
add(InitBlocks.blockPhantomEnergyface);
add(InitBlocks.blockPhantomLiquiface);
add(InitBlocks.blockPhantomPlacer);
add(InitBlocks.blockPhantomBreaker);
add(InitBlocks.blockPhantomBooster);
add(InitBlocks.blockCoffeeMachine);
add(InitBlocks.blockInputter);
add(InitBlocks.blockInputterAdvanced);
addBlock(InitBlocks.blockGreenhouseGlass);
addBlock(InitBlocks.blockGrinder);
addBlock(InitBlocks.blockGrinderDouble);
addBlock(InitBlocks.blockFurnaceDouble);
addBlock(InitBlocks.blockLavaFactoryController);
add(InitBlocks.blockGreenhouseGlass);
add(InitBlocks.blockGrinder);
add(InitBlocks.blockGrinderDouble);
add(InitBlocks.blockFurnaceDouble);
add(InitBlocks.blockLavaFactoryController);
addBlock(InitBlocks.blockFurnaceSolar);
addBlock(InitBlocks.blockHeatCollector);
addBlock(InitBlocks.blockCoalGenerator);
addBlock(InitBlocks.blockOilGenerator);
addBlock(InitBlocks.blockItemRepairer);
addBlock(InitBlocks.blockFishingNet);
addBlock(InitBlocks.blockBreaker);
addBlock(InitBlocks.blockPlacer);
addBlock(InitBlocks.blockDropper);
addBlock(InitBlocks.blockFluidPlacer);
addBlock(InitBlocks.blockFluidCollector);
add(InitBlocks.blockEnergizer);
add(InitBlocks.blockEnervator);
addBlock(InitBlocks.blockMisc);
addBlock(InitBlocks.blockFeeder);
addBlock(InitBlocks.blockCompost);
addBlock(InitBlocks.blockGiantChest);
addBlock(InitBlocks.blockCanolaPress);
addBlock(InitBlocks.blockFermentingBarrel);
add(InitBlocks.blockFurnaceSolar);
add(InitBlocks.blockHeatCollector);
add(InitBlocks.blockCoalGenerator);
add(InitBlocks.blockOilGenerator);
add(InitBlocks.blockItemRepairer);
add(InitBlocks.blockFishingNet);
add(InitBlocks.blockBreaker);
add(InitBlocks.blockPlacer);
add(InitBlocks.blockDropper);
add(InitBlocks.blockFluidPlacer);
add(InitBlocks.blockFluidCollector);
//addItem(InitItems.itemDrill);
addItem(InitItems.itemPhantomConnector);
addItem(InitItems.itemBucketCanolaOil);
addItem(InitItems.itemBucketOil);
add(InitBlocks.blockMisc);
add(InitBlocks.blockFeeder);
add(InitBlocks.blockCompost);
add(InitBlocks.blockGiantChest);
add(InitBlocks.blockCanolaPress);
add(InitBlocks.blockFermentingBarrel);
addItem(InitItems.itemCoffeeSeed);
addItem(InitItems.itemCoffeeBean);
addItem(InitItems.itemRiceSeed);
addItem(InitItems.itemCanolaSeed);
addItem(InitItems.itemFlaxSeed);
addItem(InitItems.itemHairyBall);
addItem(InitItems.itemMisc);
addItem(InitItems.itemResonantRice);
addItem(InitItems.itemFertilizer);
add(InitItems.itemDrill);
add(InitItems.itemDrillUpgradeSpeed);
add(InitItems.itemDrillUpgradeSpeedII);
add(InitItems.itemDrillUpgradeSpeedIII);
add(InitItems.itemDrillUpgradeSilkTouch);
add(InitItems.itemDrillUpgradeFortune);
add(InitItems.itemDrillUpgradeFortuneII);
add(InitItems.itemDrillUpgradeThreeByThree);
add(InitItems.itemDrillUpgradeFiveByFive);
add(InitItems.itemDrillUpgradeBlockPlacing);
add(InitItems.itemBattery);
add(InitItems.itemPhantomConnector);
add(InitItems.itemBucketCanolaOil);
add(InitItems.itemBucketOil);
addItem(InitItems.itemCoffee);
addItem(InitItems.itemFoods);
addItem(InitItems.itemKnife);
addItem(InitItems.itemCrafterOnAStick);
addItem(InitItems.itemDust);
addItem(InitItems.itemSpecialDrop);
addItem(InitItems.itemLeafBlower);
addItem(InitItems.itemLeafBlowerAdvanced);
add(InitItems.itemCoffeeSeed);
add(InitItems.itemCoffeeBean);
add(InitItems.itemRiceSeed);
add(InitItems.itemCanolaSeed);
add(InitItems.itemFlaxSeed);
add(InitItems.itemHairyBall);
add(InitItems.itemMisc);
add(InitItems.itemResonantRice);
add(InitItems.itemFertilizer);
addItem(InitItems.woodenPaxel);
addItem(InitItems.stonePaxel);
addItem(InitItems.ironPaxel);
addItem(InitItems.goldPaxel);
addItem(InitItems.diamondPaxel);
addItem(InitItems.emeraldPaxel);
addItem(InitItems.obsidianPaxel);
add(InitItems.itemCoffee);
add(InitItems.itemFoods);
add(InitItems.itemKnife);
add(InitItems.itemCrafterOnAStick);
add(InitItems.itemDust);
add(InitItems.itemSpecialDrop);
add(InitItems.itemLeafBlower);
add(InitItems.itemLeafBlowerAdvanced);
addItem(InitItems.itemPickaxeEmerald);
addItem(InitItems.itemSwordEmerald);
addItem(InitItems.itemAxeEmerald);
addItem(InitItems.itemShovelEmerald);
addItem(InitItems.itemHoeEmerald);
add(InitItems.woodenPaxel);
add(InitItems.stonePaxel);
add(InitItems.ironPaxel);
add(InitItems.goldPaxel);
add(InitItems.diamondPaxel);
add(InitItems.emeraldPaxel);
add(InitItems.obsidianPaxel);
addItem(InitItems.itemPickaxeObsidian);
addItem(InitItems.itemSwordObsidian);
addItem(InitItems.itemAxeObsidian);
addItem(InitItems.itemShovelObsidian);
addItem(InitItems.itemHoeObsidian);
add(InitItems.itemPickaxeEmerald);
add(InitItems.itemSwordEmerald);
add(InitItems.itemAxeEmerald);
add(InitItems.itemShovelEmerald);
add(InitItems.itemHoeEmerald);
addItem(InitItems.itemPotionRing);
addItem(InitItems.itemPotionRingAdvanced);
add(InitItems.itemPickaxeObsidian);
add(InitItems.itemSwordObsidian);
add(InitItems.itemAxeObsidian);
add(InitItems.itemShovelObsidian);
add(InitItems.itemHoeObsidian);
addItem(InitItems.itemJams);
add(InitItems.itemPotionRing);
add(InitItems.itemPotionRingAdvanced);
add(InitItems.itemJams);
}
@Override
@ -121,11 +135,11 @@ public class CreativeTab extends CreativeTabs{
return new ItemStack(this.getTabIconItem());
}
private void addItem(Item item){
private void add(Item item){
item.getSubItems(item, instance, list);
}
private void addBlock(Block block){
private void add(Block block){
block.getSubBlocks(new ItemStack(block).getItem(), instance, list);
}
}

View file

@ -55,7 +55,7 @@ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHa
}
public void addWants(String oredictName, int minSize, int maxSize){
ArrayList<ItemStack> stacks = OreDictionary.getOres(oredictName);
ArrayList<ItemStack> stacks = (ArrayList<ItemStack>)OreDictionary.getOres(oredictName, false);
trades.add(new Trade(stacks, minSize, maxSize));
}

View file

@ -0,0 +1,195 @@
package ellpeck.actuallyadditions.inventory;
import ellpeck.actuallyadditions.inventory.slot.SlotImmovable;
import ellpeck.actuallyadditions.items.ItemDrill;
import ellpeck.actuallyadditions.items.ItemDrillUpgrade;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
@InventoryContainer
public class ContainerDrill extends Container{
private static final int SLOT_AMOUNT = 5;
private InventoryDrill drillInventory = new InventoryDrill();
private InventoryPlayer inventory;
public ContainerDrill(InventoryPlayer inventory){
this.inventory = inventory;
for(int i = 0; i < SLOT_AMOUNT; i++){
this.addSlotToContainer(new Slot(drillInventory, i, 44+i*18, 19){
@Override
public boolean isItemValid(ItemStack stack){
return stack.getItem() instanceof ItemDrillUpgrade;
}
});
}
for(int i = 0; i < 3; i++){
for(int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j+i*9+9, 8+j*18, 58+i*18));
}
}
for(int i = 0; i < 9; i++){
if(i == inventory.currentItem) this.addSlotToContainer(new SlotImmovable(inventory, i, 8+i*18, 116));
else this.addSlotToContainer(new Slot(inventory, i, 8+i*18, 116));
}
ItemStack stack = inventory.getCurrentItem();
if(stack != null && stack.getItem() instanceof ItemDrill){
ItemStack[] slots = ((ItemDrill)stack.getItem()).getSlotsFromNBT(inventory.getCurrentItem());
if(slots != null && slots.length > 0) this.drillInventory.slots = slots;
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.drillInventory.isUseableByPlayer(player);
}
@Override
public void onContainerClosed(EntityPlayer player){
ItemStack stack = inventory.getCurrentItem();
if(stack != null && stack.getItem() instanceof ItemDrill){
((ItemDrill)stack.getItem()).writeSlotsToNBT(this.drillInventory.slots, inventory.getCurrentItem());
}
super.onContainerClosed(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 5;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot.getHasStack()){
ItemStack currentStack = theSlot.getStack();
ItemStack newStack = currentStack.copy();
if(currentStack.getItem() != null){
if(slot <= hotbarEnd && slot >= inventoryStart){
if(currentStack.getItem() instanceof ItemDrillUpgrade){
this.mergeItemStack(newStack, 0, SLOT_AMOUNT, false);
}
}
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
}
else if(slot < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
}
if(newStack.stackSize == 0) theSlot.putStack(null);
else theSlot.onSlotChanged();
if(newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);
return currentStack;
}
}
return null;
}
public static class InventoryDrill implements IInventory{
public ItemStack[] slots = new ItemStack[SLOT_AMOUNT];
@Override
public String getInventoryName(){
return "drill";
}
@Override
public boolean hasCustomInventoryName(){
return false;
}
@Override
public int getInventoryStackLimit(){
return 64;
}
@Override
public void markDirty(){
}
@Override
public void openInventory(){
}
@Override
public void closeInventory(){
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
return true;
}
@Override
public boolean isUseableByPlayer(EntityPlayer player){
return true;
}
@Override
public ItemStack getStackInSlotOnClosing(int i){
return getStackInSlot(i);
}
@Override
public void setInventorySlotContents(int i, ItemStack stack){
this.slots[i] = stack;
this.markDirty();
}
@Override
public int getSizeInventory(){
return slots.length;
}
@Override
public ItemStack getStackInSlot(int i){
if(i < this.getSizeInventory()){
return slots[i];
}
return null;
}
@Override
public ItemStack decrStackSize(int i, int j){
if (slots[i] != null){
ItemStack stackAt;
if(slots[i].stackSize <= j){
stackAt = slots[i];
slots[i] = null;
this.markDirty();
return stackAt;
}
else{
stackAt = slots[i].splitStack(j);
if (slots[i].stackSize == 0) slots[i] = null;
this.markDirty();
return stackAt;
}
}
return null;
}
}
}

View file

@ -0,0 +1,109 @@
package ellpeck.actuallyadditions.inventory;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityEnergizer;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@InventoryContainer
public class ContainerEnergizer extends Container{
private TileEntityEnergizer energizer;
private int lastEnergyStored;
public ContainerEnergizer(InventoryPlayer inventory, TileEntityBase tile){
this.energizer = (TileEntityEnergizer)tile;
this.addSlotToContainer(new Slot(this.energizer, 0, 76, 73));
this.addSlotToContainer(new SlotOutput(this.energizer, 1, 76, 42));
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.energizer.isUseableByPlayer(player);
}
@Override
public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.energizer.getEnergyStored(ForgeDirection.UNKNOWN));
}
@Override
public void detectAndSendChanges(){
super.detectAndSendChanges();
for(Object crafter : this.crafters){
ICrafting iCraft = (ICrafting)crafter;
if(this.lastEnergyStored != this.energizer.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.energizer.getEnergyStored(ForgeDirection.UNKNOWN));
}
this.lastEnergyStored = this.energizer.getEnergyStored(ForgeDirection.UNKNOWN);
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.energizer.storage.setEnergyStored(par2);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 2;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot.getHasStack()){
ItemStack currentStack = theSlot.getStack();
ItemStack newStack = currentStack.copy();
if(slot <= hotbarEnd && slot >= inventoryStart){
if(currentStack.getItem() instanceof IEnergyContainerItem){
this.mergeItemStack(newStack, 0, 1, false);
}
}
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
}
else if(slot < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
}
if(newStack.stackSize == 0) theSlot.putStack(null);
else theSlot.onSlotChanged();
if(newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);
return currentStack;
}
return null;
}
}

View file

@ -0,0 +1,109 @@
package ellpeck.actuallyadditions.inventory;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityEnervator;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
@InventoryContainer
public class ContainerEnervator extends Container{
private TileEntityEnervator enervator;
private int lastEnergyStored;
public ContainerEnervator(InventoryPlayer inventory, TileEntityBase tile){
this.enervator = (TileEntityEnervator)tile;
this.addSlotToContainer(new Slot(this.enervator, 0, 76, 73));
this.addSlotToContainer(new SlotOutput(this.enervator, 1, 76, 42));
for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
}
}
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155));
}
}
@Override
public boolean canInteractWith(EntityPlayer player){
return this.enervator.isUseableByPlayer(player);
}
@Override
public void addCraftingToCrafters(ICrafting iCraft){
super.addCraftingToCrafters(iCraft);
iCraft.sendProgressBarUpdate(this, 0, this.enervator.getEnergyStored(ForgeDirection.UNKNOWN));
}
@Override
public void detectAndSendChanges(){
super.detectAndSendChanges();
for(Object crafter : this.crafters){
ICrafting iCraft = (ICrafting)crafter;
if(this.lastEnergyStored != this.enervator.getEnergyStored(ForgeDirection.UNKNOWN)) iCraft.sendProgressBarUpdate(this, 0, this.enervator.getEnergyStored(ForgeDirection.UNKNOWN));
}
this.lastEnergyStored = this.enervator.getEnergyStored(ForgeDirection.UNKNOWN);
}
@Override
@SideOnly(Side.CLIENT)
public void updateProgressBar(int par1, int par2){
if(par1 == 0) this.enervator.storage.setEnergyStored(par2);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 2;
final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8;
Slot theSlot = (Slot)this.inventorySlots.get(slot);
if(theSlot.getHasStack()){
ItemStack currentStack = theSlot.getStack();
ItemStack newStack = currentStack.copy();
if(slot <= hotbarEnd && slot >= inventoryStart){
if(currentStack.getItem() instanceof IEnergyContainerItem){
this.mergeItemStack(newStack, 0, 1, false);
}
}
if(slot <= hotbarEnd && slot >= hotbarStart){
this.mergeItemStack(newStack, inventoryStart, inventoryEnd+1, false);
}
else if(slot <= inventoryEnd && slot >= inventoryStart){
this.mergeItemStack(newStack, hotbarStart, hotbarEnd+1, false);
}
else if(slot < inventoryStart){
this.mergeItemStack(newStack, inventoryStart, hotbarEnd+1, false);
}
if(newStack.stackSize == 0) theSlot.putStack(null);
else theSlot.onSlotChanged();
if(newStack.stackSize == currentStack.stackSize) return null;
theSlot.onPickupFromSlot(player, newStack);
return currentStack;
}
return null;
}
}

View file

@ -104,7 +104,7 @@ public class ContainerGrinder extends Container{
if(currentStack.getItem() != null){
if(slot <= hotbarEnd && slot >= inventoryStart){
if(GrinderRecipes.instance().getOutput(currentStack, false) != null){
if(GrinderRecipes.getOutput(currentStack, false) != null){
this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_1, TileEntityGrinder.SLOT_INPUT_1+1, false);
if(this.isDouble) this.mergeItemStack(newStack, TileEntityGrinder.SLOT_INPUT_2, TileEntityGrinder.SLOT_INPUT_2+1, false);
}

View file

@ -54,6 +54,12 @@ public class GuiHandler implements IGuiHandler{
return new ContainerFluidCollector(entityPlayer.inventory, tile);
case COFFEE_MACHINE_ID:
return new ContainerCoffeeMachine(entityPlayer.inventory, tile);
case DRILL_ID:
return new ContainerDrill(entityPlayer.inventory);
case ENERGIZER_ID:
return new ContainerEnergizer(entityPlayer.inventory, tile);
case ENERVATOR_ID:
return new ContainerEnervator(entityPlayer.inventory, tile);
default:
return null;
}
@ -102,6 +108,12 @@ public class GuiHandler implements IGuiHandler{
return new GuiFluidCollector(entityPlayer.inventory, tile);
case COFFEE_MACHINE_ID:
return new GuiCoffeeMachine(entityPlayer.inventory, tile, x, y, z, world);
case DRILL_ID:
return new GuiDrill(entityPlayer.inventory);
case ENERGIZER_ID:
return new GuiEnergizer(entityPlayer.inventory, tile);
case ENERVATOR_ID:
return new GuiEnervator(entityPlayer.inventory, tile);
default:
return null;
}
@ -126,6 +138,8 @@ public class GuiHandler implements IGuiHandler{
public static final int FLUID_COLLECTOR_ID = 16;
public static final int COFFEE_MACHINE_ID = 17;
public static final int DRILL_ID = 18;
public static final int ENERGIZER_ID = 19;
public static final int ENERVATOR_ID = 20;
public static void init(){
Util.logInfo("Initializing GuiHandler...");

View file

@ -0,0 +1,39 @@
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerDrill;
import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class GuiDrill extends GuiContainer{
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiDrill");
public GuiDrill(InventoryPlayer inventory){
super(new ContainerDrill(inventory));
this.xSize = 176;
this.ySize = 54+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, "container."+ModUtil.MOD_ID_LOWER+".drill");
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+54, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 54);
}
}

View file

@ -0,0 +1,60 @@
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerEnergizer;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityEnergizer;
import ellpeck.actuallyadditions.util.AssetUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiEnergizer extends GuiContainer{
private TileEntityEnergizer energizer;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer");
public GuiEnergizer(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerEnergizer(inventory, tile));
this.energizer = (TileEntityEnergizer)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.energizer.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.energizer.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
int i = this.energizer.getEnergyScaled(83);
drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
}
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.energizer.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.energizer.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
if(x >= guiLeft+57 && y >= guiTop+6 && x <= guiLeft+72 && y <= guiTop+88){
this.func_146283_a(Collections.singletonList(text1), x, y);
}
}
}

View file

@ -0,0 +1,60 @@
package ellpeck.actuallyadditions.inventory.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.ContainerEnervator;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityEnervator;
import ellpeck.actuallyadditions.util.AssetUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import java.util.Collections;
@SideOnly(Side.CLIENT)
public class GuiEnervator extends GuiContainer{
private TileEntityEnervator enervator;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiEnergizer");
public GuiEnervator(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerEnervator(inventory, tile));
this.enervator = (TileEntityEnervator)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameString(this.fontRendererObj, xSize, -10, this.enervator.getInventoryName());
}
@Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93);
if(this.enervator.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
int i = this.enervator.getEnergyScaled(83);
drawTexturedModalRect(this.guiLeft+57, this.guiTop+89-i, 176, 0, 16, i);
}
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
String text1 = this.enervator.getEnergyStored(ForgeDirection.UNKNOWN) + "/" + this.enervator.getMaxEnergyStored(ForgeDirection.UNKNOWN) + " RF";
if(x >= guiLeft+57 && y >= guiTop+6 && x <= guiLeft+72 && y <= guiTop+88){
this.func_146283_a(Collections.singletonList(text1), x, y);
}
}
}

View file

@ -0,0 +1,24 @@
package ellpeck.actuallyadditions.inventory.slot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class SlotImmovable extends Slot{
public SlotImmovable(IInventory inventory, int id, int x, int y){
super(inventory, id, x, y);
}
@Override
public boolean canTakeStack(EntityPlayer player){
return false;
}
@Override
public boolean isItemValid(ItemStack stack){
return false;
}
}

View file

@ -69,13 +69,38 @@ public class InitItems{
public static Item emeraldPaxel;
public static Item obsidianPaxel;
//public static Item itemDrill;
public static Item itemDrill;
public static Item itemDrillUpgradeSpeed;
public static Item itemDrillUpgradeSpeedII;
public static Item itemDrillUpgradeSpeedIII;
public static Item itemDrillUpgradeSilkTouch;
public static Item itemDrillUpgradeFortune;
public static Item itemDrillUpgradeFortuneII;
public static Item itemDrillUpgradeThreeByThree;
public static Item itemDrillUpgradeFiveByFive;
public static Item itemDrillUpgradeBlockPlacing;
public static Item itemBattery;
public static void init(){
Util.logInfo("Initializing Items...");
//itemDrill = new ItemDrill();
//ItemUtil.register(itemDrill);
itemDrill = new ItemDrill();
ItemUtil.register(itemDrill);
itemBattery = new ItemBattery();
ItemUtil.register(itemBattery);
itemDrillUpgradeSpeed = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED, "itemDrillUpgradeSpeed");
itemDrillUpgradeSpeedII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_II, "itemDrillUpgradeSpeedII");
itemDrillUpgradeSpeedIII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SPEED_III, "itemDrillUpgradeSpeedIII");
itemDrillUpgradeSilkTouch = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.SILK_TOUCH, "itemDrillUpgradeSilkTouch");
itemDrillUpgradeFortune = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE, "itemDrillUpgradeFortune");
itemDrillUpgradeFortuneII = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FORTUNE_II, "itemDrillUpgradeFortuneII");
itemDrillUpgradeThreeByThree = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE, "itemDrillUpgradeThreeByThree");
itemDrillUpgradeFiveByFive = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE, "itemDrillUpgradeFiveByFive");
itemDrillUpgradeBlockPlacing = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER, "itemDrillUpgradeBlockPlacing");
ItemUtil.registerItems(new Item[]{itemDrillUpgradeSpeed, itemDrillUpgradeSpeedII, itemDrillUpgradeSpeedIII, itemDrillUpgradeSilkTouch, itemDrillUpgradeFortune, itemDrillUpgradeFortuneII, itemDrillUpgradeThreeByThree, itemDrillUpgradeFiveByFive, itemDrillUpgradeBlockPlacing});
itemBucketOil = new ItemBucketAA(InitBlocks.blockOil, "itemBucketOil");
ItemUtil.register(itemBucketOil);
@ -88,6 +113,9 @@ public class InitItems{
itemFertilizer = new ItemFertilizer();
ItemUtil.register(itemFertilizer);
itemCoffee = new ItemCoffee();
ItemUtil.register(itemCoffee);
itemPhantomConnector = new ItemPhantomConnector();
ItemUtil.register(itemPhantomConnector);
@ -134,19 +162,19 @@ public class InitItems{
itemCoffeeBean = new ItemCoffeeBean();
ItemUtil.register(itemCoffeeBean);
itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, new ItemStack(itemFoods, 1, TheFoods.RICE.ordinal()));
itemRiceSeed = new ItemSeed("itemRiceSeed", InitBlocks.blockRice, Blocks.water, EnumPlantType.Water, itemFoods, TheFoods.RICE.ordinal());
ItemUtil.register(itemRiceSeed);
FactoryRegistry.sendMessage("registerPlantable", itemRiceSeed);
itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Plains, new ItemStack(itemMisc, 1, TheMiscItems.CANOLA.ordinal()));
itemCanolaSeed = new ItemSeed("itemCanolaSeed", InitBlocks.blockCanola, Blocks.grass, EnumPlantType.Plains, itemMisc, TheMiscItems.CANOLA.ordinal());
ItemUtil.register(itemCanolaSeed);
FactoryRegistry.sendMessage("registerPlantable", itemCanolaSeed);
itemFlaxSeed = new ItemSeed("itemFlaxSeed", InitBlocks.blockFlax, Blocks.grass, EnumPlantType.Plains, new ItemStack(Items.string));
itemFlaxSeed = new ItemSeed("itemFlaxSeed", InitBlocks.blockFlax, Blocks.grass, EnumPlantType.Plains, Items.string, 0);
ItemUtil.register(itemFlaxSeed);
FactoryRegistry.sendMessage("registerPlantable", itemFlaxSeed);
itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, Blocks.grass, EnumPlantType.Plains, new ItemStack(itemCoffeeBean));
itemCoffeeSeed = new ItemSeed("itemCoffeeSeed", InitBlocks.blockCoffee, Blocks.grass, EnumPlantType.Plains, itemCoffeeBean, 0);
ItemUtil.register(itemCoffeeSeed);
FactoryRegistry.sendMessage("registerPlantable", itemCoffeeSeed);
@ -172,8 +200,5 @@ public class InitItems{
emeraldPaxel = new ItemAllToolAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "emeraldPaxel", EnumRarity.epic);
obsidianPaxel = new ItemAllToolAA(InitItemMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "obsidianPaxel", EnumRarity.epic);
ItemUtil.registerItems(new Item[]{woodenPaxel, stonePaxel, ironPaxel, goldPaxel, diamondPaxel, emeraldPaxel, obsidianPaxel});
itemCoffee = new ItemCoffee();
ItemUtil.register(itemCoffee);
}
}

View file

@ -0,0 +1,107 @@
package ellpeck.actuallyadditions.items;
import cofh.api.energy.ItemEnergyContainer;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
import java.util.List;
public class ItemBattery extends ItemEnergyContainer implements INameableItem{
public ItemBattery(){
super(1000000, 10000);
this.setMaxStackSize(1);
this.setHasSubtypes(true);
}
@Override
public double getDurabilityForDisplay(ItemStack stack){
double energyDif = getMaxEnergyStored(stack)-getEnergyStored(stack);
double maxAmount = getMaxEnergyStored(stack);
return energyDif/maxAmount;
}
@Override
public boolean showDurabilityBar(ItemStack itemStack){
return true;
}
@Override
public void onCreated(ItemStack stack, World world, EntityPlayer player){
this.setEnergy(stack, 0);
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
public IIcon getIcon(ItemStack stack, int pass){
return this.itemIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
}
public void setEnergy(ItemStack stack, int energy){
NBTTagCompound compound = stack.getTagCompound();
if(compound == null) compound = new NBTTagCompound();
compound.setInteger("Energy", energy);
stack.setTagCompound(compound);
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tabs, List list){
ItemStack stackFull = new ItemStack(this);
this.setEnergy(stackFull, this.getMaxEnergyStored(stackFull));
list.add(stackFull);
ItemStack stackEmpty = new ItemStack(this);
this.setEnergy(stackEmpty, 0);
list.add(stackEmpty);
}
@Override
public String getName(){
return "itemBattery";
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
ItemUtil.addInformation(this, list, 1, "");
if(KeyUtil.isShiftPressed()){
list.add(this.getEnergyStored(stack) + "/" + this.getMaxEnergyStored(stack) + " RF");
}
}
@Override
public boolean getShareTag(){
return true;
}
}

View file

@ -6,29 +6,34 @@ import com.google.common.collect.Sets;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.config.values.ConfigFloatValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.items.tools.ItemAllToolAA;
import ellpeck.actuallyadditions.util.*;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IIcon;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import org.apache.logging.log4j.Level;
import java.util.ArrayList;
import java.util.HashSet;
@ -45,15 +50,13 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
}
public ItemDrill(){
super(500000);
super(500000, 5000);
this.setMaxStackSize(1);
this.setHasSubtypes(true);
}
public static float defaultEfficiency = 8.0F;
public static int energyUsePerBlockOrHit = 100;
public float efficiency = defaultEfficiency;
public static float defaultEfficiency = ConfigFloatValues.DRILL_DAMAGE.getValue();
public static int energyUsePerBlockOrHit = ConfigIntValues.DRILL_ENERGY_USE.getValue();
@Override
public double getDurabilityForDisplay(ItemStack stack){
@ -62,6 +65,37 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
return energyDif/maxAmount;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int hitSide, float hitX, float hitY, float hitZ){
ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER);
if(upgrade != null){
int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade);
if(slot >= 0 && slot < InventoryPlayer.getHotbarSize() && slot != player.inventory.currentItem){
ItemStack equip = player.inventory.getStackInSlot(slot);
if(equip != null){
if(!world.isRemote){
boolean placed = false;
try{
placed = equip.tryPlaceItemIntoWorld(player, world, x, y, z, hitSide, hitX, hitY, hitZ);
}
catch(Exception e){
player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!"));
ModUtil.LOGGER.log(Level.ERROR, "Player "+player.getDisplayName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.dimensionId+" threw an Exception! Don't let that happen again!");
}
if(placed){
player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy());
player.inventoryContainer.detectAndSendChanges();
return true;
}
}
else return true;
}
}
}
return false;
}
@Override
public boolean showDurabilityBar(ItemStack itemStack){
return true;
@ -72,57 +106,44 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
this.setEnergy(stack, 0);
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5){
this.addEnchantFromUpgrade(Enchantment.silkTouch, ItemDrillUpgrade.UpgradeType.SILK_TOUCH, stack, 1);
this.addEnchantFromUpgrade(Enchantment.fortune, ItemDrillUpgrade.UpgradeType.FORTUNE, stack, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1);
}
public void addEnchantFromUpgrade(Enchantment enchantment, ItemDrillUpgrade.UpgradeType upgrade, ItemStack stack, int level){
boolean hasEnchant = this.hasEnchantment(stack, enchantment) >= 0;
if(this.getHasUpgrade(stack, upgrade)){
if(!hasEnchant){
stack.addEnchantment(enchantment, level);
public float getEfficiencyFromUpgrade(ItemStack stack){
float efficiency = defaultEfficiency;
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)) efficiency += 37.0F;
else efficiency += 28.0F;
}
else efficiency += 15.0F;
}
else if(hasEnchant) this.removeEnchantment(stack, enchantment);
return efficiency;
}
public int getEnergyUsePerBlock(ItemStack stack){
int use = energyUsePerBlockOrHit;
ItemDrillUpgrade.UpgradeType[] types = ItemDrillUpgrade.UpgradeType.values();
for(ItemDrillUpgrade.UpgradeType type : types){
if(this.getHasUpgrade(stack, type)){
use += type.extraEnergy;
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED)){
use += ConfigIntValues.DRILL_SPEED_EXTRA_USE.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_II)){
use += ConfigIntValues.DRILL_SPEED_II_EXTRA_USE.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SPEED_III)) use += ConfigIntValues.DRILL_SPEED_III_EXTRA_USE.getValue();
}
}
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)) use += ConfigIntValues.DRILL_SILK_EXTRA_USE.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){
use += ConfigIntValues.DRILL_FORTUNE_EXTRA_USE.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II)) use += ConfigIntValues.DRILL_FORTUNE_II_EXTRA_USE.getValue();
}
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){
use += ConfigIntValues.DRILL_THREE_BY_THREE_EXTRA_USE.getValue();
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)) use += ConfigIntValues.DRILL_FIVE_BY_FIVE_EXTRA_USE.getValue();
}
return use;
}
public void removeEnchantment(ItemStack stack, Enchantment ench){
NBTTagList list = stack.getEnchantmentTagList();
if(list != null){
int hasEnchantment = this.hasEnchantment(stack, ench);
if(hasEnchantment >= 0){
list.removeTag(hasEnchantment);
}
}
}
public int hasEnchantment(ItemStack stack, Enchantment ench){
NBTTagList list = stack.getEnchantmentTagList();
if(list != null){
for(int i = 0; i < list.tagCount(); i++){
NBTTagCompound compound = list.getCompoundTagAt(i);
short id = compound.getShort("id");
if(id == ench.effectId){
return i;
}
}
}
return -1;
}
@Override
@SideOnly(Side.CLIENT)
public boolean hasEffect(ItemStack stack, int pass){
@ -135,21 +156,22 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
}
public boolean getHasUpgrade(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){
if(upgrade == ItemDrillUpgrade.UpgradeType.THREE_BY_THREE) return true;
if(upgrade == ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE) return true;
return this.getHasUpgradeAsStack(stack, upgrade) != null;
}
public ItemStack getHasUpgradeAsStack(ItemStack stack, ItemDrillUpgrade.UpgradeType upgrade){
NBTTagCompound compound = stack.getTagCompound();
if(compound == null) return false;
if(compound == null) return null;
ItemStack[] slots = this.getSlotsFromNBT(stack);
if(slots != null && slots.length > 0){
for(ItemStack slotStack : slots){
if(slotStack != null && slotStack.getItem() instanceof ItemDrillUpgrade){
if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade) return true;
if(((ItemDrillUpgrade)slotStack.getItem()).type == upgrade) return slotStack;
}
}
}
return false;
return null;
}
@Override
@ -222,12 +244,12 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
return slots;
}
public void breakBlocks(ItemStack stack, int radius, World world, int x, int y, int z, Entity entity){
public void breakBlocks(ItemStack stack, int radius, World world, int x, int y, int z, EntityPlayer player){
int xRange = radius;
int yRange = radius;
int zRange = 0;
MovingObjectPosition pos = WorldUtil.raytraceBlocksFromEntity(world, entity, 4.5D);
MovingObjectPosition pos = this.getMovingObjectPositionFromPlayer(world, player, false);
if(pos != null){
int side = pos.sideHit;
if(side == 0 || side == 1){
@ -246,24 +268,29 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
if(this.getEnergyStored(stack) >= use){
Block block = world.getBlock(xPos, yPos, zPos);
float hardness = block.getBlockHardness(world, xPos, yPos, zPos);
if(!(xPos == x && yPos == y && zPos == z) && hardness > -1.0F && this.canHarvestBlock(block, stack)){
if(hardness > -1.0F && this.canHarvestBlock(block, stack)){
this.extractEnergy(stack, use, false);
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
int meta = world.getBlockMetadata(xPos, yPos, zPos);
if(block.canSilkHarvest(world, (EntityPlayer)entity, xPos, yPos, zPos, meta) && EnchantmentHelper.getSilkTouchModifier((EntityPlayer)entity)){
if(block.canSilkHarvest(world, player, xPos, yPos, zPos, meta) && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){
drops.add(new ItemStack(block, 1, meta));
}
else{
drops.addAll(block.getDrops(world, xPos, yPos, zPos, meta, EnchantmentHelper.getFortuneModifier((EntityPlayer)entity)));
block.dropXpOnBlockBreak(world, x, y, z, block.getExpDrop(world, meta, EnchantmentHelper.getFortuneModifier((EntityPlayer)entity)));
int fortune = this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE) ? (this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1) : 0;
drops.addAll(block.getDrops(world, xPos, yPos, zPos, meta, fortune));
block.dropXpOnBlockBreak(world, x, y, z, block.getExpDrop(world, meta, fortune));
}
world.playAuxSFX(2001, xPos, yPos, zPos, Block.getIdFromBlock(block)+(meta << 12));
if(!(x == xPos && y == yPos && z == zPos)){
world.playAuxSFX(2001, xPos, yPos, zPos, Block.getIdFromBlock(block)+(meta << 12));
}
world.setBlockToAir(xPos, yPos, zPos);
for(ItemStack theDrop : drops){
world.spawnEntityInWorld(new EntityItem(world, xPos+0.5, yPos+0.5, zPos+0.5, theDrop));
EntityItem item = new EntityItem(world, xPos+0.5, yPos+0.5, zPos+0.5, theDrop);
item.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(item);
}
}
}
@ -286,17 +313,18 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
@Override
public boolean onBlockDestroyed(ItemStack stack, World world, Block block, int x, int y, int z, EntityLivingBase living){
int use = this.getEnergyUsePerBlock(stack);
if(this.getEnergyStored(stack) >= use){
this.extractEnergy(stack, use, false);
if(!world.isRemote){
if(!living.isSneaking()){
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){
if(living instanceof EntityPlayer){
EntityPlayer player = (EntityPlayer)living;
int use = this.getEnergyUsePerBlock(stack);
if(this.getEnergyStored(stack) >= use){
if(!world.isRemote){
if(!living.isSneaking() && this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.THREE_BY_THREE)){
if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE)){
this.breakBlocks(stack, 2, world, x, y, z, living);
this.breakBlocks(stack, 2, world, x, y, z, player);
}
else this.breakBlocks(stack, 1, world, x, y, z, living);
else this.breakBlocks(stack, 1, world, x, y, z, player);
}
else this.breakBlocks(stack, 0, world, x, y, z, player);
}
}
}
@ -306,7 +334,7 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
@Override
public float func_150893_a(ItemStack stack, Block block){
if(this.getEnergyStored(stack) < this.getEnergyUsePerBlock(stack)) return 0.0F;
if(block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil || block.getMaterial() == Material.rock || allSet.contains(block)) return efficiency;
if(block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil || block.getMaterial() == Material.rock || allSet.contains(block)) return this.getEfficiencyFromUpgrade(stack);
else return super.func_150893_a(stack, block);
}
@ -326,7 +354,9 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
if(!world.isRemote && player.isSneaking()) player.openGui(ActuallyAdditions.instance, GuiHandler.DRILL_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ);
if(!world.isRemote && player.isSneaking()){
player.openGui(ActuallyAdditions.instance, GuiHandler.DRILL_ID, world, (int)player.posX, (int)player.posY, (int)player.posZ);
}
return stack;
}
@ -350,11 +380,11 @@ public class ItemDrill extends ItemEnergyContainer implements INameableItem{
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
ItemUtil.addInformation(this, list, 3, "");
if(KeyUtil.isShiftPressed()){
list.add(this.getEnergyStored(stack) + "/" + this.getMaxEnergyStored(stack) + " RF");
}
else list.add(ItemUtil.shiftForInfo());
}
@Override

View file

@ -3,31 +3,32 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister;
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.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
public class ItemDrillUpgrade extends Item implements INameableItem{
public enum UpgradeType{
SPEED(10),
SPEED_II(20),
SPEED_III(30),
SILK_TOUCH(20), //Done
FORTUNE(40), //Done
FORTUNE_II(60), //Done
THREE_BY_THREE(5), //Done
FIVE_BY_FIVE(5), //Done
VEIN(30),
PLACER(0);
public int extraEnergy;
UpgradeType(int extraEnergy){
this.extraEnergy = extraEnergy;
}
SPEED,
SPEED_II,
SPEED_III,
SILK_TOUCH,
FORTUNE,
FORTUNE_II,
THREE_BY_THREE,
FIVE_BY_FIVE,
PLACER
}
public UpgradeType type;
@ -36,6 +37,32 @@ public class ItemDrillUpgrade extends Item implements INameableItem{
public ItemDrillUpgrade(UpgradeType type, String unlocName){
this.type = type;
this.unlocalizedName = unlocName;
this.setMaxStackSize(1);
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){
if(!world.isRemote && this.type == UpgradeType.PLACER){
this.setSlotToPlaceFrom(stack, player.inventory.currentItem);
}
return stack;
}
public void setSlotToPlaceFrom(ItemStack stack, int slot){
NBTTagCompound compound = stack.getTagCompound();
if(compound == null) compound = new NBTTagCompound();
compound.setInteger("SlotToPlaceFrom", slot+1);
stack.setTagCompound(compound);
}
public static int getSlotToPlaceFrom(ItemStack stack){
NBTTagCompound compound = stack.getTagCompound();
if(compound != null){
return compound.getInteger("SlotToPlaceFrom")-1;
}
return -1;
}
@Override
@ -58,4 +85,20 @@ public class ItemDrillUpgrade extends Item implements INameableItem{
public String getOredictName(){
return this.getName();
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
ItemUtil.addInformation(this, list, this.type == UpgradeType.PLACER ? 3 : 1, "");
if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip."+ModUtil.MOD_ID_LOWER+".itemDrillUpgrade.desc"));
if(this.type == UpgradeType.PLACER){
int slot = getSlotToPlaceFrom(stack);
if(slot >= 0){
list.add(StatCollector.translateToLocal("info."+ModUtil.MOD_ID_LOWER+".gui.slot")+": "+(slot+1));
}
}
}
}
}

View file

@ -36,7 +36,7 @@ public class ItemResonantRice extends Item implements INameableItem{
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
ItemUtil.addInformation(this, list, 1, "");
if(KeyUtil.isShiftPressed() && OreDictionary.getOres("nuggetEnderium").size() == 0) list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemResonantRice.uncraftable.desc"));
if(KeyUtil.isShiftPressed() && OreDictionary.getOres("nuggetEnderium", false).size() <= 0) list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemResonantRice.uncraftable.desc"));
}
@Override

View file

@ -34,7 +34,7 @@ public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlanta
public EnumPlantType type;
public String name;
public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, ItemStack returnItem){
public ItemSeed(String name, Block plant, Block soilBlock, EnumPlantType type, Item returnItem, int returnMeta){
super(plant, soilBlock);
this.name = name;
this.plant = plant;
@ -42,6 +42,7 @@ public class ItemSeed extends ItemSeeds implements INameableItem, IFactoryPlanta
this.type = type;
((BlockPlant)this.plant).seedItem = this;
((BlockPlant)this.plant).returnItem = returnItem;
((BlockPlant)this.plant).returnMeta = returnMeta;
}
@Override

View file

@ -21,6 +21,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.UseHoeEvent;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@ -130,4 +131,13 @@ public class ItemAllToolAA extends ItemTool implements INameableItem{
public String getOredictName(){
return oredictName;
}
@Override
public Set<String> getToolClasses(ItemStack stack){
HashSet<String> hashSet = new HashSet<String>();
hashSet.add("pickaxe");
hashSet.add("axe");
hashSet.add("shovel");
return hashSet;
}
}

View file

@ -84,7 +84,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == CrusherRecipeHandler.class){
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.instance().recipes;
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.recipes;
for(GrinderRecipes.GrinderRecipe recipe : recipes){
arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance));
}
@ -94,7 +94,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.instance().recipes;
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.recipes;
for(GrinderRecipes.GrinderRecipe recipe : recipes){
if(NEIServerUtils.areStacksSameType(recipe.firstOutput, result) || NEIServerUtils.areStacksSameType(recipe.secondOutput, result)) arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance));
}
@ -102,7 +102,7 @@ public class CrusherRecipeHandler extends TemplateRecipeHandler{
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.instance().recipes;
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.recipes;
for(GrinderRecipes.GrinderRecipe recipe : recipes){
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingredient)){
CachedCrush theRecipe = new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance);

View file

@ -10,14 +10,8 @@ import java.util.ArrayList;
public class GrinderRecipeRegistry{
private static final GrinderRecipeRegistry instance = new GrinderRecipeRegistry();
public static GrinderRecipeRegistry instance(){
return instance;
}
public ArrayList<SearchCase> searchCases = new ArrayList<SearchCase>();
public ArrayList<String> exceptions = new ArrayList<String>();
public static ArrayList<SearchCase> searchCases = new ArrayList<SearchCase>();
public static ArrayList<String> exceptions = new ArrayList<String>();
public static class SearchCase{
@ -30,11 +24,11 @@ public class GrinderRecipeRegistry{
}
}
public void registerFinally(){
public static void registerFinally(){
String[] names = OreDictionary.getOreNames();
for(String inputName : names){
if(!this.exceptions.contains(inputName)){
if(!exceptions.contains(inputName)){
int resultAmount = 1;
String inputNameWithoutPrefix = null;
@ -49,8 +43,8 @@ public class GrinderRecipeRegistry{
if(inputNameWithoutPrefix != null){
String inputWithDustPrefix = "dust" + inputNameWithoutPrefix;
ArrayList<ItemStack> allOresOfInitialInputName = OreDictionary.getOres(inputName);
ArrayList<ItemStack> allOresWithDustPrefix = OreDictionary.getOres(inputWithDustPrefix);
ArrayList<ItemStack> allOresOfInitialInputName = (ArrayList<ItemStack>)OreDictionary.getOres(inputName, false);
ArrayList<ItemStack> allOresWithDustPrefix = (ArrayList<ItemStack>)OreDictionary.getOres(inputWithDustPrefix, false);
if(allOresOfInitialInputName != null && allOresOfInitialInputName.size() > 0){
if(allOresWithDustPrefix != null && allOresWithDustPrefix.size() > 0){
for(ItemStack theInput : allOresOfInitialInputName){
@ -58,8 +52,8 @@ public class GrinderRecipeRegistry{
ItemStack input = theInput.copy();
ItemStack output = theDust.copy();
output.stackSize = resultAmount;
if(!GrinderRecipes.instance().hasRecipe(input, output)){
GrinderRecipes.instance().registerRecipe(input, output, null, 0);
if(!GrinderRecipes.hasRecipe(input, output)){
GrinderRecipes.registerRecipe(input, output, null, 0);
}
}
}

View file

@ -7,22 +7,16 @@ import java.util.ArrayList;
public class GrinderRecipes{
private static final GrinderRecipes instance = new GrinderRecipes();
public static ArrayList<GrinderRecipe> recipes = new ArrayList<GrinderRecipe>();
public ArrayList<GrinderRecipe> recipes = new ArrayList<GrinderRecipe>();
public static GrinderRecipes instance(){
return instance;
public static void registerRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int secondChance){
recipes.add(new GrinderRecipe(input, outputOne, outputTwo, secondChance));
}
public void registerRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int secondChance){
this.recipes.add(new GrinderRecipe(input, outputOne, outputTwo, secondChance));
}
public void registerRecipe(String input, String outputOne, String outputTwo, int secondChance, int outputAmount){
ArrayList<ItemStack> inputStacks = OreDictionary.getOres(input);
ArrayList<ItemStack> outputOneStacks = OreDictionary.getOres(outputOne);
ArrayList<ItemStack> outputTwoStacks = OreDictionary.getOres(outputTwo);
public static void registerRecipe(String input, String outputOne, String outputTwo, int secondChance, int outputAmount){
ArrayList<ItemStack> inputStacks = (ArrayList<ItemStack>)OreDictionary.getOres(input, false);
ArrayList<ItemStack> outputOneStacks = (ArrayList<ItemStack>)OreDictionary.getOres(outputOne, false);
ArrayList<ItemStack> outputTwoStacks = (ArrayList<ItemStack>)OreDictionary.getOres(outputTwo, false);
if(inputStacks != null && !inputStacks.isEmpty()){
for(ItemStack anInput : inputStacks){
@ -34,21 +28,21 @@ public class GrinderRecipes{
if(outputTwoStacks != null && !outputTwoStacks.isEmpty()){
for(ItemStack anOutputTwo : outputTwoStacks){
ItemStack theOutputTwo = anOutputTwo.copy();
this.registerRecipe(theInput, theOutputOne, theOutputTwo, secondChance);
registerRecipe(theInput, theOutputOne, theOutputTwo, secondChance);
}
}
else this.registerRecipe(theInput, theOutputOne, null, 0);
else registerRecipe(theInput, theOutputOne, null, 0);
}
}
}
}
}
public void registerRecipe(ItemStack input, ItemStack outputOne){
this.registerRecipe(input, outputOne, null, 0);
public static void registerRecipe(ItemStack input, ItemStack outputOne){
registerRecipe(input, outputOne, null, 0);
}
public ItemStack getOutput(ItemStack input, boolean wantSecond){
public static ItemStack getOutput(ItemStack input, boolean wantSecond){
for(GrinderRecipe recipe : recipes){
if(recipe.input.isItemEqual(input)){
return wantSecond ? recipe.secondOutput : recipe.firstOutput;
@ -57,14 +51,14 @@ public class GrinderRecipes{
return null;
}
public boolean hasRecipe(ItemStack input, ItemStack outputOne){
public static boolean hasRecipe(ItemStack input, ItemStack outputOne){
for(GrinderRecipe recipe : recipes){
if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne)) return true;
}
return false;
}
public int getSecondChance(ItemStack input){
public static int getSecondChance(ItemStack input){
for(GrinderRecipe recipe : recipes){
if(recipe.input.isItemEqual(input)){
return recipe.secondChance;
@ -73,7 +67,7 @@ public class GrinderRecipes{
return 0;
}
public class GrinderRecipe{
public static class GrinderRecipe{
public final ItemStack input;
public final ItemStack firstOutput;

View file

@ -57,6 +57,8 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityLavaFactoryController.class, ModUtil.MOD_ID_LOWER + ":tileEntityLavaFactoryController");
GameRegistry.registerTileEntity(TileEntityCoffeeMachine.class, ModUtil.MOD_ID_LOWER + ":tileEntityCoffeeMachine");
GameRegistry.registerTileEntity(TileEntityPhantomBooster.class, ModUtil.MOD_ID_LOWER + ":tileEntityPhantomBooster");
GameRegistry.registerTileEntity(TileEntityEnergizer.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnergizer");
GameRegistry.registerTileEntity(TileEntityEnervator.class, ModUtil.MOD_ID_LOWER + ":tileEntityEnervator");
}
@Override

View file

@ -63,7 +63,7 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
else if(this.isPlacer && worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ)){
int theSlot = testInventory(this.slots);
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, this.slots[theSlot]));
if(this.slots[0] != null && this.slots[0].stackSize <= 0) this.slots[0] = null;
if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0) this.slots[theSlot] = null;
}
}
}

View file

@ -28,6 +28,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean flag = this.currentBurnTime > 0;
if(this.currentBurnTime > 0){
this.currentBurnTime--;
@ -52,6 +53,15 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage);
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
}
if(flag != this.currentBurnTime > 0){
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if(meta == 1){
if(!(this.currentBurnTime <= 0 && this.slots[0] != null && TileEntityFurnace.getItemBurnTime(this.slots[0]) > 0 && energyProducedPerTick*TileEntityFurnace.getItemBurnTime(this.slots[0]) <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN)))
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
}
else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
}
}
}

View file

@ -0,0 +1,82 @@
package ellpeck.actuallyadditions.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyContainerItem;
import cofh.api.energy.IEnergyReceiver;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityEnergizer extends TileEntityInventoryBase implements IEnergyReceiver{
public EnergyStorage storage = new EnergyStorage(500000);
public TileEntityEnergizer(){
super(2, "energizer");
}
@Override
public void updateEntity(){
if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){
if(this.storage.getEnergyStored() > 0){
int received = ((IEnergyContainerItem)this.slots[0].getItem()).receiveEnergy(this.slots[0], this.storage.getEnergyStored(), false);
this.storage.extractEnergy(received, false);
}
if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) >= ((IEnergyContainerItem)this.slots[0].getItem()).getMaxEnergyStored(this.slots[0])){
this.slots[1] = this.slots[0].copy();
this.slots[0].stackSize--;
if(this.slots[0].stackSize <= 0) this.slots[0] = null;
}
}
}
@Override
public void writeToNBT(NBTTagCompound compound){
this.storage.writeToNBT(compound);
super.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound){
this.storage.readFromNBT(compound);
super.readFromNBT(compound);
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return slot == 0 && stack.getItem() instanceof IEnergyContainerItem;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == 1;
}
@SideOnly(Side.CLIENT)
public int getEnergyScaled(int i){
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
}
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate);
}
@Override
public int getEnergyStored(ForgeDirection from){
return this.storage.getEnergyStored();
}
@Override
public int getMaxEnergyStored(ForgeDirection from){
return this.storage.getMaxEnergyStored();
}
@Override
public boolean canConnectEnergy(ForgeDirection from){
return true;
}
}

View file

@ -0,0 +1,92 @@
package ellpeck.actuallyadditions.tile;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyContainerItem;
import cofh.api.energy.IEnergyProvider;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityEnervator extends TileEntityInventoryBase implements IEnergyProvider{
public EnergyStorage storage = new EnergyStorage(500000);
public TileEntityEnervator(){
super(2, "enervator");
}
@Override
public void updateEntity(){
if(this.slots[0] != null && this.slots[0].getItem() instanceof IEnergyContainerItem && this.slots[1] == null){
if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) > 0){
int toReceive = ((IEnergyContainerItem)this.slots[0].getItem()).extractEnergy(this.slots[0], this.storage.getMaxEnergyStored()-this.storage.getEnergyStored(), false);
this.storage.receiveEnergy(toReceive, false);
}
if(((IEnergyContainerItem)this.slots[0].getItem()).getEnergyStored(this.slots[0]) <= 0){
this.slots[1] = this.slots[0].copy();
this.slots[0].stackSize--;
if(this.slots[0].stackSize <= 0) this.slots[0] = null;
}
}
if(this.getEnergyStored(ForgeDirection.UNKNOWN) > 0){
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.UP, storage);
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.DOWN, storage);
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, storage);
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.EAST, storage);
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage);
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
}
}
@Override
public void writeToNBT(NBTTagCompound compound){
this.storage.writeToNBT(compound);
super.writeToNBT(compound);
}
@Override
public void readFromNBT(NBTTagCompound compound){
this.storage.readFromNBT(compound);
super.readFromNBT(compound);
}
@Override
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate){
return this.storage.extractEnergy(maxExtract, simulate);
}
@Override
public int getEnergyStored(ForgeDirection from){
return this.storage.getEnergyStored();
}
@Override
public int getMaxEnergyStored(ForgeDirection from){
return this.storage.getMaxEnergyStored();
}
@Override
public boolean canConnectEnergy(ForgeDirection from){
return true;
}
@SideOnly(Side.CLIENT)
public int getEnergyScaled(int i){
return this.getEnergyStored(ForgeDirection.UNKNOWN) * i / this.getMaxEnergyStored(ForgeDirection.UNKNOWN);
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return slot == 0 && stack.getItem() instanceof IEnergyContainerItem;
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == 1;
}
}

View file

@ -19,9 +19,9 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
public EnergyStorage storage = new EnergyStorage(30000);
public static int energyUsePerTick = ConfigIntValues.FURNACE_ENERGY_USED.getValue();
public int energyUsePerTick = ConfigIntValues.FURNACE_ENERGY_USED.getValue();
public int maxBurnTime = this.getStandardSpeed();
public int maxBurnTime = ConfigIntValues.FURNACE_DOUBLE_SMELT_TIME.getValue();
public int firstSmeltTime;
public int secondSmeltTime;
@ -34,6 +34,7 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean flag = this.firstSmeltTime > 0 || this.secondSmeltTime > 0;
boolean canSmeltOnFirst = this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1);
boolean canSmeltOnSecond = this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2);
@ -62,6 +63,14 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
else this.secondSmeltTime = 0;
if(this.storage.getEnergyStored() >= energyUsePerTick && this.firstSmeltTime > 0 || this.secondSmeltTime > 0) this.storage.extractEnergy(energyUsePerTick, false);
if(flag != (this.firstSmeltTime > 0 || this.secondSmeltTime > 0)){
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if(meta > 3){
if(!this.canSmeltOn(SLOT_INPUT_1, SLOT_OUTPUT_1) && !this.canSmeltOn(SLOT_INPUT_2, SLOT_OUTPUT_2)) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta-4, 2);
}
else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, meta+4, 2);
}
}
}
@ -135,10 +144,6 @@ public class TileEntityFurnaceDouble extends TileEntityInventoryBase implements
return slot == SLOT_OUTPUT_1 || slot == SLOT_OUTPUT_2;
}
public int getStandardSpeed(){
return ConfigIntValues.FURNACE_DOUBLE_SMELT_TIME.getValue();
}
@Override
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate){
return this.storage.receiveEnergy(maxReceive, simulate);

View file

@ -41,7 +41,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
public TileEntityGrinderDouble(){
super(6, "grinderDouble");
this.isDouble = true;
this.maxCrushTime = this.getStandardSpeed();
this.maxCrushTime = ConfigIntValues.GRINDER_DOUBLE_CRUSH_TIME.getValue();
energyUsePerTick = ConfigIntValues.GRINDER_DOUBLE_ENERGY_USED.getValue();
}
@ -54,7 +54,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
public static final int SLOT_OUTPUT_2_1 = 4;
public static final int SLOT_OUTPUT_2_2 = 5;
public static int energyUsePerTick;
public int energyUsePerTick;
public int maxCrushTime;
@ -70,7 +70,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
public TileEntityGrinder(){
super(3, "grinder");
this.isDouble = false;
this.maxCrushTime = this.getStandardSpeed();
this.maxCrushTime = ConfigIntValues.GRINDER_CRUSH_TIME.getValue();
energyUsePerTick = ConfigIntValues.GRINDER_ENERGY_USED.getValue();
}
@ -78,6 +78,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean flag = this.firstCrushTime > 0 || this.secondCrushTime > 0;
boolean canCrushOnFirst = this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2);
boolean canCrushOnSecond = false;
if(this.isDouble) canCrushOnSecond = this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2);
@ -107,13 +109,21 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
}
if(this.storage.getEnergyStored() >= energyUsePerTick && this.firstCrushTime > 0 || this.secondCrushTime > 0) this.storage.extractEnergy(energyUsePerTick, false);
if(flag != (this.firstCrushTime > 0 || this.secondCrushTime > 0)){
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if(meta == 1){
if(!this.canCrushOn(SLOT_INPUT_1, SLOT_OUTPUT_1_1, SLOT_OUTPUT_1_2) && (!this.isDouble || !this.canCrushOn(SLOT_INPUT_2, SLOT_OUTPUT_2_1, SLOT_OUTPUT_2_2))) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
}
else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
}
}
}
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput){
if(this.slots[theInput] != null){
ItemStack outputOne = GrinderRecipes.instance().getOutput(this.slots[theInput], false);
ItemStack outputTwo = GrinderRecipes.instance().getOutput(this.slots[theInput], true);
ItemStack outputOne = GrinderRecipes.getOutput(this.slots[theInput], false);
ItemStack outputTwo = GrinderRecipes.getOutput(this.slots[theInput], true);
if(this.slots[theInput] != null){
if(outputOne != null){
if((this.slots[theFirstOutput] == null || (this.slots[theFirstOutput].isItemEqual(outputOne) && this.slots[theFirstOutput].stackSize <= this.slots[theFirstOutput].getMaxStackSize()-outputOne.stackSize)) && (outputTwo == null || (this.slots[theSecondOutput] == null || (this.slots[theSecondOutput].isItemEqual(outputTwo) && this.slots[theSecondOutput].stackSize <= this.slots[theSecondOutput].getMaxStackSize()-outputTwo.stackSize)))){
@ -126,12 +136,14 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
}
public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput){
ItemStack outputOnFirst = GrinderRecipes.instance().getOutput(this.slots[theInput], false);
if (this.slots[theFirstOutput] == null) this.slots[theFirstOutput] = outputOnFirst.copy();
else if(this.slots[theFirstOutput].getItem() == outputOnFirst.getItem()) this.slots[theFirstOutput].stackSize += outputOnFirst.stackSize;
ItemStack outputOnFirst = GrinderRecipes.getOutput(this.slots[theInput], false);
if(outputOnFirst != null){
if(this.slots[theFirstOutput] == null) this.slots[theFirstOutput] = outputOnFirst.copy();
else if(this.slots[theFirstOutput].getItem() == outputOnFirst.getItem()) this.slots[theFirstOutput].stackSize += outputOnFirst.stackSize;
}
int chance = GrinderRecipes.instance().getSecondChance(this.slots[theInput]);
ItemStack outputOnSecond = GrinderRecipes.instance().getOutput(this.slots[theInput], true);
int chance = GrinderRecipes.getSecondChance(this.slots[theInput]);
ItemStack outputOnSecond = GrinderRecipes.getOutput(this.slots[theInput], true);
if(outputOnSecond != null){
int rand = new Random().nextInt(100) + 1;
if(rand <= chance){
@ -177,7 +189,7 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.instance().getOutput(stack, false) != null;
return (i == SLOT_INPUT_1 || i == SLOT_INPUT_2) && GrinderRecipes.getOutput(stack, false) != null;
}
@Override
@ -189,8 +201,4 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg
public boolean canExtractItem(int slot, ItemStack stack, int side){
return slot == SLOT_OUTPUT_1_1 || slot == SLOT_OUTPUT_1_2 || slot == SLOT_OUTPUT_2_1 || slot == SLOT_OUTPUT_2_2;
}
public int getStandardSpeed(){
return this.isDouble ? ConfigIntValues.GRINDER_DOUBLE_CRUSH_TIME.getValue() : ConfigIntValues.GRINDER_CRUSH_TIME.getValue();
}
}

View file

@ -34,6 +34,7 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
boolean flag = this.currentBurnTime > 0;
if(this.currentBurnTime > 0){
this.currentBurnTime--;
@ -64,6 +65,15 @@ public class TileEntityOilGenerator extends TileEntityInventoryBase implements I
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.SOUTH, storage);
WorldUtil.pushEnergy(worldObj, xCoord, yCoord, zCoord, ForgeDirection.WEST, storage);
}
if(flag != this.currentBurnTime > 0){
int meta = worldObj.getBlockMetadata(xCoord, yCoord, zCoord);
if(meta == 1){
if(!(energyProducedPerTick*this.maxBurnTime <= this.getMaxEnergyStored(ForgeDirection.UNKNOWN)-this.getEnergyStored(ForgeDirection.UNKNOWN) && FluidContainerRegistry.BUCKET_VOLUME <= this.tank.getCapacity()-this.tank.getFluidAmount()))
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 2);
}
else worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 2);
}
}
}

View file

@ -77,7 +77,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase{
if(boundWorld.getBlock(boundPosition.posX, boundPosition.posY, boundPosition.posZ).isReplaceable(boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ)){
int theSlot = TileEntityBreaker.testInventory(this.slots);
this.setInventorySlotContents(theSlot, WorldUtil.placeBlockAtSide(ForgeDirection.UNKNOWN, boundWorld, boundPosition.posX, boundPosition.posY, boundPosition.posZ, this.slots[theSlot]));
if(this.slots[0] != null && this.slots[0].stackSize <= 0) this.slots[0] = null;
if(this.slots[theSlot] != null && this.slots[theSlot].stackSize <= 0) this.slots[theSlot] = null;
}
}
}

View file

@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger;
public class ModUtil{
public static final String VERSION = "1.7.10-0.0.5.7";
public static final String VERSION = "1.7.10-0.0.6.0";
public static final String MOD_ID = "ActuallyAdditions";
public static final String NAME = "Actually Additions";

View file

@ -3,17 +3,11 @@ package ellpeck.actuallyadditions.util;
import cofh.api.energy.EnergyStorage;
import cofh.api.energy.IEnergyReceiver;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.IPlantable;
@ -28,26 +22,6 @@ public class WorldUtil{
return new ChunkCoordinates(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
}
public static MovingObjectPosition raytraceBlocksFromEntity(World world, Entity player, double range){
float f1 = player.prevRotationPitch+(player.rotationPitch-player.prevRotationPitch)*1.0F;
float f2 = player.prevRotationYaw+(player.rotationYaw-player.prevRotationYaw)*1.0F;
double d0 = player.prevPosX+(player.posX-player.prevPosX)*1.0D;
double d1 = player.prevPosY+(player.posY-player.prevPosY)*1.0D;
if(!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D;
double d2 = player.prevPosZ+(player.posZ-player.prevPosZ)*1.0D;
Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2);
float f3 = MathHelper.cos(-f2*0.017453292F-(float)Math.PI);
float f4 = MathHelper.sin(-f2*0.017453292F-(float)Math.PI);
float f5 = -MathHelper.cos(-f1*0.017453292F);
float f6 = MathHelper.sin(-f1*0.017453292F);
float f7 = f4*f5;
float f8 = f3*f5;
double d3 = range;
if(player instanceof EntityPlayerMP) d3 = ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance();
Vec3 vec31 = vec3.addVector((double)f7*d3, (double)f6*d3, (double)f8*d3);
return world.func_147447_a(vec3, vec31, false, true, false);
}
public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){
if(side == ForgeDirection.UNKNOWN){
world.setBlockToAir(x, y, z);
@ -65,7 +39,6 @@ public class WorldUtil{
if(((IEnergyReceiver)tile).canConnectEnergy(side.getOpposite())){
int receive = ((IEnergyReceiver)tile).receiveEnergy(side.getOpposite(), Math.min(storage.getMaxExtract(), storage.getEnergyStored()), false);
storage.extractEnergy(receive, false);
world.markBlockForUpdate(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
}
}
}
@ -76,7 +49,6 @@ public class WorldUtil{
if(((IFluidHandler)tile).canFill(side.getOpposite(), tank.getFluid().getFluid())){
int receive = ((IFluidHandler)tile).fill(side.getOpposite(), tank.getFluid(), true);
tank.drain(receive, true);
world.markBlockForUpdate(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
}
}
}

View file

@ -19,10 +19,22 @@ tile.actuallyadditions.blockFurnaceSolar.name=Solar Panel
tile.actuallyadditions.blockHeatCollector.name=Heat Collector
tile.actuallyadditions.blockItemRepairer.name=Item Repairer
item.actuallyadditions.itemDrill.name=Drill
tooltip.actuallyadditions.itemDrill.desc.1=Mines all the Blocks!
tooltip.actuallyadditions.itemDrill.desc.2=Powered by RF! Charge in an Energizer! Discharge in an Enervator!
tooltip.actuallyadditions.itemDrill.desc.3=Drill Upgrades can be applied through Sneak-Right-Clicking!
tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing
tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing
tile.actuallyadditions.blockGreenhouseGlass.name=Greenhouse Glass
tile.actuallyadditions.blockEnergizer.name=Energizer
tooltip.actuallyadditions.blockEnergizer.desc.1=A "Charger", if you will
tooltip.actuallyadditions.blockEnergizer.desc.2=Charges Items that can hold RF
tile.actuallyadditions.blockEnervator.name=Enervator
tooltip.actuallyadditions.blockEnervator.desc.1=A "Discharger", if you will
tooltip.actuallyadditions.blockEnervator.desc.2=Discharges Items that can hold RF
tile.actuallyadditions.blockRice.name=Rice Plant
tooltip.actuallyadditions.blockRice.desc=It's growing... kind of..
item.actuallyadditions.itemFoodRice.name=Rice
@ -43,6 +55,9 @@ tooltip.actuallyadditions.blockMiscCharcoal.desc=Crafted from Charcoal
item.actuallyadditions.itemMiscRiceSlime.name=Rice Slimeball
tooltip.actuallyadditions.itemMiscRiceSlime.desc=It's sticky... and smells kinda good...
item.actuallyadditions.itemBattery.name=Battery
tooltip.actuallyadditions.itemBattery.desc=Stores RF! Charge in an Energizer! Discharge in an Enervator!
tile.actuallyadditions.blockCoalGenerator.name=Coal Generator
tooltip.actuallyadditions.blockCoalGenerator.desc=Produces Energy from Coal and other flammable Materials
@ -85,13 +100,13 @@ tile.actuallyadditions.blockFluidPlacer.name=Fluid Placer
tooltip.actuallyadditions.blockFluidPlacer.desc=Places Fluids stored inside it
tooltip.actuallyadditions.paxel.desc=It's an Axe, Shovel, Sword, Hoe and Pickaxe! Combined!
item.actuallyadditions.woodenPaxel.name=Wooden Paxel
item.actuallyadditions.stonePaxel.name=Stone Paxel
item.actuallyadditions.ironPaxel.name=Iron Paxel
item.actuallyadditions.goldPaxel.name=Golden Paxel
item.actuallyadditions.diamondPaxel.name=Diamond Paxel
item.actuallyadditions.emeraldPaxel.name=Emerald Paxel
item.actuallyadditions.obsidianPaxel.name=Obsidian Paxel
item.actuallyadditions.woodenPaxel.name=Wooden Paxelordoe
item.actuallyadditions.stonePaxel.name=Stone Paxelordoe
item.actuallyadditions.ironPaxel.name=Iron Paxelordoe
item.actuallyadditions.goldPaxel.name=Golden Paxelordoe
item.actuallyadditions.diamondPaxel.name=Diamond Paxelordoe
item.actuallyadditions.emeraldPaxel.name=Emerald Paxelordoe
item.actuallyadditions.obsidianPaxel.name=Obsidian Paxelordoe
tile.actuallyadditions.blockFluidCollector.name=Fluid Collector
tooltip.actuallyadditions.blockFluidCollector.desc=Stores Fluids in front of it inside it
@ -169,6 +184,29 @@ tile.actuallyadditions.blockInputter.add.13.name=Efficient Sucking Dilettant
tile.actuallyadditions.blockInputter.add.14.name=Extreme Sand Digger
tile.actuallyadditions.blockInputter.add.15.name=MISSINGNO
item.actuallyadditions.itemDrillUpgradeSpeed.name=Drill Speed I Augment
item.actuallyadditions.itemDrillUpgradeSpeedII.name=Drill Speed II Augment
item.actuallyadditions.itemDrillUpgradeSpeedIII.name=Drill Speed III Augment
item.actuallyadditions.itemDrillUpgradeSilkTouch.name=Drill Silk Touch Augment
item.actuallyadditions.itemDrillUpgradeFortune.name=Drill Fortune I Augment
item.actuallyadditions.itemDrillUpgradeFortuneII.name=Drill Fortune II Augment
item.actuallyadditions.itemDrillUpgradeBlockPlacing.name=Drill Block Placing Augment
item.actuallyadditions.itemDrillUpgradeThreeByThree.name=Drill Three By Three Mining Augment
item.actuallyadditions.itemDrillUpgradeFiveByFive.name=Drill Five By Five Mining Augment
tooltip.actuallyadditions.itemDrillUpgradeSpeed.desc=Makes the Drill faster!
tooltip.actuallyadditions.itemDrillUpgradeSpeedII.desc=Makes the Drill even faster! Requires Tier 1.
tooltip.actuallyadditions.itemDrillUpgradeSpeedIII.desc=Insta-Mine! Requires Tier 1 and 2.
tooltip.actuallyadditions.itemDrillUpgradeSilkTouch.desc=Makes the Drill silky.
tooltip.actuallyadditions.itemDrillUpgradeFortune.desc=Gives the Drill Fortune I.
tooltip.actuallyadditions.itemDrillUpgradeFortuneII.desc=Gives the Drill Fortune III! Requires Tier 1.
tooltip.actuallyadditions.itemDrillUpgradeBlockPlacing.desc.1=Places Blocks from your Hotbar when Right-Clicking with the Drill!
tooltip.actuallyadditions.itemDrillUpgradeBlockPlacing.desc.2=You can define the Slot on your Hotbar to place from!
tooltip.actuallyadditions.itemDrillUpgradeBlockPlacing.desc.3=Sneak-Right-Click this Upgrade in the desired Slot to store it!
tooltip.actuallyadditions.itemDrillUpgradeThreeByThree.desc=Lets you mine a 3x3 Area!
tooltip.actuallyadditions.itemDrillUpgradeFiveByFive.desc=Lets you mine a 5x5 Area! Requires the 3x3 Upgrade.
tooltip.actuallyadditions.itemDrillUpgrade.desc=Sneak-Right-Click the Drill to apply Upgrades!
tile.actuallyadditions.blockMiscEnderCasing.name=Ender Casing
tooltip.actuallyadditions.blockMiscEnderCasing.desc=Extremely sturdy casing, used for crafting
@ -450,6 +488,9 @@ container.actuallyadditions.energyface.name=Energyface
container.actuallyadditions.fluidPlacer.name=Fluid Placer
container.actuallyadditions.fluidCollector.name=Fluid Collector
container.actuallyadditions.coffeeMachine.name=Coffee Machine
container.actuallyadditions.drill.name=Drill
container.actuallyadditions.energizer.name=Energizer
container.actuallyadditions.enervator.name=Enervator
container.nei.actuallyadditions.crushing.name=Crusher
container.nei.actuallyadditions.ballOfHair.name=Ball Of Hair Usage

Binary file not shown.

Before

Width:  |  Height:  |  Size: 550 B

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 807 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 537 B

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View file

@ -1 +1 @@
Fixed a Bug caused by fixing the last Bug... Whoops...
Drills, Drill Upgrades, Energizer, Enervator, Batteries

View file

@ -1 +1 @@
1.7.10-0.0.5.7
1.7.10-0.0.6.0