Huge commit for the Pull-Request.

Added a lot of things:
- Blood Tank
- Teleposition Sigil
- Transposition Sigil
- Cobblestone/Netherrack/Obisidian generation Ritual
- Tree Cutter Ritual
- Pump Ritual
- Altar Builder Ritual
- Block Placing Ritual
- Portal Ritual
- Teleportation System and API Components
- Cross pattern Area Descriptor
- Two reagents and their textures for the sigils’ crafting

Fixed:
- Teleposer not teleporting entities correctly

And probably other things I forgot!
1.12
Tombenpotter 2016-02-18 17:25:11 +01:00
parent d947f23696
commit 7e8aec8652
53 changed files with 3031 additions and 372 deletions

0
gradlew vendored Normal file → Executable file
View File

View File

@ -1,21 +1,17 @@
package WayofTime.bloodmagic;
import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.util.Utils;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.OreDictionary;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.util.Utils;
import java.io.File;
import java.util.*;
public class ConfigHandler
{
@ -26,6 +22,10 @@ public class ConfigHandler
public static String[] teleposerBlacklisting;
public static ArrayList<BlockStack> teleposerBlacklist = new ArrayList<BlockStack>();
// Transposition Sigil
public static String[] transpositionBlacklisting;
public static ArrayList<BlockStack> transpositionBlacklist = new ArrayList<BlockStack>();
// Item/Block Disabling
public static List<String> itemBlacklist;
public static List<String> blockBlacklist;
@ -59,6 +59,13 @@ public class ConfigHandler
public static boolean ritualUpgradeRemove;
public static boolean ritualArmourEvolve;
public static boolean cobblestoneRitual;
public static boolean placerRitual;
public static boolean fellingRitual;
public static boolean pumpRitual;
public static boolean altarBuilderRitual;
public static boolean portalRitual;
// Imperfect Rituals
public static boolean imperfectRitualNight;
public static boolean imperfectRitualRain;
@ -140,21 +147,26 @@ public class ConfigHandler
category = "Item/Block Blacklisting";
config.addCustomCategoryComment(category, "Allows disabling of specific Blocks/Items.\nNote that using this may result in crashes. Use is not supported.");
config.setCategoryRequiresMcRestart(category, true);
itemBlacklist = Arrays.asList(config.getStringList("itemBlacklist", category, new String[] {}, "Items to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
blockBlacklist = Arrays.asList(config.getStringList("blockBlacklist", category, new String[] {}, "Blocks to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
itemBlacklist = Arrays.asList(config.getStringList("itemBlacklist", category, new String[]{}, "Items to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
blockBlacklist = Arrays.asList(config.getStringList("blockBlacklist", category, new String[]{}, "Blocks to not be registered. This requires their mapping name. Usually the same as the class name. Can be found in F3+H mode."));
category = "Teleposer Blacklist";
config.addCustomCategoryComment(category, "Block blacklisting");
teleposerBlacklisting = config.getStringList("teleposerBlacklist", category, new String[] { "minecraft:bedrock" }, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is:\nmodid:blockname:meta");
buildTeleposerBlacklist();
teleposerBlacklisting = config.getStringList("teleposerBlacklist", category, new String[]{"minecraft:bedrock"}, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is:\nmodid:blockname:meta");
buildBlacklist(teleposerBlacklisting, teleposerBlacklist);
category = "Transposition Sigil Blacklist";
config.addCustomCategoryComment(category, "Block blacklisting");
transpositionBlacklisting = config.getStringList("transpositionBlacklist", category, new String[]{"minecraft:bedrock"}, "Stops specified blocks from being teleposed. Put entries on new lines. Valid syntax is:\nmodid:blockname:meta");
buildBlacklist(transpositionBlacklisting, transpositionBlacklist);
category = "Well of Suffering Blacklist";
config.addCustomCategoryComment(category, "Entity blacklisting from WoS");
wellOfSufferingBlacklist = Arrays.asList(config.getStringList("wellOfSufferingBlacklist", category, new String[] {}, "Use the class name of the Entity to blacklist it from usage.\nIE: EntityWolf, EntityWitch, etc"));
wellOfSufferingBlacklist = Arrays.asList(config.getStringList("wellOfSufferingBlacklist", category, new String[]{}, "Use the class name of the Entity to blacklist it from usage.\nIE: EntityWolf, EntityWitch, etc"));
category = "Blood Altar Sacrificial Values";
config.addCustomCategoryComment(category, "Entity Sacrificial Value Settings");
entitySacrificeValuesList = config.getStringList("entitySacrificeValues", category, new String[] { "EntityVillager;2000", "EntitySlime;150", "EntityEnderman;200", "EntityCow;250", "EntityChicken;250", "EntityHorse;250", "EntitySheep;250", "EntityWolf;250", "EntityOcelot;250", "EntityPig;250", "EntityRabbit;250" }, "Used to edit the amount of LP gained per sacrifice of the given entity.\nSetting an entity to 0 effectively blacklists it.\nIf a mod modifies an entity via the API, it will take precedence over this config.\nSyntax: EntityClassName;LPPerSacrifice");
entitySacrificeValuesList = config.getStringList("entitySacrificeValues", category, new String[]{"EntityVillager;2000", "EntitySlime;150", "EntityEnderman;200", "EntityCow;250", "EntityChicken;250", "EntityHorse;250", "EntitySheep;250", "EntityWolf;250", "EntityOcelot;250", "EntityPig;250", "EntityRabbit;250"}, "Used to edit the amount of LP gained per sacrifice of the given entity.\nSetting an entity to 0 effectively blacklists it.\nIf a mod modifies an entity via the API, it will take precedence over this config.\nSyntax: EntityClassName;LPPerSacrifice");
buildEntitySacrificeValues();
category = "Potions";
@ -239,6 +251,13 @@ public class ConfigHandler
ritualUpgradeRemove = config.get(category, "ritualRemove", true).getBoolean();
ritualArmourEvolve = config.get(category, "ritualArmourEvolve", true).getBoolean();
cobblestoneRitual = config.get(category, "ritualCobblestone", true).getBoolean();
placerRitual = config.get(category, "ritualPlacer", true).getBoolean();
fellingRitual = config.get(category, "ritualFelling", true).getBoolean();
pumpRitual = config.get(category, "ritualPump", true).getBoolean();
altarBuilderRitual = config.get(category, "ritualAltarBuilder", true).getBoolean();
portalRitual = config.get(category, "ritualPortal", true).getBoolean();
category = "Rituals.Imperfect";
imperfectRitualNight = config.get(category, "imperfectRitualNight", true).getBoolean();
imperfectRitualRain = config.get(category, "imperfectRitualRain", true).getBoolean();
@ -258,22 +277,17 @@ public class ConfigHandler
config.save();
}
private static void buildTeleposerBlacklist()
private static void buildBlacklist(String[] blacklisting, List<BlockStack> blockBlacklist)
{
blockBlacklist.clear();
// Make sure it's empty before setting the blacklist.
// Otherwise, reloading the config while in-game will duplicate the
// list.
teleposerBlacklist.clear();
for (String blockSet : teleposerBlacklisting)
for (String blockSet : blacklisting)
{
String[] blockData = blockSet.split(":");
Block block = GameRegistry.findBlock(blockData[0], blockData[1]);
int meta = 0;
// If the block follows full syntax: modid:blockname:meta
if (blockData.length == 3)
{
// Check if it's an int, if so, parse it. If not, set meta to 0
@ -286,7 +300,7 @@ public class ConfigHandler
meta = 0;
}
teleposerBlacklist.add(new BlockStack(block, meta));
blockBlacklist.add(new BlockStack(block, meta));
}
}

View File

@ -4,12 +4,13 @@ import lombok.EqualsAndHashCode;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.GameData;
@Getter
@EqualsAndHashCode(exclude = { "state" })
@EqualsAndHashCode(exclude = {"state"})
public class BlockStack
{
private final Block block;
@ -34,6 +35,11 @@ public class BlockStack
return new BlockStack(state.getBlock(), state.getBlock().getMetaFromState(state));
}
public ItemStack getItemStack()
{
return new ItemStack(block, 1, meta);
}
@Override
public String toString()
{

View File

@ -22,6 +22,7 @@ public class Constants
public static final String X_COORD = "xCoord";
public static final String Y_COORD = "yCoord";
public static final String Z_COORD = "zCoord";
public static final String PORTAL_LOCATION ="portalLocation";
public static final String ORB_TIER = "orbTier";
public static final String CURRENT_ESSENCE = "currentEssence";
public static final String CURRENT_RITUAL = "currentRitual";
@ -72,6 +73,7 @@ public class Constants
public static final String TICKS_REMAINING = "ticksRemaining";
public static final String CONTAINED_BLOCK_NAME = "containedBlockName";
public static final String CONTAINED_BLOCK_META = "containedBlockMeta";
public static final String CONTAINED_TILE_ENTITY = "containedTileEntity";
public static final String PREVIOUS_INPUT = "previousInput";
@ -198,7 +200,9 @@ public class Constants
SLATE("ItemSlate"),
TELEPOSITION_FOCUS("ItemTelepositionFocus"),
UPGRADE_TOME("ItemUpgradeTome"),
UPGRADE_TRAINER("ItemUpgradeTrainer");
UPGRADE_TRAINER("ItemUpgradeTrainer"),
SIGIL_TELEPOSITION("ItemSigilTeleposition"),
SIGIL_TRANSPOSITION("ItemSigilTransposition");
@Getter
private final String regName;
@ -236,7 +240,9 @@ public class Constants
TELEPOSER("BlockTeleposer"),
INCENSE_ALTAR("BlockIncenseAltar"),
PATH("BlockPath"),
DEMON_CRUCIBLE("BlockDemonCrucible");
DEMON_CRUCIBLE("BlockDemonCrucible"),
DIMENSIONAL_PORTAL("BlockDimensionalPortal"),
BLOOD_TANK("BlockBloodTank");
@Getter
private final String regName;

View File

@ -1,14 +1,14 @@
package WayofTime.bloodmagic.api.ritual;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.function.Consumer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
public abstract class AreaDescriptor implements Iterator<BlockPos>
{
public List<BlockPos> getContainedPositions(BlockPos pos)
@ -40,11 +40,9 @@ public abstract class AreaDescriptor implements Iterator<BlockPos>
* This constructor takes in the minimum and maximum BlockPos. The
* maximum offset is non-inclusive, meaning if you pass in (0,0,0) and
* (1,1,1), calling getContainedPositions() will only give (0,0,0).
*
* @param minimumOffset
* -
* @param maximumOffset
* -
*
* @param minimumOffset -
* @param maximumOffset -
*/
public Rectangle(BlockPos minimumOffset, BlockPos maximumOffset)
{
@ -96,11 +94,9 @@ public abstract class AreaDescriptor implements Iterator<BlockPos>
/**
* Sets the offsets of the AreaDescriptor in a safe way that will make
* minimumOffset the lowest corner
*
* @param offset1
* -
* @param offset2
* -
*
* @param offset1 -
* @param offset2 -
*/
public void setOffsets(BlockPos offset1, BlockPos offset2)
{
@ -280,4 +276,69 @@ public abstract class AreaDescriptor implements Iterator<BlockPos>
}
}
public static class Cross extends AreaDescriptor
{
private ArrayList<BlockPos> blockPosCache;
private BlockPos cachedPosition;
private BlockPos centerPos;
private int size;
private boolean cache = true;
public Cross(BlockPos center, int size)
{
this.centerPos = center;
this.size = size;
this.blockPosCache = new ArrayList<BlockPos>();
}
@Override
public List<BlockPos> getContainedPositions(BlockPos pos)
{
if (!cache || !pos.equals(cachedPosition) || blockPosCache.isEmpty())
{
resetCache();
blockPosCache.add(centerPos.add(pos));
for (int i = 1; i <= size; i++)
{
blockPosCache.add(centerPos.add(pos).add(i, 0, 0));
blockPosCache.add(centerPos.add(pos).add(0, 0, i));
blockPosCache.add(centerPos.add(pos).add(-i, 0, 0));
blockPosCache.add(centerPos.add(pos).add(0, 0, -i));
}
}
cachedPosition = pos;
return Collections.unmodifiableList(blockPosCache);
}
@Override
public void resetCache()
{
blockPosCache = new ArrayList<BlockPos>();
}
@Override
public boolean isWithinArea(BlockPos pos)
{
return blockPosCache.contains(pos);
}
@Override
public boolean hasNext()
{
return false;
}
@Override
public BlockPos next()
{
return null;
}
}
}

View File

@ -0,0 +1,68 @@
package WayofTime.bloodmagic.api.teleport;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.util.BlockPos;
import java.io.Serializable;
@ToString
@EqualsAndHashCode
public class ChunkPairSerializable implements Serializable
{
@Getter
private int chunkXPos;
@Getter
private int chunkZPos;
public ChunkPairSerializable(int chunkXPos, int chunkZPos)
{
this.chunkXPos = chunkXPos;
this.chunkZPos = chunkZPos;
}
public ChunkPairSerializable(BlockPos blockPos)
{
this(blockPos.getX() >> 4, blockPos.getZ() >> 4);
}
public BlockPos getChunkCenter(int y)
{
return new BlockPos((chunkXPos << 4) + 8, y, (chunkZPos << 4) + 8);
}
public BlockPos getChunkCenter(){
return getChunkCenter(64);
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ChunkPairSerializable that = (ChunkPairSerializable) o;
if (chunkXPos != that.chunkXPos) return false;
return chunkZPos == that.chunkZPos;
}
@Override
public int hashCode()
{
int result = chunkXPos;
result = 31 * result + chunkZPos;
return result;
}
@Override
public String toString()
{
return "ChunkPairSerializable{" +
"chunkXPos=" + chunkXPos +
", chunkZPos=" + chunkZPos +
'}';
}
}

View File

@ -0,0 +1,8 @@
package WayofTime.bloodmagic.api.teleport;
public interface ITeleport
{
public void teleport();
public int getTeleportCost();
}

View File

@ -0,0 +1,86 @@
package WayofTime.bloodmagic.api.teleport;
import WayofTime.bloodmagic.api.Constants;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import java.io.Serializable;
@ToString
public class PortalLocation implements Serializable
{
@Getter
private int x;
@Getter
private int y;
@Getter
private int z;
@Getter
private int dimension;
public PortalLocation(int x, int y, int z, int dimension)
{
this.x = x;
this.y = y;
this.z = z;
this.dimension = dimension;
}
public PortalLocation(BlockPos blockPos, int dimension)
{
this(blockPos.getX(), blockPos.getY(), blockPos.getZ(), dimension);
}
public static PortalLocation readFromNBT(NBTTagCompound tag)
{
if (tag.hasKey(Constants.NBT.PORTAL_LOCATION))
{
NBTTagCompound locationTag = tag.getCompoundTag(Constants.NBT.PORTAL_LOCATION);
return new PortalLocation(locationTag.getInteger(Constants.NBT.X_COORD), locationTag.getInteger(Constants.NBT.Y_COORD), locationTag.getInteger(Constants.NBT.Z_COORD), locationTag.getInteger(Constants.NBT.DIMENSION_ID));
}
return null;
}
public NBTTagCompound writeToNBT(NBTTagCompound tag)
{
NBTTagCompound locationTag = new NBTTagCompound();
locationTag.setInteger(Constants.NBT.X_COORD, x);
locationTag.setInteger(Constants.NBT.Y_COORD, y);
locationTag.setInteger(Constants.NBT.Z_COORD, z);
locationTag.setInteger(Constants.NBT.DIMENSION_ID, dimension);
tag.setTag(Constants.NBT.PORTAL_LOCATION, locationTag);
return tag;
}
public BlockPos getBlockPos()
{
return new BlockPos(x, y, z);
}
@Override
public boolean equals(Object o)
{
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
PortalLocation that = (PortalLocation) o;
if (x != that.x) return false;
if (y != that.y) return false;
return z == that.z;
}
@Override
public int hashCode()
{
int result = x;
result = 31 * result + y;
result = 31 * result + z;
return result;
}
}

View File

@ -0,0 +1,37 @@
package WayofTime.bloodmagic.api.teleport;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import net.minecraft.entity.Entity;
import net.minecraft.util.BlockPos;
@ToString
@EqualsAndHashCode
public abstract class Teleport implements ITeleport
{
@Getter
protected int x;
@Getter
protected int y;
@Getter
protected int z;
@Getter
protected Entity entity;
@Getter
protected String networkToDrain;
public Teleport(int x, int y, int z, Entity entity, String networkToDrain)
{
this.x = x;
this.y = y;
this.z = z;
this.entity = entity;
this.networkToDrain = networkToDrain;
}
public Teleport(BlockPos blockPos, Entity entity, String networkToDrain)
{
this(blockPos.getX(), blockPos.getY(), blockPos.getZ(), entity, networkToDrain);
}
}

View File

@ -0,0 +1,44 @@
package WayofTime.bloodmagic.api.teleport;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import java.util.ArrayList;
import java.util.List;
public class TeleportQueue
{
private static TeleportQueue INSTANCE = new TeleportQueue();
private static List<ITeleport> queue;
public static TeleportQueue getInstance()
{
return INSTANCE;
}
private TeleportQueue()
{
queue = new ArrayList<ITeleport>();
}
public void addITeleport(ITeleport iTeleport)
{
queue.add(iTeleport);
}
@SubscribeEvent
public void serverTick(TickEvent.ServerTickEvent event)
{
if (event.phase != TickEvent.Phase.END)
{
return;
}
for (ITeleport iTeleport : queue)
{
iTeleport.teleport();
}
queue.clear();
}
}

View File

@ -0,0 +1,38 @@
package WayofTime.bloodmagic.api.teleport;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.Teleporter;
import net.minecraft.world.WorldServer;
public class TeleporterBloodMagic extends Teleporter
{
public TeleporterBloodMagic(WorldServer worldServer)
{
super(worldServer);
}
@Override
public boolean makePortal(Entity entity)
{
return true;
}
@Override
public void removeStalePortalLocations(long worldTime)
{
;
}
@Override
public boolean placeInExistingPortal(Entity entityIn, float rotationYaw)
{
return true;
}
@Override
public void placeInPortal(Entity entity, float rotationYaw)
{
entity.setLocationAndAngles(MathHelper.floor_double(entity.posX), MathHelper.floor_double(entity.posY) + 2, MathHelper.floor_double(entity.posZ), entity.rotationYaw, entity.rotationPitch);
}
}

View File

@ -0,0 +1,130 @@
package WayofTime.bloodmagic.block;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.tile.TileBloodTank;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.List;
public class BlockBloodTank extends BlockContainer
{
public BlockBloodTank()
{
super(Material.iron);
setUnlocalizedName(Constants.Mod.MODID + ".bloodTank");
setRegistryName(Constants.BloodMagicBlock.BLOOD_TANK.getRegName());
setHardness(2.0F);
setResistance(5.0F);
setStepSound(soundTypeGlass);
setHarvestLevel("pickaxe", 1);
setCreativeTab(BloodMagic.tabBloodMagic);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileBloodTank();
}
@Override
public boolean onBlockActivated(World world, BlockPos blockPos, IBlockState blockState, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ)
{
TileBloodTank fluidHandler = (TileBloodTank) world.getTileEntity(blockPos);
if (Utils.fillHandlerWithContainer(world, fluidHandler, player))
{
world.markBlockForUpdate(blockPos);
return true;
}
if (Utils.fillContainerFromHandler(world, fluidHandler, player, fluidHandler.tank.getFluid()))
{
world.markBlockForUpdate(blockPos);
return true;
}
if (FluidContainerRegistry.isContainer(player.getCurrentEquippedItem()))
{
world.markBlockForUpdate(blockPos);
return true;
}
return super.onBlockActivated(world, blockPos, blockState, player, side, hitX, hitY, hitZ);
}
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
this.dropBlockAsItem(worldIn, pos, state, 0);
super.onBlockHarvested(worldIn, pos, state, player);
}
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos blockPos, IBlockState blockState, int fortune)
{
ArrayList<ItemStack> list = new ArrayList<ItemStack>();
if (world.getTileEntity(blockPos) instanceof TileBloodTank)
{
TileBloodTank bloodTank = (TileBloodTank) world.getTileEntity(blockPos);
ItemStack drop = new ItemStack(this);
NBTTagCompound tag = new NBTTagCompound();
bloodTank.writeToNBT(tag);
drop.setTagCompound(tag);
list.add(drop);
}
return list;
}
@Override
public void onBlockPlacedBy(World world, BlockPos blockPos, IBlockState blockState, EntityLivingBase placer, ItemStack stack)
{
if (world.getTileEntity(blockPos) != null && world.getTileEntity(blockPos) instanceof TileBloodTank)
{
NBTTagCompound tag = stack.getTagCompound();
if (tag != null)
{
world.getTileEntity(blockPos).readFromNBT(tag);
}
}
}
@Override
public int getLightValue(IBlockAccess world, BlockPos pos)
{
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileBloodTank)
{
TileBloodTank tank = (TileBloodTank) tile;
FluidStack fluid = tank.tank.getFluid();
if (fluid != null)
{
return fluid.getFluid().getLuminosity(fluid);
}
}
return 0;
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
{
return getDrops(world, pos, world.getBlockState(pos), 0).get(0);
}
}

View File

@ -0,0 +1,196 @@
package WayofTime.bloodmagic.block;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.teleport.PortalLocation;
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
import WayofTime.bloodmagic.block.base.BlockIntegerContainer;
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
import WayofTime.bloodmagic.ritual.portal.Teleports;
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.Entity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.ArrayList;
import java.util.Random;
public class BlockDimensionalPortal extends BlockIntegerContainer
{
public BlockDimensionalPortal()
{
super(Material.portal, 2);
setUnlocalizedName(Constants.Mod.MODID + ".dimensionalPortal");
setRegistryName(Constants.BloodMagicBlock.DIMENSIONAL_PORTAL.getRegName());
setCreativeTab(BloodMagic.tabBloodMagic);
setBlockUnbreakable();
setResistance(2000);
setLightOpacity(0);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileDimensionalPortal();
}
@Override
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
return null;
}
public boolean isOpaqueCube()
{
return false;
}
public boolean isFullCube()
{
return false;
}
@Override
public int getLightValue(IBlockAccess world, BlockPos pos)
{
return 12;
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState blockState, Entity entity)
{
if (!world.isRemote && world.getTileEntity(pos) instanceof TileDimensionalPortal && !(entity instanceof EntityFX))
{
TileDimensionalPortal tile = (TileDimensionalPortal) world.getTileEntity(pos);
if (LocationsHandler.getLocationsHandler() != null)
{
ArrayList<PortalLocation> linkedLocations = LocationsHandler.getLocationsHandler().getLinkedLocations(tile.portalID);
if (linkedLocations != null && !linkedLocations.isEmpty() && linkedLocations.size() > 1)
{
if (world.getTileEntity(tile.getMasterStonePos()) != null && world.getTileEntity(tile.getMasterStonePos()) instanceof IMasterRitualStone)
{
TileMasterRitualStone masterRitualStone = (TileMasterRitualStone) world.getTileEntity(tile.getMasterStonePos());
if (linkedLocations.get(0).equals(new PortalLocation(masterRitualStone.getBlockPos().up(), world.provider.getDimensionId())))
{
PortalLocation portal = linkedLocations.get(1);
if (portal.getDimension() == world.provider.getDimensionId())
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner()));
} else
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension()));
}
} else if (linkedLocations.get(1).equals(new PortalLocation(tile.masterStoneX, tile.masterStoneY + 1, tile.masterStoneZ, world.provider.getDimensionId())))
{
PortalLocation portal = linkedLocations.get(0);
if (portal.getDimension() == world.provider.getDimensionId())
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner()));
} else
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(portal.getX(), portal.getY(), portal.getZ(), entity, masterRitualStone.getOwner(), world, portal.getDimension()));
}
}
}
}
}
}
}
@Override
public int quantityDropped(Random par1Random)
{
return 0;
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos blockPos)
{
int meta = world.getBlockState(blockPos).getBlock().getMetaFromState(world.getBlockState(blockPos));
if (meta == 0)
{
setBlockBounds(0f, 0f, 0.375f, 1f, 1f, 0.625f);
} else if (meta == 1)
{
setBlockBounds(0.375f, 0f, 0f, 0.625f, 1f, 1f);
} else
{
setBlockBounds(0f, 0f, 0f, 1f, 1, 1f);
}
}
@Override
public void setBlockBoundsForItemRender()
{
setBlockBounds(0f, 0f, 0.375f, 1f, 1f, 0.625f);
}
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.TRANSLUCENT;
}
@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand)
{
this.spawnParticles(world, pos.getX(), pos.getY(), pos.getZ());
}
private void spawnParticles(World world, int x, int y, int z)
{
Random random = world.rand;
double d0 = 0.0625D;
for (int i = 0; i < 6; ++i)
{
double particleX = (double) ((float) x + random.nextFloat());
double particleY = (double) ((float) y + random.nextFloat());
double particleZ = (double) ((float) z + random.nextFloat());
if (i == 0 && !world.getBlockState(new BlockPos(x, y + 1, z)).getBlock().isOpaqueCube())
{
particleY = (double) (y + 1) + d0;
}
if (i == 1 && !world.getBlockState(new BlockPos(x, y - 1, z)).getBlock().isOpaqueCube())
{
particleY = (double) y - d0;
}
if (i == 2 && !world.getBlockState(new BlockPos(x, y, z + 1)).getBlock().isOpaqueCube())
{
particleZ = (double) (z + 1) + d0;
}
if (i == 3 && !world.getBlockState(new BlockPos(x, y, z - 1)).getBlock().isOpaqueCube())
{
particleZ = (double) z - d0;
}
if (i == 4 && !world.getBlockState(new BlockPos(x + 1, y, z)).getBlock().isOpaqueCube())
{
particleX = (double) (x + 1) + d0;
}
if (i == 5 && !world.getBlockState(new BlockPos(x - 1, y, z)).getBlock().isOpaqueCube())
{
particleX = (double) x - d0;
}
if (particleX < (double) x || particleX > (double) (x + 1) || particleY < 0.0D || particleY > (double) (y + 1) || particleZ < (double) z || particleZ > (double) (z + 1))
{
world.spawnParticle(EnumParticleTypes.REDSTONE, particleX, particleY, particleZ, 0.0D, 0.0D, 0.0D);
}
}
}
}

View File

@ -89,7 +89,7 @@ public class BlockRitualController extends BlockStringContainer
TileEntity tile = world.getTileEntity(pos);
IBlockState state = world.getBlockState(pos);
if (state.getBlock() == this && getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
if (getMetaFromState(state) == 0 && tile instanceof TileMasterRitualStone)
((TileMasterRitualStone) tile).stopRitual(Ritual.BreakType.EXPLOSION);
}

View File

@ -5,6 +5,10 @@ import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic;
@ -12,6 +16,7 @@ import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;

View File

@ -1,17 +1,17 @@
package WayofTime.bloodmagic.item;
import java.util.ArrayList;
import java.util.List;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModItems;
import lombok.Getter;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.registry.ModItems;
import java.util.ArrayList;
import java.util.List;
public class ItemComponent extends Item
{
@ -35,6 +35,8 @@ public class ItemComponent extends Item
public static final String REAGENT_COMPRESSION = "reagentCompression";
public static final String REAGENT_BRIDGE = "reagentBridge";
public static final String REAGENT_SEVERANCE = "reagentSeverance";
public static final String REAGENT_TELEPOSITION = "reagentTeleposition";
public static final String REAGENT_TRANSPOSITION = "reagentTransposition";
public ItemComponent()
{
@ -67,6 +69,8 @@ public class ItemComponent extends Item
names.add(14, REAGENT_COMPRESSION);
names.add(15, REAGENT_BRIDGE);
names.add(16, REAGENT_SEVERANCE);
names.add(17, REAGENT_TELEPOSITION);
names.add(18, REAGENT_TRANSPOSITION);
}
@Override

View File

@ -1,16 +1,18 @@
package WayofTime.bloodmagic.item;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.relauncher.Side;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import com.google.common.base.Strings;
public class ItemLavaCrystal extends ItemBindable implements IFuelHandler
{
public ItemLavaCrystal()
@ -49,6 +51,8 @@ public class ItemLavaCrystal extends ItemBindable implements IFuelHandler
if (fuelItem instanceof ItemLavaCrystal)
{
System.out.println("Test get burn time: Side = " + FMLCommonHandler.instance().getSide());
//
// if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
// {
// return 200;

View File

@ -2,7 +2,6 @@ package WayofTime.bloodmagic.item;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.creativetab.CreativeTabs;

View File

@ -0,0 +1,123 @@
package WayofTime.bloodmagic.item.block;
import WayofTime.bloodmagic.tile.TileBloodTank;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import java.util.List;
public class ItemBlockBloodTank extends ItemBlock implements IFluidContainerItem
{
public ItemBlockBloodTank(Block block)
{
super(block);
}
@Override
public String getItemStackDisplayName(ItemStack stack)
{
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("tank") && !stack.getTagCompound().getCompoundTag("tank").getString("FluidName").equals(""))
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag("tank");
return super.getItemStackDisplayName(stack) + " (" + tag.getString("FluidName") + ")";
} else
{
return super.getItemStackDisplayName(stack);
}
}
@Override
public void addInformation(ItemStack stack, EntityPlayer entityPlayer, List<String> tooltip, boolean advanced)
{
tooltip.add(StatCollector.translateToLocal("tooltip.BloodMagic.fluid.capacity") + ": " + String.valueOf(getCapacity(stack)) + "mB");
if (stack.hasTagCompound())
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag("tank");
if (!tag.getString("FluidName").equals(""))
{
tooltip.add(" ");
tooltip.add(StatCollector.translateToLocal("tooltip.BloodMagic.fluid.type") + ": " + tag.getString("FluidName"));
tooltip.add(StatCollector.translateToLocal("tooltip.BloodMagic.fluid.amount") + ": " + tag.getInteger("Amount") + "/" + getCapacity(stack) + "mB");
}
}
}
@Override
public FluidStack getFluid(ItemStack stack)
{
if (stack.hasTagCompound() && stack.getTagCompound().hasKey("tank") && !stack.getTagCompound().getCompoundTag("tank").getString("FluidName").equals(""))
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag("tank");
return FluidStack.loadFluidStackFromNBT(tag);
}
return null;
}
@Override
public int getCapacity(ItemStack container)
{
return TileBloodTank.capacity;
}
@Override
public int fill(ItemStack stack, FluidStack resource, boolean doFill)
{
if (resource == null || stack.stackSize != 1) return 0;
int fillAmount = 0, capacity = getCapacity(stack);
NBTTagCompound tag = stack.getTagCompound(), fluidTag = null;
FluidStack fluid = null;
if (tag == null || !tag.hasKey("tank") || (fluidTag = tag.getCompoundTag("tank")) == null || (fluid = FluidStack.loadFluidStackFromNBT(fluidTag)) == null)
fillAmount = Math.min(capacity, resource.amount);
if (fluid == null)
{
if (doFill)
{
fluid = resource.copy();
fluid.amount = 0;
}
} else if (!fluid.isFluidEqual(resource))
return 0;
else
fillAmount = Math.min(capacity - fluid.amount, resource.amount);
fillAmount = Math.max(fillAmount, 0);
if (doFill)
{
if (tag == null)
stack.setTagCompound(new NBTTagCompound());
tag = stack.getTagCompound();
fluid.amount += fillAmount;
tag.setTag("tank", fluid.writeToNBT(fluidTag == null ? new NBTTagCompound() : fluidTag));
}
return fillAmount;
}
@Override
public FluidStack drain(ItemStack stack, int maxDrain, boolean doDrain)
{
NBTTagCompound tag = stack.getTagCompound(), fluidTag = null;
FluidStack fluid = null;
if (tag == null || !tag.hasKey("tank") || (fluidTag = tag.getCompoundTag("tank")) == null || (fluid = FluidStack.loadFluidStackFromNBT(fluidTag)) == null)
{
if (fluidTag != null)
tag.removeTag("tank");
return null;
}
int drainAmount = Math.min(maxDrain, fluid.amount);
if (doDrain)
{
tag.removeTag("tank");
fluid.amount -= drainAmount;
if (fluid.amount > 0)
fill(stack, fluid, true);
}
fluid.amount = drainAmount;
return fluid;
}
}

View File

@ -0,0 +1,85 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.ritual.portal.Teleports;
import WayofTime.bloodmagic.tile.TileTeleposer;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class ItemSigilTeleposition extends ItemSigilBase
{
public ItemSigilTeleposition()
{
super("teleposition");
setRegistryName(Constants.BloodMagicItem.SIGIL_TELEPOSITION.getRegName());
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
super.addInformation(stack, player, tooltip, advanced);
stack = NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
if (tag != null && stack.getTagCompound().hasKey(Constants.NBT.DIMENSION_ID) && stack.getTagCompound().hasKey(Constants.NBT.X_COORD) && stack.getTagCompound().hasKey(Constants.NBT.Y_COORD) && stack.getTagCompound().hasKey(Constants.NBT.Z_COORD))
{
tooltip.add(" ");
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.telepositionFocus.coords", getValue(tag, Constants.NBT.X_COORD), getValue(tag, Constants.NBT.Y_COORD), getValue(tag, Constants.NBT.Z_COORD)));
tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.telepositionFocus.dimension", getValue(tag, Constants.NBT.DIMENSION_ID)));
}
}
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (!world.isRemote && NBTHelper.checkNBT(stack) != null && stack.getTagCompound().hasKey(Constants.NBT.DIMENSION_ID) && stack.getTagCompound().hasKey(Constants.NBT.X_COORD) && stack.getTagCompound().hasKey(Constants.NBT.Y_COORD) && stack.getTagCompound().hasKey(Constants.NBT.Z_COORD))
{
BlockPos blockPos = new BlockPos(getValue(stack.getTagCompound(), Constants.NBT.X_COORD), getValue(stack.getTagCompound(), Constants.NBT.Y_COORD), getValue(stack.getTagCompound(), Constants.NBT.Z_COORD)).up();
if (world.provider.getDimensionId() == getValue(stack.getTagCompound(), Constants.NBT.DIMENSION_ID))
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(blockPos, player, getOwnerUUID(stack)));
} else
{
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(blockPos, player, getOwnerUUID(stack), world, getValue(stack.getTagCompound(), Constants.NBT.DIMENSION_ID)));
}
}
return stack;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer entityPlayer, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (!world.isRemote && entityPlayer.isSneaking() && NBTHelper.checkNBT(stack) != null)
{
if (world.getTileEntity(blockPos) != null && world.getTileEntity(blockPos) instanceof TileTeleposer)
{
stack.getTagCompound().setInteger(Constants.NBT.DIMENSION_ID, world.provider.getDimensionId());
stack.getTagCompound().setInteger(Constants.NBT.X_COORD, blockPos.getX());
stack.getTagCompound().setInteger(Constants.NBT.Y_COORD, blockPos.getY());
stack.getTagCompound().setInteger(Constants.NBT.Z_COORD, blockPos.getZ());
return true;
}
}
return false;
}
public int getValue(NBTTagCompound tag, String key)
{
return tag.getInteger(key);
}
}

View File

@ -0,0 +1,150 @@
package WayofTime.bloodmagic.item.sigil;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import java.util.List;
public class ItemSigilTransposition extends ItemSigilBase
{
public ItemSigilTransposition()
{
super("transposition", 1000);
setRegistryName(Constants.BloodMagicItem.SIGIL_TRANSPOSITION.getRegName());
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
super.addInformation(stack, player, tooltip, advanced);
stack = NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
if (tag.hasKey(Constants.NBT.CONTAINED_BLOCK_NAME) && tag.hasKey(Constants.NBT.CONTAINED_BLOCK_META))
{
tooltip.add(" ");
BlockStack blockStack = new BlockStack(Block.getBlockFromName(tag.getString(Constants.NBT.CONTAINED_BLOCK_NAME)), tag.getByte(Constants.NBT.CONTAINED_BLOCK_META));
tooltip.add(blockStack.getItemStack().getDisplayName());
}
}
@Override
public String getItemStackDisplayName(ItemStack stack)
{
stack = NBTHelper.checkNBT(stack);
NBTTagCompound tag = stack.getTagCompound();
if (tag.hasKey(Constants.NBT.CONTAINED_BLOCK_NAME) && tag.hasKey(Constants.NBT.CONTAINED_BLOCK_META))
{
BlockStack blockStack = new BlockStack(Block.getBlockFromName(tag.getString(Constants.NBT.CONTAINED_BLOCK_NAME)), tag.getByte(Constants.NBT.CONTAINED_BLOCK_META));
return super.getItemStackDisplayName(stack) + " (" + blockStack.getItemStack().getDisplayName() + ")";
}
return super.getItemStackDisplayName(stack);
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ)
{
stack = NBTHelper.checkNBT(stack);
if (!world.isRemote)
{
BlockStack rightClickedBlock = BlockStack.getStackFromPos(world, blockPos);
if (!ConfigHandler.transpositionBlacklist.contains(rightClickedBlock) && player.isSneaking() && (!stack.getTagCompound().hasKey(Constants.NBT.CONTAINED_BLOCK_NAME) || !stack.getTagCompound().hasKey(Constants.NBT.CONTAINED_BLOCK_META)))
{
if (rightClickedBlock.getBlock().getPlayerRelativeBlockHardness(player, world, blockPos) >= 0 && rightClickedBlock.getBlock().getBlockHardness(world, blockPos) >= 0)
{
int cost = getLPUsed();
NBTTagCompound tileNBTTag = new NBTTagCompound();
String blockName = rightClickedBlock.getBlock().getRegistryName();
byte metadata = (byte) stack.getMetadata();
if (world.getTileEntity(blockPos) != null)
{
cost *= 5;
world.getTileEntity(blockPos).writeToNBT(tileNBTTag);
if (world.getTileEntity(blockPos) instanceof TileEntityMobSpawner)
{
cost *= 6;
}
}
stack.getTagCompound().setString(Constants.NBT.CONTAINED_BLOCK_NAME, blockName);
stack.getTagCompound().setByte(Constants.NBT.CONTAINED_BLOCK_META, metadata);
stack.getTagCompound().setTag(Constants.NBT.CONTAINED_TILE_ENTITY, tileNBTTag);
syphonNetwork(stack, player, cost);
lightning(world, blockPos);
world.removeTileEntity(blockPos);
world.setBlockToAir(blockPos);
return true;
}
} else if (stack.getTagCompound().hasKey(Constants.NBT.CONTAINED_BLOCK_NAME) && stack.getTagCompound().hasKey(Constants.NBT.CONTAINED_BLOCK_META))
{
IBlockState iblockstate = world.getBlockState(blockPos);
Block block = iblockstate.getBlock();
BlockStack blockToPlace = new BlockStack(Block.getBlockFromName(stack.getTagCompound().getString(Constants.NBT.CONTAINED_BLOCK_NAME)), stack.getTagCompound().getByte(Constants.NBT.CONTAINED_BLOCK_META));
if (!block.isReplaceable(world, blockPos))
{
blockPos = blockPos.offset(side);
}
if (stack.stackSize != 0 && player.canPlayerEdit(blockPos, side, stack) && world.canBlockBePlaced(blockToPlace.getBlock(), blockPos, false, side, player, stack))
{
if (world.setBlockState(blockPos, blockToPlace.getState(), 3))
{
blockToPlace.getBlock().onBlockPlacedBy(world, blockPos, blockToPlace.getState(), player, blockToPlace.getItemStack());
world.playSoundEffect((double) ((float) blockPos.getX() + 0.5F), (double) ((float) blockPos.getY() + 0.5F), (double) ((float) blockPos.getZ() + 0.5F), blockToPlace.getBlock().stepSound.getPlaceSound(), (blockToPlace.getBlock().stepSound.getVolume() + 1.0F) / 2.0F, blockToPlace.getBlock().stepSound.getFrequency() * 0.8F);
if (stack.getTagCompound().hasKey(Constants.NBT.CONTAINED_TILE_ENTITY) && blockToPlace.getBlock().hasTileEntity(blockToPlace.getState()))
{
NBTTagCompound tag = stack.getTagCompound().getCompoundTag(Constants.NBT.CONTAINED_TILE_ENTITY);
tag.setInteger("x", blockPos.getX());
tag.setInteger("y", blockPos.getY());
tag.setInteger("z", blockPos.getZ());
world.getTileEntity(blockPos).readFromNBT(tag);
}
world.markBlockForUpdate(blockPos);
stack.getTagCompound().removeTag(Constants.NBT.CONTAINED_BLOCK_NAME);
stack.getTagCompound().removeTag(Constants.NBT.CONTAINED_BLOCK_META);
stack.getTagCompound().removeTag(Constants.NBT.CONTAINED_TILE_ENTITY);
lightning(world, blockPos);
return true;
}
}
}
}
return false;
}
public void lightning(World world, BlockPos blockPos)
{
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY(), blockPos.getZ()));
}
}

View File

@ -1,10 +1,11 @@
package WayofTime.bloodmagic.proxy;
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
import WayofTime.bloodmagic.util.handler.EventHandler;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelperV2;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import WayofTime.bloodmagic.util.handler.EventHandler;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
public class CommonProxy
{
@ -22,6 +23,7 @@ public class CommonProxy
public void preInit()
{
MinecraftForge.EVENT_BUS.register(new EventHandler());
MinecraftForge.EVENT_BUS.register(TeleportQueue.getInstance());
registerRenderers();
}

View File

@ -1,57 +1,18 @@
package WayofTime.bloodmagic.registry;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.block.BlockAlchemyArray;
import WayofTime.bloodmagic.block.BlockAltar;
import WayofTime.bloodmagic.block.BlockBloodLight;
import WayofTime.bloodmagic.block.BlockBloodRune;
import WayofTime.bloodmagic.block.BlockBloodStoneBrick;
import WayofTime.bloodmagic.block.BlockCrystal;
import WayofTime.bloodmagic.block.BlockDemonCrucible;
import WayofTime.bloodmagic.block.BlockIncenseAltar;
import WayofTime.bloodmagic.block.BlockInputRoutingNode;
import WayofTime.bloodmagic.block.BlockItemRoutingNode;
import WayofTime.bloodmagic.block.BlockLifeEssence;
import WayofTime.bloodmagic.block.BlockMasterRoutingNode;
import WayofTime.bloodmagic.block.BlockOutputRoutingNode;
import WayofTime.bloodmagic.block.BlockPath;
import WayofTime.bloodmagic.block.BlockPedestal;
import WayofTime.bloodmagic.block.BlockPhantom;
import WayofTime.bloodmagic.block.BlockRitualController;
import WayofTime.bloodmagic.block.BlockRitualStone;
import WayofTime.bloodmagic.block.BlockSoulForge;
import WayofTime.bloodmagic.block.BlockSpectral;
import WayofTime.bloodmagic.block.BlockTeleposer;
import WayofTime.bloodmagic.item.block.ItemBlockBloodRune;
import WayofTime.bloodmagic.item.block.ItemBlockBloodStoneBrick;
import WayofTime.bloodmagic.item.block.ItemBlockCrystal;
import WayofTime.bloodmagic.item.block.ItemBlockPath;
import WayofTime.bloodmagic.item.block.ItemBlockPedestal;
import WayofTime.bloodmagic.item.block.ItemBlockRitualController;
import WayofTime.bloodmagic.item.block.ItemBlockRitualStone;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.tile.TileDemonCrucible;
import WayofTime.bloodmagic.tile.TileImperfectRitualStone;
import WayofTime.bloodmagic.tile.TileIncenseAltar;
import WayofTime.bloodmagic.tile.TileMasterRitualStone;
import WayofTime.bloodmagic.tile.TilePhantomBlock;
import WayofTime.bloodmagic.tile.TilePlinth;
import WayofTime.bloodmagic.tile.TileSoulForge;
import WayofTime.bloodmagic.tile.TileSpectralBlock;
import WayofTime.bloodmagic.tile.TileTeleposer;
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileItemRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileMasterRoutingNode;
import WayofTime.bloodmagic.tile.routing.TileOutputRoutingNode;
import WayofTime.bloodmagic.block.*;
import WayofTime.bloodmagic.item.block.*;
import WayofTime.bloodmagic.tile.*;
import WayofTime.bloodmagic.tile.routing.*;
import WayofTime.bloodmagic.util.helper.InventoryRenderHelper;
import net.minecraft.block.Block;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModBlocks
{
@ -60,7 +21,7 @@ public class ModBlocks
public static Block ritualController;
public static Block ritualStone;
public static Block bloodLight;
// public static Block testSpellBlock;
// public static Block testSpellBlock;
public static Block pedestal;
public static Block teleposer;
public static Block alchemyArray;
@ -81,6 +42,9 @@ public class ModBlocks
public static Block outputRoutingNode;
public static Block itemRoutingNode;
public static Block dimensionalPortal;
public static Block bloodTank;
public static void init()
{
FluidRegistry.registerFluid(BlockLifeEssence.getLifeEssence());
@ -107,6 +71,9 @@ public class ModBlocks
pathBlock = registerBlock(new BlockPath(), ItemBlockPath.class);
demonCrucible = registerBlock(new BlockDemonCrucible());
dimensionalPortal = registerBlock(new BlockDimensionalPortal());
bloodTank = registerBlock(new BlockBloodTank(), ItemBlockBloodTank.class);
// testSpellBlock = registerBlock(new BlockTestSpellBlock());
BloodMagicAPI.addToTeleposerBlacklist(inputRoutingNode);
@ -133,6 +100,9 @@ public class ModBlocks
GameRegistry.registerTileEntity(TileItemRoutingNode.class, Constants.Mod.MODID + ":" + TileItemRoutingNode.class.getSimpleName());
GameRegistry.registerTileEntity(TileIncenseAltar.class, Constants.Mod.MODID + ":" + TileIncenseAltar.class.getSimpleName());
GameRegistry.registerTileEntity(TileDemonCrucible.class, Constants.Mod.MODID + ":" + TileDemonCrucible.class.getSimpleName());
GameRegistry.registerTileEntity(TileDimensionalPortal.class, Constants.Mod.MODID + ":" + TileDimensionalPortal.class.getSimpleName());
GameRegistry.registerTileEntity(TileBloodTank.class, Constants.Mod.MODID + ":" + TileBloodTank.class.getSimpleName());
}
public static void initRenders()
@ -181,6 +151,8 @@ public class ModBlocks
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pathBlock), 5);
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pathBlock), 6);
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(pathBlock), 7);
renderHelper.itemRender(InventoryRenderHelper.getItemFromBlock(dimensionalPortal));
}
private static Block registerBlock(Block block, Class<? extends ItemBlock> itemBlock, String name)

View File

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.registry;
import WayofTime.bloodmagic.item.sigil.*;
import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.util.EnumHelper;
@ -36,23 +37,6 @@ import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
import WayofTime.bloodmagic.item.gear.ItemPackSelfSacrifice;
import WayofTime.bloodmagic.item.routing.ItemNodeRouter;
import WayofTime.bloodmagic.item.routing.ItemRouterFilter;
import WayofTime.bloodmagic.item.sigil.ItemSigilAir;
import WayofTime.bloodmagic.item.sigil.ItemSigilBloodLight;
import WayofTime.bloodmagic.item.sigil.ItemSigilCompression;
import WayofTime.bloodmagic.item.sigil.ItemSigilDivination;
import WayofTime.bloodmagic.item.sigil.ItemSigilElementalAffinity;
import WayofTime.bloodmagic.item.sigil.ItemSigilEnderSeverance;
import WayofTime.bloodmagic.item.sigil.ItemSigilFastMiner;
import WayofTime.bloodmagic.item.sigil.ItemSigilGreenGrove;
import WayofTime.bloodmagic.item.sigil.ItemSigilHaste;
import WayofTime.bloodmagic.item.sigil.ItemSigilLava;
import WayofTime.bloodmagic.item.sigil.ItemSigilMagnetism;
import WayofTime.bloodmagic.item.sigil.ItemSigilPhantomBridge;
import WayofTime.bloodmagic.item.sigil.ItemSigilSeer;
import WayofTime.bloodmagic.item.sigil.ItemSigilSuppression;
import WayofTime.bloodmagic.item.sigil.ItemSigilVoid;
import WayofTime.bloodmagic.item.sigil.ItemSigilWater;
import WayofTime.bloodmagic.item.sigil.ItemSigilWhirlwind;
import WayofTime.bloodmagic.item.soul.ItemMonsterSoul;
import WayofTime.bloodmagic.item.soul.ItemSentientArmourGem;
import WayofTime.bloodmagic.item.soul.ItemSentientBow;
@ -109,6 +93,9 @@ public class ModItems
public static Item sigilPhantomBridge;
public static Item sigilCompression;
public static Item sigilTeleposition;
public static Item sigilTransposition;
public static Item itemComponent;
public static Item telepositionFocus;
@ -198,6 +185,9 @@ public class ModItems
sigilCompression = registerItem(new ItemSigilCompression());
sigilEnderSeverance = registerItem(new ItemSigilEnderSeverance());
sigilTeleposition = registerItem(new ItemSigilTeleposition());
sigilTransposition = registerItem(new ItemSigilTransposition());
itemComponent = registerItem(new ItemComponent());
telepositionFocus = registerItem(new ItemTelepositionFocus());
@ -362,6 +352,9 @@ public class ModItems
renderHelper.itemRender(sigilEnderSeverance, 0);
renderHelper.itemRender(sigilEnderSeverance, 1);
renderHelper.itemRender(sigilTeleposition);
renderHelper.itemRender(sigilTransposition);
renderHelper.customItemRender(sentientSword, 0);
renderHelper.customItemRender(sentientSword, 1);
renderHelper.itemRender(sentientBow, 0, "ItemSentientBow");

View File

@ -160,6 +160,10 @@ public class ModRecipes
AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_BRIDGE), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.sigilPhantomBridge), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png"));
AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_COMPRESSION), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.sigilCompression), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png"));
AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_SEVERANCE), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.sigilEnderSeverance), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png"));
AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_TELEPOSITION), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.sigilTeleposition), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png"));
AlchemyArrayRecipeRegistry.registerCraftingRecipe(ItemComponent.getStack(ItemComponent.REAGENT_TRANSPOSITION), new ItemStack(ModItems.slate, 1, 3), new ItemStack(ModItems.sigilTransposition), new ResourceLocation("bloodmagic", "textures/models/AlchemyArrays/WIPArray.png"));
}
public static void addCompressionHandlers()

View File

@ -1,6 +1,5 @@
package WayofTime.bloodmagic.registry;
import net.minecraft.init.Blocks;
import WayofTime.bloodmagic.ConfigHandler;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.registry.HarvestRegistry;
@ -8,26 +7,7 @@ import WayofTime.bloodmagic.api.registry.ImperfectRitualRegistry;
import WayofTime.bloodmagic.api.registry.RitualRegistry;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.imperfect.ImperfectRitual;
import WayofTime.bloodmagic.ritual.RitualAnimalGrowth;
import WayofTime.bloodmagic.ritual.RitualArmourEvolve;
import WayofTime.bloodmagic.ritual.RitualContainment;
import WayofTime.bloodmagic.ritual.RitualCrushing;
import WayofTime.bloodmagic.ritual.RitualExpulsion;
import WayofTime.bloodmagic.ritual.RitualFeatheredKnife;
import WayofTime.bloodmagic.ritual.RitualFullStomach;
import WayofTime.bloodmagic.ritual.RitualGreenGrove;
import WayofTime.bloodmagic.ritual.RitualHarvest;
import WayofTime.bloodmagic.ritual.RitualInterdiction;
import WayofTime.bloodmagic.ritual.RitualJumping;
import WayofTime.bloodmagic.ritual.RitualLava;
import WayofTime.bloodmagic.ritual.RitualMagnetic;
import WayofTime.bloodmagic.ritual.RitualRegeneration;
import WayofTime.bloodmagic.ritual.RitualSpeed;
import WayofTime.bloodmagic.ritual.RitualSuppression;
import WayofTime.bloodmagic.ritual.RitualUpgradeRemove;
import WayofTime.bloodmagic.ritual.RitualWater;
import WayofTime.bloodmagic.ritual.RitualWellOfSuffering;
import WayofTime.bloodmagic.ritual.RitualZephyr;
import WayofTime.bloodmagic.ritual.*;
import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerPlantable;
import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerStem;
import WayofTime.bloodmagic.ritual.harvest.HarvestHandlerTall;
@ -35,6 +15,7 @@ import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualNight;
import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualRain;
import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualResistance;
import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitualZombie;
import net.minecraft.init.Blocks;
public class ModRituals
{
@ -58,6 +39,13 @@ public class ModRituals
public static Ritual zephyrRitual;
public static Ritual upgradeRemoveRitual;
public static Ritual armourEvolveRitual;
public static Ritual cobblestoneRitual;
public static Ritual placerRitual;
public static Ritual fellingRitual;
public static Ritual pumpRitual;
public static Ritual altarBuilderRitual;
public static Ritual portalRitual;
public static ImperfectRitual imperfectNight;
public static ImperfectRitual imperfectRain;
@ -107,6 +95,19 @@ public class ModRituals
RitualRegistry.registerRitual(upgradeRemoveRitual, ConfigHandler.ritualUpgradeRemove);
armourEvolveRitual = new RitualArmourEvolve();
RitualRegistry.registerRitual(armourEvolveRitual, ConfigHandler.ritualArmourEvolve);
cobblestoneRitual = new RitualCobblestone();
RitualRegistry.registerRitual(cobblestoneRitual, ConfigHandler.cobblestoneRitual);
placerRitual = new RitualPlacer();
RitualRegistry.registerRitual(placerRitual, ConfigHandler.placerRitual);
fellingRitual = new RitualFelling();
RitualRegistry.registerRitual(fellingRitual, ConfigHandler.fellingRitual);
pumpRitual = new RitualPump();
RitualRegistry.registerRitual(pumpRitual, ConfigHandler.pumpRitual);
altarBuilderRitual = new RitualAltarBuilder();
RitualRegistry.registerRitual(altarBuilderRitual, ConfigHandler.altarBuilderRitual);
portalRitual = new RitualPortal();
RitualRegistry.registerRitual(portalRitual, ConfigHandler.portalRitual);
}
public static void initImperfectRituals()

View File

@ -0,0 +1,325 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.BlockStack;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.altar.AltarComponent;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.api.altar.EnumAltarTier;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.block.BlockBloodRune;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.Block;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.ArrayList;
import java.util.Iterator;
public class RitualAltarBuilder extends Ritual
{
private Iterator<AltarComponent> altarComponentsIterator = new ArrayList<AltarComponent>(EnumAltarTier.SIX.getAltarComponents()).iterator();
private boolean cycleDone = false;
private AltarComponent currentComponent;
private BlockPos currentPos;
public RitualAltarBuilder()
{
super("ritualAltarBuilder", 0, 450, "ritual." + Constants.Mod.MODID + ".altarBuilderRitual");
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
BlockPos altarPos = masterRitualStone.getBlockPos().up(2);
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
if (cycleDone)
{
altarComponentsIterator = new ArrayList<AltarComponent>(EnumAltarTier.SIX.getAltarComponents()).iterator();
}
if (world.getBlockState(altarPos).getBlock().isReplaceable(world, altarPos) && hasItem(tileEntity, Item.getItemFromBlock(ModBlocks.altar), 0, true))
{
world.setBlockState(altarPos, ModBlocks.altar.getDefaultState());
lightning(world, altarPos);
network.syphon(getRefreshCost());
}
if (altarComponentsIterator.hasNext())
{
currentComponent = altarComponentsIterator.next();
currentPos = altarPos.add(currentComponent.getOffset());
if (world.getBlockState(currentPos).getBlock().isReplaceable(world, currentPos))
{
switch (currentComponent.getComponent())
{
case NOTAIR:
{
BlockStack blockStack = getMundaneBlock(tileEntity);
if (blockStack != null)
{
world.setBlockState(currentPos, blockStack.getState(), 3);
lightning(world, currentPos);
network.syphon(getRefreshCost());
}
break;
}
case BLOODRUNE:
{
BlockStack blockStack = getBloodRune(tileEntity);
if (blockStack != null)
{
world.setBlockState(currentPos, blockStack.getState(), 3);
lightning(world, currentPos);
network.syphon(getRefreshCost());
}
break;
}
default:
{
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(currentComponent.getComponent()), 0);
if (hasItem(tileEntity, Item.getItemFromBlock(blockStack.getBlock()), blockStack.getMeta(), true))
{
world.setBlockState(currentPos, blockStack.getState(), 3);
lightning(world, currentPos);
network.syphon(getRefreshCost());
}
break;
}
}
}
} else
{
cycleDone = true;
}
}
@Override
public int getRefreshCost()
{
return 75;
}
@Override
public int getRefreshTime()
{
return 12;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
for (int i = -12; i <= -8; i++)
{
addRune(components, i, -6, 13, EnumRuneType.AIR);
addRune(components, i, -6, -13, EnumRuneType.FIRE);
addRune(components, 13, -6, i, EnumRuneType.EARTH);
addRune(components, -13, -6, i, EnumRuneType.WATER);
addRune(components, i, 5, 13, EnumRuneType.AIR);
addRune(components, i, 5, -13, EnumRuneType.FIRE);
addRune(components, 13, 5, i, EnumRuneType.EARTH);
addRune(components, -13, 5, i, EnumRuneType.WATER);
}
for (int i = 8; i <= 12; i++)
{
addRune(components, i, -6, 13, EnumRuneType.AIR);
addRune(components, i, -6, -13, EnumRuneType.FIRE);
addRune(components, 13, -6, i, EnumRuneType.EARTH);
addRune(components, -13, -6, i, EnumRuneType.WATER);
addRune(components, i, 5, 13, EnumRuneType.AIR);
addRune(components, i, 5, -13, EnumRuneType.FIRE);
addRune(components, 13, 5, i, EnumRuneType.EARTH);
addRune(components, -13, 5, i, EnumRuneType.WATER);
}
for (int i = -6; i <= -4; i++)
{
addCornerRunes(components, 13, i, EnumRuneType.DUSK);
}
for (int i = 3; i <= 5; i++)
{
addCornerRunes(components, 13, i, EnumRuneType.DUSK);
}
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualAltarBuilder();
}
public void lightning(World world, BlockPos blockPos)
{
world.addWeatherEffect(new EntityLightningBolt(world, blockPos.getX(), blockPos.getY(), blockPos.getZ()));
}
/*
*
* These methods are utilities for this ritual.
* They support both the old forge inventory system, and the new one.
*
*/
public boolean hasItem(TileEntity tileEntity, Item item, int damage, boolean consumeItem)
{
if (tileEntity != null)
{
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
{
return false;
}
for (int i = 0; i < iItemHandler.getSlots(); i++)
{
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() == item && iItemHandler.getStackInSlot(i).getItemDamage() == damage && iItemHandler.extractItem(i, 1, !consumeItem) != null)
{
return true;
}
}
} else if (tileEntity instanceof IInventory)
{
IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() == item && inv.getStackInSlot(i).getItemDamage() == damage)
{
if (consumeItem)
{
inv.decrStackSize(i, 1);
}
return true;
}
}
}
}
return false;
}
public BlockStack getBloodRune(TileEntity tileEntity)
{
if (tileEntity != null)
{
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
{
return null;
}
for (int i = 0; i < iItemHandler.getSlots(); i++)
{
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune && iItemHandler.extractItem(i, 1, true) != null)
{
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), iItemHandler.getStackInSlot(i).getItemDamage());
iItemHandler.extractItem(i, 1, false);
return blockStack;
}
}
} else if (tileEntity instanceof IInventory)
{
IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() instanceof ItemBlock && Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune)
{
BlockStack blockStack = new BlockStack(Utils.getBlockForComponent(EnumAltarComponent.BLOODRUNE), inv.getStackInSlot(i).getItemDamage());
inv.decrStackSize(i, 1);
return blockStack;
}
}
}
}
return null;
}
public BlockStack getMundaneBlock(TileEntity tileEntity)
{
if (tileEntity != null)
{
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
{
return null;
}
for (int i = 0; i < iItemHandler.getSlots(); i++)
{
if (iItemHandler.getStackInSlot(i) != null && iItemHandler.getStackInSlot(i).stackSize > 0 && iItemHandler.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem()) instanceof BlockBloodRune) && iItemHandler.extractItem(i, 1, true) != null)
{
Block block = Block.getBlockFromItem(iItemHandler.getStackInSlot(i).getItem());
if (block != null && block != Blocks.glowstone && block != ModBlocks.bloodStoneBrick && block != ModBlocks.crystal)
{
BlockStack blockStack = new BlockStack(block, iItemHandler.getStackInSlot(i).getItemDamage());
iItemHandler.extractItem(i, 1, false);
return blockStack;
}
}
}
} else if (tileEntity instanceof IInventory)
{
IInventory inv = (IInventory) tileEntity;
for (int i = 0; i < inv.getSizeInventory(); i++)
{
if (inv.getStackInSlot(i) != null && inv.getStackInSlot(i).stackSize > 0 && inv.getStackInSlot(i).getItem() instanceof ItemBlock && !(Block.getBlockFromItem(inv.getStackInSlot(i).getItem()) instanceof BlockBloodRune))
{
Block block = Block.getBlockFromItem(inv.getStackInSlot(i).getItem());
if (block != null && block != Blocks.glowstone && block != ModBlocks.bloodStoneBrick && block != ModBlocks.crystal)
{
BlockStack blockStack = new BlockStack(block, inv.getStackInSlot(i).getItemDamage());
inv.decrStackSize(i, 1);
return blockStack;
}
}
}
}
}
return null;
}
}

View File

@ -0,0 +1,117 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.item.ItemComponent;
import WayofTime.bloodmagic.tile.TileAlchemyArray;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import java.util.ArrayList;
public class RitualCobblestone extends Ritual
{
public static final String COBBLESTONE_RANGE = "cobblestoneRange";
public RitualCobblestone()
{
super("ritualCobblestone", 0, 500, "ritual." + Constants.Mod.MODID + ".cobblestoneRitual");
addBlockRange(COBBLESTONE_RANGE, new AreaDescriptor.Cross(new BlockPos(0, 1, 0), 1));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
Block block = Blocks.cobblestone;
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
int maxEffects = currentEssence / getRefreshCost();
int totalEffects = 0;
AreaDescriptor cobblestoneRange = getBlockRange(COBBLESTONE_RANGE);
if (tileEntity != null && tileEntity instanceof TileAlchemyArray)
{
TileAlchemyArray alchemyArray = (TileAlchemyArray) tileEntity;
if (alchemyArray.getStackInSlot(0) != null && alchemyArray.getStackInSlot(0).getItem() instanceof ItemComponent)
{
switch (alchemyArray.getStackInSlot(0).getItemDamage())
{
case 0:
block = Blocks.obsidian;
alchemyArray.decrStackSize(0, 1);
world.setBlockToAir(alchemyArray.getPos());
break;
case 1:
block = Blocks.netherrack;
alchemyArray.decrStackSize(0, 1);
world.setBlockToAir(alchemyArray.getPos());
break;
/*
case 4:
block = Blocks.end_stone;
alchemyArray.decrStackSize(0, 1);
world.setBlockToAir(alchemyArray.getPos());
break;
*/
default:
break;
}
}
}
for (BlockPos blockPos : cobblestoneRange.getContainedPositions(masterRitualStone.getBlockPos()))
{
if (world.isAirBlock(blockPos))
{
world.setBlockState(blockPos, block.getDefaultState());
totalEffects++;
}
if (totalEffects >= maxEffects)
{
break;
}
}
network.syphon(getRefreshCost() * totalEffects);
}
@Override
public int getRefreshCost()
{
return 25;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
this.addCornerRunes(components, 1, 1, EnumRuneType.FIRE);
this.addParallelRunes(components, 1, 0, EnumRuneType.WATER);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualCobblestone();
}
}

View File

@ -1,9 +1,13 @@
package WayofTime.bloodmagic.ritual;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.BindableHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import com.google.common.base.Strings;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -16,18 +20,10 @@ import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.iface.IBindable;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class RitualExpulsion extends Ritual
{
@ -144,7 +140,8 @@ public class RitualExpulsion extends Ritual
if (block != null && block.getMaterial().blocksMovement())
{
flag1 = true;
} else
}
else
{
--entityLiving.posY;
--j;
@ -166,7 +163,8 @@ public class RitualExpulsion extends Ritual
{
moveEntityViaTeleport(entityLiving, lastX, lastY, lastZ);
return false;
} else
}
else
{
for (l = 0; l < 128; ++l)
{
@ -206,7 +204,8 @@ public class RitualExpulsion extends Ritual
}
}
}
} else if (entityLiving != null)
}
else if (entityLiving != null)
{
entityLiving.setPosition(x, y, z);
}

View File

@ -0,0 +1,125 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.Iterator;
public class RitualFelling extends Ritual
{
public static final String FELLING_RANGE = "fellingRange";
private ArrayList<BlockPos> treePartsCache;
private Iterator<BlockPos> blockPosIterator;
private boolean cached = false;
private BlockPos currentPos;
public RitualFelling()
{
super("ritualFelling", 0, 500, "ritual." + Constants.Mod.MODID + ".fellingRitual");
addBlockRange(FELLING_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-10, -3, -10), new BlockPos(11, 27, 11)));
treePartsCache = new ArrayList<BlockPos>();
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
if (!cached || treePartsCache.isEmpty())
{
for (BlockPos blockPos : getBlockRange(FELLING_RANGE).getContainedPositions(masterRitualStone.getBlockPos()))
{
if (!treePartsCache.contains(blockPos))
if (!world.isAirBlock(blockPos) && (world.getBlockState(blockPos).getBlock().isWood(world, blockPos) || world.getBlockState(blockPos).getBlock().isLeaves(world, blockPos)))
{
treePartsCache.add(blockPos);
}
}
cached = true;
blockPosIterator = treePartsCache.iterator();
}
if (blockPosIterator.hasNext() && world.getTileEntity(masterRitualStone.getBlockPos().up()) != null && world.getTileEntity(masterRitualStone.getBlockPos().up()) instanceof IInventory)
{
network.syphon(getRefreshCost());
currentPos = blockPosIterator.next();
placeInInventory(world.getBlockState(currentPos), world, currentPos, masterRitualStone.getBlockPos().up());
world.setBlockToAir(currentPos);
blockPosIterator.remove();
}
}
@Override
public int getRefreshCost()
{
return 30;
}
@Override
public int getRefreshTime()
{
return 1;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
addCornerRunes(components, 1, 0, EnumRuneType.EARTH);
addCornerRunes(components, 1, 1, EnumRuneType.EARTH);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualFelling();
}
private void placeInInventory(IBlockState blockState, World world, BlockPos blockPos, BlockPos tileEntityPos)
{
TileEntity tile = world.getTileEntity(tileEntityPos);
if (tile != null && blockState.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), 0) != null)
{
if (tile instanceof IInventory)
{
for (ItemStack stack : blockState.getBlock().getDrops(world, blockPos, world.getBlockState(blockPos), 0))
{
ItemStack copyStack = stack.copy();
Utils.insertStackIntoInventory(copyStack, (IInventory) tile, EnumFacing.DOWN);
if (copyStack.stackSize > 0)
{
world.spawnEntityInWorld(new EntityItem(world, blockPos.getX() + 0.4, blockPos.getY() + 2, blockPos.getZ() + 0.4, copyStack));
}
}
}
}
}
}

View File

@ -0,0 +1,141 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import net.minecraft.block.Block;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
import java.util.ArrayList;
public class RitualPlacer extends Ritual
{
public static final String PLACER_RANGE = "placerRange";
public RitualPlacer()
{
super("ritualPlacer", 0, 5000, "ritual." + Constants.Mod.MODID + ".placerRitual");
addBlockRange(PLACER_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-2, 0, -2), new BlockPos(3, 1, 3)));
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
int currentEssence = network.getCurrentEssence();
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
AreaDescriptor areaDescriptor = getBlockRange(PLACER_RANGE);
IInventory iInventory;
if (tileEntity != null)
{
// Using the new Forge inventory system
if (tileEntity.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN))
{
IItemHandler iItemHandler = tileEntity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN);
if (iItemHandler.getSlots() <= 0)
{
return;
}
for (BlockPos blockPos : areaDescriptor.getContainedPositions(masterRitualStone.getBlockPos()))
{
for (int inv = 0; inv < iItemHandler.getSlots(); inv++)
{
if (world.getBlockState(blockPos).getBlock().isReplaceable(world, blockPos) && iItemHandler.getStackInSlot(inv) != null && iItemHandler.getStackInSlot(inv).stackSize != 0)
{
if (iItemHandler.getStackInSlot(inv).getItem() instanceof ItemBlock && world.getBlockState(blockPos.down()) != null)
{
if (iItemHandler.extractItem(inv, 1, true) != null)
{
world.setBlockState(blockPos, Block.getBlockFromItem(iItemHandler.getStackInSlot(inv).getItem()).getStateFromMeta(iItemHandler.getStackInSlot(inv).getItemDamage()));
iItemHandler.extractItem(inv, 1, false);
tileEntity.markDirty();
network.syphon(getRefreshCost());
}
}
}
}
}
//Compatibility with the old system, as it still exists
} else if (tileEntity instanceof IInventory)
{
iInventory = (IInventory) tileEntity;
if (iInventory.getSizeInventory() <= 0)
{
return;
}
for (BlockPos blockPos : areaDescriptor.getContainedPositions(masterRitualStone.getBlockPos()))
{
for (int inv = 0; inv < iInventory.getSizeInventory(); inv++)
{
if (world.getBlockState(blockPos).getBlock().isReplaceable(world, blockPos) && iInventory.getStackInSlot(inv) != null && iInventory.getStackInSlot(inv).stackSize != 0)
{
if (iInventory.getStackInSlot(inv).getItem() instanceof ItemBlock && world.getBlockState(blockPos.down()) != null)
{
world.setBlockState(blockPos, Block.getBlockFromItem(iInventory.getStackInSlot(inv).getItem()).getStateFromMeta(iInventory.getStackInSlot(inv).getItemDamage()));
iInventory.decrStackSize(inv, 1);
iInventory.markDirty();
network.syphon(getRefreshCost());
}
}
}
}
}
}
}
@Override
public int getRefreshCost()
{
return 50;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
addRune(components, 3, 0, 3, EnumRuneType.EARTH);
addRune(components, 3, 0, -3, EnumRuneType.EARTH);
addRune(components, -3, 0, 3, EnumRuneType.EARTH);
addRune(components, -3, 0, -3, EnumRuneType.EARTH);
addRune(components, 3, 0, 2, EnumRuneType.WATER);
addRune(components, 3, 0, -2, EnumRuneType.WATER);
addRune(components, 2, 0, 3, EnumRuneType.WATER);
addRune(components, 2, 0, -3, EnumRuneType.WATER);
addRune(components, -2, 0, 3, EnumRuneType.WATER);
addRune(components, -2, 0, -3, EnumRuneType.WATER);
addRune(components, -3, 0, 2, EnumRuneType.WATER);
addRune(components, -3, 0, -2, EnumRuneType.WATER);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualPlacer();
}
}

View File

@ -0,0 +1,288 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
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.api.util.helper.PlayerHelper;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.ritual.portal.LocationsHandler;
import WayofTime.bloodmagic.tile.TileDimensionalPortal;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import java.util.ArrayList;
public class RitualPortal extends Ritual
{
private NBTTagCompound portalRitualTag;
public static final String PORTAL_NBT_TAG = "PortalRitualTag";
public static final String PORTAL_ID_TAG = "PortalRitualID";
public RitualPortal()
{
super("ritualPortal", 0, 500, "ritual." + Constants.Mod.MODID + ".portalRitual");
portalRitualTag = new NBTTagCompound();
}
@Override
public boolean activateRitual(IMasterRitualStone masterRitualStone, EntityPlayer player)
{
String owner = PlayerHelper.getUUIDFromPlayer(player).toString();
World world = masterRitualStone.getWorldObj();
int x = masterRitualStone.getBlockPos().getX();
int y = masterRitualStone.getBlockPos().getY();
int z = masterRitualStone.getBlockPos().getZ();
EnumFacing direction = masterRitualStone.getDirection();
String name = owner;
IBlockState blockState;
if (!world.isRemote)
{
portalRitualTag.removeTag(PORTAL_ID_TAG);
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH)
{
for (int i = x - 3; i <= x + 3; i++)
{
for (int k = z - 2; k <= z + 2; k++)
{
if (!world.isAirBlock(new BlockPos(i, y, k)) && !(getBlockState(world, i, y, k).getBlock() == ModBlocks.ritualStone))
{
blockState = getBlockState(world, i, y, k);
name = addStringToEnd(name, Block.blockRegistry.getNameForObject(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
}
}
}
for (int j = y + 1; j <= y + 5; j++)
{
if (!world.isAirBlock(new BlockPos(x - 3, j, z)) && !(getBlockState(world, x - 3, j, z).getBlock() == ModBlocks.ritualStone))
{
blockState = getBlockState(world, x - 3, j, z);
name = addStringToEnd(name, Block.blockRegistry.getNameForObject(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
}
}
for (int j = y + 1; j <= y + 5; j++)
{
if (!world.isAirBlock(new BlockPos(x + 3, j, z)) && !(getBlockState(world, x + 3, j, z) == ModBlocks.ritualStone))
{
blockState = getBlockState(world, x + 3, j, z);
name = addStringToEnd(name, Block.blockRegistry.getNameForObject(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
}
}
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST)
{
for (int k = z - 3; k <= z + 3; k++)
{
for (int i = x - 2; i <= x + 2; i++)
{
if (!world.isAirBlock(new BlockPos(i, y, k)) && !(getBlockState(world, i, y, k).getBlock() == ModBlocks.ritualStone))
{
blockState = getBlockState(world, i, y, k);
name = addStringToEnd(name, Block.blockRegistry.getNameForObject(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
}
}
}
for (int j = y + 1; j <= y + 5; j++)
{
if (!world.isAirBlock(new BlockPos(x, j, z - 3)) && !(getBlockState(world, x, j, z - 3).getBlock() == ModBlocks.ritualStone))
{
blockState = getBlockState(world, x, j, z - 3);
name = addStringToEnd(name, Block.blockRegistry.getNameForObject(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
}
}
for (int j = y + 1; j <= y + 5; j++)
{
if (!world.isAirBlock(new BlockPos(x, j, z + 3)) && !(getBlockState(world, x, j, z + 3).getBlock() == ModBlocks.ritualStone))
{
blockState = getBlockState(world, x, j, z + 3);
name = addStringToEnd(name, Block.blockRegistry.getNameForObject(blockState.getBlock()) + String.valueOf(blockState.getBlock().getMetaFromState(blockState)));
}
}
}
if (LocationsHandler.getLocationsHandler() != null)
{
if (LocationsHandler.getLocationsHandler().addLocation(name, new PortalLocation(x, y + 1, z, world.provider.getDimensionId())))
{
portalRitualTag.setString(PORTAL_ID_TAG, name);
return true;
}
}
}
return false;
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
int x = masterRitualStone.getBlockPos().getX();
int y = masterRitualStone.getBlockPos().getY();
int z = masterRitualStone.getBlockPos().getZ();
EnumFacing direction = masterRitualStone.getDirection();
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH)
{
for (int i = x - 1; i <= x + 1; i++)
{
for (int j = y + 1; j <= y + 3; j++)
{
BlockPos tempPos = new BlockPos(i, j, z);
if (world.isAirBlock(tempPos))
{
IBlockState blockState = ModBlocks.dimensionalPortal.getStateFromMeta(0);
world.setBlockState(tempPos, blockState, 3);
if (world.getTileEntity(tempPos) != null && world.getTileEntity(tempPos) instanceof TileDimensionalPortal)
{
TileDimensionalPortal tile = (TileDimensionalPortal) world.getTileEntity(tempPos);
tile.setMasterStonePos(masterRitualStone.getBlockPos());
tile.portalID = portalRitualTag.getString(PORTAL_ID_TAG);
}
}
}
}
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST)
{
for (int k = z - 1; k <= z + 1; k++)
{
for (int j = y + 1; j <= y + 3; j++)
{
BlockPos tempPos = new BlockPos(x, j, k);
if (world.isAirBlock(tempPos))
{
IBlockState blockState = ModBlocks.dimensionalPortal.getStateFromMeta(1);
world.setBlockState(tempPos, blockState, 3);
if (world.getTileEntity(tempPos) != null && world.getTileEntity(tempPos) instanceof TileDimensionalPortal)
{
TileDimensionalPortal tile = (TileDimensionalPortal) world.getTileEntity(tempPos);
tile.setMasterStonePos(masterRitualStone.getBlockPos());
tile.portalID = portalRitualTag.getString(PORTAL_ID_TAG);
}
}
}
}
}
}
@Override
public void stopRitual(IMasterRitualStone masterRitualStone, BreakType breakType)
{
World world = masterRitualStone.getWorldObj();
int x = masterRitualStone.getBlockPos().getX();
int y = masterRitualStone.getBlockPos().getY();
int z = masterRitualStone.getBlockPos().getZ();
EnumFacing direction = masterRitualStone.getDirection();
if (LocationsHandler.getLocationsHandler() != null)
{
LocationsHandler.getLocationsHandler().removeLocation(portalRitualTag.getString(PORTAL_ID_TAG), new PortalLocation(x, y + 1, z, world.provider.getDimensionId()));
}
if (direction == EnumFacing.NORTH || direction == EnumFacing.SOUTH)
{
for (int i = x - 2; i <= x + 2; i++)
{
for (int j = y + 1; j <= y + 3; j++)
{
if (getBlockState(world, i, j, z).getBlock() == ModBlocks.dimensionalPortal)
{
world.setBlockToAir(new BlockPos(i, j, z));
}
}
}
} else if (direction == EnumFacing.EAST || direction == EnumFacing.WEST)
{
for (int k = z - 2; k <= z + 2; k++)
{
for (int j = y + 1; j <= y + 3; j++)
{
if (getBlockState(world, x, j, k).getBlock() == ModBlocks.dimensionalPortal)
{
world.setBlockToAir(new BlockPos(x, j, k));
}
}
}
}
portalRitualTag.removeTag(PORTAL_ID_TAG);
}
@Override
public int getRefreshCost()
{
return 0;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
addRune(components, 1, 0, 0, EnumRuneType.AIR);
addRune(components, 2, 0, 0, EnumRuneType.WATER);
addRune(components, -1, 0, 0, EnumRuneType.FIRE);
addRune(components, -2, 0, 0 , EnumRuneType.EARTH);
addRune(components, 2, 1, 0, EnumRuneType.DUSK);
addRune(components, 2, 2, 0, EnumRuneType.AIR);
addRune(components, 2, 3, 0, EnumRuneType.WATER);
addRune(components, 2, 4, 0, EnumRuneType.FIRE);
addRune(components, 1, 4, 0, EnumRuneType.EARTH);
addRune(components, 0, 4, 0, EnumRuneType.DUSK);
addRune(components, -1, 4, 0, EnumRuneType.AIR);
addRune(components, -2, 4, 0, EnumRuneType.WATER);
addRune(components, -2, 3, 0, EnumRuneType.FIRE);
addRune(components, -2, 2, 0, EnumRuneType.EARTH);
addRune(components, -2, 1, 0, EnumRuneType.DUSK);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualPortal();
}
@Override
public void readFromNBT(NBTTagCompound tag)
{
super.readFromNBT(tag);
portalRitualTag = tag.getCompoundTag(PORTAL_NBT_TAG);
}
@Override
public void writeToNBT(NBTTagCompound tag)
{
super.writeToNBT(tag);
tag.setTag(PORTAL_NBT_TAG, portalRitualTag);
}
public IBlockState getBlockState(World world, int x, int y, int z)
{
return world.getBlockState(new BlockPos(x, y, z));
}
public String addStringToEnd(String input, String toAdd)
{
return input + toAdd;
}
}

View File

@ -0,0 +1,113 @@
package WayofTime.bloodmagic.ritual;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import net.minecraft.block.BlockLiquid;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
import java.util.ArrayList;
import java.util.Iterator;
public class RitualPump extends Ritual
{
public static final String PUMP_RANGE = "pumpRange";
private ArrayList<BlockPos> liquidsCache;
private Iterator<BlockPos> blockPosIterator;
private boolean cached = false;
private BlockPos currentPos;
public RitualPump()
{
super("ritualPump", 0, 500, "ritual." + Constants.Mod.MODID + ".pumpRitual");
addBlockRange(PUMP_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-16, -16, -16), new BlockPos(17, 17, 17)));
liquidsCache = new ArrayList<BlockPos>();
}
@Override
public void performRitual(IMasterRitualStone masterRitualStone)
{
World world = masterRitualStone.getWorldObj();
SoulNetwork network = NetworkHelper.getSoulNetwork(masterRitualStone.getOwner());
int currentEssence = network.getCurrentEssence();
TileEntity tileEntity = world.getTileEntity(masterRitualStone.getBlockPos().up());
if (currentEssence < getRefreshCost())
{
network.causeNauseaToPlayer();
return;
}
if (tileEntity != null && tileEntity instanceof IFluidHandler)
{
IFluidHandler fluidHandler = (IFluidHandler) tileEntity;
if (!cached || liquidsCache.isEmpty())
{
if (fluidHandler.drain(EnumFacing.DOWN, 1000, false) != null)
{
FluidStack fluidStack = fluidHandler.drain(EnumFacing.DOWN, 1000, false);
for (BlockPos blockPos : getBlockRange(PUMP_RANGE).getContainedPositions(masterRitualStone.getBlockPos()))
{
if (!liquidsCache.contains(blockPos))
{
if (!world.isAirBlock(blockPos) && world.getBlockState(blockPos).getBlock() == fluidStack.getFluid().getBlock() && world.getBlockState(blockPos).getValue(BlockLiquid.LEVEL) == 0)
{
liquidsCache.add(blockPos);
}
}
}
}
cached = true;
blockPosIterator = liquidsCache.iterator();
}
if (blockPosIterator.hasNext())
{
network.syphon(getRefreshCost());
currentPos = blockPosIterator.next();
fluidHandler.fill(EnumFacing.DOWN, fluidHandler.drain(EnumFacing.DOWN, 1000, false), true);
world.setBlockState(currentPos, Blocks.stone.getDefaultState());
blockPosIterator.remove();
}
}
}
@Override
public int getRefreshCost()
{
return 25;
}
@Override
public ArrayList<RitualComponent> getComponents()
{
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
addRune(components, 1, 0, 1, EnumRuneType.WATER);
addRune(components, 1, 0, -1, EnumRuneType.EARTH);
addRune(components, -1, 0, -1, EnumRuneType.AIR);
addRune(components, -1, 0, 1, EnumRuneType.FIRE);
addCornerRunes(components, 1, 1, EnumRuneType.DUSK);
return components;
}
@Override
public Ritual getNewCopy()
{
return new RitualPump();
}
}

View File

@ -1,19 +1,15 @@
package WayofTime.bloodmagic.ritual;
import java.util.ArrayList;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.*;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
import WayofTime.bloodmagic.api.ritual.Ritual;
import WayofTime.bloodmagic.api.ritual.RitualComponent;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import java.util.ArrayList;
public class RitualSpeed extends Ritual
{
@ -42,8 +38,7 @@ public class RitualSpeed extends Ritual
for (EntityLivingBase entity : world.getEntitiesWithinAABB(EntityLivingBase.class, speedRange.getAABB(masterRitualStone.getBlockPos())))
{
if (entity.isSneaking())
continue;
if (entity.isSneaking()) continue;
double motionY = 1.2;
double speed = 3;
@ -54,23 +49,21 @@ public class RitualSpeed extends Ritual
switch (direction)
{
case NORTH:
entity.setVelocity(0, motionY, -speed);
break;
case NORTH:
entity.setVelocity(0, motionY, -speed);
break;
case SOUTH:
entity.setVelocity(0, motionY, speed);
break;
case SOUTH:
entity.setVelocity(0, motionY, speed);
break;
case WEST:
entity.setVelocity(-speed, motionY, 0);
break;
case WEST:
entity.setVelocity(-speed, motionY, 0);
break;
case EAST:
entity.setVelocity(speed, motionY, 0);
break;
default:
break;
case EAST:
entity.setVelocity(speed, motionY, 0);
break;
}
}

View File

@ -0,0 +1,134 @@
package WayofTime.bloodmagic.ritual.portal;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.teleport.PortalLocation;
import net.minecraftforge.common.DimensionManager;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
public class LocationsHandler implements Serializable
{
public static final long serialVersionUID = 10102001;
private static final String fileName = String.valueOf(DimensionManager.getCurrentSaveRootDirectory()) + "/" + Constants.Mod.MODID + "/PortalLocations.dat";
private static HashMap<String, ArrayList<PortalLocation>> portals;
private static LocationsHandler locationsHandler;
private LocationsHandler()
{
portals = new HashMap<String, ArrayList<PortalLocation>>();
}
public static LocationsHandler getLocationsHandler()
{
if (locationsHandler == null || loadFile() == null)
{
locationsHandler = new LocationsHandler();
return locationsHandler;
} else
{
portals = loadFile();
return locationsHandler;
}
}
private static HashMap<String, ArrayList<PortalLocation>> loadFile()
{
HashMap<String, ArrayList<PortalLocation>> map;
File file = new File(fileName);
try
{
if (!file.exists())
{
if (file.getParentFile().mkdir())
{
if (file.createNewFile())
{
BloodMagicAPI.getLogger().info("Creating " + fileName + " in " + String.valueOf(DimensionManager.getCurrentSaveRootDirectory()));
}
} else if (file.createNewFile())
{
BloodMagicAPI.getLogger().info("Creating " + fileName + " in " + String.valueOf(DimensionManager.getCurrentSaveRootDirectory()));
}
}
FileInputStream fileIn = new FileInputStream(file);
ObjectInputStream in = new ObjectInputStream(fileIn);
map = (HashMap<String, ArrayList<PortalLocation>>) in.readObject();
in.close();
fileIn.close();
return map;
} catch (IOException e)
{
e.printStackTrace();
return null;
} catch (ClassNotFoundException e)
{
BloodMagicAPI.getLogger().error(String.valueOf(file) + " was not found in " + String.valueOf(DimensionManager.getCurrentSaveRootDirectory()));
return null;
}
}
private static void updateFile(String file, HashMap<String, ArrayList<PortalLocation>> object)
{
try
{
FileOutputStream fos = new FileOutputStream(file);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(object);
oos.close();
} catch (IOException e)
{
e.printStackTrace();
}
}
public boolean addLocation(String name, PortalLocation location)
{
ArrayList<PortalLocation> portalLocations = portals.get(name);
if (portalLocations == null)
{
portals.put(name, new ArrayList<PortalLocation>());
updateFile(fileName, portals);
}
if (!portals.get(name).isEmpty() && portals.get(name).size() >= 2)
{
BloodMagicAPI.getLogger().info("Location " + name + " already exists.");
updateFile(fileName, portals);
return false;
} else
{
portals.get(name).add(location);
BloodMagicAPI.getLogger().info("Adding " + name);
updateFile(fileName, portals);
return true;
}
}
public boolean removeLocation(String name, PortalLocation location)
{
if (portals.get(name) != null && !portals.get(name).isEmpty())
{
if (portals.get(name).contains(location))
{
portals.get(name).remove(location);
BloodMagicAPI.getLogger().info("Removing " + name);
updateFile(fileName, portals);
return true;
} else
{
BloodMagicAPI.getLogger().info("No location matching " + name);
updateFile(fileName, portals);
return false;
}
}
return false;
}
public ArrayList<PortalLocation> getLinkedLocations(String name)
{
return portals.get(name);
}
}

View File

@ -0,0 +1,178 @@
package WayofTime.bloodmagic.ritual.portal;
import WayofTime.bloodmagic.api.network.SoulNetwork;
import WayofTime.bloodmagic.api.teleport.Teleport;
import WayofTime.bloodmagic.api.teleport.TeleporterBloodMagic;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import lombok.Getter;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S06PacketUpdateHealth;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
public class Teleports
{
public static class TeleportSameDim extends Teleport
{
public TeleportSameDim(int x, int y, int z, Entity entity, String networkToDrain)
{
super(x, y, z, entity, networkToDrain);
}
public TeleportSameDim(BlockPos blockPos, Entity entity, String networkToDrain)
{
super(blockPos, entity, networkToDrain);
}
@Override
public void teleport()
{
if (entity != null)
{
if (entity.timeUntilPortal <= 0)
{
if (entity instanceof EntityPlayer)
{
EntityPlayerMP player = (EntityPlayerMP) entity;
player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5);
player.worldObj.updateEntityWithOptionalForce(player, false);
player.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
player.timeUntilPortal = 150;
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
if (network.getCurrentEssence() < getTeleportCost())
{
return;
}
network.syphon(getTeleportCost());
player.worldObj.playSoundEffect(x, y, z, "mob.endermen.portal", 1.0F, 1.0F);
} else
{
WorldServer world = (WorldServer) entity.worldObj;
entity.setPosition(x + 0.5, y + 0.5, z + 0.5);
entity.timeUntilPortal = 150;
world.resetUpdateEntityTick();
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
if (network.getCurrentEssence() < (getTeleportCost() / 10))
{
return;
}
network.syphon(getTeleportCost() / 10);
entity.worldObj.playSoundEffect(x, y, z, "mob.endermen.portal", 1.0F, 1.0F);
}
}
}
}
@Override
public int getTeleportCost()
{
return 1000;
}
}
public static class TeleportToDim extends Teleport
{
@Getter
private World oldWorld;
@Getter
private int newWorldID;
public TeleportToDim(int x, int y, int z, Entity entity, String networkToDrain, World oldWorld, int newWorld)
{
super(x, y, z, entity, networkToDrain);
this.oldWorld = oldWorld;
this.newWorldID = newWorld;
}
public TeleportToDim(BlockPos blockPos, Entity entity, String networkToDrain, World oldWorld, int newWorldID)
{
super(blockPos, entity, networkToDrain);
this.oldWorld = oldWorld;
this.newWorldID = newWorldID;
}
@Override
public void teleport()
{
if (entity != null)
{
if (entity.timeUntilPortal <= 0)
{
MinecraftServer server = MinecraftServer.getServer();
WorldServer oldWorldServer = server.worldServerForDimension(entity.dimension);
WorldServer newWorldServer = server.worldServerForDimension(newWorldID);
if (entity instanceof EntityPlayer)
{
EntityPlayerMP player = (EntityPlayerMP) entity;
if (!player.worldObj.isRemote)
{
server.getConfigurationManager().transferPlayerToDimension(player, newWorldID, new TeleporterBloodMagic(newWorldServer));
player.setPositionAndUpdate(x + 0.5, y + 0.5, z + 0.5);
player.worldObj.updateEntityWithOptionalForce(player, false);
player.playerNetServerHandler.sendPacket(new S06PacketUpdateHealth(player.getHealth(), player.getFoodStats().getFoodLevel(), player.getFoodStats().getSaturationLevel()));
}
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
if (network.getCurrentEssence() < getTeleportCost())
{
return;
}
network.syphon(getTeleportCost());
} else if (!entity.worldObj.isRemote)
{
NBTTagCompound tag = new NBTTagCompound();
entity.writeToNBTOptional(tag);
entity.setDead();
oldWorld.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
Entity teleportedEntity = EntityList.createEntityFromNBT(tag, newWorldServer);
if (teleportedEntity != null)
{
teleportedEntity.setLocationAndAngles(x + 0.5, y + 0.5, z + 0.5, entity.rotationYaw, entity.rotationPitch);
teleportedEntity.forceSpawn = true;
newWorldServer.spawnEntityInWorld(teleportedEntity);
teleportedEntity.setWorld(newWorldServer);
teleportedEntity.timeUntilPortal = 150;
}
oldWorldServer.resetUpdateEntityTick();
newWorldServer.resetUpdateEntityTick();
SoulNetwork network = NetworkHelper.getSoulNetwork(networkToDrain);
if (network.getCurrentEssence() < (getTeleportCost() / 10))
{
return;
}
network.syphon(getTeleportCost() / 10);
}
entity.timeUntilPortal = 150;
newWorldServer.playSoundEffect(x, y, z, "mob.endermen.portal", 1.0F, 1.0F);
}
}
}
@Override
public int getTeleportCost()
{
return 10000;
}
}
}

View File

@ -0,0 +1,70 @@
package WayofTime.bloodmagic.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraftforge.fluids.*;
public class TileBloodTank extends TileEntity implements IFluidHandler
{
public static int capacity;
public FluidTank tank;
public TileBloodTank()
{
capacity = 32 * FluidContainerRegistry.BUCKET_VOLUME;
tank = new FluidTank(capacity);
}
@Override
public int fill(EnumFacing from, FluidStack resource, boolean doFill)
{
return tank.fill(resource, doFill);
}
@Override
public FluidStack drain(EnumFacing from, FluidStack resource, boolean doDrain)
{
return tank.drain(resource.amount, doDrain);
}
@Override
public FluidStack drain(EnumFacing from, int maxDrain, boolean doDrain)
{
return tank.drain(maxDrain, doDrain);
}
@Override
public boolean canFill(EnumFacing from, Fluid fluid)
{
return true;
}
@Override
public boolean canDrain(EnumFacing from, Fluid fluid)
{
return true;
}
@Override
public FluidTankInfo[] getTankInfo(EnumFacing from)
{
return new FluidTankInfo[]{tank.getInfo()};
}
@Override
public void readFromNBT(NBTTagCompound tagCompound)
{
super.readFromNBT(tagCompound);
tank.readFromNBT(tagCompound.getCompoundTag("tank"));
capacity = tagCompound.getInteger("capacity");
}
@Override
public void writeToNBT(NBTTagCompound tagCompound)
{
super.writeToNBT(tagCompound);
if (tank.getFluidAmount() != 0) tagCompound.setTag("tank", tank.writeToNBT(new NBTTagCompound()));
tagCompound.setInteger("capacity", capacity);
}
}

View File

@ -0,0 +1,53 @@
package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.ritual.RitualPortal;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
public class TileDimensionalPortal extends TileEntity
{
public String portalID;
public int masterStoneX;
public int masterStoneY;
public int masterStoneZ;
public TileDimensionalPortal()
{
;
}
public void readFromNBT(NBTTagCompound tagCompound)
{
super.readFromNBT(tagCompound);
portalID = tagCompound.getString(RitualPortal.PORTAL_ID_TAG);
masterStoneX = tagCompound.getInteger("masterStoneX");
masterStoneY = tagCompound.getInteger("masterStoneY");
masterStoneZ = tagCompound.getInteger("masterStoneZ");
}
public void writeToNBT(NBTTagCompound tagCompound)
{
super.writeToNBT(tagCompound);
tagCompound.setString(RitualPortal.PORTAL_ID_TAG, portalID);
tagCompound.setInteger("masterStoneX", masterStoneX);
tagCompound.setInteger("masterStoneY", masterStoneY);
tagCompound.setInteger("masterStoneZ", masterStoneZ);
}
public BlockPos getMasterStonePos()
{
return new BlockPos(masterStoneX, masterStoneY, masterStoneZ);
}
public void setMasterStonePos(BlockPos blockPos)
{
this.masterStoneX = blockPos.getX();
this.masterStoneY = blockPos.getY();
this.masterStoneZ = blockPos.getZ();
}
}

View File

@ -1,42 +1,31 @@
package WayofTime.bloodmagic.tile;
import java.util.Iterator;
import java.util.List;
import WayofTime.bloodmagic.api.BlockStack;
import net.minecraft.block.Block;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.event.TeleposeEvent;
import WayofTime.bloodmagic.api.teleport.TeleportQueue;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.block.BlockTeleposer;
import WayofTime.bloodmagic.item.ItemBindable;
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
import WayofTime.bloodmagic.ritual.portal.Teleports;
import com.google.common.base.Strings;
import net.minecraft.block.BlockMobSpawner;
import net.minecraft.block.BlockPortal;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityList;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.play.server.S07PacketRespawn;
import net.minecraft.network.play.server.S1DPacketEntityEffect;
import net.minecraft.network.play.server.S1FPacketSetExperience;
import net.minecraft.potion.PotionEffect;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ITickable;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.FMLCommonHandler;
import WayofTime.bloodmagic.api.Constants;
import WayofTime.bloodmagic.api.event.TeleposeEvent;
import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.block.BlockTeleposer;
import WayofTime.bloodmagic.item.ItemBindable;
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
import com.google.common.base.Strings;
import java.util.List;
public class TileTeleposer extends TileInventory implements ITickable
{
@ -85,7 +74,8 @@ public class TileTeleposer extends TileInventory implements ITickable
if (!worldObj.isRemote && worldObj.getTileEntity(pos) != null && worldObj.getTileEntity(pos) instanceof TileTeleposer && canInitiateTeleport((TileTeleposer) worldObj.getTileEntity(pos)) && worldObj.getBlockState(pos).getBlock() instanceof BlockTeleposer)
{
TileTeleposer teleposer = (TileTeleposer) worldObj.getTileEntity(pos);
ItemTelepositionFocus focus = (ItemTelepositionFocus) teleposer.getStackInSlot(0).getItem();
ItemStack focusStack = NBTHelper.checkNBT(teleposer.getStackInSlot(0));
ItemTelepositionFocus focus = (ItemTelepositionFocus) focusStack.getItem();
BlockPos focusPos = focus.getBlockPos(teleposer.getStackInSlot(0));
World focusWorld = focus.getWorld(teleposer.getStackInSlot(0));
@ -93,31 +83,10 @@ public class TileTeleposer extends TileInventory implements ITickable
{
final int focusLevel = (teleposer.getStackInSlot(0).getItemDamage() + 1);
final int lpToBeDrained = (int) (0.5F * Math.sqrt((pos.getX() - focusPos.getX()) * (pos.getX() - focusPos.getX()) + (pos.getY() - focusPos.getY() + 1) * (pos.getY() - focusPos.getY() + 1) + (pos.getZ() - focusPos.getZ()) * (pos.getZ() - focusPos.getZ())));
int entityCount = 0;
//TODO MAKE THIS SYPHON LP BETTER
if (ItemBindable.syphonNetwork(teleposer.getStackInSlot(0), lpToBeDrained * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) + lpToBeDrained * entityCount))
if (ItemBindable.syphonNetwork(teleposer.getStackInSlot(0), lpToBeDrained * (focusLevel * 2 - 1) * (focusLevel * 2 - 1) * (focusLevel * 2 - 1)))
{
List<EntityLivingBase> entityList1 = null;
List<EntityLivingBase> entityList2 = null;
if (focusWorld.equals(worldObj))
{
{
AxisAlignedBB area51 = AxisAlignedBB.fromBounds(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, Math.min(focusWorld.getHeight(), pos.getY() + 2 * focusLevel), pos.getZ() + 1).expand(focusLevel - 1, 0, focusLevel - 1);
entityList1 = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, area51);
for (EntityLivingBase entity : entityList1)
entityCount++;
}
{
AxisAlignedBB area52 = AxisAlignedBB.fromBounds(focusPos.getX(), focusPos.getY() + 1, focusPos.getZ(), focusPos.getX() + 1, Math.min(focusWorld.getHeight(), focusPos.getY() + 2 * focusLevel), focusPos.getZ() + 1).expand(focusLevel - 1, 0, focusLevel - 1);
entityList2 = focusWorld.getEntitiesWithinAABB(EntityLivingBase.class, area52);
for (EntityLivingBase entity : entityList2)
entityCount++;
}
}
int blocksTransported = 0;
for (int i = -(focusLevel - 1); i <= (focusLevel - 1); i++)
@ -134,44 +103,47 @@ public class TileTeleposer extends TileInventory implements ITickable
}
}
NetworkHelper.syphonFromContainer(teleposer.getStackInSlot(0), lpToBeDrained * blocksTransported + lpToBeDrained * entityCount);
NetworkHelper.syphonFromContainer(focusStack, lpToBeDrained * blocksTransported);
List<Entity> originalWorldEntities;
List<Entity> focusWorldEntities;
AxisAlignedBB originalArea = AxisAlignedBB.fromBounds(pos.getX(), pos.getY() + 1, pos.getZ(), pos.getX() + 1, Math.min(focusWorld.getHeight(), pos.getY() + 2 * focusLevel), pos.getZ() + 1).expand(focusLevel - 1, 0, focusLevel - 1);
originalWorldEntities = worldObj.getEntitiesWithinAABB(Entity.class, originalArea);
AxisAlignedBB focusArea = AxisAlignedBB.fromBounds(focusPos.getX(), focusPos.getY() + 1, focusPos.getZ(), focusPos.getX() + 1, Math.min(focusWorld.getHeight(), focusPos.getY() + 2 * focusLevel), focusPos.getZ() + 1).expand(focusLevel - 1, 0, focusLevel - 1);
focusWorldEntities = focusWorld.getEntitiesWithinAABB(Entity.class, focusArea);
if (focusWorld.equals(worldObj))
{
if (entityList1 != null && !entityList1.isEmpty())
if (originalWorldEntities != null && !originalWorldEntities.isEmpty())
{
for (EntityLivingBase entity : entityList1)
for (Entity entity : originalWorldEntities)
{
entity.worldObj = focusWorld;
entity.setPositionAndUpdate(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ());
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID)));
}
}
if (entityList2 != null && !entityList2.isEmpty())
if (focusWorldEntities != null && !focusWorldEntities.isEmpty())
{
for (EntityLivingBase entity : entityList2)
for (Entity entity : focusWorldEntities)
{
entity.worldObj = focusWorld;
entity.setPositionAndUpdate(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ());
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportSameDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID)));
}
}
} else
{
if (entityList1 != null && !entityList1.isEmpty())
if (originalWorldEntities != null && !originalWorldEntities.isEmpty())
{
for (EntityLivingBase entity : entityList1)
for (Entity entity : originalWorldEntities)
{
entity.worldObj = focusWorld;
teleportEntityToDim(worldObj, focusWorld.provider.getDimensionId(), entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ(), entity);
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), worldObj, focusWorld.provider.getDimensionId()));
}
}
if (entityList2 != null && !entityList2.isEmpty())
if (focusWorldEntities != null && !focusWorldEntities.isEmpty())
{
for (EntityLivingBase entity : entityList2)
for (Entity entity : focusWorldEntities)
{
entity.worldObj = focusWorld;
teleportEntityToDim(focusWorld, worldObj.provider.getDimensionId(), entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ(), entity);
TeleportQueue.getInstance().addITeleport(new Teleports.TeleportToDim(new BlockPos(entity.posX - pos.getX() + focusPos.getX(), entity.posY - pos.getY() + focusPos.getY(), entity.posZ - pos.getZ() + focusPos.getZ()), entity, focusStack.getTagCompound().getString(Constants.NBT.OWNER_UUID), focusWorld, worldObj.provider.getDimensionId()));
}
}
}
@ -251,74 +223,4 @@ public class TileTeleposer extends TileInventory implements ITickable
return true;
}
public static Entity teleportEntityToDim(World prevWorld, int newWorldID, double d, double e, double f, Entity entity)
{
if (entity != null)
{
if (entity.timeUntilPortal <= 0)
{
WorldServer oldWorldServer = MinecraftServer.getServer().worldServerForDimension(entity.dimension);
WorldServer newWorldServer = MinecraftServer.getServer().worldServerForDimension(newWorldID);
if (entity instanceof EntityPlayer)
{
EntityPlayerMP player = (EntityPlayerMP) entity;
if (!player.worldObj.isRemote)
{
player.worldObj.theProfiler.startSection("portal");
player.worldObj.theProfiler.startSection("changeDimension");
ServerConfigurationManager config = player.mcServer.getConfigurationManager();
prevWorld.playSoundEffect(player.posX, player.posY, player.posZ, "mob.endermen.portal", 1.0F, 1.0F);
player.closeScreen();
player.dimension = newWorldServer.provider.getDimensionId();
player.playerNetServerHandler.sendPacket(new S07PacketRespawn(player.dimension, player.worldObj.getDifficulty(), newWorldServer.getWorldInfo().getTerrainType(), player.theItemInWorldManager.getGameType()));
oldWorldServer.removeEntity(player);
player.isDead = false;
player.setLocationAndAngles(d, e, f, player.rotationYaw, player.rotationPitch);
newWorldServer.spawnEntityInWorld(player);
player.setWorld(newWorldServer);
config.preparePlayer(player, oldWorldServer);
player.playerNetServerHandler.setPlayerLocation(d, e, f, entity.rotationYaw, entity.rotationPitch);
player.theItemInWorldManager.setWorld(newWorldServer);
config.updateTimeAndWeatherForPlayer(player, newWorldServer);
config.syncPlayerInventory(player);
player.worldObj.theProfiler.endSection();
oldWorldServer.resetUpdateEntityTick();
newWorldServer.resetUpdateEntityTick();
player.worldObj.theProfiler.endSection();
for (Iterator<PotionEffect> potion = player.getActivePotionEffects().iterator(); potion.hasNext();)
{
player.playerNetServerHandler.sendPacket(new S1DPacketEntityEffect(player.getEntityId(), potion.next()));
}
player.playerNetServerHandler.sendPacket(new S1FPacketSetExperience(player.experience, player.experienceTotal, player.experienceLevel));
FMLCommonHandler.instance().firePlayerChangedDimensionEvent(player, oldWorldServer.provider.getDimensionId(), player.dimension);
player.timeUntilPortal = 150;
}
player.worldObj.theProfiler.endSection();
newWorldServer.playSoundEffect(d, e, f, "mob.endermen.portal", 1.0F, 1.0F);
return player;
} else
{
NBTTagCompound tag = new NBTTagCompound();
entity.writeToNBTOptional(tag);
entity.setDead();
prevWorld.playSoundEffect(entity.posX, entity.posY, entity.posZ, "mob.endermen.portal", 1.0F, 1.0F);
Entity teleportedEntity = EntityList.createEntityFromNBT(tag, newWorldServer);
if (teleportedEntity != null)
{
teleportedEntity.setLocationAndAngles(d, e, f, entity.rotationYaw, entity.rotationPitch);
teleportedEntity.forceSpawn = true;
newWorldServer.spawnEntityInWorld(teleportedEntity);
teleportedEntity.setWorld(newWorldServer);
teleportedEntity.timeUntilPortal = 150;
}
oldWorldServer.resetUpdateEntityTick();
newWorldServer.resetUpdateEntityTick();
newWorldServer.playSoundEffect(d, e, f, "mob.endermen.portal", 1.0F, 1.0F);
return teleportedEntity;
}
}
}
return null;
}
}

View File

@ -1,7 +1,8 @@
package WayofTime.bloodmagic.util;
import java.util.ArrayList;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.tile.TileInventory;
import net.minecraft.block.Block;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
@ -10,18 +11,22 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.Item;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import WayofTime.bloodmagic.api.altar.EnumAltarComponent;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.tile.TileInventory;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidBlock;
import net.minecraftforge.fluids.IFluidHandler;
import java.util.ArrayList;
public class Utils
{
@ -56,15 +61,11 @@ public class Utils
}
/**
* @see #insertItemToTile(TileInventory, EntityPlayer, int)
*
* @param tile
* - The {@link TileInventory} to input the item to
* @param player
* - The player to take the item from.
*
* @param tile - The {@link TileInventory} to input the item to
* @param player - The player to take the item from.
* @return {@code true} if the ItemStack is inserted, {@code false}
* otherwise
* otherwise
* @see #insertItemToTile(TileInventory, EntityPlayer, int)
*/
public static boolean insertItemToTile(TileInventory tile, EntityPlayer player)
{
@ -74,18 +75,14 @@ public class Utils
/**
* Used for inserting an ItemStack with a stacksize of 1 to a tile's
* inventory at slot 0
*
* <p/>
* EG: Block Altar
*
* @param tile
* - The {@link TileInventory} to input the item to
* @param player
* - The player to take the item from.
* @param slot
* - The slot to attempt to insert to
*
*
* @param tile - The {@link TileInventory} to input the item to
* @param player - The player to take the item from.
* @param slot - The slot to attempt to insert to
* @return {@code true} if the ItemStack is inserted, {@code false}
* otherwise
* otherwise
*/
public static boolean insertItemToTile(TileInventory tile, EntityPlayer player, int slot)
{
@ -112,30 +109,28 @@ public class Utils
/**
* Gets a default block for each type of {@link EnumAltarComponent}
*
* @param component
* - The Component to provide a block for.
*
*
* @param component - The Component to provide a block for.
* @return The default Block for the EnumAltarComponent
*/
public static Block getBlockForComponent(EnumAltarComponent component)
{
switch (component)
{
case GLOWSTONE:
return Blocks.glowstone;
case BLOODSTONE:
return ModBlocks.bloodStoneBrick;
case BEACON:
return Blocks.beacon;
case BLOODRUNE:
return ModBlocks.bloodRune;
case CRYSTAL:
return ModBlocks.crystal;
case NOTAIR:
return Blocks.stonebrick;
default:
return Blocks.air;
case GLOWSTONE:
return Blocks.glowstone;
case BLOODSTONE:
return ModBlocks.bloodStoneBrick;
case BEACON:
return Blocks.beacon;
case BLOODRUNE:
return ModBlocks.bloodRune;
case CRYSTAL:
return ModBlocks.crystal;
case NOTAIR:
return Blocks.stonebrick;
default:
return Blocks.air;
}
}
@ -248,11 +243,9 @@ public class Utils
/**
* Used to determine if stack1 can be placed into stack2. If stack2 is null
* and stack1 isn't null, returns true. Ignores stack size
*
* @param stack1
* Stack that is placed into a slot
* @param stack2
* Slot content that stack1 is placed into
*
* @param stack1 Stack that is placed into a slot
* @param stack2 Slot content that stack1 is placed into
* @return True if they can be combined
*/
public static boolean canCombine(ItemStack stack1, ItemStack stack2)
@ -276,10 +269,8 @@ public class Utils
}
/**
* @param stack1
* Stack that is placed into a slot
* @param stack2
* Slot content that stack1 is placed into
* @param stack1 Stack that is placed into a slot
* @param stack2 Slot content that stack1 is placed into
* @return Stacks after stacking
*/
public static ItemStack[] combineStacks(ItemStack stack1, ItemStack stack2, int transferMax)
@ -309,10 +300,8 @@ public class Utils
}
/**
* @param stack1
* Stack that is placed into a slot
* @param stack2
* Slot content that stack1 is placed into
* @param stack1 Stack that is placed into a slot
* @param stack2 Slot content that stack1 is placed into
* @return Stacks after stacking
*/
public static ItemStack[] combineStacks(ItemStack stack1, ItemStack stack2)
@ -546,4 +535,90 @@ public class Utils
{
return (block instanceof IFluidBlock || block.getMaterial().isLiquid());
}
//Shamelessly ripped off of CoFH Lib
public static boolean fillContainerFromHandler(World world, IFluidHandler handler, EntityPlayer player, FluidStack tankFluid)
{
ItemStack container = player.getCurrentEquippedItem();
if (FluidContainerRegistry.isEmptyContainer(container))
{
ItemStack returnStack = FluidContainerRegistry.fillFluidContainer(tankFluid, container);
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(returnStack);
if (fluid == null || returnStack == null)
{
return false;
}
if (!player.capabilities.isCreativeMode)
{
if (container.stackSize == 1)
{
container = container.copy();
player.inventory.setInventorySlotContents(player.inventory.currentItem, returnStack);
} else if (!player.inventory.addItemStackToInventory(returnStack))
{
return false;
}
handler.drain(EnumFacing.UP, fluid.amount, true);
container.stackSize--;
if (container.stackSize <= 0)
{
container = null;
}
} else
{
handler.drain(EnumFacing.UP, fluid.amount, true);
}
return true;
}
return false;
}
//Shamelessly ripped off of CoFH Lib
public static boolean fillHandlerWithContainer(World world, IFluidHandler handler, EntityPlayer player)
{
ItemStack container = player.getCurrentEquippedItem();
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(container);
if (fluid != null)
{
if (handler.fill(EnumFacing.UP, fluid, false) == fluid.amount || player.capabilities.isCreativeMode)
{
if (world.isRemote)
{
return true;
}
handler.fill(EnumFacing.UP, fluid, true);
if (!player.capabilities.isCreativeMode)
{
player.inventory.setInventorySlotContents(player.inventory.currentItem, consumeItem(container));
}
return true;
}
}
return false;
}
//Shamelessly ripped off of CoFH Lib
public static ItemStack consumeItem(ItemStack stack)
{
Item item = stack.getItem();
boolean largerStack = stack.stackSize > 1;
if (largerStack)
{
stack.stackSize -= 1;
}
if (item.hasContainerItem(stack))
{
ItemStack ret = item.getContainerItem(stack);
if (ret == null)
{
return null;
}
if (ret.isItemStackDamageable() && ret.getItemDamage() > ret.getMaxDamage())
{
ret = null;
}
return ret;
}
return largerStack ? stack : null;
}
}

View File

@ -147,7 +147,7 @@ public class EventHandler
if (!hasAssist)
{
player.stepHeight = 0.6f;
player.stepHeight = 0.5f;
}
}

View File

@ -0,0 +1,13 @@
{
"forge_marker": 1,
"defaults": {
"textures": {},
"uvlock": true
},
"variants": {
"meta": {
"0": {"model": "bloodmagic:BlockDimensionalPortalNS"},
"1": {"model": "bloodmagic:BlockDimensionalPortalEW"}
}
}
}

View File

@ -90,6 +90,16 @@
"textures": {
"layer0": "bloodmagic:items/ReagentSeverance"
}
},
"reagentteleposition": {
"textures": {
"layer0": "bloodmagic:items/ReagentTeleposition"
}
},
"reagenttransposition": {
"textures": {
"layer0": "bloodmagic:items/ReagentTransposition"
}
}
}
}

View File

@ -84,6 +84,9 @@ item.BloodMagic.baseComponent.reagentBridge.name=Phantom Bridge Reagent
item.BloodMagic.baseComponent.reagentCompression.name=Compression Reagent
item.BloodMagic.baseComponent.reagentSeverance.name=Severance Reagent
item.BloodMagic.baseComponent.reagentTeleposition.name=Teleposition Reagent
item.BloodMagic.baseComponent.reagentTransposition.name=Transposition Reagent
item.BloodMagic.monsterSoul.base.name=Demonic Will
item.BloodMagic.sigil.air.name=Air Sigil
@ -104,6 +107,9 @@ item.BloodMagic.sigil.phantomBridge.name=Sigil of the Phantom Bridge
item.BloodMagic.sigil.whirlwind.name=Sigil of the Whirlwind
item.BloodMagic.sigil.enderSeverance.name=Sigil of Ender Severance
item.BloodMagic.sigil.teleposition.name=Teleposition Sigil
item.BloodMagic.sigil.transposition.name=Transposition Sigil
item.BloodMagic.livingArmour.helmet.name=Living Helmet
item.BloodMagic.livingArmour.chest.name=Living Chestplate
item.BloodMagic.livingArmour.legs.name=Living Leggings
@ -196,6 +202,9 @@ tile.BloodMagic.path.wornstoneTile.name=Tiled Worn Stone Path
tile.BloodMagic.path.obsidian.name=Obsidian Brick Path
tile.BloodMagic.path.obsidianTile.name=Tiled Obsidian Path
tile.BloodMagic.dimensionalPortal.name=Dimensional Portal
tile.BloodMagic.bloodTank.name=Blood Tank
# Tooltips
tooltip.BloodMagic.orb.desc=Stores raw Life Essence
tooltip.BloodMagic.orb.owner=Added by: %s
@ -239,6 +248,9 @@ tooltip.BloodMagic.sigil.phantomBridge.desc=&oWalking on thin air...
tooltip.BloodMagic.sigil.whirlwind.desc=&oBest not to wear a skirt
tooltip.BloodMagic.sigil.enderSeverance.desc=&oPutting Endermen in Dire situations!
tooltip.BloodMagic.sigil.teleposition.desc=I am very close to being moved by this.
tooltip.BloodMagic.sigil.transposition.desc=Feel the power of the Force, my young apprentice.
tooltip.BloodMagic.bound.sword.desc=&oCulling the weak
tooltip.BloodMagic.bound.pickaxe.desc=&oDestroying stone without mercy
tooltip.BloodMagic.bound.axe.desc=&oDemonic deforestation
@ -308,6 +320,10 @@ tooltip.BloodMagic.itemFilter.ignoreNBT=Ignores the NBT of the filter
tooltip.BloodMagic.itemFilter.modItems=Matches all items from the same mod
tooltip.BloodMagic.itemFilter.oreDict=Used to filter through the Ore Dictionary
tooltip.BloodMagic.fluid.type=Fluid Contained
tooltip.BloodMagic.fluid.amount=Amount
tooltip.BloodMagic.fluid.capacity=Capacity
# Ritual
ritual.BloodMagic.testRitual=Test Ritual
ritual.BloodMagic.waterRitual=Ritual of the Full Spring
@ -330,6 +346,13 @@ ritual.BloodMagic.zephyrRitual=Call of the Zephyr
ritual.BloodMagic.upgradeRemoveRitual=Sound of the Cleansing Soul
ritual.BloodMagic.armourEvolveRitual=Ritual of Living Evolution
ritual.BloodMagic.cobblestoneRitual=Le Vulcanos Frigius
ritual.BloodMagic.placerRitual=The Filler
ritual.BloodMagic.fellingRitual=The Timberman
ritual.BloodMagic.pumpRitual=Hymn of Siphoning
ritual.BloodMagic.altarBuilderRitual=The Assembly of the High Altar
ritual.BloodMagic.portalRitual=The Gate of the Fold
# Chat
chat.BloodMagic.altarMaker.setTier=Set Tier to: %d
chat.BloodMagic.altarMaker.building=Building a Tier %d Altar

View File

@ -0,0 +1,15 @@
{
"textures": {
"particle": "bloodmagic:blocks/lifeEssenceFlowing",
"portal": "bloodmagic:blocks/lifeEssenceFlowing"
},
"elements": [
{ "from": [ 6, 0, 0 ],
"to": [ 10, 16, 16 ],
"faces": {
"east": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" },
"west": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }
}
}
]
}

View File

@ -0,0 +1,15 @@
{
"textures": {
"particle": "bloodmagic:blocks/lifeEssenceFlowing",
"portal": "bloodmagic:blocks/lifeEssenceFlowing"
},
"elements": [
{ "from": [ 0, 0, 6 ],
"to": [ 16, 16, 10 ],
"faces": {
"north": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" },
"south": { "uv": [ 0, 0, 16, 16 ], "texture": "#portal" }
}
}
]
}

View File

@ -0,0 +1,22 @@
{
"parent": "bloodmagic:block/BlockDimensionalPortal",
"display": {
"thirdperson": {
"rotation": [
10,
-45,
170
],
"translation": [
0,
1.5,
-2.75
],
"scale": [
0.375,
0.375,
0.375
]
}
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"bloodmagic:item/ItemModelBase",
"textures": {
"layer0":"bloodmagic:items/TelepositionSigil"
}
}

View File

@ -0,0 +1,6 @@
{
"parent":"bloodmagic:item/ItemModelBase",
"textures": {
"layer0":"bloodmagic:items/TranspositionSigil"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 544 B