Incense Plate automation stuffs.

This commit is contained in:
Lizbeth Rika committed 2015-05-18 15:54:55 +01:00
1 parent fe1035dfb6
commit e84792607f
5 files changed
+49 -9

No files matched your search

@@ -24,14 +24,11 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.common.util.RotationHelper;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.lib.LibRenderIDs;
import vazkii.botania.common.block.tile.TileIncensePlate;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.brew.ItemIncenseStick;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
@@ -63,9 +60,7 @@ public class BlockIncensePlate extends BlockModContainer implements ILexiconable
did = true;
} else if(plateStack != null && !plate.burning) {
if(stack != null && stack.getItem() == Items.flint_and_steel) {
plate.burning = true;
Brew brew = ((ItemIncenseStick) ModItems.incenseStick).getBrew(plateStack);
plate.timeLeft = brew.getPotionEffects(plateStack).get(0).getDuration() * ItemIncenseStick.TIME_MULTIPLIER;
plate.ignite();
stack.damageItem(1, player);
did = true;
} else {
@@ -89,6 +84,16 @@ public class BlockIncensePlate extends BlockModContainer implements ILexiconable
int l = MathHelper.floor_double(p_149689_5_.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
p_149689_1_.setBlockMetadataWithNotify(p_149689_2_, p_149689_3_, p_149689_4_, META_ROTATIONS[l], 2);
}
@Override
public boolean hasComparatorInputOverride() {
return true;
}
@Override
public int getComparatorInputOverride(World world, int x, int y, int z, int side) {
return ((TileIncensePlate) world.getTileEntity(x, y, z)).comparatorOutput;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess w, int x, int y, int z) {
@@ -37,6 +37,8 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
public int timeLeft = 0;
public boolean burning = false;
public int comparatorOutput = 0;
@Override
public void updateEntity() {
ItemStack stack = getStackInSlot(0);
@@ -75,6 +77,26 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
} else timeLeft = 0;
int newComparator = 0;
if(stack != null)
newComparator = 1;
if(burning)
newComparator = 2;
if(comparatorOutput != newComparator) {
comparatorOutput = newComparator;
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
}
public void ignite() {
ItemStack stack = getStackInSlot(0);
if(stack == null || burning)
return;
burning = true;
Brew brew = ((ItemIncenseStick) ModItems.incenseStick).getBrew(stack);
timeLeft = brew.getPotionEffects(stack).get(0).getDuration() * ItemIncenseStick.TIME_MULTIPLIER;
}
@Override
@@ -120,5 +142,12 @@ public class TileIncensePlate extends TileSimpleInventory implements ISidedInven
public boolean canExtractItem(int p_102008_1_, ItemStack p_102008_2_, int p_102008_3_) {
return false;
}
@Override
public void markDirty() {
super.markDirty();
if(!worldObj.isRemote)
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(this);
}
}
@@ -18,6 +18,8 @@ import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.MovingObjectPosition;
import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.internal.IManaBurst;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileIncensePlate;
public class LensFire extends Lens {
@@ -36,7 +38,10 @@ public class LensFire extends Lens {
if(blockAt == Blocks.portal)
entity.worldObj.setBlock(pos.blockX, pos.blockY, pos.blockZ, Blocks.air);
else if(blockAt_.isAir(entity.worldObj, x, y, z))
else if(blockAt == ModBlocks.incensePlate) {
TileIncensePlate plate = (TileIncensePlate) entity.worldObj.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
plate.ignite();
} else if(blockAt_.isAir(entity.worldObj, x, y, z))
entity.worldObj.setBlock(x, y, z, Blocks.fire);
}
@@ -583,7 +583,7 @@ public final class LexiconData {
new PageBrew(ModBrewRecipes.bloodthirstBrew, "5a", "5b"), new PageBrew(ModBrewRecipes.allureBrew, "6a", "6b")).setIcon(((IBrewContainer) ModItems.vial).getItemForBrew(ModBrews.jumpBoost, new ItemStack(ModItems.vial)));
incense = new BLexiconEntry(LibLexicon.DEVICE_INCENSE, categoryDevices);
incense.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageCraftingRecipe("3", ModCraftingRecipes.recipeIncenseStick), new PageCraftingRecipe("4", ModCraftingRecipes.recipeIncensePlate));
incense.setLexiconPages(new PageText("0"), new PageText("1"), new PageText("2"), new PageText("5"), new PageCraftingRecipe("3", ModCraftingRecipes.recipeIncenseStick), new PageCraftingRecipe("4", ModCraftingRecipes.recipeIncensePlate));
// TOOLS ENTRIES
manaBlaster = new BLexiconEntry(LibLexicon.TOOL_MANA_BLASTER, categoryTools);
@@ -1992,6 +1992,7 @@ botania.entry.incense=Brew Incenses
botania.page.incense0=&4Brews&0 can provide a great variety of effects when in liquid form. They, however, don't last long, and take up inventory space. Utilizing &1Incense Sticks&0 instead of flasks mitigates that problem, these can be infused with &4Brew&0 effects just like a normal flask would, but take around ten times as much &4Mana&0 to do so.
botania.page.incense1=An &1Incense Stick&0 can be placed on an &1Incense Plate&0 by right clicking on it, a simple click with a &1Flint and Steel&0 will light it up. Once lit, the stick can not be retrieved.<br>A single stick of incense will burn for sixty times as long as as the liquid counterpart before needing to be replaced.
botania.page.incense2=&1Incense Plates&0 that are burning &1Incense Sticks&0 will provide the effects of the &4Brew&0 infused in the stick to any players on a 24 block radius of the plate.<br>Not all &4Brews&0 can be infused into &1Incense Sticks&0, for example, &4Instant Health&0 or &1Absorption&0 can't, nor can any with more than one effect.
botania.page.incense5=For the incense lovers who are also automation junkies, the &1Incense Plate&0 can receive items through &1Hoppers&0 or other input. It'll output a &1Comparator&0 signal of 1 when it has a stick and 2 when it's burning it.<br>Lastly, if a &4Mana Burst&0 with a &1Kindle Lens&0 hits the plate while there's a stick on it, it'll start burning it.
botania.page.incense3=Incense is wincense
botania.page.incense4=I can incense it