-Precision Droppers

-Bugs fixed
This commit is contained in:
Ellpeck 2015-05-04 17:26:50 +02:00
parent fb13a20feb
commit 3649bdd29c
54 changed files with 812 additions and 263 deletions

View file

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

View file

@ -1 +1 @@
1.7.10-0.0.4.2 1.7.10-0.0.4.3

View file

@ -19,6 +19,7 @@ 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.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import java.util.List; import java.util.List;
@ -51,11 +52,19 @@ public class BlockBreaker extends BlockContainerBase implements INameableItem{
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityBreaker(this.isPlacer); return this.isPlacer ? new TileEntityBreaker.TileEntityPlacer() : new TileEntityBreaker();
} }
@Override @Override
public IIcon getIcon(int side, int meta){ 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 && (side == 0 || side == 1)) return this.topIcon;
if(side == meta) return this.frontIcon; if(side == meta) return this.frontIcon;
return this.blockIcon; return this.blockIcon;

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

@ -66,6 +66,14 @@ public class BlockFurnaceDouble extends BlockContainerBase implements INameableI
@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;

View file

@ -42,7 +42,7 @@ public class BlockGrinder extends BlockContainerBase implements INameableItem{
@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

View file

@ -43,7 +43,7 @@ public class BlockInputter extends BlockContainerBase implements INameableItem{
@Override @Override
public TileEntity createNewTileEntity(World world, int par2){ public TileEntity createNewTileEntity(World world, int par2){
return new TileEntityInputter(this.isAdvanced); return this.isAdvanced ? new TileEntityInputter.TileEntityInputterAdvanced() : new TileEntityInputter();
} }
@Override @Override
@ -127,8 +127,6 @@ public class BlockInputter extends BlockContainerBase implements INameableItem{
if((((BlockInputter)theBlock).isAdvanced)) list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)theBlock).getName() + ".desc")); 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());
if(KeyUtil.isControlPressed()) BlockUtil.addOredictName(((INameableItem)theBlock).getOredictName(), list);
} }
@Override @Override

View file

@ -91,7 +91,7 @@ public class BlockMisc extends Block implements INameableItem{
@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) {
BlockUtil.addInformation(theBlock, list, 1, allMiscBlocks[stack.getItemDamage()].getName(), allMiscBlocks[stack.getItemDamage()].getOredictName()); BlockUtil.addInformation(theBlock, list, 1, allMiscBlocks[stack.getItemDamage()].getName());
} }
@Override @Override

View file

@ -21,10 +21,10 @@ public class InitBlocks{
public static Block blockHeatCollector; public static Block blockHeatCollector;
public static Block blockItemRepairer; public static Block blockItemRepairer;
public static Block blockGreenhouseGlass; public static Block blockGreenhouseGlass;
public static Block blockBreaker; public static Block blockBreaker;
public static Block blockPlacer; public static Block blockPlacer;
public static Block blockDropper;
//public static Block blockCoffeeMachine;
public static void init(){ public static void init(){
Util.logInfo("Initializing Blocks..."); Util.logInfo("Initializing Blocks...");
@ -77,7 +77,7 @@ public class InitBlocks{
blockPlacer = new BlockBreaker(true); blockPlacer = new BlockBreaker(true);
BlockUtil.register(blockPlacer, BlockBreaker.TheItemBlock.class); BlockUtil.register(blockPlacer, BlockBreaker.TheItemBlock.class);
//blockCoffeeMachine = new BlockCoffeeMachine(); blockDropper = new BlockDropper();
//BlockUtil.register(blockCoffeeMachine, BlockCoffeeMachine.TheItemBlock.class); BlockUtil.register(blockDropper, BlockDropper.TheItemBlock.class);
} }
} }

View file

@ -20,7 +20,9 @@ public enum ConfigBoolValues{
PEARL_SHARD_DROP("Ender Pearl Shard", ConfigCategories.MOB_DROPS, true, "If the Ender Pearl Shard 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"), 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_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 name;
public final String category; public final String category;

View file

@ -22,6 +22,7 @@ public enum ConfigCrafting{
GREENHOUSE_GLASS("Greenhouse Glass", ConfigCategories.BLOCKS_CRAFTING), GREENHOUSE_GLASS("Greenhouse Glass", ConfigCategories.BLOCKS_CRAFTING),
BREAKER("Breaker", ConfigCategories.BLOCKS_CRAFTING), BREAKER("Breaker", ConfigCategories.BLOCKS_CRAFTING),
PLACER("Placer", ConfigCategories.BLOCKS_CRAFTING), PLACER("Placer", ConfigCategories.BLOCKS_CRAFTING),
DROPPER("Dropper", ConfigCategories.BLOCKS_CRAFTING),
SPEED_UPGRADE("Speed Upgrade", ConfigCategories.BLOCKS_CRAFTING), SPEED_UPGRADE("Speed Upgrade", ConfigCategories.BLOCKS_CRAFTING),
BAGUETTE("Baguette", ConfigCategories.FOOD_CRAFTING), BAGUETTE("Baguette", ConfigCategories.FOOD_CRAFTING),

View file

@ -45,8 +45,8 @@ public enum ConfigIntValues{
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"), 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"); 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 name;
public final String category; public final String category;

View file

@ -61,17 +61,17 @@ public class BlockCrafting{
'C', TheMiscBlocks.STONE_CASING.getOredictName())); 'C', TheMiscBlocks.STONE_CASING.getOredictName()));
//Solar Panel //Solar Panel
if(ConfigCrafting.SOLAR_PANEL.isEnabled()) /*if(ConfigCrafting.SOLAR_PANEL.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFurnaceSolar), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockFurnaceSolar),
"IQI", "CDC", "IBI", "IQI", "CDC", "IBI",
'D', "blockDiamond", 'D', "blockDiamond",
'I', "ingotIron", 'I', "ingotIron",
'Q', TheMiscBlocks.STONE_CASING.getOredictName(), 'Q', TheMiscBlocks.STONE_CASING.getOredictName(),
'C', TheMiscItems.COIL_ADVANCED.getOredictName(), 'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
'B', new ItemStack(Blocks.iron_bars))); 'B', new ItemStack(Blocks.iron_bars)));*/
//Heat Collector //Heat Collector
if(ConfigCrafting.HEAT_COLLECTOR.isEnabled()) /*if(ConfigCrafting.HEAT_COLLECTOR.isEnabled())
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockHeatCollector), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockHeatCollector),
"BRB", "CDC", "BQB", "BRB", "CDC", "BQB",
'D', "blockDiamond", 'D', "blockDiamond",
@ -79,7 +79,7 @@ public class BlockCrafting{
'Q', TheMiscBlocks.STONE_CASING.getOredictName(), 'Q', TheMiscBlocks.STONE_CASING.getOredictName(),
'L', new ItemStack(Items.lava_bucket), 'L', new ItemStack(Items.lava_bucket),
'C', TheMiscItems.COIL_ADVANCED.getOredictName(), 'C', TheMiscItems.COIL_ADVANCED.getOredictName(),
'B', new ItemStack(Blocks.iron_bars))); 'B', new ItemStack(Blocks.iron_bars)));*/
//Quartz Pillar //Quartz Pillar
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()), GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(InitBlocks.blockMisc, 1, TheMiscBlocks.QUARTZ_PILLAR.ordinal()),
@ -177,6 +177,14 @@ public class BlockCrafting{
'R', TheMiscItems.COIL.getOredictName(), 'R', TheMiscItems.COIL.getOredictName(),
'P', Items.diamond_pickaxe)); '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

@ -2,89 +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 Crusher 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;
int specialAmount = 0;
if(name.equals("oreNickel")){
specialStacks = OreDictionary.getOres("dustPlatinum");
specialAmount = 30;
}
if(specialStacks != null && specialStacks.size() > 0){
for(ItemStack theSpecial : specialStacks){
ItemStack special = theSpecial.copy();
GrinderRecipes.instance().registerRecipe(input, output, special, specialAmount);
}
}
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

@ -40,6 +40,7 @@ public class CreativeTab extends CreativeTabs{
this.addBlock(InitBlocks.blockFishingNet); this.addBlock(InitBlocks.blockFishingNet);
this.addBlock(InitBlocks.blockBreaker); this.addBlock(InitBlocks.blockBreaker);
this.addBlock(InitBlocks.blockPlacer); this.addBlock(InitBlocks.blockPlacer);
this.addBlock(InitBlocks.blockDropper);
this.addBlock(InitBlocks.blockMisc); this.addBlock(InitBlocks.blockMisc);
this.addBlock(InitBlocks.blockFeeder); this.addBlock(InitBlocks.blockFeeder);

View file

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

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

@ -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

@ -15,47 +15,71 @@ import java.util.Random;
public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHandler{ public class JamVillagerTradeHandler implements VillagerRegistry.IVillageTradeHandler{
private ArrayList<ItemStack> villagerWants = new ArrayList<ItemStack>(); private ArrayList<Trade> trades = new ArrayList<Trade>();
public JamVillagerTradeHandler(){ public JamVillagerTradeHandler(){
this.addWants("ingotGold"); this.addWants("ingotGold", 3, 2);
this.addWants("cropWheat"); this.addWants("cropWheat", 10, 10);
this.addWants("dustRedstone"); this.addWants("dustRedstone", 15, 15);
this.addWants(new ItemStack(Items.bucket)); this.addWants(new ItemStack(Items.bucket), 1, 4);
this.addWants(new ItemStack(Items.glass_bottle)); this.addWants(new ItemStack(Items.glass_bottle), 5, 5);
this.addWants(new ItemStack(Items.potionitem)); this.addWants(new ItemStack(Items.potionitem), 1, 0);
this.addWants("ingotIron"); this.addWants("ingotIron", 5, 5);
this.addWants("gemDiamond"); this.addWants("gemDiamond", 1, 1);
this.addWants("dustGlowstone"); this.addWants("dustGlowstone", 5, 10);
} }
@Override @Override
@SuppressWarnings("unchecked") @SuppressWarnings("all")
public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){ public void manipulateTradesForVillager(EntityVillager villager, MerchantRecipeList recipeList, Random rand){
for(int i = 0; i < villagerWants.size(); i++){ for(int i = 0; i < trades.size(); i++){
for(int j = 0; j < trades.get(i).wants.size(); j++){
ItemStack wantsTwo = null; ItemStack wantsTwo = null;
ItemStack wantsOne = villagerWants.get(i); ItemStack wantsOne = trades.get(i).wants.get(j);
wantsOne.stackSize = rand.nextInt(10)+10;
if(wantsOne.stackSize > wantsOne.getMaxStackSize()) wantsOne.stackSize = wantsOne.getMaxStackSize(); wantsOne.stackSize = rand.nextInt(trades.get(i).extraStackSize) + trades.get(i).baseStackSize;
if(rand.nextInt(5) == 0){ if(rand.nextInt(3) == 0){
wantsTwo = villagerWants.get(rand.nextInt(villagerWants.size())); int toGet = rand.nextInt(trades.size());
wantsTwo.stackSize = rand.nextInt(10)+1; for(int k = 0; k < trades.get(toGet).wants.size(); k++){
if(wantsTwo.stackSize > wantsTwo.getMaxStackSize()) wantsTwo.stackSize = wantsTwo.getMaxStackSize(); wantsTwo = trades.get(toGet).wants.get(k);
wantsTwo.stackSize = rand.nextInt(trades.get(k).extraStackSize) + trades.get(k).baseStackSize;
}
} }
if(wantsOne == wantsTwo) wantsTwo = null; if(wantsOne == wantsTwo) wantsTwo = null;
for(int j = 0; j < TheJams.values().length; j++){ for(int k = 0; k < TheJams.values().length; k++){
recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(3)+1, j))); recipeList.add(new MerchantRecipe(wantsOne, wantsTwo, new ItemStack(InitItems.itemJams, rand.nextInt(5)+1, k)));
}
} }
} }
} }
public void addWants(String oredictName){ public void addWants(String oredictName, int minSize, int maxSize){
ArrayList<ItemStack> stacks = OreDictionary.getOres(oredictName); ArrayList<ItemStack> stacks = OreDictionary.getOres(oredictName);
villagerWants.addAll(stacks); 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;
} }
public void addWants(ItemStack stack){
villagerWants.add(stack);
} }
} }

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

@ -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

@ -43,6 +43,9 @@ public class GuiHandler implements IGuiHandler{
case BREAKER_ID: case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new ContainerBreaker(entityPlayer.inventory, tileBreaker); 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;
} }
@ -80,6 +83,9 @@ public class GuiHandler implements IGuiHandler{
case BREAKER_ID: case BREAKER_ID:
TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z); TileEntityBase tileBreaker = (TileEntityBase)world.getTileEntity(x, y, z);
return new GuiBreaker(entityPlayer.inventory, tileBreaker); 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;
} }
@ -95,6 +101,7 @@ public class GuiHandler implements IGuiHandler{
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 INPUTTER_ADVANCED_ID = 8;
public static final int BREAKER_ID = 9; 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

@ -61,7 +61,7 @@ public class ItemDust extends Item implements INameableItem{
@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, 1, allDusts[stack.getItemDamage()].getName(), allDusts[stack.getItemDamage()].getOredictName()); ItemUtil.addInformation(this, list, 1, allDusts[stack.getItemDamage()].getName());
} }
@Override @Override

View file

@ -104,8 +104,6 @@ public class ItemFoods extends ItemFood implements INameableItem{
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allFoods[stack.getItemDamage()].saturation); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allFoods[stack.getItemDamage()].saturation);
} }
else list.add(ItemUtil.shiftForInfo()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(allFoods[stack.getItemDamage()].getOredictName(), list);
} }
@Override @Override

View file

@ -111,8 +111,6 @@ public class ItemJams extends ItemFood implements INameableItem{
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allJams[stack.getItemDamage()].saturation); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".saturation.desc") + ": " + allJams[stack.getItemDamage()].saturation);
} }
else list.add(ItemUtil.shiftForInfo()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(allJams[stack.getItemDamage()].getOredictName(), list);
} }
@Override @Override

View file

@ -58,8 +58,6 @@ public class ItemKnife extends Item implements INameableItem{
} }
else list.add(ItemUtil.shiftForInfo()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(this.getOredictName(), list);
} }
@Override @Override

View file

@ -111,8 +111,6 @@ public class ItemLeafBlower extends Item implements INameableItem{
list.add(StringUtil.ITALIC + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemLeafBlower.desc.3")); list.add(StringUtil.ITALIC + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".itemLeafBlower.desc.3"));
} }
else list.add(ItemUtil.shiftForInfo()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(this.getOredictName(), list);
} }
@Override @Override

View file

@ -62,7 +62,7 @@ public class ItemMisc extends Item implements INameableItem{
@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, 1, allMiscItems[stack.getItemDamage()].getName(), allMiscItems[stack.getItemDamage()].getOredictName()); ItemUtil.addInformation(this, list, 1, allMiscItems[stack.getItemDamage()].getName());
} }
@Override @Override

View file

@ -91,7 +91,7 @@ public class ItemPotionRing extends Item implements INameableItem{
@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, "", this.getOredictName()); ItemUtil.addInformation(this, list, 2, "");
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
if(stack.getItemDamage() == ThePotionRings.SATURATION.ordinal()){ if(stack.getItemDamage() == ThePotionRings.SATURATION.ordinal()){

View file

@ -76,7 +76,7 @@ public class ItemSpecialDrop extends Item implements INameableItem{
@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, 1, allDrops[stack.getItemDamage()].getName(), allDrops[stack.getItemDamage()].getOredictName()); ItemUtil.addInformation(this, list, 1, allDrops[stack.getItemDamage()].getName());
} }
@Override @Override

View file

@ -40,8 +40,6 @@ public class ItemAxeAA extends ItemAxe implements INameableItem{
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()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(this.getOredictName(), list);
} }
@Override @Override

View file

@ -40,8 +40,6 @@ public class ItemHoeAA extends ItemHoe implements INameableItem{
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()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(this.getOredictName(), list);
} }
@Override @Override

View file

@ -40,8 +40,6 @@ public class ItemPickaxeAA extends ItemPickaxe implements INameableItem{
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()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(this.getOredictName(), list);
} }
@Override @Override

View file

@ -40,8 +40,6 @@ public class ItemShovelAA extends ItemSpade implements INameableItem{
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()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(this.getOredictName(), list);
} }
@Override @Override

View file

@ -40,8 +40,6 @@ public class ItemSwordAA extends ItemSword implements INameableItem{
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()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()) ItemUtil.addOredictName(this.getOredictName(), list);
} }
@Override @Override

View file

@ -0,0 +1,112 @@
package ellpeck.actuallyadditions.recipe;
import ellpeck.actuallyadditions.config.values.ConfigBoolValues;
import ellpeck.actuallyadditions.util.ModUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import org.apache.logging.log4j.Level;
import java.util.ArrayList;
public class GrinderRecipeHandler{
private static final GrinderRecipeHandler instance = new GrinderRecipeHandler();
public static GrinderRecipeHandler instance(){
return instance;
}
public ArrayList<SearchCase> searchCases = new ArrayList<SearchCase>();
public ArrayList<String> exceptions = new ArrayList<String>();
public ArrayList<SpecialOreCase> specialOreCases = new ArrayList<SpecialOreCase>();
public static class SearchCase{
public final String name;
public final int resultAmount;
public SearchCase(String name, int resultAmount){
this.name = name;
this.resultAmount = resultAmount;
}
}
public static class SpecialOreCase{
public final String inputName;
public final String secondResultName;
public final int secondResultChance;
public SpecialOreCase(String inputName, String secondResultName, int secondResultChance){
this.inputName = inputName;
this.secondResultChance = secondResultChance;
this.secondResultName = secondResultName;
}
}
public void registerFinally(){
String[] names = OreDictionary.getOreNames();
for(String inputName : names){
if(!this.exceptions.contains(inputName)){
int resultAmount = 1;
String inputNameWithoutPrefix = null;
for(SearchCase searchCase : searchCases){
String toSearch = searchCase.name;
if(inputName.length() > toSearch.length() && inputName.substring(0, toSearch.length()).equals(toSearch)){
inputNameWithoutPrefix = inputName.substring(toSearch.length());
resultAmount = searchCase.resultAmount;
break;
}
}
if(inputNameWithoutPrefix != null){
String inputWithDustPrefix = "dust" + inputNameWithoutPrefix;
ArrayList<ItemStack> allOresOfInitialInputName = OreDictionary.getOres(inputName);
ArrayList<ItemStack> allOresWithDustPrefix = OreDictionary.getOres(inputWithDustPrefix);
if(allOresOfInitialInputName != null && allOresOfInitialInputName.size() > 0){
if(allOresWithDustPrefix != null && allOresWithDustPrefix.size() > 0){
for(ItemStack theInput : allOresOfInitialInputName){
for(ItemStack theDust : allOresWithDustPrefix){
ItemStack input = theInput.copy();
ItemStack output = theDust.copy();
output.stackSize = resultAmount;
if(!GrinderRecipes.instance().hasExactRecipe(input, output)){
ArrayList<ItemStack> specialStacks = null;
int specialAmount = 0;
for(SpecialOreCase theCase : specialOreCases){
if(inputName.equals(theCase.inputName)){
specialStacks = OreDictionary.getOres(theCase.secondResultName);
specialAmount = theCase.secondResultChance;
}
}
if(specialStacks != null && specialStacks.size() > 0){
for(ItemStack theSpecial : specialStacks){
ItemStack special = theSpecial.copy();
GrinderRecipes.instance().registerRecipe(input, output, special, specialAmount);
}
}
else GrinderRecipes.instance().registerRecipe(input, output, null, 0);
}
}
}
}
else{
if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled())
ModUtil.AA_LOGGER.log(Level.INFO, "Couldn't register Crusher Recipe! An Item with OreDictionary Registry '" + inputWithDustPrefix + "' doesn't exist! It should correspond to '" + inputName + "'! This is not an Error, just a bit sad :(");
}
}
else{
if(ConfigBoolValues.DO_CRUSHER_SPAM.isEnabled())
ModUtil.AA_LOGGER.log(Level.WARN, "Couldn't register Crusher Recipe! Didn't find Items registered as '" + inputName + "'! This shouldn't happen as there is something registered as '" + inputName + "' that doesn't exist!");
}
}
}
}
}
}

View file

@ -27,6 +27,15 @@ public class GrinderRecipes{
return null; return null;
} }
public boolean hasExactRecipe(ItemStack input, ItemStack outputOne){
for(GrinderRecipe recipe : recipes){
if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne)){
return true;
}
}
return false;
}
public int getSecondChance(ItemStack input){ public int getSecondChance(ItemStack input){
for(GrinderRecipe recipe : recipes){ for(GrinderRecipe recipe : recipes){
if(recipe.input.isItemEqual(input)){ if(recipe.input.isItemEqual(input)){

View file

@ -41,6 +41,10 @@ public class TileEntityBase extends TileEntity{
GameRegistry.registerTileEntity(TileEntityItemRepairer.class, ModUtil.MOD_ID_LOWER + ":tileEntityRepairer"); GameRegistry.registerTileEntity(TileEntityItemRepairer.class, ModUtil.MOD_ID_LOWER + ":tileEntityRepairer");
GameRegistry.registerTileEntity(TileEntityGreenhouseGlass.class, ModUtil.MOD_ID_LOWER + ":tileEntityGreenhouseGlass"); GameRegistry.registerTileEntity(TileEntityGreenhouseGlass.class, ModUtil.MOD_ID_LOWER + ":tileEntityGreenhouseGlass");
GameRegistry.registerTileEntity(TileEntityBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityBreaker"); GameRegistry.registerTileEntity(TileEntityBreaker.class, ModUtil.MOD_ID_LOWER + ":tileEntityBreaker");
GameRegistry.registerTileEntity(TileEntityDropper.class, ModUtil.MOD_ID_LOWER + ":tileEntityDropper");
GameRegistry.registerTileEntity(TileEntityInputter.TileEntityInputterAdvanced.class, ModUtil.MOD_ID_LOWER + ":tileEntityInputterAdvanced");
GameRegistry.registerTileEntity(TileEntityBreaker.TileEntityPlacer.class, ModUtil.MOD_ID_LOWER + ":tileEntityPlacer");
GameRegistry.registerTileEntity(TileEntityGrinder.TileEntityGrinderDouble.class, ModUtil.MOD_ID_LOWER + ":tileEntityGrinderDouble");
} }
@Override @Override

View file

@ -7,24 +7,33 @@ import net.minecraft.block.BlockAir;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.ArrayList; import java.util.ArrayList;
public class TileEntityBreaker extends TileEntityInventoryBase{ public class TileEntityBreaker extends TileEntityInventoryBase{
private boolean isPlacer; public static class TileEntityPlacer extends TileEntityBreaker{
public TileEntityPlacer(){
super(9, "placer");
this.isPlacer = true;
}
}
public boolean isPlacer;
private final int timeNeeded = ConfigIntValues.BREAKER_TIME_NEEDED.getValue(); private final int timeNeeded = ConfigIntValues.BREAKER_TIME_NEEDED.getValue();
private int currentTime; private int currentTime;
@SuppressWarnings("unused") public TileEntityBreaker(int slots, String name){
public TileEntityBreaker(){ super(slots, name);
super(9, "");
} }
public TileEntityBreaker(boolean isPlacer){ public TileEntityBreaker(){
super(9, isPlacer ? "placer" : "breaker"); super(9, "breaker");
this.isPlacer = isPlacer; this.isPlacer = false;
} }
@Override @Override
@ -35,37 +44,27 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
if(this.currentTime > 0){ if(this.currentTime > 0){
this.currentTime--; this.currentTime--;
if(this.currentTime <= 0){ if(this.currentTime <= 0){
int sideToBreak = -1; ForgeDirection sideToManipulate = ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord));
int metaOfCurrentBlock = worldObj.getBlockMetadata(xCoord, yCoord, zCoord); ChunkCoordinates coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, xCoord, yCoord, zCoord);
if(metaOfCurrentBlock == 0) sideToBreak = 1; if(coordsBlock != null){
else if(metaOfCurrentBlock == 1) sideToBreak = 0; Block blockToBreak = worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ);
else if(metaOfCurrentBlock == 2) sideToBreak = 2; if(!this.isPlacer && blockToBreak != null && blockToBreak.getBlockHardness(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ) > -1.0F){
else if(metaOfCurrentBlock == 3) sideToBreak = 4;
else if(metaOfCurrentBlock == 4) sideToBreak = 5;
else if(metaOfCurrentBlock == 5) sideToBreak = 3;
ChunkCoordinates coordsOfBlockToBreak = WorldUtil.getCoordsFromSide(sideToBreak, xCoord, yCoord, zCoord);
if(coordsOfBlockToBreak != null){
Block blockToBreak = worldObj.getBlock(coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ);
if(!this.isPlacer && blockToBreak != null && blockToBreak.getBlockHardness(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ) > -1.0F){
ArrayList<ItemStack> drops = new ArrayList<ItemStack>(); ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
int meta = worldObj.getBlockMetadata(coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ); int meta = worldObj.getBlockMetadata(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ);
drops.addAll(blockToBreak.getDrops(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ, meta, 0)); drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, meta, 0));
if(this.addToInventory(drops, false)){ if(this.addToInventory(drops, false)){
worldObj.playAuxSFX(2001, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ, Block.getIdFromBlock(blockToBreak) + (meta << 12)); worldObj.playAuxSFX(2001, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ, Block.getIdFromBlock(blockToBreak) + (meta << 12));
WorldUtil.breakBlockAtSide(sideToBreak, worldObj, xCoord, yCoord, zCoord); WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord);
this.addToInventory(drops, true); this.addToInventory(drops, true);
this.markDirty(); this.markDirty();
} }
} }
else if(this.isPlacer && (worldObj.getBlock(coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ).isReplaceable(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ))){ else if(this.isPlacer && (worldObj.getBlock(coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ).isReplaceable(worldObj, coordsBlock.posX, coordsBlock.posY, coordsBlock.posZ))){
ItemStack removeFalse = this.removeFromInventory(false); ItemStack removeFalse = this.removeFromInventory(false);
if(removeFalse != null && Block.getBlockFromItem(removeFalse.getItem()) != blockToBreak && Block.getBlockFromItem(removeFalse.getItem()).canPlaceBlockAt(worldObj, coordsOfBlockToBreak.posX, coordsOfBlockToBreak.posY, coordsOfBlockToBreak.posZ)){ if(removeFalse != null && Block.getBlockFromItem(removeFalse.getItem()) != blockToBreak && WorldUtil.placeBlockAtSide(sideToManipulate, worldObj, xCoord, yCoord, zCoord, removeFalse)){
ItemStack stack = this.removeFromInventory(true); this.removeFromInventory(true);
//TODO insert sound effect
WorldUtil.placeBlockAtSide(sideToBreak, worldObj, xCoord, yCoord, zCoord, stack);
} }
} }
} }
@ -79,16 +78,12 @@ public class TileEntityBreaker extends TileEntityInventoryBase{
@Override @Override
public void writeToNBT(NBTTagCompound compound){ public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound); super.writeToNBT(compound);
compound.setBoolean("IsPlacer", this.isPlacer);
compound.setString("Name", this.name);
compound.setInteger("CurrentTime", this.currentTime); compound.setInteger("CurrentTime", this.currentTime);
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound); super.readFromNBT(compound);
this.isPlacer = compound.getBoolean("IsPlacer");
this.name = compound.getString("Name");
this.currentTime = compound.getInteger("CurrentTime"); this.currentTime = compound.getInteger("CurrentTime");
} }

View file

@ -0,0 +1,80 @@
package ellpeck.actuallyadditions.tile;
import ellpeck.actuallyadditions.config.values.ConfigIntValues;
import ellpeck.actuallyadditions.util.WorldUtil;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityDropper extends TileEntityInventoryBase{
private final int timeNeeded = ConfigIntValues.DROPPER_TIME_NEEDED.getValue();
private int currentTime;
@SuppressWarnings("unused")
public TileEntityDropper(){
super(9, "dropper");
}
@Override
@SuppressWarnings("unchecked")
public void updateEntity(){
if(!worldObj.isRemote){
if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){
if(this.currentTime > 0){
this.currentTime--;
if(this.currentTime <= 0){
if(this.removeFromInventory(false) != null){
ItemStack stack = this.removeFromInventory(true);
stack.stackSize = 1;
WorldUtil.dropItemAtSide(ForgeDirection.getOrientation(worldObj.getBlockMetadata(xCoord, yCoord, zCoord)), worldObj, xCoord, yCoord, zCoord, stack);
}
}
}
else this.currentTime = this.timeNeeded;
}
}
}
@Override
public void writeToNBT(NBTTagCompound compound){
super.writeToNBT(compound);
compound.setInteger("CurrentTime", this.currentTime);
}
@Override
public void readFromNBT(NBTTagCompound compound){
super.readFromNBT(compound);
this.currentTime = compound.getInteger("CurrentTime");
}
public ItemStack removeFromInventory(boolean actuallyDo){
for(int i = 0; i < this.slots.length; i++){
if(this.slots[i] != null){
ItemStack slot = this.slots[i].copy();
if(actuallyDo){
this.slots[i].stackSize--;
if(this.slots[i].stackSize <= 0) this.slots[i] = null;
}
return slot;
}
}
return null;
}
@Override
public boolean isItemValidForSlot(int i, ItemStack stack){
return true;
}
@Override
public boolean canInsertItem(int slot, ItemStack stack, int side){
return this.isItemValidForSlot(slot, stack);
}
@Override
public boolean canExtractItem(int slot, ItemStack stack, int side){
return true;
}
}

View file

@ -13,6 +13,17 @@ import java.util.Random;
public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcceptor{ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcceptor{
public static class TileEntityGrinderDouble extends TileEntityGrinder{
public TileEntityGrinderDouble(){
super(8, "grinderDouble");
this.isDouble = true;
this.maxCrushTime = this.getStandardSpeed();
this.speedUpgradeSlot = 7;
}
}
public static final int SLOT_COAL = 0; public static final int SLOT_COAL = 0;
public static final int SLOT_INPUT_1 = 1; public static final int SLOT_INPUT_1 = 1;
public static final int SLOT_OUTPUT_1_1 = 2; public static final int SLOT_OUTPUT_1_1 = 2;
@ -31,15 +42,15 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
public boolean isDouble; public boolean isDouble;
public TileEntityGrinder(){ public TileEntityGrinder(int slots, String name){
super(0, ""); super(slots, name);
} }
public TileEntityGrinder(boolean isDouble){ public TileEntityGrinder(){
super(isDouble ? 8 : 5, isDouble ? "grinderDouble" : "grinder"); super(5, "grinder");
this.isDouble = false;
this.maxCrushTime = this.getStandardSpeed(); this.maxCrushTime = this.getStandardSpeed();
this.isDouble = isDouble; this.speedUpgradeSlot = 4;
this.speedUpgradeSlot = isDouble ? 7 : 4;
} }
@Override @Override
@ -139,9 +150,6 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
compound.setInteger("CoalTimeLeft", this.coalTimeLeft); compound.setInteger("CoalTimeLeft", this.coalTimeLeft);
compound.setInteger("FirstCrushTime", this.firstCrushTime); compound.setInteger("FirstCrushTime", this.firstCrushTime);
compound.setInteger("SecondCrushTime", this.secondCrushTime); compound.setInteger("SecondCrushTime", this.secondCrushTime);
compound.setBoolean("IsDouble", this.isDouble);
compound.setString("Name", this.name);
compound.setInteger("Slots", this.slots.length);
super.writeToNBT(compound); super.writeToNBT(compound);
} }
@ -151,12 +159,6 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc
this.coalTimeLeft = compound.getInteger("CoalTimeLeft"); this.coalTimeLeft = compound.getInteger("CoalTimeLeft");
this.firstCrushTime = compound.getInteger("FirstCrushTime"); this.firstCrushTime = compound.getInteger("FirstCrushTime");
this.secondCrushTime = compound.getInteger("SecondCrushTime"); this.secondCrushTime = compound.getInteger("SecondCrushTime");
this.isDouble = compound.getBoolean("IsDouble");
this.name = compound.getString("Name");
this.maxCrushTime = this.getStandardSpeed();
this.speedUpgradeSlot = isDouble ? 7 : 4;
int slots = compound.getInteger("Slots");
this.initializeSlots(slots == 0 ? 5 : slots);
super.readFromNBT(compound); super.readFromNBT(compound);
} }

View file

@ -9,6 +9,15 @@ import net.minecraft.tileentity.TileEntity;
public class TileEntityInputter extends TileEntityInventoryBase{ public class TileEntityInputter extends TileEntityInventoryBase{
public static class TileEntityInputterAdvanced extends TileEntityInputter{
public TileEntityInputterAdvanced(){
super(13, "inputterAdvanced");
this.isAdvanced = true;
}
}
public static final int PUT_FILTER_START = 1; public static final int PUT_FILTER_START = 1;
public static final int PULL_FILTER_START = 7; public static final int PULL_FILTER_START = 7;
@ -24,13 +33,13 @@ public class TileEntityInputter extends TileEntityInventoryBase{
public boolean isAdvanced; public boolean isAdvanced;
public TileEntityInputter(){ public TileEntityInputter(int slots, String name){
super(0, ""); super(slots, name);
} }
public TileEntityInputter(boolean isAdvanced){ public TileEntityInputter(){
super(isAdvanced ? 13 : 1, isAdvanced ? "inputterAdvanced" : "inputter"); super(1, "inputter");
this.isAdvanced = isAdvanced; this.isAdvanced = false;
} }
@Override @Override
@ -177,8 +186,9 @@ public class TileEntityInputter extends TileEntityInventoryBase{
} }
public void initVars(){ public void initVars(){
this.placeToPull = WorldUtil.getTileEntityFromSide(this.sideToPull, this.worldObj, this.xCoord, this.yCoord, this.zCoord);
this.placeToPut = WorldUtil.getTileEntityFromSide(this.sideToPut, this.worldObj, this.xCoord, this.yCoord, this.zCoord); this.placeToPull = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionByRotatingSide(this.sideToPull), this.worldObj, this.xCoord, this.yCoord, this.zCoord);
this.placeToPut = WorldUtil.getTileEntityFromSide(WorldUtil.getDirectionByRotatingSide(this.sideToPut), this.worldObj, this.xCoord, this.yCoord, this.zCoord);
if(this.placeToPull != null && this.placeToPull instanceof IInventory){ if(this.placeToPull != null && this.placeToPull instanceof IInventory){
this.placeToPullSlotAmount = ((IInventory)this.placeToPull).getSizeInventory(); this.placeToPullSlotAmount = ((IInventory)this.placeToPull).getSizeInventory();
@ -225,21 +235,14 @@ public class TileEntityInputter extends TileEntityInventoryBase{
compound.setInteger("SlotToPut", this.slotToPut); compound.setInteger("SlotToPut", this.slotToPut);
compound.setInteger("SideToPull", this.sideToPull); compound.setInteger("SideToPull", this.sideToPull);
compound.setInteger("SlotToPull", this.slotToPull); compound.setInteger("SlotToPull", this.slotToPull);
compound.setBoolean("IsAdvanced", this.isAdvanced);
compound.setString("Name", this.name);
compound.setInteger("Slots", this.slots.length);
} }
@Override @Override
public void readFromNBT(NBTTagCompound compound){ public void readFromNBT(NBTTagCompound compound){
int slots = compound.getInteger("Slots");
this.initializeSlots(slots == 0 ? 1 : slots);
this.sideToPut = compound.getInteger("SideToPut"); this.sideToPut = compound.getInteger("SideToPut");
this.slotToPut = compound.getInteger("SlotToPut"); this.slotToPut = compound.getInteger("SlotToPut");
this.sideToPull = compound.getInteger("SideToPull"); this.sideToPull = compound.getInteger("SideToPull");
this.slotToPull = compound.getInteger("SlotToPull"); this.slotToPull = compound.getInteger("SlotToPull");
this.isAdvanced = compound.getBoolean("IsAdvanced");
this.name = compound.getString("Name");
super.readFromNBT(compound); super.readFromNBT(compound);
} }

View file

@ -17,6 +17,7 @@ import java.net.URL;
public class UpdateChecker{ public class UpdateChecker{
public boolean doneChecking = false; public boolean doneChecking = false;
public boolean checkFailed = false;
public boolean notified = false; public boolean notified = false;
public String onlineVersion; public String onlineVersion;
@ -29,9 +30,11 @@ public class UpdateChecker{
@SubscribeEvent @SubscribeEvent
public void onTick(TickEvent.ClientTickEvent event){ public void onTick(TickEvent.ClientTickEvent event){
if(doneChecking && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !notified){ if(doneChecking && event.phase == TickEvent.Phase.END && Minecraft.getMinecraft().thePlayer != null && !notified){
if(onlineVersion.length() > 0){
EntityPlayer player = Minecraft.getMinecraft().thePlayer; EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if(checkFailed){
player.addChatComponentMessage(IChatComponent.Serializer.func_150699_a(StatCollector.translateToLocal("info." + ModUtil.MOD_ID_LOWER + ".update.failed.desc")));
}
else if(onlineVersion.length() > 0){
int update = Integer.parseInt(onlineVersion.replace("-", "").replace(".", "")); int update = Integer.parseInt(onlineVersion.replace("-", "").replace(".", ""));
int client = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", "")); int client = Integer.parseInt(ModUtil.VERSION.replace("-", "").replace(".", ""));
@ -69,6 +72,7 @@ public class UpdateChecker{
} }
catch(Exception e){ catch(Exception e){
ModUtil.AA_LOGGER.log(Level.ERROR, "Update Check failed!"); ModUtil.AA_LOGGER.log(Level.ERROR, "Update Check failed!");
checkFailed = true;
e.printStackTrace(); e.printStackTrace();
} }
doneChecking = true; doneChecking = true;

View file

@ -17,26 +17,13 @@ public class BlockUtil{
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void addInformation(Block block, List list, int lines, String extraName, String extraOredictName){ public static void addInformation(Block block, List list, int lines, String extraName){
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
for(int i = 0; i < lines; i++){ for(int i = 0; i < lines; i++){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : ""))); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)block).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : "")));
} }
} }
else list.add(ItemUtil.shiftForInfo()); else list.add(ItemUtil.shiftForInfo());
if(KeyUtil.isControlPressed()){
addOredictName(extraOredictName, list);
}
}
public static void addInformation(Block block, List list, int lines, String extraName){
addInformation(block, list, lines, extraName, ((INameableItem)block).getOredictName());
}
@SuppressWarnings("unchecked")
public static void addOredictName(String name, List list){
list.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".oredictName.desc") + ": " + name);
} }
public static void register(Block block, Class<? extends ItemBlock> itemBlock, Enum[] list){ public static void register(Block block, Class<? extends ItemBlock> itemBlock, Enum[] list){
@ -52,7 +39,7 @@ public class BlockUtil{
block.setCreativeTab(CreativeTab.instance); block.setCreativeTab(CreativeTab.instance);
block.setBlockName(createUnlocalizedName(block)); block.setBlockName(createUnlocalizedName(block));
GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName()); GameRegistry.registerBlock(block, itemBlock, ((INameableItem)block).getName());
if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), block); if(!((INameableItem)block).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)block).getOredictName(), new ItemStack(block, 1, Util.WILDCARD));
} }
} }

View file

@ -0,0 +1,21 @@
package ellpeck.actuallyadditions.util;
import com.mojang.authlib.GameProfile;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.FakePlayer;
import java.util.UUID;
public class FakePlayerUtil{
public static final String fakeName = "EllpecksActuallyAdditionsFakePlayer";
public static GameProfile fakeProfile = new GameProfile(UUID.nameUUIDFromBytes(fakeName.getBytes()), fakeName);
public static FakePlayer newFakePlayer(World world){
if(world instanceof WorldServer){
return new FakePlayer((WorldServer)world, fakeProfile);
}
else return null;
}
}

View file

@ -11,25 +11,15 @@ import java.util.List;
public class ItemUtil{ public class ItemUtil{
public static void addInformation(Item item, List list, int lines, String extraName){
addInformation(item, list, lines, extraName, ((INameableItem)item).getOredictName());
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static void addInformation(Item item, List list, int lines, String extraName, String extraOredictName){ public static void addInformation(Item item, List list, int lines, String extraName){
if(KeyUtil.isShiftPressed()){ if(KeyUtil.isShiftPressed()){
for(int i = 0; i < lines; i++){ for(int i = 0; i < lines; i++){
list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)item).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : ""))); list.add(StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + "." + ((INameableItem)item).getName() + extraName + ".desc" + (lines > 1 ? "." +(i+1) : "")));
} }
} }
else list.add(shiftForInfo()); else list.add(shiftForInfo());
if(KeyUtil.isControlPressed()){
addOredictName(extraOredictName, list);
} }
}
public static void registerItems(Item[] items){ public static void registerItems(Item[] items){
for(Item item : items){ for(Item item : items){
@ -37,16 +27,11 @@ public class ItemUtil{
} }
} }
@SuppressWarnings("unchecked")
public static void addOredictName(String name, List list){
list.add(StringUtil.GRAY + StatCollector.translateToLocal("tooltip." + ModUtil.MOD_ID_LOWER + ".oredictName.desc") + ": " + name);
}
public static void register(Item item){ public static void register(Item item){
item.setCreativeTab(CreativeTab.instance); item.setCreativeTab(CreativeTab.instance);
item.setUnlocalizedName(createUnlocalizedName(item)); item.setUnlocalizedName(createUnlocalizedName(item));
GameRegistry.registerItem(item, ((INameableItem)item).getName()); GameRegistry.registerItem(item, ((INameableItem)item).getName());
if(!((INameableItem)item).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)item).getOredictName(), item); if(!((INameableItem)item).getOredictName().isEmpty()) OreDictionary.registerOre(((INameableItem)item).getOredictName(), new ItemStack(item, 1, Util.WILDCARD));
} }
public static void register(Item item, Enum[] list){ public static void register(Item item, Enum[] list){

View file

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

View file

@ -1,45 +1,66 @@
package ellpeck.actuallyadditions.util; package ellpeck.actuallyadditions.util;
import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.util.ForgeDirection;
public class WorldUtil{ public class WorldUtil{
public static ChunkCoordinates getCoordsFromSide(int side, int x, int y, int z){ public static ChunkCoordinates getCoordsFromSide(ForgeDirection side, int x, int y, int z){
if(side == 0) return new ChunkCoordinates(x, y + 1, z); if(side == ForgeDirection.UNKNOWN) return null;
if(side == 1) return new ChunkCoordinates(x, y - 1, z); return new ChunkCoordinates(x+side.offsetX, y+side.offsetY, z+side.offsetZ);
if(side == 2) return new ChunkCoordinates(x, y, z - 1);
if(side == 3) return new ChunkCoordinates(x + 1, y, z);
if(side == 4) return new ChunkCoordinates(x, y, z + 1);
if(side == 5) return new ChunkCoordinates(x - 1, y, z);
else return null;
} }
public static void breakBlockAtSide(int side, World world, int x, int y, int z){ public static void breakBlockAtSide(ForgeDirection side, World world, int x, int y, int z){
ChunkCoordinates c = getCoordsFromSide(side, x, y, z); ChunkCoordinates c = getCoordsFromSide(side, x, y, z);
if(c != null){ if(c != null){
world.setBlockToAir(c.posX, c.posY, c.posZ); world.setBlockToAir(c.posX, c.posY, c.posZ);
} }
} }
public static void placeBlockAtSide(int side, World world, int x, int y, int z, ItemStack stack){ public static boolean placeBlockAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
Block block = Block.getBlockFromItem(stack.getItem()); if(world instanceof WorldServer){
int meta = stack.getItem().getDamage(stack); if(side != ForgeDirection.UNKNOWN){
ChunkCoordinates c = getCoordsFromSide(side, x, y, z); return stack.tryPlaceItemIntoWorld(FakePlayerUtil.newFakePlayer(world), world, x, y, z, side.ordinal(), 0, 0, 0);
if(c != null){
world.setBlock(c.posX, c.posY, c.posZ, block, meta, 2);
} }
} }
return false;
}
public static TileEntity getTileEntityFromSide(int side, World world, int x, int y, int z){ public static boolean dropItemAtSide(ForgeDirection side, World world, int x, int y, int z, ItemStack stack){
if(side != ForgeDirection.UNKNOWN){
ChunkCoordinates coords = getCoordsFromSide(side, x, y, z);
if(coords != null){
EntityItem item = new EntityItem(world, coords.posX+0.5, coords.posY+0.5, coords.posZ+0.5, stack);
item.motionX = 0;
item.motionY = 0;
item.motionZ = 0;
world.spawnEntityInWorld(item);
}
}
return false;
}
public static TileEntity getTileEntityFromSide(ForgeDirection side, World world, int x, int y, int z){
ChunkCoordinates c = getCoordsFromSide(side, x, y, z); ChunkCoordinates c = getCoordsFromSide(side, x, y, z);
if(c != null){ if(c != null){
return world.getTileEntity(c.posX, c.posY, c.posZ); return world.getTileEntity(c.posX, c.posY, c.posZ);
} }
else return null; return null;
}
public static ForgeDirection getDirectionByRotatingSide(int side){
if(side == 0) return ForgeDirection.UP;
if(side == 1) return ForgeDirection.DOWN;
if(side == 2) return ForgeDirection.NORTH;
if(side == 3) return ForgeDirection.EAST;
if(side == 4) return ForgeDirection.SOUTH;
if(side == 5) return ForgeDirection.WEST;
else return ForgeDirection.UNKNOWN;
} }
} }

View file

@ -19,8 +19,10 @@ tile.actuallyadditions.blockItemRepairer.name=Item Repairer
tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing tile.actuallyadditions.blockMiscWoodCasing.name=Wood Casing
tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing tile.actuallyadditions.blockMiscStoneCasing.name=Stone Casing
tile.actuallyadditions.blockGreenhouseGlass.name=Greenhouse Glass tile.actuallyadditions.blockGreenhouseGlass.name=Greenhouse Glass
tile.actuallyadditions.blockBreaker.name=Breaker
tile.actuallyadditions.blockPlacer.name=Placer tile.actuallyadditions.blockBreaker.name=Auto-Breaker
tile.actuallyadditions.blockPlacer.name=Auto-Placer
tile.actuallyadditions.blockDropper.name=Automatic Precision Dropper
tile.actuallyadditions.blockInputter.name=ESD tile.actuallyadditions.blockInputter.name=ESD
tile.actuallyadditions.blockInputterAdvanced.name=Advanced ESD tile.actuallyadditions.blockInputterAdvanced.name=Advanced ESD
@ -88,7 +90,7 @@ item.actuallyadditions.itemFoodCarrotJuice.name=Carrot Juice
item.actuallyadditions.itemFoodPumpkinStew.name=Pumpkin Stew item.actuallyadditions.itemFoodPumpkinStew.name=Pumpkin Stew
item.actuallyadditions.itemFoodCheese.name=Cheese item.actuallyadditions.itemFoodCheese.name=Cheese
item.actuallyadditions.itemUpgradeSpeed=Speed Upgrade item.actuallyadditions.itemUpgradeSpeed.name=Speed Upgrade
item.actuallyadditions.itemMiscCoil.name=Basic Coil item.actuallyadditions.itemMiscCoil.name=Basic Coil
item.actuallyadditions.itemMiscCoilAdvanced.name=Advanced Coil item.actuallyadditions.itemMiscCoilAdvanced.name=Advanced Coil
@ -116,7 +118,9 @@ tooltip.actuallyadditions.shiftForInfo.desc=Press Shift for Info
tooltip.actuallyadditions.hunger.desc=Fills tooltip.actuallyadditions.hunger.desc=Fills
tooltip.actuallyadditions.saturation.desc=Saturation tooltip.actuallyadditions.saturation.desc=Saturation
tooltip.actuallyadditions.durability.desc=Durability tooltip.actuallyadditions.durability.desc=Durability
tooltip.actuallyadditions.oredictName.desc=OreDictionary Name
tooltip.actuallyadditions.oredictName.desc=OreDictionary Entries
tooltip.actuallyadditions.noOredictNameAvail.desc=Has No OreDictionary Entries
tooltip.actuallyadditions.itemJam.desc.1=A delicious Jam consisting of tooltip.actuallyadditions.itemJam.desc.1=A delicious Jam consisting of
tooltip.actuallyadditions.itemJam.desc.2=Also gives you some Effects! tooltip.actuallyadditions.itemJam.desc.2=Also gives you some Effects!
@ -127,6 +131,54 @@ tooltip.actuallyadditions.itemJamChApCi.desc=Cherry, Apple and Cinnamon
tooltip.actuallyadditions.itemJamHoMeKi.desc=Honeydew Melon and Kiwi tooltip.actuallyadditions.itemJamHoMeKi.desc=Honeydew Melon and Kiwi
tooltip.actuallyadditions.itemJamPiCo.desc=Pineapple and Coconut tooltip.actuallyadditions.itemJamPiCo.desc=Pineapple and Coconut
tile.actuallyadditions.blockCompactIronSingle.name=Single Compact Iron
tile.actuallyadditions.blockCompactIronDouble.name=Double Compact Iron
tile.actuallyadditions.blockCompactIronTriple.name=Triple Compact Iron
tile.actuallyadditions.blockCompactIronQuadruple.name=Quadruple Compact Iron
tile.actuallyadditions.blockCompactIronQuintuple.name=Quintuple Compact Iron
tile.actuallyadditions.blockCompactIronSextuple.name=Sextuple Compact Iron
tooltip.actuallyadditions.blockCompactIron.desc=Iron, but bunched together!
tile.actuallyadditions.blockCompactGoldSingle.name=Single Compact Gold
tile.actuallyadditions.blockCompactGoldDouble.name=Double Compact Gold
tile.actuallyadditions.blockCompactGoldTriple.name=Triple Compact Gold
tile.actuallyadditions.blockCompactGoldQuadruple.name=Quadruple Compact Gold
tile.actuallyadditions.blockCompactGoldQuintuple.name=Quintuple Compact Gold
tile.actuallyadditions.blockCompactGoldSextuple.name=Sextuple Compact Gold
tooltip.actuallyadditions.blockCompactGold.desc=Gold, but bunched together!
tile.actuallyadditions.blockCompactDiamondSingle.name=Single Compact Diamond
tile.actuallyadditions.blockCompactDiamondDouble.name=Double Compact Diamond
tile.actuallyadditions.blockCompactDiamondTriple.name=Triple Compact Diamond
tile.actuallyadditions.blockCompactDiamondQuadruple.name=Quadruple Compact Diamond
tile.actuallyadditions.blockCompactDiamondQuintuple.name=Quintuple Compact Diamond
tile.actuallyadditions.blockCompactDiamondSextuple.name=Sextuple Compact Diamond
tooltip.actuallyadditions.blockCompactDiamond.desc=Diamond, but bunched together!
tile.actuallyadditions.blockCompactRedstoneSingle.name=Single Compact Redstone
tile.actuallyadditions.blockCompactRedstoneDouble.name=Double Compact Redstone
tile.actuallyadditions.blockCompactRedstoneTriple.name=Triple Compact Redstone
tile.actuallyadditions.blockCompactRedstoneQuadruple.name=Quadruple Compact Redstone
tile.actuallyadditions.blockCompactRedstoneQuintuple.name=Quintuple Compact Redstone
tile.actuallyadditions.blockCompactRedstoneSextuple.name=Sextuple Compact Redstone
tooltip.actuallyadditions.blockCompactRedstone.desc=Redstone, but bunched together!
tile.actuallyadditions.blockCompactCoalSingle.name=Single Compact Coal
tile.actuallyadditions.blockCompactCoalDouble.name=Double Compact Coal
tile.actuallyadditions.blockCompactCoalTriple.name=Triple Compact Coal
tile.actuallyadditions.blockCompactCoalQuadruple.name=Quadruple Compact Coal
tile.actuallyadditions.blockCompactCoalQuintuple.name=Quintuple Compact Coal
tile.actuallyadditions.blockCompactCoalSextuple.name=Sextuple Compact Coal
tooltip.actuallyadditions.blockCompactCoal.desc=Coal, but bunched together!
tile.actuallyadditions.blockCompactLapisSingle.name=Single Compact Lapis
tile.actuallyadditions.blockCompactLapisDouble.name=Double Compact Lapis
tile.actuallyadditions.blockCompactLapisTriple.name=Triple Compact Lapis
tile.actuallyadditions.blockCompactLapisQuadruple.name=Quadruple Compact Lapis
tile.actuallyadditions.blockCompactLapisQuintuple.name=Quintuple Compact Lapis
tile.actuallyadditions.blockCompactLapisSextuple.name=Sextuple Compact Lapis
tooltip.actuallyadditions.blockCompactLapis.desc=Lapis, but bunched together!
tooltip.actuallyadditions.itemUpgradeSpeed.desc.1=Speeds up Machines when placed in their Upgrade Slot tooltip.actuallyadditions.itemUpgradeSpeed.desc.1=Speeds up Machines when placed in their Upgrade Slot
tooltip.actuallyadditions.itemUpgradeSpeed.desc.2=Works in: tooltip.actuallyadditions.itemUpgradeSpeed.desc.2=Works in:
tooltip.actuallyadditions.itemUpgradeSpeed.desc.3=-Double Furnace tooltip.actuallyadditions.itemUpgradeSpeed.desc.3=-Double Furnace
@ -161,8 +213,10 @@ tooltip.actuallyadditions.blockHeatCollector.desc.1=Powers Actually Additions Ma
tooltip.actuallyadditions.blockHeatCollector.desc.2=Needs a bunch of Lava around it tooltip.actuallyadditions.blockHeatCollector.desc.2=Needs a bunch of Lava around it
tooltip.actuallyadditions.blockHeatCollector.desc.3=Occasionally steals the Lava. Watch out! tooltip.actuallyadditions.blockHeatCollector.desc.3=Occasionally steals the Lava. Watch out!
tooltip.actuallyadditions.blockItemRepairer.desc=Repairs Tools and Armor automatically tooltip.actuallyadditions.blockItemRepairer.desc=Repairs Tools and Armor automatically
tooltip.actuallyadditions.blockBreaker.desc=Breaks Blocks and stores them in its internal Inventory tooltip.actuallyadditions.blockBreaker.desc=Breaks Blocks and stores them in its internal Inventory
tooltip.actuallyadditions.blockPlacer.desc=Places Blocks stored in its internal Inventory tooltip.actuallyadditions.blockPlacer.desc=Places Blocks stored in its internal Inventory
tooltip.actuallyadditions.blockDropper.desc=Drops Items automatically (Without spewing them all over the Place!)
tooltip.actuallyadditions.itemMiscMashedFood.desc=Used to make Fertilizer tooltip.actuallyadditions.itemMiscMashedFood.desc=Used to make Fertilizer
tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost. tooltip.actuallyadditions.itemFertilizer.desc=Om nom nom. Don't eat it. Made in a Compost.
@ -277,6 +331,7 @@ container.actuallyadditions.giantChest.name=Storage Crate
container.actuallyadditions.repairer.name=Repairer container.actuallyadditions.repairer.name=Repairer
container.actuallyadditions.placer.name=Placer container.actuallyadditions.placer.name=Placer
container.actuallyadditions.breaker.name=Breaker container.actuallyadditions.breaker.name=Breaker
container.actuallyadditions.dropper.name=Precision Dropper
container.actuallyadditions.crafting.name=Crafting Table On A Stick container.actuallyadditions.crafting.name=Crafting Table On A Stick
container.actuallyadditions.nei.crushing.name=Crusher container.actuallyadditions.nei.crushing.name=Crusher
@ -288,6 +343,7 @@ gui.actuallyadditions.waila.compostConverting.name=Converting...
info.actuallyadditions.update.generic.desc=[{"text":"There is an "},{"text":"Update ","bold":"true"},{"text":"for ","bold":"false"},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"available!","color":"none","bold":"false"}] info.actuallyadditions.update.generic.desc=[{"text":"There is an "},{"text":"Update ","bold":"true"},{"text":"for ","bold":"false"},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"available!","color":"none","bold":"false"}]
info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"text":"%s","color":"dark_red","italic":"false"},{"text":", the newest one is ","color":"none","italic":"false"},{"text":"%s","color":"dark_green","underlined":"false"},{"text":"!","color":"none","underlined":"false"}] info.actuallyadditions.update.versionComp.desc=[{"text":"You have Version "},{"text":"%s","color":"dark_red","italic":"false"},{"text":", the newest one is ","color":"none","italic":"false"},{"text":"%s","color":"dark_green","underlined":"false"},{"text":"!","color":"none","underlined":"false"}]
info.actuallyadditions.update.download.desc=[{"text":"Download the newest Version "},{"text":"here! (Click me!)","color":"dark_green","underlined":"true","clickEvent":{"action":"open_url","value":"%s"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click here to open your Browser and download the newest Version!"}]}}}] info.actuallyadditions.update.download.desc=[{"text":"Download the newest Version "},{"text":"here! (Click me!)","color":"dark_green","underlined":"true","clickEvent":{"action":"open_url","value":"%s"},"hoverEvent":{"action":"show_text","value":{"text":"","extra":[{"text":"Click here to open your Browser and download the newest Version!"}]}}}]
info.actuallyadditions.update.failed.desc=[{"text":"The Update Check for "},{"text":"Actually Additions ","color":"dark_green","bold":"true"},{"text":"failed! Check your Internet Connection and the Logs for more Info!","color":"none"}]
achievement.actuallyadditions.pickUpSolidXP=Hard and Rich and Stuff achievement.actuallyadditions.pickUpSolidXP=Hard and Rich and Stuff
achievement.actuallyadditions.pickUpSolidXP.desc=Pick up some Solidified Experience achievement.actuallyadditions.pickUpSolidXP.desc=Pick up some Solidified Experience

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 651 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

View file

@ -3,7 +3,7 @@
"modid": "ActuallyAdditions", "modid": "ActuallyAdditions",
"name": "Actually Additions", "name": "Actually Additions",
"description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!", "description": "Actually Additions is a Mod that offers a bunch of things from Machines for Automation and tons of food to advanced Hopper Mechanisms and Effect Rings!",
"version": "0.0.4.2", "version": "0.0.4.3",
"mcversion": "1.7.10", "mcversion": "1.7.10",
"url": "https://github.com/Ellpeck/ActuallyAdditions", "url": "https://github.com/Ellpeck/ActuallyAdditions",
"updateUrl": "", "updateUrl": "",