Skip to content

Commit

Permalink
removed biome check for end citys because spigot idk
Browse files Browse the repository at this point in the history
added credential management for dev
  • Loading branch information
19MisterX98 committed Nov 25, 2020
1 parent 92d031f commit 57bbfce
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ run/
logs/

src/main/java/kaptainwutax/stronghold/

credentials.properties
7 changes: 7 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,10 @@ publishing {
// mavenLocal()
}
}
project.ext.credentials = new Properties()
try {
project.ext.credentials.load(new FileReader(file('credentials.properties')))
} catch (IOException ignore) {
}

apply from: 'setupRealMcAccount.gradle'
2 changes: 2 additions & 0 deletions credentials.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minecraftUser=your user+pass
minecraftPass=in dev env
80 changes: 80 additions & 0 deletions setupRealMcAccount.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* To use your real account in the IDE, do the following:
* - Create a credentials.properties file in the root project directory if it doesn't already exist (it is ignored by the gitignore)
* - Insert minecraftUser=youremail@example.com and minecraftPass=yourminecraftpassword into the credentials file
* - Duplicate the Minecraft Client run configuration in your IDE. Configure it to run the setupRealMcAccount gradle task after build but before run
*/

buildscript {
repositories {
mavenCentral()
maven {
url 'https://libraries.minecraft.net/'
}
}
dependencies {
classpath 'com.mojang:authlib:2.0.27'
}
}

import com.google.gson.GsonBuilder
import com.mojang.authlib.Agent
import com.mojang.authlib.properties.PropertyMap
import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService

task setupRealMcAccount {
group = 'ide'
doLast {
def username = project.ext.credentials['minecraftUser']
def password = project.ext.credentials['minecraftPass']
def auth = new YggdrasilAuthenticationService(Proxy.NO_PROXY, '1').createUserAuthentication(Agent.MINECRAFT)
auth.username = username
auth.password = password
auth.logIn()
def accessToken = auth.authenticatedToken
def uuid = auth.selectedProfile.id.toString().replace('-', '')
username = auth.selectedProfile.name
def userType = auth.userType.name
def userProperties = new GsonBuilder().registerTypeAdapter(PropertyMap, new PropertyMap.Serializer()).create().toJson(auth.userProperties)

def categories = [:]
def category
minecraft.devLauncherConfig.eachLine { line ->
if (!line.empty && Character.isWhitespace(line.charAt(0))) {
category << line.trim()
} else {
category = []
categories[line] = category
}
}
def clientArgs = categories['clientArgs']

for (def i = 0; i < clientArgs.size(); i += 2) {
if (clientArgs[i] == '--accessToken' || clientArgs[i] == '--uuid' || clientArgs[i] == '--username' || clientArgs[i] == '--userType' || clientArgs[i] == '--userProperties') {
clientArgs.remove(i)
clientArgs.remove(i)
i -= 2
}
}

clientArgs << '--accessToken'
clientArgs << accessToken
clientArgs << '--uuid'
clientArgs << uuid
clientArgs << '--username'
clientArgs << username
clientArgs << '--userType'
clientArgs << userType
clientArgs << '--userProperties'
clientArgs << userProperties

def pw = minecraft.devLauncherConfig.newPrintWriter()
for (def ctgy : categories.keySet()) {
pw.println ctgy
for (def val : categories[ctgy]) {
pw.println('\t' + val)
}
}
pw.flush()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ private void buildStructure(PieceFinder finder) {
public List<BlockPos> findInChunk() {
Biome biome = this.world.getBiomeForNoiseGen((this.chunkPos.x << 2) + 2, 0, (this.chunkPos.z << 2) + 2);

if(!biome.getGenerationSettings().hasStructureFeature(StructureFeature.END_CITY)) {
return new ArrayList<>();
}

Map<PieceFinder, List<BlockPos>> result = this.findInChunkPieces();
List<BlockPos> combinedResult = new ArrayList<>();

Expand Down

0 comments on commit 57bbfce

Please sign in to comment.