Merge pull request #6 from Ellpeck/master

Merge current changes to fork.
This commit is contained in:
Paktosan 2015-05-07 09:31:41 +02:00
commit 009c941b64
165 changed files with 4055 additions and 1007 deletions

3
.gitignore vendored
View file

@ -5,4 +5,5 @@
/.idea /.idea
/*.iml /*.iml
/*.ipr /*.ipr
/*.iws /*.iws
/lib

View file

@ -16,18 +16,44 @@ buildscript {
} }
apply plugin: 'forge' apply plugin: 'forge'
apply plugin: 'maven'
version = "1.7.10-0.0.3.3" version = "1.7.10-0.0.4.3"
group = "ellpeck.actuallyadditions" group = "ellpeck.actuallyadditions"
archivesBaseName = "ActuallyAdditions" archivesBaseName = "ActuallyAdditions"
minecraft { minecraft {
version = "1.7.10-10.13.2.1291" version = "1.7.10-10.13.3.1395-1710ls"
runDir = "idea" runDir = "idea"
} }
dependencies{ repositories {
maven {
name "Mobius"
url "http://mobiusstrip.eu/maven"
}
maven {
name "ChickenBones"
url "http://chickenbones.net/maven/"
}
}
dependencies {
compile "mcp.mobius.waila:Waila:1.5.6_1.7.10"
/*When Compiling from Github, you will need to have this file present
because InventoryTweaks doesn't have a Maven Repo.
But no one is going to download and compile this anyway, so it doesn't really matter. */
compile files("lib/InventoryTweaks-api-1.58-147.jar")
}
task copyChickenBones(type: Copy, dependsOn: "extractUserDev") {
from { configurations.compile }
include "**/*Chicken*.jar", "**/*NotEnoughItems*.jar"
exclude "**/CodeChickenLib*"
into file("./run/mods")
mustRunAfter "deobfBinJar"
mustRunAfter "repackMinecraft"
} }
processResources{ processResources{
@ -38,7 +64,7 @@ processResources{
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info' include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version expand 'update':project.version, 'mcversion':project.minecraft.version
} }
from(sourceSets.main.resources.srcDirs) { from(sourceSets.main.resources.srcDirs) {

1
newestVersion.txt Normal file
View file

@ -0,0 +1 @@
1.7.10-0.0.4.3

View file

@ -5,6 +5,7 @@ import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements; import ellpeck.actuallyadditions.achievement.InitAchievements;
@ -13,12 +14,12 @@ import ellpeck.actuallyadditions.config.ConfigurationHandler;
import ellpeck.actuallyadditions.crafting.GrinderCrafting; import ellpeck.actuallyadditions.crafting.GrinderCrafting;
import ellpeck.actuallyadditions.crafting.InitCrafting; import ellpeck.actuallyadditions.crafting.InitCrafting;
import ellpeck.actuallyadditions.event.InitEvents; import ellpeck.actuallyadditions.event.InitEvents;
import ellpeck.actuallyadditions.gen.InitVillager;
import ellpeck.actuallyadditions.gen.OreGen; import ellpeck.actuallyadditions.gen.OreGen;
import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.material.InitItemMaterials; import ellpeck.actuallyadditions.material.InitItemMaterials;
import ellpeck.actuallyadditions.network.PacketHandler; import ellpeck.actuallyadditions.network.PacketHandler;
import ellpeck.actuallyadditions.oredict.OreDictRegistry;
import ellpeck.actuallyadditions.proxy.IProxy; import ellpeck.actuallyadditions.proxy.IProxy;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -42,7 +43,7 @@ public class ActuallyAdditions{
InitItemMaterials.init(); InitItemMaterials.init();
InitBlocks.init(); InitBlocks.init();
InitItems.init(); InitItems.init();
OreDictRegistry.init(); InitVillager.init();
proxy.preInit(); proxy.preInit();
Util.logInfo("PreInitialization Finished."); Util.logInfo("PreInitialization Finished.");
@ -59,6 +60,7 @@ public class ActuallyAdditions{
TileEntityBase.init(); TileEntityBase.init();
InitEvents.init(); InitEvents.init();
InitCrafting.init(); InitCrafting.init();
FMLInterModComms.sendMessage("Waila", "register", "ellpeck.actuallyadditions.waila.WailaDataProvider.register");
proxy.init(); proxy.init();
Util.logInfo("Initialization Finished."); Util.logInfo("Initialization Finished.");

View file

@ -1,13 +1,8 @@
-Redstone Control for the ESD
-Quartz Enchanter -Quartz Enchanter
-Lets you enchant Tools with Black Quartz -Lets you enchant Tools with Black Quartz
-Doesn't use Levels -Doesn't use Levels
-Needs Quartz and Diamond Blocks instead of Bookcases around -Needs Quartz and Diamond Blocks instead of Bookcases around
-Advanced ESD
-Has a Filter
-Instant Teleport Device -Instant Teleport Device
-Teleports Players to where they look (Much like the Bukkit Compass) -Teleports Players to where they look (Much like the Bukkit Compass)
@ -30,10 +25,6 @@
-Has a Recipe saved -Has a Recipe saved
-Crafts Recipe on Shift-Right-Click if all Items are in Inventory -Crafts Recipe on Shift-Right-Click if all Items are in Inventory
-Repair Station
-Powered by Coal
-Repairs Items slowly
-TNT Arrows -TNT Arrows
-Teleport Arrows -Teleport Arrows
@ -58,5 +49,15 @@
-Decorative Lead -Decorative Lead
-Can be placed between two Fences for Decoration -Can be placed between two Fences for Decoration
-Greenhouse Glass -Crafting Table Minecart
-Gives Plants below more Growth Ticks -Anvil Minecart
-Dropper Minecart
-Super Speed Track
-File Jukebox
-Plays Sound Files put into your Minecraft Folder
-RF Implementation
-Power Acceptor Block that powers Machines
-Machines still don't accept RF themselves!
-Solar Panel & Heat Collector produce RF

View file

@ -1,15 +0,0 @@
package ellpeck.actuallyadditions.achievement;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
public class AchievementAA extends Achievement{
public AchievementAA(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){
super("achievement." + ModUtil.MOD_ID_LOWER + "." + name, ModUtil.MOD_ID_LOWER + "." + name, x, y, displayStack, hasToHaveBefore);
/*InitAchievements.achievementList.add(this);
if(hasToHaveBefore == null) this.initIndependentStat();
this.registerStat();*/
}
}

View file

@ -1,48 +1,31 @@
package ellpeck.actuallyadditions.achievement; package ellpeck.actuallyadditions.achievement;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.stats.Achievement;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.AchievementPage;
import java.util.ArrayList;
public class InitAchievements{ public class InitAchievements{
/*public static AchievementPage theAchievementPage; public static final int CRAFTING_ACH = 0;
public static final int SMELTING_ACH = 1;
public static final int PICKUP_ACH = 2;
public static AchievementPage theAchievementPage;
public static ArrayList<Achievement> achievementList = new ArrayList<Achievement>(); public static ArrayList<Achievement> achievementList = new ArrayList<Achievement>();
public static Achievement achievementCraftKnifeBlade;
public static Achievement achievementCraftKnife;
public static Achievement achievementCraftDough;
public static Achievement achievementSmeltBaguette;
public static Achievement achievementCraftSubSandwich;
public static Achievement achievementCraftMashedFood;
public static Achievement achievementCraftCompost;
public static Achievement achievementCraftFertilizer;
public static Achievement achievementCraftPaperCone;
public static Achievement achievementCraftFrenchFry;
public static Achievement achievementCraftFrenchFries;
public static Achievement achievementCraftFishNChips;*/
public static void init(){ public static void init(){
/*Util.logInfo("Initializing Achievements..."); Util.logInfo("Initializing Achievements...");
achievementCraftKnifeBlade = new AchievementAA("craftKnifeBlade", -2, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), null);
achievementCraftKnife = new AchievementAA("craftKnife", 0, 0, new ItemStack(InitItems.itemKnife), achievementCraftKnifeBlade);
achievementCraftDough = new AchievementAA("craftDough", 0, -3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), achievementCraftKnife);
achievementSmeltBaguette = new AchievementAA("smeltBaguette", 2, -3, new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), achievementCraftDough);
achievementCraftSubSandwich = new AchievementAA("craftSubSandwich", 4, -3, new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()), achievementSmeltBaguette);
achievementCraftMashedFood = new AchievementAA("craftMashedFood", 3, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()), achievementCraftKnife);
achievementCraftCompost = new AchievementAA("craftCompost", 5, 0, new ItemStack(InitBlocks.blockCompost), achievementCraftMashedFood);
achievementCraftFertilizer = new AchievementAA("craftFertilizer", 7, 0, new ItemStack(InitItems.itemFertilizer), achievementCraftCompost);
achievementCraftPaperCone = new AchievementAA("craftPaperCone", 0, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), achievementCraftKnife);
achievementCraftFrenchFry = new AchievementAA("craftFrenchFry", 2, 3, new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal()), achievementCraftPaperCone);
achievementCraftFrenchFries = new AchievementAA("craftFrenchFries", 4, 4, new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()), achievementCraftFrenchFry);
achievementCraftFishNChips = new AchievementAA("craftFishNChips", 4, 2, new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()), achievementCraftFrenchFry);
for(int i = 0; i < TheAchievements.values().length; i++){
achievementList.add(TheAchievements.values()[i].ach);
}
theAchievementPage = new AchievementPage(StatCollector.translateToLocal("achievement.page." + ModUtil.MOD_ID_LOWER), achievementList.toArray(new Achievement[achievementList.size()])); theAchievementPage = new AchievementPage(StatCollector.translateToLocal("achievement.page." + ModUtil.MOD_ID_LOWER), achievementList.toArray(new Achievement[achievementList.size()]));
AchievementPage.registerAchievementPage(theAchievementPage);*/ AchievementPage.registerAchievementPage(theAchievementPage);
} }
} }

View file

@ -0,0 +1,41 @@
package ellpeck.actuallyadditions.achievement;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.Achievement;
public enum TheAchievements{
//Special Stuff Path
PICK_UP_XP("pickUpSolidXP", 0, 0, new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()), null, InitAchievements.PICKUP_ACH),
//Food & Fertilizer Path
CRAFT_KNIFE_BLADE("craftKnifeBlade", 0, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), null),
CRAFT_KNIFE("craftKnife", 2, 2, new ItemStack(InitItems.itemKnife), CRAFT_KNIFE_BLADE.ach),
CRAFT_MASHED_FOOD("craftMashedFood", 4, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal()), CRAFT_KNIFE.ach),
//Machine Path
CRAFT_WOODEN_CASE("craftWoodenCasing", 0, -3, new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()), null),
CRAFT_STONE_CASE("craftStoneCasing", 2, -4, new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()), CRAFT_WOODEN_CASE.ach),
CRAFT_COIL("craftBasicCoil", 2, -2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()), CRAFT_WOODEN_CASE.ach),
CRAFT_ADVANCED_COIL("craftAdvancedCoil", 4, -2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()), CRAFT_COIL.ach);
public final Achievement ach;
public final int type;
TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore, int type){
this.ach = new Achievement("achievement." + ModUtil.MOD_ID_LOWER + "." + name, ModUtil.MOD_ID_LOWER + "." + name, x, y, displayStack, hasToHaveBefore);
if(hasToHaveBefore == null) this.ach.initIndependentStat();
this.ach.registerStat();
this.type = type;
}
TheAchievements(String name, int x, int y, ItemStack displayStack, Achievement hasToHaveBefore){
this(name, x, y, displayStack, hasToHaveBefore, InitAchievements.CRAFTING_ACH);
}
}

View file

@ -0,0 +1,135 @@
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.TileEntityBreaker;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
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.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
public class BlockBreaker extends BlockContainerBase implements INameableItem{
private IIcon frontIcon;
private IIcon topIcon;
private boolean isPlacer;
public BlockBreaker(boolean isPlacer){
super(Material.rock);
this.isPlacer = isPlacer;
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker();
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1) return this.topIcon;
if(side == 3) return this.frontIcon;
return this.blockIcon;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z);
if(side != meta && (side == 0 || side == 1)) return this.topIcon;
if(side == meta) return this.frontIcon;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front");
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
}
@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){
TileEntityBreaker breaker = (TileEntityBreaker)world.getTileEntity(x, y, z);
if (breaker != null) player.openGui(ActuallyAdditions.instance, GuiHandler.BREAKER_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.isPlacer ? "blockPlacer" : "blockBreaker";
}
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.rare;
}
@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, 1, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -0,0 +1,119 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
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.init.Blocks;
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 BlockCoffeeMachine extends BlockContainerBase implements INameableItem{
public BlockCoffeeMachine(){
super(Material.wood);
this.setHarvestLevel("axe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeWood);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int f6, float f7, float f8, float f9){
if(!world.isRemote){
}
return true;
}
@Override
public IIcon getIcon(int side, int metadata){
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = Blocks.hopper.getIcon(0, 0);
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
public int getRenderType(){
return RenderingRegistry.getNextAvailableRenderId();
}
@Override
public TileEntity createNewTileEntity(World world, int meta){
return null;
}
@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 "blockCoffeeMachine";
}
@Override
public String getOredictName(){
return this.getName();
}
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, 1, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -3,15 +3,13 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.ItemFertilizer; import ellpeck.actuallyadditions.items.ItemFertilizer;
import ellpeck.actuallyadditions.items.ItemMisc; import ellpeck.actuallyadditions.items.ItemMisc;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.tile.TileEntityCompost; import ellpeck.actuallyadditions.tile.TileEntityCompost;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -24,12 +22,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class BlockCompost extends BlockContainerBase implements IName{ public class BlockCompost extends BlockContainerBase implements INameableItem{
public BlockCompost(){ public BlockCompost(){
super(Material.wood); super(Material.wood);
@ -44,7 +41,7 @@ public class BlockCompost extends BlockContainerBase implements IName{
ItemStack stackPlayer = player.getCurrentEquippedItem(); ItemStack stackPlayer = player.getCurrentEquippedItem();
TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(x, y, z); TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(x, y, z);
//Add items to be composted //Add items to be composted
if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < ConfigValues.compostAmountNeededToConvert))){ if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < ConfigIntValues.COMPOST_AMOUNT.getValue()))){
if(tile.slots[0] == null) tile.slots[0] = new ItemStack(stackPlayer.getItem(), 1, TheMiscItems.MASHED_FOOD.ordinal()); if(tile.slots[0] == null) tile.slots[0] = new ItemStack(stackPlayer.getItem(), 1, TheMiscItems.MASHED_FOOD.ordinal());
else tile.slots[0].stackSize++; else tile.slots[0].stackSize++;
if(!player.capabilities.isCreativeMode) player.inventory.getCurrentItem().stackSize--; if(!player.capabilities.isCreativeMode) player.inventory.getCurrentItem().stackSize--;
@ -125,6 +122,11 @@ public class BlockCompost extends BlockContainerBase implements IName{
return "blockCompost"; return "blockCompost";
} }
@Override
public String getOredictName(){
return this.getName();
}
public static class TheItemBlock extends ItemBlock{ public static class TheItemBlock extends ItemBlock{
private Block theBlock; private Block theBlock;
@ -150,12 +152,7 @@ public class BlockCompost extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()){ BlockUtil.addInformation(theBlock, list, 1, "");
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.1"));
//TODO Remove second info
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc.2"));
}
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -0,0 +1,132 @@
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.TileEntityDropper;
import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockPistonBase;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
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.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
public class BlockDropper extends BlockContainerBase implements INameableItem{
private IIcon frontIcon;
private IIcon topIcon;
public BlockDropper(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack){
int rotation = BlockPistonBase.determineOrientation(world, x, y, z, player);
world.setBlockMetadataWithNotify(x, y, z, rotation, 2);
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityDropper();
}
@Override
public IIcon getIcon(int side, int meta){
if(side == 0 || side == 1) return this.topIcon;
if(side == 3) return this.frontIcon;
return this.blockIcon;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z);
if(side != meta && (side == 0 || side == 1)) return this.topIcon;
if(side == meta) return this.frontIcon;
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.frontIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Front");
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
}
@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){
TileEntityDropper dropper = (TileEntityDropper)world.getTileEntity(x, y, z);
if (dropper != null) player.openGui(ActuallyAdditions.instance, GuiHandler.DROPPER_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 "blockDropper";
}
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.rare;
}
@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, 1, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityFeeder; import ellpeck.actuallyadditions.tile.TileEntityFeeder;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,20 +17,24 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class BlockFeeder extends BlockContainerBase implements IName{ public class BlockFeeder extends BlockContainerBase implements INameableItem{
private IIcon topIcon; private IIcon topIcon;
public BlockFeeder(){ public BlockFeeder(){
super(Material.wood); super(Material.rock);
this.setHarvestLevel("axe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F); this.setHardness(1.0F);
this.setStepSound(soundTypeWood); this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
} }
@Override @Override
@ -97,8 +100,7 @@ public class BlockFeeder extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); BlockUtil.addInformation(theBlock, list, 1, "");
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -4,10 +4,8 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityFishingNet; import ellpeck.actuallyadditions.tile.TileEntityFishingNet;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -18,12 +16,11 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class BlockFishingNet extends BlockContainerBase implements IName{ public class BlockFishingNet extends BlockContainerBase implements INameableItem{
public BlockFishingNet(){ public BlockFishingNet(){
super(Material.wood); super(Material.wood);
@ -33,6 +30,11 @@ public class BlockFishingNet extends BlockContainerBase implements IName{
this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F); this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F);
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFishingNet(); return new TileEntityFishingNet();
@ -94,8 +96,7 @@ public class BlockFishingNet extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); BlockUtil.addInformation(theBlock, list, 1, "");
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -20,14 +19,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockFurnaceDouble extends BlockContainerBase implements IName{ public class BlockFurnaceDouble extends BlockContainerBase implements INameableItem{
private IIcon topIcon; private IIcon topIcon;
private IIcon onIcon; private IIcon onIcon;
@ -42,23 +40,8 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{
} }
@Override @Override
public void onBlockAdded(World world, int x, int y, int z){ public String getOredictName(){
super.onBlockAdded(world, x, y, z); return this.getName();
if (!world.isRemote){
Block block1 = world.getBlock(x, y, z-1);
Block block2 = world.getBlock(x, y, z+1);
Block block3 = world.getBlock(x-1, y, z);
Block block4 = world.getBlock(x+1, y, z);
int metaToSet = 1;
if (block1.func_149730_j() && !block2.func_149730_j()) metaToSet = 0;
if (block2.func_149730_j() && !block1.func_149730_j()) metaToSet = 1;
if (block3.func_149730_j() && !block4.func_149730_j()) metaToSet = 2;
if (block4.func_149730_j() && !block3.func_149730_j()) metaToSet = 3;
world.setBlockMetadataWithNotify(x, y, z, metaToSet, 2);
}
} }
@Override @Override
@ -83,6 +66,14 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{
@Override @Override
public IIcon getIcon(int side, int meta){ public IIcon getIcon(int side, int meta){
if(side == 1) return this.topIcon;
if(side == 3) return this.frontIcon;
return this.blockIcon;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side){
int meta = world.getBlockMetadata(x, y, z);
if(side == 1) return this.topIcon; if(side == 1) return this.topIcon;
if(side == meta+2 && meta <= 3) return this.frontIcon; if(side == meta+2 && meta <= 3) return this.frontIcon;
else if(side == meta-2 && meta > 3) return this.onIcon; else if(side == meta-2 && meta > 3) return this.onIcon;
@ -179,8 +170,7 @@ public class BlockFurnaceDouble extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); BlockUtil.addInformation(theBlock, list, 1, "");
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -4,10 +4,8 @@ import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar; import ellpeck.actuallyadditions.tile.TileEntityFurnaceSolar;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -18,12 +16,11 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class BlockFurnaceSolar extends BlockContainerBase implements IName{ public class BlockFurnaceSolar extends BlockContainerBase implements INameableItem{
public BlockFurnaceSolar(){ public BlockFurnaceSolar(){
super(Material.wood); super(Material.wood);
@ -33,6 +30,11 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IName{
this.setBlockBounds(0F, 0F, 0F, 1F, 3F/16F, 1F); this.setBlockBounds(0F, 0F, 0F, 1F, 3F/16F, 1F);
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityFurnaceSolar(); return new TileEntityFurnaceSolar();
@ -94,8 +96,7 @@ public class BlockFurnaceSolar extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); BlockUtil.addInformation(theBlock, list, 1, "");
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityGiantChest; import ellpeck.actuallyadditions.tile.TileEntityGiantChest;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,14 +17,14 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class BlockGiantChest extends BlockContainerBase implements IName{ public class BlockGiantChest extends BlockContainerBase implements INameableItem{
private IIcon topIcon; private IIcon topIcon;
private IIcon bottomIcon;
public BlockGiantChest(){ public BlockGiantChest(){
super(Material.wood); super(Material.wood);
@ -34,6 +33,11 @@ public class BlockGiantChest extends BlockContainerBase implements IName{
this.setStepSound(soundTypeWood); this.setStepSound(soundTypeWood);
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGiantChest(); return new TileEntityGiantChest();
@ -41,7 +45,7 @@ public class BlockGiantChest extends BlockContainerBase implements IName{
@Override @Override
public IIcon getIcon(int side, int metadata){ public IIcon getIcon(int side, int metadata){
return side == 1 ? this.topIcon : this.blockIcon; return side == 1 ? this.topIcon : (side == 0 ? this.bottomIcon : this.blockIcon);
} }
@Override @Override
@ -49,6 +53,7 @@ public class BlockGiantChest extends BlockContainerBase implements IName{
public void registerBlockIcons(IIconRegister iconReg){ public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName()); this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top"); this.topIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Top");
this.bottomIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Bottom");
} }
@Override @Override
@ -97,8 +102,7 @@ public class BlockGiantChest extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc")); BlockUtil.addInformation(theBlock, list, 1, "");
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -0,0 +1,115 @@
package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityGreenhouseGlass;
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.Facing;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import java.util.List;
public class BlockGreenhouseGlass extends BlockContainerBase implements INameableItem{
public BlockGreenhouseGlass(){
super(Material.rock);
this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F);
this.setStepSound(soundTypeStone);
}
@Override
public String getOredictName(){
return this.getName();
}
@Override
public boolean isOpaqueCube(){
return false;
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderBlockPass(){
return 0;
}
@Override
public boolean renderAsNormalBlock(){
return false;
}
@Override
public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGreenhouseGlass();
}
@Override
public IIcon getIcon(int side, int metadata){
return this.blockIcon;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconReg){
this.blockIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
}
@Override
public String getName(){
return "blockGreenhouseGlass";
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int meta){
return world.getBlockMetadata(x, y, z) != world.getBlockMetadata(x-Facing.offsetsXForSide[meta], y-Facing.offsetsYForSide[meta], z-Facing.offsetsZForSide[meta]) || (world.getBlock(x, y, z) != this && super.shouldSideBeRendered(world, x, y, z, meta));
}
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.epic;
}
@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, 1, "");
}
@Override
public int getMetadata(int damage){
return damage;
}
}
}

View file

@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityGrinder; import ellpeck.actuallyadditions.tile.TileEntityGrinder;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,14 +17,13 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockGrinder extends BlockContainerBase implements IName{ public class BlockGrinder extends BlockContainerBase implements INameableItem{
private IIcon topIcon; private IIcon topIcon;
private IIcon onIcon; private IIcon onIcon;
@ -44,7 +42,7 @@ public class BlockGrinder extends BlockContainerBase implements IName{
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityGrinder(this.isDouble); return this.isDouble ? new TileEntityGrinder.TileEntityGrinderDouble() : new TileEntityGrinder();
} }
@Override @Override
@ -94,6 +92,11 @@ public class BlockGrinder extends BlockContainerBase implements IName{
return true; return true;
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
public void breakBlock(World world, int x, int y, int z, Block block, int par6){ public void breakBlock(World world, int x, int y, int z, Block block, int par6){
this.dropInventory(world, x, y, z); this.dropInventory(world, x, y, z);
@ -130,12 +133,7 @@ public class BlockGrinder extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()){ BlockUtil.addInformation(theBlock, list, ((BlockGrinder)theBlock).isDouble ? 3 : 4, "");
for(int i = 0; i < (((BlockGrinder)theBlock).isDouble ? 3 : 4); i++){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i+1)));
}
}
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityHeatCollector; import ellpeck.actuallyadditions.tile.TileEntityHeatCollector;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -16,12 +15,11 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class BlockHeatCollector extends BlockContainerBase implements IName{ public class BlockHeatCollector extends BlockContainerBase implements INameableItem{
private IIcon topIcon; private IIcon topIcon;
private IIcon bottomIcon; private IIcon bottomIcon;
@ -33,6 +31,11 @@ public class BlockHeatCollector extends BlockContainerBase implements IName{
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityHeatCollector(); return new TileEntityHeatCollector();
@ -81,12 +84,7 @@ public class BlockHeatCollector extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()){ BlockUtil.addInformation(theBlock, list, 3, "");
for(int i = 0; i < 3; i++){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i + 1)));
}
}
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -21,21 +21,29 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockInputter extends BlockContainerBase implements IName{ public class BlockInputter extends BlockContainerBase implements INameableItem{
public static final int NAME_FLAVOUR_AMOUNTS = 12; public static final int NAME_FLAVOUR_AMOUNTS = 15;
public BlockInputter(){ public boolean isAdvanced;
public BlockInputter(boolean isAdvanced){
super(Material.rock); super(Material.rock);
this.setHarvestLevel("pickaxe", 0); this.setHarvestLevel("pickaxe", 0);
this.setHardness(1.0F); this.setHardness(1.0F);
this.setStepSound(soundTypeStone); this.setStepSound(soundTypeStone);
this.setTickRandomly(true); this.setTickRandomly(true);
this.isAdvanced = isAdvanced;
}
@Override
public String getOredictName(){
return this.getName();
} }
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityInputter(); return this.isAdvanced ? new TileEntityInputter.TileEntityInputterAdvanced() : new TileEntityInputter();
} }
@Override @Override
@ -53,7 +61,7 @@ public class BlockInputter extends BlockContainerBase implements IName{
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9){ 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(!world.isRemote){
TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(x, y, z); TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(x, y, z);
if (inputter != null) player.openGui(ActuallyAdditions.instance, GuiHandler.INPUTTER_ID, world, x, y, z); if (inputter != null) player.openGui(ActuallyAdditions.instance, this.isAdvanced ? GuiHandler.INPUTTER_ADVANCED_ID : GuiHandler.INPUTTER_ID, world, x, y, z);
return true; return true;
} }
return true; return true;
@ -67,7 +75,7 @@ public class BlockInputter extends BlockContainerBase implements IName{
@Override @Override
public String getName(){ public String getName(){
return "blockInputter"; return this.isAdvanced ? "blockInputterAdvanced" : "blockInputter";
} }
public static class TheItemBlock extends ItemBlock{ public static class TheItemBlock extends ItemBlock{
@ -86,7 +94,7 @@ public class BlockInputter extends BlockContainerBase implements IName{
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare; return ((BlockInputter)theBlock).isAdvanced ? EnumRarity.epic : EnumRarity.rare;
} }
@Override @Override
@ -96,10 +104,10 @@ public class BlockInputter extends BlockContainerBase implements IName{
if(this.lastSysTime+5000 < sysTime){ if(this.lastSysTime+5000 < sysTime){
this.lastSysTime = sysTime; this.lastSysTime = sysTime;
this.toPick = rand.nextInt(NAME_FLAVOUR_AMOUNTS+1); this.toPick = rand.nextInt(NAME_FLAVOUR_AMOUNTS)+1;
} }
return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name") + " (" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".add." + this.toPick + ".name") + ")"; return StatCollector.translateToLocal(this.getUnlocalizedName() + ".name") + " (" + StatCollector.translateToLocal("tile." + ModUtil.MOD_ID_LOWER + ".blockInputter.add." + this.toPick + ".name") + ")";
} }
@Override @Override
@ -112,10 +120,11 @@ public class BlockInputter extends BlockContainerBase implements IName{
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocalFormatted("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + 1, StringUtil.OBFUSCATED, StringUtil.LIGHT_GRAY)); list.add(StatCollector.translateToLocalFormatted("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + 1, StringUtil.OBFUSCATED, StringUtil.LIGHT_GRAY));
for(int i = 1; i < 5; i++){ for(int i = 1; i < 6; i++){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc." + (i + 1))); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".blockInputter.desc." + (i + 1)));
} }
if((((BlockInputter)theBlock).isAdvanced)) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)theBlock).getName() + ".desc"));
} }
else list.add(ItemUtil.shiftForInfo()); else list.add(ItemUtil.shiftForInfo());
} }

View file

@ -5,9 +5,8 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.tile.TileEntityItemRepairer; import ellpeck.actuallyadditions.tile.TileEntityItemRepairer;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -18,14 +17,13 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class BlockItemRepairer extends BlockContainerBase implements IName{ public class BlockItemRepairer extends BlockContainerBase implements INameableItem{
private IIcon topIcon; private IIcon topIcon;
private IIcon onIcon; private IIcon onIcon;
@ -39,6 +37,11 @@ public class BlockItemRepairer extends BlockContainerBase implements IName{
this.setTickRandomly(true); this.setTickRandomly(true);
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityItemRepairer(); return new TileEntityItemRepairer();
@ -118,10 +121,7 @@ public class BlockItemRepairer extends BlockContainerBase implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()){ BlockUtil.addInformation(theBlock, list, 1, "");
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + ".desc"));
}
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.blocks;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.BlockUtil;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
@ -17,19 +16,18 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class BlockMisc extends Block implements IName{ public class BlockMisc extends Block implements INameableItem{
public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values(); public static final TheMiscBlocks[] allMiscBlocks = TheMiscBlocks.values();
public IIcon[] textures = new IIcon[allMiscBlocks.length]; public IIcon[] textures = new IIcon[allMiscBlocks.length];
public BlockMisc(){ public BlockMisc(){
super(Material.rock); super(Material.rock);
this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F);
this.setHardness(1.0F); this.setHarvestLevel("pickaxe", 1);
} }
@SuppressWarnings("all") @SuppressWarnings("all")
@ -63,6 +61,11 @@ public class BlockMisc extends Block implements IName{
return "blockMisc"; return "blockMisc";
} }
@Override
public String getOredictName(){
return "";
}
public static class TheItemBlock extends ItemBlock{ public static class TheItemBlock extends ItemBlock{
private Block theBlock; private Block theBlock;
@ -88,8 +91,7 @@ public class BlockMisc extends Block implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((IName)theBlock).getName() + allMiscBlocks[stack.getItemDamage()].getName() + ".desc")); BlockUtil.addInformation(theBlock, list, 1, allMiscBlocks[stack.getItemDamage()].getName());
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -15,10 +15,16 @@ public class InitBlocks{
public static Block blockGrinderDouble; public static Block blockGrinderDouble;
public static Block blockFurnaceDouble; public static Block blockFurnaceDouble;
public static Block blockInputter; public static Block blockInputter;
public static Block blockInputterAdvanced;
public static Block blockFishingNet; public static Block blockFishingNet;
public static Block blockFurnaceSolar; public static Block blockFurnaceSolar;
public static Block blockHeatCollector; public static Block blockHeatCollector;
public static Block blockItemRepairer; public static Block blockItemRepairer;
public static Block blockGreenhouseGlass;
public static Block blockBreaker;
public static Block blockPlacer;
public static Block blockDropper;
public static void init(){ public static void init(){
Util.logInfo("Initializing Blocks..."); Util.logInfo("Initializing Blocks...");
@ -27,7 +33,7 @@ public class InitBlocks{
BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class); BlockUtil.register(blockCompost, BlockCompost.TheItemBlock.class);
blockMisc = new BlockMisc(); blockMisc = new BlockMisc();
BlockUtil.register(blockMisc, BlockMisc.TheItemBlock.class); BlockUtil.register(blockMisc, BlockMisc.TheItemBlock.class, BlockMisc.allMiscBlocks);
blockFeeder = new BlockFeeder(); blockFeeder = new BlockFeeder();
BlockUtil.register(blockFeeder, BlockFeeder.TheItemBlock.class); BlockUtil.register(blockFeeder, BlockFeeder.TheItemBlock.class);
@ -44,9 +50,12 @@ public class InitBlocks{
blockFurnaceDouble = new BlockFurnaceDouble(); blockFurnaceDouble = new BlockFurnaceDouble();
BlockUtil.register(blockFurnaceDouble, BlockFurnaceDouble.TheItemBlock.class); BlockUtil.register(blockFurnaceDouble, BlockFurnaceDouble.TheItemBlock.class);
blockInputter = new BlockInputter(); blockInputter = new BlockInputter(false);
BlockUtil.register(blockInputter, BlockInputter.TheItemBlock.class); BlockUtil.register(blockInputter, BlockInputter.TheItemBlock.class);
blockInputterAdvanced = new BlockInputter(true);
BlockUtil.register(blockInputterAdvanced, BlockInputter.TheItemBlock.class);
blockFishingNet = new BlockFishingNet(); blockFishingNet = new BlockFishingNet();
BlockUtil.register(blockFishingNet, BlockFishingNet.TheItemBlock.class); BlockUtil.register(blockFishingNet, BlockFishingNet.TheItemBlock.class);
@ -58,5 +67,17 @@ public class InitBlocks{
blockItemRepairer = new BlockItemRepairer(); blockItemRepairer = new BlockItemRepairer();
BlockUtil.register(blockItemRepairer, BlockItemRepairer.TheItemBlock.class); BlockUtil.register(blockItemRepairer, BlockItemRepairer.TheItemBlock.class);
blockGreenhouseGlass = new BlockGreenhouseGlass();
BlockUtil.register(blockGreenhouseGlass, BlockGreenhouseGlass.TheItemBlock.class);
blockBreaker = new BlockBreaker(false);
BlockUtil.register(blockBreaker, BlockBreaker.TheItemBlock.class);
blockPlacer = new BlockBreaker(true);
BlockUtil.register(blockPlacer, BlockBreaker.TheItemBlock.class);
blockDropper = new BlockDropper();
BlockUtil.register(blockDropper, BlockDropper.TheItemBlock.class);
} }
} }

View file

@ -1,25 +1,34 @@
package ellpeck.actuallyadditions.blocks.metalists; package ellpeck.actuallyadditions.blocks.metalists;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
public enum TheMiscBlocks implements IName{ public enum TheMiscBlocks implements INameableItem{
QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.rare), QUARTZ_PILLAR("BlackQuartzPillar", EnumRarity.rare, "blockQuartzBlack"),
QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.rare), QUARTZ_CHISELED("BlackQuartzChiseled", EnumRarity.rare, "blockQuartzBlack"),
QUARTZ("BlackQuartz", EnumRarity.rare), QUARTZ("BlackQuartz", EnumRarity.rare, "blockQuartzBlack"),
ORE_QUARTZ("OreBlackQuartz", EnumRarity.epic); ORE_QUARTZ("OreBlackQuartz", EnumRarity.epic, "oreQuartzBlack"),
WOOD_CASING("WoodCasing", EnumRarity.common, "blockCasingWood"),
STONE_CASING("StoneCasing", EnumRarity.uncommon, "blockCasingStone");
public final String name; public final String name;
public final String oredictName;
public final EnumRarity rarity; public final EnumRarity rarity;
TheMiscBlocks(String name, EnumRarity rarity){ TheMiscBlocks(String name, EnumRarity rarity, String oredictName){
this.name = name; this.name = name;
this.rarity = rarity; this.rarity = rarity;
this.oredictName = oredictName;
} }
@Override @Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }
@Override
public String getOredictName(){
return this.oredictName;
}
} }

View file

@ -1,5 +1,6 @@
package ellpeck.actuallyadditions.blocks.render; package ellpeck.actuallyadditions.blocks.render;
import ellpeck.actuallyadditions.tile.TileEntityCompost;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
public class ModelCompost extends ModelBaseAA{ public class ModelCompost extends ModelBaseAA{
@ -9,10 +10,12 @@ public class ModelCompost extends ModelBaseAA{
public ModelRenderer wallTwo; public ModelRenderer wallTwo;
public ModelRenderer wallThree; public ModelRenderer wallThree;
public ModelRenderer wallFour; public ModelRenderer wallFour;
public ModelRenderer[] innerRawList = new ModelRenderer[13];
public ModelRenderer innerDone;
public ModelCompost(){ public ModelCompost(){
this.textureWidth = 64; this.textureWidth = 64;
this.textureHeight = 64; this.textureHeight = 128;
this.wallThree = new ModelRenderer(this, 0, 0); this.wallThree = new ModelRenderer(this, 0, 0);
this.wallThree.setRotationPoint(-6.0F, 8.0F, 6.0F); this.wallThree.setRotationPoint(-6.0F, 8.0F, 6.0F);
this.wallThree.addBox(0.0F, 0.0F, 0.0F, 12, 15, 1, 0.0F); this.wallThree.addBox(0.0F, 0.0F, 0.0F, 12, 15, 1, 0.0F);
@ -28,6 +31,29 @@ public class ModelCompost extends ModelBaseAA{
this.floor = new ModelRenderer(this, 0, 0); this.floor = new ModelRenderer(this, 0, 0);
this.floor.setRotationPoint(-7.0F, 23.0F, -7.0F); this.floor.setRotationPoint(-7.0F, 23.0F, -7.0F);
this.floor.addBox(0.0F, 0.0F, 0.0F, 14, 1, 14, 0.0F); this.floor.addBox(0.0F, 0.0F, 0.0F, 14, 1, 14, 0.0F);
for(int i = 0; i < this.innerRawList.length; i++){
this.innerRawList[i] = new ModelRenderer(this, 0, 29);
this.innerRawList[i].setRotationPoint(-6.0F, 10.0F, -6.0F);
this.innerRawList[i].addBox(0.0F, 12-i, 0.0F, 12, i+1, 12, 0.0F);
}
this.innerDone = new ModelRenderer(this, 0, 54);
this.innerDone.setRotationPoint(-6.0F, 10.0F, -6.0F);
this.innerDone.addBox(0.0F, 0.0F, 0.0F, 12, 13, 12, 0.0F);
}
public void renderExtra(float f, TileEntityCompost tile){
int meta = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
if(meta > 0 && meta <= tile.amountNeededToConvert){
int heightToDisplay = meta*13/tile.amountNeededToConvert;
if(heightToDisplay > 13) heightToDisplay = 13;
this.innerRawList[heightToDisplay-1].render(f);
}
if(meta == tile.amountNeededToConvert+1){
this.innerDone.render(f);
}
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package ellpeck.actuallyadditions.blocks.render; package ellpeck.actuallyadditions.blocks.render;
import ellpeck.actuallyadditions.tile.TileEntityCompost;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@ -17,11 +18,14 @@ public class RenderTileEntity extends TileEntitySpecialRenderer{
@Override @Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){ public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par5){
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef((float)x+0.5F, (float)y-0.5F, (float)z+0.5F); GL11.glTranslatef((float)x + 0.5F, (float)y - 0.5F, (float)z + 0.5F);
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(0.0F, -2.0F, 0.0F); GL11.glTranslatef(0.0F, -2.0F, 0.0F);
this.bindTexture(new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png")); this.bindTexture(new ResourceLocation(ModUtil.MOD_ID_LOWER, "textures/blocks/models/" + this.theModel.getName() + ".png"));
theModel.render(0.0625F); theModel.render(0.0625F);
if(tile instanceof TileEntityCompost && theModel instanceof ModelCompost) ((ModelCompost)theModel).renderExtra(0.0625F, (TileEntityCompost)tile);
GL11.glPopMatrix(); GL11.glPopMatrix();
} }

View file

@ -0,0 +1,21 @@
package ellpeck.actuallyadditions.config;
public enum ConfigCategories{
FOOD_CRAFTING("food crafting"),
MISC_CRAFTING("misc crafting"),
BLOCKS_CRAFTING("block crafting"),
ITEMS_CRAFTING("item crafting"),
TOOL_VALUES("tool values"),
MACHINE_VALUES("machine values"),
MOB_DROPS("mob drops"),
WORLD_GEN("world gen"),
POTION_RING_CRAFTING("ring crafting"),
OTHER("other");
public final String name;
ConfigCategories(String name){
this.name = name;
}
}

View file

@ -1,157 +1,45 @@
package ellpeck.actuallyadditions.config; package ellpeck.actuallyadditions.config;
import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.metalists.ThePotionRings; import ellpeck.actuallyadditions.config.values.ConfigFloatValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import net.minecraftforge.common.config.Configuration; import net.minecraftforge.common.config.Configuration;
public class ConfigValues{ public class ConfigValues{
public static boolean[] enabledFoodRecipes = new boolean[TheFoods.values().length]; public static ConfigCrafting[] craftingConfig = ConfigCrafting.values();
public static boolean[] enabledMiscRecipes = new boolean[TheMiscItems.values().length]; public static boolean[] craftingValues = new boolean[craftingConfig.length];
public static boolean[] enablePotionRingRecipes = new boolean[ThePotionRings.values().length];
public static boolean enableCompostRecipe;
public static boolean enableKnifeRecipe;
public static boolean enableLeafBlowerRecipe;
public static boolean enableLeafBlowerAdvancedRecipe;
public static boolean enableCrusherRecipe;
public static boolean enableCrusherDoubleRecipe;
public static boolean enableFurnaceDoubleRecipe;
public static boolean enableGiantChestRecipe;
public static boolean enableFeederRecipe;
public static boolean enableCrafterRecipe;
public static boolean enableInputterRecipe;
public static boolean enableRepairerRecipe;
public static boolean enableSolarRecipe;
public static boolean enableFishingNetRecipe;
public static boolean enableHeatCollectorRecipe;
public static boolean enableToolEmeraldRecipe;
public static boolean enableToolObsidianRecipe;
public static int knifeMaxDamage; public static ConfigIntValues[] intConfig = ConfigIntValues.values();
public static int toolEmeraldHarvestLevel; public static int[] intValues = new int[intConfig.length];
public static int toolEmeraldMaxUses;
public static int toolEmeraldEnchantability;
public static int toolObsidianHarvestLevel;
public static int toolObsidianMaxUses;
public static int toolObsidianEnchantability;
public static float toolObsidianEfficiency;
public static float toolObsidianDamage;
public static float toolEmeraldEfficiency;
public static float toolEmeraldDamage;
public static int compostAmountNeededToConvert; public static ConfigFloatValues[] floatConfig = ConfigFloatValues.values();
public static int compostConversionTimeNeeded; public static float[] floatValues = new float[floatConfig.length];
public static int feederReach;
public static int feederTimeNeeded;
public static int feederThreshold;
public static int fishingNetTime;
public static int furnaceDoubleSmeltTime;
public static int grinderDoubleCrushTime;
public static int grinderCrushTime;
public static int leafBlowerRangeSides;
public static int leafBlowerRangeUp;
public static int heatCollectorRandomChance;
public static int heatCollectorBlocksNeeded;
public static int repairerSpeedSlowdown;
public static boolean leafBlowerDropItems;
public static boolean leafBlowerParticles;
public static boolean leafBlowerHasSound;
public static boolean generateBlackQuartz; public static ConfigBoolValues[] boolConfig = ConfigBoolValues.values();
public static int blackQuartzBaseAmount; public static boolean[] boolValues = new boolean[boolConfig.length];
public static int blackQuartzAdditionalChance;
public static int blackQuartzChance;
public static int blackQuartzMinHeight;
public static int blackQuartzMaxHeight;
public static boolean enableExperienceDrop;
public static boolean enableBloodDrop;
public static boolean enableHeartDrop;
public static boolean enableSubstanceDrop;
public static boolean enablePearlShardDrop;
public static boolean enableEmeraldShardDrop;
public static void defineConfigValues(Configuration config){ public static void defineConfigValues(Configuration config){
for(int i = 0; i < enabledFoodRecipes.length; i++){ for(int i = 0; i < craftingValues.length; i++){
enabledFoodRecipes[i] = config.getBoolean(TheFoods.values()[i].name, ConfigurationHandler.CATEGORY_FOOD_CRAFTING, true, "If the Crafting Recipe for " + TheFoods.values()[i].name + " is Enabled"); ConfigCrafting currConf = craftingConfig[i];
} craftingValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, "If the Crafting Recipe for the " + currConf.name + " is Enabled");
for(int i = 0; i < enabledMiscRecipes.length; i++){
enabledMiscRecipes[i] = config.getBoolean(TheMiscItems.values()[i].name, ConfigurationHandler.CATEGORY_MISC_CRAFTING, true, "If the Crafting Recipe for " + TheMiscItems.values()[i].name + " is Enabled");
}
for(int i = 0; i < enablePotionRingRecipes.length; i++){
enablePotionRingRecipes[i] = config.getBoolean(ThePotionRings.values()[i].name, ConfigurationHandler.CATEGORY_POTION_RING_CRAFTING, i != ThePotionRings.SATURATION.ordinal(), "If the Crafting Recipe for the Ring of " + ThePotionRings.values()[i].name + " is Enabled");
} }
enableLeafBlowerRecipe = config.getBoolean("Leaf Blower", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Leaf Blower is Enabled"); for(int i = 0; i < intValues.length; i++){
enableLeafBlowerAdvancedRecipe = config.getBoolean("Advanced Leaf Blower", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Advanced Leaf Blower is Enabled"); ConfigIntValues currConf = intConfig[i];
leafBlowerDropItems = config.getBoolean("Leaf Blower: Drops Items", ConfigurationHandler.CATEGORY_TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks' Drops drop"); intValues[i] = config.getInt(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
leafBlowerParticles = config.getBoolean("Leaf Blower: Particles", ConfigurationHandler.CATEGORY_TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks have particles when getting destroyed"); }
leafBlowerHasSound = config.getBoolean("Leaf Blower: Sound", ConfigurationHandler.CATEGORY_TOOL_VALUES, true, "If the Leaf Blower makes Sounds");
leafBlowerRangeSides = config.getInt("Leaf Blower: Side Range", ConfigurationHandler.CATEGORY_TOOL_VALUES, 5, 1, 25, "The Leaf Blower's Range to the Sides");
leafBlowerRangeUp = config.getInt("Leaf Blower: Height Range", ConfigurationHandler.CATEGORY_TOOL_VALUES, 1, 1, 10, "The Leaf Blower's Range to the Top and Bottom");
generateBlackQuartz = config.getBoolean("Black Quartz", ConfigurationHandler.CATEGORY_WORLD_GEN, true, "If the Black Quartz generates in the world"); for(int i = 0; i < floatValues.length; i++){
blackQuartzBaseAmount = config.getInt("Black Quartz Amount", ConfigurationHandler.CATEGORY_WORLD_GEN, 3, 1, 50, "How big a Black Quartz Vein is at least"); ConfigFloatValues currConf = floatConfig[i];
blackQuartzAdditionalChance = config.getInt("Black Quartz Additional Chance", ConfigurationHandler.CATEGORY_WORLD_GEN, 3, 0, 50, "How much bigger than the Base Amount a Black Quartz Vein can get"); floatValues[i] = config.getFloat(currConf.name, currConf.category, currConf.defaultValue, currConf.min, currConf.max, currConf.desc);
blackQuartzChance = config.getInt("Black Quartz Chance", ConfigurationHandler.CATEGORY_WORLD_GEN, 25, 1, 150, "How often the Black Quartz tries to generate"); }
blackQuartzMinHeight = config.getInt("Black Quartz Min Height", ConfigurationHandler.CATEGORY_WORLD_GEN, 0, 0, 256, "How high the Black Quartz starts to generate");
blackQuartzMaxHeight = config.getInt("Black Quartz Max Height", ConfigurationHandler.CATEGORY_WORLD_GEN, 25, 0, 256, "How high the Black Quartz stops to generate at");
enableExperienceDrop = config.getBoolean("Solidified Experience", ConfigurationHandler.CATEGORY_MOB_DROPS, true, "If the Solidified Experience drops from Mobs"); for(int i = 0; i < boolValues.length; i++){
enableBloodDrop = config.getBoolean("Blood Fragments", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Blood Fragments drop from Mobs"); ConfigBoolValues currConf = boolConfig[i];
enableHeartDrop = config.getBoolean("Heart Parts", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Heart Parts drop from Mobs"); boolValues[i] = config.getBoolean(currConf.name, currConf.category, currConf.defaultValue, currConf.desc);
enableSubstanceDrop = config.getBoolean("Unknown Substance", ConfigurationHandler.CATEGORY_MOB_DROPS, false, "If the Unknown Substance drops from Mobs"); }
enablePearlShardDrop = config.getBoolean("Ender Pearl Shard", ConfigurationHandler.CATEGORY_MOB_DROPS, true, "If the Ender Pearl Shard drops from Mobs");
enableEmeraldShardDrop = config.getBoolean("Emerald Shard", ConfigurationHandler.CATEGORY_MOB_DROPS, true, "If the Emerald Shard drops from Mobs");
enableCompostRecipe = config.getBoolean("Compost", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Compost is Enabled");
enableRepairerRecipe = config.getBoolean("Item Repairer", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Item Repairer is Enabled");
enableKnifeRecipe = config.getBoolean("Knife", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Knife is Enabled");
enableCrusherDoubleRecipe = config.getBoolean("Double Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Double Crusher is Enabled");
enableCrusherRecipe = config.getBoolean("Crusher", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Crusher is Enabled");
enableFurnaceDoubleRecipe = config.getBoolean("Double Furnace", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Double Furnace is Enabled");
enableGiantChestRecipe = config.getBoolean("Giant Chest", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Giant Chest is Enabled");
enableInputterRecipe = config.getBoolean("ESD", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the ESD is Enabled");
enableFeederRecipe = config.getBoolean("Feeder", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Feeder is Enabled");
enableCrafterRecipe = config.getBoolean("Crafting Table On A Stick", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for the Crafting Table On A Stick is Enabled");
enableSolarRecipe = config.getBoolean("Solar Panel", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Solar Panel is Enabled");
enableFishingNetRecipe = config.getBoolean("Fishing Net", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Fishing Net is Enabled");
enableHeatCollectorRecipe = config.getBoolean("Heat Collector", ConfigurationHandler.CATEGORY_BLOCKS_CRAFTING, true, "If the Crafting Recipe for the Heat Collector is Enabled");
compostAmountNeededToConvert = config.getInt("Compost: Amount Needed To Convert", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer");
compostConversionTimeNeeded = config.getInt("Compost: Conversion Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer");
fishingNetTime = config.getInt("Fishing Net: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2000, 50, 50000, "How long it takes on Average until the Fishing Net catches a Fish");
feederReach = config.getInt("Feeder: Reach", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder");
feederTimeNeeded = config.getInt("Feeder: Time Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder");
feederThreshold = config.getInt("Feeder: Threshold", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop");
knifeMaxDamage = config.getInt("Knife: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with");
toolEmeraldHarvestLevel = config.getInt("Emerald: Harvest Level", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Emerald Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)");
toolEmeraldMaxUses = config.getInt("Emerald: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2000, 50, 10000, "How often Emerald Tools can be used");
toolEmeraldEfficiency = config.getFloat("Emerald: Efficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 9.0F, 1.0F, 20.0F, "How fast Emerald Tools are");
toolEmeraldDamage = config.getFloat("Emerald: Damage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 5.0F, 0.1F, 50.0F, "How much damage an Emerald Tool deals");
toolEmeraldEnchantability = config.getInt("Emerald: Enchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Emerald Tool is");
enableToolEmeraldRecipe = config.getBoolean("Emerald Tools", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for Emerald Tools is Enabled");
toolObsidianHarvestLevel = config.getInt("Obsidian: Harvest Level", ConfigurationHandler.CATEGORY_TOOL_VALUES, 3, 0, 3, "What Harvest Level Obsidian Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)");
toolObsidianMaxUses = config.getInt("Obsidian: Max Uses", ConfigurationHandler.CATEGORY_TOOL_VALUES, 8000, 50, 20000, "How often Obsidian Tools can be used");
toolObsidianEfficiency = config.getFloat("Obsidian: Efficiency", ConfigurationHandler.CATEGORY_TOOL_VALUES, 4.0F, 1.0F, 20.0F, "How fast Obsidian Tools are");
toolObsidianDamage = config.getFloat("Obsidian: Damage", ConfigurationHandler.CATEGORY_TOOL_VALUES, 2.0F, 0.1F, 50.0F, "How much damage an Obsidian Tool deals");
toolObsidianEnchantability = config.getInt("Obsidian: Enchantability", ConfigurationHandler.CATEGORY_TOOL_VALUES, 15, 1, 30, "How enchantable an Obsidian Tool is");
enableToolObsidianRecipe = config.getBoolean("Obsidian Tools", ConfigurationHandler.CATEGORY_ITEMS_CRAFTING, true, "If the Crafting Recipe for Obsidian Tools is Enabled");
grinderCrushTime = config.getInt("Crusher: Crush Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 200, 10, 1000, "How long the Crusher takes to crush an item");
grinderDoubleCrushTime = config.getInt("Double Crusher: Crush Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Crusher takes to crush an item");
furnaceDoubleSmeltTime = config.getInt("Double Furnace: Smelt Time", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 300, 10, 1000, "How long the Double Furnace takes to crush an item");
repairerSpeedSlowdown = config.getInt("Item Repairer: Speed Slowdown", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 2, 1, 100, "How much slower the Item Repairer repairs");
heatCollectorBlocksNeeded = config.getInt("Heat Collector: Blocks Needed", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 4, 1, 5, "How many Blocks are needed for the Heat Collector to power Machines above it");
heatCollectorRandomChance = config.getInt("Heat Collector: Random Chance", ConfigurationHandler.CATEGORY_MACHINE_VALUES, 10000, 10, 100000, "The Chance of the Heat Collector destroying a Lava Block around (Default Value 2000 meaning a 1/2000 Chance!)");
} }
} }

View file

@ -7,17 +7,6 @@ import java.io.File;
public class ConfigurationHandler{ public class ConfigurationHandler{
public static final String CATEGORY_FOOD_CRAFTING = "food crafting";
public static final String CATEGORY_MISC_CRAFTING = "misc crafting";
public static final String CATEGORY_BLOCKS_CRAFTING = "block crafting";
public static final String CATEGORY_ITEMS_CRAFTING = "items crafting";
public static final String CATEGORY_TOOL_VALUES = "tool values";
public static final String CATEGORY_MACHINE_VALUES = "machine values";
public static final String CATEGORY_MOB_DROPS = "mob drops";
public static final String CATEGORY_WORLD_GEN = "world gen";
public static final String CATEGORY_POTION_RING_CRAFTING = "ring crafting";
public static void init(File configFile){ public static void init(File configFile){
Util.logInfo("Grabbing Configurations..."); Util.logInfo("Grabbing Configurations...");
Configuration config = new Configuration(configFile); Configuration config = new Configuration(configFile);

View file

@ -0,0 +1,43 @@
package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
public enum ConfigBoolValues{
LEAF_BLOWER_ITEMS("Leaf Blower: Drops Items", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks' Drops drop"),
LEAF_BLOWER_PARTICLES("Leaf Blower: Particles", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower lets destroyed Blocks have particles when getting destroyed"),
LEAF_BLOWER_SOUND("Leaf Blower: Sound", ConfigCategories.TOOL_VALUES, true, "If the Leaf Blower makes Sounds"),
JAM_VILLAGER_EXISTS("Jam Villager: Existence", ConfigCategories.WORLD_GEN, true, "If the Jam Villager and his House exist"),
GENERATE_QUARTZ("Black Quartz", ConfigCategories.WORLD_GEN, true, "If the Black Quartz generates in the world"),
EXPERIENCE_DROP("Solidified Experience", ConfigCategories.MOB_DROPS, true, "If the Solidified Experience drops from Mobs"),
BLOOD_DROP("Blood Fragments", ConfigCategories.MOB_DROPS, false, "If the Blood Fragments drop from Mobs"),
HEART_DROP("Heart Parts", ConfigCategories.MOB_DROPS, false, "If the Heart Parts drop from Mobs"),
SUBSTANCE_DROP("Unknown Substance", ConfigCategories.MOB_DROPS, false, "If the Unknown Substance drops from Mobs"),
PEARL_SHARD_DROP("Ender Pearl Shard", ConfigCategories.MOB_DROPS, true, "If the Ender Pearl Shard drops from Mobs"),
EMERALD_SHARD_CROP("Emerald Shard", ConfigCategories.MOB_DROPS, true, "If the Emerald Shard drops from Mobs"),
DO_UPDATE_CHECK("Do Update Check", ConfigCategories.OTHER, true, "If Actually Additions should check for an Update on joining a World"),
DO_CRUSHER_SPAM("Crusher Debug", ConfigCategories.OTHER, false, "Print out Crusher Recipe Initializing Debug");
public final String name;
public final String category;
public final boolean defaultValue;
public final String desc;
ConfigBoolValues(String name, ConfigCategories category, boolean defaultValue, String desc){
this.name = name;
this.category = category.name;
this.defaultValue = defaultValue;
this.desc = desc;
}
public boolean isEnabled(){
return ConfigValues.boolValues[this.ordinal()];
}
}

View file

@ -0,0 +1,91 @@
package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
public enum ConfigCrafting{
COMPOST("Compost", ConfigCategories.BLOCKS_CRAFTING),
WOOD_CASING("Wood Casing", ConfigCategories.BLOCKS_CRAFTING),
STONE_CASING("Stone Casing", ConfigCategories.BLOCKS_CRAFTING),
FISHING_NET("Fishing Net", ConfigCategories.BLOCKS_CRAFTING),
REPAIRER("Repairer", ConfigCategories.BLOCKS_CRAFTING),
SOLAR_PANEL("Solar Panel", ConfigCategories.BLOCKS_CRAFTING),
HEAT_COLLECTOR("Heat Collector", ConfigCategories.BLOCKS_CRAFTING),
INPUTTER("ESD", ConfigCategories.BLOCKS_CRAFTING),
CRUSHER("Crusher", ConfigCategories.BLOCKS_CRAFTING),
DOUBLE_CRUSHER("Double Crusher", ConfigCategories.BLOCKS_CRAFTING),
DOUBLE_FURNACE("Double Furnace", ConfigCategories.BLOCKS_CRAFTING),
FEEDER("Feeder", ConfigCategories.BLOCKS_CRAFTING),
GIANT_CHEST("Storage Crate", ConfigCategories.BLOCKS_CRAFTING),
GREENHOUSE_GLASS("Greenhouse Glass", ConfigCategories.BLOCKS_CRAFTING),
BREAKER("Breaker", ConfigCategories.BLOCKS_CRAFTING),
PLACER("Placer", ConfigCategories.BLOCKS_CRAFTING),
DROPPER("Dropper", ConfigCategories.BLOCKS_CRAFTING),
SPEED_UPGRADE("Speed Upgrade", ConfigCategories.BLOCKS_CRAFTING),
BAGUETTE("Baguette", ConfigCategories.FOOD_CRAFTING),
PIZZA("Pizza", ConfigCategories.FOOD_CRAFTING),
HAMBURGER("Hamburger", ConfigCategories.FOOD_CRAFTING),
BIG_COOKIE("Big Cookie", ConfigCategories.FOOD_CRAFTING),
SUB("Sub Sandwich", ConfigCategories.FOOD_CRAFTING),
FRENCH_FRY("French Fry", ConfigCategories.FOOD_CRAFTING),
FRENCH_FRIES("French Fries", ConfigCategories.FOOD_CRAFTING),
FISH_N_CHIPS("Fish And Chips", ConfigCategories.FOOD_CRAFTING),
CHEESE("Cheese", ConfigCategories.FOOD_CRAFTING),
PUMPKIN_STEW("Pumpkin Stew", ConfigCategories.FOOD_CRAFTING),
CARROT_JUICE("Carrot Juice", ConfigCategories.FOOD_CRAFTING),
SPAGHETTI("Spaghetti", ConfigCategories.FOOD_CRAFTING),
NOODLE("Noodle", ConfigCategories.FOOD_CRAFTING),
CHOCOLATE("Chocolate", ConfigCategories.FOOD_CRAFTING),
CHOCOLATE_CAKE("Chocolate Cake", ConfigCategories.FOOD_CRAFTING),
TOAST("Toast", ConfigCategories.FOOD_CRAFTING),
LEAF_BLOWER("Leaf Blower", ConfigCategories.ITEMS_CRAFTING),
LEAF_BLOWER_ADVANCED("Advanced Leaf Blower", ConfigCategories.ITEMS_CRAFTING),
COIL("Coil", ConfigCategories.ITEMS_CRAFTING),
ADV_COIL("Advanced Coil", ConfigCategories.ITEMS_CRAFTING),
KNIFE("Knife", ConfigCategories.ITEMS_CRAFTING),
STICK_CRAFTER("Crafting Table On A Stick", ConfigCategories.ITEMS_CRAFTING),
MASHED_FOOD("Mashed Food", ConfigCategories.ITEMS_CRAFTING),
RING_SPEED("Speed Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_HASTE("Haste Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_STRENGTH("Strength Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_JUMP_BOOST("Jump Boost Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_REGEN("Regen Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_RESISTANCE("Resistance Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_FIRE_RESISTANCE("Fire Resistance Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_WATER_BREATHING("Water Breathing Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_INVISIBILITY("Invisibility Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_NIGHT_VISION("Night Vision Ring", ConfigCategories.POTION_RING_CRAFTING),
RING_SATURATION("Saturation Ring", ConfigCategories.POTION_RING_CRAFTING, false),
DOUGH("Dough", ConfigCategories.ITEMS_CRAFTING),
PAPER_CONE("Paper Cone", ConfigCategories.ITEMS_CRAFTING),
KNIFE_HANDLE("Knife Handle", ConfigCategories.ITEMS_CRAFTING),
KNIFE_BLADE("Knife Blade", ConfigCategories.ITEMS_CRAFTING),
TOOL_EMERALD("Emerald Tools", ConfigCategories.ITEMS_CRAFTING),
TOOL_OBSIDIAN("Obsidian Tools", ConfigCategories.ITEMS_CRAFTING);
public final String name;
public final String category;
public final boolean defaultValue;
ConfigCrafting(String name, ConfigCategories category){
this(name, category, true);
}
ConfigCrafting(String name, ConfigCategories category, boolean defaultValue){
this.name = name;
this.category = category.name;
this.defaultValue = defaultValue;
}
public boolean isEnabled(){
return ConfigValues.craftingValues[this.ordinal()];
}
}

View file

@ -0,0 +1,34 @@
package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
public enum ConfigFloatValues{
EMERALD_SPEED("Emerald: Efficiency", ConfigCategories.TOOL_VALUES, 9.0F, 1.0F, 20.0F, "How fast Emerald Tools are"),
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");
public final String name;
public final String category;
public final float defaultValue;
public final float min;
public final float max;
public final String desc;
ConfigFloatValues(String name, ConfigCategories category, float defaultValue, float min, float max, String desc){
this.name = name;
this.category = category.name;
this.defaultValue = defaultValue;
this.min = min;
this.max = max;
this.desc = desc;
}
public float getValue(){
return ConfigValues.floatValues[this.ordinal()];
}
}

View file

@ -0,0 +1,71 @@
package ellpeck.actuallyadditions.config.values;
import ellpeck.actuallyadditions.config.ConfigCategories;
import ellpeck.actuallyadditions.config.ConfigValues;
public enum ConfigIntValues{
JAM_VILLAGER_ID("Jam Villager: ID", ConfigCategories.WORLD_GEN, 493827, 100, 1000000, "The ID of the Jam Villager"),
LEAF_BLOWER_RANGE_SIDES("Leaf Blower: Side Range", ConfigCategories.TOOL_VALUES, 5, 1, 25, "The Leaf Blower's Range to the Sides"),
LEAF_BLOWER_RANGE_UP("Leaf Blower: Range Up", ConfigCategories.TOOL_VALUES, 1, 1, 10, "The Leaf Blower's Range Up"),
BLACK_QUARTZ_BASE_AMOUNT("Black Quartz Amount", ConfigCategories.WORLD_GEN, 3, 1, 50, "How big a Black Quartz Vein is at least"),
BLACK_QUARTZ_ADD_CHANCE("Black Quartz Additional Chance", ConfigCategories.WORLD_GEN, 3, 0, 50, "How much bigger than the Base Amount a Black Quartz Vein can get"),
BLACK_QUARTZ_CHANCE("Black Quartz Chance", ConfigCategories.WORLD_GEN, 25, 1, 150, "How often the Black Quartz tries to generate"),
BLACK_QUARTZ_MIN_HEIGHT("Black Quartz Min Height", ConfigCategories.WORLD_GEN, 0, 0, 256, "How high the Black Quartz starts to generate"),
BLACK_QUARTZ_MAX_HEIGHT("Black Quartz Max Height", ConfigCategories.WORLD_GEN, 25, 0, 256, "How high the Black Quartz stops to generate at"),
COMPOST_AMOUNT("Compost: Amount Needed To Convert", ConfigCategories.MACHINE_VALUES, 10, 1, 64, "How many items are needed in the Compost to convert to Fertilizer"),
COMPOST_TIME("Compost: Conversion Time Needed", ConfigCategories.MACHINE_VALUES, 1000, 30, 10000, "How long the Compost needs to convert to Fertilizer"),
FISHER_TIME("Fishing Net: Time Needed", ConfigCategories.MACHINE_VALUES, 2000, 50, 50000, "How long it takes on Average until the Fishing Net catches a Fish"),
FEEDER_REACH("Feeder: Reach", ConfigCategories.MACHINE_VALUES, 5, 1, 20, "The Radius of Action of the Feeder"),
FEEDER_TIME("Feeder: Time Needed", ConfigCategories.MACHINE_VALUES, 100, 50, 5000, "The time spent between feeding animals with the Feeder"),
FEEDER_THRESHOLD("Feeder: Threshold", ConfigCategories.MACHINE_VALUES, 30, 3, 500, "How many animals need to be in the area for the Feeder to stop"),
KNIFE_DAMAGE("Knife: Max Uses", ConfigCategories.TOOL_VALUES, 100, 5, 5000, "How often the Knife can be crafted with"),
EMERALD_HARVEST_LEVEL("Emerald: Harvest Level", ConfigCategories.TOOL_VALUES, 3, 0, 3, "What Harvest Level Emerald Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)"),
EMERALD_USES("Emerald: Max Uses", ConfigCategories.TOOL_VALUES, 2000, 50, 10000, "How often Emerald Tools can be used"),
EMERALD_ENCHANTABILITY("Emerald: Enchantability", ConfigCategories.TOOL_VALUES, 15, 1, 30, "How enchantable an Emerald Tool is"),
OBSIDIAN_HARVEST_LEVEL("Obsidian: Harvest Level", ConfigCategories.TOOL_VALUES, 3, 0, 3, "What Harvest Level Obsidian Tools have (0 = Wood, 1 = Stone, 2 = Iron, 3 = Diamond)"),
OBSIDIAN_USES("Obsidian: Max Uses", ConfigCategories.TOOL_VALUES, 8000, 50, 20000, "How often Obsidian Tools can be used"),
OBSIDIAN_ENCHANTABILITY("Obsidian: Enchantability", ConfigCategories.TOOL_VALUES, 15, 1, 30, "How enchantable an Obsidian Tool is"),
GRINDER_CRUSH_TIME("Crusher: Crush Time", ConfigCategories.MACHINE_VALUES, 200, 10, 1000, "How long the Crusher takes to crush an item"),
GRINDER_DOUBLE_CRUSH_TIME("Double Crusher: Crush Time", ConfigCategories.MACHINE_VALUES, 300, 10, 1000, "How long the Double Crusher takes to crush an item"),
FURNACE_DOUBLE_SMELT_TIME("Double Furnace: Smelt Time", ConfigCategories.MACHINE_VALUES, 300, 10, 1000, "How long the Double Furnace takes to crush an item"),
REPAIRER_SPEED_SLOWDOWN("Item 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!)"),
GLASS_TIME_NEEDED("Greenhouse Glass: Time Needed", ConfigCategories.MACHINE_VALUES, 1000, 10, 1000000, "The Time Needed for the Greenhouse Glass to grow a Plant below it"),
BREAKER_TIME_NEEDED("Breaker and Placer: Time Needed", ConfigCategories.MACHINE_VALUES, 15, 1, 10000, "The Time Needed for the Breaker and the Placer to place or break a Block"),
DROPPER_TIME_NEEDED("Dropper: Time Needed", ConfigCategories.MACHINE_VALUES, 10, 1, 10000, "The Time Needed for the Dropper to drop an Item");
public final String name;
public final String category;
public final int defaultValue;
public final int min;
public final int max;
public final String desc;
ConfigIntValues(String name, ConfigCategories category, int defaultValue, int min, int max, String desc){
this.name = name;
this.category = category.name;
this.defaultValue = defaultValue;
this.min = min;
this.max = max;
this.desc = desc;
}
public int getValue(){
return ConfigValues.intValues[this.ordinal()];
}
}

View file

@ -3,117 +3,187 @@ package ellpeck.actuallyadditions.crafting;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class BlockCrafting{ public class BlockCrafting{
public static void init(){ public static void init(){
//Compost //Compost
if(ConfigValues.enableCompostRecipe) if(ConfigCrafting.COMPOST.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockCompost), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockCompost),
"W W", "WFW", "WWW", "W W", "W W", "WCW",
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD), 'W', "plankWood",
'F', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.MASHED_FOOD.ordinal())); 'C', TheMiscBlocks.WOOD_CASING.getOredictName()));
//Wood Casing
if(ConfigCrafting.WOOD_CASING.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.WOOD_CASING.ordinal()),
"WSW", "SRS", "WSW",
'W', "plankWood",
'R', "dustRedstone",
'S', "stickWood"));
//Stone Casing
if(ConfigCrafting.STONE_CASING.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.STONE_CASING.ordinal()),
"WSW", "SRS", "WSW",
'W', "cobblestone",
'R', "dustRedstone",
'S', "stickWood"));
//Quartz Block //Quartz Block
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal()),
"QQ", "QQ", "QQ", "QQ",
'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); 'Q', TheMiscItems.QUARTZ.getOredictName()));
//Fishing Net //Fishing Net
if(ConfigValues.enableFishingNetRecipe) if(ConfigCrafting.FISHING_NET.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFishingNet), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFishingNet),
"SSS", "SDS", "SSS", "SSS", "SDS", "SSS",
'D', new ItemStack(Items.diamond), 'D', "gemDiamond",
'S', new ItemStack(Items.string)); 'S', Items.string));
//Repairer //Repairer
if(ConfigValues.enableRepairerRecipe) if(ConfigCrafting.REPAIRER.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockItemRepairer), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockItemRepairer),
"DID", "DCD", "DID", "DID", "OCO", "DID",
'D', new ItemStack(Items.diamond), 'D', "gemDiamond",
'I', new ItemStack(Items.iron_ingot), 'I', "ingotIron",
'C', new ItemStack(Blocks.crafting_table)); 'O', TheMiscItems.COIL.getOredictName(),
'C', TheMiscBlocks.STONE_CASING.getOredictName()));
//Solar Panel //Solar Panel
if(ConfigValues.enableSolarRecipe) /*if(ConfigCrafting.SOLAR_PANEL.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFurnaceSolar), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFurnaceSolar),
"IBI", "BDB", "IBI", "IQI", "CDC", "IBI",
'D', new ItemStack(Blocks.diamond_block), 'D', "blockDiamond",
'I', new ItemStack(Items.iron_ingot), 'I', "ingotIron",
'B', new ItemStack(Blocks.iron_bars)); 'Q', TheMiscBlocks.STONE_CASING.getOredictName(),
'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
'B', new ItemStack(Blocks.iron_bars)));*/
//Heat Collector //Heat Collector
if(ConfigValues.enableHeatCollectorRecipe) /*if(ConfigCrafting.HEAT_COLLECTOR.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockHeatCollector), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockHeatCollector),
"BRB", "LDL", "BRB", "BRB", "CDC", "BQB",
'D', new ItemStack(Blocks.diamond_block), 'D', "blockDiamond",
'R', new ItemStack(Items.repeater), 'R', new ItemStack(Items.repeater),
'Q', TheMiscBlocks.STONE_CASING.getOredictName(),
'L', new ItemStack(Items.lava_bucket), 'L', new ItemStack(Items.lava_bucket),
'B', new ItemStack(Blocks.iron_bars)); 'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
'B', new ItemStack(Blocks.iron_bars)));*/
//Quartz Pillar //Quartz Pillar
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()),
"Q", "Q", "Q", "Q",
'Q', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); 'Q', TheMiscItems.QUARTZ.getOredictName()));
//Chiseled Quartz //Chiseled Quartz
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockMisc, 2, TheMiscBlocks.QUARTZ_CHISELED.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 2, TheMiscBlocks.QUARTZ_CHISELED.ordinal()),
"Q", "Q", "Q", "Q",
'Q', new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ.ordinal())); 'Q', TheMiscBlocks.QUARTZ.getOredictName()));
//Inputter //Inputter
if(ConfigValues.enableInputterRecipe) if(ConfigCrafting.INPUTTER.isEnabled()){
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockInputter), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockInputter),
"WWW", "WHW", "WWW", "WWW", "CHC", "WWW",
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD), 'W', "plankWood",
'H', new ItemStack(Blocks.hopper)); 'C', TheMiscBlocks.WOOD_CASING.getOredictName(),
'H', new ItemStack(Blocks.hopper)));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitBlocks.blockInputterAdvanced),
((INameableItem)InitBlocks.blockInputter).getOredictName(),
TheMiscItems.COIL_ADVANCED.getOredictName(),
TheMiscItems.QUARTZ.getOredictName(),
"dustRedstone"));
}
//Crusher //Crusher
if(ConfigValues.enableCrusherRecipe) if(ConfigCrafting.CRUSHER.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGrinder), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGrinder),
"CFC", "CPC", "CFC", "CFC", "DQD", "CFC",
'C', new ItemStack(Blocks.cobblestone), 'C', "cobblestone",
'D', TheMiscItems.COIL.getOredictName(),
'Q', TheMiscBlocks.STONE_CASING.getOredictName(),
'P', new ItemStack(Blocks.piston), 'P', new ItemStack(Blocks.piston),
'F', new ItemStack(Items.flint)); 'F', new ItemStack(Items.flint)));
//Double Crusher //Double Crusher
if(ConfigValues.enableCrusherDoubleRecipe) if(ConfigCrafting.DOUBLE_CRUSHER.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGrinderDouble), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGrinderDouble),
"CCC", "RPR", "CCC", "CDC", "RFR", "CDC",
'C', new ItemStack(Blocks.cobblestone), 'C', "cobblestone",
'R', new ItemStack(InitBlocks.blockGrinder), 'D', TheMiscItems.COIL_ADVANCED.getOredictName(),
'P', new ItemStack(Blocks.piston)); 'R', ((INameableItem)InitBlocks.blockGrinder).getOredictName(),
'F', TheMiscBlocks.STONE_CASING.getOredictName(),
'P', new ItemStack(Blocks.piston)));
//Double Furnace //Double Furnace
if(ConfigValues.enableFurnaceDoubleRecipe) if(ConfigCrafting.COMPOST.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFurnaceDouble), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFurnaceDouble),
"CCC", "RPR", "CCC", "CDC", "RFR", "CDC",
'C', new ItemStack(Blocks.cobblestone), 'C', "cobblestone",
'D', TheMiscItems.COIL.getOredictName(),
'R', new ItemStack(Blocks.furnace), 'R', new ItemStack(Blocks.furnace),
'P', new ItemStack(Items.brick)); 'F', TheMiscBlocks.STONE_CASING.getOredictName(),
'P', "ingotBrick"));
//Feeder //Feeder
if(ConfigValues.enableFeederRecipe) if(ConfigCrafting.DOUBLE_FURNACE.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockFeeder), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFeeder),
"WCW", "WHW", "WCW", "WCW", "DHD", "WCW",
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD), 'W', "plankWood",
'D', TheMiscItems.COIL.getOredictName(),
'C', new ItemStack(Items.golden_carrot), 'C', new ItemStack(Items.golden_carrot),
'H', new ItemStack(Items.wheat)); 'H', TheMiscBlocks.WOOD_CASING.getOredictName()));
//Giant Chest //Giant Chest
if(ConfigValues.enableGiantChestRecipe) if(ConfigCrafting.GIANT_CHEST.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitBlocks.blockGiantChest), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGiantChest),
"CWC", "W W", "CWC", "CWC", "WDW", "CWC",
'C', new ItemStack(Blocks.chest), 'C', new ItemStack(Blocks.chest),
'W', new ItemStack(Blocks.planks, 1, Util.WILDCARD)); 'D', TheMiscBlocks.WOOD_CASING.getOredictName(),
'W', "plankWood"));
//Greenhouse Glass
if(ConfigCrafting.GREENHOUSE_GLASS.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockGreenhouseGlass),
"GSG", "SDS", "GSG",
'G', "blockGlass",
'D', "gemDiamond",
'S', "treeSapling"));
//Placer
if(ConfigCrafting.PLACER.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockPlacer),
"CCC", "CRP", "CCC",
'C', "cobblestone",
'R', TheMiscItems.COIL.getOredictName(),
'P', Blocks.piston));
//Breaker
if(ConfigCrafting.BREAKER.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockBreaker),
"CCC", "CRP", "CCC",
'C', "cobblestone",
'R', TheMiscItems.COIL.getOredictName(),
'P', Items.diamond_pickaxe));
//Dropper
if(ConfigCrafting.DROPPER.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockDropper),
"CCC", "CDR", "CCC",
'C', "cobblestone",
'D', Blocks.dropper,
'R', TheMiscItems.COIL_ADVANCED.getOredictName()));
} }

View file

@ -1,132 +1,135 @@
package ellpeck.actuallyadditions.crafting; package ellpeck.actuallyadditions.crafting;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheFoods;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class FoodCrafting{ public class FoodCrafting{
public static void init(){ public static void init(){
ItemStack knifeStack = new ItemStack(InitItems.itemKnife, 1, Util.WILDCARD); String knifeStack = ((INameableItem)InitItems.itemKnife).getOredictName();
//Baguette //Baguette
if(ConfigValues.enabledFoodRecipes[TheFoods.BAGUETTE.ordinal()]) if(ConfigCrafting.BAGUETTE.isEnabled())
GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1, GameRegistry.addSmelting(new ItemStack(InitItems.itemMisc, 1,
TheMiscItems.DOUGH.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), 1F); TheMiscItems.DOUGH.ordinal()), new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), 1F);
//Pizza //Pizza
if(ConfigValues.enabledFoodRecipes[TheFoods.PIZZA.ordinal()]) if(ConfigCrafting.PIZZA.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PIZZA.ordinal()),
"HKH", "MCF", " D ", "HKH", "MCF", " D ",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), 'D', TheMiscItems.DOUGH.getOredictName(),
'M', new ItemStack(Blocks.brown_mushroom), 'M', new ItemStack(Blocks.brown_mushroom),
'C', new ItemStack(Items.carrot), 'C', "cropCarrot",
'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
'K', knifeStack, 'K', knifeStack,
'H', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal())); 'H', TheFoods.CHEESE.getOredictName()));
//Hamburger //Hamburger
if(ConfigValues.enabledFoodRecipes[TheFoods.HAMBURGER.ordinal()]) if(ConfigCrafting.HAMBURGER.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.HAMBURGER.ordinal()),
"KT ", "CB ", " T ", "KT ", "CB ", " T ",
'T', new ItemStack(InitItems.itemFoods, 1, TheFoods.TOAST.ordinal()), 'T', TheFoods.TOAST.getOredictName(),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), 'C', TheFoods.CHEESE.getOredictName(),
'K', knifeStack, 'K', knifeStack,
'B', new ItemStack(Items.cooked_beef)); 'B', new ItemStack(Items.cooked_beef)));
//Big Cookie //Big Cookie
if(ConfigValues.enabledFoodRecipes[TheFoods.BIG_COOKIE.ordinal()]) if(ConfigCrafting.BIG_COOKIE.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.BIG_COOKIE.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.BIG_COOKIE.ordinal()),
"DCD", "CDC", "DCD", "DCD", "CDC", "DCD",
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), 'D', TheMiscItems.DOUGH.getOredictName(),
'C', new ItemStack(Items.dye, 1, 3)); 'C', new ItemStack(Items.dye, 1, 3)));
//Sub Sandwich //Sub Sandwich
if(ConfigValues.enabledFoodRecipes[TheFoods.SUBMARINE_SANDWICH.ordinal()]) if(ConfigCrafting.SUB.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SUBMARINE_SANDWICH.ordinal()),
"KCP", "FB ", "PCP", "KCP", "FB ", "PCP",
'P', new ItemStack(Items.paper), 'P', new ItemStack(Items.paper),
'C', new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), 'C', TheFoods.CHEESE.getOredictName(),
'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'F', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
'B', new ItemStack(InitItems.itemFoods, 1, TheFoods.BAGUETTE.ordinal()), 'B', TheFoods.BAGUETTE.getOredictName(),
'K', knifeStack); 'K', knifeStack));
//French Fry //French Fry
if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRY.ordinal()]) if(ConfigCrafting.FRENCH_FRY.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.FRENCH_FRY.ordinal()),
new ItemStack(Items.baked_potato), new ItemStack(Items.baked_potato),
knifeStack); knifeStack));
//French Fries //French Fries
if(ConfigValues.enabledFoodRecipes[TheFoods.FRENCH_FRIES.ordinal()]) if(ConfigCrafting.FRENCH_FRIES.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRIES.ordinal()),
"FFF", " P ", "FFF", " P ",
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), 'P', TheMiscItems.PAPER_CONE.getOredictName(),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal())); 'F', TheFoods.FRENCH_FRY.getOredictName()));
//Fish N Chips //Fish N Chips
if(ConfigValues.enabledFoodRecipes[TheFoods.FISH_N_CHIPS.ordinal()]) if(ConfigCrafting.FISH_N_CHIPS.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.FISH_N_CHIPS.ordinal()),
"FIF", " P ", "FIF", " P ",
'I', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD), 'I', new ItemStack(Items.cooked_fished, 1, Util.WILDCARD),
'P', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), 'P', TheMiscItems.PAPER_CONE.getOredictName(),
'F', new ItemStack(InitItems.itemFoods, 1, TheFoods.FRENCH_FRY.ordinal())); 'F', TheFoods.FRENCH_FRY.getOredictName()));
//Cheese //Cheese
if(ConfigValues.enabledFoodRecipes[TheFoods.CHEESE.ordinal()]) if(ConfigCrafting.CHEESE.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()), GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHEESE.ordinal()),
new ItemStack(Items.milk_bucket)); new ItemStack(Items.milk_bucket));
//Pumpkin Stew //Pumpkin Stew
if(ConfigValues.enabledFoodRecipes[TheFoods.PUMPKIN_STEW.ordinal()]) if(ConfigCrafting.PUMPKIN_STEW.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PUMPKIN_STEW.ordinal()), GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.PUMPKIN_STEW.ordinal()),
"P", "B", "P", "B",
'P', new ItemStack(Blocks.pumpkin), 'P', new ItemStack(Blocks.pumpkin),
'B', new ItemStack(Items.bowl)); 'B', new ItemStack(Items.bowl));
//Carrot Juice //Carrot Juice
if(ConfigValues.enabledFoodRecipes[TheFoods.CARROT_JUICE.ordinal()]) if(ConfigCrafting.CARROT_JUICE.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CARROT_JUICE.ordinal()),
new ItemStack(Items.glass_bottle), new ItemStack(Items.carrot), knifeStack); new ItemStack(Items.glass_bottle), "cropCarrot", knifeStack));
//Spaghetti //Spaghetti
if(ConfigValues.enabledFoodRecipes[TheFoods.SPAGHETTI.ordinal()]) if(ConfigCrafting.SPAGHETTI.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SPAGHETTI.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.SPAGHETTI.ordinal()),
"NNN", " B ", "NNN", " B ",
'N', new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), 'N', TheFoods.NOODLE.getOredictName(),
'B', new ItemStack(Items.bowl)); 'B', new ItemStack(Items.bowl)));
//Noodle //Noodle
if(ConfigValues.enabledFoodRecipes[TheFoods.NOODLE.ordinal()]) if(ConfigCrafting.NOODLE.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.NOODLE.ordinal()),
new ItemStack(Items.wheat), knifeStack); "cropWheat", knifeStack));
//Chocolate //Chocolate
if(ConfigValues.enabledFoodRecipes[TheFoods.CHOCOLATE.ordinal()]) if(ConfigCrafting.CHOCOLATE.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE.ordinal()), GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE.ordinal()),
"C C", "CMC", "C C", "C C", "CMC", "C C",
'C', new ItemStack(Items.dye, 1, 3), 'C', new ItemStack(Items.dye, 1, 3),
'M', new ItemStack(Items.milk_bucket)); 'M', new ItemStack(Items.milk_bucket));
//Chocolate Cake //Chocolate Cake
if(ConfigValues.enabledFoodRecipes[TheFoods.CHOCOLATE_CAKE.ordinal()]) if(ConfigCrafting.CHOCOLATE_CAKE.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE_CAKE.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemFoods, 1, TheFoods.CHOCOLATE_CAKE.ordinal()),
"MMM", "CCC", "EDS", "MMM", "CCC", "EDS",
'M', new ItemStack(Items.milk_bucket), 'M', new ItemStack(Items.milk_bucket),
'E', new ItemStack(Items.egg), 'E', new ItemStack(Items.egg),
'D', new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DOUGH.ordinal()), 'D', TheMiscItems.DOUGH.getOredictName(),
'S', new ItemStack(Items.sugar), 'S', new ItemStack(Items.sugar),
'C', new ItemStack(Items.dye, 1, 3)); 'C', new ItemStack(Items.dye, 1, 3)));
//Toast //Toast
if(ConfigValues.enabledFoodRecipes[TheFoods.TOAST.ordinal()]) if(ConfigCrafting.TOAST.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.TOAST.ordinal()), GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemFoods, 2, TheFoods.TOAST.ordinal()),
new ItemStack(Items.bread)); new ItemStack(Items.bread));
} }

View file

@ -2,85 +2,36 @@ package ellpeck.actuallyadditions.crafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheDusts;
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler;
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler.SearchCase;
import ellpeck.actuallyadditions.recipe.GrinderRecipeHandler.SpecialOreCase;
import ellpeck.actuallyadditions.recipe.GrinderRecipes; import ellpeck.actuallyadditions.recipe.GrinderRecipes;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.Level;
import java.util.ArrayList;
public class GrinderCrafting{ public class GrinderCrafting{
private static GrinderRecipeHandler grindRecHan = GrinderRecipeHandler.instance();
private static GrinderRecipes grindRec = GrinderRecipes.instance();
public static void init(){ public static void init(){
Util.logInfo("Initializing Grinder Recipes..."); Util.logInfo("Initializing Crusher Recipes...");
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.iron_ore), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()), new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()), 10); grindRec.registerRecipe(new ItemStack(Blocks.iron_ore), new ItemStack(InitItems.itemDust, 2, TheDusts.IRON.ordinal()), new ItemStack(InitItems.itemDust, 1, TheDusts.GOLD.ordinal()), 10);
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10), null, 0); grindRec.registerRecipe(new ItemStack(Blocks.redstone_ore), new ItemStack(Items.redstone, 10), null, 0);
GrinderRecipes.instance().registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()), null, 0); grindRec.registerRecipe(new ItemStack(Blocks.lapis_ore), new ItemStack(InitItems.itemDust, 12, TheDusts.LAPIS.ordinal()), null, 0);
grindRecHan.specialOreCases.add(new SpecialOreCase("oreNickel", "dustPlatinum", 30));
registerFinally(); grindRecHan.searchCases.add(new SearchCase("ore", 2));
} grindRecHan.searchCases.add(new SearchCase("oreNether", 6));
grindRecHan.searchCases.add(new SearchCase("denseore", 8));
grindRecHan.searchCases.add(new SearchCase("gem", 1));
grindRecHan.searchCases.add(new SearchCase("ingot", 1));
grindRecHan.exceptions.add("ingotBrick");
grindRecHan.exceptions.add("ingotBrickNether");
public static void registerFinally(){ grindRecHan.registerFinally();
String[] names = OreDictionary.getOreNames();
for(String name : names){
int resultAmount = 1;
String nameOfOre = null;
if(name.length() > 3 && name.substring(0, 3).equals("ore")){
nameOfOre = name.substring(3);
resultAmount = 2;
}
if(name.length() > 9 && name.substring(0, 9).equals("oreNether")){
nameOfOre = name.substring(9);
resultAmount = 4;
}
if(name.length() > 8 && name.substring(0, 8).equals("denseore")){
nameOfOre = name.substring(8);
resultAmount = 12;
}
if(name.length() > 3 && name.substring(0, 3).equals("gem")) nameOfOre = name.substring(3);
if(name.length() > 5 && name.substring(0, 5).equals("ingot")) nameOfOre = name.substring(5);
if(nameOfOre != null){
ArrayList<ItemStack> allDusts;
String nameToGetFrom = "dust" + nameOfOre;
allDusts = OreDictionary.getOres(nameToGetFrom);
if(allDusts != null && allDusts.size() > 0){
ArrayList<ItemStack> allOresOfName = OreDictionary.getOres(name);
if(allOresOfName != null && allOresOfName.size() > 0){
for(ItemStack theDust : allDusts){
ItemStack output = theDust.copy();
output.stackSize = resultAmount;
for(ItemStack theInput : allOresOfName){
ItemStack input = theInput.copy();
if(GrinderRecipes.instance().getOutput(input, false) == null){
ArrayList<ItemStack> specialStacks = null;
if(name.equals("oreNickel")) specialStacks = OreDictionary.getOres("dustPlatinum");
if(specialStacks != null){
for(ItemStack theSpecial : specialStacks){
ItemStack special = theSpecial.copy();
GrinderRecipes.instance().registerRecipe(input, output, special, 10);
}
}
else GrinderRecipes.instance().registerRecipe(input, output, null, 0);
}
}
}
}
else ModUtil.AA_LOGGER.log(Level.ERROR, "Couldn't register Crusher Recipe! Didn't find Items registered as '" + name + "'! This shouldn't happen as there is something registered as '" + name + "' that doesn't exist!");
}
else if(!name.equals("ingotBrick") && !name.equals("ingotBrickNether")) ModUtil.AA_LOGGER.log(Level.WARN, "Couldn't register Crusher Recipe! An Item with OreDictionary Registry '" + nameToGetFrom + "' doesn't exist! It should correspond to '" + name + "'! This is not an Error, just a bit sad :(");
}
}
} }
} }

View file

@ -3,7 +3,7 @@ package ellpeck.actuallyadditions.crafting;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheDusts;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
@ -15,19 +15,35 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemFood; import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class ItemCrafting{ public class ItemCrafting{
public static void init(){ public static void init(){
//Leaf Blower //Leaf Blower
if(ConfigValues.enableLeafBlowerRecipe) if(ConfigCrafting.LEAF_BLOWER.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemLeafBlower), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlower),
" F", "IP", "IR", " F", "IP", "IC",
'F', new ItemStack(Items.flint), 'F', new ItemStack(Items.flint),
'I', new ItemStack(Items.iron_ingot), 'I', "ingotIron",
'P', new ItemStack(Blocks.piston), 'P', new ItemStack(Blocks.piston),
'R', new ItemStack(Items.redstone)); 'C', TheMiscItems.COIL_ADVANCED.getOredictName()));
//Coil
if(ConfigCrafting.COIL.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL.ordinal()),
" R ", "RIR", " R ",
'I', "ingotIron",
'R', "dustRedstone"));
//Advanced Coil
if(ConfigCrafting.ADV_COIL.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.COIL_ADVANCED.ordinal()),
" G ", "GCG", " G ",
'C', TheMiscItems.COIL.getOredictName(),
'G', "ingotGold"));
//Ender Pearl //Ender Pearl
GameRegistry.addRecipe(new ItemStack(Items.ender_pearl), GameRegistry.addRecipe(new ItemStack(Items.ender_pearl),
@ -40,34 +56,41 @@ public class ItemCrafting{
'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.EMERALD_SHARD.ordinal())); 'X', new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.EMERALD_SHARD.ordinal()));
//Advanced Leaf Blower //Advanced Leaf Blower
if(ConfigValues.enableLeafBlowerAdvancedRecipe) if(ConfigCrafting.LEAF_BLOWER_ADVANCED.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemLeafBlowerAdvanced),
" F", "DP", "DR", " F", "DP", "DC",
'F', new ItemStack(Items.flint), 'F', new ItemStack(Items.flint),
'D', new ItemStack(Items.diamond), 'D', "gemDiamond",
'P', new ItemStack(Blocks.piston), 'P', new ItemStack(Blocks.piston),
'R', new ItemStack(Items.redstone)); 'C', TheMiscItems.COIL_ADVANCED.getOredictName()));
//Quartz //Quartz
if(ConfigValues.enabledMiscRecipes[TheMiscItems.QUARTZ.ordinal()]) GameRegistry.addSmelting(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()),
GameRegistry.addSmelting(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.ORE_QUARTZ.ordinal()), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 1F);
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 1F);
//Knife //Knife
if(ConfigValues.enableKnifeRecipe) if(ConfigCrafting.KNIFE.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemKnife), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemKnife),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), TheMiscItems.KNIFE_BLADE.getOredictName(),
new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal())); TheMiscItems.KNIFE_HANDLE.getOredictName()));
//Crafter on a Stick //Crafter on a Stick
if(ConfigValues.enableCrafterRecipe) if(ConfigCrafting.STICK_CRAFTER.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCrafterOnAStick), GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemCrafterOnAStick),
new ItemStack(Blocks.crafting_table), new ItemStack(Blocks.crafting_table),
new ItemStack(Items.sign), new ItemStack(Items.sign),
new ItemStack(Items.slime_ball)); new ItemStack(Items.slime_ball));
//SpeedUpgrade
if(ConfigCrafting.SPEED_UPGRADE.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemSpeedUpgrade, 2),
"RGR", "GUG", "RGR",
'U', TheMiscItems.COIL.getOredictName(),
'R', "dustRedstone",
'G', "ingotGold"));
//Mashed Food //Mashed Food
if(ConfigValues.enabledMiscRecipes[TheMiscItems.MASHED_FOOD.ordinal()]) if(ConfigCrafting.MASHED_FOOD.isEnabled())
initMashedFoodRecipes(); initMashedFoodRecipes();
//Rings //Rings
@ -94,19 +117,29 @@ public class ItemCrafting{
} }
public static void initPotionRingRecipes(){ public static void initPotionRingRecipes(){
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()),
"IGI", "GDG", "IGI", "IGI", "GDG", "IGI",
'G', new ItemStack(Items.gold_ingot), 'G', "ingotGold",
'I', new ItemStack(Items.iron_ingot), 'I', "ingotIron",
'D', new ItemStack(Items.glowstone_dust)); 'D', "dustGlowstone"));
for(int i = 0; i < ThePotionRings.values().length; i++){ if(ConfigCrafting.RING_SPEED.isEnabled()) addRingRecipeWithStack(ThePotionRings.SPEED.craftingItem, ThePotionRings.SPEED.ordinal());
if(ConfigValues.enablePotionRingRecipes[i]){ if(ConfigCrafting.RING_HASTE.isEnabled()) addRingRecipeWithStack(ThePotionRings.HASTE.craftingItem, ThePotionRings.HASTE.ordinal());
ItemStack mainStack = ThePotionRings.values()[i].craftingItem; if(ConfigCrafting.RING_STRENGTH.isEnabled()) addRingRecipeWithStack(ThePotionRings.STRENGTH.craftingItem, ThePotionRings.STRENGTH.ordinal());
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, i), mainStack, mainStack, mainStack, mainStack, new ItemStack(Blocks.diamond_block), new ItemStack(Items.nether_wart), new ItemStack(Items.potionitem), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal())); if(ConfigCrafting.RING_JUMP_BOOST.isEnabled()) addRingRecipeWithStack(ThePotionRings.JUMP_BOOST.craftingItem, ThePotionRings.JUMP_BOOST.ordinal());
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, i), new ItemStack(InitItems.itemPotionRing, 1, i), new ItemStack(Items.nether_star)); if(ConfigCrafting.RING_REGEN.isEnabled()) addRingRecipeWithStack(ThePotionRings.REGEN.craftingItem, ThePotionRings.REGEN.ordinal());
} if(ConfigCrafting.RING_RESISTANCE.isEnabled()) addRingRecipeWithStack(ThePotionRings.RESISTANCE.craftingItem, ThePotionRings.RESISTANCE.ordinal());
} if(ConfigCrafting.RING_FIRE_RESISTANCE.isEnabled()) addRingRecipeWithStack(ThePotionRings.FIRE_RESISTANCE.craftingItem, ThePotionRings.FIRE_RESISTANCE.ordinal());
if(ConfigCrafting.RING_WATER_BREATHING.isEnabled()) addRingRecipeWithStack(ThePotionRings.WATER_BREATHING.craftingItem, ThePotionRings.WATER_BREATHING.ordinal());
if(ConfigCrafting.RING_INVISIBILITY.isEnabled()) addRingRecipeWithStack(ThePotionRings.INVISIBILITY.craftingItem, ThePotionRings.INVISIBILITY.ordinal());
if(ConfigCrafting.RING_NIGHT_VISION.isEnabled()) addRingRecipeWithStack(ThePotionRings.NIGHT_VISION.craftingItem, ThePotionRings.NIGHT_VISION.ordinal());
if(ConfigCrafting.RING_SATURATION.isEnabled()) addRingRecipeWithStack(ThePotionRings.SATURATION.craftingItem, ThePotionRings.SATURATION.ordinal());
}
public static void addRingRecipeWithStack(ItemStack mainStack, int meta){
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRing, 1, meta), mainStack, mainStack, mainStack, mainStack, new ItemStack(Blocks.diamond_block), new ItemStack(Items.nether_wart), new ItemStack(Items.potionitem), new ItemStack(InitItems.itemMisc, 1, TheMiscItems.RING.ordinal()));
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemPotionRingAdvanced, 1, meta), new ItemStack(InitItems.itemPotionRing, 1, meta), new ItemStack(Items.nether_star));
} }
public static void initMashedFoodRecipes(){ public static void initMashedFoodRecipes(){

View file

@ -1,40 +1,41 @@
package ellpeck.actuallyadditions.crafting; package ellpeck.actuallyadditions.crafting;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class MiscCrafting{ public class MiscCrafting{
public static void init(){ public static void init(){
//Dough //Dough
if(ConfigValues.enabledMiscRecipes[TheMiscItems.DOUGH.ordinal()]) if(ConfigCrafting.DOUGH.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 2, TheMiscItems.DOUGH.ordinal()),
new ItemStack(Items.wheat), new ItemStack(Items.wheat)); "cropWheat", "cropWheat"));
//Paper Cone //Paper Cone
if(ConfigValues.enabledMiscRecipes[TheMiscItems.PAPER_CONE.ordinal()]) if(ConfigCrafting.PAPER_CONE.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()), GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.PAPER_CONE.ordinal()),
"P P", " P ", "P P", " P ",
'P', new ItemStack(Items.paper)); 'P', new ItemStack(Items.paper));
//Knife Handle //Knife Handle
if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_HANDLE.ordinal()]) if(ConfigCrafting.KNIFE_HANDLE.isEnabled())
GameRegistry.addShapelessRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()), GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_HANDLE.ordinal()),
new ItemStack(Items.stick), "stickWood",
new ItemStack(Items.leather)); new ItemStack(Items.leather)));
//Knife Blade //Knife Blade
if(ConfigValues.enabledMiscRecipes[TheMiscItems.KNIFE_BLADE.ordinal()]) if(ConfigCrafting.KNIFE_BLADE.isEnabled())
GameRegistry.addRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.KNIFE_BLADE.ordinal()),
"KF", "KF",
'K', new ItemStack(Items.iron_ingot), 'K', "ingotIron",
'F', new ItemStack(Items.flint)); 'F', new ItemStack(Items.flint)));
} }
} }

View file

@ -1,49 +1,50 @@
package ellpeck.actuallyadditions.crafting; package ellpeck.actuallyadditions.crafting;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigCrafting;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.ShapedOreRecipe;
public class ToolCrafting{ public class ToolCrafting{
public static void init(){ public static void init(){
if(ConfigValues.enableToolEmeraldRecipe){ if(ConfigCrafting.TOOL_EMERALD.isEnabled()){
//Pickaxe //Pickaxe
GameRegistry.addRecipe(new ItemStack(InitItems.itemPickaxeEmerald), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemPickaxeEmerald),
"EEE", " S ", " S ", "EEE", " S ", " S ",
'E', new ItemStack(Items.emerald), 'E', "gemEmerald",
'S', new ItemStack(Items.stick)); 'S', new ItemStack(Items.stick)));
//Sword //Sword
GameRegistry.addRecipe(new ItemStack(InitItems.itemSwordEmerald), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemSwordEmerald),
"E", "E", "S", "E", "E", "S",
'E', new ItemStack(Items.emerald), 'E', "gemEmerald",
'S', new ItemStack(Items.stick)); 'S', new ItemStack(Items.stick)));
//Axe //Axe
GameRegistry.addRecipe(new ItemStack(InitItems.itemAxeEmerald), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemAxeEmerald),
"EE", "ES", " S", "EE", "ES", " S",
'E', new ItemStack(Items.emerald), 'E', "gemEmerald",
'S', new ItemStack(Items.stick)); 'S', new ItemStack(Items.stick)));
//Shovel //Shovel
GameRegistry.addRecipe(new ItemStack(InitItems.itemShovelEmerald), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemShovelEmerald),
"E", "S", "S", "E", "S", "S",
'E', new ItemStack(Items.emerald), 'E', "gemEmerald",
'S', new ItemStack(Items.stick)); 'S', new ItemStack(Items.stick)));
//Hoe //Hoe
GameRegistry.addRecipe(new ItemStack(InitItems.itemHoeEmerald), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitItems.itemHoeEmerald),
"EE", " S", " S", "EE", " S", " S",
'E', new ItemStack(Items.emerald), 'E', "gemEmerald",
'S', new ItemStack(Items.stick)); 'S', new ItemStack(Items.stick)));
} }
if(ConfigValues.enableToolObsidianRecipe){ if(ConfigCrafting.TOOL_OBSIDIAN.isEnabled()){
//Pickaxe //Pickaxe
GameRegistry.addRecipe(new ItemStack(InitItems.itemPickaxeObsidian), GameRegistry.addRecipe(new ItemStack(InitItems.itemPickaxeObsidian),
"EEE", " S ", " S ", "EEE", " S ", " S ",

View file

@ -27,19 +27,27 @@ public class CreativeTab extends CreativeTabs{
this.list = list; this.list = list;
this.addBlock(InitBlocks.blockInputter); this.addBlock(InitBlocks.blockInputter);
this.addBlock(InitBlocks.blockInputterAdvanced);
this.addBlock(InitBlocks.blockGreenhouseGlass);
this.addBlock(InitBlocks.blockGrinder); this.addBlock(InitBlocks.blockGrinder);
this.addBlock(InitBlocks.blockGrinderDouble); this.addBlock(InitBlocks.blockGrinderDouble);
this.addBlock(InitBlocks.blockFurnaceDouble); this.addBlock(InitBlocks.blockFurnaceDouble);
this.addBlock(InitBlocks.blockFurnaceSolar);
this.addBlock(InitBlocks.blockFishingNet); //TODO Re-add
this.addBlock(InitBlocks.blockHeatCollector); //this.addBlock(InitBlocks.blockFurnaceSolar);
//this.addBlock(InitBlocks.blockHeatCollector);
this.addBlock(InitBlocks.blockItemRepairer); this.addBlock(InitBlocks.blockItemRepairer);
this.addBlock(InitBlocks.blockFishingNet);
this.addBlock(InitBlocks.blockBreaker);
this.addBlock(InitBlocks.blockPlacer);
this.addBlock(InitBlocks.blockDropper);
this.addBlock(InitBlocks.blockMisc); this.addBlock(InitBlocks.blockMisc);
this.addBlock(InitBlocks.blockFeeder); this.addBlock(InitBlocks.blockFeeder);
this.addBlock(InitBlocks.blockCompost); this.addBlock(InitBlocks.blockCompost);
this.addBlock(InitBlocks.blockGiantChest); this.addBlock(InitBlocks.blockGiantChest);
this.addItem(InitItems.itemSpeedUpgrade);
this.addItem(InitItems.itemMisc); this.addItem(InitItems.itemMisc);
this.addItem(InitItems.itemFertilizer); this.addItem(InitItems.itemFertilizer);
this.addItem(InitItems.itemFoods); this.addItem(InitItems.itemFoods);
@ -64,6 +72,8 @@ public class CreativeTab extends CreativeTabs{
this.addItem(InitItems.itemPotionRing); this.addItem(InitItems.itemPotionRing);
this.addItem(InitItems.itemPotionRingAdvanced); this.addItem(InitItems.itemPotionRingAdvanced);
this.addItem(InitItems.itemJams);
} }
@Override @Override

View file

@ -2,40 +2,27 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent; import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
import ellpeck.actuallyadditions.achievement.TheAchievements;
import net.minecraft.item.ItemStack;
public class CraftEvent{ public class CraftEvent{
@SubscribeEvent @SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){ public void onCraftedEvent(PlayerEvent.ItemCraftedEvent event){
/*if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.DOUGH.ordinal()){ checkAchievements(event.crafting, event, InitAchievements.CRAFTING_ACH);
event.player.addStat(InitAchievements.achievementCraftDough, 1); }
public static void checkAchievements(ItemStack gotten, PlayerEvent event, int type){
for(int i = 0; i < TheAchievements.values().length; i++){
TheAchievements ach = TheAchievements.values()[i];
if(ach.type == type){
if(gotten.getItem() == ach.ach.theItemStack.getItem()){
if(gotten.getItemDamage() == ach.ach.theItemStack.getItemDamage()){
event.player.addStat(ach.ach, 1);
}
}
}
} }
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal()){
event.player.addStat(InitAchievements.achievementCraftMashedFood, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.KNIFE_BLADE.ordinal()){
event.player.addStat(InitAchievements.achievementCraftKnifeBlade, 1);
}
if(event.crafting.getItem() == InitItems.itemKnife){
event.player.addStat(InitAchievements.achievementCraftKnife, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.SUBMARINE_SANDWICH.ordinal()){
event.player.addStat(InitAchievements.achievementCraftSubSandwich, 1);
}
if(event.crafting.getItem() == InitItems.itemMisc && event.crafting.getItemDamage() == TheMiscItems.PAPER_CONE.ordinal()){
event.player.addStat(InitAchievements.achievementCraftPaperCone, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRY.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFrenchFry, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FRENCH_FRIES.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFrenchFries, 1);
}
if(event.crafting.getItem() == InitItems.itemFoods && event.crafting.getItemDamage() == TheFoods.FISH_N_CHIPS.ordinal()){
event.player.addStat(InitAchievements.achievementCraftFishNChips, 1);
}
if(event.crafting.getItem()== Item.getItemFromBlock(InitBlocks.blockCompost)){
event.player.addStat(InitAchievements.achievementCraftCompost, 1);
}*/
} }
} }

View file

@ -10,6 +10,8 @@ public class InitEvents{
Util.registerEvent(new SmeltEvent()); Util.registerEvent(new SmeltEvent());
Util.registerEvent(new CraftEvent()); Util.registerEvent(new CraftEvent());
Util.registerEvent(new KilledEvent()); Util.registerEvent(new KilledEvent());
Util.registerEvent(new PickupEvent());
Util.registerEvent(new TooltipEvent());
} }
} }

View file

@ -0,0 +1,14 @@
package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
public class PickupEvent{
@SubscribeEvent
public void onCraftedEvent(PlayerEvent.ItemPickupEvent event){
CraftEvent.checkAchievements(event.pickedUp.getEntityItem(), event, InitAchievements.PICKUP_ACH);
}
}

View file

@ -39,7 +39,7 @@ public class RenderPlayerEventAA{
//dqmhose //dqmhose
if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){ if(event.entityPlayer.getUniqueID().equals(UUID.fromString("cb7b293a-5031-484e-b5be-b4f2f4e92726"))){
hoseRender.render(event.entityPlayer, event.partialRenderTick, 0.5F, 1.25F); hoseRender.render(event.entityPlayer, event.partialRenderTick, 0.5F, 1.3F);
} }
} }
} }

View file

@ -2,13 +2,12 @@ package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent; import cpw.mods.fml.common.gameevent.PlayerEvent;
import ellpeck.actuallyadditions.achievement.InitAchievements;
public class SmeltEvent{ public class SmeltEvent{
@SubscribeEvent @SubscribeEvent
public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){ public void onSmeltedEvent(PlayerEvent.ItemSmeltedEvent event){
/*if(event.smelting.getItem() == InitItems.itemFoods && event.smelting.getItemDamage() == TheFoods.BAGUETTE.ordinal()){ CraftEvent.checkAchievements(event.smelting, event, InitAchievements.SMELTING_ACH);
event.player.addStat(InitAchievements.achievementSmeltBaguette, 1);
}*/
} }
} }

View file

@ -0,0 +1,26 @@
package ellpeck.actuallyadditions.event;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.util.StatCollector;
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.oredict.OreDictionary;
public class TooltipEvent{
@SubscribeEvent
public void onTooltipEvent(ItemTooltipEvent event){
if(KeyUtil.isControlPressed()){
int[] oreIDs = OreDictionary.getOreIDs(event.itemStack);
if(oreIDs.length > 0){
event.toolTip.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".oredictName.desc") + ":");
for(int oreID : oreIDs){
event.toolTip.add(StringUtil.GRAY + "-" + OreDictionary.getOreName(oreID));
}
}
else event.toolTip.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".noOredictNameAvail.desc"));
}
}
}

View file

@ -6,7 +6,6 @@ import net.minecraft.client.model.ModelRenderer;
public class ModelStandardBlock extends ModelBaseAA{ public class ModelStandardBlock extends ModelBaseAA{
public ModelRenderer s; public ModelRenderer s;
private String name; private String name;
public ModelStandardBlock(String name){ public ModelStandardBlock(String name){

View file

@ -22,9 +22,9 @@ public class RenderSpecial{
public void render(EntityPlayer player, float renderTick, float size, float offsetUp){ public void render(EntityPlayer player, float renderTick, float size, float offsetUp){
int bobHeight = 70; int bobHeight = 70;
double rotationModifier = 2; long theTime = Minecraft.getSystemTime();
long time = theTime/50;
long time = player.worldObj.getTotalWorldTime();
if(time-bobHeight >= lastTimeForBobbing){ if(time-bobHeight >= lastTimeForBobbing){
this.lastTimeForBobbing = time; this.lastTimeForBobbing = time;
} }
@ -37,7 +37,7 @@ public class RenderSpecial{
GL11.glTranslated(playerPos.xCoord-clientPos.xCoord, playerPos.yCoord-clientPos.yCoord+1.6225, playerPos.zCoord-clientPos.zCoord); GL11.glTranslated(playerPos.xCoord-clientPos.xCoord, playerPos.yCoord-clientPos.yCoord+1.6225, playerPos.zCoord-clientPos.zCoord);
} }
GL11.glTranslated(0F, offsetUp+0.15D, 0F); GL11.glTranslated(0F, offsetUp + 0.15D, 0F);
GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F); GL11.glRotatef(180F, 1.0F, 0.0F, 1.0F);
GL11.glScalef(size, size, size); GL11.glScalef(size, size, size);
@ -49,7 +49,7 @@ public class RenderSpecial{
GL11.glTranslated(0, -((double)time-lastTimeForBobbing)/100+(double)bobHeight/100, 0); GL11.glTranslated(0, -((double)time-lastTimeForBobbing)/100+(double)bobHeight/100, 0);
} }
GL11.glRotated((double)time*rotationModifier, 0, 1, 0); GL11.glRotated((double)theTime/20, 0, 1, 0);
Minecraft.getMinecraft().renderEngine.bindTexture(theTexture); Minecraft.getMinecraft().renderEngine.bindTexture(theTexture);
theModel.render(0.0625F); theModel.render(0.0625F);

View file

@ -0,0 +1,43 @@
package ellpeck.actuallyadditions.gen;
import cpw.mods.fml.common.registry.VillagerRegistry;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheJams;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.gen.structure.MapGenStructureIO;
import net.minecraftforge.common.ChestGenHooks;
import java.util.Random;
public class InitVillager{
public static ChestGenHooks jamHouseChest;
public static void init(){
Util.logInfo("Initializing Village Addons...");
if(ConfigBoolValues.JAM_VILLAGER_EXISTS.isEnabled()){
int jamID = ConfigIntValues.JAM_VILLAGER_ID.getValue();
VillagerRegistry.instance().registerVillagerId(jamID);
VillagerRegistry.instance().registerVillageTradeHandler(jamID, new JamVillagerTradeHandler());
jamHouseChest = new ChestGenHooks("JamHouse", new WeightedRandomChestContent[0], 5, 20);
for(int i = 0; i < TheJams.values().length; i++){
jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(InitItems.itemJams, new Random().nextInt(5)+1, i), 1, 1, 15));
}
jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.glass_bottle, new Random().nextInt(5)+1), 1, 1, 15));
jamHouseChest.addItem(new WeightedRandomChestContent(new ItemStack(Items.potionitem, new Random().nextInt(5)+1), 1, 1, 15));
VillagerRegistry.instance().registerVillageCreationHandler(new VillageJamHouseHandler());
MapGenStructureIO.func_143031_a(VillageComponentJamHouse.class, ModUtil.MOD_ID_LOWER + ":jamHouseStructure");
}
}
}

View file

@ -0,0 +1,85 @@
package ellpeck.actuallyadditions.gen;
import cpw.mods.fml.common.registry.VillagerRegistry;
import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.items.metalists.TheJams;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.village.MerchantRecipe;
import net.minecraft.village.MerchantRecipeList;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.Random;
public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHandler{
private ArrayList<Trade> trades = new ArrayList<Trade>();
public JamVillagerTradeHandler(){
this.addWants("ingotGold", 3, 2);
this.addWants("cropWheat", 10, 10);
this.addWants("dustRedstone", 15, 15);
this.addWants(new ItemStack(Items.bucket), 1, 4);
this.addWants(new ItemStack(Items.glass_bottle), 5, 5);
this.addWants(new ItemStack(Items.potionitem), 1, 0);
this.addWants("ingotIron", 5, 5);
this.addWants("gemDiamond", 1, 1);
this.addWants("dustGlowstone", 5, 10);
}
@Override
@SuppressWarnings("all")
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){
for(int i = 0; i < trades.size(); i++){
for(int j = 0; j < trades.get(i).wants.size(); j++){
ItemStack wantsTwo = null;
ItemStack wantsOne = trades.get(i).wants.get(j);
wantsOne.stackSize = rand.nextInt(trades.get(i).extraStackSize) + trades.get(i).baseStackSize;
if(rand.nextInt(3) == 0){
int toGet = rand.nextInt(trades.size());
for(int k = 0; k < trades.get(toGet).wants.size(); k++){
wantsTwo = trades.get(toGet).wants.get(k);
wantsTwo.stackSize = rand.nextInt(trades.get(k).extraStackSize) + trades.get(k).baseStackSize;
}
}
if(wantsOne == wantsTwo) wantsTwo = null;
for(int k = 0; k < TheJams.values().length; k++){
recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(5)+1, k)));
}
}
}
}
public void addWants(String oredictName, int minSize, int maxSize){
ArrayList<ItemStack> stacks = OreDictionary.getOres(oredictName);
trades.add(new Trade(stacks, minSize, maxSize));
}
public void addWants(ItemStack stack, int minSize, int maxSize){
trades.add(new Trade(stack, minSize, maxSize));
}
public static class Trade{
public final ArrayList<ItemStack> wants = new ArrayList<ItemStack>();
public final int baseStackSize;
public final int extraStackSize;
public Trade(ArrayList<ItemStack> wants, int minStackSize, int maxStackSize){
this.wants.addAll(wants);
this.baseStackSize = minStackSize <= 0 ? 1 : minStackSize;
this.extraStackSize = maxStackSize <= 0 ? 1 : maxStackSize;
}
public Trade(ItemStack want, int minStackSize, int maxStackSize){
this.wants.add(want);
this.baseStackSize = minStackSize <= 0 ? 1 : minStackSize;
this.extraStackSize = maxStackSize <= 0 ? 1 : maxStackSize;
}
}
}

View file

@ -4,7 +4,8 @@ import cpw.mods.fml.common.IWorldGenerator;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import ellpeck.actuallyadditions.blocks.InitBlocks; import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks; import ellpeck.actuallyadditions.blocks.metalists.TheMiscBlocks;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -36,7 +37,7 @@ public class OreGen implements IWorldGenerator{
} }
private void generateSurface(World world, Random random, int x, int z){ private void generateSurface(World world, Random random, int x, int z){
if(ConfigValues.generateBlackQuartz) this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, this.getRandom(ConfigValues.blackQuartzBaseAmount, ConfigValues.blackQuartzAdditionalChance, random), ConfigValues.blackQuartzChance, ConfigValues.blackQuartzMinHeight, ConfigValues.blackQuartzMaxHeight); if(ConfigBoolValues.GENERATE_QUARTZ.isEnabled()) this.addOreSpawn(InitBlocks.blockMisc, TheMiscBlocks.ORE_QUARTZ.ordinal(), Blocks.stone, world, random, x, z, this.getRandom(ConfigIntValues.BLACK_QUARTZ_BASE_AMOUNT.getValue(), ConfigIntValues.BLACK_QUARTZ_ADD_CHANCE.getValue(), random), ConfigIntValues.BLACK_QUARTZ_CHANCE.getValue(), ConfigIntValues.BLACK_QUARTZ_MIN_HEIGHT.getValue(), ConfigIntValues.BLACK_QUARTZ_MAX_HEIGHT.getValue());
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")

View file

@ -0,0 +1,193 @@
package ellpeck.actuallyadditions.gen;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureBoundingBox;
import net.minecraft.world.gen.structure.StructureComponent;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import java.util.List;
import java.util.Random;
public class VillageComponentJamHouse extends StructureVillagePieces.House1{
private static final int xSize = 10;
private static final int ySize = 8;
private static final int zSize = 11;
private int averageGroundLevel = -1;
@SuppressWarnings("unused")
public VillageComponentJamHouse(){
}
public VillageComponentJamHouse(StructureBoundingBox boundingBox, int par5){
this.coordBaseMode = par5;
this.boundingBox = boundingBox;
}
public static VillageComponentJamHouse buildComponent(List pieces, int p1, int p2, int p3, int p4){
StructureBoundingBox boundingBox = StructureBoundingBox.getComponentToAddBoundingBox(p1, p2, p3, 0, 0, 0, xSize+1, ySize+1, zSize+1, p4);
return canVillageGoDeeper(boundingBox) && StructureComponent.findIntersecting(pieces, boundingBox) == null ? new VillageComponentJamHouse(boundingBox, p4) : null;
}
@Override
public boolean addComponentParts(World world, Random rand, StructureBoundingBox sbb){
if(this.averageGroundLevel < 0){
this.averageGroundLevel = this.getAverageGroundLevel(world, sbb);
if(this.averageGroundLevel < 0) return true;
this.boundingBox.offset(0, this.averageGroundLevel-this.boundingBox.maxY+ySize, 0);
}
this.spawnActualHouse(world, rand, sbb);
for (int i = 0; i < xSize; i++){
for(int j = 0; j < zSize; j++){
this.clearCurrentPositionBlocksUpwards(world, j, ySize, i, sbb);
this.func_151554_b(world, Blocks.cobblestone, 0, j, -1, i, sbb);
}
}
this.spawnVillagers(world, sbb, 3, 1, 3, 1);
return true;
}
public void spawnActualHouse(World world, Random rand, StructureBoundingBox sbb){
//Base
this.fillWithBlocks(world, sbb, 1, 0, 8, 9, 0, 10, Blocks.grass);
this.fillWithBlocks(world, sbb, 0, 0, 0, 1, 0, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 2, 0, 0, 4, 0, 1, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 9, 0, 0, 10, 0, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 6, 0, 0, 8, 0, 1, Blocks.cobblestone);
this.placeBlockAtCurrentPosition(world, Blocks.stone_stairs, this.getMetadataWithOffset(Blocks.stone_stairs, 3), 5, 0, 0, sbb);
this.fillWithBlocks(world, sbb, 2, 0, 7, 3, 0, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 5, 0, 7, 8, 0, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 10, 0, 8, 10, 0, 11, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 0, 0, 8, 0, 0, 11, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 0, 0, 11, 10, 0, 11, Blocks.cobblestone);
this.fillWithMetadataBlocks(world, sbb, 2, 0, 2, 8, 0, 6, Blocks.planks, 1, Blocks.planks, 1, false);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 5, 0, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 1, 4, 0, 7, sbb);
//Garden Fence
this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 1, 11, Blocks.fence);
this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 1, 11, Blocks.fence);
this.fillWithBlocks(world, sbb, 1, 1, 11, 9, 1, 11, Blocks.fence);
//Side Walls
for(int i = 0; i < 2; i++){
this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 1, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 1+i*8, 1, 1, 1+i*8, 4, 1, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 1+i*8, 1, 7, 1+i*8, 4, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 1+i*8, 4, 2, 1+i*8, 5, 6, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 1+i*8, 3, 2, 1+i*8, 3, 6, Blocks.planks);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i* 8, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 1+i*8, 2, 6, sbb);
this.fillWithBlocks(world, sbb, 1+i*8, 2, 3, 1+i*8, 2, 5, Blocks.glass_pane);
}
//Front Wall
this.fillWithBlocks(world, sbb, 7, 1, 1, 8, 4, 1, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 2, 1, 1, 3, 4, 1, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 4, 4, 1, 7, 4, 1, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 6, 1, 1, 6, 3, 1, Blocks.planks);
this.fillWithBlocks(world, sbb, 4, 1, 1, 4, 3, 1, Blocks.planks);
this.fillWithBlocks(world, sbb, 5, 3, 1, 5, 3, 1, Blocks.planks);
this.placeDoorAtCurrentPosition(world, sbb, rand, 5, 1, 1, this.getMetadataWithOffset(Blocks.wooden_door, 1));
//Back Wall
this.fillWithBlocks(world, sbb, 2, 1, 7, 2, 4, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 3, 1, 7, 3, 3, 7, Blocks.planks);
this.fillWithBlocks(world, sbb, 4, 3, 7, 8, 3, 7, Blocks.planks);
this.fillWithBlocks(world, sbb, 3, 4, 7, 8, 4, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 5, 1, 7, 5, 2, 7, Blocks.planks);
this.fillWithBlocks(world, sbb, 6, 1, 7, 8, 1, 7, Blocks.cobblestone);
this.fillWithBlocks(world, sbb, 6, 2, 7, 7, 2, 7, Blocks.glass_pane);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 8, 2, 7, sbb);
this.placeDoorAtCurrentPosition(world, sbb, rand, 4, 1, 7, this.getMetadataWithOffset(Blocks.wooden_door, 1));
//Fence Supports
this.fillWithBlocks(world, sbb, 0, 1, 8, 0, 3, 8, Blocks.fence);
this.fillWithBlocks(world, sbb, 10, 1, 8, 10, 3, 8, Blocks.fence);
this.fillWithBlocks(world, sbb, 0, 1, 0, 0, 3, 0, Blocks.fence);
this.fillWithBlocks(world, sbb, 10, 1, 0, 10, 3, 0, Blocks.fence);
//Roof
this.fillWithBlocks(world, sbb, 1, 6, 3, 9, 6, 5, Blocks.planks);
this.fillWithMetadataBlocks(world, sbb, 0, 4, 0, 10, 4, 0, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false);
this.fillWithMetadataBlocks(world, sbb, 0, 5, 1, 10, 5, 1, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false);
this.fillWithMetadataBlocks(world, sbb, 0, 6, 2, 10, 6, 2, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 3), false);
this.fillWithMetadataBlocks(world, sbb, 0, 4, 8, 10, 4, 8, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false);
this.fillWithMetadataBlocks(world, sbb, 0, 5, 7, 10, 5, 7, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false);
this.fillWithMetadataBlocks(world, sbb, 0, 6, 6, 10, 6, 6, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 2), false);
this.fillWithBlocks(world, sbb, 0, 7, 3, 10, 7, 5, Blocks.wooden_slab);
//Roof Gadgets
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 1, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 4, 7, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 0, 5, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 4, 7, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.planks, 0, 10, 5, 6, sbb);
this.fillWithBlocks(world, sbb, 0, 6, 3, 0, 6, 5, Blocks.planks);
this.fillWithBlocks(world, sbb, 10, 6, 3, 10, 6, 5, Blocks.planks);
//Counter
this.fillWithMetadataBlocks(world, sbb, 6, 3, 2, 6, 3, 4, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false);
this.fillWithMetadataBlocks(world, sbb, 5, 3, 4, 5, 3, 6, Blocks.wooden_slab, 8, Blocks.wooden_slab, 8, false);
this.fillWithBlocks(world, sbb, 6, 1, 2, 6, 1, 4, Blocks.planks);
this.fillWithBlocks(world, sbb, 5, 1, 4, 5, 1, 5, Blocks.planks);
this.fillWithBlocks(world, sbb, 6, 4, 2, 6, 5, 2, Blocks.fence);
this.fillWithBlocks(world, sbb, 5, 4, 4, 5, 5, 4, Blocks.fence);
this.fillWithBlocks(world, sbb, 5, 4, 6, 5, 5, 6, Blocks.fence);
//Decoration
this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 8, 1, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 8, 2, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.fence, 0, 2, 1, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.leaves, 0, 2, 2, 6, sbb);
this.fillWithMetadataBlocks(world, sbb, 2, 1, 3, 2, 1, 5, Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), Blocks.oak_stairs, this.getMetadataWithOffset(Blocks.oak_stairs, 1), false);
this.fillWithMetadataBlocks(world, sbb, 3, 1, 2, 5, 1, 3, Blocks.carpet, 10, Blocks.carpet, 10, false);
this.fillWithMetadataBlocks(world, sbb, 3, 1, 4, 4, 1, 6, Blocks.carpet, 10, Blocks.carpet, 10, false);
//Loot Chest
this.placeBlockAtCurrentPosition(world, Blocks.chest, 0, 8, 1, 6, sbb);
int posX = this.getXWithOffset(8, 6);
int posY = this.getYWithOffset(1);
int posZ = this.getZWithOffset(8, 6);
TileEntity chest = world.getTileEntity(posX, posY, posZ);
if(chest != null && chest instanceof TileEntityChest){
WeightedRandomChestContent.generateChestContents(rand, InitVillager.jamHouseChest.getItems(rand), (TileEntityChest)chest, InitVillager.jamHouseChest.getCount(rand));
}
//Torches
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 6, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 4, 2, 0, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 5, 2, 8, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 3, 2, 8, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 2, 3, 6, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 2, sbb);
this.placeBlockAtCurrentPosition(world, Blocks.torch, 0, 8, 3, 6, sbb);
}
public void fillWithBlocks(World world, StructureBoundingBox sbb, int minX, int minY, int minZ, int maxX, int maxY, int maxZ, Block block){
this.fillWithBlocks(world, sbb, minX, minY, minZ, maxX, maxY, maxZ, block, block, false);
}
@Override
protected int getVillagerType(int par1){
return ConfigIntValues.JAM_VILLAGER_ID.getValue();
}
}

View file

@ -0,0 +1,25 @@
package ellpeck.actuallyadditions.gen;
import cpw.mods.fml.common.registry.VillagerRegistry;
import net.minecraft.world.gen.structure.StructureVillagePieces;
import java.util.List;
import java.util.Random;
public class VillageJamHouseHandler implements VillagerRegistry.IVillageCreationHandler{
@Override
public StructureVillagePieces.PieceWeight getVillagePieceWeight(Random random, int i){
return new StructureVillagePieces.PieceWeight(VillageComponentJamHouse.class, 5, 1);
}
@Override
public Class<?> getComponentClass(){
return VillageComponentJamHouse.class;
}
@Override
public Object buildComponent(StructureVillagePieces.PieceWeight villagePiece, StructureVillagePieces.Start startPiece, List pieces, Random random, int p1, int p2, int p3, int p4, int p5){
return VillageComponentJamHouse.buildComponent(pieces, p1, p2, p3, p4);
}
}

View file

@ -0,0 +1,78 @@
package ellpeck.actuallyadditions.inventory;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityBreaker;
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.Slot;
import net.minecraft.item.ItemStack;
@InventoryContainer
public class ContainerBreaker extends Container{
private TileEntityBreaker breaker;
public ContainerBreaker(InventoryPlayer inventory, TileEntityBase tile){
this.breaker = (TileEntityBreaker)tile;
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
this.addSlotToContainer(new Slot(this.breaker, j+i*3, 62+j*18, 21+i*18));
}
}
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.breaker.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 9;
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){
this.mergeItemStack(newStack, 0, 9+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

@ -1,5 +1,6 @@
package ellpeck.actuallyadditions.inventory; package ellpeck.actuallyadditions.inventory;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*; import net.minecraft.inventory.*;
@ -7,6 +8,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World; import net.minecraft.world.World;
@InventoryContainer
public class ContainerCrafter extends Container{ public class ContainerCrafter extends Container{
public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3);

View file

@ -0,0 +1,78 @@
package ellpeck.actuallyadditions.inventory;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityDropper;
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.Slot;
import net.minecraft.item.ItemStack;
@InventoryContainer
public class ContainerDropper extends Container{
private TileEntityDropper dropper;
public ContainerDropper(InventoryPlayer inventory, TileEntityBase tile){
this.dropper = (TileEntityDropper)tile;
for (int i = 0; i < 3; i++){
for (int j = 0; j < 3; j++){
this.addSlotToContainer(new Slot(this.dropper, j+i*3, 62+j*18, 21+i*18));
}
}
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.dropper.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 9;
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){
this.mergeItemStack(newStack, 0, 9+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

@ -4,6 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFeeder; import ellpeck.actuallyadditions.tile.TileEntityFeeder;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -11,6 +12,7 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@InventoryContainer
public class ContainerFeeder extends Container{ public class ContainerFeeder extends Container{
private TileEntityFeeder tileFeeder; private TileEntityFeeder tileFeeder;

View file

@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble; import ellpeck.actuallyadditions.tile.TileEntityFurnaceDouble;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -14,6 +15,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.tileentity.TileEntityFurnace;
@InventoryContainer
public class ContainerFurnaceDouble extends Container{ public class ContainerFurnaceDouble extends Container{
private TileEntityFurnaceDouble tileFurnace; private TileEntityFurnaceDouble tileFurnace;
@ -22,6 +24,7 @@ public class ContainerFurnaceDouble extends Container{
private int lastCoalTimeLeft; private int lastCoalTimeLeft;
private int lastFirstCrushTime; private int lastFirstCrushTime;
private int lastSecondCrushTime; private int lastSecondCrushTime;
private int lastBurnTime;
public ContainerFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){ public ContainerFurnaceDouble(InventoryPlayer inventory, TileEntityBase tile){
this.tileFurnace = (TileEntityFurnaceDouble)tile; this.tileFurnace = (TileEntityFurnaceDouble)tile;
@ -33,6 +36,8 @@ public class ContainerFurnaceDouble extends Container{
this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21)); this.addSlotToContainer(new Slot(this.tileFurnace, TileEntityFurnaceDouble.SLOT_INPUT_2, 109, 21));
this.addSlotToContainer(new SlotOutput(this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69)); this.addSlotToContainer(new SlotOutput(this.tileFurnace, TileEntityFurnaceDouble.SLOT_OUTPUT_2, 108, 69));
this.addSlotToContainer(new Slot(this.tileFurnace, this.tileFurnace.speedUpgradeSlot, 155, 21));
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){ for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
@ -50,6 +55,7 @@ public class ContainerFurnaceDouble extends Container{
iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft); iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft);
iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime); iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime);
iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime); iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime);
iCraft.sendProgressBarUpdate(this, 4, this.tileFurnace.maxBurnTime);
} }
@Override @Override
@ -62,12 +68,14 @@ public class ContainerFurnaceDouble extends Container{
if(this.lastCoalTimeLeft != this.tileFurnace.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft); if(this.lastCoalTimeLeft != this.tileFurnace.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileFurnace.coalTimeLeft);
if(this.lastFirstCrushTime != this.tileFurnace.firstSmeltTime) iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime); if(this.lastFirstCrushTime != this.tileFurnace.firstSmeltTime) iCraft.sendProgressBarUpdate(this, 2, this.tileFurnace.firstSmeltTime);
if(this.lastSecondCrushTime != this.tileFurnace.secondSmeltTime) iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime); if(this.lastSecondCrushTime != this.tileFurnace.secondSmeltTime) iCraft.sendProgressBarUpdate(this, 3, this.tileFurnace.secondSmeltTime);
if(this.lastBurnTime != this.tileFurnace.maxBurnTime) iCraft.sendProgressBarUpdate(this, 4, this.tileFurnace.maxBurnTime);
} }
this.lastCoalTime = this.tileFurnace.coalTime; this.lastCoalTime = this.tileFurnace.coalTime;
this.lastCoalTimeLeft = this.tileFurnace.coalTimeLeft; this.lastCoalTimeLeft = this.tileFurnace.coalTimeLeft;
this.lastFirstCrushTime = this.tileFurnace.firstSmeltTime; this.lastFirstCrushTime = this.tileFurnace.firstSmeltTime;
this.lastSecondCrushTime = this.tileFurnace.secondSmeltTime; this.lastSecondCrushTime = this.tileFurnace.secondSmeltTime;
this.lastBurnTime = this.tileFurnace.maxBurnTime;
} }
@Override @Override
@ -77,6 +85,7 @@ public class ContainerFurnaceDouble extends Container{
if(par1 == 1) this.tileFurnace.coalTimeLeft = par2; if(par1 == 1) this.tileFurnace.coalTimeLeft = par2;
if(par1 == 2) this.tileFurnace.firstSmeltTime = par2; if(par1 == 2) this.tileFurnace.firstSmeltTime = par2;
if(par1 == 3) this.tileFurnace.secondSmeltTime = par2; if(par1 == 3) this.tileFurnace.secondSmeltTime = par2;
if(par1 == 4) this.tileFurnace.maxBurnTime = par2;
} }
@Override @Override
@ -86,7 +95,7 @@ public class ContainerFurnaceDouble extends Container{
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){ public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 5; final int inventoryStart = 6;
final int inventoryEnd = inventoryStart+26; final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1; final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8; final int hotbarEnd = hotbarStart+8;

View file

@ -2,12 +2,14 @@ package ellpeck.actuallyadditions.inventory;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityGiantChest; import ellpeck.actuallyadditions.tile.TileEntityGiantChest;
import invtweaks.api.container.ChestContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ChestContainer(rowSize = 13)
public class ContainerGiantChest extends Container{ public class ContainerGiantChest extends Container{
public TileEntityGiantChest tileChest; public TileEntityGiantChest tileChest;

View file

@ -6,6 +6,7 @@ import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.recipe.GrinderRecipes; import ellpeck.actuallyadditions.recipe.GrinderRecipes;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityGrinder; import ellpeck.actuallyadditions.tile.TileEntityGrinder;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -14,6 +15,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.tileentity.TileEntityFurnace;
@InventoryContainer
public class ContainerGrinder extends Container{ public class ContainerGrinder extends Container{
private TileEntityGrinder tileGrinder; private TileEntityGrinder tileGrinder;
@ -23,6 +25,7 @@ public class ContainerGrinder extends Container{
private int lastCoalTimeLeft; private int lastCoalTimeLeft;
private int lastFirstCrushTime; private int lastFirstCrushTime;
private int lastSecondCrushTime; private int lastSecondCrushTime;
private int lastMaxCrushTime;
public ContainerGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){ public ContainerGrinder(InventoryPlayer inventory, TileEntityBase tile, boolean isDouble){
this.tileGrinder = (TileEntityGrinder)tile; this.tileGrinder = (TileEntityGrinder)tile;
@ -39,6 +42,8 @@ public class ContainerGrinder extends Container{
this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69)); this.addSlotToContainer(new SlotOutput(this.tileGrinder, TileEntityGrinder.SLOT_OUTPUT_2_2, 121, 69));
} }
this.addSlotToContainer(new Slot(this.tileGrinder, this.tileGrinder.speedUpgradeSlot, this.isDouble ? 155 : 146, 21));
for (int i = 0; i < 3; i++){ for (int i = 0; i < 3; i++){
for (int j = 0; j < 9; j++){ for (int j = 0; j < 9; j++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18));
@ -55,7 +60,8 @@ public class ContainerGrinder extends Container{
iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime); iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime);
iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft); iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft);
iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime); iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime);
if(this.isDouble) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.secondCrushTime); iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.maxCrushTime);
if(this.isDouble) iCraft.sendProgressBarUpdate(this, 4, this.tileGrinder.secondCrushTime);
} }
@Override @Override
@ -67,12 +73,14 @@ public class ContainerGrinder extends Container{
if(this.lastCoalTime != this.tileGrinder.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime); if(this.lastCoalTime != this.tileGrinder.coalTime) iCraft.sendProgressBarUpdate(this, 0, this.tileGrinder.coalTime);
if(this.lastCoalTimeLeft != this.tileGrinder.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft); if(this.lastCoalTimeLeft != this.tileGrinder.coalTimeLeft) iCraft.sendProgressBarUpdate(this, 1, this.tileGrinder.coalTimeLeft);
if(this.lastFirstCrushTime != this.tileGrinder.firstCrushTime) iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime); if(this.lastFirstCrushTime != this.tileGrinder.firstCrushTime) iCraft.sendProgressBarUpdate(this, 2, this.tileGrinder.firstCrushTime);
if(this.isDouble) if(this.lastSecondCrushTime != this.tileGrinder.secondCrushTime) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.secondCrushTime); if(this.lastMaxCrushTime != this.tileGrinder.maxCrushTime) iCraft.sendProgressBarUpdate(this, 3, this.tileGrinder.maxCrushTime);
if(this.isDouble) if(this.lastSecondCrushTime != this.tileGrinder.secondCrushTime) iCraft.sendProgressBarUpdate(this, 4, this.tileGrinder.secondCrushTime);
} }
this.lastCoalTime = this.tileGrinder.coalTime; this.lastCoalTime = this.tileGrinder.coalTime;
this.lastCoalTimeLeft = this.tileGrinder.coalTimeLeft; this.lastCoalTimeLeft = this.tileGrinder.coalTimeLeft;
this.lastFirstCrushTime = this.tileGrinder.firstCrushTime; this.lastFirstCrushTime = this.tileGrinder.firstCrushTime;
this.lastMaxCrushTime = this.tileGrinder.maxCrushTime;
if(this.isDouble) this.lastSecondCrushTime = this.tileGrinder.secondCrushTime; if(this.isDouble) this.lastSecondCrushTime = this.tileGrinder.secondCrushTime;
} }
@ -82,7 +90,8 @@ public class ContainerGrinder extends Container{
if(par1 == 0) this.tileGrinder.coalTime = par2; if(par1 == 0) this.tileGrinder.coalTime = par2;
if(par1 == 1) this.tileGrinder.coalTimeLeft = par2; if(par1 == 1) this.tileGrinder.coalTimeLeft = par2;
if(par1 == 2) this.tileGrinder.firstCrushTime = par2; if(par1 == 2) this.tileGrinder.firstCrushTime = par2;
if(this.isDouble && par1 == 3) this.tileGrinder.secondCrushTime = par2; if(par1 == 3) this.tileGrinder.maxCrushTime = par2;
if(this.isDouble && par1 == 4) this.tileGrinder.secondCrushTime = par2;
} }
@Override @Override
@ -92,7 +101,7 @@ public class ContainerGrinder extends Container{
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){ public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = this.isDouble ? 7 : 4; final int inventoryStart = this.isDouble ? 8 : 5;
final int inventoryEnd = inventoryStart+26; final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1; final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8; final int hotbarEnd = hotbarStart+8;

View file

@ -2,8 +2,10 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.slot.SlotFilter;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityInputter; import ellpeck.actuallyadditions.tile.TileEntityInputter;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -11,6 +13,7 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.inventory.Slot; import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@InventoryContainer
public class ContainerInputter extends Container{ public class ContainerInputter extends Container{
private TileEntityInputter tileInputter; private TileEntityInputter tileInputter;
@ -22,18 +25,32 @@ public class ContainerInputter extends Container{
private int lastPlaceToPutSlotAmount; private int lastPlaceToPutSlotAmount;
private int lastPlaceToPullSlotAmount; private int lastPlaceToPullSlotAmount;
public ContainerInputter(InventoryPlayer inventory, TileEntityBase tile){ private boolean isAdvanced;
public ContainerInputter(InventoryPlayer inventory, TileEntityBase tile, boolean isAdvanced){
this.tileInputter = (TileEntityInputter)tile; this.tileInputter = (TileEntityInputter)tile;
this.isAdvanced = isAdvanced;
this.addSlotToContainer(new Slot(this.tileInputter, 0, 80, 21)); this.addSlotToContainer(new Slot(this.tileInputter, 0, 80, 21 + (isAdvanced ? 12 : 0)));
for (int i = 0; i < 3; i++){ if(isAdvanced){
for (int j = 0; j < 9; j++){ for(int i = 0; i < 2; i++){
this.addSlotToContainer(new Slot(inventory, j + i * 9 + 9, 8 + j * 18, 97 + i * 18)); this.addSlotToContainer(new SlotFilter(this.tileInputter, 1+i*6, 20+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 2+i*6, 38+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 3+i*6, 56+i*84, 6));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 4+i*6, 20+i*84, 24));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 5+i*6, 38+i*84, 24));
this.addSlotToContainer(new SlotFilter(this.tileInputter, 6+i*6, 56+i*84, 24));
} }
} }
for (int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155)); 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 + (isAdvanced ? 12 : 0)));
}
}
for(int i = 0; i < 9; i++){
this.addSlotToContainer(new Slot(inventory, i, 8 + i * 18, 155 + (isAdvanced ? 12 : 0)));
} }
} }
@ -87,7 +104,7 @@ public class ContainerInputter extends Container{
@Override @Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot){ public ItemStack transferStackInSlot(EntityPlayer player, int slot){
final int inventoryStart = 1; final int inventoryStart = this.isAdvanced ? 13 : 1;
final int inventoryEnd = inventoryStart+26; final int inventoryEnd = inventoryStart+26;
final int hotbarStart = inventoryEnd+1; final int hotbarStart = inventoryEnd+1;
final int hotbarEnd = hotbarStart+8; final int hotbarEnd = hotbarStart+8;

View file

@ -5,6 +5,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.inventory.slot.SlotOutput; import ellpeck.actuallyadditions.inventory.slot.SlotOutput;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityItemRepairer; import ellpeck.actuallyadditions.tile.TileEntityItemRepairer;
import invtweaks.api.container.InventoryContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@ -13,6 +14,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.tileentity.TileEntityFurnace;
@InventoryContainer
public class ContainerRepairer extends Container{ public class ContainerRepairer extends Container{
private TileEntityItemRepairer tileRepairer; private TileEntityItemRepairer tileRepairer;

View file

@ -0,0 +1,47 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityBreaker;
import ellpeck.actuallyadditions.util.AssetUtil;
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 GuiBreaker extends GuiContainer{
private TileEntityBreaker breaker;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
public GuiBreaker(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerBreaker(inventory, tile));
this.breaker = (TileEntityBreaker)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.breaker.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);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
}
}

View file

@ -2,6 +2,8 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.AssetUtil;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@ -19,6 +21,11 @@ public class GuiCrafter extends GuiContainer{
this.ySize = 166; this.ySize = 166;
} }
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 74, -10, "container." + ModUtil.MOD_ID_LOWER + ".crafting");
}
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -0,0 +1,47 @@
package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityDropper;
import ellpeck.actuallyadditions.util.AssetUtil;
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 GuiDropper extends GuiContainer{
private TileEntityDropper dropper;
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiBreaker");
public GuiDropper(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerDropper(inventory, tile));
this.dropper = (TileEntityDropper)tile;
this.xSize = 176;
this.ySize = 93+86;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.dropper.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);
}
@Override
public void drawScreen(int x, int y, float f){
super.drawScreen(x, y, f);
}
}

View file

@ -29,6 +29,11 @@ public class GuiFeeder extends GuiContainer{
this.ySize = 70+86; this.ySize = 70+86;
} }
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 70-5, -10, this.tileFeeder.getInventoryName());
}
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -23,6 +23,11 @@ public class GuiFurnaceDouble extends GuiContainer{
this.ySize = 93+86; this.ySize = 93+86;
} }
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileFurnace.getInventoryName());
}
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -3,6 +3,7 @@ package ellpeck.actuallyadditions.inventory;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.tile.TileEntityBase; import ellpeck.actuallyadditions.tile.TileEntityBase;
import ellpeck.actuallyadditions.tile.TileEntityGiantChest;
import ellpeck.actuallyadditions.util.AssetUtil; import ellpeck.actuallyadditions.util.AssetUtil;
import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
@ -14,13 +15,21 @@ public class GuiGiantChest extends GuiContainer{
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGiantChest"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiGiantChest");
TileEntityGiantChest chest;
public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile){ public GuiGiantChest(InventoryPlayer inventory, TileEntityBase tile){
super(new ContainerGiantChest(inventory, tile)); super(new ContainerGiantChest(inventory, tile));
this.chest = (TileEntityGiantChest)tile;
this.xSize = 242; this.xSize = 242;
this.ySize = 172+86; this.ySize = 172+86;
} }
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 172-5, -10, this.chest.getInventoryName());
}
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -26,6 +26,11 @@ public class GuiGrinder extends GuiContainer{
this.ySize = 93+86; this.ySize = 93+86;
} }
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileGrinder.getInventoryName());
}
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -33,10 +33,19 @@ public class GuiHandler implements IGuiHandler{
return new ContainerFurnaceDouble(entityPlayer.inventory, tileFurnace); return new ContainerFurnaceDouble(entityPlayer.inventory, tileFurnace);
case INPUTTER_ID: case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerInputter(entityPlayer.inventory, tileInputter); return new ContainerInputter(entityPlayer.inventory, tileInputter, false);
case INPUTTER_ADVANCED_ID:
TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerInputter(entityPlayer.inventory, tileInputterAdvanced, true);
case REPAIRER_ID: case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerRepairer(entityPlayer.inventory, tileRepairer); return new ContainerRepairer(entityPlayer.inventory, tileRepairer);
case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerBreaker(entityPlayer.inventory, tileBreaker);
case DROPPER_ID:
TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerDropper(entityPlayer.inventory, tileDropper);
default: default:
return null; return null;
} }
@ -64,10 +73,19 @@ public class GuiHandler implements IGuiHandler{
return new GuiFurnaceDouble(entityPlayer.inventory, tileFurnace); return new GuiFurnaceDouble(entityPlayer.inventory, tileFurnace);
case INPUTTER_ID: case INPUTTER_ID:
TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileInputter = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world); return new GuiInputter(entityPlayer.inventory, tileInputter, x, y, z, world, false);
case INPUTTER_ADVANCED_ID:
TileEntityBase tileInputterAdvanced = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiInputter(entityPlayer.inventory, tileInputterAdvanced, x, y, z, world, true);
case REPAIRER_ID: case REPAIRER_ID:
TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileRepairer = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiRepairer(entityPlayer.inventory, tileRepairer); return new GuiRepairer(entityPlayer.inventory, tileRepairer);
case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiBreaker(entityPlayer.inventory, tileBreaker);
case DROPPER_ID:
TileEntityBase tileDropper = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiDropper(entityPlayer.inventory, tileDropper);
default: default:
return null; return null;
} }
@ -81,6 +99,9 @@ public class GuiHandler implements IGuiHandler{
public static final int FURNACE_DOUBLE_ID = 5; public static final int FURNACE_DOUBLE_ID = 5;
public static final int INPUTTER_ID = 6; public static final int INPUTTER_ID = 6;
public static final int REPAIRER_ID = 7; public static final int REPAIRER_ID = 7;
public static final int INPUTTER_ADVANCED_ID = 8;
public static final int BREAKER_ID = 9;
public static final int DROPPER_ID = 10;
public static void init(){ public static void init(){
Util.logInfo("Initializing GuiHandler..."); Util.logInfo("Initializing GuiHandler...");

View file

@ -23,6 +23,8 @@ import org.lwjgl.opengl.GL11;
public class GuiInputter extends GuiContainer{ public class GuiInputter extends GuiContainer{
private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter"); private static final ResourceLocation resLoc = AssetUtil.getGuiLocation("guiInputter");
private static final ResourceLocation resLocAdvanced = AssetUtil.getGuiLocation("guiInputterAdvanced");
private TileEntityInputter tileInputter; private TileEntityInputter tileInputter;
private int x; private int x;
@ -35,6 +37,8 @@ public class GuiInputter extends GuiContainer{
private SmallerButton buttonSlotPutM; private SmallerButton buttonSlotPutM;
private SmallerButton buttonSlotPullM; private SmallerButton buttonSlotPullM;
private boolean isAdvanced;
public static final String[] sideString = new String[]{ public static final String[] sideString = new String[]{
StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.disabled"), StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.disabled"),
StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.up"), StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.up"),
@ -44,15 +48,21 @@ public class GuiInputter extends GuiContainer{
StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.south"), StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.south"),
StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.west")}; StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.west")};
public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world){ public GuiInputter(InventoryPlayer inventory, TileEntityBase tile, int x, int y, int z, World world, boolean isAdvanced){
super(new ContainerInputter(inventory, tile)); super(new ContainerInputter(inventory, tile, isAdvanced));
this.tileInputter = (TileEntityInputter)tile; this.tileInputter = (TileEntityInputter)tile;
this.x = x; this.x = x;
this.y = y; this.y = y;
this.z = z; this.z = z;
this.world = world; this.world = world;
this.xSize = 176; this.xSize = 176;
this.ySize = 93+86; this.ySize = 93+86 + (isAdvanced ? 12 : 0);
this.isAdvanced = isAdvanced;
}
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, this.isAdvanced ? 105-5 : 93-5, -10, this.tileInputter.getInventoryName());
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -60,15 +70,15 @@ public class GuiInputter extends GuiContainer{
public void initGui(){ public void initGui(){
super.initGui(); super.initGui();
SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 70, guiTop + 43, ">"); SmallerButton buttonSidePutP = new SmallerButton(0, guiLeft + 70, guiTop + 43 + (isAdvanced ? 12 : 0), ">");
SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 5, guiTop + 43, "<"); SmallerButton buttonSidePutM = new SmallerButton(1, guiLeft + 5, guiTop + 43 + (isAdvanced ? 12 : 0), "<");
buttonSlotPutP = new SmallerButton(2, guiLeft + 70, guiTop + 64, "+"); buttonSlotPutP = new SmallerButton(2, guiLeft + 70, guiTop + 64 + (isAdvanced ? 12 : 0), "+");
buttonSlotPutM = new SmallerButton(3, guiLeft + 5, guiTop + 64, "-"); buttonSlotPutM = new SmallerButton(3, guiLeft + 5, guiTop + 64 + (isAdvanced ? 12 : 0), "-");
SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 155, guiTop + 43, ">"); SmallerButton buttonSidePullP = new SmallerButton(4, guiLeft + 155, guiTop + 43 + (isAdvanced ? 12 : 0), ">");
SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 90, guiTop + 43, "<"); SmallerButton buttonSidePullM = new SmallerButton(5, guiLeft + 90, guiTop + 43 + (isAdvanced ? 12 : 0), "<");
buttonSlotPullP = new SmallerButton(6, guiLeft+ 155, guiTop + 64, "+"); buttonSlotPullP = new SmallerButton(6, guiLeft+ 155, guiTop + 64 + (isAdvanced ? 12 : 0), "+");
buttonSlotPullM = new SmallerButton(7, guiLeft + 90, guiTop + 64, "-"); buttonSlotPullM = new SmallerButton(7, guiLeft + 90, guiTop + 64 + (isAdvanced ? 12 : 0), "-");
this.buttonList.add(buttonSidePutP); this.buttonList.add(buttonSidePutP);
this.buttonList.add(buttonSlotPutP); this.buttonList.add(buttonSlotPutP);
@ -85,19 +95,19 @@ public class GuiInputter extends GuiContainer{
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION); this.mc.getTextureManager().bindTexture(AssetUtil.GUI_INVENTORY_LOCATION);
this.drawTexturedModalRect(this.guiLeft, this.guiTop+93, 0, 0, 176, 86); this.drawTexturedModalRect(this.guiLeft, this.guiTop+93 + (isAdvanced ? 12 : 0), 0, 0, 176, 86);
this.mc.getTextureManager().bindTexture(resLoc); this.mc.getTextureManager().bindTexture(this.isAdvanced ? resLocAdvanced : resLoc);
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 176, 93 + (isAdvanced ? 12 : 0));
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 22 + 3, guiTop + 32, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.put"), guiLeft + 22 + 3, guiTop + 32 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 107 + 3, guiTop + 32, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.pull"), guiLeft + 107 + 3, guiTop + 32 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 24 + 1, guiTop + 45 + 3, 4210752); this.fontRendererObj.drawString(sideString[tileInputter.sideToPut+1], guiLeft + 24 + 1, guiTop + 45 + 3 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 24 + 3, guiTop + 66 + 3, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPut == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPut).toString(), guiLeft + 24 + 3, guiTop + 66 + 3 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 109 + 1, guiTop + 45 + 3, 4210752); this.fontRendererObj.drawString(sideString[tileInputter.sideToPull+1], guiLeft + 109 + 1, guiTop + 45 + 3 + (isAdvanced ? 12 : 0), 4210752);
this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 109 + 3, guiTop + 66 + 3, 4210752); this.fontRendererObj.drawString(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.slot") + " " + (tileInputter.slotToPull == -1 ? StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".gui.all") : tileInputter.slotToPull).toString(), guiLeft + 109 + 3, guiTop + 66 + 3 + (isAdvanced ? 12 : 0), 4210752);
} }
@Override @Override

View file

@ -23,6 +23,11 @@ public class GuiRepairer extends GuiContainer{
this.ySize = 93+86; this.ySize = 93+86;
} }
@Override
public void drawGuiContainerForegroundLayer(int x, int y){
AssetUtil.displayNameAndInventoryString(this.fontRendererObj, xSize, 93-5, -10, this.tileRepairer.getInventoryName());
}
@Override @Override
public void drawGuiContainerBackgroundLayer(float f, int x, int y){ public void drawGuiContainerBackgroundLayer(float f, int x, int y){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -0,0 +1,16 @@
package ellpeck.actuallyadditions.inventory.slot;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
public class SlotFilter extends Slot{
public SlotFilter(IInventory inventory, int id, int x, int y){
super(inventory, id, x, y);
}
@Override
public int getSlotStackLimit(){
return 1;
}
}

View file

@ -15,6 +15,7 @@ public class InitItems{
public static Item itemFertilizer; public static Item itemFertilizer;
public static Item itemMisc; public static Item itemMisc;
public static Item itemFoods; public static Item itemFoods;
public static Item itemJams;
public static Item itemKnife; public static Item itemKnife;
public static Item itemCrafterOnAStick; public static Item itemCrafterOnAStick;
public static Item itemDust; public static Item itemDust;
@ -37,6 +38,8 @@ public class InitItems{
public static Item itemSwordObsidian; public static Item itemSwordObsidian;
public static Item itemHoeObsidian; public static Item itemHoeObsidian;
public static Item itemSpeedUpgrade;
public static void init(){ public static void init(){
Util.logInfo("Initializing Items..."); Util.logInfo("Initializing Items...");
@ -44,10 +47,13 @@ public class InitItems{
ItemUtil.register(itemFertilizer); ItemUtil.register(itemFertilizer);
itemMisc = new ItemMisc(); itemMisc = new ItemMisc();
ItemUtil.register(itemMisc); ItemUtil.register(itemMisc, ItemMisc.allMiscItems);
itemFoods = new ItemFoods(); itemFoods = new ItemFoods();
ItemUtil.register(itemFoods); ItemUtil.register(itemFoods, ItemFoods.allFoods);
itemJams = new ItemJams();
ItemUtil.register(itemJams, ItemJams.allJams);
itemKnife = new ItemKnife(); itemKnife = new ItemKnife();
ItemUtil.register(itemKnife); ItemUtil.register(itemKnife);
@ -56,10 +62,10 @@ public class InitItems{
ItemUtil.register(itemCrafterOnAStick); ItemUtil.register(itemCrafterOnAStick);
itemDust = new ItemDust(); itemDust = new ItemDust();
ItemUtil.register(itemDust); ItemUtil.register(itemDust, ItemDust.allDusts);
itemSpecialDrop = new ItemSpecialDrop(); itemSpecialDrop = new ItemSpecialDrop();
ItemUtil.register(itemSpecialDrop); ItemUtil.register(itemSpecialDrop, ItemSpecialDrop.allDrops);
itemLeafBlower = new ItemLeafBlower(false); itemLeafBlower = new ItemLeafBlower(false);
ItemUtil.register(itemLeafBlower); ItemUtil.register(itemLeafBlower);
@ -73,6 +79,9 @@ public class InitItems{
itemPotionRingAdvanced = new ItemPotionRing(true); itemPotionRingAdvanced = new ItemPotionRing(true);
ItemUtil.register(itemPotionRingAdvanced); ItemUtil.register(itemPotionRingAdvanced);
itemSpeedUpgrade = new ItemUpgrade(ItemUpgrade.UpgradeType.SPEED, "itemUpgradeSpeed", 2+3);
ItemUtil.register(itemSpeedUpgrade);
itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare); itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", EnumRarity.rare);
itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare); itemAxeEmerald = new ItemAxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemAxeEmerald", EnumRarity.rare);
itemShovelEmerald = new ItemShovelAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemShovelEmerald", EnumRarity.rare); itemShovelEmerald = new ItemShovelAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemShovelEmerald", EnumRarity.rare);

View file

@ -4,7 +4,7 @@ import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.ActuallyAdditions; import ellpeck.actuallyadditions.ActuallyAdditions;
import ellpeck.actuallyadditions.inventory.GuiHandler; import ellpeck.actuallyadditions.inventory.GuiHandler;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -17,7 +17,7 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class ItemCrafterOnAStick extends Item implements IName{ public class ItemCrafterOnAStick extends Item implements INameableItem{
public ItemCrafterOnAStick(){ public ItemCrafterOnAStick(){
this.setMaxStackSize(1); this.setMaxStackSize(1);
@ -27,7 +27,7 @@ public class ItemCrafterOnAStick extends Item implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
list.add(ItemUtil.addStandardInformation(this)); ItemUtil.addInformation(this, list, 1, "");
} }
@Override @Override
@ -56,4 +56,9 @@ public class ItemCrafterOnAStick extends Item implements IName{
public String getName(){ public String getName(){
return "itemCrafterOnAStick"; return "itemCrafterOnAStick";
} }
@Override
public String getOredictName(){
return this.getName();
}
} }

View file

@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.items.metalists.TheDusts; import ellpeck.actuallyadditions.items.metalists.TheDusts;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -14,11 +13,10 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemDust extends Item implements IName{ public class ItemDust extends Item implements INameableItem{
public static final TheDusts[] allDusts = TheDusts.values(); public static final TheDusts[] allDusts = TheDusts.values();
@ -31,6 +29,11 @@ public class ItemDust extends Item implements IName{
return "itemDust"; return "itemDust";
} }
@Override
public String getOredictName(){
return "";
}
@Override @Override
public int getMetadata(int damage){ public int getMetadata(int damage){
return damage; return damage;
@ -58,8 +61,7 @@ public class ItemDust extends Item implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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){
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allDusts[stack.getItemDamage()].getName() + ".desc")); ItemUtil.addInformation(this, list, 1, allDusts[stack.getItemDamage()].getName());
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -16,7 +16,7 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class ItemFertilizer extends Item implements IName{ public class ItemFertilizer extends Item implements INameableItem{
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){ public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10){
@ -36,7 +36,7 @@ public class ItemFertilizer extends Item implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
list.add(ItemUtil.addStandardInformation(this)); ItemUtil.addInformation(this, list, 1, "");
} }
@Override @Override
@ -54,4 +54,9 @@ public class ItemFertilizer extends Item implements IName{
public String getName(){ public String getName(){
return "itemFertilizer"; return "itemFertilizer";
} }
@Override
public String getOredictName(){
return this.getName();
}
} }

View file

@ -3,7 +3,7 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.items.metalists.TheFoods; import ellpeck.actuallyadditions.items.metalists.TheFoods;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -18,7 +18,7 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class ItemFoods extends ItemFood implements IName{ public class ItemFoods extends ItemFood implements INameableItem{
public static final TheFoods[] allFoods = TheFoods.values(); public static final TheFoods[] allFoods = TheFoods.values();
public IIcon[] textures = new IIcon[allFoods.length]; public IIcon[] textures = new IIcon[allFoods.length];
@ -30,6 +30,11 @@ public class ItemFoods extends ItemFood implements IName{
TheFoods.setReturnItems(); TheFoods.setReturnItems();
} }
@Override
public String getOredictName(){
return "";
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return allFoods[stack.getItemDamage()].rarity; return allFoods[stack.getItemDamage()].rarity;

View file

@ -0,0 +1,138 @@
package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.items.metalists.TheJams;
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.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import java.util.List;
public class ItemJams extends ItemFood implements INameableItem{
public static final TheJams[] allJams = TheJams.values();
public IIcon overlayIcon;
public ItemJams(){
super(0, 0.0F, false);
this.setHasSubtypes(true);
this.setMaxDamage(0);
}
@Override
public String getOredictName(){
return "";
}
@Override
public EnumRarity getRarity(ItemStack stack){
return allJams[stack.getItemDamage()].rarity;
}
@Override
public int func_150905_g(ItemStack stack){
return allJams[stack.getItemDamage()].healAmount;
}
@Override
public float func_150906_h(ItemStack stack){
return allJams[stack.getItemDamage()].saturation;
}
@Override
public int getMetadata(int damage){
return damage;
}
@SuppressWarnings("all")
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list){
for (int j = 0; j < allJams.length; j++){
list.add(new ItemStack(this, 1, j));
}
}
@Override
public String getUnlocalizedName(ItemStack stack){
return this.getUnlocalizedName() + allJams[stack.getItemDamage()].getName();
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass){
return pass > 0 ? allJams[stack.getItemDamage()].color : super.getColorFromItemStack(stack, pass);
}
@Override
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player){
ItemStack stackToReturn = super.onEaten(stack, world, player);
if(!world.isRemote){
PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200);
player.addPotionEffect(firstEffectToGet);
PotionEffect secondEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].secondEffectToGet, 600);
player.addPotionEffect(secondEffectToGet);
ItemStack returnItem = new ItemStack(Items.glass_bottle);
if(!player.inventory.addItemStackToInventory(returnItem.copy())){
EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy());
entityItem.delayBeforeCanPickup = 0;
player.worldObj.spawnEntityInWorld(entityItem);
}
}
return stackToReturn;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld){
if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.1"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allJams[stack.getItemDamage()].getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.2"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".hunger.desc") + ": " + allJams[stack.getItemDamage()].healAmount);
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allJams[stack.getItemDamage()].saturation);
}
else list.add(ItemUtil.shiftForInfo());
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIconFromDamageForRenderPass(int damage, int pass){
return pass > 0 ? this.overlayIcon : super.getIconFromDamageForRenderPass(damage, pass);
}
@Override
public boolean requiresMultipleRenderPasses(){
return true;
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister iconReg){
this.itemIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName());
this.overlayIcon = iconReg.registerIcon(ModUtil.MOD_ID_LOWER + ":" + this.getName() + "Overlay");
}
@Override
public String getName(){
return "itemJam";
}
}

View file

@ -2,8 +2,8 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -17,10 +17,10 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemKnife extends Item implements IName{ public class ItemKnife extends Item implements INameableItem{
public ItemKnife(){ public ItemKnife(){
this.setMaxDamage(ConfigValues.knifeMaxDamage); this.setMaxDamage(ConfigIntValues.KNIFE_DAMAGE.getValue());
this.setMaxStackSize(1); this.setMaxStackSize(1);
this.setContainerItem(this); this.setContainerItem(this);
} }
@ -38,6 +38,11 @@ public class ItemKnife extends Item implements IName{
return false; return false;
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return EnumRarity.epic; return EnumRarity.epic;

View file

@ -2,7 +2,8 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.*; import ellpeck.actuallyadditions.util.*;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockBush; import net.minecraft.block.BlockBush;
@ -21,15 +22,14 @@ import net.minecraft.world.World;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random;
public class ItemLeafBlower extends Item implements IName{ public class ItemLeafBlower extends Item implements INameableItem{
public final int range = ConfigValues.leafBlowerRangeSides; public final int range = ConfigIntValues.LEAF_BLOWER_RANGE_SIDES.getValue();
public final int rangeUp = ConfigValues.leafBlowerRangeUp; public final int rangeUp = ConfigIntValues.LEAF_BLOWER_RANGE_UP.getValue();
public final boolean doesDrop = ConfigValues.leafBlowerDropItems; public final boolean doesDrop = ConfigBoolValues.LEAF_BLOWER_ITEMS.isEnabled();
public final boolean hasParticles = ConfigValues.leafBlowerParticles; public final boolean hasParticles = ConfigBoolValues.LEAF_BLOWER_PARTICLES.isEnabled();
public final boolean hasSound = ConfigValues.leafBlowerHasSound; public final boolean hasSound = ConfigBoolValues.LEAF_BLOWER_SOUND.isEnabled();
private final boolean isAdvanced; private final boolean isAdvanced;
@ -48,46 +48,46 @@ public class ItemLeafBlower extends Item implements IName{
} }
} }
public void breakStuff(World world, int x, int y, int z){ @Override
ArrayList<ChunkCoordinates> theCoords = new ArrayList<ChunkCoordinates>(); public String getOredictName(){
return this.getName();
}
public void breakStuff(World world, int x, int y, int z){
for(int reachX = -range; reachX < range+1; reachX++){ for(int reachX = -range; reachX < range+1; reachX++){
for(int reachZ = -range; reachZ < range+1; reachZ++){ for(int reachZ = -range; reachZ < range+1; reachZ++){
for(int reachY = (this.isAdvanced ? -range : -rangeUp); reachY < (this.isAdvanced ? range+1 : rangeUp+1); reachY++){ for(int reachY = (this.isAdvanced ? -range : -rangeUp); reachY < (this.isAdvanced ? range+1 : rangeUp+1); reachY++){
Block block = world.getBlock(x+reachX, y+reachY, z+reachZ); Block block = world.getBlock(x+reachX, y+reachY, z+reachZ);
if(block != null && (block instanceof BlockBush || (this.isAdvanced && block instanceof BlockLeavesBase))){ if(block != null && (block instanceof BlockBush || (this.isAdvanced && block instanceof BlockLeavesBase))){
theCoords.add(new ChunkCoordinates(x+reachX, y+reachY, z+reachZ)); ChunkCoordinates theCoord = new ChunkCoordinates(x+reachX, y+reachY, z+reachZ);
Block theBlock = world.getBlock(theCoord.posX, theCoord.posY, theCoord.posZ);
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
int meta = world.getBlockMetadata(theCoord.posX, theCoord.posY, theCoord.posZ);
drops.addAll(theBlock.getDrops(world, theCoord.posX, theCoord.posY, theCoord.posZ, meta, 0));
world.setBlockToAir(theCoord.posX, theCoord.posY, theCoord.posZ);
if(this.hasParticles) world.playAuxSFX(2001, theCoord.posX, theCoord.posY, theCoord.posZ, Block.getIdFromBlock(theBlock)+(meta << 12));
if(this.doesDrop){
for(ItemStack theDrop : drops){
world.spawnEntityInWorld(new EntityItem(world, theCoord.posX + 0.5, theCoord.posY + 0.5, theCoord.posZ + 0.5, theDrop));
}
}
return;
} }
} }
} }
} }
if(theCoords.size() > 0){
ChunkCoordinates theCoord = theCoords.get(new Random().nextInt(theCoords.size()));
Block theBlock = world.getBlock(theCoord.posX, theCoord.posY, theCoord.posZ);
ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
int meta = world.getBlockMetadata(theCoord.posX, theCoord.posY, theCoord.posZ);
drops.addAll(theBlock.getDrops(world, theCoord.posX, theCoord.posY, theCoord.posZ, meta, 0));
world.setBlockToAir(theCoord.posX, theCoord.posY, theCoord.posZ);
if(this.hasParticles) world.playAuxSFX(2001, theCoord.posX, theCoord.posY, theCoord.posZ, Block.getIdFromBlock(theBlock)+(meta << 12));
if(this.doesDrop){
for(ItemStack theDrop : drops){
world.spawnEntityInWorld(new EntityItem(world, theCoord.posX + 0.5, theCoord.posY + 0.5, theCoord.posZ + 0.5, theDrop));
}
}
}
} }
@Override @Override
public int getMaxItemUseDuration(ItemStack stack){ public int getMaxItemUseDuration(ItemStack stack){
return 100000; return 1000000;
} }
@Override @Override
public EnumAction getItemUseAction(ItemStack stack){ public EnumAction getItemUseAction(ItemStack stack){
return EnumAction.none; return EnumAction.bow;
} }
@Override @Override

View file

@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.items.metalists.TheMiscItems; import ellpeck.actuallyadditions.items.metalists.TheMiscItems;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -14,11 +13,10 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemMisc extends Item implements IName{ public class ItemMisc extends Item implements INameableItem{
public static final TheMiscItems[] allMiscItems = TheMiscItems.values(); public static final TheMiscItems[] allMiscItems = TheMiscItems.values();
public IIcon[] textures = new IIcon[allMiscItems.length]; public IIcon[] textures = new IIcon[allMiscItems.length];
@ -32,6 +30,11 @@ public class ItemMisc extends Item implements IName{
return "itemMisc"; return "itemMisc";
} }
@Override
public String getOredictName(){
return "";
}
@Override @Override
public EnumRarity getRarity(ItemStack stack){ public EnumRarity getRarity(ItemStack stack){
return allMiscItems[stack.getItemDamage()].rarity; return allMiscItems[stack.getItemDamage()].rarity;
@ -59,8 +62,7 @@ public class ItemMisc extends Item implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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){
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allMiscItems[stack.getItemDamage()].getName() + ".desc")); ItemUtil.addInformation(this, list, 1, allMiscItems[stack.getItemDamage()].getName());
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -18,7 +18,7 @@ import net.minecraft.world.World;
import java.util.List; import java.util.List;
public class ItemPotionRing extends Item implements IName{ public class ItemPotionRing extends Item implements INameableItem{
public static final ThePotionRings[] allRings = ThePotionRings.values(); public static final ThePotionRings[] allRings = ThePotionRings.values();
@ -30,23 +30,31 @@ public class ItemPotionRing extends Item implements IName{
this.isAdvanced = isAdvanced; this.isAdvanced = isAdvanced;
} }
@Override
public String getOredictName(){
return this.getName();
}
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){ public void onUpdate(ItemStack stack, World world, Entity player, int par4, boolean par5){
super.onUpdate(stack, world, player, par4, par5); super.onUpdate(stack, world, player, par4, par5);
if(player instanceof EntityPlayer){ if(!world.isRemote){
EntityPlayer thePlayer = (EntityPlayer)player; if(player instanceof EntityPlayer){
ItemStack equippedStack = ((EntityPlayer)player).getCurrentEquippedItem(); EntityPlayer thePlayer = (EntityPlayer)player;
ItemStack equippedStack = ((EntityPlayer)player).getCurrentEquippedItem();
ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()]; ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()];
if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(effect.effectID)){ if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(effect.effectID)){
if(!((ItemPotionRing)stack.getItem()).isAdvanced){ if(!((ItemPotionRing)stack.getItem()).isAdvanced){
if(equippedStack != null && stack.isItemEqual(equippedStack)){ if(equippedStack != null && stack.isItemEqual(equippedStack)){
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.normalAmplifier, true)); thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.normalAmplifier, true));
}
} }
else
thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true));
} }
else thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true));
} }
} }
} }
@ -83,15 +91,14 @@ public class ItemPotionRing extends Item implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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, 2, "");
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.1"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc.2"));
if(stack.getItemDamage() == ThePotionRings.SATURATION.ordinal()){ if(stack.getItemDamage() == ThePotionRings.SATURATION.ordinal()){
list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.1")); list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.1"));
list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.2")); list.add(StringUtil.RED + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemPotionRing.desc.off.2"));
} }
} }
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -3,9 +3,8 @@ package ellpeck.actuallyadditions.items;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
@ -15,13 +14,12 @@ import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
public class ItemSpecialDrop extends Item implements IName{ public class ItemSpecialDrop extends Item implements INameableItem{
public static final TheSpecialDrops[] allDrops = TheSpecialDrops.values(); public static final TheSpecialDrops[] allDrops = TheSpecialDrops.values();
public IIcon[] textures = new IIcon[allDrops.length]; public IIcon[] textures = new IIcon[allDrops.length];
@ -51,6 +49,11 @@ public class ItemSpecialDrop extends Item implements IName{
return allDrops[stack.getItemDamage()].rarity; return allDrops[stack.getItemDamage()].rarity;
} }
@Override
public String getOredictName(){
return "";
}
@Override @Override
public int getMetadata(int damage){ public int getMetadata(int damage){
return damage; return damage;
@ -73,8 +76,7 @@ public class ItemSpecialDrop extends Item implements IName{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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){
if(KeyUtil.isShiftPressed()) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + allDrops[stack.getItemDamage()].getName() + ".desc")); ItemUtil.addInformation(this, list, 1, allDrops[stack.getItemDamage()].getName());
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override

View file

@ -0,0 +1,65 @@
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.ModUtil;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import java.util.List;
public class ItemUpgrade extends Item implements INameableItem{
private final String name;
public UpgradeType type;
private int textAmount;
public ItemUpgrade(UpgradeType type, String name, int textAmount){
this.name = name;
this.type = type;
this.textAmount = textAmount;
}
@Override
public EnumRarity getRarity(ItemStack stack){
return EnumRarity.rare;
}
@Override
@SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) {
ItemUtil.addInformation(this, list, this.textAmount, "");
}
@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());
}
@Override
public String getName(){
return this.name;
}
@Override
public String getOredictName(){
return this.getName();
}
public enum UpgradeType{
SPEED
}
}

View file

@ -1,32 +1,39 @@
package ellpeck.actuallyadditions.items.metalists; package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.StringUtil; import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
public enum TheDusts implements IName{ public enum TheDusts implements INameableItem{
IRON("Iron", 7826534, EnumRarity.common), IRON("Iron", 7826534, EnumRarity.common, "dustIron"),
GOLD("Gold", 14335744, EnumRarity.uncommon), GOLD("Gold", 14335744, EnumRarity.uncommon, "dustGold"),
DIAMOND("Diamond", 292003, EnumRarity.rare), DIAMOND("Diamond", 292003, EnumRarity.rare, "dustDiamond"),
EMERALD("Emerald", 4319527, EnumRarity.epic), EMERALD("Emerald", 4319527, EnumRarity.epic, "dustEmerald"),
LAPIS("Lapis", 1849791, EnumRarity.uncommon), LAPIS("Lapis", 1849791, EnumRarity.uncommon, "dustLapis"),
QUARTZ("Quartz", StringUtil.DECIMAL_COLOR_WHITE, EnumRarity.uncommon), QUARTZ("Quartz", StringUtil.DECIMAL_COLOR_WHITE, EnumRarity.uncommon, "dustQuartz"),
COAL("Coal", 0, EnumRarity.uncommon), COAL("Coal", 0, EnumRarity.uncommon, "dustCoal"),
QUARTZ_BLACK("QuartzBlack", 18, EnumRarity.rare); QUARTZ_BLACK("QuartzBlack", 18, EnumRarity.rare, "dustQuartzBlack");
public final String name; public final String name;
public final String oredictName;
public final int color; public final int color;
public final EnumRarity rarity; public final EnumRarity rarity;
TheDusts(String name, int color, EnumRarity rarity){ TheDusts(String name, int color, EnumRarity rarity, String oredictName){
this.name = name; this.name = name;
this.color = color; this.color = color;
this.rarity = rarity; this.rarity = rarity;
this.oredictName = oredictName;
} }
@Override @Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }
@Override
public String getOredictName(){
return this.oredictName;
}
} }

View file

@ -1,29 +1,29 @@
package ellpeck.actuallyadditions.items.metalists; package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.items.InitItems; import ellpeck.actuallyadditions.items.InitItems;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public enum TheFoods implements IName{ public enum TheFoods implements INameableItem{
CHEESE("Cheese", 1, 0.5F, false, 3, EnumRarity.common), CHEESE("Cheese", 1, 0.5F, false, 3, EnumRarity.common, "foodCheese"),
PUMPKIN_STEW("PumpkinStew", 10, 1F, true, 30, EnumRarity.common), PUMPKIN_STEW("PumpkinStew", 10, 1F, true, 30, EnumRarity.common, "foodPumpkinStew"),
CARROT_JUICE("CarrotJuice", 6, 0.6F, true, 20, EnumRarity.common), CARROT_JUICE("CarrotJuice", 6, 0.6F, true, 20, EnumRarity.common, "foodCarrotJuice"),
FISH_N_CHIPS("FishNChips", 20, 5F, false, 40, EnumRarity.uncommon), FISH_N_CHIPS("FishNChips", 20, 5F, false, 40, EnumRarity.uncommon, "foodFishNChips"),
FRENCH_FRIES("FrenchFries", 16, 4F, false, 32, EnumRarity.common), FRENCH_FRIES("FrenchFries", 16, 4F, false, 32, EnumRarity.common, "foodFrenchFries"),
FRENCH_FRY("FrenchFry", 3, 0.5F, false, 3, EnumRarity.common), FRENCH_FRY("FrenchFry", 3, 0.5F, false, 3, EnumRarity.common, "foodFrenchFry"),
SPAGHETTI("Spaghetti", 18, 3F, false, 38, EnumRarity.common), SPAGHETTI("Spaghetti", 18, 3F, false, 38, EnumRarity.common, "foodSpaghetti"),
NOODLE("Noodle", 1, 0.5F, false, 3, EnumRarity.common), NOODLE("Noodle", 1, 0.5F, false, 3, EnumRarity.common, "foodNoodle"),
CHOCOLATE_CAKE("ChocolateCake", 16, 2F, false, 45, EnumRarity.uncommon), CHOCOLATE_CAKE("ChocolateCake", 16, 2F, false, 45, EnumRarity.uncommon, "foodChocolateCake"),
CHOCOLATE("Chocolate", 5, 1F, false, 15, EnumRarity.common), CHOCOLATE("Chocolate", 5, 1F, false, 15, EnumRarity.common, "foodChocolate"),
TOAST("Toast", 3, 0.4F, false, 25, EnumRarity.common), TOAST("Toast", 3, 0.4F, false, 25, EnumRarity.common, "foodToast"),
SUBMARINE_SANDWICH("SubmarineSandwich", 10, 8F, false, 40, EnumRarity.uncommon), SUBMARINE_SANDWICH("SubmarineSandwich", 10, 8F, false, 40, EnumRarity.uncommon, "foodSubmarineSandwich"),
BIG_COOKIE("BigCookie", 6, 1F, false, 20, EnumRarity.uncommon), BIG_COOKIE("BigCookie", 6, 1F, false, 20, EnumRarity.uncommon, "foodBigCookie"),
HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.common), HAMBURGER("Hamburger", 14, 6F, false, 40, EnumRarity.common, "foodHamburger"),
PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.uncommon), PIZZA("Pizza", 20, 10F, false, 45, EnumRarity.uncommon, "foodPizza"),
BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common); BAGUETTE("Baguette", 7, 2F, false, 25, EnumRarity.common, "foodBaguette");
public static void setReturnItems(){ public static void setReturnItems(){
SPAGHETTI.returnItem = new ItemStack(Items.bowl); SPAGHETTI.returnItem = new ItemStack(Items.bowl);
@ -34,6 +34,7 @@ public enum TheFoods implements IName{
} }
public final String name; public final String name;
public final String oredictName;
public final int healAmount; public final int healAmount;
public final float saturation; public final float saturation;
public final boolean getsDrunken; public final boolean getsDrunken;
@ -41,17 +42,23 @@ public enum TheFoods implements IName{
public ItemStack returnItem; public ItemStack returnItem;
public final EnumRarity rarity; public final EnumRarity rarity;
TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity){ TheFoods(String name, int healAmount, float saturation, boolean getsDrunken, int useDuration, EnumRarity rarity, String oredictName){
this.name = name; this.name = name;
this.getsDrunken = getsDrunken; this.getsDrunken = getsDrunken;
this.healAmount = healAmount; this.healAmount = healAmount;
this.saturation = saturation; this.saturation = saturation;
this.useDuration = useDuration; this.useDuration = useDuration;
this.rarity = rarity; this.rarity = rarity;
this.oredictName = oredictName;
} }
@Override @Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }
@Override
public String getOredictName(){
return this.oredictName;
}
} }

View file

@ -0,0 +1,44 @@
package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.item.EnumRarity;
public enum TheJams implements INameableItem{
CU_BA_RA("CuBaRa", 20, 5F, EnumRarity.rare, "jamCuBaRa", 5, 12, 12595273),
GRA_KI_BA("GraKiBa", 20, 5F, EnumRarity.rare, "jamGraKiBa", 16, 13, 5492820),
PL_AP_LE("PlApLe", 20, 5F, EnumRarity.rare, "jamPlApLe", 15, 3, 13226009),
CH_AP_CI("ChApCi", 20, 5F, EnumRarity.rare, "jamChApCi", 10, 1, 13189222),
HO_ME_KI("HoMeKi", 20, 5F, EnumRarity.rare, "jamHoMeKi", 10, 14, 2031360),
PI_CO("PiCo", 20, 5F, EnumRarity.rare, "jamPiCo", 9, 1, 16056203);
public final String name;
public final String oredictName;
public final int healAmount;
public final float saturation;
public final EnumRarity rarity;
public final int firstEffectToGet;
public final int secondEffectToGet;
public final int color;
TheJams(String name, int healAmount, float saturation, EnumRarity rarity, String oredictName, int firstEffectID, int secondEffectID, int color){
this.name = name;
this.healAmount = healAmount;
this.saturation = saturation;
this.rarity = rarity;
this.oredictName = oredictName;
this.firstEffectToGet = firstEffectID;
this.secondEffectToGet = secondEffectID;
this.color = color;
}
@Override
public String getName(){
return this.name;
}
@Override
public String getOredictName(){
return this.oredictName;
}
}

View file

@ -1,28 +1,37 @@
package ellpeck.actuallyadditions.items.metalists; package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
public enum TheMiscItems implements IName{ public enum TheMiscItems implements INameableItem{
PAPER_CONE("PaperCone", EnumRarity.common), PAPER_CONE("PaperCone", EnumRarity.common, "itemPaperCone"),
MASHED_FOOD("MashedFood", EnumRarity.uncommon), MASHED_FOOD("MashedFood", EnumRarity.uncommon, "itemMashedFood"),
KNIFE_BLADE("KnifeBlade", EnumRarity.common), KNIFE_BLADE("KnifeBlade", EnumRarity.common, "itemKnifeBlade"),
KNIFE_HANDLE("KnifeHandle", EnumRarity.common), KNIFE_HANDLE("KnifeHandle", EnumRarity.common, "itemKnifeHandle"),
DOUGH("Dough", EnumRarity.common), DOUGH("Dough", EnumRarity.common, "itemDough"),
QUARTZ("BlackQuartz", EnumRarity.epic), QUARTZ("BlackQuartz", EnumRarity.epic, "gemQuartzBlack"),
RING("Ring", EnumRarity.uncommon); RING("Ring", EnumRarity.uncommon, "itemRing"),
COIL("Coil", EnumRarity.common, "itemCoilBasic"),
COIL_ADVANCED("CoilAdvanced", EnumRarity.uncommon, "itemCoilAdvanced");
public final String name; public final String name;
public final String oredictName;
public final EnumRarity rarity; public final EnumRarity rarity;
TheMiscItems(String name, EnumRarity rarity){ TheMiscItems(String name, EnumRarity rarity, String oredictName){
this.name = name; this.name = name;
this.rarity = rarity; this.rarity = rarity;
this.oredictName = oredictName;
} }
@Override @Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }
@Override
public String getOredictName(){
return this.oredictName;
}
} }

View file

@ -1,12 +1,12 @@
package ellpeck.actuallyadditions.items.metalists; package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
public enum ThePotionRings implements IName{ public enum ThePotionRings implements INameableItem{
SPEED("Speed", 8171462, 1, 0, 3, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)), SPEED("Speed", 8171462, 1, 0, 3, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)),
//TODO Slowness //TODO Slowness
@ -58,4 +58,9 @@ public enum ThePotionRings implements IName{
public String getName(){ public String getName(){
return this.name; return this.name;
} }
@Override
public String getOredictName(){
return "";
}
} }

View file

@ -1,40 +1,47 @@
package ellpeck.actuallyadditions.items.metalists; package ellpeck.actuallyadditions.items.metalists;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import net.minecraft.entity.EntityCreature; import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.monster.EntityCreeper; import net.minecraft.entity.monster.EntityCreeper;
import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.monster.EntityEnderman;
import net.minecraft.entity.monster.EntitySkeleton; import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.item.EnumRarity; import net.minecraft.item.EnumRarity;
public enum TheSpecialDrops implements IName{ public enum TheSpecialDrops implements INameableItem{
SOLIDIFIED_EXPERIENCE("SolidifiedExperience", 40, 3, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableExperienceDrop), SOLIDIFIED_EXPERIENCE("SolidifiedExperience", 40, 3, EntityCreature.class, EnumRarity.uncommon, ConfigBoolValues.EXPERIENCE_DROP.isEnabled(), "itemSolidifiedExperience"),
BLOOD_FRAGMENT("BloodFragment", 15, 1, EntityCreature.class, EnumRarity.uncommon, ConfigValues.enableBloodDrop), BLOOD_FRAGMENT("BloodFragment", 15, 1, EntityCreature.class, EnumRarity.uncommon, ConfigBoolValues.BLOOD_DROP.isEnabled(), "itemBloodFragment"),
HEART_PART("HeartPart", 5, 1, EntityCreature.class, EnumRarity.rare, ConfigValues.enableHeartDrop), HEART_PART("HeartPart", 5, 1, EntityCreature.class, EnumRarity.rare, ConfigBoolValues.HEART_DROP.isEnabled(), "itemHeartPart"),
UNKNOWN_SUBSTANCE("UnknownSubstance", 3, 1, EntitySkeleton.class, EnumRarity.epic, ConfigValues.enableSubstanceDrop), UNKNOWN_SUBSTANCE("UnknownSubstance", 3, 1, EntitySkeleton.class, EnumRarity.epic, ConfigBoolValues.SUBSTANCE_DROP.isEnabled(), "itemUnknownSubstance"),
PEARL_SHARD("PearlShard", 30, 3, EntityEnderman.class, EnumRarity.epic, ConfigValues.enablePearlShardDrop), PEARL_SHARD("PearlShard", 30, 3, EntityEnderman.class, EnumRarity.epic, ConfigBoolValues.PEARL_SHARD_DROP.isEnabled(), "nuggetEnderpearl"),
EMERALD_SHARD("EmeraldShard", 30, 3, EntityCreeper.class, EnumRarity.rare, ConfigValues.enableEmeraldShardDrop); EMERALD_SHARD("EmeraldShard", 30, 3, EntityCreeper.class, EnumRarity.rare, ConfigBoolValues.EMERALD_SHARD_CROP.isEnabled(), "nuggetEmerald");
public final String name; public final String name;
public final String oredictName;
public final int chance; public final int chance;
public final int maxAmount; public final int maxAmount;
public final Class<? extends EntityCreature> dropFrom; public final Class<? extends EntityCreature> dropFrom;
public final boolean canDrop; public final boolean canDrop;
public final EnumRarity rarity; public final EnumRarity rarity;
TheSpecialDrops(String name, int chance, int maxAmount, Class<? extends EntityCreature> dropFrom, EnumRarity rarity, boolean canDrop){ TheSpecialDrops(String name, int chance, int maxAmount, Class<? extends EntityCreature> dropFrom, EnumRarity rarity, boolean canDrop, String oredictName){
this.name = name; this.name = name;
this.chance = chance; this.chance = chance;
this.rarity = rarity; this.rarity = rarity;
this.maxAmount = maxAmount; this.maxAmount = maxAmount;
this.dropFrom = dropFrom; this.dropFrom = dropFrom;
this.canDrop = canDrop; this.canDrop = canDrop;
this.oredictName = oredictName;
} }
@Override @Override
public String getName(){ public String getName(){
return this.name; return this.name;
} }
@Override
public String getOredictName(){
return this.oredictName;
}
} }

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -16,27 +16,30 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemAxeAA extends ItemAxe implements IName{ public class ItemAxeAA extends ItemAxe implements INameableItem{
private String name; private String name;
private EnumRarity rarity; private EnumRarity rarity;
private ItemStack repairItem; private ItemStack repairItem;
private String oredictName;
public ItemAxeAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){ public ItemAxeAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity){
super(toolMat); super(toolMat);
this.name = unlocalizedName; this.name = unlocalizedName;
this.rarity = rarity; this.rarity = rarity;
this.repairItem = repairItem; this.repairItem = repairItem;
this.oredictName = name;
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
list.add(ItemUtil.addStandardInformation(this));
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override
@ -64,4 +67,9 @@ public class ItemAxeAA extends ItemAxe implements IName{
public String getName(){ public String getName(){
return name; return name;
} }
@Override
public String getOredictName(){
return oredictName;
}
} }

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemHoeAA extends ItemHoe implements IName{ public class ItemHoeAA extends ItemHoe implements INameableItem{
private String name; private String name;
private String oredictName;
private EnumRarity rarity; private EnumRarity rarity;
private ItemStack repairItem; private ItemStack repairItem;
@ -27,16 +28,18 @@ public class ItemHoeAA extends ItemHoe implements IName{
this.name = unlocalizedName; this.name = unlocalizedName;
this.rarity = rarity; this.rarity = rarity;
this.repairItem = repairItem; this.repairItem = repairItem;
this.oredictName = name;
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
list.add(ItemUtil.addStandardInformation(this));
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override
@ -64,4 +67,9 @@ public class ItemHoeAA extends ItemHoe implements IName{
public String getName(){ public String getName(){
return name; return name;
} }
@Override
public String getOredictName(){
return this.oredictName;
}
} }

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemPickaxeAA extends ItemPickaxe implements IName{ public class ItemPickaxeAA extends ItemPickaxe implements INameableItem{
private String name; private String name;
private String oredictName;
private EnumRarity rarity; private EnumRarity rarity;
private ItemStack repairItem; private ItemStack repairItem;
@ -27,16 +28,18 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{
this.name = unlocalizedName; this.name = unlocalizedName;
this.rarity = rarity; this.rarity = rarity;
this.repairItem = repairItem; this.repairItem = repairItem;
this.oredictName = name;
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
list.add(ItemUtil.addStandardInformation(this));
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override
@ -64,4 +67,9 @@ public class ItemPickaxeAA extends ItemPickaxe implements IName{
public String getName(){ public String getName(){
return name; return name;
} }
@Override
public String getOredictName(){
return oredictName;
}
} }

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemShovelAA extends ItemSpade implements IName{ public class ItemShovelAA extends ItemSpade implements INameableItem{
private String name; private String name;
private String oredictName;
private EnumRarity rarity; private EnumRarity rarity;
private ItemStack repairItem; private ItemStack repairItem;
@ -27,16 +28,18 @@ public class ItemShovelAA extends ItemSpade implements IName{
this.name = unlocalizedName; this.name = unlocalizedName;
this.rarity = rarity; this.rarity = rarity;
this.repairItem = repairItem; this.repairItem = repairItem;
this.oredictName = name;
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
list.add(ItemUtil.addStandardInformation(this));
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override
@ -64,4 +67,9 @@ public class ItemShovelAA extends ItemSpade implements IName{
public String getName(){ public String getName(){
return name; return name;
} }
@Override
public String getOredictName(){
return oredictName;
}
} }

View file

@ -2,7 +2,7 @@ package ellpeck.actuallyadditions.items.tools;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import ellpeck.actuallyadditions.util.IName; import ellpeck.actuallyadditions.util.INameableItem;
import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.ItemUtil;
import ellpeck.actuallyadditions.util.KeyUtil; import ellpeck.actuallyadditions.util.KeyUtil;
import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.ModUtil;
@ -16,9 +16,10 @@ import net.minecraft.util.StatCollector;
import java.util.List; import java.util.List;
public class ItemSwordAA extends ItemSword implements IName{ public class ItemSwordAA extends ItemSword implements INameableItem{
private String name; private String name;
private String oredictName;
private EnumRarity rarity; private EnumRarity rarity;
private ItemStack repairItem; private ItemStack repairItem;
@ -27,16 +28,18 @@ public class ItemSwordAA extends ItemSword implements IName{
this.name = unlocalizedName; this.name = unlocalizedName;
this.rarity = rarity; this.rarity = rarity;
this.repairItem = repairItem; this.repairItem = repairItem;
this.oredictName = name;
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@SideOnly(Side.CLIENT) @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) {
list.add(ItemUtil.addStandardInformation(this));
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + this.getName() + ".desc"));
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage()); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".durability.desc") + ": " + (this.getMaxDamage()-this.getDamage(stack)) + "/" + this.getMaxDamage());
} }
else list.add(ItemUtil.shiftForInfo());
} }
@Override @Override
@ -64,4 +67,9 @@ public class ItemSwordAA extends ItemSword implements IName{
public String getName(){ public String getName(){
return name; return name;
} }
@Override
public String getOredictName(){
return oredictName;
}
} }

View file

@ -1,6 +1,7 @@
package ellpeck.actuallyadditions.material; package ellpeck.actuallyadditions.material;
import ellpeck.actuallyadditions.config.ConfigValues; import ellpeck.actuallyadditions.config.values.ConfigFloatValues;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.Util; import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.Item.ToolMaterial;
import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.common.util.EnumHelper;
@ -13,8 +14,8 @@ public class InitItemMaterials{
public static void init(){ public static void init(){
Util.logInfo("Initializing Materials..."); Util.logInfo("Initializing Materials...");
toolMaterialEmerald = EnumHelper.addToolMaterial("toolMaterialEmerald", ConfigValues.toolEmeraldHarvestLevel, ConfigValues.toolEmeraldMaxUses, ConfigValues.toolEmeraldEfficiency, ConfigValues.toolEmeraldDamage, ConfigValues.toolEmeraldEnchantability); toolMaterialEmerald = EnumHelper.addToolMaterial("toolMaterialEmerald", ConfigIntValues.EMERALD_HARVEST_LEVEL.getValue(), ConfigIntValues.EMERALD_USES.getValue(), ConfigFloatValues.EMERALD_SPEED.getValue(), ConfigFloatValues.EMERALD_MAX_DAMAGE.getValue(), ConfigIntValues.EMERALD_ENCHANTABILITY.getValue());
toolMaterialObsidian = EnumHelper.addToolMaterial("toolMaterialObsidian", ConfigValues.toolObsidianHarvestLevel, ConfigValues.toolObsidianMaxUses, ConfigValues.toolObsidianEfficiency, ConfigValues.toolObsidianDamage, ConfigValues.toolObsidianEnchantability); toolMaterialObsidian = EnumHelper.addToolMaterial("toolMaterialObsidian", ConfigIntValues.OBSIDIAN_HARVEST_LEVEL.getValue(), ConfigIntValues.OBSIDIAN_USES.getValue(), ConfigFloatValues.OBSIDIAN_SPEED.getValue(), ConfigFloatValues.OBSIDIAN_MAX_DAMAGE.getValue(), ConfigIntValues.OBSIDIAN_ENCHANTABILITY.getValue());
} }

View file

@ -0,0 +1,202 @@
package ellpeck.actuallyadditions.nei;
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.ItemList;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.RecipeInfo;
import codechicken.nei.recipe.TemplateRecipeHandler;
import ellpeck.actuallyadditions.inventory.GuiGrinder;
import ellpeck.actuallyadditions.recipe.GrinderRecipes;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.StringUtil;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.util.*;
import java.util.List;
public class CrusherRecipeHandler extends TemplateRecipeHandler{
public static final String NAME = "crushing";
public static final String FUEL = "fuel";
public static ArrayList<Fuel> fuels;
public CrusherRecipeHandler(){
super();
RecipeInfo.setGuiOffset(this.getGuiClass(), 0, 0);
}
public class CachedCrush extends CachedRecipe{
public PositionedStack ingredient;
public PositionedStack resultOne;
public PositionedStack resultTwo;
public int secondChance;
public CachedCrush(ItemStack in, ItemStack resultOne, ItemStack resultTwo, int secondChance){
in.stackSize = 1;
this.ingredient = new PositionedStack(in, 80, 21);
this.resultOne = new PositionedStack(resultOne, 66, 69);
if(resultTwo != null) this.resultTwo = new PositionedStack(resultTwo, 94, 69);
this.secondChance = secondChance;
}
@Override
public List<PositionedStack> getIngredients(){
return getCycledIngredients(cycleticks / 48, Collections.singletonList(ingredient));
}
@Override
public PositionedStack getResult(){
return resultOne;
}
@Override
public PositionedStack getOtherStack(){
return fuels.get((cycleticks / 48) % fuels.size()).stack;
}
@Override
public List<PositionedStack> getOtherStacks(){
ArrayList<PositionedStack> list = new ArrayList<PositionedStack>();
list.add(this.getOtherStack());
if(this.resultTwo != null) list.add(this.resultTwo);
return list;
}
}
@Override
public int recipiesPerPage(){
return 1;
}
public static class Fuel{
public Fuel(ItemStack in, int burnTime){
this.stack = new PositionedStack(in, 51, 21, false);
this.burnTime = burnTime;
}
public PositionedStack stack;
public int burnTime;
}
@Override
public void loadTransferRects(){
transferRects.add(new RecipeTransferRect(new Rectangle(51, 5, 14, 14), FUEL));
transferRects.add(new RecipeTransferRect(new Rectangle(80, 40, 24, 22), NAME));
}
@Override
public Class<? extends GuiContainer> getGuiClass(){
return GuiGrinder.class;
}
@Override
public String getRecipeName(){
return StatCollector.translateToLocal("container." + ModUtil.MOD_ID_LOWER + ".nei." + NAME + ".name");
}
@Override
public TemplateRecipeHandler newInstance(){
if (fuels == null || fuels.isEmpty()) findFuels();
return super.newInstance();
}
@Override
public void loadCraftingRecipes(String outputId, Object... results){
if(outputId.equals(NAME) && getClass() == CrusherRecipeHandler.class){
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.instance().recipes;
for(GrinderRecipes.GrinderRecipe recipe : recipes){
arecipes.add(new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance));
}
}
else super.loadCraftingRecipes(outputId, results);
}
@Override
public void loadCraftingRecipes(ItemStack result){
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.instance().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));
}
}
@Override
public void loadUsageRecipes(String inputId, Object... ingredients){
if (inputId.equals(FUEL) && getClass() == CrusherRecipeHandler.class) loadCraftingRecipes(NAME);
else super.loadUsageRecipes(inputId, ingredients);
}
@Override
public void loadUsageRecipes(ItemStack ingredient){
ArrayList<GrinderRecipes.GrinderRecipe> recipes = GrinderRecipes.instance().recipes;
for(GrinderRecipes.GrinderRecipe recipe : recipes){
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.input, ingredient)){
CachedCrush theRecipe = new CachedCrush(recipe.input, recipe.firstOutput, recipe.secondOutput, recipe.secondChance);
theRecipe.setIngredientPermutation(Collections.singletonList(theRecipe.ingredient), ingredient);
arecipes.add(theRecipe);
}
}
}
@Override
public String getGuiTexture(){
return ModUtil.MOD_ID_LOWER + ":textures/gui/guiGrinder.png";
}
@Override
public void drawBackground(int recipeIndex){
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GuiDraw.changeTexture(getGuiTexture());
GuiDraw.drawTexturedModalRect(49, 5, 49, 5, 66, 86);
}
@Override
public void drawExtras(int recipe){
drawProgressBar(51, 5, 176, 44, 14, 14, 48, 7);
drawProgressBar(80, 40, 176, 0, 24, 23, 48, 1);
CachedCrush crush = (CachedCrush)this.arecipes.get(recipe);
if(crush.resultTwo != null){
int secondChance = crush.secondChance;
String secondString = secondChance + "%";
GuiDraw.drawString(secondString, 118, 73, StringUtil.DECIMAL_COLOR_GRAY_TEXT, false);
}
}
private static Set<Item> excludedFuels(){
Set<Item> theFuels = new HashSet<Item>();
theFuels.add(Item.getItemFromBlock(Blocks.brown_mushroom));
theFuels.add(Item.getItemFromBlock(Blocks.red_mushroom));
theFuels.add(Item.getItemFromBlock(Blocks.standing_sign));
theFuels.add(Item.getItemFromBlock(Blocks.wall_sign));
theFuels.add(Item.getItemFromBlock(Blocks.wooden_door));
theFuels.add(Item.getItemFromBlock(Blocks.trapped_chest));
return theFuels;
}
private static void findFuels(){
fuels = new ArrayList<Fuel>();
Set<Item> theFuels = excludedFuels();
for(ItemStack item : ItemList.items){
if(!theFuels.contains(item.getItem())){
int burnTime = TileEntityFurnace.getItemBurnTime(item);
if(burnTime > 0) fuels.add(new Fuel(item.copy(), burnTime));
}
}
}
@Override
public String getOverlayIdentifier(){
return NAME;
}
}

View file

@ -0,0 +1,34 @@
package ellpeck.actuallyadditions.nei;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import ellpeck.actuallyadditions.blocks.InitBlocks;
import ellpeck.actuallyadditions.util.ModUtil;
import ellpeck.actuallyadditions.util.Util;
import net.minecraft.item.ItemStack;
public class NEIActuallyAdditionsConfig implements IConfigureNEI{
@Override
public void loadConfig(){
Util.logInfo("Initializing Not Enough Items Plugin...");
CrusherRecipeHandler crusherRecipeHandler = new CrusherRecipeHandler();
API.registerRecipeHandler(crusherRecipeHandler);
API.registerUsageHandler(crusherRecipeHandler);
//TODO Re-add
API.hideItem(new ItemStack(InitBlocks.blockHeatCollector));
API.hideItem(new ItemStack(InitBlocks.blockFurnaceSolar));
}
@Override
public String getName(){
return ModUtil.MOD_ID + " NEI Plugin";
}
@Override
public String getVersion(){
return ModUtil.VERSION;
}
}

Some files were not shown because too many files have changed in this diff Show more