mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 11:19:19 +00:00
The Livingwood Avatar can now place down dirt using the Rod of the Lands.
This commit is contained in:
1 parent
4bb2cadf72
commit
caaaf45de3
7 files changed
+46
-3
No files matched your search
@@ -10,6 +10,7 @@
|
||||
*/
|
||||
package vazkii.botania.api.item;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.mana.IManaReceiver;
|
||||
|
||||
@@ -23,7 +24,12 @@ public interface IAvatarTile extends IManaReceiver {
|
||||
* @return An IItemhandler representing the avatar's inventory
|
||||
*/
|
||||
public IItemHandler getInventory();
|
||||
|
||||
|
||||
/**
|
||||
* Gets the avatar's facing.
|
||||
*/
|
||||
public EnumFacing getAvatarFacing();
|
||||
|
||||
/**
|
||||
* Gets the amount of ticks that have elapsed on this avatar while it's functional
|
||||
* (has redstone signal).
|
||||
@@ -34,5 +40,6 @@ public interface IAvatarTile extends IManaReceiver {
|
||||
* Gets if this avatar is enabled (isn't powered by a redstone signal).
|
||||
*/
|
||||
public boolean isEnabled();
|
||||
|
||||
|
||||
}
|
||||
@@ -118,6 +118,7 @@ public final class LibResources {
|
||||
public static final String MODEL_AVATAR_MISSILE = PREFIX_MODEL + "avatarMissile.png";
|
||||
public static final String MODEL_AVATAR_RAINBOW = PREFIX_MODEL + "avatarRainbow.png";
|
||||
public static final String MODEL_AVATAR_TORNADO = PREFIX_MODEL + "avatarTornado.png";
|
||||
public static final String MODEL_AVATAR_DIRT = PREFIX_MODEL + "avatarDirt.png";
|
||||
|
||||
public static final String MISC_PARTICLES = PREFIX_MISC + "particles.png";
|
||||
public static final String MISC_WISP_LARGE = PREFIX_MISC + "wispLarge.png";
|
||||
|
||||
@@ -16,6 +16,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import vazkii.botania.api.item.IAvatarTile;
|
||||
import vazkii.botania.api.item.IAvatarWieldable;
|
||||
import vazkii.botania.api.state.BotaniaStateProps;
|
||||
|
||||
public class TileAvatar extends TileSimpleInventory implements IAvatarTile {
|
||||
|
||||
@@ -106,6 +107,11 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile {
|
||||
return getItemHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumFacing getAvatarFacing() {
|
||||
return worldObj.getBlockState(getPos()).getValue(BotaniaStateProps.CARDINALS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getElapsedFunctionalTicks() {
|
||||
return ticksElapsed;
|
||||
|
||||
@@ -11,21 +11,27 @@
|
||||
package vazkii.botania.common.item.rod;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import vazkii.botania.api.item.IAvatarTile;
|
||||
import vazkii.botania.api.item.IAvatarWieldable;
|
||||
import vazkii.botania.api.item.IBlockProvider;
|
||||
import vazkii.botania.api.mana.IManaUsingItem;
|
||||
import vazkii.botania.api.mana.ManaItemHandler;
|
||||
import vazkii.botania.client.lib.LibResources;
|
||||
import vazkii.botania.common.Botania;
|
||||
import vazkii.botania.common.achievement.ICraftAchievement;
|
||||
import vazkii.botania.common.achievement.ModAchievements;
|
||||
@@ -34,8 +40,10 @@ import vazkii.botania.common.lib.LibItemNames;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public class ItemDirtRod extends ItemMod implements IManaUsingItem, ICraftAchievement, IBlockProvider {
|
||||
public class ItemDirtRod extends ItemMod implements IManaUsingItem, ICraftAchievement, IBlockProvider, IAvatarWieldable {
|
||||
|
||||
private static final ResourceLocation avatarOverlay = new ResourceLocation(LibResources.MODEL_AVATAR_DIRT);
|
||||
|
||||
static final int COST = 75;
|
||||
|
||||
public ItemDirtRod() {
|
||||
@@ -99,5 +107,25 @@ public class ItemDirtRod extends ItemMod implements IManaUsingItem, ICraftAchiev
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAvatarUpdate(IAvatarTile tile, ItemStack stack) {
|
||||
TileEntity te = (TileEntity) tile;
|
||||
World world = te.getWorld();
|
||||
if(!world.isRemote && tile.getCurrentMana() >= COST && tile.getElapsedFunctionalTicks() % 4 == 0 && world.rand.nextInt(8) == 0 && tile.isEnabled()) {
|
||||
BlockPos pos = ((TileEntity) tile).getPos().offset(tile.getAvatarFacing());
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if(state.getBlock().isAir(state, world, pos)) {
|
||||
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||
world.playEvent(2001, pos, Block.getStateId(Blocks.DIRT.getDefaultState()));
|
||||
tile.recieveMana(-COST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getOverlayResource(IAvatarTile tile, ItemStack stack) {
|
||||
return avatarOverlay;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -841,7 +841,7 @@ public final class LexiconData {
|
||||
new PageCraftingRecipe("5", ModCraftingRecipes.recipesAltGrassSeeds));
|
||||
|
||||
dirtRod = new BasicLexiconEntry(LibLexicon.TOOL_DIRT_ROD, categoryTools);
|
||||
dirtRod.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeDirtRod));
|
||||
dirtRod.setLexiconPages(new PageText("0"), new PageText("2"), new PageCraftingRecipe("1", ModCraftingRecipes.recipeDirtRod));
|
||||
|
||||
terraformRod = new BasicLexiconEntry(LibLexicon.TOOL_TERRAFORM_ROD, categoryTools);
|
||||
terraformRod.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"),
|
||||
|
||||
@@ -2807,6 +2807,7 @@ botania.page.grassSeeds5=The alternate &1Pasture Seeds&0
|
||||
botania.entry.dirtRod=Rod of the Lands
|
||||
botania.tagline.dirtRod=A rod to create dirt
|
||||
botania.page.dirtRod0=The &1Rod of the Lands&0 is a rather simple tool; by utilizing &4Mana&0 from the user's inventory (via a &1Mana Tablet&0 or others), it can materialize and place a &1Dirt&0 block down.<br>For the same &4Mana&0 cost, this item can provide &1Dirt&0 to the &1Rod of the Shifting Crust&0.
|
||||
botania.page.dirtRod2=This rod can be given to a &1Livingwood Avatar&0. When done so, it'll periodically place down a piece of &1Dirt&0 in front of it.<br>This process uses &4Mana&0 from the avatar, and can be disabled by applying redstone to it.
|
||||
botania.page.dirtRod1=The Dirty Stick
|
||||
|
||||
# -- TERRA FIRMA ROD
|
||||
|
||||
BIN
Binary file not shown.
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
Reference in new issue
Block a user