mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-15 17:45:08 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3ef15ad081 | ||
|
|
1d92c0dd7f | ||
|
|
13d6533edc | ||
|
|
a4373ebe5c | ||
|
|
f91de79376 | ||
|
|
567cd3e78b | ||
|
|
84e23b3e8e | ||
|
|
eba2bf1f86 | ||
|
|
47bd83e29e | ||
|
|
f7b49fccdd |
No files matched your search
+21
-39
@@ -1,4 +1,4 @@
|
||||
//version: 1695323114
|
||||
//version: 1690104383
|
||||
/*
|
||||
DO NOT CHANGE THIS FILE!
|
||||
Also, you may replace this file at any time if there is an update available.
|
||||
@@ -69,7 +69,7 @@ plugins {
|
||||
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
|
||||
id 'com.modrinth.minotaur' version '2.+' apply false
|
||||
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
|
||||
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.21'
|
||||
}
|
||||
|
||||
print("You might want to check out './gradlew :faq' if your build fails.\n")
|
||||
@@ -401,13 +401,9 @@ if (identifiedVersion == versionOverride) {
|
||||
|
||||
group = "com.github.GTNewHorizons"
|
||||
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||
base {
|
||||
archivesName = customArchiveBaseName
|
||||
}
|
||||
archivesBaseName = customArchiveBaseName
|
||||
} else {
|
||||
base {
|
||||
archivesName = modId
|
||||
}
|
||||
archivesBaseName = modId
|
||||
}
|
||||
|
||||
|
||||
@@ -562,6 +558,9 @@ repositories {
|
||||
maven {
|
||||
name 'Overmind forge repo mirror'
|
||||
url 'https://gregtech.overminddl1.com/'
|
||||
mavenContent {
|
||||
excludeGroup("net.minecraftforge") // missing the `universal` artefact
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "GTNH Maven"
|
||||
@@ -600,10 +599,15 @@ repositories {
|
||||
}
|
||||
maven {
|
||||
name = "ic2"
|
||||
url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/")
|
||||
content {
|
||||
includeGroup "net.industrial-craft"
|
||||
url = "https://maven.ic2.player.to/"
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
}
|
||||
}
|
||||
maven {
|
||||
name = "ic2-mirror"
|
||||
url = "https://maven2.ic2.player.to/"
|
||||
metadataSources {
|
||||
mavenPom()
|
||||
artifact()
|
||||
@@ -623,8 +627,6 @@ def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}
|
||||
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
|
||||
ext.mixinProviderSpec = mixinProviderSpec
|
||||
|
||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||
|
||||
dependencies {
|
||||
if (usesMixins.toBoolean()) {
|
||||
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
|
||||
@@ -636,7 +638,7 @@ dependencies {
|
||||
}
|
||||
}
|
||||
if (usesMixins.toBoolean()) {
|
||||
implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
|
||||
implementation(modUtils.enableMixins(mixinProviderSpec))
|
||||
} else if (forceEnableMixins.toBoolean()) {
|
||||
runtimeOnlyNonPublishable(mixinProviderSpec)
|
||||
}
|
||||
@@ -689,6 +691,8 @@ if (file('dependencies.gradle.kts').exists()) {
|
||||
throw new RuntimeException("Missing dependencies.gradle[.kts]")
|
||||
}
|
||||
|
||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||
|
||||
tasks.register('generateAssets') {
|
||||
group = "GTNH Buildscript"
|
||||
description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed"
|
||||
@@ -771,10 +775,10 @@ dependencies {
|
||||
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
|
||||
}
|
||||
if (modId != 'hodgepodge') {
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.26')
|
||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.19')
|
||||
}
|
||||
|
||||
java17PatchDependencies('net.minecraft:launchwrapper:1.17.2') {transitive = false}
|
||||
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
|
||||
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
|
||||
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
|
||||
@@ -1144,10 +1148,7 @@ tasks.named("processIdeaSettings").configure {
|
||||
|
||||
tasks.named("ideVirtualMainClasses").configure {
|
||||
// Make IntelliJ "Build project" build the mod jars
|
||||
dependsOn("jar", "reobfJar")
|
||||
if (!disableSpotless) {
|
||||
dependsOn("spotlessCheck")
|
||||
}
|
||||
dependsOn("jar", "reobfJar", "spotlessCheck")
|
||||
}
|
||||
|
||||
// workaround variable hiding in pom processing
|
||||
@@ -1571,25 +1572,6 @@ def getSecondaryArtifacts() {
|
||||
return secondaryArtifacts
|
||||
}
|
||||
|
||||
def getURL(String main, String fallback) {
|
||||
return pingURL(main, 10000) ? main : fallback
|
||||
}
|
||||
|
||||
// credit: https://stackoverflow.com/a/3584332
|
||||
def pingURL(String url, int timeout) {
|
||||
url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates.
|
||||
try {
|
||||
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection()
|
||||
connection.setConnectTimeout(timeout)
|
||||
connection.setReadTimeout(timeout)
|
||||
connection.setRequestMethod("HEAD")
|
||||
int responseCode = connection.getResponseCode()
|
||||
return 200 <= responseCode && responseCode <= 399
|
||||
} catch (IOException ignored) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// For easier scripting of things that require variables defined earlier in the buildscript
|
||||
if (file('addon.late.gradle.kts').exists()) {
|
||||
apply from: 'addon.late.gradle.kts'
|
||||
|
||||
+8
-8
@@ -1,22 +1,22 @@
|
||||
// Add your dependencies here
|
||||
|
||||
dependencies {
|
||||
api('com.github.GTNewHorizons:EnderCore:0.2.17:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.4.2-GTNH:dev')
|
||||
api('com.github.GTNewHorizons:EnderCore:0.2.16:dev')
|
||||
implementation('com.github.GTNewHorizons:ForestryMC:4.6.13:dev')
|
||||
implementation('com.github.GTNewHorizons:NotEnoughItems:2.3.76-GTNH:dev')
|
||||
implementation("com.github.GTNewHorizons:GTNHLib:0.0.13:dev")
|
||||
api('com.github.GTNewHorizons:BuildCraft:7.1.36:dev')
|
||||
api('curse.maven:cofh-lib-220333:2388748') // https://www.curseforge.com/minecraft/mc-mods/cofh-lib/files/2388748
|
||||
shadowImplementation('cglib:cglib-nodep:3.3.0')
|
||||
|
||||
compileOnly('com.github.GTNewHorizons:waila:1.6.0:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-256-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-240-GTNH:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Baubles:1.0.1.16:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.19:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.15.0:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.43.140:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Railcraft:9.14.6:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:StorageDrawers:1.12.0-GTNH:api') {transitive = false}
|
||||
implementation('com.github.GTNewHorizons:Chisel:2.11.4-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.15-GTNH:api') {transitive = false}
|
||||
implementation('com.github.GTNewHorizons:Chisel:2.11.3-GTNH:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.9.12-GTNH:api') {transitive = false}
|
||||
compileOnly('curse.maven:minefactory-reloaded-66672:2366150') // https://www.curseforge.com/minecraft/mc-mods/minefactory-reloaded/files/2366150
|
||||
compileOnly('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev')
|
||||
compileOnly('curse.maven:ee3-65509:2305023') // https://www.curseforge.com/minecraft/mc-mods/ee3/files/2305023
|
||||
|
||||
@@ -84,6 +84,8 @@ public final class Config {
|
||||
public static boolean reinforcedObsidianEnabled = true;
|
||||
public static boolean reinforcedObsidianUseDarkSteelBlocks = false;
|
||||
|
||||
public static boolean enforceOfflinePlayerUUID = false;
|
||||
|
||||
public static boolean useAlternateBinderRecipe = false;
|
||||
|
||||
public static boolean useAlternateTesseractModel = false;
|
||||
@@ -1035,6 +1037,13 @@ public final class Config {
|
||||
"Enable per tick sampling on individual power inputs and outputs. This allows slightly more detailed messages from the RF Reader but has a negative impact on server performance.")
|
||||
.getBoolean(detailedPowerTrackingEnabled);
|
||||
|
||||
enforceOfflinePlayerUUID = config.get(
|
||||
sectionAdvanced.name,
|
||||
"enforceOfflinePlayerUUID",
|
||||
false,
|
||||
"Enforces to use the players offline UUID. Recommendet to use before creating your world, otherwise it might breaks all secuity related things.")
|
||||
.getBoolean(enforceOfflinePlayerUUID);
|
||||
|
||||
useSneakMouseWheelYetaWrench = config.get(
|
||||
sectionPersonal.name,
|
||||
"useSneakMouseWheelYetaWrench",
|
||||
|
||||
@@ -111,55 +111,42 @@ public class TravelController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the error message, or null if the packet is valid.
|
||||
*/
|
||||
public String validatePacketTravelEvent(EntityPlayerMP toTp, int x, int y, int z, int powerUse,
|
||||
public boolean validatePacketTravelEvent(EntityPlayerMP toTp, int x, int y, int z, int powerUse,
|
||||
boolean conserveMotion, TravelSource source) {
|
||||
BlockCoord target = new BlockCoord(x, y, z);
|
||||
double dist = getDistanceSquared(toTp, target);
|
||||
// allow 15% overshoot to account for rounding
|
||||
if (dist * 100 > source.getMaxDistanceTravelledSq() * 115) return "dist check fail";
|
||||
// allow 4 blocks of c/s player pos desync
|
||||
if (getPower(toTp, source, target, -4F) > powerUse) return "power use too little";
|
||||
if (dist * 100 > source.getMaxDistanceTravelledSq() * 115) return false;
|
||||
if (powerUse < getRequiredPower(toTp, source, target)) return false;
|
||||
ItemStack equippedItem = toTp.getCurrentEquippedItem();
|
||||
switch (source) {
|
||||
case TELEPAD:
|
||||
// this source is invalid for this type of packet
|
||||
return "invalid travel source";
|
||||
return false;
|
||||
case BLOCK:
|
||||
// this source is only triggered when player is on any active travel anchor
|
||||
BlockCoord on = getActiveTravelBlock(toTp);
|
||||
if (on == null) return "on anchor is null";
|
||||
if (on == null) return false;
|
||||
// target must be a valid selectedCoord
|
||||
// selectedCoord can either be a block right above/below when the player is on anchor...
|
||||
if (on.x == x && on.z == z) return null;
|
||||
if (on.x == x && on.z == z) return true;
|
||||
// or another anchor
|
||||
TileEntity maybeAnchor = target.getTileEntity(toTp.worldObj);
|
||||
if (!(maybeAnchor instanceof ITravelAccessable)) return "not anchor";
|
||||
if (!(maybeAnchor instanceof ITravelAccessable)) return false;
|
||||
ITravelAccessable anchor = (ITravelAccessable) maybeAnchor;
|
||||
if (!anchor.canBlockBeAccessed(toTp) && isValidTarget(toTp, target, TravelSource.BLOCK)) {
|
||||
return "not valid target";
|
||||
}
|
||||
return null;
|
||||
return anchor.canBlockBeAccessed(toTp) || !isValidTarget(toTp, target, TravelSource.BLOCK);
|
||||
case STAFF:
|
||||
case STAFF_BLINK:
|
||||
if (equippedItem == null || !(equippedItem.getItem() instanceof IItemOfTravel)) return "not staff";
|
||||
if (!((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) return "staff not active";
|
||||
if (equippedItem == null || !(equippedItem.getItem() instanceof IItemOfTravel)) return false;
|
||||
if (!((IItemOfTravel) equippedItem.getItem()).isActive(toTp, equippedItem)) return false;
|
||||
int energy = ((IItemOfTravel) equippedItem.getItem()).canExtractInternal(equippedItem, powerUse);
|
||||
if (energy != -1 && energy != powerUse) {
|
||||
return "not enough power";
|
||||
}
|
||||
return null;
|
||||
return energy == -1 || energy == powerUse;
|
||||
case TELEPORT_STAFF_BLINK:
|
||||
case TELEPORT_STAFF:
|
||||
// tp staff is creative version of traveling staff
|
||||
// no energy check or anything else needed
|
||||
// but the player must actually be equipped with one of these
|
||||
if (equippedItem != null && equippedItem.getItem() instanceof ItemTeleportStaff) {
|
||||
return null;
|
||||
}
|
||||
return "not staff";
|
||||
return equippedItem != null && equippedItem.getItem() instanceof ItemTeleportStaff;
|
||||
default:
|
||||
throw new AssertionError("unidentified travel source");
|
||||
}
|
||||
@@ -675,7 +662,7 @@ public class TravelController {
|
||||
}
|
||||
int requiredPower;
|
||||
ItemStack staff = player.getCurrentEquippedItem();
|
||||
requiredPower = getPower(player, source, coord, 0F);
|
||||
requiredPower = (int) (getDistance(player, coord) * source.getPowerCostPerBlockTraveledRF());
|
||||
int canUsePower = getEnergyInTravelItem(staff);
|
||||
if (requiredPower > canUsePower) {
|
||||
// make sure chat is sent only once per trial
|
||||
@@ -688,10 +675,6 @@ public class TravelController {
|
||||
return requiredPower;
|
||||
}
|
||||
|
||||
private int getPower(EntityPlayer player, TravelSource source, BlockCoord coord, float distanceWavier) {
|
||||
return (int) ((getDistance(player, coord) + distanceWavier) * source.getPowerCostPerBlockTraveledRF());
|
||||
}
|
||||
|
||||
private boolean isInRangeTarget(EntityPlayer player, BlockCoord bc, float maxSq) {
|
||||
return getDistanceSquared(player, bc) <= maxSq;
|
||||
}
|
||||
|
||||
@@ -83,14 +83,12 @@ public class PacketTravelEvent implements IMessage, IMessageHandler<PacketTravel
|
||||
|
||||
TravelSource source = TravelSource.values()[message.source];
|
||||
|
||||
String error = TravelController.instance
|
||||
.validatePacketTravelEvent(toTp, x, y, z, message.powerUse, message.conserveMotion, source);
|
||||
if (error != null) {
|
||||
if (!TravelController.instance
|
||||
.validatePacketTravelEvent(toTp, x, y, z, message.powerUse, message.conserveMotion, source)) {
|
||||
Log.LOGGER.warn(
|
||||
Log.securityMarker,
|
||||
"Player {} tried to tp without valid prereq: {}",
|
||||
ctx.getServerHandler().playerEntity.getGameProfile(),
|
||||
error);
|
||||
"Player {} tried to tp without valid prereq.",
|
||||
ctx.getServerHandler().playerEntity.getGameProfile());
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.common.UsernameCache;
|
||||
|
||||
import com.enderio.core.common.util.PlayerUtil;
|
||||
@@ -13,6 +14,7 @@ import com.google.common.base.Charsets;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import crazypants.enderio.Log;
|
||||
import crazypants.enderio.config.Config;
|
||||
|
||||
public class UserIdent {
|
||||
|
||||
@@ -76,7 +78,7 @@ public class UserIdent {
|
||||
* changes, implement them and write a log message.
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nonnull String suuid, @Nullable String playerName) {
|
||||
if (NONE_MARKER.equals(suuid)) {
|
||||
if (NONE_MARKER.equals(suuid) || Config.enforceOfflinePlayerUUID) {
|
||||
return new UserIdent(null, playerName);
|
||||
}
|
||||
try {
|
||||
@@ -110,8 +112,7 @@ public class UserIdent {
|
||||
*/
|
||||
public static @Nonnull UserIdent create(@Nullable GameProfile gameProfile) {
|
||||
if (gameProfile != null && (gameProfile.getId() != null || gameProfile.getName() != null)) {
|
||||
if (gameProfile.getId() != null && gameProfile.getName() != null
|
||||
&& gameProfile.getId().equals(offlineUUID(gameProfile.getName()))) {
|
||||
if (gameProfile.getName() != null && (Config.enforceOfflinePlayerUUID || !isOnlineMode())) {
|
||||
return new UserIdent(null, gameProfile.getName());
|
||||
} else {
|
||||
return new UserIdent(gameProfile.getId(), gameProfile.getName());
|
||||
@@ -121,6 +122,11 @@ public class UserIdent {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isOnlineMode() {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
return server != null ? server.isServerInOnlineMode() : true;
|
||||
}
|
||||
|
||||
private static @Nonnull UUID offlineUUID(String playerName) {
|
||||
UUID result = UUID.nameUUIDFromBytes(("OfflinePlayer:" + playerName).getBytes(Charsets.UTF_8));
|
||||
return result != null ? result : new UUID(-1, -1);
|
||||
@@ -221,6 +227,9 @@ public class UserIdent {
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof UUID) {
|
||||
return getUUID().equals(obj);
|
||||
}
|
||||
return this == obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user