Skip to content

Commit

Permalink
Add Clayconia Alluvia for getting clay before iron+gold
Browse files Browse the repository at this point in the history
  • Loading branch information
codewarrior0 committed Oct 2, 2017
1 parent 3448d63 commit 3cdb3ff
Show file tree
Hide file tree
Showing 6 changed files with 151 additions and 17 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildscript {

apply plugin: 'forge'

version = "6.0.1"
version = "6.0.2"
group = "pharaun.Gregtania"
archivesBaseName = "Gregtania"

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
package com.gmail.pharaun.gregtania.botania;
/**
* This class was created by <Vazkii>. 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<ChunkCoordinates> 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; }
}
}
32 changes: 17 additions & 15 deletions src/main/java/com/gmail/pharaun/gregtania/botania/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<? extends SubTileEntity> 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
Expand All @@ -74,6 +75,7 @@ public String getTagline() {
}

BotaniaAPI.addEntry(lexicon, lexicon.category);
return lexicon;
}

/*
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/com/gmail/pharaun/gregtania/proxies/CommonProxy.java
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 6 additions & 1 deletion src/main/resources/assets/gregtania/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 3cdb3ff

Please sign in to comment.