This commit is contained in:
Vincent Lee committed 2020-04-04 12:52:35 -05:00
1 parent 0f2c8d61b6
commit 43337b723d
27 files changed
+59 -67

No files matched your search

@@ -21,12 +21,12 @@ public interface IManaReceiver extends IManaBlock {
/**
* Called when this receiver receives mana.
*/
public void recieveMana(int mana);
public void receiveMana(int mana);
/**
* Can this tile receive mana from bursts? Generally set to false for
* implementations of IManaCollector.
*/
public boolean canRecieveManaFromBursts();
public boolean canReceiveManaFromBursts();
}
@@ -71,7 +71,7 @@ public class TileEntityFunctionalFlower extends TileEntitySpecialFlower {
int manaInPool = pool.getCurrentMana();
int manaMissing = getMaxMana() - mana;
int manaToRemove = Math.min(manaMissing, manaInPool);
pool.recieveMana(-manaToRemove);
pool.receiveMana(-manaToRemove);
addMana(manaToRemove);
}
@@ -170,7 +170,7 @@ public class TileEntityGeneratingFlower extends TileEntitySpecialFlower {
if (!collector.isFull() && getMana() > 0) {
int manaval = Math.min(getMana(), collector.getMaxMana() - collector.getCurrentMana());
mana = getMana() - manaval;
collector.recieveMana(manaval);
collector.receiveMana(manaval);
}
}
}
@@ -33,7 +33,6 @@ import vazkii.botania.api.recipe.IElvenItem;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.api.state.enums.AlfPortalState;
import vazkii.botania.client.fx.WispParticleData;
import vazkii.botania.common.Botania;
import vazkii.botania.common.advancements.AlfPortalBreadTrigger;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.mana.BlockPool;
@@ -52,7 +51,6 @@ import javax.annotation.Nullable;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class TileAlfPortal extends TileMod implements ITickableTileEntity {
@@ -434,7 +432,7 @@ public class TileAlfPortal extends TileMod implements ITickableTileEntity {
if (consumed >= expectedConsumption) {
for (TilePool pool : consumePools) {
pool.recieveMana(-costPer);
pool.receiveMana(-costPer);
}
return true;
}
@@ -101,12 +101,12 @@ public class TileAvatar extends TileSimpleInventory implements IAvatarTile, ITic
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.mana = Math.min(MAX_MANA, this.mana + mana);
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return !itemHandler.getStackInSlot(0).isEmpty();
}
@@ -110,7 +110,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
}
// Update every tick.
recieveMana(0);
receiveMana(0);
if (!world.isRemote && recipe == null) {
List<ItemEntity> items = world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1));
@@ -146,7 +146,7 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
if (mana >= getManaCost() && !world.isRemote) {
int mana = getManaCost();
recieveMana(-mana);
receiveMana(-mana);
ItemStack output = recipe.getOutput(itemHandler.getStackInSlot(0));
ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
@@ -251,12 +251,12 @@ public class TileBrewery extends TileSimpleInventory implements IManaReceiver, I
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.mana = Math.min(this.mana + mana, getManaCost());
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return !isFull();
}
@@ -372,12 +372,12 @@ public class TileEnchanter extends TileMod implements ISparkAttachable, ITickabl
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.mana = Math.min(manaRequired, this.mana + mana);
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return manaRequired > 0;
}
@@ -28,7 +28,6 @@ import net.minecraftforge.registries.ObjectHolder;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.api.recipe.RecipeRuneAltar;
@@ -151,7 +150,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
public void tick() {
// Update every tick.
recieveMana(0);
receiveMana(0);
if (!world.isRemote) {
if (manaToGet == 0) {
@@ -276,7 +275,7 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
if (livingrock != null) {
int mana = recipe.getManaUsage();
recieveMana(-mana);
receiveMana(-mana);
ItemStack output = recipe.getRecipeOutput().copy();
ItemEntity outputItem = new ItemEntity(world, pos.getX() + 0.5, pos.getY() + 1.5, pos.getZ() + 0.5, output);
world.addEntity(outputItem);
@@ -360,12 +359,12 @@ public class TileRuneAltar extends TileSimpleInventory implements IManaReceiver,
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.mana = Math.min(this.mana + mana, manaToGet);
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return !isFull();
}
@@ -172,12 +172,12 @@ public class TileSpawnerClaw extends TileMod implements IManaReceiver, ITickable
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.mana = Math.min(160, this.mana + mana);
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return true;
}
@@ -112,7 +112,7 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable, ITickab
}
if (removeMana) {
recieveMana(-1000);
receiveMana(-1000);
}
}
@@ -173,13 +173,13 @@ public class TileTerraPlate extends TileMod implements ISparkAttachable, ITickab
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.mana = Math.max(0, Math.min(MAX_MANA, this.mana + mana));
world.updateComparatorOutputLevel(pos, getBlockState().getBlock());
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return areItemsValid(getItems());
}
@@ -65,12 +65,12 @@ public class TileDistributor extends TileMod implements IManaReceiver, ITickable
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
int tiles = validPools.size();
if (tiles != 0) {
int manaForEach = mana / tiles;
for (IManaReceiver pool : validPools) {
pool.recieveMana(manaForEach);
pool.receiveMana(manaForEach);
TileEntity tile = (TileEntity) pool;
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, tile.getPos());
}
@@ -78,7 +78,7 @@ public class TileDistributor extends TileMod implements IManaReceiver, ITickable
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return !isFull();
}
}
@@ -35,7 +35,7 @@ public class TileManaVoid extends TileMod implements IClientManaHandler {
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
if (mana > 0) {
for (int i = 0; i < 10; i++) {
SparkleParticleData data = SparkleParticleData.sparkle(0.7F + 0.5F * (float) Math.random(), 0.2F, 0.2F, 0.2F, 5);
@@ -45,7 +45,7 @@ public class TileManaVoid extends TileMod implements IClientManaHandler {
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return true;
}
@@ -17,12 +17,10 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
@@ -35,7 +33,6 @@ import net.minecraftforge.registries.ObjectHolder;
import org.lwjgl.opengl.GL11;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.VanillaPacketDispatcher;
import vazkii.botania.api.item.IManaDissolvable;
import vazkii.botania.api.mana.IKeyLocked;
@@ -119,7 +116,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
int old = this.mana;
this.mana = Math.max(0, Math.min(getCurrentMana() + mana, manaCap));
if (old != this.mana) {
@@ -194,7 +191,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
if (recipe != null) {
int mana = recipe.getManaToConsume();
if (getCurrentMana() >= mana) {
recieveMana(-mana);
receiveMana(-mana);
stack.shrink(1);
item.onGround = false; //Force entity collision update to run every tick if crafting is in progress
@@ -319,7 +316,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
int manaVal = Math.min(transfRate, Math.min(getCurrentMana(), mana.getMaxMana(stack) - mana.getMana(stack)));
mana.addMana(stack, manaVal);
recieveMana(-manaVal);
receiveMana(-manaVal);
}
} else {
if (canAccept) {
@@ -329,7 +326,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
int manaVal = Math.min(transfRate, Math.min(manaCap - getCurrentMana(), mana.getMana(stack)));
mana.addMana(stack, -manaVal);
recieveMana(manaVal);
receiveMana(manaVal);
}
}
@@ -435,7 +432,7 @@ public class TilePool extends TileMod implements IManaPool, IKeyLocked, ISparkAt
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return true;
}
@@ -136,12 +136,12 @@ public class TileRFGenerator extends TileMod implements IManaReceiver, ITickable
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.energy = Math.min(MAX_ENERGY, this.energy + mana * MANA_TO_FE);
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return true;
}
@@ -15,13 +15,11 @@ import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.projectile.ThrowableEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
@@ -157,7 +155,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
@Override
public void recieveMana(int mana) {
public void receiveMana(int mana) {
this.mana = Math.min(this.mana + mana, getMaxMana());
this.markDirty();
}
@@ -197,8 +195,8 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
if (manaInPool > 0 && !isFull()) {
int manaMissing = getMaxMana() - mana;
int manaToRemove = Math.min(manaInPool, manaMissing);
pool.recieveMana(-manaToRemove);
recieveMana(manaToRemove);
pool.receiveMana(-manaToRemove);
receiveMana(manaToRemove);
}
}
}
@@ -385,7 +383,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return true;
}
@@ -452,7 +450,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
private void tryShootBurst() {
boolean redstone = getVariant() == BlockSpreader.Variant.REDSTONE;
if ((receiver != null || redstone) && !invalidTentativeBurst) {
if (canShootBurst && (redstone || receiver.canRecieveManaFromBursts() && !receiver.isFull())) {
if (canShootBurst && (redstone || receiver.canReceiveManaFromBursts() && !receiver.isFull())) {
EntityManaBurst burst = getBurst(false);
if (burst != null) {
if (!world.isRemote) {
@@ -530,7 +530,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
}
if (tile == null || !tile.getPos().equals(coords)) {
if (!fake && !noParticles && (!world.isRemote || tile instanceof IClientManaHandler) && tile != null && tile instanceof IManaReceiver && ((IManaReceiver) tile).canRecieveManaFromBursts()) {
if (!fake && !noParticles && (!world.isRemote || tile instanceof IClientManaHandler) && tile != null && tile instanceof IManaReceiver && ((IManaReceiver) tile).canReceiveManaFromBursts()) {
onRecieverImpact((IManaReceiver) tile, tile.getPos());
}
@@ -549,7 +549,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
ILensEffect lens = getLensInstance();
if (lens != null) {
dead = lens.collideBurst(this, rtr, collidedTile instanceof IManaReceiver
&& ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens());
&& ((IManaReceiver) collidedTile).canReceiveManaFromBursts(), dead, getSourceLens());
}
if (pos != null && !hasAlreadyCollidedAt(pos)) {
@@ -598,7 +598,7 @@ public class EntityManaBurst extends ThrowableEntity implements IManaBurst {
mana *= ((IManaCollector) tile).getManaYieldMultiplier(this);
}
tile.recieveMana(mana);
tile.receiveMana(mana);
if (tile instanceof IThrottledPacket) {
((IThrottledPacket) tile).markDispatchable();
@@ -160,7 +160,7 @@ public class EntityPoolMinecart extends AbstractMinecartEntity {
int transfer = Math.min(TRANSFER_RATE, poolMana);
int actualTransfer = Math.min(TilePool.MAX_MANA - cartMana, transfer);
if (actualTransfer > 0) {
pool.recieveMana(-transfer);
pool.receiveMana(-transfer);
setMana(cartMana + actualTransfer);
did = true;
}
@@ -172,7 +172,7 @@ public class EntityPoolMinecart extends AbstractMinecartEntity {
int cartMana = getMana();
int transfer = Math.min(TRANSFER_RATE, cartMana);
if (transfer > 0) {
pool.recieveMana(transfer);
pool.receiveMana(transfer);
setMana(cartMana - transfer);
did = true;
}
@@ -157,7 +157,7 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
int cost = items.get(stack);
int manaToPut = Math.min(getAttachedTile().getCurrentMana(), cost);
((IManaItem) stack.getItem()).addMana(stack, manaToPut);
getAttachedTile().recieveMana(-manaToPut);
getAttachedTile().receiveMana(-manaToPut);
particlesTowards(player);
}
@@ -207,12 +207,12 @@ public class EntitySpark extends EntitySparkBase implements ISparkEntity {
ISparkAttachable attached = spark.getAttachedTile();
int spend = Math.min(attached.getAvailableSpaceForMana(), manaForEach);
attached.recieveMana(spend);
attached.receiveMana(spend);
manaSpent += spend;
particlesTowards((Entity) spark);
}
tile.recieveMana(-manaSpent);
tile.receiveMana(-manaSpent);
}
}
@@ -53,7 +53,7 @@ public class ItemBlackLotus extends Item implements IManaDissolvable {
boolean t2 = stack.getItem() == ModItems.blackerLotus;
if (!item.world.isRemote) {
pool.recieveMana(t2 ? MANA_PER_T2 : MANA_PER);
pool.receiveMana(t2 ? MANA_PER_T2 : MANA_PER);
stack.shrink(1);
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(item.world, tile.getPos());
PacketHandler.sendToNearby(item.world, item, new PacketBotaniaEffect(PacketBotaniaEffect.EffectType.BLACK_LOTUS_DISSOLVE, item.getX(), tile.getPos().getY() + 0.5, item.getZ()));
@@ -71,7 +71,7 @@ public class ItemManaMirror extends Item implements IManaItem, ICoordBoundItem,
if (pool == null) {
setMana(stack, 0);
} else {
pool.recieveMana(getManaBacklog(stack));
pool.receiveMana(getManaBacklog(stack));
setManaBacklog(stack, 0);
setMana(stack, pool.getCurrentMana());
}
@@ -194,10 +194,10 @@ public class ItemManaMirror extends Item implements IManaItem, ICoordBoundItem,
}
@Override
public void recieveMana(int mana) {}
public void receiveMana(int mana) {}
@Override
public boolean canRecieveManaFromBursts() {
public boolean canReceiveManaFromBursts() {
return false;
}
@@ -49,7 +49,7 @@ public class LensMagnet extends Lens {
BlockPos srcCoords = burst.getBurstSourceBlockPos();
if (tile.getPos().distanceSq(srcCoords) > 9 && receiver.canRecieveManaFromBursts() && !receiver.isFull()) {
if (tile.getPos().distanceSq(srcCoords) > 9 && receiver.canReceiveManaFromBursts() && !receiver.isFull()) {
Vector3 burstVec = Vector3.fromEntity(entity);
Vector3 tileVec = Vector3.fromTileEntityCenter(tile).add(0, -0.1, 0);
Vector3 motionVec = new Vector3(entity.getMotion());
@@ -113,7 +113,7 @@ public class ItemDirtRod extends Item implements IManaUsingItem, IBlockProvider,
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);
tile.receiveMana(-COST);
}
}
}
@@ -92,7 +92,7 @@ public class ItemDiviningRod extends Item implements IManaUsingItem, IAvatarWiel
World world = te.getWorld();
if (tile.getCurrentMana() >= COST && tile.getElapsedFunctionalTicks() % 200 == 0 && tile.isEnabled()) {
doHighlight(world, te.getPos(), 18, te.getPos().hashCode());
tile.recieveMana(-COST);
tile.receiveMana(-COST);
}
}
@@ -77,7 +77,7 @@ public class ItemFireRod extends Item implements IManaUsingItem, IAvatarWieldabl
EntityFlameRing entity = new EntityFlameRing(world);
entity.setPosition(te.getPos().getX() + 0.5, te.getPos().getY(), te.getPos().getZ() + 0.5);
world.addEntity(entity);
tile.recieveMana(-COST);
tile.receiveMana(-COST);
}
}
@@ -109,7 +109,7 @@ public class ItemMissileRod extends Item implements IManaUsingItem, IAvatarWield
if (tile.getCurrentMana() >= COST_AVATAR && tile.getElapsedFunctionalTicks() % 3 == 0 && tile.isEnabled()) {
if (spawnMissile(world, null, te.getPos().getX() + 0.5 + (Math.random() - 0.5 * 0.1), te.getPos().getY() + 2.5 + (Math.random() - 0.5 * 0.1), te.getPos().getZ() + (Math.random() - 0.5 * 0.1))) {
if (!world.isRemote) {
tile.recieveMana(-COST_AVATAR);
tile.receiveMana(-COST_AVATAR);
}
SparkleParticleData data = SparkleParticleData.sparkle(6F, 1F, 0.4F, 1F, 6);
world.addParticle(data, te.getPos().getX() + 0.5, te.getPos().getY() + 2.5, te.getPos().getZ() + 0.5, 0, 0, 0);
@@ -190,12 +190,12 @@ public class ItemRainbowRod extends Item implements IManaUsingItem, IAvatarWield
world.setBlockState(pos, ModBlocks.bifrost.getDefaultState());
TileBifrost tileBifrost = (TileBifrost) world.getTileEntity(pos);
tileBifrost.ticks = 10;
tile.recieveMana(-MANA_COST_AVATAR);
tile.receiveMana(-MANA_COST_AVATAR);
} else if (block == ModBlocks.bifrost) {
TileBifrost tileBifrost = (TileBifrost) world.getTileEntity(pos);
if (tileBifrost.ticks < 2) {
tileBifrost.ticks = 10;
tile.recieveMana(-MANA_COST_AVATAR);
tile.receiveMana(-MANA_COST_AVATAR);
}
}
}
@@ -160,7 +160,7 @@ public class ItemTornadoRod extends Item implements IManaUsingItem, IAvatarWield
if (!world.isRemote) {
p.world.playSound(null, p.getX(), p.getY(), p.getZ(), ModSounds.dash, SoundCategory.PLAYERS, 1F, 1F);
p.addPotionEffect(new EffectInstance(ModPotions.featherfeet, 100, 0));
tile.recieveMana(-COST);
tile.receiveMana(-COST);
}
}
}