diff --git a/build.gradle b/build.gradle index 4fc4b5d1f..c5b1c8c5b 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ buildscript { apply plugin: 'forge' apply plugin: 'maven' -version = "1.7.10-0.0.4.3" +version = "1.7.10-0.0.4.4" group = "ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" diff --git a/newestVersion.txt b/newestVersion.txt index d4ec1fbbc..b3a35a712 100644 --- a/newestVersion.txt +++ b/newestVersion.txt @@ -1 +1 @@ -1.7.10-0.0.4.3 \ No newline at end of file +1.7.10-0.0.4.4 \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java index 63b653816..1f13cd985 100644 --- a/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/blocks/BlockGrinder.java @@ -29,7 +29,7 @@ public class BlockGrinder extends BlockContainerBase implements INameableItem{ private IIcon onIcon; private IIcon bottomIcon; - private boolean isDouble; + private final boolean isDouble; public BlockGrinder(boolean isDouble){ super(Material.rock); diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java index 9c246564c..8c65da1ec 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigBoolValues.java @@ -22,7 +22,9 @@ public enum ConfigBoolValues{ 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"); + DO_CRUSHER_SPAM("Crusher Debug", ConfigCategories.OTHER, false, "Print out Crusher Recipe Initializing Debug"), + + DO_CAT_DROPS("Do Cat Drops", ConfigCategories.OTHER, true, "If Cats drop Hairy Balls on Occasion"); public final String name; public final String category; diff --git a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java index 65944bf6c..80df3d523 100644 --- a/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java +++ b/src/main/java/ellpeck/actuallyadditions/config/values/ConfigIntValues.java @@ -19,7 +19,7 @@ public enum ConfigIntValues{ 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"), + FISHER_TIME("Fishing Net: Time Needed", ConfigCategories.MACHINE_VALUES, 10000, 50, 500000, "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"), @@ -39,14 +39,16 @@ public enum ConfigIntValues{ 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"), + REPAIRER_SPEED_SLOWDOWN("Item Repairer: Speed Slowdown", ConfigCategories.MACHINE_VALUES, 3, 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"); + DROPPER_TIME_NEEDED("Dropper: Time Needed", ConfigCategories.MACHINE_VALUES, 10, 1, 10000, "The Time Needed for the Dropper to drop an Item"), + + CAT_DROP_CHANCE("Cat Drops: Chance", ConfigCategories.OTHER, 5000, 5, 10000000, "The 1 in X chance for a Hairy Ball to Drop from a Cat with X being this value"); public final String name; public final String category; diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java index acadece1b..6e174270e 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/BlockCrafting.java @@ -58,7 +58,7 @@ public class BlockCrafting{ 'D', "gemDiamond", 'I', "ingotIron", 'O', TheMiscItems.COIL.getOredictName(), - 'C', TheMiscBlocks.STONE_CASING.getOredictName())); + 'C', Items.nether_star)); //Solar Panel /*if(ConfigCrafting.SOLAR_PANEL.isEnabled()) diff --git a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java index b5cb88347..a75b29265 100644 --- a/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java +++ b/src/main/java/ellpeck/actuallyadditions/crafting/GrinderCrafting.java @@ -4,7 +4,6 @@ import ellpeck.actuallyadditions.items.InitItems; 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.util.Util; import net.minecraft.init.Blocks; @@ -19,10 +18,15 @@ public class GrinderCrafting{ public static void init(){ Util.logInfo("Initializing Crusher Recipes..."); - grindRec.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.redstone_ore), new ItemStack(Items.redstone, 10), 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)); + + grindRec.registerRecipe("cobblestone", "sand"); + grindRec.registerRecipe(new ItemStack(Blocks.gravel), new ItemStack(Items.flint)); + grindRec.registerRecipe("stone", "cobblestone"); + + grindRec.registerRecipe("oreNickel", "dustNickel", "dustPlatinum", 30, 2); + grindRec.registerRecipe("oreIron", "dustIron", "dustGold", 20, 2); grindRecHan.searchCases.add(new SearchCase("ore", 2)); grindRecHan.searchCases.add(new SearchCase("oreNether", 6)); diff --git a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java index a6f6b816a..7a15a5fbd 100644 --- a/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java +++ b/src/main/java/ellpeck/actuallyadditions/creative/CreativeTab.java @@ -47,6 +47,7 @@ public class CreativeTab extends CreativeTabs{ this.addBlock(InitBlocks.blockCompost); this.addBlock(InitBlocks.blockGiantChest); + this.addItem(InitItems.itemHairyBall); this.addItem(InitItems.itemSpeedUpgrade); this.addItem(InitItems.itemMisc); this.addItem(InitItems.itemFertilizer); diff --git a/src/main/java/ellpeck/actuallyadditions/event/EntityLivingEvent.java b/src/main/java/ellpeck/actuallyadditions/event/EntityLivingEvent.java new file mode 100644 index 000000000..ea6520261 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/event/EntityLivingEvent.java @@ -0,0 +1,31 @@ +package ellpeck.actuallyadditions.event; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import ellpeck.actuallyadditions.config.values.ConfigBoolValues; +import ellpeck.actuallyadditions.config.values.ConfigIntValues; +import ellpeck.actuallyadditions.items.InitItems; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.passive.EntityOcelot; +import net.minecraft.item.ItemStack; +import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; + +import java.util.Random; + +public class EntityLivingEvent{ + + @SubscribeEvent + public void livingUpdateEvent(LivingUpdateEvent event){ + if(!event.entityLiving.worldObj.isRemote){ + if(event.entityLiving instanceof EntityOcelot){ + EntityOcelot theOcelot = (EntityOcelot)event.entityLiving; + if(ConfigBoolValues.DO_CAT_DROPS.isEnabled() && theOcelot.isTamed()){ + if(new Random().nextInt(ConfigIntValues.CAT_DROP_CHANCE.getValue())+1 == 1){ + EntityItem item = new EntityItem(theOcelot.worldObj, theOcelot.posX + 0.5, theOcelot.posY + 0.5, theOcelot.posZ + 0.5, new ItemStack(InitItems.itemHairyBall)); + theOcelot.worldObj.spawnEntityInWorld(item); + } + } + } + } + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java index 71c28a16d..d087f1b95 100644 --- a/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java +++ b/src/main/java/ellpeck/actuallyadditions/event/InitEvents.java @@ -12,6 +12,7 @@ public class InitEvents{ Util.registerEvent(new KilledEvent()); Util.registerEvent(new PickupEvent()); Util.registerEvent(new TooltipEvent()); + Util.registerEvent(new EntityLivingEvent()); } } diff --git a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java index c0062a2c5..703d497f0 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/InitItems.java +++ b/src/main/java/ellpeck/actuallyadditions/items/InitItems.java @@ -2,6 +2,7 @@ package ellpeck.actuallyadditions.items; import ellpeck.actuallyadditions.items.tools.*; import ellpeck.actuallyadditions.material.InitItemMaterials; +import ellpeck.actuallyadditions.recipe.HairyBallHandler; import ellpeck.actuallyadditions.util.ItemUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.init.Blocks; @@ -40,6 +41,8 @@ public class InitItems{ public static Item itemSpeedUpgrade; + public static Item itemHairyBall; + public static void init(){ Util.logInfo("Initializing Items..."); @@ -82,6 +85,10 @@ public class InitItems{ itemSpeedUpgrade = new ItemUpgrade(ItemUpgrade.UpgradeType.SPEED, "itemUpgradeSpeed", 2+3); ItemUtil.register(itemSpeedUpgrade); + itemHairyBall = new ItemHairyBall(); + ItemUtil.register(itemHairyBall); + HairyBallHandler.init(); + itemPickaxeEmerald = new ItemPickaxeAA(InitItemMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "itemPickaxeEmerald", 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); diff --git a/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java b/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java new file mode 100644 index 000000000..3f6482ab0 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/items/ItemHairyBall.java @@ -0,0 +1,74 @@ +package ellpeck.actuallyadditions.items; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import ellpeck.actuallyadditions.recipe.HairyBallHandler; +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.item.EntityItem; +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 net.minecraft.util.WeightedRandom; +import net.minecraft.world.World; + +import java.util.List; +import java.util.Random; + +public class ItemHairyBall extends Item implements INameableItem{ + + @Override + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + if(!world.isRemote){ + ItemStack returnItem = this.getRandomReturnItem(); + if(!player.inventory.addItemStackToInventory(returnItem)){ + EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem); + entityItem.delayBeforeCanPickup = 0; + player.worldObj.spawnEntityInWorld(entityItem); + } + stack.stackSize--; + } + return stack; + } + + public ItemStack getRandomReturnItem(){ + return ((HairyBallHandler.Return)WeightedRandom.getRandomItem(new Random(), HairyBallHandler.returns)).returnItem.copy(); + } + + @Override + public EnumRarity getRarity(ItemStack stack){ + return EnumRarity.epic; + } + + @Override + @SuppressWarnings("unchecked") + @SideOnly(Side.CLIENT) + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isHeld) { + ItemUtil.addInformation(this, list, 2, ""); + } + + @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 "itemHairyBall"; + } + + @Override + public String getOredictName(){ + return this.getName(); + } +} diff --git a/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java b/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java index 3e08a50c9..a5904b898 100644 --- a/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java +++ b/src/main/java/ellpeck/actuallyadditions/items/metalists/ThePotionRings.java @@ -8,17 +8,17 @@ import net.minecraft.item.ItemStack; public enum ThePotionRings implements INameableItem{ - SPEED("Speed", 8171462, 1, 0, 3, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)), + SPEED("Speed", 8171462, 1, 0, 1, 10, false, EnumRarity.uncommon, new ItemStack(Items.sugar)), //TODO Slowness - HASTE("Haste", 14270531, 3, 0, 3, 10, false, EnumRarity.epic, new ItemStack(Items.repeater)), + HASTE("Haste", 14270531, 3, 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.repeater)), //TODO Mining Fatigue - STRENGTH("Strength", 9643043, 5, 0, 3, 10, false, EnumRarity.rare, new ItemStack(Items.blaze_powder)), + STRENGTH("Strength", 9643043, 5, 0, 1, 10, false, EnumRarity.rare, new ItemStack(Items.blaze_powder)), //Health (Not Happening) //TODO Damage - JUMP_BOOST("JumpBoost", 7889559, 8, 0, 3, 10, false, EnumRarity.rare, new ItemStack(Blocks.piston)), + JUMP_BOOST("JumpBoost", 7889559, 8, 0, 1, 10, false, EnumRarity.rare, new ItemStack(Blocks.piston)), //TODO Nausea - REGEN("Regen", 13458603, 10, 0, 3, 50, true, EnumRarity.rare, new ItemStack(Items.ghast_tear)), - RESISTANCE("Resistance", 10044730, 11, 0, 3, 10, false, EnumRarity.epic, new ItemStack(Items.slime_ball)), + REGEN("Regen", 13458603, 10, 0, 1, 50, true, EnumRarity.rare, new ItemStack(Items.ghast_tear)), + RESISTANCE("Resistance", 10044730, 11, 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.slime_ball)), FIRE_RESISTANCE("FireResistance", 14981690, 12, 0, 0, 10, false, EnumRarity.uncommon, new ItemStack(Items.magma_cream)), WATER_BREATHING("WaterBreathing", 3035801, 13, 0, 0, 10, false, EnumRarity.rare, new ItemStack(Items.fish, 1, 3)), INVISIBILITY("Invisibility", 8356754, 14, 0, 0, 10, false, EnumRarity.epic, new ItemStack(Items.fermented_spider_eye)), @@ -30,7 +30,7 @@ public enum ThePotionRings implements INameableItem{ //TODO Withering //Health Boost (Not Happening) //Absorption (Not Happening) - SATURATION("Saturation", 16262179, 23, 0, 3, 10, false, EnumRarity.epic, new ItemStack(Items.cooked_beef)); + SATURATION("Saturation", 16262179, 23, 0, 1, 10, false, EnumRarity.epic, new ItemStack(Items.cooked_beef)); public final String name; public final int color; diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeHandler.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeHandler.java index 192270f4f..ee4b4a5d7 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeHandler.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipeHandler.java @@ -18,7 +18,6 @@ public class GrinderRecipeHandler{ public ArrayList searchCases = new ArrayList(); public ArrayList exceptions = new ArrayList(); - public ArrayList specialOreCases = new ArrayList(); public static class SearchCase{ @@ -31,20 +30,6 @@ public class GrinderRecipeHandler{ } } - 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){ @@ -73,23 +58,8 @@ public class GrinderRecipeHandler{ ItemStack input = theInput.copy(); ItemStack output = theDust.copy(); output.stackSize = resultAmount; - if(!GrinderRecipes.instance().hasExactRecipe(input, output)){ - ArrayList 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); + if(!GrinderRecipes.instance().hasRecipe(inputName, inputWithDustPrefix)){ + GrinderRecipes.instance().registerRecipe(input, output, null, 0); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java index d0a2ebab2..3b60baad6 100644 --- a/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java +++ b/src/main/java/ellpeck/actuallyadditions/recipe/GrinderRecipes.java @@ -1,6 +1,7 @@ package ellpeck.actuallyadditions.recipe; import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; import java.util.ArrayList; @@ -18,6 +19,36 @@ public class GrinderRecipes{ this.recipes.add(new GrinderRecipe(input, outputOne, outputTwo, secondChance)); } + public void registerRecipe(String input, String outputOne, String outputTwo, int secondChance, int outputTwoAmount){ + ArrayList inputStacks = OreDictionary.getOres(input); + ArrayList outputOneStacks = OreDictionary.getOres(outputOne); + ArrayList outputTwoStacks = OreDictionary.getOres(outputTwo); + + if(inputStacks != null && !inputStacks.isEmpty()){ + for(ItemStack theInput : inputStacks){ + if(outputOneStacks != null && !outputOneStacks.isEmpty()){ + for(ItemStack theOutputOne : outputOneStacks){ + theOutputOne.stackSize = outputTwoAmount; + if(outputTwoStacks != null && !outputTwoStacks.isEmpty()){ + for(ItemStack theOutputTwo : outputTwoStacks){ + this.registerRecipe(theInput, theOutputOne, theOutputTwo, secondChance); + } + } + else this.registerRecipe(theInput, theOutputOne, null, 0); + } + } + } + } + } + + public void registerRecipe(String input, String outputOne){ + this.registerRecipe(input, outputOne, "", 0, 1); + } + + public void registerRecipe(ItemStack input, ItemStack outputOne){ + this.registerRecipe(input, outputOne, null, 0); + } + public ItemStack getOutput(ItemStack input, boolean wantSecond){ for(GrinderRecipe recipe : recipes){ if(recipe.input.isItemEqual(input)){ @@ -27,13 +58,28 @@ public class GrinderRecipes{ return null; } - public boolean hasExactRecipe(ItemStack input, ItemStack outputOne){ + public boolean hasRecipe(String input, String outputOne){ + boolean containsInput = false; + boolean containsOutput = false; + for(GrinderRecipe recipe : recipes){ - if(recipe.input.isItemEqual(input) && recipe.firstOutput.isItemEqual(outputOne)){ - return true; + int[] recipeInputIDs = OreDictionary.getOreIDs(recipe.input); + for(int recipeInputID : recipeInputIDs){ + if(input.equals(OreDictionary.getOreName(recipeInputID))){ + containsInput = true; + break; + } + } + + int[] recipeOutputIDs = OreDictionary.getOreIDs(recipe.firstOutput); + for(int recipeOutputID : recipeOutputIDs){ + if(outputOne.equals(OreDictionary.getOreName(recipeOutputID))){ + containsOutput = true; + break; + } } } - return false; + return containsInput && containsOutput; } public int getSecondChance(ItemStack input){ diff --git a/src/main/java/ellpeck/actuallyadditions/recipe/HairyBallHandler.java b/src/main/java/ellpeck/actuallyadditions/recipe/HairyBallHandler.java new file mode 100644 index 000000000..a03da6f18 --- /dev/null +++ b/src/main/java/ellpeck/actuallyadditions/recipe/HairyBallHandler.java @@ -0,0 +1,57 @@ +package ellpeck.actuallyadditions.recipe; + +import ellpeck.actuallyadditions.items.InitItems; +import ellpeck.actuallyadditions.items.metalists.TheSpecialDrops; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.WeightedRandom; + +import java.util.ArrayList; + +public class HairyBallHandler{ + + public static ArrayList returns = new ArrayList(); + + public static void init(){ + addReturn(new ItemStack(Items.string), 100); + addReturn(new ItemStack(Items.diamond), 2); + addReturn(new ItemStack(Items.name_tag), 1); + addReturn(new ItemStack(Items.fish), 80); + addReturn(new ItemStack(Items.feather), 60); + addReturn(new ItemStack(Items.leather), 30); + addReturn(new ItemStack(Items.dye), 70); + addReturn(new ItemStack(Items.clay_ball), 40); + addReturn(new ItemStack(Items.stick), 40); + addReturn(new ItemStack(Items.iron_ingot), 10); + addReturn(new ItemStack(Items.gold_ingot), 6); + addReturn(new ItemStack(Items.beef), 30); + addReturn(new ItemStack(Items.ender_pearl), 2); + addReturn(new ItemStack(Blocks.planks), 20); + addReturn(new ItemStack(Blocks.waterlily), 10); + addReturn(new ItemStack(Items.experience_bottle), 3); + addReturn(new ItemStack(Blocks.gravel), 40); + addReturn(new ItemStack(Blocks.sand), 50); + addReturn(new ItemStack(Blocks.vine), 30); + addReturn(new ItemStack(Blocks.web), 4); + addReturn(new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.SOLIDIFIED_EXPERIENCE.ordinal()), 20); + addReturn(new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.EMERALD_SHARD.ordinal()), 10); + addReturn(new ItemStack(InitItems.itemSpecialDrop, 1, TheSpecialDrops.PEARL_SHARD.ordinal()), 10); + } + + public static void addReturn(ItemStack stack, int chance){ + returns.add(new Return(stack, chance)); + } + + public static class Return extends WeightedRandom.Item{ + + public ItemStack returnItem; + + public Return(ItemStack returnItem, int chance){ + super(chance); + this.returnItem = returnItem; + } + + } + +} diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java index cfde380a7..cf3f30777 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBase.java @@ -4,29 +4,11 @@ import cpw.mods.fml.common.registry.GameRegistry; import ellpeck.actuallyadditions.util.ModUtil; import ellpeck.actuallyadditions.util.Util; import net.minecraft.block.Block; -import net.minecraft.block.BlockAir; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.NetworkManager; -import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class TileEntityBase extends TileEntity{ - @Override - public Packet getDescriptionPacket(){ - NBTTagCompound compound = new NBTTagCompound(); - this.writeToNBT(compound); - return new S35PacketUpdateTileEntity(this.xCoord, this.yCoord, this.zCoord, this.getBlockMetadata(), compound); - } - - @Override - public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet){ - super.onDataPacket(net, packet); - this.readFromNBT(packet.func_148857_g()); - } - public static void init(){ Util.logInfo("Registering TileEntities..."); GameRegistry.registerTileEntity(TileEntityCompost.class, ModUtil.MOD_ID_LOWER + ":tileEntityCompost"); @@ -49,6 +31,6 @@ public class TileEntityBase extends TileEntity{ @Override public boolean shouldRefresh(Block oldBlock, Block newBlock, int oldMeta, int newMeta, World world, int x, int y, int z){ - return newBlock == null || newBlock instanceof BlockAir; + return !(oldBlock.isAssociatedBlock(newBlock)); } } \ No newline at end of file diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java index 27ef4bfb3..c316ab395 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityBreaker.java @@ -40,6 +40,15 @@ public class TileEntityBreaker extends TileEntityInventoryBase{ @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + + //TODO Remove after some Updating + if(this.isPlacer && this.getClass() != TileEntityPlacer.class){ + ItemStack[] theSlots = this.slots.clone(); + worldObj.removeTileEntity(xCoord, yCoord, zCoord); + worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityPlacer()); + ((TileEntityPlacer)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone(); + } + if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ if(this.currentTime > 0){ this.currentTime--; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java index d4d84c4f2..6139fc209 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityFishingNet.java @@ -3,8 +3,13 @@ package ellpeck.actuallyadditions.tile; import ellpeck.actuallyadditions.config.values.ConfigIntValues; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.ISidedInventory; +import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraftforge.common.FishingHooks; +import net.minecraftforge.common.util.ForgeDirection; import java.util.Random; @@ -17,15 +22,44 @@ public class TileEntityFishingNet extends TileEntityBase{ @Override public void updateEntity(){ if(!worldObj.isRemote){ - if(worldObj.getBlock(xCoord, yCoord-1, zCoord).getMaterial() == Material.water){ - Random rand = new Random(); - if(this.timeUntilNextDrop > 0){ - this.timeUntilNextDrop--; - if(timeUntilNextDrop <= 0){ - worldObj.spawnEntityInWorld(new EntityItem(worldObj, xCoord+0.5, yCoord+1.8, zCoord+0.5, FishingHooks.getRandomFishable(rand, this.worldObj.rand.nextFloat()))); + if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ + if(worldObj.getBlock(xCoord, yCoord - 1, zCoord).getMaterial() == Material.water){ + Random rand = new Random(); + if(this.timeUntilNextDrop > 0){ + this.timeUntilNextDrop--; + if(timeUntilNextDrop <= 0){ + ItemStack fishable = FishingHooks.getRandomFishable(rand, this.worldObj.rand.nextFloat()); + TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord); + if(tile != null && tile instanceof IInventory){ + this.insertIntoInventory((IInventory)tile, fishable); + } + else{ + EntityItem item = new EntityItem(worldObj, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, fishable); + item.lifespan = 2000; + worldObj.spawnEntityInWorld(item); + } + } + } + else this.timeUntilNextDrop = this.timeUntilNextDropToSet + rand.nextInt(this.timeUntilNextDropToSet / 2); + } + } + } + } + + public void insertIntoInventory(IInventory inventory, ItemStack stack){ + for(int i = 0; i < inventory.getSizeInventory(); i++){ + if(inventory.isItemValidForSlot(i, stack)){ + if(!(inventory instanceof ISidedInventory) || ((ISidedInventory)inventory).canInsertItem(i, stack, ForgeDirection.DOWN.flag)){ + ItemStack slot = inventory.getStackInSlot(i); + if(slot == null){ + inventory.setInventorySlotContents(i, stack); + return; + } + if(slot.isItemEqual(stack) && slot.stackSize <= slot.getMaxStackSize() - stack.stackSize && slot.stackSize <= inventory.getInventoryStackLimit() - stack.stackSize){ + slot.stackSize += stack.stackSize; + return; } } - else this.timeUntilNextDrop = this.timeUntilNextDropToSet + rand.nextInt(this.timeUntilNextDropToSet/2); } } } diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java index 6c80adcdd..e9057a3cf 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityGrinder.java @@ -57,6 +57,15 @@ public class TileEntityGrinder extends TileEntityUpgradable implements IPowerAcc @SuppressWarnings("unchecked") public void updateEntity(){ if(!worldObj.isRemote){ + + //TODO Remove after some Updating + if(this.isDouble && this.getClass() != TileEntityGrinderDouble.class){ + ItemStack[] theSlots = this.slots.clone(); + worldObj.removeTileEntity(xCoord, yCoord, zCoord); + worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityGrinderDouble()); + ((TileEntityGrinderDouble)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone(); + } + this.speedUp(); boolean theFlag = this.coalTimeLeft > 0; diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java index c96d5953f..7cb0f5ff6 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInputter.java @@ -45,6 +45,15 @@ public class TileEntityInputter extends TileEntityInventoryBase{ @Override public void updateEntity(){ if(!worldObj.isRemote){ + + //TODO Remove after some Updating + if(this.isAdvanced && this.getClass() != TileEntityInputterAdvanced.class){ + ItemStack[] theSlots = this.slots.clone(); + worldObj.removeTileEntity(xCoord, yCoord, zCoord); + worldObj.setTileEntity(xCoord, yCoord, zCoord, new TileEntityInputterAdvanced()); + ((TileEntityInputterAdvanced)worldObj.getTileEntity(xCoord, yCoord, zCoord)).slots = theSlots.clone(); + } + this.initVars(); if(!worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)){ diff --git a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java index 2ecc4bc2d..0ba5b40b2 100644 --- a/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java +++ b/src/main/java/ellpeck/actuallyadditions/tile/TileEntityInventoryBase.java @@ -78,7 +78,10 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements @Override public ItemStack getStackInSlot(int i){ - return slots[i]; + if(i < this.getSizeInventory()){ + return slots[i]; + } + return null; } @Override diff --git a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java index 94584f60d..6b79d8d70 100644 --- a/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java +++ b/src/main/java/ellpeck/actuallyadditions/util/ModUtil.java @@ -5,7 +5,7 @@ import org.apache.logging.log4j.Logger; public class ModUtil{ - public static final String VERSION = "1.7.10-0.0.4.3"; + public static final String VERSION = "1.7.10-0.0.4.4"; public static final String MOD_ID = "ActuallyAdditions"; public static final String NAME = "Actually Additions"; diff --git a/src/main/resources/assets/actuallyadditions/lang/en_US.lang b/src/main/resources/assets/actuallyadditions/lang/en_US.lang index 9c5c10455..445f97aa0 100644 --- a/src/main/resources/assets/actuallyadditions/lang/en_US.lang +++ b/src/main/resources/assets/actuallyadditions/lang/en_US.lang @@ -58,6 +58,7 @@ item.actuallyadditions.itemJamChApCi.name=ChApCi-Jam item.actuallyadditions.itemJamHoMeKi.name=HoMeKi-Jam item.actuallyadditions.itemJamPiCo.name=PiCo-Jam +item.actuallyadditions.itemHairyBall.name=Ball of Hair item.actuallyadditions.itemLeafBlower.name=Leaf Blower item.actuallyadditions.itemLeafBlowerAdvanced.name=Advanced Leaf Blower item.actuallyadditions.itemKnife.name=Knife @@ -131,53 +132,8 @@ tooltip.actuallyadditions.itemJamChApCi.desc=Cherry, Apple and Cinnamon tooltip.actuallyadditions.itemJamHoMeKi.desc=Honeydew Melon and Kiwi 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.itemHairyBall.desc.1=A Ball of Hair dropped from a Cat... +tooltip.actuallyadditions.itemHairyBall.desc.2=Maybe you can get something from it by using it... tooltip.actuallyadditions.itemUpgradeSpeed.desc.1=Speeds up Machines when placed in their Upgrade Slot tooltip.actuallyadditions.itemUpgradeSpeed.desc.2=Works in: @@ -344,6 +300,7 @@ info.actuallyadditions.update.generic.desc=[{"text":"There is an "},{"text":"Upd 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.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"}] +info.actuallyadditions.update.new.desc=Important Changes: achievement.actuallyadditions.pickUpSolidXP=Hard and Rich and Stuff achievement.actuallyadditions.pickUpSolidXP.desc=Pick up some Solidified Experience diff --git a/src/main/resources/assets/actuallyadditions/textures/items/itemHairyBall.png b/src/main/resources/assets/actuallyadditions/textures/items/itemHairyBall.png new file mode 100644 index 000000000..f8d9492a7 Binary files /dev/null and b/src/main/resources/assets/actuallyadditions/textures/items/itemHairyBall.png differ diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 435c78154..a5141932f 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "ActuallyAdditions", "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!", - "version": "0.0.4.3", + "version": "0.0.4.4", "mcversion": "1.7.10", "url": "https://github.com/Ellpeck/ActuallyAdditions", "updateUrl": "",