Run migration mappings

Everything is still broken, but at least we reduced the amount of errors by hundreds, if not thousands.
This commit is contained in:
Nicholas Ignoffo 2019-09-22 12:55:43 -07:00
parent 1caae69992
commit 4035d91151
484 changed files with 4924 additions and 4962 deletions

View file

@ -8,10 +8,10 @@ import WayofTime.bloodmagic.core.registry.AlchemyArrayRecipeRegistry;
import WayofTime.bloodmagic.iface.IAlchemyArray;
import WayofTime.bloodmagic.util.Constants;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraftforge.fml.relauncher.Side;
@ -20,7 +20,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
public class TileAlchemyArray extends TileInventory implements ITickable, IAlchemyArray {
public boolean isActive = false;
public int activeCounter = 0;
public EnumFacing rotation = EnumFacing.HORIZONTALS[0];
public Direction rotation = Direction.HORIZONTALS[0];
public int rotateCooldown = 0;
private String key = "empty";
@ -31,14 +31,14 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
super(2, "alchemyArray");
}
public void onEntityCollidedWithBlock(IBlockState state, Entity entity) {
public void onEntityCollidedWithBlock(BlockState state, Entity entity) {
if (arrayEffect != null) {
arrayEffect.onEntityCollidedWithBlock(this, getWorld(), pos, state, entity);
}
}
@Override
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
super.deserialize(tagCompound);
this.isActive = tagCompound.getBoolean("isActive");
this.activeCounter = tagCompound.getInteger("activeCounter");
@ -49,9 +49,9 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
} else {
this.doDropIngredients = tagCompound.getBoolean("doDropIngredients");
}
this.rotation = EnumFacing.HORIZONTALS[tagCompound.getInteger(Constants.NBT.DIRECTION)];
this.rotation = Direction.HORIZONTALS[tagCompound.getInteger(Constants.NBT.DIRECTION)];
NBTTagCompound arrayTag = tagCompound.getCompoundTag("arrayTag");
CompoundNBT arrayTag = tagCompound.getCompoundTag("arrayTag");
arrayEffect = AlchemyArrayRecipeRegistry.getAlchemyArrayEffect(key);
if (arrayEffect != null) {
arrayEffect.readFromNBT(arrayTag);
@ -59,7 +59,7 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
super.serialize(tagCompound);
tagCompound.setBoolean("isActive", isActive);
tagCompound.setInteger("activeCounter", activeCounter);
@ -67,7 +67,7 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
tagCompound.setBoolean("doDropIngredients", doDropIngredients);
tagCompound.setInteger(Constants.NBT.DIRECTION, rotation.getHorizontalIndex());
NBTTagCompound arrayTag = new NBTTagCompound();
CompoundNBT arrayTag = new CompoundNBT();
if (arrayEffect != null) {
arrayEffect.writeToNBT(arrayTag);
}
@ -159,11 +159,11 @@ public class TileAlchemyArray extends TileInventory implements ITickable, IAlche
}
@Override
public EnumFacing getRotation() {
public Direction getRotation() {
return rotation;
}
public void setRotation(EnumFacing rotation) {
public void setRotation(Direction rotation) {
this.rotation = rotation;
}

View file

@ -12,12 +12,12 @@ import WayofTime.bloodmagic.orb.IBloodOrb;
import WayofTime.bloodmagic.recipe.alchemyTable.AlchemyTableRecipe;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
@ -34,7 +34,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
public static final int toolSlot = 7;
public static final int outputSlot = 8;
public EnumFacing direction = EnumFacing.NORTH;
public Direction direction = Direction.NORTH;
public boolean isSlave = false;
public int burnTime = 0;
public int ticksRequired = 1;
@ -46,7 +46,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
super(9, "alchemyTable");
}
public void setInitialTableParameters(EnumFacing direction, boolean isSlave, BlockPos connectedPos) {
public void setInitialTableParameters(Direction direction, boolean isSlave, BlockPos connectedPos) {
this.isSlave = isSlave;
this.connectedPos = connectedPos;
@ -69,11 +69,11 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
isSlave = tag.getBoolean("isSlave");
direction = EnumFacing.byIndex(tag.getInteger(Constants.NBT.DIRECTION));
direction = Direction.byIndex(tag.getInteger(Constants.NBT.DIRECTION));
connectedPos = new BlockPos(tag.getInteger(Constants.NBT.X_COORD), tag.getInteger(Constants.NBT.Y_COORD), tag.getInteger(Constants.NBT.Z_COORD));
burnTime = tag.getInteger("burnTime");
@ -85,7 +85,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
tag.setBoolean("isSlave", isSlave);
@ -107,7 +107,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
public <T> T getCapability(Capability<T> capability, Direction facing) {
if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
if (this.isSlave()) {
TileEntity tile = getWorld().getTileEntity(connectedPos);
@ -123,7 +123,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
}
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(Direction side) {
switch (side) {
case DOWN:
return new int[]{outputSlot};
@ -135,7 +135,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
}
@Override
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) {
public boolean canInsertItem(int index, ItemStack stack, Direction direction) {
switch (direction) {
case DOWN:
return index != outputSlot && index != orbSlot && index != toolSlot;
@ -159,7 +159,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
public boolean canExtractItem(int index, ItemStack stack, Direction direction) {
switch (direction) {
case DOWN:
return index == outputSlot;
@ -182,7 +182,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
}
}
public List<Integer> getAccessibleInputSlots(EnumFacing direction) {
public List<Integer> getAccessibleInputSlots(Direction direction) {
List<Integer> list = new ArrayList<>();
for (int i = 0; i < 6; i++) {
@ -236,7 +236,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
burnTime = 0;
IBlockState state = getWorld().getBlockState(pos);
BlockState state = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(getPos(), state, state, 3);
} else if (burnTime > ticksRequired + 10) {
burnTime = 0;
@ -394,7 +394,7 @@ public class TileAlchemyTable extends TileInventory implements ISidedInventory,
}
}
public EnumFacing getDirection() {
public Direction getDirection() {
return direction;
}

View file

@ -4,8 +4,8 @@ import WayofTime.bloodmagic.altar.BloodAltar;
import WayofTime.bloodmagic.altar.AltarTier;
import WayofTime.bloodmagic.altar.IBloodAltar;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.ITickable;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
@ -22,19 +22,19 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable {
}
@Override
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
super.deserialize(tagCompound);
NBTTagCompound altarTag = tagCompound.getCompoundTag("bloodAltar");
CompoundNBT altarTag = tagCompound.getCompoundTag("bloodAltar");
this.bloodAltar.readFromNBT(altarTag);
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
super.serialize(tagCompound);
NBTTagCompound altarTag = new NBTTagCompound();
CompoundNBT altarTag = new CompoundNBT();
this.bloodAltar.writeToNBT(altarTag);
tagCompound.setTag("bloodAltar", altarTag);
@ -170,7 +170,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable {
}
@Override
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable EnumFacing facing) {
public boolean hasCapability(@Nonnull Capability<?> capability, @Nullable Direction facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return true;
}
@ -180,7 +180,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, ITickable {
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable EnumFacing facing) {
public <T> T getCapability(@Nonnull Capability<T> capability, @Nullable Direction facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY) {
return (T) bloodAltar;
}

View file

@ -2,8 +2,8 @@ package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.tile.base.TileBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidTank;
@ -25,7 +25,7 @@ public class TileBloodTank extends TileBase {
}
@Override
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
super.deserialize(tagCompound);
tank.readFromNBT(tagCompound.getCompoundTag(Constants.NBT.TANK));
capacity = tagCompound.getInteger(Constants.NBT.ALTAR_CAPACITY);
@ -33,10 +33,10 @@ public class TileBloodTank extends TileBase {
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
super.serialize(tagCompound);
if (tank.getFluidAmount() != 0)
tagCompound.setTag(Constants.NBT.TANK, tank.writeToNBT(new NBTTagCompound()));
tagCompound.setTag(Constants.NBT.TANK, tank.writeToNBT(new CompoundNBT()));
tagCompound.setInteger(Constants.NBT.ALTAR_CAPACITY, capacity);
return tagCompound;
}
@ -66,13 +66,13 @@ public class TileBloodTank extends TileBase {
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
public boolean hasCapability(Capability<?> capability, Direction facing) {
return capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
public <T> T getCapability(Capability<T> capability, Direction facing) {
if (capability == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY)
return (T) tank;
return super.getCapability(capability, facing);

View file

@ -7,8 +7,8 @@ import WayofTime.bloodmagic.soul.IDiscreteDemonWill;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.ITickable;
import java.util.HashMap;
@ -89,7 +89,7 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
willMap.clear();
@ -103,7 +103,7 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
for (Entry<EnumDemonWillType, Double> entry : willMap.entrySet()) {
@ -198,17 +198,17 @@ public class TileDemonCrucible extends TileInventory implements ITickable, IDemo
}
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(Direction side) {
return new int[]{0};
}
@Override
public boolean canInsertItem(int index, ItemStack stack, EnumFacing direction) {
public boolean canInsertItem(int index, ItemStack stack, Direction direction) {
return !stack.isEmpty() && inventory.get(0).isEmpty() && (stack.getItem() instanceof IDemonWillGem || stack.getItem() instanceof IDiscreteDemonWill);
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
public boolean canExtractItem(int index, ItemStack stack, Direction direction) {
return true;
}
}

View file

@ -5,11 +5,11 @@ import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.soul.DemonWillHolder;
import WayofTime.bloodmagic.soul.EnumDemonWillType;
import WayofTime.bloodmagic.tile.base.TileTicking;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.math.MathHelper;
public class TileDemonCrystal extends TileTicking {
@ -22,7 +22,7 @@ public class TileDemonCrystal extends TileTicking {
public double progressToNextCrystal = 0;
public int internalCounter = 0;
public int crystalCount = 1;
public EnumFacing placement = EnumFacing.UP; //Side that this crystal is placed on.
public Direction placement = Direction.UP; //Side that this crystal is placed on.
public TileDemonCrystal() {
this.crystalCount = 1;
@ -84,7 +84,7 @@ public class TileDemonCrystal extends TileTicking {
return 0;
}
IBlockState state = getWorld().getBlockState(pos);
BlockState state = getWorld().getBlockState(pos);
int meta = this.getBlockType().getMetaFromState(state);
EnumDemonWillType type = EnumDemonWillType.values()[meta];
@ -122,7 +122,7 @@ public class TileDemonCrystal extends TileTicking {
public boolean dropSingleCrystal() {
if (!getWorld().isRemote && crystalCount > 1) {
IBlockState state = getWorld().getBlockState(pos);
BlockState state = getWorld().getBlockState(pos);
EnumDemonWillType type = state.getValue(BlockDemonCrystal.TYPE);
ItemStack stack = BlockDemonCrystal.getItemStackDropped(type, 1);
if (!stack.isEmpty()) {
@ -145,15 +145,15 @@ public class TileDemonCrystal extends TileTicking {
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
holder.readFromNBT(tag, "Will");
crystalCount = tag.getInteger("crystalCount");
placement = EnumFacing.byIndex(tag.getInteger("placement"));
placement = Direction.byIndex(tag.getInteger("placement"));
progressToNextCrystal = tag.getDouble("progress");
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
holder.writeToNBT(tag, "Will");
tag.setInteger("crystalCount", crystalCount);
tag.setInteger("placement", placement.getIndex());
@ -169,11 +169,11 @@ public class TileDemonCrystal extends TileTicking {
this.crystalCount = crystalCount;
}
public EnumFacing getPlacement() {
public Direction getPlacement() {
return placement;
}
public void setPlacement(EnumFacing placement) {
public void setPlacement(Direction placement) {
this.placement = placement;
}

View file

@ -1,8 +1,8 @@
package WayofTime.bloodmagic.tile;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
@ -30,7 +30,7 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
return;
}
BlockPos offsetPos = pos.offset(EnumFacing.UP);
BlockPos offsetPos = pos.offset(Direction.UP);
if (getWorld().isAirBlock(offsetPos)) //Room for a crystal to grow
{
EnumDemonWillType highestType = WorldDemonWillHandler.getHighestDemonWillType(getWorld(), pos);
@ -53,7 +53,7 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
getWorld().setBlockState(position, RegistrarBloodMagicBlocks.DEMON_CRYSTAL.getStateFromMeta(type.ordinal()));
TileEntity tile = getWorld().getTileEntity(position);
if (tile instanceof TileDemonCrystal) {
((TileDemonCrystal) tile).setPlacement(EnumFacing.UP);
((TileDemonCrystal) tile).setPlacement(Direction.UP);
return true;
}
@ -65,13 +65,13 @@ public class TileDemonCrystallizer extends TileTicking implements IDemonWillCond
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
holder.readFromNBT(tag, "Will");
internalCounter = tag.getDouble("internalCounter");
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
holder.writeToNBT(tag, "Will");
tag.setDouble("internalCounter", internalCounter);
return tag;

View file

@ -5,8 +5,8 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType;
import WayofTime.bloodmagic.soul.IDemonWillConduit;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.tile.base.TileTicking;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
public class TileDemonPylon extends TileTicking implements IDemonWillConduit {
@ -27,7 +27,7 @@ public class TileDemonPylon extends TileTicking implements IDemonWillConduit {
for (EnumDemonWillType type : EnumDemonWillType.values()) {
double currentAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), pos, type);
for (EnumFacing side : EnumFacing.HORIZONTALS) {
for (Direction side : Direction.HORIZONTALS) {
BlockPos offsetPos = pos.offset(side, 16);
double sideAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), offsetPos, type);
if (sideAmount > currentAmount) {
@ -40,12 +40,12 @@ public class TileDemonPylon extends TileTicking implements IDemonWillConduit {
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
holder.readFromNBT(tag, "Will");
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
holder.writeToNBT(tag, "Will");
return tag;
}

View file

@ -3,7 +3,7 @@ package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.ritual.types.RitualPortal;
import WayofTime.bloodmagic.tile.base.TileBase;
import com.google.common.base.Strings;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
public class TileDimensionalPortal extends TileBase {
@ -12,7 +12,7 @@ public class TileDimensionalPortal extends TileBase {
public int masterStoneY;
public int masterStoneZ;
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
portalID = tagCompound.getString(RitualPortal.PORTAL_ID_TAG);
masterStoneX = tagCompound.getInteger("masterStoneX");
@ -20,7 +20,7 @@ public class TileDimensionalPortal extends TileBase {
masterStoneZ = tagCompound.getInteger("masterStoneZ");
}
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
tagCompound.setString(RitualPortal.PORTAL_ID_TAG, Strings.isNullOrEmpty(portalID) ? "" : portalID);
tagCompound.setInteger("masterStoneX", masterStoneX);

View file

@ -7,8 +7,8 @@ import WayofTime.bloodmagic.ritual.imperfect.ImperfectRitual;
import WayofTime.bloodmagic.tile.base.TileBase;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import WayofTime.bloodmagic.util.helper.PlayerHelper;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.effect.LightningBoltEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -17,13 +17,13 @@ import javax.annotation.Nullable;
public class TileImperfectRitualStone extends TileBase implements IImperfectRitualStone {
@Override
public boolean performRitual(World world, BlockPos pos, @Nullable ImperfectRitual imperfectRitual, EntityPlayer player) {
public boolean performRitual(World world, BlockPos pos, @Nullable ImperfectRitual imperfectRitual, PlayerEntity player) {
if (imperfectRitual != null && BloodMagic.RITUAL_MANAGER.enabled(BloodMagic.RITUAL_MANAGER.getId(imperfectRitual), true)) {
if (!PlayerHelper.isFakePlayer(player) && !world.isRemote) {
NetworkHelper.getSoulNetwork(player).syphonAndDamage(player, SoulTicket.block(getWorld(), getPos(), imperfectRitual.getActivationCost()));
if (imperfectRitual.onActivate(this, player)) {
if (imperfectRitual.isLightShow())
getWorld().addWeatherEffect(new EntityLightningBolt(getWorld(), getPos().getX(), getPos().getY() + 2, getPos().getZ(), true));
getWorld().addWeatherEffect(new LightningBoltEntity(getWorld(), getPos().getX(), getPos().getY() + 2, getPos().getZ(), true));
return true;
}
}

View file

@ -4,15 +4,15 @@ import WayofTime.bloodmagic.ritual.AreaDescriptor;
import WayofTime.bloodmagic.util.helper.PlayerSacrificeHelper;
import WayofTime.bloodmagic.incense.*;
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.EnumFacing;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraft.world.ServerWorld;
import java.util.HashMap;
import java.util.List;
@ -35,7 +35,7 @@ public class TileIncenseAltar extends TileInventory implements ITickable {
@Override
public void update() {
AxisAlignedBB aabb = incenseArea.getAABB(getPos());
List<EntityPlayer> playerList = getWorld().getEntitiesWithinAABB(EntityPlayer.class, aabb);
List<PlayerEntity> playerList = getWorld().getEntitiesWithinAABB(PlayerEntity.class, aabb);
if (playerList.isEmpty()) {
return;
}
@ -46,29 +46,29 @@ public class TileIncenseAltar extends TileInventory implements ITickable {
boolean hasPerformed = false;
for (EntityPlayer player : playerList) {
for (PlayerEntity player : playerList) {
if (PlayerSacrificeHelper.incrementIncense(player, 0, incenseAddition, incenseAddition / 100)) {
hasPerformed = true;
}
}
if (hasPerformed) {
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof WorldServer) {
WorldServer server = (WorldServer) getWorld();
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof ServerWorld) {
ServerWorld server = (ServerWorld) getWorld();
server.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 1, 0.02, 0.03, 0.02, 0);
}
}
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
tranquility = tag.getDouble("tranquility");
incenseAddition = tag.getDouble("incenseAddition");
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
tag.setDouble("tranquility", tranquility);
tag.setDouble("incenseAddition", incenseAddition);
@ -90,11 +90,11 @@ public class TileIncenseAltar extends TileInventory implements ITickable {
canFormRoad = true;
level:
for (EnumFacing horizontalFacing : EnumFacing.HORIZONTALS) {
for (Direction horizontalFacing : Direction.HORIZONTALS) {
BlockPos facingOffsetPos = verticalPos.offset(horizontalFacing, currentDistance);
for (int j = -1; j <= 1; j++) {
BlockPos offsetPos = facingOffsetPos.offset(horizontalFacing.rotateY(), j);
IBlockState state = getWorld().getBlockState(offsetPos);
BlockState state = getWorld().getBlockState(offsetPos);
Block block = state.getBlock();
if (!(block instanceof IIncensePath && ((IIncensePath) block).getLevelOfPath(getWorld(), offsetPos, state) >= currentDistance - 2)) {
canFormRoad = false;
@ -118,7 +118,7 @@ public class TileIncenseAltar extends TileInventory implements ITickable {
for (int y = yOffset; y <= 2 + yOffset; y++) {
BlockPos offsetPos = pos.add(i, y, j);
IBlockState state = getWorld().getBlockState(offsetPos);
BlockState state = getWorld().getBlockState(offsetPos);
Block block = state.getBlock();
TranquilityStack stack = IncenseTranquilityRegistry.getTranquilityOfBlock(getWorld(), offsetPos, block, state);
if (stack != null) {

View file

@ -2,17 +2,17 @@ package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.tile.base.TileBase;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@ -50,14 +50,14 @@ public class TileInventory extends TileBase implements IInventory {
}
@Override
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
super.deserialize(tagCompound);
NBTTagList tags = tagCompound.getTagList("Items", 10);
ListNBT tags = tagCompound.getTagList("Items", 10);
inventory = NonNullList.withSize(size, ItemStack.EMPTY);
for (int i = 0; i < tags.tagCount(); i++) {
if (!isSyncedSlot(i)) {
NBTTagCompound data = tags.getCompoundTagAt(i);
CompoundNBT data = tags.getCompoundTagAt(i);
byte j = data.getByte("Slot");
if (j >= 0 && j < inventory.size()) {
@ -68,13 +68,13 @@ public class TileInventory extends TileBase implements IInventory {
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
super.serialize(tagCompound);
NBTTagList tags = new NBTTagList();
ListNBT tags = new ListNBT();
for (int i = 0; i < inventory.size(); i++) {
if ((!inventory.get(i).isEmpty()) && !isSyncedSlot(i)) {
NBTTagCompound data = new NBTTagCompound();
CompoundNBT data = new CompoundNBT();
data.setByte("Slot", (byte) i);
inventory.get(i).writeToNBT(data);
tags.appendTag(data);
@ -146,12 +146,12 @@ public class TileInventory extends TileBase implements IInventory {
}
@Override
public void openInventory(EntityPlayer player) {
public void openInventory(PlayerEntity player) {
}
@Override
public void closeInventory(EntityPlayer player) {
public void closeInventory(PlayerEntity player) {
}
@ -192,7 +192,7 @@ public class TileInventory extends TileBase implements IInventory {
}
@Override
public boolean isUsableByPlayer(EntityPlayer player) {
public boolean isUsableByPlayer(PlayerEntity player) {
return true;
}
@ -208,17 +208,17 @@ public class TileInventory extends TileBase implements IInventory {
@Override
public ITextComponent getDisplayName() {
return new TextComponentString(getName());
return new StringTextComponent(getName());
}
protected void initializeItemHandlers() {
if (this instanceof ISidedInventory) {
handlerDown = new SidedInvWrapper((ISidedInventory) this, EnumFacing.DOWN);
handlerUp = new SidedInvWrapper((ISidedInventory) this, EnumFacing.UP);
handlerNorth = new SidedInvWrapper((ISidedInventory) this, EnumFacing.NORTH);
handlerSouth = new SidedInvWrapper((ISidedInventory) this, EnumFacing.SOUTH);
handlerWest = new SidedInvWrapper((ISidedInventory) this, EnumFacing.WEST);
handlerEast = new SidedInvWrapper((ISidedInventory) this, EnumFacing.EAST);
handlerDown = new SidedInvWrapper((ISidedInventory) this, Direction.DOWN);
handlerUp = new SidedInvWrapper((ISidedInventory) this, Direction.UP);
handlerNorth = new SidedInvWrapper((ISidedInventory) this, Direction.NORTH);
handlerSouth = new SidedInvWrapper((ISidedInventory) this, Direction.SOUTH);
handlerWest = new SidedInvWrapper((ISidedInventory) this, Direction.WEST);
handlerEast = new SidedInvWrapper((ISidedInventory) this, Direction.EAST);
} else {
handlerDown = new InvWrapper(this);
handlerUp = handlerDown;
@ -231,7 +231,7 @@ public class TileInventory extends TileBase implements IInventory {
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
public <T> T getCapability(Capability<T> capability, Direction facing) {
if (facing != null && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) {
switch (facing) {
case DOWN:
@ -255,7 +255,7 @@ public class TileInventory extends TileBase implements IInventory {
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
public boolean hasCapability(Capability<?> capability, Direction facing) {
return capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || super.hasCapability(capability, facing);
}
}

View file

@ -10,10 +10,10 @@ import WayofTime.bloodmagic.inversion.InversionPillarHandler;
import WayofTime.bloodmagic.tile.base.TileTicking;
import com.google.common.collect.ImmutableMap;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
@ -133,9 +133,9 @@ public class TileInversionPillar extends TileTicking {
BlockPos candidatePos = findCandidatePositionForPillar(getWorld(), type, pos, allConnectedPos, 5, 10);
if (!candidatePos.equals(BlockPos.ORIGIN)) {
currentInversion = 0;
IBlockState pillarState = RegistrarBloodMagicBlocks.INVERSION_PILLAR.getStateFromMeta(type.ordinal());
IBlockState bottomState = RegistrarBloodMagicBlocks.INVERSION_PILLAR_END.getStateFromMeta(type.ordinal() * 2);
IBlockState topState = RegistrarBloodMagicBlocks.INVERSION_PILLAR_END.getStateFromMeta(type.ordinal() * 2 + 1);
BlockState pillarState = RegistrarBloodMagicBlocks.INVERSION_PILLAR.getStateFromMeta(type.ordinal());
BlockState bottomState = RegistrarBloodMagicBlocks.INVERSION_PILLAR_END.getStateFromMeta(type.ordinal() * 2);
BlockState topState = RegistrarBloodMagicBlocks.INVERSION_PILLAR_END.getStateFromMeta(type.ordinal() * 2 + 1);
getWorld().setBlockState(candidatePos, pillarState);
getWorld().setBlockState(candidatePos.down(), bottomState);
getWorld().setBlockState(candidatePos.up(), topState);
@ -166,7 +166,7 @@ public class TileInversionPillar extends TileTicking {
return;
}
for (EnumFacing side : EnumFacing.HORIZONTALS) {
for (Direction side : Direction.HORIZONTALS) {
BlockPos offsetPos = pos.offset(side, 16);
double sideAmount = WorldDemonWillHandler.getCurrentWill(getWorld(), offsetPos, type);
if (currentAmount > sideAmount) {
@ -194,7 +194,7 @@ public class TileInversionPillar extends TileTicking {
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
if (!tag.hasKey(Constants.NBT.WILL_TYPE)) {
@ -211,7 +211,7 @@ public class TileInversionPillar extends TileTicking {
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
tag.setString(Constants.NBT.WILL_TYPE, type.toString());
@ -282,7 +282,7 @@ public class TileInversionPillar extends TileTicking {
return 1; //Invalid block (itself!)
}
IBlockState state = getWorld().getBlockState(offsetPos);
BlockState state = getWorld().getBlockState(offsetPos);
if (!state.getBlock().isAir(state, getWorld(), offsetPos)) {
//Consume Will and set this block
Block block = state.getBlock();
@ -314,7 +314,7 @@ public class TileInversionPillar extends TileTicking {
}
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing side) {
public boolean hasCapability(Capability<?> capability, Direction side) {
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY) {
return true;
}
@ -322,7 +322,7 @@ public class TileInversionPillar extends TileTicking {
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing side) {
public <T> T getCapability(Capability<T> capability, Direction side) {
if (capability == CapabilityAnimation.ANIMATION_CAPABILITY) {
return CapabilityAnimation.ANIMATION_CAPABILITY.cast(asm);
}

View file

@ -19,12 +19,12 @@ import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.util.helper.*;
import com.google.common.base.Strings;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
@ -40,7 +40,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
private int activeTime;
private int cooldown;
private Ritual currentRitual;
private EnumFacing direction = EnumFacing.NORTH;
private Direction direction = Direction.NORTH;
private boolean inverted;
private List<EnumDemonWillType> currentActiveWillConfig = new ArrayList<>();
@ -73,20 +73,20 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
owner = tag.hasUniqueId("owner") ? tag.getUniqueId("owner") : null;
if (owner != null)
cachedNetwork = NetworkHelper.getSoulNetwork(owner);
currentRitual = BloodMagic.RITUAL_MANAGER.getRitual(tag.getString(Constants.NBT.CURRENT_RITUAL));
if (currentRitual != null) {
NBTTagCompound ritualTag = tag.getCompoundTag(Constants.NBT.CURRENT_RITUAL_TAG);
CompoundNBT ritualTag = tag.getCompoundTag(Constants.NBT.CURRENT_RITUAL_TAG);
if (!ritualTag.isEmpty()) {
currentRitual.readFromNBT(ritualTag);
}
}
active = tag.getBoolean(Constants.NBT.IS_RUNNING);
activeTime = tag.getInteger(Constants.NBT.RUNTIME);
direction = EnumFacing.VALUES[tag.getInteger(Constants.NBT.DIRECTION)];
direction = Direction.VALUES[tag.getInteger(Constants.NBT.DIRECTION)];
redstoned = tag.getBoolean(Constants.NBT.IS_REDSTONED);
for (EnumDemonWillType type : EnumDemonWillType.values()) {
@ -97,13 +97,13 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
String ritualId = BloodMagic.RITUAL_MANAGER.getId(getCurrentRitual());
if (owner != null)
tag.setUniqueId("owner", owner);
tag.setString(Constants.NBT.CURRENT_RITUAL, Strings.isNullOrEmpty(ritualId) ? "" : ritualId);
if (currentRitual != null) {
NBTTagCompound ritualTag = new NBTTagCompound();
CompoundNBT ritualTag = new CompoundNBT();
currentRitual.writeToNBT(ritualTag);
tag.setTag(Constants.NBT.CURRENT_RITUAL_TAG, ritualTag);
}
@ -120,7 +120,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
@Override
public boolean activateRitual(ItemStack activationCrystal, @Nullable EntityPlayer activator, Ritual ritual) {
public boolean activateRitual(ItemStack activationCrystal, @Nullable PlayerEntity activator, Ritual ritual) {
if (PlayerHelper.isFakePlayer(activator))
return false;
@ -133,7 +133,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
SoulNetwork network = NetworkHelper.getSoulNetwork(binding);
if (!isRedstoned() && network.getCurrentEssence() < ritual.getActivationCost() && (activator != null && !activator.capabilities.isCreativeMode)) {
activator.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.ritual.weak"), true);
activator.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.ritual.weak"), true);
return false;
}
@ -144,7 +144,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
if (MinecraftForge.EVENT_BUS.post(event)) {
if (activator != null)
activator.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.ritual.prevent"), true);
activator.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.ritual.prevent"), true);
return false;
}
@ -153,7 +153,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
network.syphon(ticket(ritual.getActivationCost()));
if (activator != null)
activator.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.ritual.activate"), true);
activator.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.ritual.activate"), true);
this.active = true;
this.owner = binding.getOwnerId();
@ -174,7 +174,7 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
} else {
if (activator != null)
activator.sendStatusMessage(new TextComponentTranslation("chat.bloodmagic.ritual.notValid"), true);
activator.sendStatusMessage(new TranslationTextComponent("chat.bloodmagic.ritual.notValid"), true);
}
return false;
@ -229,11 +229,11 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
@Override
public EnumFacing getDirection() {
public Direction getDirection() {
return direction;
}
public void setDirection(EnumFacing direction) {
public void setDirection(Direction direction) {
this.direction = direction;
}
@ -291,26 +291,26 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
@Override
public void provideInformationOfRitualToPlayer(EntityPlayer player) {
public void provideInformationOfRitualToPlayer(PlayerEntity player) {
if (this.currentRitual != null) {
ChatUtil.sendNoSpam(player, this.currentRitual.provideInformationOfRitualToPlayer(player));
}
}
@Override
public void provideInformationOfRangeToPlayer(EntityPlayer player, String range) {
public void provideInformationOfRangeToPlayer(PlayerEntity player, String range) {
if (this.currentRitual != null && this.currentRitual.getListOfRanges().contains(range)) {
ChatUtil.sendNoSpam(player, this.currentRitual.provideInformationOfRangeToPlayer(player, range));
}
}
@Override
public void setActiveWillConfig(EntityPlayer player, List<EnumDemonWillType> typeList) {
public void setActiveWillConfig(PlayerEntity player, List<EnumDemonWillType> typeList) {
this.currentActiveWillConfig = typeList;
}
@Override
public EnumReaderBoundaries setBlockRangeByBounds(EntityPlayer player, String range, BlockPos offset1, BlockPos offset2) {
public EnumReaderBoundaries setBlockRangeByBounds(PlayerEntity player, String range, BlockPos offset1, BlockPos offset2) {
AreaDescriptor descriptor = this.getBlockRange(range);
DemonWillHolder holder = WorldDemonWillHandler.getWillHolder(world, getBlockPos());
@ -327,10 +327,10 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
@Override
public void provideInformationOfWillConfigToPlayer(EntityPlayer player, List<EnumDemonWillType> typeList) {
public void provideInformationOfWillConfigToPlayer(PlayerEntity player, List<EnumDemonWillType> typeList) {
//There is probably an easier way to make expanded chat messages
if (typeList.size() >= 1) {
Object[] translations = new TextComponentTranslation[typeList.size()];
Object[] translations = new TranslationTextComponent[typeList.size()];
StringBuilder constructedString = new StringBuilder("%s");
for (int i = 1; i < typeList.size(); i++) {
@ -338,12 +338,12 @@ public class TileMasterRitualStone extends TileTicking implements IMasterRitualS
}
for (int i = 0; i < typeList.size(); i++) {
translations[i] = new TextComponentTranslation("tooltip.bloodmagic.currentBaseType." + typeList.get(i).name.toLowerCase());
translations[i] = new TranslationTextComponent("tooltip.bloodmagic.currentBaseType." + typeList.get(i).name.toLowerCase());
}
ChatUtil.sendNoSpam(player, new TextComponentTranslation("ritual.bloodmagic.willConfig.set", new TextComponentTranslation(constructedString.toString(), translations)));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("ritual.bloodmagic.willConfig.set", new TranslationTextComponent(constructedString.toString(), translations)));
} else {
ChatUtil.sendNoSpam(player, new TextComponentTranslation("ritual.bloodmagic.willConfig.void"));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("ritual.bloodmagic.willConfig.void"));
}
}

View file

@ -8,26 +8,26 @@ import WayofTime.bloodmagic.util.ChatUtil;
import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.StateUtil;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityPotion;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PotionEntity;
import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.PotionEffect;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.potion.EffectInstance;
import net.minecraft.potion.PotionUtils;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraft.world.Difficulty;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
@ -39,9 +39,9 @@ public class TileMimic extends TileInventory implements ITickable {
private static Field _blockMetadata = ReflectionHelper.findField(TileEntity.class, "blockMetadata", "field_145847_g");
public boolean dropItemsOnBreak = true;
public NBTTagCompound tileTag = new NBTTagCompound();
public CompoundNBT tileTag = new CompoundNBT();
public TileEntity mimicedTile = null;
IBlockState stateOfReplacedBlock = Blocks.AIR.getDefaultState();
BlockState stateOfReplacedBlock = Blocks.AIR.getDefaultState();
public int playerCheckRadius = 5;
public int potionSpawnRadius = 5;
@ -64,9 +64,9 @@ public class TileMimic extends TileInventory implements ITickable {
ItemStack potionStack = this.getStackInSlot(1);
if (!potionStack.isEmpty()) {
AxisAlignedBB bb = new AxisAlignedBB(this.getPos()).expand(playerCheckRadius, playerCheckRadius, playerCheckRadius);
List<EntityPlayer> playerList = getWorld().getEntitiesWithinAABB(EntityPlayer.class, bb);
List<PlayerEntity> playerList = getWorld().getEntitiesWithinAABB(PlayerEntity.class, bb);
for (EntityPlayer player : playerList) {
for (PlayerEntity player : playerList) {
if (!player.capabilities.isCreativeMode) {
double posX = this.pos.getX() + 0.5 + (2 * getWorld().rand.nextDouble() - 1) * potionSpawnRadius;
double posY = this.pos.getY() + 0.5 + (2 * getWorld().rand.nextDouble() - 1) * potionSpawnRadius;
@ -75,7 +75,7 @@ public class TileMimic extends TileInventory implements ITickable {
ItemStack newStack = new ItemStack(potionStack.getItem() == RegistrarBloodMagicItems.POTION_FLASK ? Items.SPLASH_POTION : potionStack.getItem());
newStack.setTagCompound(potionStack.getTagCompound());
EntityPotion potionEntity = new EntityPotion(getWorld(), posX, posY, posZ, newStack);
PotionEntity potionEntity = new PotionEntity(getWorld(), posX, posY, posZ, newStack);
getWorld().spawnEntity(potionEntity);
break;
@ -84,11 +84,11 @@ public class TileMimic extends TileInventory implements ITickable {
}
}
if (this.getBlockMetadata() == BlockMimic.sentientMimicMeta && getWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(mimicedTile instanceof IInventory)) {
if (this.getBlockMetadata() == BlockMimic.sentientMimicMeta && getWorld().getDifficulty() != Difficulty.PEACEFUL && !(mimicedTile instanceof IInventory)) {
AxisAlignedBB bb = new AxisAlignedBB(this.getPos()).expand(playerCheckRadius, playerCheckRadius, playerCheckRadius);
List<EntityPlayer> playerList = getWorld().getEntitiesWithinAABB(EntityPlayer.class, bb);
List<PlayerEntity> playerList = getWorld().getEntitiesWithinAABB(PlayerEntity.class, bb);
for (EntityPlayer player : playerList) {
for (PlayerEntity player : playerList) {
if (!player.capabilities.isCreativeMode && Utils.canEntitySeeBlock(getWorld(), player, getPos())) {
spawnMimicEntity(player);
break;
@ -98,14 +98,14 @@ public class TileMimic extends TileInventory implements ITickable {
}
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side) {
public boolean onBlockActivated(World world, BlockPos pos, BlockState state, PlayerEntity player, Hand hand, ItemStack heldItem, Direction side) {
if (!heldItem.isEmpty() && player.capabilities.isCreativeMode) {
List<PotionEffect> list = PotionUtils.getEffectsFromStack(heldItem);
List<EffectInstance> list = PotionUtils.getEffectsFromStack(heldItem);
if (!list.isEmpty()) {
if (!world.isRemote) {
setInventorySlotContents(1, heldItem.copy());
world.notifyBlockUpdate(pos, state, state, 3);
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.potionSet"));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.potionSet"));
}
return true;
} else if (heldItem.getItem() == RegistrarBloodMagicItems.POTION_FLASK) {
@ -113,7 +113,7 @@ public class TileMimic extends TileInventory implements ITickable {
if (!world.isRemote) {
setInventorySlotContents(1, ItemStack.EMPTY);
world.notifyBlockUpdate(pos, state, state, 3);
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.potionRemove"));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.potionRemove"));
}
return true;
}
@ -138,8 +138,8 @@ public class TileMimic extends TileInventory implements ITickable {
Utils.insertItemToTile(this, player, 0);
ItemStack stack = getStackInSlot(0);
if (stateOfReplacedBlock == Blocks.AIR.getDefaultState()) {
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
if (!stack.isEmpty() && stack.getItem() instanceof BlockItem) {
Block block = ((BlockItem) stack.getItem()).getBlock();
stateOfReplacedBlock = block.getDefaultState();
}
}
@ -153,16 +153,16 @@ public class TileMimic extends TileInventory implements ITickable {
return true;
}
public boolean performSpecialAbility(EntityPlayer player, EnumFacing sideHit) {
public boolean performSpecialAbility(PlayerEntity player, Direction sideHit) {
switch (this.getBlockMetadata()) {
case BlockMimic.sentientMimicMeta:
if (player.capabilities.isCreativeMode) {
if (player.isSneaking()) {
playerCheckRadius = Math.max(playerCheckRadius - 1, 0);
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.detectRadius.down", playerCheckRadius));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.detectRadius.down", playerCheckRadius));
} else {
playerCheckRadius++;
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.detectRadius.up", playerCheckRadius));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.detectRadius.up", playerCheckRadius));
}
return false;
@ -180,30 +180,30 @@ public class TileMimic extends TileInventory implements ITickable {
case WEST:
if (player.isSneaking()) {
potionSpawnRadius = Math.max(potionSpawnRadius - 1, 0);
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.potionSpawnRadius.down", potionSpawnRadius));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.potionSpawnRadius.down", potionSpawnRadius));
} else {
potionSpawnRadius++;
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.potionSpawnRadius.up", potionSpawnRadius));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.potionSpawnRadius.up", potionSpawnRadius));
}
break;
case NORTH: //When the block is clicked on the NORTH or SOUTH side, detectRadius is edited.
case SOUTH:
if (player.isSneaking()) {
playerCheckRadius = Math.max(playerCheckRadius - 1, 0);
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.detectRadius.down", playerCheckRadius));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.detectRadius.down", playerCheckRadius));
} else {
playerCheckRadius++;
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.detectRadius.up", playerCheckRadius));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.detectRadius.up", playerCheckRadius));
}
break;
case UP: //When the block is clicked on the UP or DOWN side, potionSpawnInterval is edited.
case DOWN:
if (player.isSneaking()) {
potionSpawnInterval = Math.max(potionSpawnInterval - 1, 1);
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.potionInterval.down", potionSpawnInterval));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.potionInterval.down", potionSpawnInterval));
} else {
potionSpawnInterval++;
ChatUtil.sendNoSpam(player, new TextComponentTranslation("chat.bloodmagic.mimic.potionInterval.up", potionSpawnInterval));
ChatUtil.sendNoSpam(player, new TranslationTextComponent("chat.bloodmagic.mimic.potionInterval.up", potionSpawnInterval));
}
break;
default:
@ -217,8 +217,8 @@ public class TileMimic extends TileInventory implements ITickable {
return false;
}
public boolean spawnMimicEntity(EntityPlayer target) {
if (this.getWorld().getDifficulty() == EnumDifficulty.PEACEFUL) {
public boolean spawnMimicEntity(PlayerEntity target) {
if (this.getWorld().getDifficulty() == Difficulty.PEACEFUL) {
return false;
}
@ -252,7 +252,7 @@ public class TileMimic extends TileInventory implements ITickable {
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
dropItemsOnBreak = tag.getBoolean("dropItemsOnBreak");
@ -265,7 +265,7 @@ public class TileMimic extends TileInventory implements ITickable {
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
tag.setBoolean("dropItemsOnBreak", dropItemsOnBreak);
@ -293,11 +293,11 @@ public class TileMimic extends TileInventory implements ITickable {
}
}
public IBlockState getReplacedState() {
public BlockState getReplacedState() {
return stateOfReplacedBlock;
}
public void setReplacedState(IBlockState state) {
public void setReplacedState(BlockState state) {
stateOfReplacedBlock = state;
}
@ -313,10 +313,10 @@ public class TileMimic extends TileInventory implements ITickable {
replaceMimicWithBlockActual(world, pos, mimic.getStackInSlot(0), mimic.tileTag, mimic.stateOfReplacedBlock);
}
public static boolean replaceMimicWithBlockActual(World world, BlockPos pos, ItemStack stack, NBTTagCompound tileTag, IBlockState replacementState) {
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
IBlockState state = replacementState;
public static boolean replaceMimicWithBlockActual(World world, BlockPos pos, ItemStack stack, CompoundNBT tileTag, BlockState replacementState) {
if (!stack.isEmpty() && stack.getItem() instanceof BlockItem) {
Block block = ((BlockItem) stack.getItem()).getBlock();
BlockState state = replacementState;
if (world.setBlockState(pos, state, 3)) {
TileEntity tile = world.getTileEntity(pos);
if (tile != null) {
@ -334,10 +334,10 @@ public class TileMimic extends TileInventory implements ITickable {
}
@Nullable
public static TileEntity getTileFromStackWithTag(World world, BlockPos pos, ItemStack stack, @Nullable NBTTagCompound tag, IBlockState replacementState) {
if (!stack.isEmpty() && stack.getItem() instanceof ItemBlock) {
Block block = ((ItemBlock) stack.getItem()).getBlock();
IBlockState state = replacementState;
public static TileEntity getTileFromStackWithTag(World world, BlockPos pos, ItemStack stack, @Nullable CompoundNBT tag, BlockState replacementState) {
if (!stack.isEmpty() && stack.getItem() instanceof BlockItem) {
Block block = ((BlockItem) stack.getItem()).getBlock();
BlockState state = replacementState;
if (block.hasTileEntity(state)) {
TileEntity tile = block.createTileEntity(world, state);
@ -345,7 +345,7 @@ public class TileMimic extends TileInventory implements ITickable {
return null;
if (tag != null) {
NBTTagCompound copyTag = tag.copy();
CompoundNBT copyTag = tag.copy();
copyTag.setInteger("x", pos.getX());
copyTag.setInteger("y", pos.getY());
copyTag.setInteger("z", pos.getZ());

View file

@ -3,8 +3,8 @@ package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.item.sigil.ItemSigilPhantomBridge;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.tile.base.TileTicking;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
public class TilePhantomBlock extends TileTicking {
private int ticksRemaining = 10;
@ -17,12 +17,12 @@ public class TilePhantomBlock extends TileTicking {
}
@Override
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
this.ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
tagCompound.setInteger(Constants.NBT.TICKS_REMAINING, ticksRemaining);
return tagCompound;
}
@ -30,7 +30,7 @@ public class TilePhantomBlock extends TileTicking {
@Override
public void onUpdate() {
if (!world.isRemote) {
EntityPlayer player = world.getClosestPlayer(getPos().getX(), getPos().getY(), getPos().getZ(), 10.0D, ItemSigilPhantomBridge.IS_PHANTOM_ACTIVE);
PlayerEntity player = world.getClosestPlayer(getPos().getX(), getPos().getY(), getPos().getZ(), 10.0D, ItemSigilPhantomBridge.IS_PHANTOM_ACTIVE);
if (player != null && !player.isSneaking())
return;
ticksRemaining--;

View file

@ -3,14 +3,14 @@ package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.iface.IPurificationAsh;
import WayofTime.bloodmagic.ritual.AreaDescriptor;
import WayofTime.bloodmagic.util.helper.PurificationHelper;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldServer;
import net.minecraft.world.ServerWorld;
import java.util.List;
@ -39,14 +39,14 @@ public class TilePurificationAltar extends TileInventory implements ITickable {
}
AxisAlignedBB aabb = purityArea.getAABB(getPos());
List<EntityAnimal> animalList = getWorld().getEntitiesWithinAABB(EntityAnimal.class, aabb);
List<AnimalEntity> animalList = getWorld().getEntitiesWithinAABB(AnimalEntity.class, aabb);
if (animalList.isEmpty()) {
return;
}
boolean hasPerformed = false;
for (EntityAnimal animal : animalList) {
for (AnimalEntity animal : animalList) {
double added = PurificationHelper.addPurity(animal, Math.min(purityRate, totalPurity), maxPurity);
if (added > 0) {
totalPurity -= purityRate;
@ -55,15 +55,15 @@ public class TilePurificationAltar extends TileInventory implements ITickable {
}
if (hasPerformed) {
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof WorldServer) {
WorldServer server = (WorldServer) getWorld();
if (getWorld().rand.nextInt(4) == 0 && getWorld() instanceof ServerWorld) {
ServerWorld server = (ServerWorld) getWorld();
server.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + 0.5, pos.getY() + 1.2, pos.getZ() + 0.5, 1, 0.02, 0.03, 0.02, 0);
}
}
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
totalPurity = tag.getDouble("totalPurity");
maxPurity = tag.getDouble("maxPurity");
@ -71,7 +71,7 @@ public class TilePurificationAltar extends TileInventory implements ITickable {
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
tag.setDouble("totalPurity", totalPurity);

View file

@ -10,7 +10,7 @@ import WayofTime.bloodmagic.soul.IDemonWillConduit;
import WayofTime.bloodmagic.soul.IDemonWillGem;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ITickable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.items.ItemHandlerHelper;
@ -34,14 +34,14 @@ public class TileSoulForge extends TileInventory implements ITickable, IDemonWil
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
burnTime = tag.getInteger(Constants.NBT.SOUL_FORGE_BURN);
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
tag.setInteger(Constants.NBT.SOUL_FORGE_BURN, burnTime);

View file

@ -5,8 +5,8 @@ import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
import WayofTime.bloodmagic.tile.base.TileTicking;
import com.google.common.base.Strings;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -21,14 +21,14 @@ public class TileSpectralBlock extends TileTicking {
}
@Override
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
ticksRemaining = tagCompound.getInteger(Constants.NBT.TICKS_REMAINING);
containedBlockName = tagCompound.getString(Constants.NBT.CONTAINED_BLOCK_NAME);
containedBlockMeta = tagCompound.getInteger(Constants.NBT.CONTAINED_BLOCK_META);
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
tagCompound.setInteger(Constants.NBT.TICKS_REMAINING, ticksRemaining);
tagCompound.setString(Constants.NBT.CONTAINED_BLOCK_NAME, Strings.isNullOrEmpty(containedBlockName) ? "" : containedBlockName);
tagCompound.setInteger(Constants.NBT.CONTAINED_BLOCK_META, containedBlockMeta);
@ -48,7 +48,7 @@ public class TileSpectralBlock extends TileTicking {
}
}
private void setContainedBlockInfo(IBlockState blockState) {
private void setContainedBlockInfo(BlockState blockState) {
containedBlockName = blockState.getBlock().getRegistryName().toString();
containedBlockMeta = blockState.getBlock().getMetaFromState(blockState);
}
@ -75,7 +75,7 @@ public class TileSpectralBlock extends TileTicking {
public static void createSpectralBlock(World world, BlockPos blockPos, int duration) {
if (world.isAirBlock(blockPos))
return;
IBlockState cachedState = world.getBlockState(blockPos);
BlockState cachedState = world.getBlockState(blockPos);
world.setBlockState(blockPos, RegistrarBloodMagicBlocks.SPECTRAL.getDefaultState());
TileSpectralBlock tile = (TileSpectralBlock) world.getTileEntity(blockPos);
tile.setContainedBlockInfo(cachedState);

View file

@ -13,7 +13,7 @@ import WayofTime.bloodmagic.util.Utils;
import WayofTime.bloodmagic.util.helper.NetworkHelper;
import net.minecraft.entity.Entity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.AxisAlignedBB;
@ -35,13 +35,13 @@ public class TileTeleposer extends TileInventory implements ITickable {
}
@Override
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
super.deserialize(tagCompound);
previousInput = tagCompound.getInteger(Constants.NBT.PREVIOUS_INPUT);
}
@Override
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
super.serialize(tagCompound);
tagCompound.setInteger(Constants.NBT.PREVIOUS_INPUT, previousInput);
return tagCompound;

View file

@ -1,9 +1,9 @@
package WayofTime.bloodmagic.tile.base;
import net.minecraft.block.state.IBlockState;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SPacketUpdateTileEntity;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -17,27 +17,27 @@ import net.minecraftforge.fml.relauncher.SideOnly;
*/
public class TileBase extends TileEntity {
@Override
public final void readFromNBT(NBTTagCompound compound) {
public final void readFromNBT(CompoundNBT compound) {
super.readFromNBT(compound);
deserializeBase(compound);
deserialize(compound);
}
@Override
public final NBTTagCompound writeToNBT(NBTTagCompound compound) {
public final CompoundNBT writeToNBT(CompoundNBT compound) {
super.writeToNBT(compound);
serializeBase(compound);
return serialize(compound);
}
/**
* Called by {@link #readFromNBT(NBTTagCompound)}
* Called by {@link #readFromNBT(CompoundNBT)}
* <p>
* Internal data (such as coordinates) are handled for you. Just read the data you need.
*
* @param tagCompound - The tag compound to read from
*/
public void deserialize(NBTTagCompound tagCompound) {
public void deserialize(CompoundNBT tagCompound) {
}
@ -47,19 +47,19 @@ public class TileBase extends TileEntity {
* @param tagCompound - The tag compound to read from
* @see TileTicking
*/
void deserializeBase(NBTTagCompound tagCompound) {
void deserializeBase(CompoundNBT tagCompound) {
}
/**
* Called by {@link #writeToNBT(NBTTagCompound)}
* Called by {@link #writeToNBT(CompoundNBT)}
* <p>
* Internal data (such as coordinates) are handled for you. Just read the data you need.
*
* @param tagCompound - The tag compound to write to.
* @return the modified tag compound
*/
public NBTTagCompound serialize(NBTTagCompound tagCompound) {
public CompoundNBT serialize(CompoundNBT tagCompound) {
return tagCompound;
}
@ -71,30 +71,30 @@ public class TileBase extends TileEntity {
* @return the modified tag compound
* @see TileTicking
*/
NBTTagCompound serializeBase(NBTTagCompound tagCompound) {
CompoundNBT serializeBase(CompoundNBT tagCompound) {
return tagCompound;
}
public void notifyUpdate() {
IBlockState state = getWorld().getBlockState(getPos());
BlockState state = getWorld().getBlockState(getPos());
getWorld().notifyBlockUpdate(getPos(), state, state, 3);
}
// Data syncing
@Override
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
public boolean shouldRefresh(World world, BlockPos pos, BlockState oldState, BlockState newState) {
return oldState.getBlock() != newState.getBlock();
}
@Override
public final SPacketUpdateTileEntity getUpdatePacket() {
return new SPacketUpdateTileEntity(getPos(), -999, writeToNBT(new NBTTagCompound()));
public final SUpdateTileEntityPacket getUpdatePacket() {
return new SUpdateTileEntityPacket(getPos(), -999, writeToNBT(new CompoundNBT()));
}
@Override
@SideOnly(Side.CLIENT)
public final void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt) {
public final void onDataPacket(NetworkManager net, SUpdateTileEntityPacket pkt) {
super.onDataPacket(net, pkt);
readFromNBT(pkt.getNbtCompound());
onDataPacketClientReceived();
@ -108,12 +108,12 @@ public class TileBase extends TileEntity {
}
@Override
public final NBTTagCompound getUpdateTag() {
return writeToNBT(new NBTTagCompound());
public final CompoundNBT getUpdateTag() {
return writeToNBT(new CompoundNBT());
}
@Override
public final void handleUpdateTag(NBTTagCompound tag) {
public final void handleUpdateTag(CompoundNBT tag) {
readFromNBT(tag);
}
}

View file

@ -1,6 +1,6 @@
package WayofTime.bloodmagic.tile.base;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ITickable;
/**
@ -20,13 +20,13 @@ public abstract class TileTicking extends TileBase implements ITickable {
}
@Override
void deserializeBase(NBTTagCompound tagCompound) {
void deserializeBase(CompoundNBT tagCompound) {
this.ticksExisted = tagCompound.getInteger("ticksExisted");
this.shouldTick = tagCompound.getBoolean("shouldTick");
}
@Override
NBTTagCompound serializeBase(NBTTagCompound tagCompound) {
CompoundNBT serializeBase(CompoundNBT tagCompound) {
tagCompound.setInteger("ticksExisted", getTicksExisted());
tagCompound.setBoolean("shouldTick", shouldTick());
return tagCompound;

View file

@ -2,18 +2,18 @@ package WayofTime.bloodmagic.tile.container;
import WayofTime.bloodmagic.orb.IBloodOrb;
import WayofTime.bloodmagic.tile.TileAlchemyTable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
public class ContainerAlchemyTable extends Container {
private final IInventory tileTable;
public ContainerAlchemyTable(InventoryPlayer inventoryPlayer, IInventory tileTable) {
public ContainerAlchemyTable(PlayerInventory inventoryPlayer, IInventory tileTable) {
this.tileTable = tileTable;
this.addSlotToContainer(new Slot(tileTable, 0, 62, 15));
this.addSlotToContainer(new Slot(tileTable, 1, 80, 51));
@ -37,8 +37,8 @@ public class ContainerAlchemyTable extends Container {
}
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
InventoryPlayer inventoryPlayer = player.inventory;
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
PlayerInventory inventoryPlayer = player.inventory;
if (slotId < 6 && slotId >= 0) {
Slot slot = this.getSlot(slotId);
@ -51,7 +51,7 @@ public class ContainerAlchemyTable extends Container {
}
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
@ -95,7 +95,7 @@ public class ContainerAlchemyTable extends Container {
}
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
public boolean canInteractWith(PlayerEntity playerIn) {
return this.tileTable.isUsableByPlayer(playerIn);
}

View file

@ -4,12 +4,12 @@ import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.item.routing.IRoutingFilterProvider;
import WayofTime.bloodmagic.tile.routing.TileFilteredRoutingNode;
import WayofTime.bloodmagic.util.GhostItemHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ClickType;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import javax.annotation.Nullable;
@ -21,7 +21,7 @@ public class ContainerItemRoutingNode extends Container {
// private final ItemInventory itemInventory;
private int slotsOccupied;
public ContainerItemRoutingNode(InventoryPlayer inventoryPlayer, IInventory tileItemRoutingNode) {
public ContainerItemRoutingNode(PlayerInventory inventoryPlayer, IInventory tileItemRoutingNode) {
this.tileItemRoutingNode = tileItemRoutingNode;
inventory = (TileFilteredRoutingNode) tileItemRoutingNode;
@ -55,8 +55,8 @@ public class ContainerItemRoutingNode extends Container {
* Overridden in order to handle ghost item slots.
*/
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
InventoryPlayer inventoryPlayer = player.inventory;
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, PlayerEntity player) {
PlayerInventory inventoryPlayer = player.inventory;
// if (!player.worldObj.isRemote)
{
if (slotId >= 0) {
@ -111,7 +111,7 @@ public class ContainerItemRoutingNode extends Container {
}
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
@ -154,7 +154,7 @@ public class ContainerItemRoutingNode extends Container {
}
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
public boolean canInteractWith(PlayerEntity playerIn) {
return this.tileItemRoutingNode.isUsableByPlayer(playerIn);
}
@ -218,7 +218,7 @@ public class ContainerItemRoutingNode extends Container {
}
@Override
public boolean canTakeStack(EntityPlayer playerIn) {
public boolean canTakeStack(PlayerEntity playerIn) {
return false;
}

View file

@ -1,20 +1,20 @@
package WayofTime.bloodmagic.tile.container;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.IInventory;
public class ContainerMasterRoutingNode extends Container {
private final IInventory tileMasterRoutingNode;
public ContainerMasterRoutingNode(InventoryPlayer inventoryPlayer, IInventory tileMasterRoutingNode) {
public ContainerMasterRoutingNode(PlayerInventory inventoryPlayer, IInventory tileMasterRoutingNode) {
this.tileMasterRoutingNode = tileMasterRoutingNode;
}
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
public boolean canInteractWith(PlayerEntity playerIn) {
return this.tileMasterRoutingNode.isUsableByPlayer(playerIn);
}
}

View file

@ -3,17 +3,17 @@ package WayofTime.bloodmagic.tile.container;
import WayofTime.bloodmagic.soul.IDemonWill;
import WayofTime.bloodmagic.soul.IDemonWillGem;
import WayofTime.bloodmagic.tile.TileSoulForge;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
public class ContainerSoulForge extends Container {
private final IInventory tileForge;
public ContainerSoulForge(InventoryPlayer inventoryPlayer, IInventory tileForge) {
public ContainerSoulForge(PlayerInventory inventoryPlayer, IInventory tileForge) {
this.tileForge = tileForge;
this.addSlotToContainer(new Slot(tileForge, 0, 8, 15));
this.addSlotToContainer(new Slot(tileForge, 1, 80, 15));
@ -34,7 +34,7 @@ public class ContainerSoulForge extends Container {
}
@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) {
ItemStack itemstack = ItemStack.EMPTY;
Slot slot = this.inventorySlots.get(index);
@ -77,7 +77,7 @@ public class ContainerSoulForge extends Container {
}
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
public boolean canInteractWith(PlayerEntity playerIn) {
return this.tileForge.isUsableByPlayer(playerIn);
}

View file

@ -1,17 +1,17 @@
package WayofTime.bloodmagic.tile.container;
import WayofTime.bloodmagic.item.ItemTelepositionFocus;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
public class ContainerTeleposer extends Container {
private final IInventory tileTeleposer;
public ContainerTeleposer(InventoryPlayer inventoryPlayer, IInventory tileTeleposer) {
public ContainerTeleposer(PlayerInventory inventoryPlayer, IInventory tileTeleposer) {
this.tileTeleposer = tileTeleposer;
this.addSlotToContainer(new SlotTeleposer(tileTeleposer, 0, 80, 33));
@ -27,7 +27,7 @@ public class ContainerTeleposer extends Container {
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slot) {
public ItemStack transferStackInSlot(PlayerEntity player, int slot) {
ItemStack stack = ItemStack.EMPTY;
Slot slotObject = inventorySlots.get(slot);
int slots = inventorySlots.size();
@ -63,7 +63,7 @@ public class ContainerTeleposer extends Container {
}
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
public boolean canInteractWith(PlayerEntity playerIn) {
return this.tileTeleposer.isUsableByPlayer(playerIn);
}

View file

@ -3,12 +3,12 @@ package WayofTime.bloodmagic.tile.routing;
import WayofTime.bloodmagic.util.Constants;
import WayofTime.bloodmagic.item.inventory.ItemInventory;
import WayofTime.bloodmagic.util.GhostItemHelper;
import net.minecraft.block.state.IBlockState;
import net.minecraft.block.BlockState;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.EnumFacing;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.NonNullList;
public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedInventory {
@ -21,7 +21,7 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
super(size, name);
}
public ItemStack getFilterStack(EnumFacing side) {
public ItemStack getFilterStack(Direction side) {
int index = side.getIndex();
return getStackInSlot(index);
@ -37,12 +37,12 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
}
@Override
public boolean isInventoryConnectedToSide(EnumFacing side) {
public boolean isInventoryConnectedToSide(Direction side) {
return true;
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
currentActiveSlot = tag.getInteger("currentSlot");
priorities = tag.getIntArray(Constants.NBT.ROUTING_PRIORITY);
@ -51,11 +51,11 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
}
if (!tag.getBoolean("updated")) {
NBTTagList tags = tag.getTagList("Items", 10);
ListNBT tags = tag.getTagList("Items", 10);
inventory = NonNullList.withSize(getSizeInventory(), ItemStack.EMPTY);
for (int i = 0; i < tags.tagCount(); i++) {
if (!isSyncedSlot(i)) {
NBTTagCompound data = tags.getCompoundTagAt(i);
CompoundNBT data = tags.getCompoundTagAt(i);
byte j = data.getByte("Slot");
if (j == 0) {
@ -71,7 +71,7 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
tag.setInteger("currentSlot", currentActiveSlot);
tag.setIntArray(Constants.NBT.ROUTING_PRIORITY, priorities);
@ -86,34 +86,34 @@ public class TileFilteredRoutingNode extends TileRoutingNode implements ISidedIn
}
@Override
public int[] getSlotsForFace(EnumFacing side) {
public int[] getSlotsForFace(Direction side) {
return new int[0];
}
@Override
public boolean canInsertItem(int index, ItemStack itemStackIn, EnumFacing direction) {
public boolean canInsertItem(int index, ItemStack itemStackIn, Direction direction) {
return false;
}
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
public boolean canExtractItem(int index, ItemStack stack, Direction direction) {
return false;
}
@Override
public int getPriority(EnumFacing side) {
public int getPriority(Direction side) {
return priorities[side.getIndex()];
}
public void incrementCurrentPriotiryToMaximum(int max) {
priorities[currentActiveSlot] = Math.min(priorities[currentActiveSlot] + 1, max);
IBlockState state = getWorld().getBlockState(pos);
BlockState state = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(pos, state, state, 3);
}
public void decrementCurrentPriority() {
priorities[currentActiveSlot] = Math.max(priorities[currentActiveSlot] - 1, 0);
IBlockState state = getWorld().getBlockState(pos);
BlockState state = getWorld().getBlockState(pos);
getWorld().notifyBlockUpdate(pos, state, state, 3);
}
}

View file

@ -6,7 +6,7 @@ import WayofTime.bloodmagic.routing.*;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandler;
@ -17,12 +17,12 @@ public class TileInputRoutingNode extends TileFilteredRoutingNode implements IIn
}
@Override
public boolean isInput(EnumFacing side) {
public boolean isInput(Direction side) {
return true;
}
@Override
public IItemFilter getInputFilterForSide(EnumFacing side) {
public IItemFilter getInputFilterForSide(Direction side) {
TileEntity tile = getWorld().getTileEntity(pos.offset(side));
if (tile != null) {
IItemHandler handler = Utils.getInventory(tile, side.getOpposite());
@ -46,12 +46,12 @@ public class TileInputRoutingNode extends TileFilteredRoutingNode implements IIn
}
@Override
public boolean isFluidInput(EnumFacing side) {
public boolean isFluidInput(Direction side) {
return true;
}
@Override
public IFluidFilter getInputFluidFilterForSide(EnumFacing side) {
public IFluidFilter getInputFluidFilterForSide(Direction side) {
TileEntity tile = getWorld().getTileEntity(pos.offset(side));
if (tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) {
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
@ -67,7 +67,7 @@ public class TileInputRoutingNode extends TileFilteredRoutingNode implements IIn
}
@Override
public boolean isTankConnectedToSide(EnumFacing side) {
public boolean isTankConnectedToSide(Direction side) {
return true;
}
}

View file

@ -5,10 +5,10 @@ import WayofTime.bloodmagic.soul.EnumDemonWillType;
import WayofTime.bloodmagic.demonAura.WorldDemonWillHandler;
import WayofTime.bloodmagic.routing.*;
import WayofTime.bloodmagic.tile.TileInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -52,7 +52,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
if (outputTile instanceof IOutputItemRoutingNode) {
IOutputItemRoutingNode outputNode = (IOutputItemRoutingNode) outputTile;
for (EnumFacing facing : EnumFacing.VALUES) {
for (Direction facing : Direction.VALUES) {
if (!outputNode.isInventoryConnectedToSide(facing) || !outputNode.isOutput(facing)) {
continue;
}
@ -74,7 +74,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
if (outputTile instanceof IOutputFluidRoutingNode) {
IOutputFluidRoutingNode outputNode = (IOutputFluidRoutingNode) outputTile;
for (EnumFacing facing : EnumFacing.VALUES) {
for (Direction facing : Direction.VALUES) {
if (!outputNode.isTankConnectedToSide(facing) || !outputNode.isFluidOutput(facing)) {
continue;
}
@ -104,7 +104,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
if (inputTile instanceof IInputItemRoutingNode) {
IInputItemRoutingNode inputNode = (IInputItemRoutingNode) inputTile;
for (EnumFacing facing : EnumFacing.VALUES) {
for (Direction facing : Direction.VALUES) {
if (!inputNode.isInventoryConnectedToSide(facing) || !inputNode.isInput(facing)) {
continue;
}
@ -126,7 +126,7 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
if (inputTile instanceof IInputFluidRoutingNode) {
IInputFluidRoutingNode inputNode = (IInputFluidRoutingNode) inputTile;
for (EnumFacing facing : EnumFacing.VALUES) {
for (Direction facing : Direction.VALUES) {
if (!inputNode.isTankConnectedToSide(facing) || !inputNode.isFluidInput(facing)) {
continue;
}
@ -186,11 +186,11 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
NBTTagList tags = new NBTTagList();
ListNBT tags = new ListNBT();
for (BlockPos pos : generalNodeList) {
NBTTagCompound posTag = new NBTTagCompound();
CompoundNBT posTag = new CompoundNBT();
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
posTag.setInteger(Constants.NBT.Z_COORD, pos.getZ());
@ -198,9 +198,9 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
}
tag.setTag(Constants.NBT.ROUTING_MASTER_GENERAL, tags);
tags = new NBTTagList();
tags = new ListNBT();
for (BlockPos pos : inputNodeList) {
NBTTagCompound posTag = new NBTTagCompound();
CompoundNBT posTag = new CompoundNBT();
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
posTag.setInteger(Constants.NBT.Z_COORD, pos.getZ());
@ -208,9 +208,9 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
}
tag.setTag(Constants.NBT.ROUTING_MASTER_INPUT, tags);
tags = new NBTTagList();
tags = new ListNBT();
for (BlockPos pos : outputNodeList) {
NBTTagCompound posTag = new NBTTagCompound();
CompoundNBT posTag = new CompoundNBT();
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
posTag.setInteger(Constants.NBT.Z_COORD, pos.getZ());
@ -221,26 +221,26 @@ public class TileMasterRoutingNode extends TileInventory implements IMasterRouti
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
NBTTagList tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_GENERAL, 10);
ListNBT tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_GENERAL, 10);
for (int i = 0; i < tags.tagCount(); i++) {
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
CompoundNBT blockTag = tags.getCompoundTagAt(i);
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
generalNodeList.add(newPos);
}
tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_INPUT, 10);
for (int i = 0; i < tags.tagCount(); i++) {
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
CompoundNBT blockTag = tags.getCompoundTagAt(i);
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
inputNodeList.add(newPos);
}
tags = tag.getTagList(Constants.NBT.ROUTING_MASTER_OUTPUT, 10);
for (int i = 0; i < tags.tagCount(); i++) {
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
CompoundNBT blockTag = tags.getCompoundTagAt(i);
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
outputNodeList.add(newPos);
}

View file

@ -6,7 +6,7 @@ import WayofTime.bloodmagic.routing.*;
import WayofTime.bloodmagic.util.Utils;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.items.IItemHandler;
@ -17,12 +17,12 @@ public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IO
}
@Override
public boolean isOutput(EnumFacing side) {
public boolean isOutput(Direction side) {
return true;
}
@Override
public IItemFilter getOutputFilterForSide(EnumFacing side) {
public IItemFilter getOutputFilterForSide(Direction side) {
TileEntity tile = getWorld().getTileEntity(pos.offset(side));
if (tile != null) {
IItemHandler handler = Utils.getInventory(tile, side.getOpposite());
@ -46,12 +46,12 @@ public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IO
}
@Override
public boolean isFluidOutput(EnumFacing side) {
public boolean isFluidOutput(Direction side) {
return true;
}
@Override
public IFluidFilter getOutputFluidFilterForSide(EnumFacing side) {
public IFluidFilter getOutputFluidFilterForSide(Direction side) {
TileEntity tile = getWorld().getTileEntity(pos.offset(side));
if (tile != null && tile.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side)) {
IFluidHandler handler = tile.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, side);
@ -67,7 +67,7 @@ public class TileOutputRoutingNode extends TileFilteredRoutingNode implements IO
}
@Override
public boolean isTankConnectedToSide(EnumFacing side) {
public boolean isTankConnectedToSide(Direction side) {
return true;
}
}

View file

@ -5,10 +5,10 @@ import WayofTime.bloodmagic.routing.IItemRoutingNode;
import WayofTime.bloodmagic.routing.IMasterRoutingNode;
import WayofTime.bloodmagic.routing.IRoutingNode;
import WayofTime.bloodmagic.tile.TileInventory;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Direction;
import net.minecraft.util.ITickable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
@ -36,17 +36,17 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
}
@Override
public NBTTagCompound serialize(NBTTagCompound tag) {
public CompoundNBT serialize(CompoundNBT tag) {
super.serialize(tag);
NBTTagCompound masterTag = new NBTTagCompound();
CompoundNBT masterTag = new CompoundNBT();
masterTag.setInteger(Constants.NBT.X_COORD, masterPos.getX());
masterTag.setInteger(Constants.NBT.Y_COORD, masterPos.getY());
masterTag.setInteger(Constants.NBT.Z_COORD, masterPos.getZ());
tag.setTag(Constants.NBT.ROUTING_MASTER, masterTag);
NBTTagList tags = new NBTTagList();
ListNBT tags = new ListNBT();
for (BlockPos pos : connectionList) {
NBTTagCompound posTag = new NBTTagCompound();
CompoundNBT posTag = new CompoundNBT();
posTag.setInteger(Constants.NBT.X_COORD, pos.getX());
posTag.setInteger(Constants.NBT.Y_COORD, pos.getY());
posTag.setInteger(Constants.NBT.Z_COORD, pos.getZ());
@ -57,15 +57,15 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
}
@Override
public void deserialize(NBTTagCompound tag) {
public void deserialize(CompoundNBT tag) {
super.deserialize(tag);
connectionList.clear();
NBTTagCompound masterTag = tag.getCompoundTag(Constants.NBT.ROUTING_MASTER);
CompoundNBT masterTag = tag.getCompoundTag(Constants.NBT.ROUTING_MASTER);
masterPos = new BlockPos(masterTag.getInteger(Constants.NBT.X_COORD), masterTag.getInteger(Constants.NBT.Y_COORD), masterTag.getInteger(Constants.NBT.Z_COORD));
NBTTagList tags = tag.getTagList(Constants.NBT.ROUTING_CONNECTION, 10);
ListNBT tags = tag.getTagList(Constants.NBT.ROUTING_CONNECTION, 10);
for (int i = 0; i < tags.tagCount(); i++) {
NBTTagCompound blockTag = tags.getCompoundTagAt(i);
CompoundNBT blockTag = tags.getCompoundTagAt(i);
BlockPos newPos = new BlockPos(blockTag.getInteger(Constants.NBT.X_COORD), blockTag.getInteger(Constants.NBT.Y_COORD), blockTag.getInteger(Constants.NBT.Z_COORD));
connectionList.add(newPos);
}
@ -159,12 +159,12 @@ public class TileRoutingNode extends TileInventory implements IRoutingNode, IIte
}
@Override
public boolean isInventoryConnectedToSide(EnumFacing side) {
public boolean isInventoryConnectedToSide(Direction side) {
return false;
}
@Override
public int getPriority(EnumFacing side) {
public int getPriority(Direction side) {
return 0;
}