diff --git a/build.gradle b/build.gradle index 8048b9e..335f814 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "6.0.1" +version = "6.0.2" group = "pharaun.Gregtania" archivesBaseName = "Gregtania" diff --git a/src/main/java/com/gmail/pharaun/gregtania/botania/SubTileClayconiaAlluvia.java b/src/main/java/com/gmail/pharaun/gregtania/botania/SubTileClayconiaAlluvia.java new file mode 100644 index 0000000..6f94157 --- /dev/null +++ b/src/main/java/com/gmail/pharaun/gregtania/botania/SubTileClayconiaAlluvia.java @@ -0,0 +1,111 @@ +package com.gmail.pharaun.gregtania.botania; +/** + * This class was created by . It's distributed as + * part of the Botania Mod. Get the Source Code in github: + * https://github.com/Vazkii/Botania + * + * Botania is Open Source and distributed under the + * Botania License: http://botaniamod.net/license.php + * + * File Created @ [May 17, 2014, 12:05:37 AM (GMT)] + */ + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ChunkCoordinates; +import vazkii.botania.api.lexicon.LexiconEntry; +import vazkii.botania.api.subtile.RadiusDescriptor; +import vazkii.botania.api.subtile.SubTileFunctional; +import vazkii.botania.common.core.handler.ConfigHandler; +import vazkii.botania.common.lexicon.LexiconData; + +public class SubTileClayconiaAlluvia extends SubTileFunctional { + + private static final int COST = 240; + private static final int RANGE = 5; + private static final int RANGE_Y = 3; + + private static final int RANGE_MINI = 2; + private static final int RANGE_Y_MINI = 1; + + public static LexiconEntry lexiconEntry; + + @Override + public void onUpdate() { + super.onUpdate(); + + if(!supertile.getWorldObj().isRemote && ticksExisted % 5 == 0) { + if(mana >= COST) { + ChunkCoordinates coords = getCoordsToPut(); + if(coords != null) { + supertile.getWorldObj().setBlockToAir(coords.posX, coords.posY, coords.posZ); + if(ConfigHandler.blockBreakParticles) + supertile.getWorldObj().playAuxSFX(2001, coords.posX, coords.posY, coords.posZ, Block.getIdFromBlock(Block.getBlockFromName("sand"))); + EntityItem item = new EntityItem(supertile.getWorldObj(), coords.posX + 0.5, coords.posY + 0.5, coords.posZ + 0.5, new ItemStack(Items.clay_ball)); + supertile.getWorldObj().spawnEntityInWorld(item); + mana -= COST; + } + } + } + } + + public ChunkCoordinates getCoordsToPut() { + List possibleCoords = new ArrayList(); + + int range = getRange(); + int rangeY = getRangeY(); + + for(int i = -range; i < range + 1; i++) + for(int j = -rangeY; j < rangeY + 1; j++) + for(int k = -range; k < range + 1; k++) { + int x = supertile.xCoord + i; + int y = supertile.yCoord + j; + int z = supertile.zCoord + k; + Block block = supertile.getWorldObj().getBlock(x, y, z); + if(block == Block.getBlockFromName("gravel")) + possibleCoords.add(new ChunkCoordinates(x, y, z)); + } + + if(possibleCoords.isEmpty()) + return null; + return possibleCoords.get(supertile.getWorldObj().rand.nextInt(possibleCoords.size())); + } + + @Override + public RadiusDescriptor getRadius() { + return new RadiusDescriptor.Square(toChunkCoordinates(), getRange()); + } + + public int getRange() { + return RANGE; + } + + public int getRangeY() { + return RANGE_Y; + } + + @Override + public int getColor() { + return 0x7B8792; + } + + @Override + public int getMaxMana() { + return 1920; + } + + @Override + public LexiconEntry getEntry() { + return lexiconEntry; + } + + public static class Mini extends SubTileClayconiaAlluvia { + @Override public int getRange() { return RANGE_MINI; } + @Override public int getRangeY() { return RANGE_Y_MINI; } + } +} \ No newline at end of file diff --git a/src/main/java/com/gmail/pharaun/gregtania/botania/Util.java b/src/main/java/com/gmail/pharaun/gregtania/botania/Util.java index ac043eb..1986bd0 100644 --- a/src/main/java/com/gmail/pharaun/gregtania/botania/Util.java +++ b/src/main/java/com/gmail/pharaun/gregtania/botania/Util.java @@ -7,6 +7,7 @@ import vazkii.botania.api.lexicon.LexiconPage; import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.api.recipe.RecipeRuneAltar; +import vazkii.botania.api.subtile.SubTileEntity; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; import vazkii.botania.common.lexicon.page.PagePetalRecipe; import vazkii.botania.common.lexicon.page.PageRuneRecipe; @@ -16,49 +17,49 @@ // Thanks Magical Beees and ExCompressium for various hints on how to disable a flower/add a new flower public class Util { - public static void registerFlower(String name, Class klass) { + public static void registerFlower(String name, Class klass) { BotaniaAPI.registerSubTile(name, klass); BotaniaAPI.registerSubTileSignature(klass, new CustomSubTileSignature(name)); BotaniaAPI.addSubTileToCreativeMenu(name); } - public static void registerFunctionalPetalRecipe(String name, Object... petals) { - registerFunctionalPetalRecipeTier(name, false, petals); + public static LexiconEntry registerFunctionalPetalRecipe(String name, Object... petals) { + return registerFunctionalPetalRecipeTier(name, false, petals); } - public static void registerFunctionalPetalRecipeElven(String name, Object... petals) { - registerFunctionalPetalRecipeTier(name, true, petals); + public static LexiconEntry registerFunctionalPetalRecipeElven(String name, Object... petals) { + return registerFunctionalPetalRecipeTier(name, true, petals); } - private static void registerFunctionalPetalRecipeTier(String name, boolean elven, Object... petals) { + private static LexiconEntry registerFunctionalPetalRecipeTier(String name, boolean elven, Object... petals) { ItemStack flower = ItemBlockSpecialFlower.ofType(name); RecipePetals recipeFlowerEvolved = BotaniaAPI.registerPetalRecipe(flower, petals); String lexiconLangPage = "tile.botania:flower." + Reference.MODID + "." + name + ".page"; - LexiconPage lexiconRecipe = new PagePetalRecipe(lexiconLangPage + ".1", recipeFlowerEvolved); + LexiconPage lexiconRecipe = new PagePetalRecipe<>(lexiconLangPage + ".1", recipeFlowerEvolved); - registerLexicon(name, elven, new PageText(lexiconLangPage + ".0"), lexiconRecipe); + return registerLexicon(name, elven, new PageText(lexiconLangPage + ".0"), lexiconRecipe); } - public static void registerFunctionalRunicRecipe(String name, int mana, Object... petals) { - registerFunctionalRunicRecipe(name, false, mana, petals); + public static LexiconEntry registerFunctionalRunicRecipe(String name, int mana, Object... petals) { + return registerFunctionalRunicRecipe(name, false, mana, petals); } - public static void registerFunctionalRunicRecipeElven(String name, int mana, Object... petals) { - registerFunctionalRunicRecipe(name,true, mana, petals); + public static LexiconEntry registerFunctionalRunicRecipeElven(String name, int mana, Object... petals) { + return registerFunctionalRunicRecipe(name,true, mana, petals); } - private static void registerFunctionalRunicRecipe(String name, boolean elven, int mana, Object... petals) { + private static LexiconEntry registerFunctionalRunicRecipe(String name, boolean elven, int mana, Object... petals) { ItemStack flower = ItemBlockSpecialFlower.ofType(name); RecipeRuneAltar recipeFlowerEvolved = BotaniaAPI.registerRuneAltarRecipe(flower, mana, petals); String lexiconLangPage = "tile.botania:flower." + Reference.MODID + "." + name + ".page"; PageRuneRecipe lexiconRecipe = new PageRuneRecipe(lexiconLangPage + ".1", recipeFlowerEvolved); - registerLexicon(name, elven, new PageText(lexiconLangPage + ".0"), lexiconRecipe); + return registerLexicon(name, elven, new PageText(lexiconLangPage + ".0"), lexiconRecipe); } - private static void registerLexicon(String name, boolean elven, LexiconPage... pages) { + private static LexiconEntry registerLexicon(String name, boolean elven, LexiconPage... pages) { String lexiconLangName = "tile.botania:flower." + Reference.MODID + "." + name + ".name"; LexiconEntry lexicon = new LexiconEntry(lexiconLangName, BotaniaAPI.categoryFunctionalFlowers) { @Override @@ -74,6 +75,7 @@ public String getTagline() { } BotaniaAPI.addEntry(lexicon, lexicon.category); + return lexicon; } /* diff --git a/src/main/java/com/gmail/pharaun/gregtania/proxies/CommonProxy.java b/src/main/java/com/gmail/pharaun/gregtania/proxies/CommonProxy.java index a596f44..c31920b 100644 --- a/src/main/java/com/gmail/pharaun/gregtania/proxies/CommonProxy.java +++ b/src/main/java/com/gmail/pharaun/gregtania/proxies/CommonProxy.java @@ -1,5 +1,6 @@ package com.gmail.pharaun.gregtania.proxies; +import com.gmail.pharaun.gregtania.botania.SubTileClayconiaAlluvia; import com.gmail.pharaun.gregtania.botania.Util; import com.gmail.pharaun.gregtania.botania.tiers.*; import com.gmail.pharaun.gregtania.misc.BotaniaHelper; @@ -11,11 +12,17 @@ import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; +import vazkii.botania.api.BotaniaAPI; +import vazkii.botania.api.recipe.RecipePetals; import vazkii.botania.common.block.ModBlocks; +import vazkii.botania.common.crafting.ModPetalRecipes; import vazkii.botania.common.item.ModItems; import vazkii.botania.common.item.block.ItemBlockSpecialFlower; +import java.util.List; + public class CommonProxy { + public static final String SUBTILE_CLAYCONIA_ALLUVIA = "clayconiaAlluvia"; public static final String SUBTILE_EVOLVED_ORECHID = "evolvedOrechid"; public static final String SUBTILE_EVOLVED_ORECHID_IGNEM = "evolvedOrechidIgnem"; public static final String SUBTILE_EVOLVED_ORECHID_ENDIUM = "evolvedOrechidEndium"; @@ -94,6 +101,15 @@ public void init(FMLInitializationEvent event) { OreDictionary.registerOre("rockGtStone", new ItemStack(ModItems.manaResource, 1, 21)); OreDictionary.registerOre("rockGtAnyStone", new ItemStack(ModItems.manaResource, 1, 21)); + + // Gravel Clayconia - because: + // sand needs an alchemy catalyst, which needs gold, which needs a crucible + // and Clayconia needs an earth rune, which needs iron, which needs a clay crucible + + Util.registerFlower(SUBTILE_CLAYCONIA_ALLUVIA, SubTileClayconiaAlluvia.class); + SubTileClayconiaAlluvia.lexiconEntry = Util.registerFunctionalPetalRecipe(SUBTILE_CLAYCONIA_ALLUVIA, "petalGray", "petalLightGray", "petalLightGray", "petalCyan"); + + } public void postInit(FMLPostInitializationEvent event) { diff --git a/src/main/resources/assets/gregtania/lang/en_US.lang b/src/main/resources/assets/gregtania/lang/en_US.lang index a04c45a..488e0df 100644 --- a/src/main/resources/assets/gregtania/lang/en_US.lang +++ b/src/main/resources/assets/gregtania/lang/en_US.lang @@ -53,4 +53,9 @@ tile.botania:flower.gregtania.evolvedOrechidEndiumIII.page.1=&oPretty sure it is tile.botania:flower.gregtania.evolvedOrechidEndiumIV.name=Orechid Endium IV tile.botania:flower.gregtania.evolvedOrechidEndiumIV.reference=Orechid Endium: Shady^4 tile.botania:flower.gregtania.evolvedOrechidEndiumIV.page.0=This &1Orechid Endium III&0 is the last answer in end ores! -tile.botania:flower.gregtania.evolvedOrechidEndiumIV.page.1=&oPretty sure it is organic dragon poop&r. \ No newline at end of file +tile.botania:flower.gregtania.evolvedOrechidEndiumIV.page.1=&oPretty sure it is organic dragon poop&r. + +tile.botania:flower.gregtania.clayconiaAlluvia.name=Clayconia Alluvia +tile.botania:flower.gregtania.clayconiaAlluvia.reference=Perfectly Balanced +tile.botania:flower.gregtania.clayconiaAlluvia.page.0=Obtaining Clay without access to any metals would prove impossible without the &1Clayconia Alluvia&0. This flower will turn your Gravel to Clay, but at a greater mana cost than the standard Clayconia. +tile.botania:flower.gregtania.clayconiaAlluvia.page.1=&oWhere have I Bentonite? At the Clay Bar!&r. \ No newline at end of file diff --git a/src/main/resources/assets/gregtania/textures/blocks/clayconiaAlluvia.png b/src/main/resources/assets/gregtania/textures/blocks/clayconiaAlluvia.png new file mode 100644 index 0000000..5e17e2d Binary files /dev/null and b/src/main/resources/assets/gregtania/textures/blocks/clayconiaAlluvia.png differ