Readded Fluid capabilities to altar.

Also readded the recipe for the bucket of life.
This commit is contained in:
WayofTime 2020-11-08 21:04:20 -05:00
parent be8737c096
commit 0297f3a979
5 changed files with 55 additions and 37 deletions

View file

@ -302,6 +302,7 @@ f41e9bf8376ffcad07752b5657e27e06e500be0a data/bloodmagic/recipes/alchemytable/pl
a91e81c79959b522bcd1bac901bca646184015de data/bloodmagic/recipes/alchemytable/string.json
3c9d829f7bff8a4d607c46fc3ff4f86dffa28fd5 data/bloodmagic/recipes/altar/air_tool.json
f41b0e9dfab608c42a85c3c5c5bbc050b03f02a1 data/bloodmagic/recipes/altar/apprenticebloodorb.json
2269c03d8ba4b790fb6a30c32bdb0169c283e5e2 data/bloodmagic/recipes/altar/bucket_life.json
2a67e37497a571b5ee944375d315fddccea87697 data/bloodmagic/recipes/altar/daggerofsacrifice.json
c5a4a256a7437f2e13c574a6f0c4d75fc2e718cb data/bloodmagic/recipes/altar/demonicslate.json
d79a96eb3eed597f1c18a8983764a6362a24748c data/bloodmagic/recipes/altar/dusk_tool.json

View file

@ -0,0 +1,13 @@
{
"type": "bloodmagic:altar",
"input": {
"item": "minecraft:bucket"
},
"output": {
"item": "bloodmagic:life_essence_bucket"
},
"upgradeLevel": 0,
"altarSyphon": 1000,
"consumptionRate": 5,
"drainRate": 0
}

View file

@ -350,8 +350,7 @@ public class BloodAltar// implements IFluidHandler
// server.spawnParticle(ParticleTypes.SPLASH, (double) pos.getX()
// + worldIn.rand.nextDouble(), (double) (pos.getY() + 1), (double) pos.getZ()
// + worldIn.rand.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D);
server.spawnParticle(RedstoneParticleData.REDSTONE_DUST, pos.getX() + 0.5, pos.getY()
+ 1.0, pos.getZ() + 0.5, 1, 0.2, 0.0, 0.2, 0.0);
server.spawnParticle(RedstoneParticleData.REDSTONE_DUST, pos.getX() + 0.5, pos.getY() + 1.0, pos.getZ() + 0.5, 1, 0.2, 0.0, 0.2, 0.0);
}
} else if (!hasOperated && progress > 0)
@ -361,8 +360,7 @@ public class BloodAltar// implements IFluidHandler
if (internalCounter % 2 == 0 && world instanceof ServerWorld)
{
ServerWorld server = (ServerWorld) world;
server.spawnParticle(ParticleTypes.LARGE_SMOKE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ()
+ 0.5, 1, 0.1, 0, 0.1, 0);
server.spawnParticle(ParticleTypes.LARGE_SMOKE, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0.1, 0, 0.1, 0);
}
}
@ -380,8 +378,7 @@ public class BloodAltar// implements IFluidHandler
if (world instanceof ServerWorld)
{
ServerWorld server = (ServerWorld) world;
server.spawnParticle(RedstoneParticleData.REDSTONE_DUST, pos.getX() + 0.5, pos.getY()
+ 1, pos.getZ() + 0.5, 40, 0.3, 0, 0.3, 0);
server.spawnParticle(RedstoneParticleData.REDSTONE_DUST, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 40, 0.3, 0, 0.3, 0);
}
this.cooldownAfterCrafting = 30;
@ -416,8 +413,7 @@ public class BloodAltar// implements IFluidHandler
if (drain > 0 && internalCounter % 4 == 0 && world instanceof ServerWorld)
{
ServerWorld server = (ServerWorld) world;
server.spawnParticle(ParticleTypes.WITCH, pos.getX() + 0.5, pos.getY() + 1, pos.getZ()
+ 0.5, 1, 0, 0, 0, 0.001);
server.spawnParticle(ParticleTypes.WITCH, pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5, 1, 0, 0, 0, 0.001);
}
}
}
@ -460,8 +456,9 @@ public class BloodAltar// implements IFluidHandler
this.efficiencyMultiplier = (float) Math.pow(0.85, upgrade.getLevel(BloodRuneType.EFFICIENCY));
this.sacrificeEfficiencyMultiplier = (float) (0.10 * upgrade.getLevel(BloodRuneType.SACRIFICE));
this.selfSacrificeEfficiencyMultiplier = (float) (0.10 * upgrade.getLevel(BloodRuneType.SELF_SACRIFICE));
this.capacityMultiplier = (float) ((1 * Math.pow(1.10, upgrade.getLevel(BloodRuneType.AUGMENTED_CAPACITY)))
+ 0.20 * upgrade.getLevel(BloodRuneType.CAPACITY));
this.capacityMultiplier = (float) ((1
* Math.pow(1.10, upgrade.getLevel(BloodRuneType.AUGMENTED_CAPACITY))) + 0.20
* upgrade.getLevel(BloodRuneType.CAPACITY));
this.dislocationMultiplier = (float) (Math.pow(1.2, upgrade.getLevel(BloodRuneType.DISPLACEMENT)));
this.orbCapacityMultiplier = (float) (1 + 0.02 * upgrade.getLevel(BloodRuneType.ORB));
this.chargingFrequency = Math.max(20 - accelerationUpgrades, 1);
@ -497,15 +494,15 @@ public class BloodAltar// implements IFluidHandler
{
if (this.lockdownDuration > 0)
{
int amt = (int) Math.min(bufferCapacity
- fluidInput.getAmount(), (isSacrifice ? 1 + sacrificeEfficiencyMultiplier
: 1 + selfSacrificeEfficiencyMultiplier) * amount);
int amt = (int) Math.min(bufferCapacity - fluidInput.getAmount(), (isSacrifice
? 1 + sacrificeEfficiencyMultiplier
: 1 + selfSacrificeEfficiencyMultiplier) * amount);
fluidInput.setAmount(fluidInput.getAmount() + amt);
} else
{
fluid.setAmount((int) (fluid.getAmount()
+ Math.min(capacity - fluid.getAmount(), (isSacrifice ? 1 + sacrificeEfficiencyMultiplier
: 1 + selfSacrificeEfficiencyMultiplier) * amount)));
fluid.setAmount((int) (fluid.getAmount() + Math.min(capacity - fluid.getAmount(), (isSacrifice
? 1 + sacrificeEfficiencyMultiplier
: 1 + selfSacrificeEfficiencyMultiplier) * amount)));
}
}
@ -758,11 +755,11 @@ public class BloodAltar// implements IFluidHandler
return currentTierDisplayed;
}
static class VariableSizeFluidHandler implements IFluidHandler
public static class VariableSizeFluidHandler implements IFluidHandler
{
BloodAltar altar;
VariableSizeFluidHandler(BloodAltar altar)
public VariableSizeFluidHandler(BloodAltar altar)
{
this.altar = altar;
}
@ -777,21 +774,19 @@ public class BloodAltar// implements IFluidHandler
@Override
public FluidStack getFluidInTank(int tank)
{
// TODO Auto-generated method stub
return null;
return altar.fluid;
}
@Override
public int getTankCapacity(int tank)
{
// TODO Auto-generated method stub
return 0;
return altar.getCapacity();
}
@Override
public boolean isFluidValid(int tank, FluidStack stack)
{
return false;
return stack.getFluid() == BloodMagicBlocks.LIFE_ESSENCE_FLUID.get();
}
@Override
@ -809,8 +804,7 @@ public class BloodAltar// implements IFluidHandler
@Override
public FluidStack drain(int maxDrain, FluidAction action)
{
// TODO Auto-generated method stub
return null;
return altar.drain(maxDrain, action == FluidAction.EXECUTE);
}
}
}

View file

@ -10,6 +10,7 @@ import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
import wayoftime.bloodmagic.BloodMagic;
import wayoftime.bloodmagic.altar.AltarTier;
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
import wayoftime.bloodmagic.common.data.recipe.builder.BloodAltarRecipeBuilder;
import wayoftime.bloodmagic.common.item.BloodMagicItems;
@ -24,6 +25,7 @@ public class BloodAltarRecipeProvider implements ISubRecipeProvider
// ONE
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.GEMS_DIAMOND), new ItemStack(BloodMagicItems.WEAK_BLOOD_ORB.get()), AltarTier.ONE.ordinal(), 2000, 2, 1).build(consumer, new ResourceLocation(BloodMagic.MODID, basePath + "weakbloodorb"));
BloodAltarRecipeBuilder.altar(Ingredient.fromTag(Tags.Items.STONE), new ItemStack(BloodMagicItems.SLATE.get()), AltarTier.ONE.ordinal(), 1000, 5, 5).build(consumer, new ResourceLocation(BloodMagic.MODID, basePath + "slate"));
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(Items.BUCKET), new ItemStack(BloodMagicBlocks.LIFE_ESSENCE_BUCKET.get()), AltarTier.ONE.ordinal(), 1000, 5, 0).build(consumer, BloodMagic.rl(basePath + "bucket_life"));
// TWO
BloodAltarRecipeBuilder.altar(Ingredient.fromItems(BloodMagicItems.SLATE.get()), new ItemStack(BloodMagicItems.REINFORCED_SLATE.get()), AltarTier.TWO.ordinal(), 2000, 5, 5).build(consumer, BloodMagic.rl(basePath + "reinforcedslate"));

View file

@ -1,9 +1,16 @@
package wayoftime.bloodmagic.tile;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.registries.ObjectHolder;
import wayoftime.bloodmagic.altar.AltarTier;
import wayoftime.bloodmagic.altar.BloodAltar;
@ -201,7 +208,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickableTi
{
return bloodAltar.setCurrentTierDisplayed(altarTier);
}
//
// @Override
// public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing)
// {
@ -212,16 +219,17 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickableTi
//
// return super.hasCapability(capability, facing);
// }
//
// @SuppressWarnings("unchecked")
// @Override
// public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing)
// {
// if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
// {
@SuppressWarnings("unchecked")
@Override
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing)
{
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
{
return LazyOptional.of(() -> new BloodAltar.VariableSizeFluidHandler(bloodAltar)).cast();
// return (T) bloodAltar;
// }
//
// return super.getCapability(capability, facing);
// }
}
return super.getCapability(capability, facing);
}
}