Run formatter
This commit is contained in:
parent
61c44a831b
commit
08258fd6ef
606 changed files with 13464 additions and 22975 deletions
src/main/java/WayofTime/bloodmagic/item/sigil
|
@ -1,42 +1,35 @@
|
|||
package WayofTime.bloodmagic.item.sigil;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import WayofTime.bloodmagic.api.util.helper.PlayerHelper;
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import WayofTime.bloodmagic.core.RegistrarBloodMagicBlocks;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class ItemSigilPhantomBridge extends ItemSigilToggleableBase
|
||||
{
|
||||
public class ItemSigilPhantomBridge extends ItemSigilToggleableBase {
|
||||
private Map<EntityPlayer, Pair<Double, Double>> prevPositionMap = new HashMap<EntityPlayer, Pair<Double, Double>>();
|
||||
private double expansionFactor = 2;
|
||||
private int range = 3;
|
||||
|
||||
public ItemSigilPhantomBridge()
|
||||
{
|
||||
public ItemSigilPhantomBridge() {
|
||||
super("phantomBridge", 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected)
|
||||
{
|
||||
public void onSigilUpdate(ItemStack stack, World world, EntityPlayer player, int itemSlot, boolean isSelected) {
|
||||
if (PlayerHelper.isFakePlayer(player))
|
||||
return;
|
||||
|
||||
if (!prevPositionMap.containsKey(player))
|
||||
{
|
||||
if (!prevPositionMap.containsKey(player)) {
|
||||
prevPositionMap.put(player, Pair.of(player.posX, player.posZ));
|
||||
}
|
||||
|
||||
if ((!player.onGround && !player.isRiding()) && !player.isSneaking())
|
||||
{
|
||||
if ((!player.onGround && !player.isRiding()) && !player.isSneaking()) {
|
||||
prevPositionMap.put(player, Pair.of(player.posX, player.posZ));
|
||||
return;
|
||||
}
|
||||
|
@ -52,8 +45,7 @@ public class ItemSigilPhantomBridge extends ItemSigilToggleableBase
|
|||
double playerVelZ = player.posZ - prevPosition.getRight();
|
||||
|
||||
double totalVel = Math.sqrt(playerVelX * playerVelX + playerVelZ * playerVelZ);
|
||||
if (totalVel > 2)
|
||||
{
|
||||
if (totalVel > 2) {
|
||||
//I am SURE you are teleporting!
|
||||
playerVelX = 0;
|
||||
playerVelZ = 0;
|
||||
|
@ -74,12 +66,9 @@ public class ItemSigilPhantomBridge extends ItemSigilToggleableBase
|
|||
int truncC = (int) C;
|
||||
|
||||
//TODO: Make this for-loop better.
|
||||
for (int ix = -truncC; ix <= truncC; ix++)
|
||||
{
|
||||
for (int iz = -truncC; iz <= truncC; iz++)
|
||||
{
|
||||
if (computeEllipse(ix + avgX, iz + avgZ, posX, posZ, offsetPosX, offsetPosZ) > C)
|
||||
{
|
||||
for (int ix = -truncC; ix <= truncC; ix++) {
|
||||
for (int iz = -truncC; iz <= truncC; iz++) {
|
||||
if (computeEllipse(ix + avgX, iz + avgZ, posX, posZ, offsetPosX, offsetPosZ) > C) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -93,8 +82,7 @@ public class ItemSigilPhantomBridge extends ItemSigilToggleableBase
|
|||
prevPositionMap.put(player, Pair.of(player.posX, player.posZ));
|
||||
}
|
||||
|
||||
public static double computeEllipse(double x, double z, double focusX1, double focusZ1, double focusX2, double focusZ2)
|
||||
{
|
||||
public static double computeEllipse(double x, double z, double focusX1, double focusZ1, double focusX2, double focusZ2) {
|
||||
return Math.sqrt((x - focusX1) * (x - focusX1) + (z - focusZ1) * (z - focusZ1)) + Math.sqrt((x - focusX2) * (x - focusX2) + (z - focusZ2) * (z - focusZ2));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue