mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-18 03:15:07 +00:00
Added comparator support to the T.A. Plate.
This commit is contained in:
1 parent
17e1c0e6a2
commit
8de9ca9802
2 files changed
+18
No files matched your search
@@ -23,6 +23,7 @@ import vazkii.botania.api.lexicon.LexiconEntry;
|
||||
import vazkii.botania.client.core.helper.IconHelper;
|
||||
import vazkii.botania.common.block.BlockModContainer;
|
||||
import vazkii.botania.common.block.tile.TileTerraPlate;
|
||||
import vazkii.botania.common.block.tile.mana.TilePool;
|
||||
import vazkii.botania.common.lexicon.LexiconData;
|
||||
import vazkii.botania.common.lib.LibBlockNames;
|
||||
|
||||
@@ -77,5 +78,20 @@ public class BlockTerraPlate extends BlockModContainer implements ILexiconable {
|
||||
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
|
||||
return LexiconData.terrasteel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasComparatorInputOverride() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
|
||||
TileTerraPlate plate = (TileTerraPlate) par1World.getTileEntity(par2, par3, par4);
|
||||
int val = (int) ((double) plate.getCurrentMana() / (double) TileTerraPlate.MAX_MANA * 15.0);
|
||||
if(plate.getCurrentMana() > 0)
|
||||
val = Math.max(val, 1);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -90,6 +90,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
else item.setEntityItemStack(new ItemStack(ModItems.manaResource, 1, 4));
|
||||
item.worldObj.playSoundAtEntity(item, "botania:terrasteelCraft", 1F, 1F);
|
||||
mana = 0;
|
||||
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
|
||||
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(worldObj, xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
@@ -201,6 +202,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable {
|
||||
@Override
|
||||
public void recieveMana(int mana) {
|
||||
this.mana = Math.max(0, Math.min(MAX_MANA, this.mana + mana));
|
||||
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user