Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
|
@ -1,10 +1,11 @@
|
|||
package WayofTime.bloodmagic.ritual;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import WayofTime.bloodmagic.BloodMagic;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.ritual.*;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
import com.google.common.base.Strings;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -18,36 +19,26 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
import WayofTime.bloodmagic.api.iface.IBindable;
|
||||
import WayofTime.bloodmagic.api.ritual.AreaDescriptor;
|
||||
import WayofTime.bloodmagic.api.ritual.EnumRuneType;
|
||||
import WayofTime.bloodmagic.api.ritual.IMasterRitualStone;
|
||||
import WayofTime.bloodmagic.api.ritual.Ritual;
|
||||
import WayofTime.bloodmagic.api.ritual.RitualComponent;
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.util.Utils;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class RitualExpulsion extends Ritual
|
||||
{
|
||||
public class RitualExpulsion extends Ritual {
|
||||
public static final String EXPULSION_RANGE = "expulsionRange";
|
||||
|
||||
public RitualExpulsion()
|
||||
{
|
||||
public RitualExpulsion() {
|
||||
super("ritualExpulsion", 0, 10000, "ritual." + BloodMagic.MODID + ".expulsionRitual");
|
||||
addBlockRange(EXPULSION_RANGE, new AreaDescriptor.Rectangle(new BlockPos(-12, 0, -12), 25));
|
||||
setMaximumVolumeAndDistanceOfRange(EXPULSION_RANGE, 0, 12, 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performRitual(IMasterRitualStone masterRitualStone)
|
||||
{
|
||||
public void performRitual(IMasterRitualStone masterRitualStone) {
|
||||
World world = masterRitualStone.getWorldObj();
|
||||
int currentEssence = masterRitualStone.getOwnerNetwork().getCurrentEssence();
|
||||
|
||||
if (currentEssence < getRefreshCost())
|
||||
{
|
||||
if (currentEssence < getRefreshCost()) {
|
||||
masterRitualStone.getOwnerNetwork().causeNausea();
|
||||
return;
|
||||
}
|
||||
|
@ -61,16 +52,12 @@ public class RitualExpulsion extends Ritual
|
|||
BlockPos masterPos = masterRitualStone.getBlockPos();
|
||||
TileEntity tile = world.getTileEntity(masterPos.up());
|
||||
|
||||
if (tile != null)
|
||||
{
|
||||
if (tile != null) {
|
||||
IItemHandler handler = Utils.getInventory(tile, null);
|
||||
if (handler != null)
|
||||
{
|
||||
for (int i = 0; i < handler.getSlots(); i++)
|
||||
{
|
||||
if (handler != null) {
|
||||
for (int i = 0; i < handler.getSlots(); i++) {
|
||||
ItemStack itemStack = handler.getStackInSlot(i);
|
||||
if (itemStack != null && itemStack.getItem() instanceof IBindable)
|
||||
{
|
||||
if (itemStack != null && itemStack.getItem() instanceof IBindable) {
|
||||
IBindable bindable = (IBindable) itemStack.getItem();
|
||||
if (!Strings.isNullOrEmpty(bindable.getOwnerName(itemStack)) && !allowedNames.contains(bindable.getOwnerName(itemStack)))
|
||||
allowedNames.add(bindable.getOwnerUUID(itemStack));
|
||||
|
@ -81,8 +68,7 @@ public class RitualExpulsion extends Ritual
|
|||
|
||||
final int teleportDistance = 100;
|
||||
|
||||
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, expulsionRange.getAABB(masterRitualStone.getBlockPos())))
|
||||
{
|
||||
for (EntityPlayer player : world.getEntitiesWithinAABB(EntityPlayer.class, expulsionRange.getAABB(masterRitualStone.getBlockPos()))) {
|
||||
if (player.capabilities.isCreativeMode || PlayerHelper.getUUIDFromPlayer(player).toString().equals(masterRitualStone.getOwner()) || allowedNames.contains(PlayerHelper.getUUIDFromPlayer(player).toString()))
|
||||
continue;
|
||||
|
||||
|
@ -93,10 +79,8 @@ public class RitualExpulsion extends Ritual
|
|||
allowedNames.clear();
|
||||
}
|
||||
|
||||
public boolean teleportRandomly(EntityLivingBase entityLiving, double distance)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
public boolean teleportRandomly(EntityLivingBase entityLiving, double distance) {
|
||||
if (entityLiving instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entityLiving;
|
||||
if (player.capabilities.isCreativeMode)
|
||||
return false;
|
||||
|
@ -111,8 +95,7 @@ public class RitualExpulsion extends Ritual
|
|||
double randZ = z + (rand.nextDouble() - 0.5D) * distance;
|
||||
int i = 0;
|
||||
|
||||
while (!teleportTo(entityLiving, randX, randY, randZ, x, y, z) && i < 100)
|
||||
{
|
||||
while (!teleportTo(entityLiving, randX, randY, randZ, x, y, z) && i < 100) {
|
||||
randX = x + (rand.nextDouble() - 0.5D) * distance;
|
||||
randY = y + (rand.nextInt((int) distance) - (distance) / 2);
|
||||
randZ = z + (rand.nextDouble() - 0.5D) * distance;
|
||||
|
@ -122,12 +105,10 @@ public class RitualExpulsion extends Ritual
|
|||
return i >= 100;
|
||||
}
|
||||
|
||||
public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ)
|
||||
{
|
||||
public boolean teleportTo(EntityLivingBase entityLiving, double par1, double par3, double par5, double lastX, double lastY, double lastZ) {
|
||||
EnderTeleportEvent event = new EnderTeleportEvent(entityLiving, par1, par3, par5, 0);
|
||||
|
||||
if (MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
if (MinecraftForge.EVENT_BUS.post(event)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -138,43 +119,34 @@ public class RitualExpulsion extends Ritual
|
|||
int k = MathHelper.floor(entityLiving.posZ);
|
||||
int l;
|
||||
|
||||
if (!entityLiving.getEntityWorld().isAirBlock(new BlockPos(i, j, k)))
|
||||
{
|
||||
if (!entityLiving.getEntityWorld().isAirBlock(new BlockPos(i, j, k))) {
|
||||
boolean flag1 = false;
|
||||
|
||||
while (!flag1 && j > 0)
|
||||
{
|
||||
while (!flag1 && j > 0) {
|
||||
IBlockState state = entityLiving.getEntityWorld().getBlockState(new BlockPos(i, j - 1, k));
|
||||
|
||||
if (state.getMaterial().blocksMovement())
|
||||
{
|
||||
if (state.getMaterial().blocksMovement()) {
|
||||
flag1 = true;
|
||||
} else
|
||||
{
|
||||
} else {
|
||||
--entityLiving.posY;
|
||||
--j;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag1)
|
||||
{
|
||||
if (flag1) {
|
||||
moveEntityViaTeleport(entityLiving, entityLiving.posX, entityLiving.posY, entityLiving.posZ);
|
||||
|
||||
if (!entityLiving.isCollided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox()))
|
||||
{
|
||||
if (!entityLiving.isCollided && !entityLiving.getEntityWorld().containsAnyLiquid(entityLiving.getEntityBoundingBox())) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!flag)
|
||||
{
|
||||
if (!flag) {
|
||||
moveEntityViaTeleport(entityLiving, lastX, lastY, lastZ);
|
||||
return false;
|
||||
} else
|
||||
{
|
||||
for (l = 0; l < 128; ++l)
|
||||
{
|
||||
} else {
|
||||
for (l = 0; l < 128; ++l) {
|
||||
double lengthVal = (double) l / ((double) 128 - 1.0D);
|
||||
float randF1 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
|
||||
float randF2 = (entityLiving.getEntityWorld().rand.nextFloat() - 0.5F) * 0.2F;
|
||||
|
@ -189,49 +161,39 @@ public class RitualExpulsion extends Ritual
|
|||
}
|
||||
}
|
||||
|
||||
public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z)
|
||||
{
|
||||
if (entityLiving != null && entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
if (entityLiving instanceof EntityPlayerMP)
|
||||
{
|
||||
public void moveEntityViaTeleport(EntityLivingBase entityLiving, double x, double y, double z) {
|
||||
if (entityLiving != null && entityLiving instanceof EntityPlayer) {
|
||||
if (entityLiving instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP) entityLiving;
|
||||
|
||||
if (entityplayermp.getEntityWorld() == entityLiving.getEntityWorld())
|
||||
{
|
||||
if (entityplayermp.getEntityWorld() == entityLiving.getEntityWorld()) {
|
||||
EnderTeleportEvent event = new EnderTeleportEvent(entityplayermp, x, y, z, 5.0F);
|
||||
|
||||
if (!MinecraftForge.EVENT_BUS.post(event))
|
||||
{
|
||||
if (entityLiving.isRiding())
|
||||
{
|
||||
if (!MinecraftForge.EVENT_BUS.post(event)) {
|
||||
if (entityLiving.isRiding()) {
|
||||
entityplayermp.mountEntityAndWakeUp();
|
||||
}
|
||||
entityLiving.setPositionAndUpdate(event.getTargetX(), event.getTargetY(), event.getTargetZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (entityLiving != null)
|
||||
{
|
||||
} else if (entityLiving != null) {
|
||||
entityLiving.setPosition(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshTime()
|
||||
{
|
||||
public int getRefreshTime() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRefreshCost()
|
||||
{
|
||||
public int getRefreshCost() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<RitualComponent> getComponents()
|
||||
{
|
||||
public ArrayList<RitualComponent> getComponents() {
|
||||
ArrayList<RitualComponent> components = new ArrayList<RitualComponent>();
|
||||
|
||||
this.addCornerRunes(components, 2, 0, EnumRuneType.EARTH);
|
||||
|
@ -275,8 +237,7 @@ public class RitualExpulsion extends Ritual
|
|||
}
|
||||
|
||||
@Override
|
||||
public Ritual getNewCopy()
|
||||
{
|
||||
public Ritual getNewCopy() {
|
||||
return new RitualExpulsion();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue