Move commonly used API systems to a plugin based system

Create a class that implements IBloodMagicPlugin and annotate it with
`@BloodMagicPlugin`. The `register` method will be called during init.

Currently implemented systems:
- Blacklisting
  - Teleposer
  - Teleposer (entity)
  - Transposition
  - Well of Suffering
  - Green Grove
- Setting sacrificial values
- Adding altar components
This commit is contained in:
Nicholas Ignoffo 2017-08-15 18:14:28 -07:00
parent 5fcdd978d7
commit 554c9852e6
86 changed files with 528 additions and 496 deletions

View file

@ -1,10 +1,16 @@
package WayofTime.bloodmagic;
import java.io.File;
import java.util.List;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import WayofTime.bloodmagic.apiv2.BloodMagicPlugin;
import WayofTime.bloodmagic.apiv2.IBloodMagicPlugin;
import WayofTime.bloodmagic.command.CommandBloodMagic;
import WayofTime.bloodmagic.api.registry.RitualRegistry;
import WayofTime.bloodmagic.meteor.MeteorConfigHandler;
import WayofTime.bloodmagic.util.PluginUtil;
import com.google.common.collect.Lists;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.launchwrapper.Launch;
@ -19,15 +25,15 @@ import WayofTime.bloodmagic.client.gui.GuiHandler;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import WayofTime.bloodmagic.proxy.CommonProxy;
import WayofTime.bloodmagic.registry.ModArmourTrackers;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.ModCorruptionBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.registry.ModRecipes;
import WayofTime.bloodmagic.registry.ModRituals;
import WayofTime.bloodmagic.registry.ModTranquilityHandlers;
import WayofTime.bloodmagic.structures.ModDungeons;
import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.handler.IMCHandler;
import org.apache.commons.lang3.tuple.Pair;
@Mod(modid = BloodMagic.MODID, name = BloodMagic.NAME, version = BloodMagic.VERSION, dependencies = BloodMagic.DEPEND, guiFactory = "WayofTime.bloodmagic.client.gui.config.ConfigGuiFactory")
public class BloodMagic
@ -59,6 +65,7 @@ public class BloodMagic
}
}.setNoTitle().setBackgroundImageName("items_search.png");
public static final boolean IS_DEV = (Boolean) Launch.blackboard.get("fml.deobfuscatedEnvironment");
public static final List<Pair<IBloodMagicPlugin, BloodMagicPlugin>> PLUGINS = Lists.newArrayList();
static
{
@ -79,6 +86,8 @@ public class BloodMagic
configDir = new File(event.getModConfigurationDirectory(), "BloodMagic");
ConfigHandler.init(new File(configDir, "BloodMagic.cfg"));
PLUGINS.addAll(PluginUtil.getPlugins(event.getAsmData()));
ModTranquilityHandlers.init();
ModDungeons.init();
@ -90,7 +99,8 @@ public class BloodMagic
public void init(FMLInitializationEvent event)
{
BloodMagicPacketHandler.init();
RegistrarBloodMagicBlocks.registerBlacklists();
for (Pair<IBloodMagicPlugin, BloodMagicPlugin> plugin : PLUGINS)
plugin.getLeft().register(BloodMagicAPI.INSTANCE);
ModRecipes.init();
ModRituals.initRituals();

View file

@ -2,6 +2,8 @@ package WayofTime.bloodmagic.altar;
import java.util.List;
import WayofTime.bloodmagic.api.orb.BloodOrb;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -22,7 +24,6 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.altar.AltarComponent;
import WayofTime.bloodmagic.api.altar.AltarUpgrade;
@ -118,27 +119,20 @@ public class BloodAltar implements IFluidHandler
for (AltarComponent altarComponent : EnumAltarTier.values()[altarTier].getAltarComponents())
{
BlockPos componentPos = worldPos.add(altarComponent.getOffset());
BlockStack worldBlock = new BlockStack(world.getBlockState(componentPos).getBlock(), world.getBlockState(componentPos).getBlock().getMetaFromState(world.getBlockState(componentPos)));
IBlockState state = world.getBlockState(componentPos);
if (altarComponent.getComponent() != EnumAltarComponent.NOTAIR)
{
if (worldBlock.getBlock() instanceof IAltarComponent)
{
EnumAltarComponent component = ((IAltarComponent) worldBlock.getBlock()).getType(world, worldBlock.getState(), componentPos);
if (component == null || component != altarComponent.getComponent())
return false;
} else if (worldBlock.getBlock() != Utils.getBlockForComponent(altarComponent.getComponent())) // Special case Vanilla
{
return false;
} else if (BloodMagicAPI.altarComponents.get(worldBlock.getState()) != null) // Mod compat
{
return BloodMagicAPI.altarComponents.get(worldBlock.getState()) == altarComponent.getComponent();
}
} else
{
if (world.isAirBlock(componentPos))
if (altarComponent.getComponent() == EnumAltarComponent.NOTAIR && world.isAirBlock(componentPos))
return false;
if (state.getBlock() instanceof IAltarComponent) {
EnumAltarComponent component = ((IAltarComponent) state.getBlock()).getType(world, state, componentPos);
if (component == null || component != altarComponent.getComponent())
return false;
}
EnumAltarComponent component = BloodMagicAPI.INSTANCE.getAltarComponents().get(state);
if (component == null || component != altarComponent.getComponent())
return false;
}
return true;
@ -259,10 +253,10 @@ public class BloodAltar implements IFluidHandler
if (fluid != null)
setMainFluid(fluid);
FluidStack fluidOut = new FluidStack(BloodMagicAPI.lifeEssence, tagCompound.getInteger(Constants.NBT.OUTPUT_AMOUNT));
FluidStack fluidOut = new FluidStack(BlockLifeEssence.getLifeEssence(), tagCompound.getInteger(Constants.NBT.OUTPUT_AMOUNT));
setOutputFluid(fluidOut);
FluidStack fluidIn = new FluidStack(BloodMagicAPI.lifeEssence, tagCompound.getInteger(Constants.NBT.INPUT_AMOUNT));
FluidStack fluidIn = new FluidStack(BlockLifeEssence.getLifeEssence(), tagCompound.getInteger(Constants.NBT.INPUT_AMOUNT));
setInputFluid(fluidIn);
}
@ -540,8 +534,8 @@ public class BloodAltar implements IFluidHandler
{
int liquidDrained = Math.min((int) (altarTier.ordinal() >= 2 ? consumptionRate * (1 + consumptionMultiplier) : consumptionRate), fluid.amount);
int drain = NetworkHelper.getSoulNetwork(ownerUUID).add(liquidDrained, (int) (item.getMaxEssence(returnedItem.getMetadata()) * this.orbCapacityMultiplier));
BloodOrb orb = item.getOrb(returnedItem);
int drain = orb == null ? 0 : NetworkHelper.getSoulNetwork(ownerUUID).add(liquidDrained, (int) (orb.getCapacity() * this.orbCapacityMultiplier));
fluid.amount = fluid.amount - drain;
if (drain > 0 && internalCounter % 4 == 0 && world instanceof WorldServer)

View file

@ -1,277 +1,19 @@
package WayofTime.bloodmagic.api;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.api.util.helper.LogHelper;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.UniversalBucket;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The primary API class. Includes helper methods and blacklists.
*
* Some API methods can be used via IMC instead. The supported methods are:
*
* <ul>
* <li>{@link #addToTeleposerBlacklist(BlockStack)}</li>
* <li>{@link #blacklistFromGreenGrove(Block)}</li>
* <li>{@link #setEntitySacrificeValue(Class, int)}</li>
* <li>{@link #addAltarComponent(IBlockState, EnumAltarComponent)}</li>
* </ul>
*/
// TODO - Nuke this class
public class BloodMagicAPI
{
public static final List<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
public static final List<BlockStack> transpositionBlacklist = new ArrayList<BlockStack>();
public static final Map<String, Integer> entitySacrificeValues = new HashMap<String, Integer>();
public static final ArrayList<Block> greenGroveBlacklist = new ArrayList<Block>();
public static final Map<IBlockState, EnumAltarComponent> altarComponents = new HashMap<IBlockState, EnumAltarComponent>();
public static boolean loggingEnabled;
public static LogHelper logger = new LogHelper("BloodMagic|API");
public static DamageSource damageSource = new DamageSourceBloodMagic();
public static Fluid lifeEssence;
public static ItemStack lifeEssenceBucket;
public static ItemStack getLifeEssenceBucket()
{
if (lifeEssenceBucket != null)
return lifeEssenceBucket;
lifeEssenceBucket = UniversalBucket.getFilledBucket(ForgeModContainer.getInstance().universalBucket, lifeEssence);
return lifeEssenceBucket;
}
/**
* Used to obtain Items from BloodMagic. Use
* {@link WayofTime.bloodmagic.api.Constants.BloodMagicItem} to get the
* registered name.
*
* @param name
* - The registered name of the item. Usually the same as the class
* name.
* @return - The requested Item
*/
public static Item getItem(String name)
{
return ForgeRegistries.ITEMS.getValue(new ResourceLocation(BloodMagic.MODID, name));
}
/**
* @see #getItem(String)
*
* @param bloodMagicItem
* - The {@link WayofTime.bloodmagic.api.Constants.BloodMagicItem} to
* get.
* @return - The requested Item
*/
public static Item getItem(Constants.BloodMagicItem bloodMagicItem)
{
return getItem(bloodMagicItem.getRegName());
}
/**
* Used to obtain Blocks from BloodMagic. Use
* {@link WayofTime.bloodmagic.api.Constants.BloodMagicBlock} to get the
* registered name.
*
* @param name
* - The registered name of the block. Usually the same as the class
* name.
* @return - The requested Block
*/
public static Block getBlock(String name)
{
return ForgeRegistries.BLOCKS.getValue(new ResourceLocation(BloodMagic.MODID, name));
}
/**
* @see #getBlock(String)
*
* @param bloodMagicBlock
* - The {@link WayofTime.bloodmagic.api.Constants.BloodMagicBlock}
* to get.
* @return - The requested Block
*/
public static Block getBlock(Constants.BloodMagicBlock bloodMagicBlock)
{
return getBlock(bloodMagicBlock.getRegName());
}
/**
* Used to add a {@link BlockStack} to the Teleposer blacklist that cannot
* be changed via Configuration files.
*
* IMC:
* {@code FMLInterModComs.sendMessage("bloodmagic", "teleposerBlacklist", ItemStack)}
* Example:
* {@code FMLInterModComs.sendMessage("bloodmagic", "teleposerBlacklist", new ItemStack(Blocks.bedrock))}
*
* @param blockStack
* - The BlockStack to blacklist.
*/
public static void addToTeleposerBlacklist(BlockStack blockStack)
{
if (!teleposerBlacklist.contains(blockStack))
teleposerBlacklist.add(blockStack);
}
/**
* @see #addToTeleposerBlacklist(BlockStack)
*
* @param block
* - The block to blacklist
* @param meta
* - The meta of the block to blacklist
*/
public static void addToTeleposerBlacklist(Block block, int meta)
{
addToTeleposerBlacklist(new BlockStack(block, meta));
}
/**
* @see #addToTeleposerBlacklist(BlockStack)
*
* @param block
* - The block to blacklist
*/
public static void addToTeleposerBlacklist(Block block)
{
addToTeleposerBlacklist(block, 0);
}
/**
* Used to add a {@link BlockStack} to the Transposition blacklist that
* cannot be changed via Configuration files.
*
* IMC:
* {@code FMLInterModComs.sendMessage("bloodmagic", "transpositionBlacklist", ItemStack)}
* Example:
* {@code FMLInterModComs.sendMessage("bloodmagic", "transpositionBlacklist", new ItemStack(Blocks.bedrock))}
*
* @param blockStack
* - The BlockStack to blacklist.
*/
public static void addToTranspositionBlacklist(BlockStack blockStack)
{
if (!transpositionBlacklist.contains(blockStack))
transpositionBlacklist.add(blockStack);
}
/**
* @see #addToTranspositionBlacklist(BlockStack)
*
* @param block
* - The block to blacklist
* @param meta
* - The meta of the block to blacklist
*/
public static void addToTranspositionBlacklist(Block block, int meta)
{
addToTranspositionBlacklist(new BlockStack(block, meta));
}
/**
* @see #addToTranspositionBlacklist(BlockStack)
*
* @param block
* - The block to blacklist
*/
public static void addToTranspositionBlacklist(Block block)
{
addToTranspositionBlacklist(block, 0);
}
/**
* Used to set the sacrifice value of an Entity. The value provided is how
* much LP will be gained when the entity is sacrificed at a Blood Altar.
*
* Setting a sacrificeValue of 0 will effectively blacklist the entity.
*
* The default value for any unset Entity is 500 LP per sacrifice.
*
* IMC:
* {@code FMLInterModComs.sendMessage("bloodmagic", "sacrificeValue", "ClassName;Value")}
* Example:
* {@code FMLInterModComs.sendMessage("bloodmagic", "sacrificeValue", "EntityVillager;2000")}
*
* @param entityClass
* - The class of the entity to blacklist.
* @param sacrificeValue
* - The Amount of LP to provide per each HP of the entity
* sacrificed.
*/
public static void setEntitySacrificeValue(Class<? extends EntityLivingBase> entityClass, int sacrificeValue)
{
if (!entitySacrificeValues.containsKey(entityClass.getSimpleName()))
entitySacrificeValues.put(entityClass.getSimpleName(), sacrificeValue);
}
/**
* @see #setEntitySacrificeValue(Class, int)
*
* @param entityClassName
* - The name of the class of the entity to blacklist.
* @param sacrificeValue
* - The Amount of LP to provide per each HP of the entity
* sacrificed.
*/
public static void setEntitySacrificeValue(String entityClassName, int sacrificeValue)
{
if (!entitySacrificeValues.containsKey(entityClassName))
entitySacrificeValues.put(entityClassName, sacrificeValue);
}
/**
* Blacklists a block from the Green Grove Ritual and Sigil.
*
* IMC:
* {@code FMLInterModComs.sendMessage("bloodmagic", "greenGroveBlacklist", "domain:name")}
* Example:
* {@code FMLInterModComs.sendMessage("bloodmagic", "greenGroveBlacklist", "minecraft:wheat")}
*
* @param block
* - Block to blacklist
*/
public static void blacklistFromGreenGrove(Block block)
{
if (!greenGroveBlacklist.contains(block))
greenGroveBlacklist.add(block);
}
/**
* Marks an IBlockState as a specific {@link EnumAltarComponent} without needing to implement
* {@link WayofTime.bloodmagic.api.altar.IAltarComponent} on the block.
*
* IMC:
* {@code FMLInterModComs.sendMessage("bloodmagic", "altarComponent", "domain:name:meta:component")}
* Example:
* {@code FMLInterModComs.sendMessage("bloodmagic", "altarComponent", "minecraft:glowstone:0:GLOWSTONE")}
*
* @param state
* - The IBlockState for this component
* @param altarComponent
* - The EnumAltarComponent for this state
*/
public static void addAltarComponent(IBlockState state, EnumAltarComponent altarComponent)
{
if (!altarComponents.containsKey(state))
altarComponents.put(state, altarComponent);
}
}

View file

@ -14,6 +14,7 @@ public enum EnumAltarComponent
CRYSTAL,
NOTAIR;
public static final EnumAltarComponent[] VALUES = values();
private static final String BASE = "chat.bloodmagic.altar.comp.";
private String key;

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.api.event;
import WayofTime.bloodmagic.api.BlockStack;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@ -18,21 +18,21 @@ public class TeleposeEvent extends Event
{
public final World initalWorld;
public final BlockPos initialBlockPos;
public final BlockStack initialStack;
public final IBlockState initialState;
public final World finalWorld;
public final BlockPos finalBlockPos;
public final BlockStack finalStack;
public final IBlockState finalState;
public TeleposeEvent(World initialWorld, BlockPos initialBlockPos, World finalWorld, BlockPos finalBlockPos)
{
this.initalWorld = initialWorld;
this.initialBlockPos = initialBlockPos;
this.initialStack = BlockStack.getStackFromPos(initialWorld, initialBlockPos);
this.initialState = initialWorld.getBlockState(initialBlockPos);
this.finalWorld = finalWorld;
this.finalBlockPos = finalBlockPos;
this.finalStack = BlockStack.getStackFromPos(finalWorld, finalBlockPos);
this.finalState = finalWorld.getBlockState(finalBlockPos);
}
public TileEntity getInitialTile()

View file

@ -1,22 +1,12 @@
package WayofTime.bloodmagic.api.registry;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
import WayofTime.bloodmagic.api.orb.BloodOrb;
import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import com.google.common.collect.ArrayListMultimap;
import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Collections;

View file

@ -0,0 +1,56 @@
package WayofTime.bloodmagic.api_impl;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.apiv2.IBloodMagicAPI;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
import java.util.Map;
public class BloodMagicAPI implements IBloodMagicAPI {
public static final BloodMagicAPI INSTANCE = new BloodMagicAPI();
private final BloodMagicBlacklist blacklist;
private final Map<ResourceLocation, Integer> sacrificialValues;
private final Map<IBlockState, EnumAltarComponent> altarComponents;
public BloodMagicAPI() {
this.blacklist = new BloodMagicBlacklist();
this.sacrificialValues = Maps.newHashMap();
this.altarComponents = Maps.newHashMap();
}
@Override
public BloodMagicBlacklist getBlacklist() {
return blacklist;
}
@Override
public void setSacrificialValue(ResourceLocation entityId, int value) {
sacrificialValues.put(entityId, value);
}
@Override
public void registerAltarComponent(IBlockState state, String componentType) {
EnumAltarComponent component = EnumAltarComponent.NOTAIR;
for (EnumAltarComponent type : EnumAltarComponent.VALUES) {
if (type.name().equalsIgnoreCase(componentType)) {
component = type;
break;
}
}
altarComponents.put(state, component);
}
public Map<ResourceLocation, Integer> getSacrificialValues() {
return ImmutableMap.copyOf(sacrificialValues);
}
public Map<IBlockState, EnumAltarComponent> getAltarComponents() {
return ImmutableMap.copyOf(altarComponents);
}
}

View file

@ -0,0 +1,97 @@
package WayofTime.bloodmagic.api_impl;
import WayofTime.bloodmagic.apiv2.IBloodMagicBlacklist;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
import java.util.Set;
public class BloodMagicBlacklist implements IBloodMagicBlacklist {
private final Set<IBlockState> teleposer;
private final Set<ResourceLocation> teleposerEntities;
private final Set<IBlockState> transposition;
private final Set<IBlockState> greenGrove;
private final Set<ResourceLocation> sacrifice;
public BloodMagicBlacklist() {
this.teleposer = Sets.newHashSet();
this.teleposerEntities = Sets.newHashSet();
this.transposition = Sets.newHashSet();
this.greenGrove = Sets.newHashSet();
this.sacrifice = Sets.newHashSet();
}
@Override
public void addTeleposer(IBlockState state) {
if (!teleposer.contains(state))
teleposer.add(state);
}
@Override
public void addTeleposer(Block block) {
for (IBlockState state : block.getBlockState().getValidStates())
addTeleposer(state);
}
@Override
public void addTeleposer(ResourceLocation entityId) {
if (!teleposerEntities.contains(entityId))
teleposerEntities.add(entityId);
}
@Override
public void addTransposition(IBlockState state) {
if (!transposition.contains(state))
transposition.add(state);
}
@Override
public void addTransposition(Block block) {
for (IBlockState state : block.getBlockState().getValidStates())
addTransposition(state);
}
@Override
public void addGreenGrove(IBlockState state) {
if (!greenGrove.contains(state))
greenGrove.add(state);
}
@Override
public void addGreenGrove(Block block) {
for (IBlockState state : block.getBlockState().getValidStates())
addGreenGrove(state);
}
@Override
public void addSacrifice(ResourceLocation entityId) {
if (!sacrifice.contains(entityId))
sacrifice.add(entityId);
}
// Internal use getters
public Set<IBlockState> getTeleposer() {
return ImmutableSet.copyOf(teleposer);
}
public Set<ResourceLocation> getTeleposerEntities() {
return ImmutableSet.copyOf(teleposerEntities);
}
public Set<IBlockState> getTransposition() {
return ImmutableSet.copyOf(transposition);
}
public Set<IBlockState> getGreenGrove() {
return ImmutableSet.copyOf(greenGrove);
}
public Set<ResourceLocation> getSacrifice() {
return ImmutableSet.copyOf(sacrifice);
}
}

View file

@ -0,0 +1,54 @@
package WayofTime.bloodmagic.api_impl;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.apiv2.BloodMagicPlugin;
import WayofTime.bloodmagic.apiv2.IBloodMagicAPI;
import WayofTime.bloodmagic.apiv2.IBloodMagicPlugin;
import WayofTime.bloodmagic.block.BlockBloodRune;
import WayofTime.bloodmagic.block.BlockDecorative;
import WayofTime.bloodmagic.block.enums.EnumBloodRune;
import WayofTime.bloodmagic.block.enums.EnumDecorative;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import net.minecraft.init.Blocks;
import net.minecraft.util.ResourceLocation;
@BloodMagicPlugin
public class BloodMagicCorePlugin implements IBloodMagicPlugin {
@Override
public void register(IBloodMagicAPI api) {
// Add forced blacklistings
api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INPUT_ROUTING_NODE);
api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.INPUT_ROUTING_NODE);
api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.OUTPUT_ROUTING_NODE);
api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.OUTPUT_ROUTING_NODE);
api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.ITEM_ROUTING_NODE);
api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.ITEM_ROUTING_NODE);
api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.MASTER_ROUTING_NODE);
api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.MASTER_ROUTING_NODE);
api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.DEMON_CRYSTAL);
api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.DEMON_CRYSTAL);
api.getBlacklist().addTeleposer(RegistrarBloodMagicBlocks.INVERSION_PILLAR);
api.getBlacklist().addTransposition(RegistrarBloodMagicBlocks.INVERSION_PILLAR);
api.getBlacklist().addSacrifice(new ResourceLocation("armor_stand"));
api.getBlacklist().addSacrifice(new ResourceLocation(BloodMagic.MODID, "sentient_specter"));
// TODO - Register things from config
// Add standard blocks for altar components
api.registerAltarComponent(Blocks.GLOWSTONE.getDefaultState(), EnumAltarComponent.GLOWSTONE.name());
api.registerAltarComponent(Blocks.SEA_LANTERN.getDefaultState(), EnumAltarComponent.GLOWSTONE.name());
api.registerAltarComponent(Blocks.BEACON.getDefaultState(), EnumAltarComponent.BEACON.name());
BlockDecorative decorative = (BlockDecorative) RegistrarBloodMagicBlocks.DECORATIVE_BRICK;
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_BRICK), EnumAltarComponent.BLOODSTONE.name());
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.BLOODSTONE_TILE), EnumAltarComponent.BLOODSTONE.name());
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_BRICK), EnumAltarComponent.CRYSTAL.name());
api.registerAltarComponent(decorative.getDefaultState().withProperty(decorative.getProperty(), EnumDecorative.CRYSTAL_TILE), EnumAltarComponent.CRYSTAL.name());
BlockBloodRune bloodRune = (BlockBloodRune) RegistrarBloodMagicBlocks.BLOOD_RUNE;
for (EnumBloodRune runeType : EnumBloodRune.values())
api.registerAltarComponent(bloodRune.getDefaultState().withProperty(bloodRune.getProperty(), runeType), EnumAltarComponent.BLOODRUNE.name());
}
}

View file

@ -0,0 +1,12 @@
package WayofTime.bloodmagic.apiv2;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface BloodMagicPlugin {
}

View file

@ -0,0 +1,18 @@
package WayofTime.bloodmagic.apiv2;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
public interface IBloodMagicAPI {
/**
* Retrieves the instance of the blacklisting system that Blood Magic uses.
*
* @return the active blacklist instance
*/
IBloodMagicBlacklist getBlacklist();
void setSacrificialValue(ResourceLocation entityId, int value);
void registerAltarComponent(IBlockState state, String componentType);
}

View file

@ -0,0 +1,24 @@
package WayofTime.bloodmagic.apiv2;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.ResourceLocation;
public interface IBloodMagicBlacklist {
void addTeleposer(IBlockState state);
void addTeleposer(Block block);
void addTeleposer(ResourceLocation entityId);
void addTransposition(IBlockState state);
void addTransposition(Block block);
void addGreenGrove(IBlockState state);
void addGreenGrove(Block block);
void addSacrifice(ResourceLocation entityId);
}

View file

@ -0,0 +1,6 @@
package WayofTime.bloodmagic.apiv2;
public interface IBloodMagicPlugin {
void register(IBloodMagicAPI api);
}

View file

@ -22,7 +22,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.util.Utils;

View file

@ -17,7 +17,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import javax.annotation.Nullable;

View file

@ -12,7 +12,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fluids.BlockFluidClassic;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.util.helper.TextHelper;
@ -26,7 +25,6 @@ public class BlockLifeEssence extends BlockFluidClassic
setUnlocalizedName(BloodMagic.MODID + ".fluid.lifeEssence");
getLifeEssence().setBlock(this);
BloodMagicAPI.lifeEssence = LIFE_ESSENCE;
}
@Override

View file

@ -27,7 +27,7 @@ import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.api.altar.IAltarComponent;
import WayofTime.bloodmagic.block.enums.EnumMimic;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.TileMimic;
import WayofTime.bloodmagic.util.Utils;

View file

@ -27,7 +27,7 @@ import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
import WayofTime.bloodmagic.api.util.helper.RitualHelper;
import WayofTime.bloodmagic.block.enums.EnumRitualController;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
import amerifrance.guideapi.api.IGuideLinked;

View file

@ -1,6 +1,5 @@
package WayofTime.bloodmagic.block;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.SoundType;
@ -14,15 +13,12 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.api.ritual.IRitualStone;
import WayofTime.bloodmagic.block.base.BlockEnum;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class BlockRitualStone extends BlockEnum<EnumRuneType> implements IRitualStone

View file

@ -4,7 +4,7 @@ import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.item.inventory.ContainerHolding;
import WayofTime.bloodmagic.item.inventory.InventoryHolding;
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.GlStateManager;

View file

@ -2,7 +2,7 @@ package WayofTime.bloodmagic.client.hud;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.item.sigil.ItemSigilHolding;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;

View file

@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
public class CustomMeshDefinitionWillGem implements ItemMeshDefinition
{

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.client.render.entity;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderItem;

View file

@ -2,8 +2,8 @@ package WayofTime.bloodmagic.compat.guideapi;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.compat.guideapi.book.*;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import amerifrance.guideapi.api.GuideAPI;
import amerifrance.guideapi.api.GuideBook;
import amerifrance.guideapi.api.IGuideBook;

View file

@ -6,7 +6,7 @@ import WayofTime.bloodmagic.compat.guideapi.BookUtils;
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
import WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray;
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.RecipeHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.IPage;

View file

@ -19,8 +19,8 @@ import WayofTime.bloodmagic.compat.guideapi.page.PageAlchemyArray;
import WayofTime.bloodmagic.compat.guideapi.page.PageAltarRecipe;
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
import WayofTime.bloodmagic.item.ItemComponent;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.RecipeHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.IPage;

View file

@ -14,8 +14,8 @@ import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.compat.guideapi.BookUtils;
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
import WayofTime.bloodmagic.compat.guideapi.page.PageTartaricForgeRecipe;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.RecipeHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.IPage;

View file

@ -15,8 +15,8 @@ import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.compat.guideapi.BookUtils;
import WayofTime.bloodmagic.compat.guideapi.entry.EntryText;
import WayofTime.bloodmagic.compat.guideapi.page.PageAltarRecipe;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.RecipeHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.IPage;

View file

@ -31,8 +31,8 @@ import WayofTime.bloodmagic.compat.jei.forge.TartaricForgeRecipeHandler;
import WayofTime.bloodmagic.compat.jei.forge.TartaricForgeRecipeMaker;
import WayofTime.bloodmagic.compat.jei.orb.ShapedOrbRecipeHandler;
import WayofTime.bloodmagic.compat.jei.orb.ShapelessOrbRecipeHandler;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
@JEIPlugin
public class BloodMagicPlugin extends BlankModPlugin

View file

@ -6,12 +6,15 @@ import java.util.Map;
import javax.annotation.Nonnull;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.ItemStackWrapper;
import WayofTime.bloodmagic.block.BlockLifeEssence;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
public class AltarRecipeMaker
{
@ -35,7 +38,7 @@ public class AltarRecipeMaker
int drainRate = itemStackAltarRecipeEntry.getValue().getDrainRate();
if (output.getItem() == ForgeModContainer.getInstance().universalBucket && requiredLP == 1000)
output = BloodMagicAPI.getLifeEssenceBucket();
output = FluidUtil.getFilledBucket(new FluidStack(BlockLifeEssence.getLifeEssence(), Fluid.BUCKET_VOLUME));
AltarRecipeJEI recipe = new AltarRecipeJEI(input, output, requiredTier, requiredLP, consumptionRate, drainRate);
recipes.add(recipe);

View file

@ -8,7 +8,7 @@ import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.recipe.LivingArmourDowngradeRecipe;
import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import java.util.List;

View file

@ -11,7 +11,7 @@ import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.BlankRecipeWrapper;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.recipe.TartaricForgeRecipe;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class TartaricForgeRecipeJEI extends BlankRecipeWrapper

View file

@ -12,8 +12,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.util.helper.TextHelper;

View file

@ -17,7 +17,7 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.BlockAltar;
import WayofTime.bloodmagic.item.sigil.ItemSigilDivination;
import WayofTime.bloodmagic.item.sigil.ItemSigilSeer;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.util.helper.TextHelper;

View file

@ -1,4 +1,4 @@
package WayofTime.bloodmagic.registry;
package WayofTime.bloodmagic.core;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.orb.BloodOrb;
@ -10,6 +10,7 @@ import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
@ -17,6 +18,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.RegistryBuilder;
@ -84,16 +87,16 @@ public class RegistrarBloodMagic {
@SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityEntry> event) {
int entities = 0;
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "BloodLight"), EntityBloodLight.class, "BloodLight", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "SoulSnare"), EntitySoulSnare.class, "SoulSnare", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "SoulArrow"), EntitySentientArrow.class, "SoulArrow", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "Meteor"), EntityMeteor.class, "Meteor", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "SentientSpecter"), EntitySentientSpecter.class, "SentientSpecter", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "Mimic"), EntityMimic.class, "Mimic", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "CorruptedZombie"), EntityCorruptedZombie.class, "CorruptedZombie", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "CorruptedSheep"), EntityCorruptedSheep.class, "CorruptedSheep", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "CorruptedChicken"), EntityCorruptedChicken.class, "CorruptedChicken", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "CorruptedSpider"), EntityCorruptedSpider.class, "CorruptedSpider", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "blood_light"), EntityBloodLight.class, "BloodLight", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "soul_snare"), EntitySoulSnare.class, "SoulSnare", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "soul_arrow"), EntitySentientArrow.class, "SoulArrow", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "meteor"), EntityMeteor.class, "Meteor", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "sentient_specter"), EntitySentientSpecter.class, "SentientSpecter", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "mimic"), EntityMimic.class, "Mimic", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "corrupted_zombie"), EntityCorruptedZombie.class, "CorruptedZombie", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "corrupted_sheep"), EntityCorruptedSheep.class, "CorruptedSheep", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "corrupted_chicken"), EntityCorruptedChicken.class, "CorruptedChicken", ++entities, BloodMagic.instance, 16*4, 3, true);
EntityRegistry.registerModEntity(new ResourceLocation(BloodMagic.MODID, "corrupted_spider"), EntityCorruptedSpider.class, "CorruptedSpider", ++entities, BloodMagic.instance, 16*4, 3, true);
}
@SubscribeEvent
@ -106,8 +109,9 @@ public class RegistrarBloodMagic {
.create();
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void registerModels() {
public static void registerModels(ModelRegistryEvent event) {
for (BloodOrb orb : BLOOD_ORBS) {
ModelResourceLocation modelLocation = orb.getModelLocation();
if (modelLocation == null)

View file

@ -1,6 +1,5 @@
package WayofTime.bloodmagic.registry;
package WayofTime.bloodmagic.core;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.block.*;
import com.google.common.collect.Sets;
import net.minecraft.block.Block;
@ -149,8 +148,7 @@ public class RegistrarBloodMagicBlocks
registerTiles();
}
private static void registerTiles()
{
private static void registerTiles() {
GameRegistry.registerTileEntity(TileAltar.class, BloodMagic.MODID + ":" + TileAltar.class.getSimpleName());
GameRegistry.registerTileEntity(TileImperfectRitualStone.class, BloodMagic.MODID + ":" + TileImperfectRitualStone.class.getSimpleName());
GameRegistry.registerTileEntity(TileMasterRitualStone.class, BloodMagic.MODID + ":" + TileMasterRitualStone.class.getSimpleName());
@ -175,15 +173,4 @@ public class RegistrarBloodMagicBlocks
GameRegistry.registerTileEntity(TileMimic.class, BloodMagic.MODID + ":" + TileMimic.class.getSimpleName());
GameRegistry.registerTileEntity(TileInversionPillar.class, BloodMagic.MODID + ":" + TileInversionPillar.class.getSimpleName());
}
public static void registerBlacklists() {
BloodMagicAPI.addToTeleposerBlacklist(INPUT_ROUTING_NODE);
BloodMagicAPI.addToTranspositionBlacklist(INPUT_ROUTING_NODE);
BloodMagicAPI.addToTeleposerBlacklist(OUTPUT_ROUTING_NODE);
BloodMagicAPI.addToTranspositionBlacklist(OUTPUT_ROUTING_NODE);
BloodMagicAPI.addToTeleposerBlacklist(ITEM_ROUTING_NODE);
BloodMagicAPI.addToTranspositionBlacklist(ITEM_ROUTING_NODE);
BloodMagicAPI.addToTeleposerBlacklist(DEMON_CRYSTAL);
BloodMagicAPI.addToTranspositionBlacklist(DEMON_CRYSTAL);
}
}

View file

@ -1,4 +1,4 @@
package WayofTime.bloodmagic.registry;
package WayofTime.bloodmagic.core;
import WayofTime.bloodmagic.block.IBMBlock;
import WayofTime.bloodmagic.client.IVariantProvider;

View file

@ -35,7 +35,7 @@ import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import WayofTime.bloodmagic.block.BlockMimic;
import WayofTime.bloodmagic.entity.ai.EntityAIMimicReform;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.TileMimic;
public class EntityMimic extends EntityDemonBase

View file

@ -50,7 +50,7 @@ import WayofTime.bloodmagic.entity.ai.EntityAIOwnerHurtByTarget;
import WayofTime.bloodmagic.entity.ai.EntityAIOwnerHurtTarget;
import WayofTime.bloodmagic.entity.ai.EntityAIRetreatToHeal;
import WayofTime.bloodmagic.item.soul.ItemSentientBow;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
public class EntitySentientSpecter extends EntityDemonBase
{

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.entity.projectile;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.fuel;
import WayofTime.bloodmagic.item.ItemComponent;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.IFuelHandler;

View file

@ -3,7 +3,7 @@ package WayofTime.bloodmagic.incense;
import WayofTime.bloodmagic.api.incense.EnumTranquilityType;
import WayofTime.bloodmagic.api.incense.ITranquilityHandler;
import WayofTime.bloodmagic.api.incense.TranquilityStack;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;

View file

@ -20,7 +20,7 @@ import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.util.helper.TextHelper;

View file

@ -3,11 +3,10 @@ package WayofTime.bloodmagic.item;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.registry.RegistrarBloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
@ -17,7 +16,6 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.orb.BloodOrb;
import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.api.registry.OrbRegistry;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;

View file

@ -35,7 +35,7 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionActivatable;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Strings;

View file

@ -41,7 +41,7 @@ import WayofTime.bloodmagic.api.event.BoundToolEvent;
import WayofTime.bloodmagic.api.iface.IActivatable;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.ImmutableSet;

View file

@ -16,7 +16,7 @@ import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
public class ItemComponent extends Item implements IVariantProvider
{

View file

@ -3,6 +3,8 @@ package WayofTime.bloodmagic.item;
import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import com.google.common.collect.Lists;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.passive.EntityAnimal;
@ -14,12 +16,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundCategory;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.util.helper.PlayerSacrificeHelper;
import WayofTime.bloodmagic.api.util.helper.PurificationHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
@ -56,14 +59,8 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
if (target.isDead || target.getHealth() < 0.5F)
return false;
String entityName = target.getClass().getSimpleName();
int lifeEssenceRatio = 25;
if (ConfigHandler.entitySacrificeValues.containsKey(entityName))
lifeEssenceRatio = ConfigHandler.entitySacrificeValues.get(entityName);
if (BloodMagicAPI.getEntitySacrificeValues().containsKey(entityName))
lifeEssenceRatio = BloodMagicAPI.getEntitySacrificeValues().get(entityName);
EntityEntry entityEntry = EntityRegistry.getEntry(target.getClass());
int lifeEssenceRatio = BloodMagicAPI.INSTANCE.getSacrificialValues().getOrDefault(entityEntry.getRegistryName(), 25);
if (lifeEssenceRatio <= 0)
return false;
@ -83,7 +80,7 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
{
target.getEntityWorld().playSound(null, target.posX, target.posY, target.posZ, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (target.getEntityWorld().rand.nextFloat() - target.getEntityWorld().rand.nextFloat()) * 0.8F);
target.setHealth(-1);
target.onDeath(BloodMagicAPI.getDamageSource());
target.onDeath(WayofTime.bloodmagic.api.BloodMagicAPI.damageSource);
}
return false;
@ -92,8 +89,8 @@ public class ItemDaggerOfSacrifice extends Item implements IVariantProvider
@Override
public List<Pair<Integer, String>> getVariants()
{
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
ret.add(new ImmutablePair<Integer, String>(0, "type=normal"));
List<Pair<Integer, String>> ret = Lists.newArrayList();
ret.add(Pair.of(0, "type=normal"));
return ret;
}
}

View file

@ -19,7 +19,7 @@ import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.IDiscreteDemonWill;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
public class ItemDemonCrystal extends Item implements IDiscreteDemonWill, IVariantProvider
{

View file

@ -36,7 +36,7 @@ import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.util.helper.RitualHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Utils;

View file

@ -20,7 +20,7 @@ import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.iface.ICustomAlchemyConsumable;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
public class ItemCuttingFluid extends Item implements IVariantProvider, ICustomAlchemyConsumable

View file

@ -28,7 +28,7 @@ import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.Iterables;

View file

@ -45,7 +45,7 @@ import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerRepairing;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeElytra;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import WayofTime.bloodmagic.network.PlayerFallDistancePacketProcessor;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.TextHelper;

View file

@ -31,7 +31,7 @@ import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

View file

@ -15,7 +15,7 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
public class ItemSigilBloodLight extends ItemSigilBase
{

View file

@ -1,19 +1,18 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import net.minecraft.block.Block;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.BonemealEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import WayofTime.bloodmagic.api.BloodMagicAPI;
public class ItemSigilGreenGrove extends ItemSigilToggleableBase
{
@ -28,7 +27,7 @@ public class ItemSigilGreenGrove extends ItemSigilToggleableBase
if (PlayerHelper.isFakePlayer(player))
return false;
if (applyBonemeal(world, blockPos, player))
if (applyBonemeal(world, blockPos, player, stack))
{
if (!world.isRemote)
{
@ -59,16 +58,16 @@ public class ItemSigilGreenGrove extends ItemSigilToggleableBase
for (int iy = posY - verticalRange; iy <= posY + verticalRange; iy++)
{
BlockPos blockPos = new BlockPos(ix, iy, iz);
Block block = worldIn.getBlockState(blockPos).getBlock();
IBlockState state = worldIn.getBlockState(blockPos);
if (!BloodMagicAPI.greenGroveBlacklist.contains(block))
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
{
if (block instanceof IPlantable || block instanceof IGrowable)
if (state.getBlock() instanceof IGrowable)
{
if (worldIn.rand.nextInt(50) == 0)
{
IBlockState preBlockState = worldIn.getBlockState(blockPos);
block.updateTick(worldIn, blockPos, worldIn.getBlockState(blockPos), worldIn.rand);
state.getBlock().updateTick(worldIn, blockPos, state, worldIn.rand);
IBlockState newState = worldIn.getBlockState(blockPos);
if (!newState.equals(preBlockState) && !worldIn.isRemote)
@ -81,11 +80,11 @@ public class ItemSigilGreenGrove extends ItemSigilToggleableBase
}
}
private boolean applyBonemeal(World worldIn, BlockPos target, EntityPlayer player)
private boolean applyBonemeal(World worldIn, BlockPos target, EntityPlayer player, ItemStack sigilStack)
{
IBlockState iblockstate = worldIn.getBlockState(target);
BonemealEvent event = new BonemealEvent(player, worldIn, target, iblockstate);
BonemealEvent event = new BonemealEvent(player, worldIn, target, iblockstate, EnumHand.MAIN_HAND, sigilStack);
if (MinecraftForge.EVENT_BUS.post(event))
return false;
else if (event.getResult() == Result.ALLOW)

View file

@ -11,7 +11,7 @@ import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.Pair;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
public class ItemSigilPhantomBridge extends ItemSigilToggleableBase
{

View file

@ -40,7 +40,7 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.HashMultimap;

View file

@ -31,7 +31,7 @@ import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import java.util.Locale;

View file

@ -40,7 +40,7 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.HashMultimap;

View file

@ -40,7 +40,7 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.HashMultimap;

View file

@ -38,7 +38,7 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.client.mesh.CustomMeshDefinitionMultiWill;
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.collect.HashMultimap;

View file

@ -5,6 +5,7 @@ import java.util.Collection;
import java.util.List;
import java.util.Random;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import net.minecraft.block.Block;
import net.minecraft.block.IGrowable;
import net.minecraft.block.state.IBlockState;
@ -16,8 +17,6 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTablePotionAugmentRecipe;
@ -46,11 +45,11 @@ public class BMPotionUtils
for (int i = 0; i < maxPlantsGrown; i++)
{
BlockPos blockPos = entity.getPosition().add(rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius, rand.nextInt(verticalRadius * 2 + 1) - verticalRadius, rand.nextInt(horizontalRadius * 2 + 1) - horizontalRadius);
Block block = world.getBlockState(blockPos).getBlock();
IBlockState state = world.getBlockState(blockPos);
if (!BloodMagicAPI.greenGroveBlacklist.contains(block))
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
{
if (block instanceof IPlantable || block instanceof IGrowable)
if (state.getBlock() instanceof IGrowable)
{
growList.add(blockPos);
}
@ -77,7 +76,7 @@ public class BMPotionUtils
if (incurredDamage > 0)
{
entity.attackEntityFrom(BloodMagicAPI.damageSource, (float) incurredDamage);
entity.attackEntityFrom(WayofTime.bloodmagic.api.BloodMagicAPI.damageSource, (float) incurredDamage);
}
return incurredDamage;

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.potion;
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
import WayofTime.bloodmagic.registry.RegistrarBloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.projectile.EntityArrow;

View file

@ -57,8 +57,8 @@ import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
import WayofTime.bloodmagic.entity.projectile.EntityMeteor;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;

View file

@ -7,7 +7,7 @@ import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.potion.PotionUtils;
import WayofTime.bloodmagic.potion.BMPotionUtils;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
public class AlchemyTablePotionAugmentRecipe extends AlchemyTablePotionRecipe
{

View file

@ -9,7 +9,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.bloodmagic.api.recipe.AlchemyTableRecipe;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
public class AlchemyTablePotionRecipe extends AlchemyTableRecipe
{

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.registry;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import net.minecraft.init.Blocks;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.inversion.CorruptionHandler;

View file

@ -8,6 +8,9 @@ import java.util.Map.Entry;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.block.enums.EnumBloodRune;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.item.soul.ItemSoulGem;
import WayofTime.bloodmagic.tile.TileBloodTank;
import com.google.common.collect.ImmutableMap;

View file

@ -10,7 +10,7 @@ import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.block.BlockBloodRune;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.entity.effect.EntityLightningBolt;

View file

@ -30,7 +30,7 @@ import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.util.Utils;
public class RitualCrushing extends Ritual

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
@ -20,6 +21,8 @@ import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.tile.TileDemonCrystal;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
public class RitualForsakenSoul extends Ritual
{
@ -116,29 +119,31 @@ public class RitualForsakenSoul extends Ritual
for (EntityLivingBase entity : entities)
{
if (!ConfigHandler.wellOfSufferingBlacklist.contains(entity.getClass().getSimpleName()))
EntityEntry entityEntry = EntityRegistry.getEntry(entity.getClass());
if (BloodMagicAPI.INSTANCE.getBlacklist().getSacrifice().contains(entityEntry.getRegistryName()))
continue;
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
{
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
{
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
if (!entity.isEntityAlive())
{
if (!entity.isEntityAlive())
int uniqueness = calculateUniqueness(entity);
double modifier = 1;
if (entity instanceof EntityAnimal && !entity.isCollided)
{
int uniqueness = calculateUniqueness(entity);
double modifier = 1;
if (entity instanceof EntityAnimal && !entity.isCollided)
{
modifier = 4;
}
modifier = 4;
}
willBuffer += modifier * getWillForUniqueness(uniqueness) / HEALTH_THRESHOLD * entity.getMaxHealth();
crystalBuffer += modifier * entity.getMaxHealth() / HEALTH_THRESHOLD;
willBuffer += modifier * getWillForUniqueness(uniqueness) / HEALTH_THRESHOLD * entity.getMaxHealth();
crystalBuffer += modifier * entity.getMaxHealth() / HEALTH_THRESHOLD;
totalEffects++;
if (totalEffects >= maxEffects)
{
break;
}
totalEffects++;
if (totalEffects >= maxEffects)
{
break;
}
}
}

View file

@ -5,6 +5,8 @@ import java.util.List;
import java.util.Random;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFarmland;
import net.minecraft.block.IGrowable;
@ -19,7 +21,6 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.common.IPlantable;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
@ -28,7 +29,6 @@ import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.soul.DemonWillHolder;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.util.Utils;
public class RitualGreenGrove extends Ritual
@ -104,15 +104,14 @@ public class RitualGreenGrove extends Ritual
for (BlockPos newPos : growingRange.getContainedPositions(pos))
{
IBlockState state = world.getBlockState(newPos);
Block block = state.getBlock();
if (!BloodMagicAPI.greenGroveBlacklist.contains(block))
if (!BloodMagicAPI.INSTANCE.getBlacklist().getGreenGrove().contains(state))
{
if (block instanceof IPlantable || block instanceof IGrowable)
if (state.getBlock() instanceof IGrowable)
{
if (world.rand.nextDouble() < growthChance)
{
block.updateTick(world, newPos, state, new Random());
state.getBlock().updateTick(world, newPos, state, new Random());
IBlockState newState = world.getBlockState(newPos);
if (!newState.equals(state))
{
@ -214,12 +213,12 @@ public class RitualGreenGrove extends Ritual
continue;
}
if (entityLiving.isPotionActive(ModPotions.plantLeech) || !entityLiving.isPotionApplicable(new PotionEffect(ModPotions.plantLeech)))
if (entityLiving.isPotionActive(RegistrarBloodMagic.PLANT_LEECH) || !entityLiving.isPotionApplicable(new PotionEffect(RegistrarBloodMagic.PLANT_LEECH)))
{
continue;
}
entityLiving.addPotionEffect(new PotionEffect(ModPotions.plantLeech, 200, 0));
entityLiving.addPotionEffect(new PotionEffect(RegistrarBloodMagic.PLANT_LEECH, 200, 0));
corrosiveWill -= corrosiveWillDrain;
corrosiveDrain += corrosiveWillDrain;

View file

@ -6,7 +6,7 @@ import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.teleport.PortalLocation;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
import net.minecraft.block.state.IBlockState;

View file

@ -22,7 +22,7 @@ import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.util.helper.ItemHelper.LivingUpgrades;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import com.google.common.collect.Iterables;

View file

@ -2,8 +2,8 @@ package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import WayofTime.bloodmagic.tile.TileAltar;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -12,6 +12,8 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import java.util.ArrayList;
import java.util.List;
@ -85,27 +87,20 @@ public class RitualWellOfSuffering extends Ritual
for (EntityLivingBase entity : entities)
{
if (ConfigHandler.wellOfSufferingBlacklist.contains(entity.getClass().getSimpleName()))
EntityEntry entityEntry = EntityRegistry.getEntry(entity.getClass());
if (BloodMagicAPI.INSTANCE.getBlacklist().getSacrifice().contains(entityEntry.getRegistryName()))
continue;
String simpleClassName = entity.getClass().getSimpleName();
if (BloodMagicAPI.entitySacrificeValues.containsKey(simpleClassName) && BloodMagicAPI.entitySacrificeValues.get(simpleClassName) <= 0)
int lifeEssenceRatio = BloodMagicAPI.INSTANCE.getSacrificialValues().getOrDefault(entityEntry.getRegistryName(), SACRIFICE_AMOUNT);
if (lifeEssenceRatio <= 0)
continue;
if (entity.isEntityAlive() && !(entity instanceof EntityPlayer))
{
if (entity.attackEntityFrom(DamageSource.OUT_OF_WORLD, 1))
{
String entityName = entity.getClass().getSimpleName();
int lifeEssenceRatio = SACRIFICE_AMOUNT;
if (ConfigHandler.entitySacrificeValues.containsKey(entityName))
lifeEssenceRatio = ConfigHandler.entitySacrificeValues.get(entityName);
if (BloodMagicAPI.entitySacrificeValues.containsKey(entityName))
lifeEssenceRatio = BloodMagicAPI.entitySacrificeValues.get(entityName);
if (entity.isChild())
lifeEssenceRatio *= 0.5F;

View file

@ -4,7 +4,7 @@ import WayofTime.bloodmagic.api.soul.DemonWillHolder;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.IDemonWillConduit;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.base.TileTicking;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;

View file

@ -24,7 +24,7 @@ import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.inversion.InversionPillarHandler;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.base.TileTicking;
import com.google.common.collect.ImmutableMap;

View file

@ -25,7 +25,7 @@ import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.api.util.helper.RitualHelper;
import WayofTime.bloodmagic.item.ItemActivationCrystal;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.ChatUtil;
import com.google.common.base.Strings;

View file

@ -27,8 +27,8 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import WayofTime.bloodmagic.block.BlockMimic;
import WayofTime.bloodmagic.entity.mob.EntityMimic;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Utils;

View file

@ -1,7 +1,7 @@
package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.base.TileTicking;
import com.google.common.base.Strings;
import net.minecraft.block.Block;

View file

@ -0,0 +1,36 @@
package WayofTime.bloodmagic.util;
import WayofTime.bloodmagic.apiv2.BloodMagicPlugin;
import WayofTime.bloodmagic.apiv2.IBloodMagicPlugin;
import com.google.common.collect.Lists;
import net.minecraftforge.fml.common.discovery.ASMDataTable;
import org.apache.commons.lang3.tuple.Pair;
import javax.annotation.Nonnull;
import java.util.List;
import java.util.Set;
public class PluginUtil {
@SuppressWarnings("unchecked")
@Nonnull
public static List<Pair<IBloodMagicPlugin, BloodMagicPlugin>> getPlugins(ASMDataTable dataTable) {
List<Pair<IBloodMagicPlugin, BloodMagicPlugin>> discoveredAnnotations = Lists.newArrayList();
Set<ASMDataTable.ASMData> discoveredPlugins = dataTable.getAll(BloodMagicPlugin.class.getCanonicalName());
for (ASMDataTable.ASMData data : discoveredPlugins) {
try {
Class<?> asmClass = Class.forName(data.getClassName());
Class<? extends IBloodMagicPlugin> pluginClass = asmClass.asSubclass(IBloodMagicPlugin.class);
IBloodMagicPlugin instance = pluginClass.newInstance();
discoveredAnnotations.add(Pair.of(instance, pluginClass.getAnnotation(BloodMagicPlugin.class)));
} catch (Exception e) {
e.printStackTrace();
}
}
return discoveredAnnotations;
}
}

View file

@ -58,7 +58,7 @@ import WayofTime.bloodmagic.api.iface.IDemonWillViewer;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import WayofTime.bloodmagic.network.PlayerVelocityPacketProcessor;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.TileInventory;
import com.google.common.collect.Iterables;

View file

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.block.BlockLifeEssence;
import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemBanner;
@ -11,10 +12,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.event.AnvilUpdateEvent;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.annot.Handler;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.event.AltarCraftedEvent;
import WayofTime.bloodmagic.api.iface.IUpgradeTrainer;
@ -22,7 +25,7 @@ import WayofTime.bloodmagic.api.livingArmour.LivingArmourUpgrade;
import WayofTime.bloodmagic.api.util.helper.ItemHelper;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.item.ItemInscriptionTool;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
@Handler
public class CraftingHandler
@ -45,7 +48,7 @@ public class CraftingHandler
if (event.getOutput().getItem() == ForgeModContainer.getInstance().universalBucket && event.getAltarRecipe().getSyphon() == 1000)
{
NBTTagCompound bucketTags = BloodMagicAPI.getLifeEssenceBucket().getTagCompound();
NBTTagCompound bucketTags = FluidUtil.getFilledBucket(new FluidStack(BlockLifeEssence.getLifeEssence(), Fluid.BUCKET_VOLUME)).getTagCompound();
event.getOutput().setTagCompound(bucketTags);
}
}

View file

@ -6,6 +6,9 @@ import java.util.Map;
import java.util.Random;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.orb.BloodOrb;
import WayofTime.bloodmagic.api_impl.BloodMagicAPI;
import WayofTime.bloodmagic.core.RegistrarBloodMagic;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper;
@ -49,7 +52,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.annot.Handler;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.event.ItemBindEvent;
import WayofTime.bloodmagic.api.event.SacrificeKnifeUsedEvent;
@ -79,13 +81,14 @@ import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrific
import WayofTime.bloodmagic.network.BloodMagicPacketHandler;
import WayofTime.bloodmagic.network.DemonAuraPacketProcessor;
import WayofTime.bloodmagic.potion.BMPotionUtils;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.registry.ModPotions;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.TextHelper;
import com.google.common.base.Strings;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
@Handler
public class GenericHandler
@ -99,7 +102,7 @@ public class GenericHandler
if (event.getEntityLiving() instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) event.getEntityLiving();
if (player.isPotionActive(ModPotions.bounce) && !player.isSneaking() && event.getDistance() > 2)
if (player.isPotionActive(RegistrarBloodMagic.BOUNCE) && !player.isSneaking() && event.getDistance() > 2)
{
event.setDamageMultiplier(0);
@ -144,10 +147,10 @@ public class GenericHandler
@SubscribeEvent
public void onPlayerClick(PlayerInteractEvent event)
{
if (event.isCancelable() && event.getEntityPlayer().isPotionActive(ModPotions.constrict))
if (event.isCancelable() && event.getEntityPlayer().isPotionActive(RegistrarBloodMagic.CONSTRICT))
{
EntityPlayer player = event.getEntityPlayer();
int level = player.getActivePotionEffect(ModPotions.constrict).getAmplifier();
int level = player.getActivePotionEffect(RegistrarBloodMagic.CONSTRICT).getAmplifier();
if (event.getHand() == EnumHand.OFF_HAND || level > 1)
{
event.setCanceled(true);
@ -253,7 +256,7 @@ public class GenericHandler
if (event.getEntityLiving() instanceof EntityAnimal)
{
EntityAnimal animal = (EntityAnimal) event.getEntityLiving();
if (animal.isPotionActive(ModPotions.sacrificialLamb))
if (animal.isPotionActive(RegistrarBloodMagic.SACRIFICIAL_LAMB))
{
if (!targetTaskMap.containsKey(animal))
{
@ -267,7 +270,7 @@ public class GenericHandler
if (animal.getAttackTarget() != null && animal.getDistanceSqToEntity(animal.getAttackTarget()) < 4)
{
animal.getEntityWorld().createExplosion(null, animal.posX, animal.posY + (double) (animal.height / 16.0F), animal.posZ, 2 + animal.getActivePotionEffect(ModPotions.sacrificialLamb).getAmplifier() * 1.5f, false);
animal.getEntityWorld().createExplosion(null, animal.posX, animal.posY + (double) (animal.height / 16.0F), animal.posZ, 2 + animal.getActivePotionEffect(RegistrarBloodMagic.SACRIFICIAL_LAMB).getAmplifier() * 1.5f, false);
targetTaskMap.remove(animal);
attackTaskMap.remove(animal);
}
@ -284,7 +287,7 @@ public class GenericHandler
if (entity instanceof EntityPlayer)
{
EntityPlayer player = (EntityPlayer) entity;
if (player.isSneaking() && player.isPotionActive(ModPotions.cling) && Utils.isPlayerBesideSolidBlockFace(player) && !player.onGround)
if (player.isSneaking() && player.isPotionActive(RegistrarBloodMagic.CLING) && Utils.isPlayerBesideSolidBlockFace(player) && !player.onGround)
{
if (player.getEntityWorld().isRemote)
{
@ -307,24 +310,24 @@ public class GenericHandler
}
}
if (entity.isPotionActive(ModPotions.fireFuse))
if (entity.isPotionActive(RegistrarBloodMagic.FIRE_FUSE))
{
Random random = entity.getEntityWorld().rand;
entity.getEntityWorld().spawnParticle(EnumParticleTypes.FLAME, entity.posX + random.nextDouble() * 0.3, entity.posY + random.nextDouble() * 0.3, entity.posZ + random.nextDouble() * 0.3, 0, 0.06d, 0);
int r = entity.getActivePotionEffect(ModPotions.fireFuse).getAmplifier();
int radius = 1 * r + 1;
int r = entity.getActivePotionEffect(RegistrarBloodMagic.FIRE_FUSE).getAmplifier();
int radius = r + 1;
if (entity.getActivePotionEffect(ModPotions.fireFuse).getDuration() <= 3)
if (entity.getActivePotionEffect(RegistrarBloodMagic.FIRE_FUSE).getDuration() <= 3)
{
entity.getEntityWorld().createExplosion(null, entity.posX, entity.posY, entity.posZ, radius, false);
}
}
if (entity.isPotionActive(ModPotions.plantLeech))
if (entity.isPotionActive(RegistrarBloodMagic.PLANT_LEECH))
{
int amplifier = entity.getActivePotionEffect(ModPotions.plantLeech).getAmplifier();
int timeRemaining = entity.getActivePotionEffect(ModPotions.plantLeech).getDuration();
int amplifier = entity.getActivePotionEffect(RegistrarBloodMagic.PLANT_LEECH).getAmplifier();
int timeRemaining = entity.getActivePotionEffect(RegistrarBloodMagic.PLANT_LEECH).getDuration();
if (timeRemaining % 10 == 0)
{
BMPotionUtils.damageMobAndGrowSurroundingPlants(entity, 2 + amplifier, 1, 0.5 * 3 / (amplifier + 3), 25 * (1 + amplifier));
@ -366,10 +369,7 @@ public class GenericHandler
@SubscribeEvent
public void onTelepose(TeleposeEvent event)
{
if (ConfigHandler.teleposerBlacklist.contains(event.initialStack) || ConfigHandler.teleposerBlacklist.contains(event.finalStack))
event.setCanceled(true);
if (BloodMagicAPI.teleposerBlacklist.contains(event.initialStack) || BloodMagicAPI.teleposerBlacklist.contains(event.finalStack))
if (BloodMagicAPI.INSTANCE.getBlacklist().getTeleposer().contains(event.initialState) || BloodMagicAPI.INSTANCE.getBlacklist().getTeleposer().contains(event.finalState))
event.setCanceled(true);
}
@ -377,7 +377,8 @@ public class GenericHandler
@SubscribeEvent
public void onTeleposeEntity(TeleposeEvent.Ent event)
{
if (ConfigHandler.teleposerBlacklistEntity.contains(event.entity.getClass().getSimpleName()))
EntityEntry entry = EntityRegistry.getEntry(event.entity.getClass());
if (BloodMagicAPI.INSTANCE.getBlacklist().getTeleposerEntities().contains(entry.getRegistryName()))
event.setCanceled(true);
}
@ -427,8 +428,12 @@ public class GenericHandler
IBloodOrb bloodOrb = (IBloodOrb) held.getItem();
SoulNetwork network = NetworkHelper.getSoulNetwork(player);
if (bloodOrb.getOrbLevel(held.getItemDamage()) > network.getOrbTier())
network.setOrbTier(bloodOrb.getOrbLevel(held.getItemDamage()));
BloodOrb orb = bloodOrb.getOrb(held);
if (orb == null)
return;
if (orb.getTier() > network.getOrbTier())
network.setOrbTier(orb.getTier());
}
}

View file

@ -34,7 +34,7 @@ import WayofTime.bloodmagic.demonAura.PosXY;
import WayofTime.bloodmagic.demonAura.WillChunk;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import WayofTime.bloodmagic.registry.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.registry.ModPotions;
@Handler