Fixed freezing when looking straight up/down or perfectly horizontal. Removed updateJSONURL in mods.toml. (8-6-2020)
This commit is contained in:
@@ -13,7 +13,7 @@ apply plugin: 'net.minecraftforge.gradle'
|
|||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
version = '1.14.4-2.18'
|
version = '1.14.4-2.19'
|
||||||
group = 'nl.requios.effortlessbuilding' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
group = 'nl.requios.effortlessbuilding' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
archivesBaseName = 'effortlessbuilding'
|
archivesBaseName = 'effortlessbuilding'
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class EffortlessBuilding
|
|||||||
{
|
{
|
||||||
public static final String MODID = "effortlessbuilding";
|
public static final String MODID = "effortlessbuilding";
|
||||||
public static final String NAME = "Effortless Building";
|
public static final String NAME = "Effortless Building";
|
||||||
public static final String VERSION = "1.14.4-2.18";
|
public static final String VERSION = "1.14.4-2.19";
|
||||||
|
|
||||||
public static EffortlessBuilding instance;
|
public static EffortlessBuilding instance;
|
||||||
|
|
||||||
|
|||||||
@@ -229,6 +229,31 @@ public class BuildModes {
|
|||||||
return new Vec3d(x, y, z);
|
return new Vec3d(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Use this instead of player.getLookVec() in any buildmodes code
|
||||||
|
public static Vec3d getPlayerLookVec(PlayerEntity player){
|
||||||
|
Vec3d lookVec = player.getLookVec();
|
||||||
|
double x = lookVec.x;
|
||||||
|
double y = lookVec.y;
|
||||||
|
double z = lookVec.z;
|
||||||
|
|
||||||
|
//Further calculations (findXBound etc) don't like any component being 0 or 1 (e.g. dividing by 0)
|
||||||
|
//isCriteriaValid below will take up to 2 minutes to raytrace blocks towards infinity if that is the case
|
||||||
|
//So make sure they are close to but never exactly 0 or 1
|
||||||
|
if (Math.abs(x) < 0.0001) x = 0.0001;
|
||||||
|
if (Math.abs(x - 1.0) < 0.0001) x = 0.9999;
|
||||||
|
if (Math.abs(x + 1.0) < 0.0001) x = -0.9999;
|
||||||
|
|
||||||
|
if (Math.abs(y) < 0.0001) y = 0.0001;
|
||||||
|
if (Math.abs(y - 1.0) < 0.0001) y = 0.9999;
|
||||||
|
if (Math.abs(y + 1.0) < 0.0001) y = -0.9999;
|
||||||
|
|
||||||
|
if (Math.abs(z) < 0.0001) z = 0.0001;
|
||||||
|
if (Math.abs(z - 1.0) < 0.0001) z = 0.9999;
|
||||||
|
if (Math.abs(z + 1.0) < 0.0001) z = -0.9999;
|
||||||
|
|
||||||
|
return new Vec3d(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isCriteriaValid(Vec3d start, Vec3d look, int reach, PlayerEntity player, boolean skipRaytrace, Vec3d lineBound, Vec3d planeBound, double distToPlayerSq) {
|
public static boolean isCriteriaValid(Vec3d start, Vec3d look, int reach, PlayerEntity player, boolean skipRaytrace, Vec3d lineBound, Vec3d planeBound, double distToPlayerSq) {
|
||||||
boolean intersects = false;
|
boolean intersects = false;
|
||||||
if (!skipRaytrace) {
|
if (!skipRaytrace) {
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public abstract class ThreeClicksBuildMode extends BaseBuildMode {
|
|||||||
|
|
||||||
//Finds height after floor has been chosen in buildmodes with 3 clicks
|
//Finds height after floor has been chosen in buildmodes with 3 clicks
|
||||||
public static BlockPos findHeight(PlayerEntity player, BlockPos secondPos, boolean skipRaytrace) {
|
public static BlockPos findHeight(PlayerEntity player, BlockPos secondPos, boolean skipRaytrace) {
|
||||||
Vec3d look = player.getLookVec();
|
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||||
|
|
||||||
List<HeightCriteria> criteriaList = new ArrayList<>(3);
|
List<HeightCriteria> criteriaList = new ArrayList<>(3);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||||
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class Floor extends TwoClicksBuildMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BlockPos findFloor(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
public static BlockPos findFloor(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
||||||
Vec3d look = player.getLookVec();
|
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||||
|
|
||||||
List<Criteria> criteriaList = new ArrayList<>(3);
|
List<Criteria> criteriaList = new ArrayList<>(3);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package nl.requios.effortlessbuilding.buildmode.buildmodes;
|
|||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import nl.requios.effortlessbuilding.EffortlessBuilding;
|
||||||
import nl.requios.effortlessbuilding.buildmode.BuildModes;
|
import nl.requios.effortlessbuilding.buildmode.BuildModes;
|
||||||
import nl.requios.effortlessbuilding.buildmode.TwoClicksBuildMode;
|
import nl.requios.effortlessbuilding.buildmode.TwoClicksBuildMode;
|
||||||
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
import nl.requios.effortlessbuilding.helper.ReachHelper;
|
||||||
@@ -60,7 +61,7 @@ public class Line extends TwoClicksBuildMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BlockPos findLine(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
public static BlockPos findLine(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
||||||
Vec3d look = player.getLookVec();
|
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||||
|
|
||||||
List<Criteria> criteriaList = new ArrayList<>(3);
|
List<Criteria> criteriaList = new ArrayList<>(3);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class Wall extends TwoClicksBuildMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static BlockPos findWall(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
public static BlockPos findWall(PlayerEntity player, BlockPos firstPos, boolean skipRaytrace) {
|
||||||
Vec3d look = player.getLookVec();
|
Vec3d look = BuildModes.getPlayerLookVec(player);
|
||||||
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
Vec3d start = new Vec3d(player.posX, player.posY + player.getEyeHeight(), player.posZ);
|
||||||
|
|
||||||
List<Criteria> criteriaList = new ArrayList<>(3);
|
List<Criteria> criteriaList = new ArrayList<>(3);
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ version="${file.jarVersion}" #mandatory
|
|||||||
# A display name for the mod
|
# A display name for the mod
|
||||||
displayName="Effortless Building" #mandatory
|
displayName="Effortless Building" #mandatory
|
||||||
# A URL to query for updates for this mod. See the JSON update specification <here>
|
# A URL to query for updates for this mod. See the JSON update specification <here>
|
||||||
updateJSONURL="http://myurl.me/" #optional
|
#updateJSONURL="example.com" #optional
|
||||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||||
displayURL="https://minecraft.curseforge.com/projects/effortless-building" #optional
|
displayURL="https://minecraft.curseforge.com/projects/effortless-building" #optional
|
||||||
# A file name (in the root of the mod JAR) containing a logo for display
|
# A file name (in the root of the mod JAR) containing a logo for display
|
||||||
|
|||||||
Reference in New Issue
Block a user