
The new one is now built for the api jar and the old one is now internal. It will slowly be moved around to sane places within the internal code. Most of the features provided in the old "api" are addon specific features which will generally rely on the main jar anyways. The new API will be specific to compatibility features, such as blacklists, recipes, and value modification.
99 lines
3.5 KiB
Java
99 lines
3.5 KiB
Java
package WayofTime.bloodmagic.ritual;
|
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
|
import WayofTime.bloodmagic.apibutnotreally.ritual.*;
|
|
import WayofTime.bloodmagic.item.ItemComponent;
|
|
import WayofTime.bloodmagic.tile.TileAlchemyArray;
|
|
import net.minecraft.block.Block;
|
|
import net.minecraft.init.Blocks;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.util.math.BlockPos;
|
|
import net.minecraft.world.World;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
public class RitualCobblestone extends Ritual {
|
|
|
|
public static final String COBBLESTONE_RANGE = "cobblestoneRange";
|
|
|
|
public RitualCobblestone() {
|
|
super("ritualCobblestone", 0, 500, "ritual." + BloodMagic.MODID + ".cobblestoneRitual");
|
|
addBlockRange(COBBLESTONE_RANGE, new AreaDescriptor.Cross(new BlockPos(0, 1, 0), 1));
|
|
}
|
|
|
|
@Override
|
|
public void performRitual(IMasterRitualStone masterRitualStone) {
|
|
World world = masterRitualStone.getWorldObj();
|
|
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
|
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
|
|
Block block = Blocks.COBBLESTONE;
|
|
|
|
if (currentEssence < getRefreshCost()) {
|
|
masterRitualStone.getOwnerNetwork().causeNausea();
|
|
return;
|
|
}
|
|
|
|
int maxEffects = currentEssence / getRefreshCost();
|
|
int totalEffects = 0;
|
|
|
|
AreaDescriptor cobblestoneRange = getBlockRange(COBBLESTONE_RANGE);
|
|
|
|
if (tileEntity != null && tileEntity instanceof TileAlchemyArray) {
|
|
TileAlchemyArray alchemyArray = (TileAlchemyArray) tileEntity;
|
|
if (!alchemyArray.getStackInSlot(0).isEmpty() && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent) {
|
|
switch (alchemyArray.getStackInSlot(0).getItemDamage()) {
|
|
case 0:
|
|
block = Blocks.OBSIDIAN;
|
|
alchemyArray.decrStackSize(0, 1);
|
|
world.setBlockToAir(alchemyArray.getPos());
|
|
break;
|
|
case 1:
|
|
block = Blocks.NETHERRACK;
|
|
alchemyArray.decrStackSize(0, 1);
|
|
world.setBlockToAir(alchemyArray.getPos());
|
|
break;
|
|
/*
|
|
* case 4: block = Blocks.end_stone;
|
|
* alchemyArray.decrStackSize(0, 1);
|
|
* world.setBlockToAir(alchemyArray.getPos()); break;
|
|
*/
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
for (BlockPos blockPos : cobblestoneRange.getContainedPositions(masterRitualStone.getBlockPos())) {
|
|
if (world.isAirBlock(blockPos)) {
|
|
world.setBlockState(blockPos, block.getDefaultState());
|
|
totalEffects++;
|
|
}
|
|
|
|
if (totalEffects >= maxEffects) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
masterRitualStone.getOwnerNetwork().syphon(getRefreshCost() * totalEffects);
|
|
}
|
|
|
|
@Override
|
|
public int getRefreshCost() {
|
|
return 25;
|
|
}
|
|
|
|
@Override
|
|
public ArrayList<RitualComponent> getComponents() {
|
|
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
|
|
|
this.addCornerRunes(components, 1, 1, EnumRuneType.FIRE);
|
|
this.addParallelRunes(components, 1, 0, EnumRuneType.WATER);
|
|
|
|
return components;
|
|
}
|
|
|
|
@Override
|
|
public Ritual getNewCopy() {
|
|
return new RitualCobblestone();
|
|
}
|
|
}
|