Added the "Resonance of the Faceted Crystal"
This commit is contained in:
parent
7e2dc3f4e7
commit
60c8441115
9 changed files with 296 additions and 58 deletions
|
@ -101,6 +101,7 @@ public class ConfigHandler
|
|||
public boolean ritualMeteor = true;
|
||||
public boolean ritualDowngrade = true;
|
||||
public boolean ritualEllipsoid = true;
|
||||
public boolean ritualCrystalSplit = true;
|
||||
public ConfigImperfectRituals imperfect = new ConfigImperfectRituals();
|
||||
}
|
||||
|
||||
|
|
|
@ -24,10 +24,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class CategoryRitual {
|
||||
public class CategoryRitual
|
||||
{
|
||||
static String keyBase = "guide." + BloodMagic.MODID + ".entry.ritual.";
|
||||
|
||||
public static Map<ResourceLocation, EntryAbstract> buildCategory() {
|
||||
public static Map<ResourceLocation, EntryAbstract> buildCategory()
|
||||
{
|
||||
Map<ResourceLocation, EntryAbstract> entries = new LinkedHashMap<>();
|
||||
|
||||
addRitualPagesToEntries("intro", entries);
|
||||
|
@ -36,16 +38,19 @@ public class CategoryRitual {
|
|||
List<IPage> ritualStonePages = new ArrayList<>();
|
||||
|
||||
IRecipe ritualStoneRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.RITUAL_STONE));
|
||||
if (ritualStoneRecipe != null) {
|
||||
if (ritualStoneRecipe != null)
|
||||
{
|
||||
ritualStonePages.add(BookUtils.getPageForRecipe(ritualStoneRecipe));
|
||||
}
|
||||
|
||||
ritualStonePages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "ritualStone" + ".info.1"), 370));
|
||||
|
||||
for (int i = 1; i < 5; i++) {
|
||||
for (int i = 1; i < 5; i++)
|
||||
{
|
||||
EnumRuneType type = EnumRuneType.values()[i];
|
||||
AltarRecipe scribeRecipe = RecipeHelper.getAltarRecipeForOutput(type.getStack());
|
||||
if (scribeRecipe != null) {
|
||||
if (scribeRecipe != null)
|
||||
{
|
||||
ritualStonePages.add(new PageAltarRecipe(scribeRecipe));
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +61,8 @@ public class CategoryRitual {
|
|||
List<IPage> masterRitualStonePages = new ArrayList<>();
|
||||
|
||||
IRecipe masterRitualStoneRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicBlocks.RITUAL_CONTROLLER, 1, 0));
|
||||
if (masterRitualStoneRecipe != null) {
|
||||
if (masterRitualStoneRecipe != null)
|
||||
{
|
||||
masterRitualStonePages.add(BookUtils.getPageForRecipe(masterRitualStoneRecipe));
|
||||
}
|
||||
|
||||
|
@ -68,7 +74,8 @@ public class CategoryRitual {
|
|||
activationCrystalPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "activationCrystal" + ".info.1"), 370));
|
||||
|
||||
AltarRecipe crystalRecipe = RecipeHelper.getAltarRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.ACTIVATION_CRYSTAL));
|
||||
if (crystalRecipe != null) {
|
||||
if (crystalRecipe != null)
|
||||
{
|
||||
activationCrystalPages.add(new PageAltarRecipe(crystalRecipe));
|
||||
}
|
||||
|
||||
|
@ -80,7 +87,8 @@ public class CategoryRitual {
|
|||
divinerPages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + "diviner" + ".info.1"), 370));
|
||||
|
||||
IRecipe divinerRecipe = RecipeHelper.getRecipeForOutput(new ItemStack(RegistrarBloodMagicItems.RITUAL_DIVINER));
|
||||
if (divinerRecipe != null) {
|
||||
if (divinerRecipe != null)
|
||||
{
|
||||
divinerPages.add(BookUtils.getPageForRecipe(divinerRecipe));
|
||||
}
|
||||
|
||||
|
@ -107,10 +115,14 @@ public class CategoryRitual {
|
|||
addRitualPagesToEntries("timberman", entries);
|
||||
addRitualPagesToEntries("meteor", entries);
|
||||
addRitualPagesToEntries("downgrade", entries);
|
||||
addRitualPagesToEntries("crystalSplit", entries);
|
||||
|
||||
for (Entry<ResourceLocation, EntryAbstract> entry : entries.entrySet()) {
|
||||
for (IPage page : entry.getValue().pageList) {
|
||||
if (page instanceof PageText) {
|
||||
for (Entry<ResourceLocation, EntryAbstract> entry : entries.entrySet())
|
||||
{
|
||||
for (IPage page : entry.getValue().pageList)
|
||||
{
|
||||
if (page instanceof PageText)
|
||||
{
|
||||
((PageText) page).setUnicodeFlag(true);
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +131,8 @@ public class CategoryRitual {
|
|||
return entries;
|
||||
}
|
||||
|
||||
public static void addRitualPagesToEntries(String name, Map<ResourceLocation, EntryAbstract> entries) {
|
||||
public static void addRitualPagesToEntries(String name, Map<ResourceLocation, EntryAbstract> entries)
|
||||
{
|
||||
List<IPage> pages = new ArrayList<>();
|
||||
pages.addAll(PageHelper.pagesForLongText(TextHelper.localize(keyBase + name + ".info"), 370));
|
||||
entries.put(new ResourceLocation(keyBase + name), new EntryText(pages, TextHelper.localize(keyBase + name), true));
|
||||
|
|
|
@ -49,6 +49,7 @@ public class ModRituals
|
|||
public static Ritual portalRitual;
|
||||
|
||||
public static Ritual ellipsoidRitual;
|
||||
public static Ritual crystalSplitRitual;
|
||||
|
||||
public static Ritual meteorRitual;
|
||||
|
||||
|
@ -125,6 +126,9 @@ public class ModRituals
|
|||
ellipsoidRitual = new RitualEllipsoid();
|
||||
RitualRegistry.registerRitual(ellipsoidRitual, ConfigHandler.rituals.ritualEllipsoid);
|
||||
|
||||
crystalSplitRitual = new RitualCrystalSplit();
|
||||
RitualRegistry.registerRitual(crystalSplitRitual, ConfigHandler.rituals.ritualCrystalSplit);
|
||||
|
||||
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.FluidType.BASIC.getStack(), 250, 0.5);
|
||||
RitualCrushing.registerCuttingFluid(ItemCuttingFluid.FluidType.EXPLOSIVE.getStack(), 25, 0.05);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,192 @@
|
|||
package WayofTime.bloodmagic.ritual.types;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.tile.TileDemonCrystal;
|
||||
|
||||
public class RitualCrystalSplit extends Ritual
|
||||
{
|
||||
public RitualCrystalSplit()
|
||||
{
|
||||
super("ritualCrystalSplit", 0, 20000, "ritual." + BloodMagic.MODID + ".crystalSplitRitual");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
||||
BlockPos pos = masterRitualStone.getBlockPos();
|
||||
EnumFacing direction = masterRitualStone.getDirection();
|
||||
BlockPos rawPos = pos.up(2);
|
||||
|
||||
TileEntity tile = world.getTileEntity(rawPos);
|
||||
if (!(tile instanceof TileDemonCrystal) || ((TileDemonCrystal) tile).getType() != EnumDemonWillType.DEFAULT)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IBlockState rawState = world.getBlockState(rawPos);
|
||||
|
||||
TileDemonCrystal rawTile = (TileDemonCrystal) tile;
|
||||
if (rawTile.crystalCount >= 5)
|
||||
{
|
||||
BlockPos vengefulPos = pos.offset(rotateFacing(EnumFacing.NORTH, direction)).up();
|
||||
BlockPos corrosivePos = pos.offset(rotateFacing(EnumFacing.EAST, direction)).up();
|
||||
BlockPos steadfastPos = pos.offset(rotateFacing(EnumFacing.SOUTH, direction)).up();
|
||||
BlockPos destructivePos = pos.offset(rotateFacing(EnumFacing.WEST, direction)).up();
|
||||
|
||||
int vengefulCrystals = 0;
|
||||
int corrosiveCrystals = 0;
|
||||
int steadfastCrystals = 0;
|
||||
int destructiveCrystals = 0;
|
||||
|
||||
tile = world.getTileEntity(vengefulPos);
|
||||
if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.VENGEFUL && ((TileDemonCrystal) tile).crystalCount < 7)
|
||||
{
|
||||
vengefulCrystals = ((TileDemonCrystal) tile).crystalCount;
|
||||
} else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(vengefulPos))
|
||||
{
|
||||
// #donothing, no point setting the crystal to 0 again
|
||||
} else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tile = world.getTileEntity(corrosivePos);
|
||||
if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.CORROSIVE && ((TileDemonCrystal) tile).crystalCount < 7)
|
||||
{
|
||||
corrosiveCrystals = ((TileDemonCrystal) tile).crystalCount;
|
||||
} else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(corrosivePos))
|
||||
{
|
||||
|
||||
} else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tile = world.getTileEntity(steadfastPos);
|
||||
if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.STEADFAST && ((TileDemonCrystal) tile).crystalCount < 7)
|
||||
{
|
||||
steadfastCrystals = ((TileDemonCrystal) tile).crystalCount;
|
||||
} else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(steadfastPos))
|
||||
{
|
||||
|
||||
} else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
tile = world.getTileEntity(destructivePos);
|
||||
if (tile instanceof TileDemonCrystal && ((TileDemonCrystal) tile).getType() == EnumDemonWillType.DESTRUCTIVE && ((TileDemonCrystal) tile).crystalCount < 7)
|
||||
{
|
||||
destructiveCrystals = ((TileDemonCrystal) tile).crystalCount;
|
||||
} else if (!(tile instanceof TileDemonCrystal) && world.isAirBlock(destructivePos))
|
||||
{
|
||||
|
||||
} else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
rawTile.crystalCount -= 4;
|
||||
|
||||
growCrystal(world, vengefulPos, EnumDemonWillType.VENGEFUL, vengefulCrystals);
|
||||
growCrystal(world, corrosivePos, EnumDemonWillType.CORROSIVE, corrosiveCrystals);
|
||||
growCrystal(world, steadfastPos, EnumDemonWillType.STEADFAST, steadfastCrystals);
|
||||
growCrystal(world, destructivePos, EnumDemonWillType.DESTRUCTIVE, destructiveCrystals);
|
||||
rawTile.markDirty();
|
||||
world.notifyBlockUpdate(rawPos, rawState, rawState, 3);
|
||||
}
|
||||
}
|
||||
|
||||
public EnumFacing rotateFacing(EnumFacing facing, EnumFacing rotation)
|
||||
{
|
||||
switch (rotation)
|
||||
{
|
||||
case EAST:
|
||||
return facing.rotateY();
|
||||
case SOUTH:
|
||||
return facing.rotateY().rotateY();
|
||||
case WEST:
|
||||
return facing.rotateYCCW();
|
||||
case NORTH:
|
||||
default:
|
||||
return facing;
|
||||
}
|
||||
}
|
||||
|
||||
public void growCrystal(World world, BlockPos pos, EnumDemonWillType type, int currentCrystalCount)
|
||||
{
|
||||
if (currentCrystalCount <= 0)
|
||||
{
|
||||
world.setBlockState(pos, RegistrarBloodMagicBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal()), 3);
|
||||
} else
|
||||
{
|
||||
TileDemonCrystal tile = (TileDemonCrystal) world.getTileEntity(pos);
|
||||
tile.crystalCount++;
|
||||
tile.markDirty();
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
world.notifyBlockUpdate(pos, state, state, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
return 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gatherComponents(Consumer<RitualComponent> components)
|
||||
{
|
||||
addRune(components, 0, 0, -1, EnumRuneType.FIRE);
|
||||
addRune(components, 1, 0, 0, EnumRuneType.EARTH);
|
||||
addRune(components, 0, 0, 1, EnumRuneType.WATER);
|
||||
addRune(components, -1, 0, 0, EnumRuneType.AIR);
|
||||
|
||||
this.addOffsetRunes(components, 1, 2, -1, EnumRuneType.DUSK);
|
||||
this.addCornerRunes(components, 1, 0, EnumRuneType.BLANK);
|
||||
this.addParallelRunes(components, 2, 0, EnumRuneType.DUSK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
return new RitualCrystalSplit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITextComponent[] provideInformationOfRitualToPlayer(EntityPlayer player)
|
||||
{
|
||||
return new ITextComponent[] { new TextComponentTranslation(this.getUnlocalizedName() + ".info") };
|
||||
}
|
||||
}
|
|
@ -1,16 +1,17 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import WayofTime.bloodmagic.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.block.BlockDemonCrystal;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.tile.base.TileTicking;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.inventory.InventoryHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import WayofTime.bloodmagic.block.BlockDemonCrystal;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.tile.base.TileTicking;
|
||||
|
||||
public class TileDemonCrystal extends TileTicking
|
||||
{
|
||||
|
@ -42,12 +43,12 @@ public class TileDemonCrystal extends TileTicking
|
|||
|
||||
if (internalCounter % 20 == 0 && crystalCount < 7)
|
||||
{
|
||||
EnumDemonWillType type = EnumDemonWillType.values()[this.getBlockMetadata()];
|
||||
EnumDemonWillType type = getType();
|
||||
|
||||
double value = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
|
||||
if (type != EnumDemonWillType.DEFAULT)
|
||||
{
|
||||
if (value >= 100)
|
||||
if (value >= 0.5)
|
||||
{
|
||||
double nextProgress = getCrystalGrowthPerSecond(value);
|
||||
progressToNextCrystal += WorldDemonWillHandler.drainWill(getWorld(), getPos(), type, nextProgress * sameWillConversionRate, true) / sameWillConversionRate;
|
||||
|
@ -118,6 +119,11 @@ public class TileDemonCrystal extends TileTicking
|
|||
return percentDrain * progressPercentage;
|
||||
}
|
||||
|
||||
public EnumDemonWillType getType()
|
||||
{
|
||||
return EnumDemonWillType.values()[this.getBlockMetadata()];
|
||||
}
|
||||
|
||||
public void checkAndGrowCrystal()
|
||||
{
|
||||
if (progressToNextCrystal >= 1 && internalCounter % 100 == 0)
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
package WayofTime.bloodmagic.tile;
|
||||
|
||||
import WayofTime.bloodmagic.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.soul.IDemonWillConduit;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.tile.base.TileTicking;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
|
||||
import WayofTime.bloodmagic.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.soul.EnumDemonWillType;
|
||||
import WayofTime.bloodmagic.soul.IDemonWillConduit;
|
||||
import WayofTime.bloodmagic.tile.base.TileTicking;
|
||||
|
||||
public class TileDemonCrystallizer extends TileTicking implements IDemonWillConduit {
|
||||
public class TileDemonCrystallizer extends TileTicking implements IDemonWillConduit
|
||||
{
|
||||
public static final int maxWill = 100;
|
||||
public static final double drainRate = 1;
|
||||
public static final double willToFormCrystal = 99;
|
||||
|
@ -20,13 +21,16 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
public DemonWillHolder holder = new DemonWillHolder();
|
||||
public double internalCounter = 0;
|
||||
|
||||
public TileDemonCrystallizer() {
|
||||
public TileDemonCrystallizer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate() {
|
||||
if (getWorld().isRemote) {
|
||||
public void onUpdate()
|
||||
{
|
||||
if (getWorld().isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -35,11 +39,15 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
{
|
||||
EnumDemonWillType highestType = WorldDemonWillHandler.getHighestDemonWillType(getWorld(), pos);
|
||||
double amount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, highestType);
|
||||
if (amount >= willToFormCrystal) {
|
||||
if (amount >= willToFormCrystal)
|
||||
{
|
||||
internalCounter += getCrystalFormationRate(amount);
|
||||
if (internalCounter >= totalFormationTime) {
|
||||
if (WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal) {
|
||||
if (highestType == EnumDemonWillType.DEFAULT && formRandomSpecialCrystal(offsetPos) || formCrystal(highestType, offsetPos)) {
|
||||
if (internalCounter >= totalFormationTime)
|
||||
{
|
||||
if (WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, false) >= willToFormCrystal)
|
||||
{
|
||||
if (formCrystal(highestType, offsetPos))
|
||||
{
|
||||
WorldDemonWillHandler.drainWill(getWorld(), getPos(), highestType, willToFormCrystal, true);
|
||||
internalCounter = 0;
|
||||
}
|
||||
|
@ -49,10 +57,12 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
}
|
||||
}
|
||||
|
||||
public boolean formCrystal(EnumDemonWillType type, BlockPos position) {
|
||||
public boolean formCrystal(EnumDemonWillType type, BlockPos position)
|
||||
{
|
||||
getWorld().setBlockState(position, RegistrarBloodMagicBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal()));
|
||||
TileEntity tile = getWorld().getTileEntity(position);
|
||||
if (tile instanceof TileDemonCrystal) {
|
||||
if (tile instanceof TileDemonCrystal)
|
||||
{
|
||||
((TileDemonCrystal) tile).setPlacement(EnumFacing.UP);
|
||||
return true;
|
||||
}
|
||||
|
@ -60,26 +70,21 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean formRandomSpecialCrystal(BlockPos position) {
|
||||
if (getWorld().rand.nextDouble() > 0.1) {
|
||||
return formCrystal(EnumDemonWillType.DEFAULT, position);
|
||||
}
|
||||
EnumDemonWillType crystalType = EnumDemonWillType.values()[getWorld().rand.nextInt(EnumDemonWillType.values().length - 1) + 1];
|
||||
return formCrystal(crystalType, position);
|
||||
}
|
||||
|
||||
public double getCrystalFormationRate(double currentWill) {
|
||||
public double getCrystalFormationRate(double currentWill)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(NBTTagCompound tag) {
|
||||
public void deserialize(NBTTagCompound tag)
|
||||
{
|
||||
holder.readFromNBT(tag, "Will");
|
||||
internalCounter = tag.getDouble("internalCounter");
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound serialize(NBTTagCompound tag) {
|
||||
public NBTTagCompound serialize(NBTTagCompound tag)
|
||||
{
|
||||
holder.writeToNBT(tag, "Will");
|
||||
tag.setDouble("internalCounter", internalCounter);
|
||||
return tag;
|
||||
|
@ -88,21 +93,26 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
// IDemonWillConduit
|
||||
|
||||
@Override
|
||||
public int getWeight() {
|
||||
public int getWeight()
|
||||
{
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill) {
|
||||
if (amount <= 0) {
|
||||
public double fillDemonWill(EnumDemonWillType type, double amount, boolean doFill)
|
||||
{
|
||||
if (amount <= 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!canFill(type)) {
|
||||
if (!canFill(type))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!doFill) {
|
||||
if (!doFill)
|
||||
{
|
||||
return Math.min(maxWill - holder.getWill(type), amount);
|
||||
}
|
||||
|
||||
|
@ -110,14 +120,17 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
}
|
||||
|
||||
@Override
|
||||
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain) {
|
||||
public double drainDemonWill(EnumDemonWillType type, double amount, boolean doDrain)
|
||||
{
|
||||
double drained = amount;
|
||||
double current = holder.getWill(type);
|
||||
if (current < drained) {
|
||||
if (current < drained)
|
||||
{
|
||||
drained = current;
|
||||
}
|
||||
|
||||
if (doDrain) {
|
||||
if (doDrain)
|
||||
{
|
||||
return holder.drainWill(type, amount);
|
||||
}
|
||||
|
||||
|
@ -125,17 +138,20 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(EnumDemonWillType type) {
|
||||
public boolean canFill(EnumDemonWillType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(EnumDemonWillType type) {
|
||||
public boolean canDrain(EnumDemonWillType type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCurrentWill(EnumDemonWillType type) {
|
||||
public double getCurrentWill(EnumDemonWillType type)
|
||||
{
|
||||
return holder.getWill(type);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue