Finished implementation of Incense Altar and associated blocks.
Also added the recipe for the Ritual Tinkerer, as well as the finalized book entry for the Incense Altar.
This commit is contained in:
parent
7634404dac
commit
cb2db9bc50
108 changed files with 2197 additions and 81 deletions
|
@ -51,6 +51,7 @@ import wayoftime.bloodmagic.core.recipe.IngredientBloodOrb;
|
|||
import wayoftime.bloodmagic.core.registry.OrbRegistry;
|
||||
import wayoftime.bloodmagic.network.BloodMagicPacketHandler;
|
||||
import wayoftime.bloodmagic.potion.BloodMagicPotions;
|
||||
import wayoftime.bloodmagic.registry.ModTranquilityHandlers;
|
||||
import wayoftime.bloodmagic.ritual.RitualManager;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemicalReactionChamber;
|
||||
import wayoftime.bloodmagic.tile.TileAlchemyArray;
|
||||
|
@ -59,6 +60,7 @@ import wayoftime.bloodmagic.tile.TileAltar;
|
|||
import wayoftime.bloodmagic.tile.TileDemonCrucible;
|
||||
import wayoftime.bloodmagic.tile.TileDemonCrystal;
|
||||
import wayoftime.bloodmagic.tile.TileDemonCrystallizer;
|
||||
import wayoftime.bloodmagic.tile.TileIncenseAltar;
|
||||
import wayoftime.bloodmagic.tile.TileMasterRitualStone;
|
||||
import wayoftime.bloodmagic.tile.TileSoulForge;
|
||||
import wayoftime.bloodmagic.util.handler.event.GenericHandler;
|
||||
|
@ -122,6 +124,8 @@ public class BloodMagic
|
|||
|
||||
ModLoadingContext context = ModLoadingContext.get();
|
||||
context.registerConfig(ModConfig.Type.CLIENT, ConfigManager.CLIENT_SPEC);
|
||||
|
||||
ModTranquilityHandlers.init();
|
||||
}
|
||||
|
||||
private void registerRecipes(RegistryEvent.Register<IRecipeSerializer<?>> event)
|
||||
|
@ -166,6 +170,7 @@ public class BloodMagic
|
|||
event.getRegistry().register(TileEntityType.Builder.create(TileDemonCrystal::new, BloodMagicBlocks.RAW_CRYSTAL_BLOCK.get(), BloodMagicBlocks.CORROSIVE_CRYSTAL_BLOCK.get(), BloodMagicBlocks.DESTRUCTIVE_CRYSTAL_BLOCK.get(), BloodMagicBlocks.VENGEFUL_CRYSTAL_BLOCK.get(), BloodMagicBlocks.STEADFAST_CRYSTAL_BLOCK.get()).build(null).setRegistryName("demoncrystal"));
|
||||
event.getRegistry().register(TileEntityType.Builder.create(TileDemonCrucible::new, BloodMagicBlocks.DEMON_CRUCIBLE.get()).build(null).setRegistryName("demoncrucible"));
|
||||
event.getRegistry().register(TileEntityType.Builder.create(TileDemonCrystallizer::new, BloodMagicBlocks.DEMON_CRYSTALLIZER.get()).build(null).setRegistryName("demoncrystallizer"));
|
||||
event.getRegistry().register(TileEntityType.Builder.create(TileIncenseAltar::new, BloodMagicBlocks.INCENSE_ALTAR.get()).build(null).setRegistryName("incensealtar"));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
|
|
@ -276,11 +276,11 @@ public class BloodAltar// implements IFluidHandler
|
|||
|
||||
if (internalCounter % this.getChargingFrequency() == 0 && !this.isActive)
|
||||
{
|
||||
// int chargeInputted = Math.min(chargingRate, this.fluid.getAmount());
|
||||
// chargeInputted = Math.min(chargeInputted, maxCharge - totalCharge);
|
||||
// totalCharge += chargeInputted;
|
||||
// this.fluid.setAmount(this.fluid.getAmount() - chargeInputted);
|
||||
// tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
|
||||
int chargeInputted = Math.min(chargingRate, this.fluid.getAmount());
|
||||
chargeInputted = Math.min(chargeInputted, maxCharge - totalCharge);
|
||||
totalCharge += chargeInputted;
|
||||
this.fluid.setAmount(this.fluid.getAmount() - chargeInputted);
|
||||
tileAltar.getWorld().notifyBlockUpdate(tileAltar.getPos(), tileAltar.getWorld().getBlockState(tileAltar.getPos()), tileAltar.getWorld().getBlockState(tileAltar.getPos()), 3);
|
||||
}
|
||||
|
||||
if (internalCounter % 100 == 0 && (this.isActive || this.cooldownAfterCrafting <= 0))
|
||||
|
|
|
@ -32,14 +32,14 @@ public interface IBloodMagicAPI
|
|||
*/
|
||||
@Nonnull
|
||||
IBloodMagicRecipeRegistrar getRecipeRegistrar();
|
||||
//
|
||||
// /**
|
||||
// * Retrieves the instance of the value manager.
|
||||
// *
|
||||
// * @return the active {@link IBloodMagicValueManager} instance
|
||||
// */
|
||||
// @Nonnull
|
||||
// IBloodMagicValueManager getValueManager();
|
||||
|
||||
/**
|
||||
* Retrieves the instance of the value manager.
|
||||
*
|
||||
* @return the active {@link IBloodMagicValueManager} instance
|
||||
*/
|
||||
@Nonnull
|
||||
IBloodMagicValueManager getValueManager();
|
||||
|
||||
/**
|
||||
* Registers an {@link IBlockState} as a given component for the Blood Altar.
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package wayoftime.bloodmagic.api;
|
||||
|
||||
import javax.annotation.Nonnegative;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Allows value modification for various features of Blood Magic such as
|
||||
* Sacrificial values.
|
||||
*/
|
||||
public interface IBloodMagicValueManager
|
||||
{
|
||||
|
||||
/**
|
||||
* Sets the amount of LP received per health point from sacrificing the given
|
||||
* entity. By default, this is 25. Setting the value to 0 effectively disables
|
||||
* sacrificing.
|
||||
*
|
||||
* @param entityId The registry name of the entity.
|
||||
* @param value The amount of LP per health point to receive upon sacrifice.
|
||||
*/
|
||||
void setSacrificialValue(@Nonnull ResourceLocation entityId, @Nonnegative int value);
|
||||
|
||||
/**
|
||||
* Sets the Tranquility value of a given {@link IBlockState}.
|
||||
* <p>
|
||||
* Valid tranquility types:
|
||||
* <ul>
|
||||
* <li>PLANT</li>
|
||||
* <li>CROP</li>
|
||||
* <li>TREE</li>
|
||||
* <li>EARTHEN</li>
|
||||
* <li>WATER</li>
|
||||
* <li>FIRE</li>
|
||||
* <li>LAVA</li>
|
||||
* </ul>
|
||||
*
|
||||
* @param state The {@link IBlockState} to set the value of.
|
||||
* @param tranquilityType The type of Tranquility this block should provide.
|
||||
* @param value The amount of tranquility this block should provide.
|
||||
*/
|
||||
void setTranquility(@Nonnull BlockState state, @Nonnull String tranquilityType, double value);
|
||||
}
|
|
@ -19,14 +19,14 @@ public class BloodMagicAPI implements IBloodMagicAPI
|
|||
|
||||
// private final BloodMagicBlacklist blacklist;
|
||||
private final BloodMagicRecipeRegistrar recipeRegistrar;
|
||||
// private final BloodMagicValueManager valueManager;
|
||||
private final BloodMagicValueManager valueManager;
|
||||
private final Multimap<ComponentType, BlockState> altarComponents;
|
||||
|
||||
public BloodMagicAPI()
|
||||
{
|
||||
// this.blacklist = new BloodMagicBlacklist();
|
||||
this.recipeRegistrar = new BloodMagicRecipeRegistrar();
|
||||
// this.valueManager = new BloodMagicValueManager();
|
||||
this.valueManager = new BloodMagicValueManager();
|
||||
this.altarComponents = ArrayListMultimap.create();
|
||||
}
|
||||
|
||||
|
@ -43,13 +43,14 @@ public class BloodMagicAPI implements IBloodMagicAPI
|
|||
{
|
||||
return recipeRegistrar;
|
||||
}
|
||||
|
||||
//
|
||||
// @Nonnull
|
||||
// @Override
|
||||
// public BloodMagicValueManager getValueManager()
|
||||
// {
|
||||
// return valueManager;
|
||||
// }
|
||||
@Nonnull
|
||||
@Override
|
||||
public BloodMagicValueManager getValueManager()
|
||||
{
|
||||
return valueManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAltarComponent(@Nonnull BlockState state, @Nonnull String componentType)
|
||||
|
|
|
@ -4,6 +4,8 @@ import net.minecraft.block.Blocks;
|
|||
import wayoftime.bloodmagic.altar.ComponentType;
|
||||
import wayoftime.bloodmagic.api.IBloodMagicAPI;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.incense.EnumTranquilityType;
|
||||
import wayoftime.bloodmagic.incense.TranquilityStack;
|
||||
|
||||
public class BloodMagicCorePlugin
|
||||
{
|
||||
|
@ -11,6 +13,21 @@ public class BloodMagicCorePlugin
|
|||
|
||||
public void register(IBloodMagicAPI apiInterface)
|
||||
{
|
||||
BloodMagicAPI api = (BloodMagicAPI) apiInterface;
|
||||
api.getValueManager().setTranquility(Blocks.LAVA, new TranquilityStack(EnumTranquilityType.LAVA, 1.2D));
|
||||
// api.getValueManager().setTranquility(Blocks.FLOWING_LAVA, new TranquilityStack(EnumTranquilityType.LAVA, 1.2D));
|
||||
api.getValueManager().setTranquility(Blocks.WATER, new TranquilityStack(EnumTranquilityType.WATER, 1.0D));
|
||||
// api.getValueManager().setTranquility(Blocks.water, new TranquilityStack(EnumTranquilityType.WATER, 1.0D));
|
||||
api.getValueManager().setTranquility(BloodMagicBlocks.LIFE_ESSENCE_BLOCK.get(), new TranquilityStack(EnumTranquilityType.WATER, 1.5D));
|
||||
api.getValueManager().setTranquility(Blocks.NETHERRACK, new TranquilityStack(EnumTranquilityType.FIRE, 0.5D));
|
||||
api.getValueManager().setTranquility(Blocks.DIRT, new TranquilityStack(EnumTranquilityType.EARTHEN, 0.25D));
|
||||
api.getValueManager().setTranquility(Blocks.FARMLAND, new TranquilityStack(EnumTranquilityType.EARTHEN, 1.0D));
|
||||
api.getValueManager().setTranquility(Blocks.POTATOES, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
api.getValueManager().setTranquility(Blocks.CARROTS, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
api.getValueManager().setTranquility(Blocks.WHEAT, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
api.getValueManager().setTranquility(Blocks.NETHER_WART, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
api.getValueManager().setTranquility(Blocks.BEETROOTS, new TranquilityStack(EnumTranquilityType.CROP, 1.0D));
|
||||
|
||||
apiInterface.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), ComponentType.GLOWSTONE.name());
|
||||
apiInterface.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), ComponentType.GLOWSTONE.name());
|
||||
apiInterface.registerAltarComponent(BloodMagicBlocks.BLOODSTONE.get().getDefaultState(), ComponentType.BLOODSTONE.name());
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package wayoftime.bloodmagic.api.impl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import wayoftime.bloodmagic.api.IBloodMagicValueManager;
|
||||
import wayoftime.bloodmagic.incense.EnumTranquilityType;
|
||||
import wayoftime.bloodmagic.incense.TranquilityStack;
|
||||
import wayoftime.bloodmagic.util.BMLog;
|
||||
|
||||
public class BloodMagicValueManager implements IBloodMagicValueManager
|
||||
{
|
||||
|
||||
private final Map<ResourceLocation, Integer> sacrificial;
|
||||
private final Map<BlockState, TranquilityStack> tranquility;
|
||||
|
||||
public BloodMagicValueManager()
|
||||
{
|
||||
this.sacrificial = Maps.newHashMap();
|
||||
this.tranquility = Maps.newHashMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSacrificialValue(@Nonnull ResourceLocation entityId, int value)
|
||||
{
|
||||
BMLog.API_VERBOSE.info("Value Manager: Set sacrificial value of {} to {}.", entityId, value);
|
||||
sacrificial.put(entityId, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTranquility(@Nonnull BlockState state, @Nonnull String tranquilityType, double value)
|
||||
{
|
||||
EnumTranquilityType tranquility = null;
|
||||
for (EnumTranquilityType type : EnumTranquilityType.values())
|
||||
{
|
||||
if (type.name().equalsIgnoreCase(tranquilityType))
|
||||
{
|
||||
tranquility = type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (tranquility != null)
|
||||
{
|
||||
BMLog.API_VERBOSE.info("Value Manager: Set tranquility value of {} to {} @ {}", state, tranquilityType, value);
|
||||
this.tranquility.put(state, new TranquilityStack(tranquility, value));
|
||||
} else
|
||||
BMLog.API.warn("Invalid tranquility type: {}.", tranquilityType);
|
||||
}
|
||||
|
||||
public void setTranquility(Block block, TranquilityStack tranquilityStack)
|
||||
{
|
||||
for (BlockState state : block.getStateContainer().getValidStates())
|
||||
{
|
||||
BMLog.API_VERBOSE.info("Value Manager: Set tranquility value of {} to {} @ {}", state, tranquilityStack.type, tranquilityStack.value);
|
||||
tranquility.put(state, tranquilityStack);
|
||||
}
|
||||
}
|
||||
|
||||
public Map<ResourceLocation, Integer> getSacrificial()
|
||||
{
|
||||
return ImmutableMap.copyOf(sacrificial);
|
||||
}
|
||||
|
||||
public Map<BlockState, TranquilityStack> getTranquility()
|
||||
{
|
||||
return ImmutableMap.copyOf(tranquility);
|
||||
}
|
||||
}
|
|
@ -28,6 +28,7 @@ import wayoftime.bloodmagic.client.screens.ScreenAlchemyTable;
|
|||
import wayoftime.bloodmagic.client.screens.ScreenSoulForge;
|
||||
import wayoftime.bloodmagic.common.block.BloodMagicBlocks;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
import wayoftime.bloodmagic.common.item.ItemSacrificialDagger;
|
||||
import wayoftime.bloodmagic.common.item.sigil.ItemSigilToggleable;
|
||||
import wayoftime.bloodmagic.common.item.soul.ItemSentientSword;
|
||||
import wayoftime.bloodmagic.common.registries.BloodMagicEntityTypes;
|
||||
|
@ -79,6 +80,7 @@ public class ClientEvents
|
|||
registerMultiWillTool(BloodMagicItems.LESSER_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.COMMON_GEM.get());
|
||||
registerMultiWillTool(BloodMagicItems.GREATER_GEM.get());
|
||||
registerSacrificialKnife(BloodMagicItems.SACRIFICIAL_DAGGER.get());
|
||||
|
||||
ItemModelsProperties.registerProperty(BloodMagicItems.SENTIENT_SWORD.get(), BloodMagic.rl("active"), new IItemPropertyGetter()
|
||||
{
|
||||
|
@ -129,4 +131,21 @@ public class ClientEvents
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void registerSacrificialKnife(Item item)
|
||||
{
|
||||
ItemModelsProperties.registerProperty(item, BloodMagic.rl("incense"), new IItemPropertyGetter()
|
||||
{
|
||||
@Override
|
||||
public float call(ItemStack stack, ClientWorld world, LivingEntity entity)
|
||||
{
|
||||
Item item = stack.getItem();
|
||||
if (item instanceof ItemSacrificialDagger)
|
||||
{
|
||||
return ((ItemSacrificialDagger) item).canUseForSacrifice(stack) ? 1 : 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
57
src/main/java/wayoftime/bloodmagic/client/Sprite.java
Normal file
57
src/main/java/wayoftime/bloodmagic/client/Sprite.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
package wayoftime.bloodmagic.client;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class Sprite
|
||||
{
|
||||
|
||||
private final ResourceLocation textureLocation;
|
||||
private final int textureX;
|
||||
private final int textureY;
|
||||
private final int textureWidth;
|
||||
private final int textureHeight;
|
||||
|
||||
public Sprite(ResourceLocation textureLocation, int textureX, int textureY, int textureWidth, int textureHeight)
|
||||
{
|
||||
this.textureLocation = textureLocation;
|
||||
this.textureX = textureX;
|
||||
this.textureY = textureY;
|
||||
this.textureWidth = textureWidth;
|
||||
this.textureHeight = textureHeight;
|
||||
}
|
||||
|
||||
public ResourceLocation getTextureLocation()
|
||||
{
|
||||
return textureLocation;
|
||||
}
|
||||
|
||||
public int getTextureX()
|
||||
{
|
||||
return textureX;
|
||||
}
|
||||
|
||||
public int getTextureY()
|
||||
{
|
||||
return textureY;
|
||||
}
|
||||
|
||||
public int getTextureWidth()
|
||||
{
|
||||
return textureWidth;
|
||||
}
|
||||
|
||||
public int getTextureHeight()
|
||||
{
|
||||
return textureHeight;
|
||||
}
|
||||
|
||||
public void draw(MatrixStack matrixStack, int x, int y)
|
||||
{
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(getTextureLocation());
|
||||
AbstractGui.blit(matrixStack, x, y, 0, getTextureX(), getTextureY(), getTextureWidth(), getTextureHeight(), 256, 256);
|
||||
}
|
||||
}
|
|
@ -1,15 +1,90 @@
|
|||
package wayoftime.bloodmagic.client.hud;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Vector2f;
|
||||
import wayoftime.bloodmagic.BloodMagic;
|
||||
import wayoftime.bloodmagic.ConfigManager;
|
||||
import wayoftime.bloodmagic.client.Sprite;
|
||||
import wayoftime.bloodmagic.client.hud.element.ElementDemonAura;
|
||||
import wayoftime.bloodmagic.client.hud.element.ElementDivinedInformation;
|
||||
import wayoftime.bloodmagic.tile.TileAltar;
|
||||
import wayoftime.bloodmagic.tile.TileIncenseAltar;
|
||||
import wayoftime.bloodmagic.util.helper.NumeralHelper;
|
||||
|
||||
public class Elements
|
||||
{
|
||||
public static void registerElements()
|
||||
{
|
||||
ElementRegistry.registerHandler(new ResourceLocation(BloodMagic.MODID, "demon_will_aura"), new ElementDemonAura(), new Vector2f(ConfigManager.CLIENT.demonWillGaugeX.get().floatValue(), ConfigManager.CLIENT.demonWillGaugeY.get().floatValue()));
|
||||
|
||||
ElementRegistry.registerHandler(BloodMagic.rl("blood_altar"), new ElementDivinedInformation<TileAltar>(2, true, TileAltar.class)
|
||||
{
|
||||
@Override
|
||||
public void gatherInformation(Consumer<Pair<Sprite, Function<TileAltar, String>>> information)
|
||||
{
|
||||
// Current tier
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 0, 46, 16, 16), altar -> altar == null
|
||||
? "IV"
|
||||
: NumeralHelper.toRoman(altar.getTier().toInt())));
|
||||
// Stored/Capacity
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 16, 46, 16, 16), altar -> String.format("%d/%d", altar == null
|
||||
? 0
|
||||
: altar.getCurrentBlood(), altar == null ? 10000 : altar.getCapacity())));
|
||||
}
|
||||
}, new Vector2f(0.01F, 0.01F));
|
||||
|
||||
ElementRegistry.registerHandler(new ResourceLocation(BloodMagic.MODID, "blood_altar_adv"), new ElementDivinedInformation<TileAltar>(5, false, TileAltar.class)
|
||||
{
|
||||
@Override
|
||||
public void gatherInformation(Consumer<Pair<Sprite, Function<TileAltar, String>>> information)
|
||||
{
|
||||
// Current tier
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 0, 46, 16, 16), altar -> altar == null
|
||||
? "IV"
|
||||
: NumeralHelper.toRoman(altar.getTier().toInt())));
|
||||
// Stored/Capacity
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 16, 46, 16, 16), altar -> String.format("%d/%d", altar == null
|
||||
? 0
|
||||
: altar.getCurrentBlood(), altar == null ? 10000 : altar.getCapacity())));
|
||||
// Crafting progress/Crafting requirement
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 32, 46, 16, 16), altar -> {
|
||||
if (altar == null || !altar.isActive())
|
||||
return I18n.format("hud.bloodmagic.inactive");
|
||||
int progress = altar.getProgress();
|
||||
int totalLiquidRequired = altar.getLiquidRequired() * altar.getStackInSlot(0).getCount();
|
||||
return String.format("%d/%d", progress, totalLiquidRequired);
|
||||
}));
|
||||
// Consumption rate
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 48, 46, 16, 16), altar -> altar == null
|
||||
? "0"
|
||||
: String.valueOf((int) (altar.getConsumptionRate() * (altar.getConsumptionMultiplier() + 1)))));
|
||||
// Total charge
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 64, 46, 16, 16), altar -> altar == null
|
||||
? "0"
|
||||
: String.valueOf(altar.getTotalCharge())));
|
||||
}
|
||||
}, new Vector2f(0.01F, 0.01F));
|
||||
|
||||
ElementRegistry.registerHandler(new ResourceLocation(BloodMagic.MODID, "incense_altar"), new ElementDivinedInformation<TileIncenseAltar>(2, true, TileIncenseAltar.class)
|
||||
{
|
||||
@Override
|
||||
public void gatherInformation(Consumer<Pair<Sprite, Function<TileIncenseAltar, String>>> information)
|
||||
{
|
||||
// Current tranquility
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 80, 46, 16, 16), incense -> incense == null
|
||||
? "0"
|
||||
: String.valueOf((int) ((100D * (int) (100 * incense.tranquility)) / 100D))));
|
||||
// Sacrifice bonus
|
||||
information.accept(Pair.of(new Sprite(new ResourceLocation(BloodMagic.MODID, "textures/gui/widgets.png"), 96, 46, 16, 16), incense -> incense == null
|
||||
? "0"
|
||||
: String.valueOf((int) (100 * incense.incenseAddition))));
|
||||
}
|
||||
}, new Vector2f(0.01F, 0.01F));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
package wayoftime.bloodmagic.client.hud.element;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.Hand;
|
||||
import wayoftime.bloodmagic.common.item.BloodMagicItems;
|
||||
|
||||
public abstract class ElementDivinedInformation<T extends TileEntity> extends ElementTileInformation<T>
|
||||
{
|
||||
|
||||
private final boolean simple;
|
||||
|
||||
public ElementDivinedInformation(int lines, boolean simple, Class<T> tileClass)
|
||||
{
|
||||
super(100, lines, tileClass);
|
||||
this.simple = simple;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(Minecraft minecraft)
|
||||
{
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
ItemStack sigilStack = player.getHeldItem(Hand.MAIN_HAND);
|
||||
boolean flag = false;
|
||||
if (simple)
|
||||
{
|
||||
if (sigilStack.getItem() == BloodMagicItems.DIVINATION_SIGIL.get() || sigilStack.getItem() == BloodMagicItems.SEER_SIGIL.get())
|
||||
flag = true;
|
||||
else
|
||||
flag = isFlagSigilHolding(sigilStack, true);
|
||||
|
||||
// if (!flag)
|
||||
// {
|
||||
// sigilStack = player.getHeldItem(Hand.OFF_HAND);
|
||||
// if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION || sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER)
|
||||
// flag = true;
|
||||
// else
|
||||
// flag = isFlagSigilHolding(sigilStack, true);
|
||||
// }
|
||||
|
||||
} else
|
||||
{
|
||||
if (sigilStack.getItem() == BloodMagicItems.SEER_SIGIL.get())
|
||||
flag = true;
|
||||
else
|
||||
flag = isFlagSigilHolding(sigilStack, false);
|
||||
//
|
||||
// if (!flag)
|
||||
// {
|
||||
// sigilStack = player.getHeldItem(Hand.OFF_HAND);
|
||||
// if (sigilStack.getItem() == RegistrarBloodMagicItems.SIGIL_SEER)
|
||||
// flag = true;
|
||||
// else
|
||||
// flag = isFlagSigilHolding(sigilStack, false);
|
||||
// }
|
||||
}
|
||||
|
||||
return super.shouldRender(minecraft) && flag;
|
||||
}
|
||||
|
||||
private boolean isFlagSigilHolding(ItemStack sigilStack, boolean simple)
|
||||
{
|
||||
// if (sigilStack.getItem() instanceof ItemSigilHolding)
|
||||
// {
|
||||
// List<ItemStack> internalInv = ItemSigilHolding.getInternalInventory(sigilStack);
|
||||
// int currentSlot = ItemSigilHolding.getCurrentItemOrdinal(sigilStack);
|
||||
// if (internalInv != null && !internalInv.get(currentSlot).isEmpty())
|
||||
// {
|
||||
// return (internalInv.get(currentSlot).getItem() == RegistrarBloodMagicItems.SIGIL_SEER && !simple) || (internalInv.get(currentSlot).getItem() == RegistrarBloodMagicItems.SIGIL_DIVINATION && simple);
|
||||
// }
|
||||
// }
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
package wayoftime.bloodmagic.client.hud.element;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockRayTraceResult;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import wayoftime.bloodmagic.client.Sprite;
|
||||
|
||||
public abstract class ElementTileInformation<T extends TileEntity> extends HUDElement
|
||||
{
|
||||
|
||||
protected final Class<T> tileClass;
|
||||
private final List<Pair<Sprite, Function<T, String>>> information;
|
||||
|
||||
public ElementTileInformation(int width, int lines, Class<T> tileClass)
|
||||
{
|
||||
super(width, 18 * lines - 2);
|
||||
|
||||
this.tileClass = tileClass;
|
||||
this.information = Lists.newArrayList();
|
||||
gatherInformation(information::add);
|
||||
}
|
||||
|
||||
public abstract void gatherInformation(Consumer<Pair<Sprite, Function<T, String>>> information);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void draw(MatrixStack matrixStack, float partialTicks, int drawX, int drawY)
|
||||
{
|
||||
RayTraceResult trace = Minecraft.getInstance().objectMouseOver;
|
||||
if (trace == null || trace.getType() != RayTraceResult.Type.BLOCK)
|
||||
return;
|
||||
|
||||
T tile = (T) Minecraft.getInstance().world.getTileEntity(((BlockRayTraceResult) trace).getPos());
|
||||
|
||||
int yOffset = 0;
|
||||
for (Pair<Sprite, Function<T, String>> sprite : information)
|
||||
{
|
||||
sprite.getLeft().draw(matrixStack, drawX, drawY + yOffset);
|
||||
int textY = drawY + yOffset + (sprite.getLeft().getTextureHeight() / 4);
|
||||
Minecraft.getInstance().fontRenderer.drawStringWithShadow(matrixStack, (tile != null && tile.getClass() == tileClass)
|
||||
? sprite.getRight().apply(tile)
|
||||
: "?", drawX + sprite.getLeft().getTextureWidth() + 2, textY, Color.WHITE.getRGB());
|
||||
yOffset += sprite.getLeft().getTextureHeight() + 2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender(Minecraft minecraft)
|
||||
{
|
||||
RayTraceResult trace = Minecraft.getInstance().objectMouseOver;
|
||||
if (trace == null || trace.getType() != RayTraceResult.Type.BLOCK)
|
||||
return false;
|
||||
|
||||
TileEntity tile = Minecraft.getInstance().world.getTileEntity(((BlockRayTraceResult) trace).getPos());
|
||||
if (tile == null || !tileClass.isAssignableFrom(tile.getClass()))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockRenderType;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||
import net.minecraft.util.math.shapes.VoxelShape;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
import wayoftime.bloodmagic.tile.TileIncenseAltar;
|
||||
import wayoftime.bloodmagic.tile.TileSoulForge;
|
||||
|
||||
public class BlockIncenseAltar extends Block
|
||||
{
|
||||
protected static final VoxelShape BODY = Block.makeCuboidShape(5, 0, 5, 12, 16, 12);
|
||||
|
||||
public BlockIncenseAltar()
|
||||
{
|
||||
super(Properties.create(Material.IRON).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context)
|
||||
{
|
||||
return BODY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerDestroy(IWorld world, BlockPos blockPos, BlockState blockState)
|
||||
{
|
||||
TileSoulForge forge = (TileSoulForge) world.getTileEntity(blockPos);
|
||||
if (forge != null)
|
||||
forge.dropItems();
|
||||
|
||||
super.onPlayerDestroy(world, blockPos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving)
|
||||
{
|
||||
if (!state.isIn(newState.getBlock()))
|
||||
{
|
||||
TileEntity tileentity = worldIn.getTileEntity(pos);
|
||||
if (tileentity instanceof TileSoulForge)
|
||||
{
|
||||
((TileSoulForge) tileentity).dropItems();
|
||||
worldIn.updateComparatorOutputLevel(pos, this);
|
||||
}
|
||||
|
||||
super.onReplaced(state, worldIn, pos, newState, isMoving);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasTileEntity(BlockState state)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world)
|
||||
{
|
||||
return new TileIncenseAltar();
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockRenderType getRenderType(BlockState state)
|
||||
{
|
||||
return BlockRenderType.MODEL;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import wayoftime.bloodmagic.incense.IIncensePath;
|
||||
|
||||
public class BlockPath extends Block implements IIncensePath
|
||||
{
|
||||
protected final int pathLevel;
|
||||
|
||||
public BlockPath(int pathLevel, Properties properties)
|
||||
{
|
||||
super(properties);
|
||||
this.pathLevel = pathLevel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevelOfPath(World world, BlockPos pos, BlockState state)
|
||||
{
|
||||
return pathLevel;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package wayoftime.bloodmagic.common.block;
|
||||
|
||||
import net.minecraft.block.AbstractBlock;
|
||||
import net.minecraft.block.AbstractBlock.Properties;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.FlowingFluidBlock;
|
||||
|
@ -41,6 +42,7 @@ public class BloodMagicBlocks
|
|||
|
||||
// public static final RegistryObject<Block> BLOODSTONE = BASICBLOCKS.register("ruby_block", BloodstoneBlock::new);
|
||||
public static final RegistryObject<Block> SOUL_FORGE = BLOCKS.register("soulforge", BlockSoulForge::new);
|
||||
public static final RegistryObject<Block> INCENSE_ALTAR = BLOCKS.register("incensealtar", BlockIncenseAltar::new);
|
||||
public static final RegistryObject<Block> ALCHEMY_ARRAY = BLOCKS.register("alchemyarray", BlockAlchemyArray::new);
|
||||
public static final RegistryObject<Block> BLANK_RUNE = BASICBLOCKS.register("blankrune", () -> new BlockBloodRune(BloodRuneType.BLANK));
|
||||
public static final RegistryObject<Block> SPEED_RUNE = BASICBLOCKS.register("speedrune", () -> new BlockBloodRune(BloodRuneType.SPEED));
|
||||
|
@ -81,6 +83,15 @@ public class BloodMagicBlocks
|
|||
public static final RegistryObject<Block> VENGEFUL_CRYSTAL_BLOCK = BLOCKS.register("vengefuldemoncrystal", () -> new BlockDemonCrystal(EnumDemonWillType.VENGEFUL));
|
||||
public static final RegistryObject<Block> STEADFAST_CRYSTAL_BLOCK = BLOCKS.register("steadfastdemoncrystal", () -> new BlockDemonCrystal(EnumDemonWillType.STEADFAST));
|
||||
|
||||
public static final RegistryObject<Block> WOOD_PATH = BASICBLOCKS.register("woodbrickpath", () -> new BlockPath(2, AbstractBlock.Properties.create(Material.WOOD).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.AXE).harvestLevel(0)));
|
||||
public static final RegistryObject<Block> WOOD_TILE_PATH = BASICBLOCKS.register("woodtilepath", () -> new BlockPath(2, AbstractBlock.Properties.create(Material.WOOD).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.AXE).harvestLevel(0)));
|
||||
public static final RegistryObject<Block> STONE_PATH = BASICBLOCKS.register("stonebrickpath", () -> new BlockPath(4, AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0)));
|
||||
public static final RegistryObject<Block> STONE_TILE_PATH = BASICBLOCKS.register("stonetilepath", () -> new BlockPath(4, AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0)));
|
||||
public static final RegistryObject<Block> WORN_STONE_PATH = BASICBLOCKS.register("wornstonebrickpath", () -> new BlockPath(6, AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0)));
|
||||
public static final RegistryObject<Block> WORN_STONE_TILE_PATH = BASICBLOCKS.register("wornstonetilepath", () -> new BlockPath(6, AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0)));
|
||||
public static final RegistryObject<Block> OBSIDIAN_PATH = BASICBLOCKS.register("obsidianbrickpath", () -> new BlockPath(8, AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(3)));
|
||||
public static final RegistryObject<Block> OBSIDIAN_TILE_PATH = BASICBLOCKS.register("obsidiantilepath", () -> new BlockPath(8, AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(2.0F, 5.0F).harvestTool(ToolType.PICKAXE).harvestLevel(3)));
|
||||
|
||||
private static ForgeFlowingFluid.Properties makeProperties()
|
||||
{
|
||||
return new ForgeFlowingFluid.Properties(LIFE_ESSENCE_FLUID, LIFE_ESSENCE_FLUID_FLOWING, FluidAttributes.builder(FLUID_STILL, FLUID_FLOWING)).bucket(LIFE_ESSENCE_BUCKET).block(LIFE_ESSENCE_BLOCK);
|
||||
|
@ -95,6 +106,7 @@ public class BloodMagicBlocks
|
|||
public static final RegistryObject<ContainerType<ContainerSoulForge>> SOUL_FORGE_CONTAINER = CONTAINERS.register("soul_forge_container", () -> IForgeContainerType.create(ContainerSoulForge::new));
|
||||
public static final RegistryObject<ContainerType<ContainerAlchemicalReactionChamber>> ARC_CONTAINER = CONTAINERS.register("arc_container", () -> IForgeContainerType.create(ContainerAlchemicalReactionChamber::new));
|
||||
public static final RegistryObject<ContainerType<ContainerAlchemyTable>> ALCHEMY_TABLE_CONTAINER = CONTAINERS.register("alchemy_table_container", () -> IForgeContainerType.create(ContainerAlchemyTable::new));
|
||||
|
||||
// public static final RegistryObject<BloodstoneBlock> BLOOD_STONE = registerNoItem("blood_stone", () -> new BloodstoneBlock());
|
||||
//
|
||||
//// private static <T extends Block> RegistryObject<T> register(String name, Supplier<? extends T> sup, Function<RegistryObject<T>, Supplier<? extends Item>> itemCreator)
|
||||
|
|
|
@ -46,6 +46,10 @@ public class GeneratorBaseRecipes extends BaseRecipeProvider
|
|||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.DUSK_RITUAL_DIVINER.get()).key('S', BloodMagicItems.DEMONIC_SLATE.get()).key('t', BloodMagicItems.DUSK_INSCRIPTION_TOOL.get()).key('d', BloodMagicItems.BASE_RITUAL_DIVINER.get()).patternLine(" S ").patternLine("tdt").patternLine(" S ").addCriterion("has_demon_slate", hasItem(BloodMagicItems.DEMONIC_SLATE.get())).build(consumer, BloodMagic.rl("ritual_diviner_1"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.BLOODSTONE_BRICK.get(), 4).key('s', BloodMagicBlocks.BLOODSTONE.get()).patternLine("ss").patternLine("ss").addCriterion("has_weak_shard", hasItem(BloodMagicItems.WEAK_BLOOD_SHARD.get())).build(consumer, BloodMagic.rl("bloodstonebrick"));
|
||||
ShapelessRecipeBuilder.shapelessRecipe(BloodMagicBlocks.BLOODSTONE.get(), 8).addIngredient(Tags.Items.STONE).addIngredient(BloodMagicItems.WEAK_BLOOD_SHARD.get()).addCriterion("has_weak_shard", hasItem(BloodMagicItems.WEAK_BLOOD_SHARD.get())).build(consumer, BloodMagic.rl("largebloodstonebrick"));
|
||||
|
||||
ShapelessRecipeBuilder.shapelessRecipe(BloodMagicBlocks.WOOD_TILE_PATH.get(), 4).addIngredient(BloodMagicBlocks.WOOD_PATH.get()).addIngredient(BloodMagicBlocks.WOOD_PATH.get()).addIngredient(BloodMagicBlocks.WOOD_PATH.get()).addIngredient(BloodMagicBlocks.WOOD_PATH.get()).addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("path/path_woodtile"));
|
||||
ShapelessRecipeBuilder.shapelessRecipe(BloodMagicBlocks.STONE_TILE_PATH.get(), 4).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("path/path_stonetile"));
|
||||
ShapelessRecipeBuilder.shapelessRecipe(BloodMagicBlocks.WORN_STONE_TILE_PATH.get(), 4).addIngredient(BloodMagicBlocks.WORN_STONE_PATH.get()).addIngredient(BloodMagicBlocks.WORN_STONE_PATH.get()).addIngredient(BloodMagicBlocks.WORN_STONE_PATH.get()).addIngredient(BloodMagicBlocks.WORN_STONE_PATH.get()).addCriterion("has_master_orb", hasItem(BloodMagicItems.MASTER_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("path/path_wornstonetile"));
|
||||
}
|
||||
|
||||
private void addVanillaSmithingRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
|
@ -57,6 +61,8 @@ public class GeneratorBaseRecipes extends BaseRecipeProvider
|
|||
|
||||
private void addBloodOrbRecipes(Consumer<IFinishedRecipe> consumer)
|
||||
{
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.INCENSE_ALTAR.get()).key('s', Tags.Items.STONE).key('c', Tags.Items.COBBLESTONE).key('h', Items.CHARCOAL).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).patternLine("s s").patternLine("shs").patternLine("coc").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("incense_altar"));
|
||||
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.BLANK_RUNE.get()).key('a', Tags.Items.STONE).key('s', Ingredient.fromItems(BloodMagicItems.SLATE.get())).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).patternLine("asa").patternLine("aoa").patternLine("aaa").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("blood_rune_blank"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('a', Tags.Items.STONE).key('b', Ingredient.fromItems(BloodMagicItems.SLATE.get())).key('c', Ingredient.fromItems(Items.SUGAR)).key('d', BloodMagicBlocks.BLANK_RUNE.get()).patternLine("aba").patternLine("cdc").patternLine("aba").addCriterion("has_blank_rune", hasItem(BloodMagicItems.BLANK_RUNE_ITEM.get())).build(consumer, BloodMagic.rl("blood_rune_speed"));
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SACRIFICE_RUNE.get()).key('a', Tags.Items.STONE).key('b', BloodMagicItems.REINFORCED_SLATE.get()).key('c', Tags.Items.INGOTS_GOLD).key('d', BloodMagicBlocks.BLANK_RUNE.get()).key('e', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_APPRENTICE.get())).patternLine("aba").patternLine("cdc").patternLine("aea").addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("blood_rune_sacrifice"));
|
||||
|
@ -78,6 +84,12 @@ public class GeneratorBaseRecipes extends BaseRecipeProvider
|
|||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.LAVA_CRYSTAL.get()).key('a', Tags.Items.GLASS).key('b', Items.LAVA_BUCKET).key('c', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).key('d', Tags.Items.OBSIDIAN).key('e', Tags.Items.GEMS_DIAMOND).patternLine("aba").patternLine("bcb").patternLine("ded").addCriterion("has_weak_orb", hasItem(BloodMagicItems.WEAK_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("lava_crystal"));
|
||||
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.PRIMITIVE_HYDRATION_CELL.get()).key('B', Items.WATER_BUCKET).key('c', Tags.Items.COBBLESTONE).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).key('s', BloodMagicItems.SLATE.get()).patternLine("csc").patternLine("cBc").patternLine("coc").addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("primitive_hydration_cell"));
|
||||
|
||||
ShapelessRecipeBuilder.shapelessRecipe(BloodMagicBlocks.WOOD_PATH.get(), 4).addIngredient(ItemTags.PLANKS).addIngredient(ItemTags.PLANKS).addIngredient(ItemTags.PLANKS).addIngredient(ItemTags.PLANKS).addIngredient(IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_APPRENTICE.get())).addCriterion("has_apprentice_orb", hasItem(BloodMagicItems.APPRENTICE_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("path/path_wood"));
|
||||
ShapelessRecipeBuilder.shapelessRecipe(BloodMagicBlocks.STONE_PATH.get(), 4).addIngredient(Tags.Items.STONE).addIngredient(Tags.Items.STONE).addIngredient(Tags.Items.STONE).addIngredient(Tags.Items.STONE).addIngredient(IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MAGICIAN.get())).addCriterion("has_magician_orb", hasItem(BloodMagicItems.MAGICIAN_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("path/path_stone"));
|
||||
ShapelessRecipeBuilder.shapelessRecipe(BloodMagicBlocks.WORN_STONE_PATH.get(), 4).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addIngredient(BloodMagicBlocks.STONE_PATH.get()).addIngredient(IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MASTER.get())).addCriterion("has_master_orb", hasItem(BloodMagicItems.MASTER_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("path/path_wornstone"));
|
||||
|
||||
ShapedRecipeBuilder.shapedRecipe(BloodMagicItems.RITUAL_READER.get()).key('s', BloodMagicItems.DEMONIC_SLATE.get()).key('g', Tags.Items.GLASS).key('i', Tags.Items.INGOTS_GOLD).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_MASTER.get())).patternLine("gog").patternLine("isi").patternLine(" s ").addCriterion("has_master_orb", hasItem(BloodMagicItems.MASTER_BLOOD_ORB.get())).build(consumer, BloodMagic.rl("ritual_reader"));
|
||||
// ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('s', Items.GLASS).key('o', Ingredient.fromItems(Items.DIAMOND)).patternLine("sss").patternLine("sos").patternLine("sss").addCriterion("has_diamond", hasItem(Items.DIAMOND)).build(consumer, new ResourceLocation(BloodMagic.MODID, "speed_rune_from_standard"));
|
||||
// ShapedRecipeBuilder.shapedRecipe(BloodMagicBlocks.SPEED_RUNE.get()).key('s', Items.GLASS).key('o', IngredientBloodOrb.fromOrb(BloodMagicItems.ORB_WEAK.get())).patternLine("sss").patternLine("sos").patternLine("sss").addCriterion("has_diamond", hasItem(Items.DIAMOND)).build(consumer, new ResourceLocation(BloodMagic.MODID, "speed_rune_from_orb"));
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ public class GeneratorItemModels extends ItemModelProvider
|
|||
registerDemonTool(BloodMagicItems.SENTIENT_AXE.get());
|
||||
registerDemonTool(BloodMagicItems.SENTIENT_PICKAXE.get());
|
||||
registerDemonTool(BloodMagicItems.SENTIENT_SHOVEL.get());
|
||||
registerSacrificialKnife(BloodMagicItems.SACRIFICIAL_DAGGER.get());
|
||||
}
|
||||
|
||||
private void registerCustomBlockPath(Block block, String newPath)
|
||||
|
@ -145,4 +146,14 @@ public class GeneratorItemModels extends ItemModelProvider
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
private void registerSacrificialKnife(Item item)
|
||||
{
|
||||
String path = item.getRegistryName().getPath();
|
||||
ItemModelBuilder builder = getBuilder(path);
|
||||
|
||||
ModelFile baseKnifeFile = singleTexture("item/variants/" + path, mcLoc("item/handheld"), "layer0", modLoc("item/" + path));
|
||||
ModelFile ceremonialKnifeFile = singleTexture("item/variants/" + path + "_ceremonial", mcLoc("item/handheld"), "layer0", modLoc("item/" + path + "_ceremonial"));
|
||||
builder = builder.override().predicate(BloodMagic.rl("incense"), 0).model(baseKnifeFile).end().override().predicate(BloodMagic.rl("incense"), 1).model(ceremonialKnifeFile).end();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
@Override
|
||||
protected void addTranslations()
|
||||
{
|
||||
// HUD
|
||||
add("hud.bloodmagic.inactive", "Inactive");
|
||||
|
||||
// Creative Tab
|
||||
add("itemGroup.bloodmagic.creativeTab", "Blood Magic");
|
||||
|
||||
|
@ -45,6 +48,17 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
// add("tooltip.bloodmagic.sigil.divination.currentInversion", "Current Inversion: %d");
|
||||
add("tooltip.bloodmagic.sigil.divination.currentBonus", "Current Bonus: +%d%%");
|
||||
|
||||
add("tooltip.bloodmagic.sigil.seer.desc", "When seeing all is not enough");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentAltarProgress", "Current Progress: %d LP/ %s LP");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentAltarProgress.percent", "Current Progress: %s");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentAltarConsumptionRate", "Consumption Rate: %d LP");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentAltarTier", "Current Tier: %d");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentEssence", "Current Essence: %d LP");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentAltarCapacity", "Current Capacity: %d LP");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentCharge", "Current Charge: %d");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentTranquility", "Current Tranquility: %d");
|
||||
add("tooltip.bloodmagic.sigil.seer.currentBonus", "Current Bonus: +%d%%");
|
||||
|
||||
add("tooltip.bloodmagic.decoration.safe", "Safe for decoration");
|
||||
add("tooltip.bloodmagic.decoration.notSafe", "Dangerous for decoration");
|
||||
|
||||
|
@ -304,6 +318,7 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
|
||||
addBlock(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER, "Alchemical Reaction Chamber");
|
||||
addBlock(BloodMagicBlocks.ALCHEMY_TABLE, "Alchemy Table");
|
||||
addBlock(BloodMagicBlocks.INCENSE_ALTAR, "Incense Altar");
|
||||
|
||||
addBlock(BloodMagicBlocks.BLOODSTONE, "Large Bloodstone Brick");
|
||||
addBlock(BloodMagicBlocks.BLOODSTONE_BRICK, "Bloodstone Brick");
|
||||
|
@ -317,6 +332,15 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
addBlock(BloodMagicBlocks.DEMON_CRUCIBLE, "Demon Crucible");
|
||||
addBlock(BloodMagicBlocks.DEMON_CRYSTALLIZER, "Demon Crystallizer");
|
||||
|
||||
addBlock(BloodMagicBlocks.WOOD_PATH, "Wooden Path");
|
||||
addBlock(BloodMagicBlocks.WOOD_TILE_PATH, "Tiled Wooden Path");
|
||||
addBlock(BloodMagicBlocks.STONE_PATH, "Stone Path");
|
||||
addBlock(BloodMagicBlocks.STONE_TILE_PATH, "Tiled Stone Path");
|
||||
addBlock(BloodMagicBlocks.WORN_STONE_PATH, "Worn Stone Path");
|
||||
addBlock(BloodMagicBlocks.WORN_STONE_TILE_PATH, "Tiled Worn Stone Path");
|
||||
addBlock(BloodMagicBlocks.OBSIDIAN_PATH, "Obsidian Path");
|
||||
addBlock(BloodMagicBlocks.OBSIDIAN_TILE_PATH, "Tiled Obsidian Path");
|
||||
|
||||
// Item names
|
||||
addItem(BloodMagicItems.WEAK_BLOOD_ORB, "Weak Blood Orb");
|
||||
addItem(BloodMagicItems.APPRENTICE_BLOOD_ORB, "Apprentice Blood Orb");
|
||||
|
@ -332,6 +356,7 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
addItem(BloodMagicItems.ICE_SIGIL, "Sigil of the Frozen Lake");
|
||||
addItem(BloodMagicItems.AIR_SIGIL, "Air Sigil");
|
||||
addItem(BloodMagicItems.BLOOD_LIGHT_SIGIL, "Sigil of the Blood Lamp");
|
||||
addItem(BloodMagicItems.SEER_SIGIL, "Seer's Sigil");
|
||||
|
||||
addItem(BloodMagicBlocks.LIFE_ESSENCE_BUCKET, "Bucket of Life");
|
||||
addItem(BloodMagicItems.ARCANE_ASHES, "Arcane Ashes");
|
||||
|
@ -353,6 +378,7 @@ public class GeneratorLanguage extends LanguageProvider
|
|||
addItem(BloodMagicItems.REAGENT_MAGNETISM, "Magnetism Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_AIR, "Air Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_BLOOD_LIGHT, "Blood Lamp Reagent");
|
||||
addItem(BloodMagicItems.REAGENT_SIGHT, "Sight Reagent");
|
||||
|
||||
addItem(BloodMagicItems.PETTY_GEM, "Petty Tartaric Gem");
|
||||
addItem(BloodMagicItems.LESSER_GEM, "Lesser Tartaric Gem");
|
||||
|
|
|
@ -75,6 +75,7 @@ public class GeneratorLootTable extends LootTableProvider
|
|||
registerDropSelfLootTable(BloodMagicBlocks.ALCHEMICAL_REACTION_CHAMBER.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.DEMON_CRUCIBLE.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.DEMON_CRYSTALLIZER.get());
|
||||
registerDropSelfLootTable(BloodMagicBlocks.INCENSE_ALTAR.get());
|
||||
// registerNoDropLootTable(BloodMagicBlocks.RAW_CRYSTAL_BLOCK.get());
|
||||
|
||||
registerDropCrystalsLootTable(BloodMagicBlocks.RAW_CRYSTAL_BLOCK.get(), BloodMagicItems.RAW_CRYSTAL.get());
|
||||
|
|
|
@ -78,6 +78,16 @@ public class BloodMagicItems
|
|||
|
||||
public static final RegistryObject<Item> BLOOD_ALTAR_ITEM = ITEMS.register("altar", () -> new BlockItem(BloodMagicBlocks.BLOOD_ALTAR.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> ALCHEMY_TABLE_ITEM = ITEMS.register("alchemytable", () -> new ItemBlockAlchemyTable(BloodMagicBlocks.ALCHEMY_TABLE.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> INCENSE_ALTAR_ITEM = ITEMS.register("incensealtar", () -> new BlockItem(BloodMagicBlocks.INCENSE_ALTAR.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
public static final RegistryObject<Item> WOOD_PATH_ITEM = ITEMS.register("woodbrickpath", () -> new BlockItem(BloodMagicBlocks.WOOD_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> WOOD_TILE_PATH_ITEM = ITEMS.register("woodtilepath", () -> new BlockItem(BloodMagicBlocks.WOOD_TILE_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> STONE_PATH_ITEM = ITEMS.register("stonebrickpath", () -> new BlockItem(BloodMagicBlocks.STONE_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> STONE_TILE_PATH_ITEM = ITEMS.register("stonetilepath", () -> new BlockItem(BloodMagicBlocks.STONE_TILE_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> WORN_STONE_PATH_ITEM = ITEMS.register("wornstonebrickpath", () -> new BlockItem(BloodMagicBlocks.WORN_STONE_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> WORN_STONE_TILE_PATH_ITEM = ITEMS.register("wornstonetilepath", () -> new BlockItem(BloodMagicBlocks.WORN_STONE_TILE_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> OBSIDIAN_PATH_ITEM = ITEMS.register("obsidianbrickpath", () -> new BlockItem(BloodMagicBlocks.OBSIDIAN_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
public static final RegistryObject<Item> OBSIDIAN_TILE_PATH_ITEM = ITEMS.register("obsidiantilepath", () -> new BlockItem(BloodMagicBlocks.OBSIDIAN_TILE_PATH.get(), new Item.Properties().group(BloodMagic.TAB)));
|
||||
|
||||
// TODO: Need to rework the above instantiations for the ItemBlocks so that it's
|
||||
// done with the Blocks.
|
||||
|
@ -90,6 +100,7 @@ public class BloodMagicItems
|
|||
public static final RegistryObject<Item> MASTER_BLOOD_ORB = BASICITEMS.register("masterbloodorb", () -> new ItemBloodOrb(ORB_MASTER));
|
||||
|
||||
public static final RegistryObject<Item> DIVINATION_SIGIL = BASICITEMS.register("divinationsigil", () -> new ItemSigilDivination(true));
|
||||
public static final RegistryObject<Item> SEER_SIGIL = BASICITEMS.register("seersigil", () -> new ItemSigilDivination(false));
|
||||
public static final RegistryObject<Item> SACRIFICIAL_DAGGER = BASICITEMS.register("sacrificialdagger", () -> new ItemSacrificialDagger());
|
||||
public static final RegistryObject<Item> SLATE = BASICITEMS.register("blankslate", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REINFORCED_SLATE = BASICITEMS.register("reinforcedslate", () -> new ItemBase());
|
||||
|
@ -136,6 +147,7 @@ public class BloodMagicItems
|
|||
public static final RegistryObject<Item> REAGENT_MAGNETISM = BASICITEMS.register("reagentmagnetism", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_AIR = BASICITEMS.register("reagentair", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_BLOOD_LIGHT = BASICITEMS.register("reagentbloodlight", () -> new ItemBase());
|
||||
public static final RegistryObject<Item> REAGENT_SIGHT = BASICITEMS.register("reagentsight", () -> new ItemBase());
|
||||
|
||||
// Tartaric Gems
|
||||
public static final RegistryObject<Item> PETTY_GEM = ITEMS.register("soulgempetty", () -> new ItemSoulGem("petty", 64));
|
||||
|
|
|
@ -25,6 +25,7 @@ import wayoftime.bloodmagic.ConfigHandler;
|
|||
import wayoftime.bloodmagic.event.SacrificeKnifeUsedEvent;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
import wayoftime.bloodmagic.util.DamageSourceBloodMagic;
|
||||
import wayoftime.bloodmagic.util.helper.IncenseHelper;
|
||||
import wayoftime.bloodmagic.util.helper.NBTHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerSacrificeHelper;
|
||||
|
@ -52,7 +53,14 @@ public class ItemSacrificialDagger extends Item
|
|||
public void onPlayerStoppedUsing(ItemStack stack, World worldIn, LivingEntity entityLiving, int timeLeft)
|
||||
{
|
||||
if (entityLiving instanceof PlayerEntity && !entityLiving.getEntityWorld().isRemote)
|
||||
PlayerSacrificeHelper.sacrificePlayerHealth((PlayerEntity) entityLiving);
|
||||
if (PlayerSacrificeHelper.sacrificePlayerHealth((PlayerEntity) entityLiving))
|
||||
IncenseHelper.setHasMaxIncense(stack, (PlayerEntity) entityLiving, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasEffect(ItemStack stack)
|
||||
{
|
||||
return IncenseHelper.getHasMaxIncense(stack) || super.hasEffect(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,13 +122,15 @@ public class ItemSacrificialDagger extends Item
|
|||
return super.onItemRightClick(world, player, hand);
|
||||
|
||||
lpAdded = evt.lpAdded;
|
||||
} else if (player.isSneaking())
|
||||
{
|
||||
lpAdded = Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
double posX = player.getPosX();
|
||||
double posY = player.getPosY();
|
||||
double posZ = player.getPosZ();
|
||||
world.playSound(player, posX, posY, posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat())
|
||||
* 0.8F);
|
||||
world.playSound(player, posX, posY, posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F);
|
||||
|
||||
for (int l = 0; l < 8; ++l)
|
||||
world.addParticle(RedstoneParticleData.REDSTONE_DUST, posX + Math.random() - Math.random(), posY + Math.random() - Math.random(), posZ + Math.random() - Math.random(), 0, 0, 0);
|
||||
|
|
|
@ -6,6 +6,7 @@ import net.minecraft.client.util.ITooltipFlag;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
|
@ -36,7 +37,7 @@ public class ItemSigilBase extends ItemSigil
|
|||
@OnlyIn(Dist.CLIENT)
|
||||
public void addInformation(ItemStack stack, World world, List<ITextComponent> tooltip, ITooltipFlag flag)
|
||||
{
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "desc"));
|
||||
tooltip.add(new TranslationTextComponent(tooltipBase + "desc").mergeStyle(TextFormatting.ITALIC));
|
||||
// if (TextHelper.canTranslate(tooltipBase + "desc"))
|
||||
// tooltip.addAll(Arrays.asList(WordUtils.wrap(TextHelper.localizeEffect(tooltipBase
|
||||
// + "desc"), 30, "/cut", false).split("/cut")));
|
||||
|
|
|
@ -20,6 +20,7 @@ import wayoftime.bloodmagic.altar.IBloodAltar;
|
|||
import wayoftime.bloodmagic.core.data.Binding;
|
||||
import wayoftime.bloodmagic.iface.IAltarReader;
|
||||
import wayoftime.bloodmagic.iface.ISigil;
|
||||
import wayoftime.bloodmagic.tile.TileIncenseAltar;
|
||||
import wayoftime.bloodmagic.util.ChatUtil;
|
||||
import wayoftime.bloodmagic.util.helper.NetworkHelper;
|
||||
import wayoftime.bloodmagic.util.helper.NumeralHelper;
|
||||
|
@ -27,10 +28,12 @@ import wayoftime.bloodmagic.util.helper.PlayerHelper;
|
|||
|
||||
public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
||||
{
|
||||
private final boolean isSimple;
|
||||
|
||||
public ItemSigilDivination(boolean simple)
|
||||
{
|
||||
super(simple ? "divination" : "seer");
|
||||
isSimple = simple;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -51,7 +54,7 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
super.onItemRightClick(world, player, hand);
|
||||
|
||||
Binding binding = getBinding(stack);
|
||||
if (binding != null)
|
||||
if (isSimple && binding != null)
|
||||
{
|
||||
int currentEssence = NetworkHelper.getSoulNetwork(binding).getCurrentEssence();
|
||||
List<ITextComponent> toSend = Lists.newArrayList();
|
||||
|
@ -73,18 +76,21 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
int currentEssence = altar.getCurrentBlood();
|
||||
int capacity = altar.getCapacity();
|
||||
altar.checkTier();
|
||||
ChatUtil.sendNoSpam(player, new TranslationTextComponent(tooltipBase
|
||||
+ "currentAltarTier", NumeralHelper.toRoman(tier)), new TranslationTextComponent(tooltipBase
|
||||
+ "currentEssence", currentEssence), new TranslationTextComponent(tooltipBase
|
||||
+ "currentAltarCapacity", capacity));
|
||||
if (isSimple)
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, new TranslationTextComponent(tooltipBase + "currentAltarTier", NumeralHelper.toRoman(tier)), new TranslationTextComponent(tooltipBase + "currentEssence", currentEssence), new TranslationTextComponent(tooltipBase + "currentAltarCapacity", capacity));
|
||||
} else
|
||||
{
|
||||
ChatUtil.sendNoSpam(player, new TranslationTextComponent(tooltipBase + "currentAltarTier", NumeralHelper.toRoman(tier)), new TranslationTextComponent(tooltipBase + "currentEssence", currentEssence), new TranslationTextComponent(tooltipBase + "currentAltarCapacity", capacity));
|
||||
}
|
||||
} else if (tile != null && tile instanceof TileIncenseAltar)
|
||||
{
|
||||
TileIncenseAltar altar = (TileIncenseAltar) tile;
|
||||
altar.recheckConstruction();
|
||||
double tranquility = altar.tranquility;
|
||||
ChatUtil.sendNoSpam(player, new TranslationTextComponent(tooltipBase + "currentTranquility", (int) ((100D * (int) (100 * tranquility)) / 100d)), new TranslationTextComponent(tooltipBase + "currentBonus", (int) (100 * altar.incenseAddition)));
|
||||
}
|
||||
// else if (tile != null && tile instanceof TileIncenseAltar)
|
||||
// {
|
||||
// TileIncenseAltar altar = (TileIncenseAltar) tile;
|
||||
// altar.recheckConstruction();
|
||||
// double tranquility = altar.tranquility;
|
||||
// ChatUtil.sendNoSpam(player, new TextComponentTranslation(tooltipBase + "currentTranquility", (int) ((100D * (int) (100 * tranquility)) / 100d)), new TextComponentTranslation(tooltipBase + "currentBonus", (int) (100 * altar.incenseAddition)));
|
||||
// } else if (tile != null && tile instanceof TileInversionPillar)
|
||||
// else if (tile != null && tile instanceof TileInversionPillar)
|
||||
// {
|
||||
// TileInversionPillar pillar = (TileInversionPillar) tile;
|
||||
// double inversion = pillar.getCurrentInversion();
|
||||
|
@ -98,8 +104,7 @@ public class ItemSigilDivination extends ItemSigilBase implements IAltarReader
|
|||
int currentEssence = NetworkHelper.getSoulNetwork(binding).getCurrentEssence();
|
||||
List<ITextComponent> toSend = Lists.newArrayList();
|
||||
if (!binding.getOwnerId().equals(player.getGameProfile().getId()))
|
||||
toSend.add(new TranslationTextComponent(tooltipBase
|
||||
+ "otherNetwork", binding.getOwnerName()));
|
||||
toSend.add(new TranslationTextComponent(tooltipBase + "otherNetwork", binding.getOwnerName()));
|
||||
toSend.add(new TranslationTextComponent(tooltipBase + "currentEssence", currentEssence));
|
||||
ChatUtil.sendNoSpam(player, toSend.toArray(new ITextComponent[toSend.size()]));
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemGroup;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
|
@ -77,8 +76,6 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMultiWillTool
|
|||
if (!stack.hasTag())
|
||||
return;
|
||||
|
||||
Items d;
|
||||
|
||||
EnumDemonWillType type = this.getCurrentType(stack);
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.soulGem." + name));
|
||||
tooltip.add(new TranslationTextComponent("tooltip.bloodmagic.will", ChatUtil.DECIMAL_FORMAT.format(getWill(type, stack))));
|
||||
|
@ -133,8 +130,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMultiWillTool
|
|||
|
||||
if (soulsLeft < getMaxWill(thisType, soulGemStack))
|
||||
{
|
||||
double newSoulsLeft = Math.min(soulsLeft
|
||||
+ soul.getWill(thisType, soulStack), getMaxWill(thisType, soulGemStack));
|
||||
double newSoulsLeft = Math.min(soulsLeft + soul.getWill(thisType, soulStack), getMaxWill(thisType, soulGemStack));
|
||||
soul.drainWill(thisType, soulStack, newSoulsLeft - soulsLeft);
|
||||
|
||||
setWill(thisType, soulGemStack, newSoulsLeft);
|
||||
|
|
|
@ -28,6 +28,7 @@ public class AlchemyArrayRecipeProvider implements ISubRecipeProvider
|
|||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/magnetismsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_MAGNETISM.get()), Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()), new ItemStack(BloodMagicItems.MAGNETISM_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "magnetismsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/lightsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_BLOOD_LIGHT.get()), Ingredient.fromItems(BloodMagicItems.IMBUED_SLATE.get()), new ItemStack(BloodMagicItems.BLOOD_LIGHT_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "bloodlightsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/airsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_AIR.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.AIR_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "airsigil"));
|
||||
AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/sightsigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_SIGHT.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.SEER_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "seersigil"));
|
||||
// AlchemyArrayRecipeBuilder.array(BloodMagic.rl("textures/models/alchemyarrays/fastminersigil.png"), Ingredient.fromItems(BloodMagicItems.REAGENT_FAST_MINER.get()), Ingredient.fromItems(BloodMagicItems.REINFORCED_SLATE.get()), new ItemStack(BloodMagicItems.FAST_MINER_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "frostsigil"));
|
||||
// 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"));
|
||||
|
|
|
@ -23,7 +23,7 @@ public class BloodAltarRecipeProvider implements ISubRecipeProvider
|
|||
String basePath = "altar/";
|
||||
|
||||
// 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.GEMS_DIAMOND), new ItemStack(BloodMagicItems.WEAK_BLOOD_ORB.get()), AltarTier.ONE.ordinal(), 2000, 5, 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"));
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public class TartaricForgeRecipeProvider implements ISubRecipeProvider
|
|||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_MAGNETISM.get()), 600, 10, Ingredient.fromTag(Tags.Items.STRING), Ingredient.fromTag(Tags.Items.INGOTS_GOLD), Ingredient.fromTag(Tags.Items.INGOTS_GOLD), Ingredient.fromTag(Tags.Items.STORAGE_BLOCKS_IRON)).build(consumer, BloodMagic.rl(basePath + "reagent_magnetism"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_FAST_MINER.get()), 128, 20, Ingredient.fromItems(Items.IRON_PICKAXE), Ingredient.fromItems(Items.IRON_AXE), Ingredient.fromItems(Items.IRON_SHOVEL), Ingredient.fromTag(Tags.Items.GUNPOWDER)).build(consumer, BloodMagic.rl(basePath + "reagent_fastminer"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_BLOOD_LIGHT.get()), 300, 10, Ingredient.fromTag(Tags.Items.DUSTS_GLOWSTONE), Ingredient.fromItems(Items.TORCH), Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE), Ingredient.fromTag(Tags.Items.DUSTS_REDSTONE)).build(consumer, BloodMagic.rl(basePath + "reagent_blood_light"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicItems.REAGENT_SIGHT.get()), 64, 0, Ingredient.fromTag(Tags.Items.DUSTS_GLOWSTONE), Ingredient.fromTag(Tags.Items.GLASS), Ingredient.fromTag(Tags.Items.GLASS), Ingredient.fromItems(BloodMagicItems.DIVINATION_SIGIL.get())).build(consumer, BloodMagic.rl(basePath + "reagent_sight"));
|
||||
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicBlocks.DEMON_CRUCIBLE.get()), 400, 100, Ingredient.fromItems(Items.CAULDRON), Ingredient.fromTag(Tags.Items.STONE), Ingredient.fromTag(Tags.Items.GEMS_LAPIS), Ingredient.fromTag(Tags.Items.GEMS_DIAMOND)).build(consumer, BloodMagic.rl(basePath + "demon_crucible"));
|
||||
TartaricForgeRecipeBuilder.tartaricForge(new ItemStack(BloodMagicBlocks.DEMON_CRYSTALLIZER.get()), 500, 100, Ingredient.fromItems(BloodMagicBlocks.SOUL_FORGE.get()), Ingredient.fromTag(Tags.Items.STONE), Ingredient.fromTag(Tags.Items.GEMS_LAPIS), Ingredient.fromTag(Tags.Items.GLASS)).build(consumer, BloodMagic.rl(basePath + "demon_crystallizer"));
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
package wayoftime.bloodmagic.incense;
|
||||
|
||||
public enum EnumTranquilityType
|
||||
{
|
||||
PLANT(),
|
||||
CROP(),
|
||||
TREE(),
|
||||
EARTHEN(),
|
||||
WATER(),
|
||||
FIRE(),
|
||||
LAVA(),;
|
||||
}
|
15
src/main/java/wayoftime/bloodmagic/incense/IIncensePath.java
Normal file
15
src/main/java/wayoftime/bloodmagic/incense/IIncensePath.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
package wayoftime.bloodmagic.incense;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IIncensePath
|
||||
{
|
||||
/**
|
||||
* Goes from 0 to however far this path block can be from the altar while still
|
||||
* functioning. 0 represents a block that can work when it is two blocks
|
||||
* horizontally away from the altar.
|
||||
*/
|
||||
int getLevelOfPath(World world, BlockPos pos, BlockState state);
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package wayoftime.bloodmagic.incense;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface ITranquilityHandler
|
||||
{
|
||||
TranquilityStack getTranquilityOfBlock(World world, BlockPos pos, Block block, BlockState state);
|
||||
}
|
|
@ -0,0 +1,60 @@
|
|||
package wayoftime.bloodmagic.incense;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class IncenseAltarComponent
|
||||
{
|
||||
public final BlockPos offsetPos;
|
||||
public final Block block;
|
||||
|
||||
public IncenseAltarComponent(BlockPos offsetPos, Block block)
|
||||
{
|
||||
this.offsetPos = offsetPos;
|
||||
this.block = block;
|
||||
}
|
||||
|
||||
public boolean doesBlockMatch(Block block)
|
||||
{
|
||||
return this.block == block;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base rotation is north.
|
||||
*/
|
||||
public BlockPos getOffset(Direction rotation)
|
||||
{
|
||||
return new BlockPos(this.getX(rotation), offsetPos.getY(), this.getZ(rotation));
|
||||
}
|
||||
|
||||
public int getX(Direction direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case EAST:
|
||||
return -this.offsetPos.getZ();
|
||||
case SOUTH:
|
||||
return -this.offsetPos.getX();
|
||||
case WEST:
|
||||
return this.offsetPos.getZ();
|
||||
default:
|
||||
return this.offsetPos.getX();
|
||||
}
|
||||
}
|
||||
|
||||
public int getZ(Direction direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case EAST:
|
||||
return this.offsetPos.getX();
|
||||
case SOUTH:
|
||||
return -this.offsetPos.getZ();
|
||||
case WEST:
|
||||
return -this.offsetPos.getX();
|
||||
default:
|
||||
return this.offsetPos.getZ();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
package wayoftime.bloodmagic.incense;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class IncenseAltarHandler
|
||||
{
|
||||
public static Map<Integer, List<IncenseAltarComponent>> incenseComponentMap = new TreeMap<>();
|
||||
// Incense bonus maximum applied for the tier of blocks.
|
||||
public static double[] incenseBonuses = new double[] { 0.2, 0.6, 1.2, 2, 3, 4.5 };
|
||||
public static double[] tranquilityRequired = new double[] { 0, 6, 14.14, 28, 44.09, 83.14 };
|
||||
public static int[] roadsRequired = new int[] { 0, 1, 4, 6, 8, 10, 12 }; // TODO: Change for when the roads are
|
||||
// fully implemented
|
||||
|
||||
public static void registerIncenseComponent(int altarLevel, IncenseAltarComponent component)
|
||||
{
|
||||
if (incenseComponentMap.containsKey(altarLevel))
|
||||
{
|
||||
incenseComponentMap.get(altarLevel).add(component);
|
||||
} else
|
||||
{
|
||||
List<IncenseAltarComponent> list = new ArrayList<>();
|
||||
list.add(component);
|
||||
incenseComponentMap.put(altarLevel, list);
|
||||
}
|
||||
}
|
||||
|
||||
public static void registerIncenseComponent(int altarLevel, BlockPos offsetPos, Block block, BlockState state)
|
||||
{
|
||||
registerIncenseComponent(altarLevel, new IncenseAltarComponent(offsetPos, block));
|
||||
}
|
||||
|
||||
public static double getMaxIncenseBonusFromComponents(World world, BlockPos pos)
|
||||
{
|
||||
double accumulatedBonus = 0;
|
||||
for (int i = 0; i < incenseBonuses.length; i++)
|
||||
{
|
||||
double previousBonus = (i <= 0 ? 0 : incenseBonuses[i - 1]);
|
||||
double nextBonus = incenseBonuses[i];
|
||||
if (!incenseComponentMap.containsKey(i))
|
||||
{
|
||||
accumulatedBonus += (nextBonus - previousBonus);
|
||||
} else
|
||||
{
|
||||
boolean hasAllComponentsThisTier = true;
|
||||
for (IncenseAltarComponent component : incenseComponentMap.get(i))
|
||||
{
|
||||
BlockPos offsetPos = pos.add(component.getOffset(Direction.NORTH));
|
||||
BlockState state = world.getBlockState(offsetPos);
|
||||
Block block = state.getBlock();
|
||||
if (component.doesBlockMatch(block))
|
||||
{
|
||||
hasAllComponentsThisTier = false;
|
||||
} else
|
||||
{
|
||||
accumulatedBonus += (nextBonus - previousBonus) / incenseComponentMap.get(i).size();
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasAllComponentsThisTier)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return accumulatedBonus;
|
||||
}
|
||||
|
||||
public static double getMaxIncenseBonusFromRoads(int roads)
|
||||
{
|
||||
double previousBonus = 0;
|
||||
for (int i = 0; i < incenseBonuses.length; i++)
|
||||
{
|
||||
if (roads >= roadsRequired[i])
|
||||
{
|
||||
previousBonus = incenseBonuses[i];
|
||||
} else
|
||||
{
|
||||
return previousBonus;
|
||||
}
|
||||
}
|
||||
|
||||
return previousBonus;
|
||||
}
|
||||
|
||||
public static double getIncenseBonusFromComponents(World world, BlockPos pos, double tranquility, int roads)
|
||||
{
|
||||
double maxBonus = Math.min(getMaxIncenseBonusFromComponents(world, pos), getMaxIncenseBonusFromRoads(roads));
|
||||
double possibleBonus = 0;
|
||||
|
||||
for (int i = 0; i < incenseBonuses.length; i++)
|
||||
{
|
||||
if (tranquility >= tranquilityRequired[i])
|
||||
{
|
||||
possibleBonus = incenseBonuses[i];
|
||||
} else if (i >= 1)
|
||||
{
|
||||
possibleBonus += (incenseBonuses[i] - possibleBonus) * (tranquility - tranquilityRequired[i - 1]) / (tranquilityRequired[i] - tranquilityRequired[i - 1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Math.min(maxBonus, possibleBonus);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package wayoftime.bloodmagic.incense;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class IncenseTranquilityRegistry
|
||||
{
|
||||
public static List<ITranquilityHandler> handlerList = new ArrayList<>();
|
||||
|
||||
public static void registerTranquilityHandler(ITranquilityHandler handler)
|
||||
{
|
||||
handlerList.add(handler);
|
||||
}
|
||||
|
||||
public static TranquilityStack getTranquilityOfBlock(World world, BlockPos pos, Block block, BlockState state)
|
||||
{
|
||||
for (ITranquilityHandler handler : handlerList)
|
||||
{
|
||||
TranquilityStack tranq = handler.getTranquilityOfBlock(world, pos, block, state);
|
||||
if (tranq != null)
|
||||
{
|
||||
return tranq;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
package wayoftime.bloodmagic.incense;
|
||||
|
||||
public class TranquilityStack
|
||||
{
|
||||
public final EnumTranquilityType type;
|
||||
public double value;
|
||||
|
||||
public TranquilityStack(EnumTranquilityType type, double value)
|
||||
{
|
||||
this.type = type;
|
||||
this.value = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
package wayoftime.bloodmagic.registry;
|
||||
|
||||
import net.minecraft.block.FireBlock;
|
||||
import net.minecraft.block.GrassBlock;
|
||||
import net.minecraft.block.LeavesBlock;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import wayoftime.bloodmagic.api.impl.BloodMagicAPI;
|
||||
import wayoftime.bloodmagic.incense.EnumTranquilityType;
|
||||
import wayoftime.bloodmagic.incense.IncenseTranquilityRegistry;
|
||||
import wayoftime.bloodmagic.incense.TranquilityStack;
|
||||
|
||||
public class ModTranquilityHandlers
|
||||
{
|
||||
|
||||
public static void init()
|
||||
{
|
||||
IncenseTranquilityRegistry.registerTranquilityHandler((world, pos, block, state) -> block instanceof LeavesBlock
|
||||
? new TranquilityStack(EnumTranquilityType.PLANT, 1.0D)
|
||||
: null);
|
||||
IncenseTranquilityRegistry.registerTranquilityHandler((world, pos, block, state) -> block instanceof FireBlock
|
||||
? new TranquilityStack(EnumTranquilityType.FIRE, 1.0D)
|
||||
: null);
|
||||
IncenseTranquilityRegistry.registerTranquilityHandler((world, pos, block, state) -> block instanceof GrassBlock
|
||||
? new TranquilityStack(EnumTranquilityType.EARTHEN, 0.5D)
|
||||
: null);
|
||||
IncenseTranquilityRegistry.registerTranquilityHandler((world, pos, block, state) -> BlockTags.LOGS.contains(block)
|
||||
? new TranquilityStack(EnumTranquilityType.TREE, 1.0D)
|
||||
: null);
|
||||
IncenseTranquilityRegistry.registerTranquilityHandler((world, pos, block, state) -> BloodMagicAPI.INSTANCE.getValueManager().getTranquility().get(state));
|
||||
}
|
||||
}
|
206
src/main/java/wayoftime/bloodmagic/tile/TileIncenseAltar.java
Normal file
206
src/main/java/wayoftime/bloodmagic/tile/TileIncenseAltar.java
Normal file
|
@ -0,0 +1,206 @@
|
|||
package wayoftime.bloodmagic.tile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.particles.ParticleTypes;
|
||||
import net.minecraft.tileentity.ITickableTileEntity;
|
||||
import net.minecraft.tileentity.TileEntityType;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.registries.ObjectHolder;
|
||||
import wayoftime.bloodmagic.incense.EnumTranquilityType;
|
||||
import wayoftime.bloodmagic.incense.IIncensePath;
|
||||
import wayoftime.bloodmagic.incense.IncenseAltarHandler;
|
||||
import wayoftime.bloodmagic.incense.IncenseTranquilityRegistry;
|
||||
import wayoftime.bloodmagic.incense.TranquilityStack;
|
||||
import wayoftime.bloodmagic.ritual.AreaDescriptor;
|
||||
import wayoftime.bloodmagic.util.helper.PlayerSacrificeHelper;
|
||||
|
||||
public class TileIncenseAltar extends TileInventory implements ITickableTileEntity
|
||||
{
|
||||
public static int maxCheckRange = 5;
|
||||
public AreaDescriptor incenseArea = new AreaDescriptor.Rectangle(new BlockPos(-5, -5, -5), 11);
|
||||
public Map<EnumTranquilityType, Double> tranquilityMap = new HashMap<>();
|
||||
|
||||
public double incenseAddition = 0; // Self-sacrifice is multiplied by 1 plus this value.
|
||||
public double tranquility = 0;
|
||||
public int roadDistance = 0; // Number of road blocks laid down
|
||||
|
||||
@ObjectHolder("bloodmagic:incensealtar")
|
||||
public static TileEntityType<TileIncenseAltar> TYPE;
|
||||
|
||||
public TileIncenseAltar(TileEntityType<?> type)
|
||||
{
|
||||
super(type, 1, "incensealtar");
|
||||
}
|
||||
|
||||
public TileIncenseAltar()
|
||||
{
|
||||
this(TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
AxisAlignedBB aabb = incenseArea.getAABB(getPos());
|
||||
List<PlayerEntity> playerList = getWorld().getEntitiesWithinAABB(PlayerEntity.class, aabb);
|
||||
if (playerList.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (getWorld().getGameTime() % 100 == 0)
|
||||
{
|
||||
recheckConstruction();
|
||||
}
|
||||
|
||||
boolean hasPerformed = false;
|
||||
|
||||
for (PlayerEntity player : playerList)
|
||||
{
|
||||
if (PlayerSacrificeHelper.incrementIncense(player, 0, incenseAddition, incenseAddition / 100))
|
||||
{
|
||||
hasPerformed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (hasPerformed)
|
||||
{
|
||||
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof ServerWorld)
|
||||
{
|
||||
ServerWorld server = (ServerWorld) getWorld();
|
||||
server.spawnParticle(ParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 1, 0.02, 0.03, 0.02, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deserialize(CompoundNBT tag)
|
||||
{
|
||||
super.deserialize(tag);
|
||||
tranquility = tag.getDouble("tranquility");
|
||||
incenseAddition = tag.getDouble("incenseAddition");
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT serialize(CompoundNBT tag)
|
||||
{
|
||||
super.serialize(tag);
|
||||
tag.putDouble("tranquility", tranquility);
|
||||
tag.putDouble("incenseAddition", incenseAddition);
|
||||
return tag;
|
||||
}
|
||||
|
||||
public void recheckConstruction()
|
||||
{
|
||||
// TODO: Check the physical construction of the incense altar to determine the
|
||||
// maximum length.
|
||||
int maxLength = 11; // Max length of the path. The path starts two blocks away from the center
|
||||
// block.
|
||||
int yOffset = 0;
|
||||
|
||||
Map<EnumTranquilityType, Double> tranquilityMap = new HashMap<>();
|
||||
|
||||
for (int currentDistance = 2; currentDistance < currentDistance + maxLength; currentDistance++)
|
||||
{
|
||||
boolean canFormRoad = false;
|
||||
|
||||
for (int i = -maxCheckRange + yOffset; i <= maxCheckRange + yOffset; i++)
|
||||
{
|
||||
BlockPos verticalPos = pos.add(0, i, 0);
|
||||
|
||||
canFormRoad = true;
|
||||
level: for (int index = 0; index < 4; index++)
|
||||
{
|
||||
Direction horizontalFacing = Direction.byHorizontalIndex(index);
|
||||
BlockPos facingOffsetPos = verticalPos.offset(horizontalFacing, currentDistance);
|
||||
for (int j = -1; j <= 1; j++)
|
||||
{
|
||||
BlockPos offsetPos = facingOffsetPos.offset(horizontalFacing.rotateY(), j);
|
||||
BlockState state = getWorld().getBlockState(offsetPos);
|
||||
Block block = state.getBlock();
|
||||
if (!(block instanceof IIncensePath && ((IIncensePath) block).getLevelOfPath(getWorld(), offsetPos, state) >= currentDistance - 2))
|
||||
{
|
||||
canFormRoad = false;
|
||||
break level;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (canFormRoad)
|
||||
{
|
||||
yOffset = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (canFormRoad)
|
||||
{
|
||||
for (int i = -currentDistance; i <= currentDistance; i++)
|
||||
{
|
||||
for (int j = -currentDistance; j <= currentDistance; j++)
|
||||
{
|
||||
if (Math.abs(i) != currentDistance && Math.abs(j) != currentDistance)
|
||||
{
|
||||
continue; // TODO: Can make this just set j to currentDistance to speed it up.
|
||||
}
|
||||
|
||||
for (int y = yOffset; y <= 2 + yOffset; y++)
|
||||
{
|
||||
BlockPos offsetPos = pos.add(i, y, j);
|
||||
BlockState state = getWorld().getBlockState(offsetPos);
|
||||
Block block = state.getBlock();
|
||||
TranquilityStack stack = IncenseTranquilityRegistry.getTranquilityOfBlock(getWorld(), offsetPos, block, state);
|
||||
if (stack != null)
|
||||
{
|
||||
if (!tranquilityMap.containsKey(stack.type))
|
||||
{
|
||||
tranquilityMap.put(stack.type, stack.value);
|
||||
} else
|
||||
{
|
||||
tranquilityMap.put(stack.type, tranquilityMap.get(stack.type) + stack.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
{
|
||||
roadDistance = currentDistance - 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
this.tranquilityMap = tranquilityMap;
|
||||
|
||||
double totalTranquility = 0;
|
||||
for (Entry<EnumTranquilityType, Double> entry : tranquilityMap.entrySet())
|
||||
{
|
||||
totalTranquility += entry.getValue();
|
||||
}
|
||||
|
||||
if (totalTranquility < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double appliedTranquility = 0;
|
||||
for (Entry<EnumTranquilityType, Double> entry : tranquilityMap.entrySet())
|
||||
{
|
||||
appliedTranquility += Math.sqrt(entry.getValue());
|
||||
}
|
||||
|
||||
double bonus = IncenseAltarHandler.getIncenseBonusFromComponents(getWorld(), pos, appliedTranquility, roadDistance);
|
||||
incenseAddition = bonus;
|
||||
this.tranquility = appliedTranquility;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package wayoftime.bloodmagic.util.helper;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import wayoftime.bloodmagic.util.Constants;
|
||||
|
||||
public class IncenseHelper
|
||||
{
|
||||
|
||||
public static double getCurrentIncense(PlayerEntity player)
|
||||
{
|
||||
CompoundNBT data = player.getPersistentData();
|
||||
if (data.contains(Constants.NBT.CURRENT_INCENSE))
|
||||
{
|
||||
return data.getDouble(Constants.NBT.CURRENT_INCENSE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void setCurrentIncense(PlayerEntity player, double amount)
|
||||
{
|
||||
CompoundNBT data = player.getPersistentData();
|
||||
data.putDouble(Constants.NBT.CURRENT_INCENSE, amount);
|
||||
}
|
||||
|
||||
public static void setMaxIncense(PlayerEntity player, double amount)
|
||||
{
|
||||
CompoundNBT data = player.getPersistentData();
|
||||
data.putDouble(Constants.NBT.MAX_INCENSE, amount);
|
||||
}
|
||||
|
||||
public static double getMaxIncense(PlayerEntity player)
|
||||
{
|
||||
CompoundNBT data = player.getPersistentData();
|
||||
if (data.contains(Constants.NBT.MAX_INCENSE))
|
||||
{
|
||||
return data.getDouble(Constants.NBT.MAX_INCENSE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void setHasMaxIncense(ItemStack stack, PlayerEntity player, boolean isMax)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
stack.getTag().putBoolean(Constants.NBT.HAS_MAX_INCENSE, isMax);
|
||||
}
|
||||
|
||||
public static boolean getHasMaxIncense(ItemStack stack)
|
||||
{
|
||||
stack = NBTHelper.checkNBT(stack);
|
||||
return stack.getTag().getBoolean(Constants.NBT.HAS_MAX_INCENSE);
|
||||
}
|
||||
}
|
|
@ -19,35 +19,35 @@ public class PlayerSacrificeHelper
|
|||
|
||||
public static double getPlayerIncense(PlayerEntity player)
|
||||
{
|
||||
return 0;
|
||||
// return IncenseHelper.getCurrentIncense(player);
|
||||
// return 0;
|
||||
return IncenseHelper.getCurrentIncense(player);
|
||||
}
|
||||
|
||||
public static void setPlayerIncense(PlayerEntity player, double amount)
|
||||
{
|
||||
// IncenseHelper.setCurrentIncense(player, amount);
|
||||
IncenseHelper.setCurrentIncense(player, amount);
|
||||
}
|
||||
|
||||
public static boolean incrementIncense(PlayerEntity player, double min, double incenseAddition, double increment)
|
||||
{
|
||||
return true;
|
||||
// double amount = getPlayerIncense(player);
|
||||
// if (amount < min || amount >= incenseAddition)
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// amount = amount + Math.min(increment, incenseAddition - amount);
|
||||
// setPlayerIncense(player, amount);
|
||||
//
|
||||
// if (amount == incenseAddition)
|
||||
// {
|
||||
// IncenseHelper.setMaxIncense(player, incenseAddition);
|
||||
// }
|
||||
// // System.out.println("Amount of incense: " + amount + ", Increment: " +
|
||||
// // increment);
|
||||
//
|
||||
// return true;
|
||||
double amount = getPlayerIncense(player);
|
||||
if (amount < min || amount >= incenseAddition)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
amount = amount + Math.min(increment, incenseAddition - amount);
|
||||
setPlayerIncense(player, amount);
|
||||
|
||||
if (amount == incenseAddition)
|
||||
{
|
||||
IncenseHelper.setMaxIncense(player, incenseAddition);
|
||||
}
|
||||
// System.out.println("Amount of incense: " + amount + ", Increment: " +
|
||||
// increment);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,8 +74,7 @@ public class PlayerSacrificeHelper
|
|||
if (health > maxHealth / 10.0)
|
||||
{
|
||||
float sacrificedHealth = health - maxHealth / 10.0f;
|
||||
int lpAdded = (int) (sacrificedHealth * ConfigHandler.values.sacrificialDaggerConversion
|
||||
* getModifier(amount));
|
||||
int lpAdded = (int) (sacrificedHealth * ConfigHandler.values.sacrificialDaggerConversion * getModifier(amount));
|
||||
|
||||
IBloodAltar altar = getAltar(player.getEntityWorld(), player.getPosition());
|
||||
if (altar != null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue