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!
This commit is contained in:
parent
d947f23696
commit
7e8aec8652
53 changed files with 3031 additions and 372 deletions
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 +
|
||||
'}';
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
package WayofTime.bloodmagic.api.teleport;
|
||||
|
||||
public interface ITeleport
|
||||
{
|
||||
public void teleport();
|
||||
|
||||
public int getTeleportCost();
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue