Skip to content

Commit

Permalink
feat: update to 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed Jun 22, 2023
1 parent 623435d commit cc523a0
Show file tree
Hide file tree
Showing 56 changed files with 487 additions and 352 deletions.
77 changes: 35 additions & 42 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import org.apache.http.impl.client.HttpClients

buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = "https://repo.spongepowered.org/maven" }
//maven { url = 'https://sizableshrimp.me/maven' }
maven { url = "https://plugins.gradle.org/m2/" }
maven { url = "https://maven.parchmentmc.org" }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath(group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.+', changing: true)
classpath "org.spongepowered:mixingradle:0.7+"
classpath "org.apache.httpcomponents:httpmime:4.5.13"
classpath "org.parchmentmc:librarian:1.+"
Expand All @@ -31,9 +31,8 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: "java"
apply plugin: 'eclipse'
apply plugin: 'org.parchmentmc.librarian.forgegradle'
//apply plugin: 'maven-publish'
apply plugin: 'maven-publish'

// May be able to remove it
apply plugin: "org.spongepowered.mixin"

def branch = System.getenv("GITHUB_REF")
Expand Down Expand Up @@ -76,13 +75,14 @@ minecraft {
// stable_# Stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'official', version: '1.19.3'
mappings channel: 'official', version: '1.20.1'
//mappings channel: 'parchment', version: '2021.12.19-1.18.1'
//mappings channel: 'parchment', version: '2021.07.21-1.17'

// This is for personal local tests i was doing ignore it ;)
//mappings channel: 'snapshot', version: '20200706-unofficialtest-1.16.1'

// Readd if access transformers needed
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
Expand Down Expand Up @@ -130,7 +130,6 @@ minecraft {
data {
workingDirectory project.file('run')

forceExit false
// Recommended logging data for a userdev environment
property 'forge.logging.markers', ''
//property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
Expand All @@ -156,12 +155,12 @@ dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.19.3-44.1.5'
minecraft 'net.minecraftforge:forge:1.20.1-47.0.14'

implementation 'org.spongepowered:mixin:0.8.5'
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'

implementation fg.deobf("com.sekwah:SekCLib:0.4.3")
implementation fg.deobf("com.sekwah:SekCLib:[1.0.0,2)")
// Trick intellij to allow for better editing in here for the discord task
// compile "org.apache.httpcomponents:httpmime:4.5.13"
//implementation fg.deobf("curse.maven:torohealth-damage-indicators-245733:3556931")
Expand Down Expand Up @@ -197,7 +196,8 @@ mixin {
// Example for how to get properties into the manifest for reading by the runtime..
jar {
finalizedBy 'reobfJar'
classifier = 'universal'
archiveClassifier = 'universal'
archiveBaseName = "${archivesBaseName}${project.mc_version}"
manifest {
attributes([
"Specification-Title": project.modid,
Expand All @@ -207,7 +207,6 @@ jar {
"Implementation-Version": "${versionString}",
"Implementation-Vendor" :project.vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
"MixinConfigs": "mixins.${project.modid}.json"
])
}
}
Expand All @@ -225,36 +224,35 @@ def reobfArtifact = artifacts.add('default', reobfFile) {
task srcJar(type: Jar) {
build.dependsOn it
from sourceSets.main.allSource
classifier = 'sources'
baseName "${archivesBaseName}${project.mc_version}"
archiveClassifier = 'sources'
archiveBaseName = "${archivesBaseName}${project.mc_version}"
from file("LICENSE")
}

task deobfJar(type: Jar) {
build.dependsOn it
from sourceSets.main.output
classifier = 'deobf'
baseName "${archivesBaseName}${project.mc_version}"
archiveClassifier = 'deobf'
archiveBaseName = "${archivesBaseName}${project.mc_version}"
from file("LICENSE")
}

//publishing {
// publications {
// mavenJava(MavenPublication) {
// artifact reobfArtifact
// artifact srcJar
// artifact deobfJar
// }
// }
// repositories {
// maven {
// url "s3://sekwah-maven/"
// authentication {
// awsIm(AwsImAuthentication)
// }
// }
// }
//}
publishing {
publications {
mavenJava(MavenPublication) {
artifact reobfArtifact
artifact srcJar
}
}
repositories {
maven {
url "s3://sekwah-maven/"
authentication {
awsIm(AwsImAuthentication)
}
}
}
}

def getReleaseChangelog() {
def changelogFile = file('CHANGELOG.md')
Expand All @@ -274,7 +272,6 @@ task discordupload {
String discordWebhook = System.getenv("DISCORD_WEBHOOK")

if(discordWebhook != null) {
println("Logging Into Discord")

CloseableHttpClient httpClient = HttpClients.createDefault()
HttpPost uploadFile = new HttpPost(discordWebhook)
Expand All @@ -289,7 +286,9 @@ task discordupload {
"```")
}

builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, jar.archiveName)
var name = jar.archiveBaseName.get() + "-" + jar.archiveVersion.get() + ".jar"

builder.addBinaryBody("file", file(jar.archiveFile).newInputStream(), ContentType.APPLICATION_OCTET_STREAM, name)

HttpEntity multipart = builder.build()

Expand All @@ -314,11 +313,11 @@ curseforge {
}
project {
id = project.curse_project_id
// TODO add code to reference this but also cut the latest change logs in for the files
changelog = getReleaseChangelog()
changelogType = 'markdown'
releaseType = 'release'
addGameVersion '1.19.3'
addGameVersion '1.20'
addGameVersion '1.20.1'

relations {
requiredDependency 'sekclib'
Expand All @@ -331,20 +330,14 @@ curseforge {
}
}

gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xmaxerrs" << "100000"
}
}

// https://github.com/modrinth/minotaur
modrinth {
token = System.getenv("MODRINTH_TOKEN")
projectId = project.modrinth_slug
versionType = "release"
uploadFile = jar
additionalFiles = [srcJar, deobfJar]
gameVersions = ["1.19.3"]
gameVersions = ["1.20", "1.20.1"]
changelog = getReleaseChangelog()
dependencies {
required.project "sekclib" // Creates a new required dependency on Fabric API
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ org.gradle.daemon=false
title=Naruto Mod
archive=NarutoMod
# This is just for the jar outputs
mc_version=-1.19.3
mc_version=-1.20
modid=narutomod
package=com.sekwah
vendor=Sekwah
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
13 changes: 13 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}
2 changes: 2 additions & 0 deletions src/main/java/com/sekwah/narutomod/NarutoMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.sekwah.narutomod.entity.NarutoDataSerialisers;
import com.sekwah.narutomod.entity.NarutoEntities;
import com.sekwah.narutomod.gameevents.NarutoGameEvents;
import com.sekwah.narutomod.item.NarutoCreativeTabs;
import com.sekwah.narutomod.item.NarutoDispenseItemBehavior;
import com.sekwah.narutomod.item.NarutoItems;
import com.sekwah.narutomod.network.PacketHandler;
Expand Down Expand Up @@ -65,6 +66,7 @@ public NarutoMod() {
NarutoEntities.register(eventBus);
NarutoAbilities.register(eventBus);
NarutoGameEvents.register(eventBus);
NarutoCreativeTabs.register(eventBus);

DistExecutor.safeCallWhenOn(Dist.CLIENT, () -> NarutoInGameGUI::new);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)
ninjaData.scheduleDelayedTickEvent((delayedPlayer) -> {
Vec3 shootSpeed = player.getLookAngle();
FireballJutsuEntity fireball = new FireballJutsuEntity(player, shootSpeed.x, shootSpeed.y, shootSpeed.z);
player.getLevel().addFreshEntity(fireball);
player.getLevel().playSound(null, player, NarutoSounds.FIREBALL_SHOOT.get(), SoundSource.PLAYERS, 1f, 1.0f);
player.level().addFreshEntity(fireball);
player.level().playSound(null, player, NarutoSounds.FIREBALL_SHOOT.get(), SoundSource.PLAYERS, 1f, 1.0f);
}, 10);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)

Vec3 loc = ninjaData.getSubstitutionLoc();
double distance = loc != null ? player.position().distanceTo(loc) : 0;
if(loc != null && Math.round(distance) <= MAX_MARKER_DISTANCE && player.level.dimension().location().equals(ninjaData.getSubstitutionDimension())) {
if(loc != null && Math.round(distance) <= MAX_MARKER_DISTANCE && player.level().dimension().location().equals(ninjaData.getSubstitutionDimension())) {
spawnLogAt(player, player.position(), ninjaData);
player.teleportTo(loc.x, loc.y - 2, loc.z);
ninjaData.setSubstitutionLoc(null, null);
Expand All @@ -71,18 +71,18 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)
}
}
} else {
ninjaData.setSubstitutionLoc(player.position().add(0, 2, 0), player.level.dimension().location());
ninjaData.setSubstitutionLoc(player.position().add(0, 2, 0), player.level().dimension().location());
// Mark
}
}

public void spawnLogAt(Player player, Vec3 pos, INinjaData ninjaData) {
ninjaData.setInvisibleTicks(5);
player.addEffect(new MobEffectInstance(MobEffects.INVISIBILITY, 5, 0, false, false));
SubstitutionLogEntity log = new SubstitutionLogEntity(player.level);
SubstitutionLogEntity log = new SubstitutionLogEntity(player.level());
log.setPos(pos.add(0, 1, 0));
player.level.addFreshEntity(log);
if(player.level instanceof ServerLevel serverLevel) {
player.level().addFreshEntity(log);
if(player.level() instanceof ServerLevel serverLevel) {
serverLevel.sendParticles(ParticleTypes.CLOUD,
pos.x,
pos.y + (player.getBbHeight() / 2),
Expand All @@ -95,7 +95,7 @@ public void spawnLogAt(Player player, Vec3 pos, INinjaData ninjaData) {
public boolean randomTeleportPlayer(Player player, INinjaData ninjaData) {
for(int i = 0; i < 16; i++) {
double x = player.getX() + (player.getRandom().nextDouble() - 0.5D) * 25.0D;
double y = Mth.clamp(player.getY() + (double)(player.getRandom().nextInt(16) - 8), player.level.getMinBuildHeight(), (player.level.getMinBuildHeight() + ((ServerLevel)player.level).getLogicalHeight() - 1));
double y = Mth.clamp(player.getY() + (double)(player.getRandom().nextInt(16) - 8), player.level().getMinBuildHeight(), (player.level().getMinBuildHeight() + ((ServerLevel)player.level()).getLogicalHeight() - 1));
double z = player.getZ() + (player.getRandom().nextDouble() - 0.5D) * 25.0D;
if(Math.sqrt(player.distanceToSqr(x, y, z)) >= 10 && player.randomTeleport(x, y, z, false)) {
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)
Vec3 shootSpeed = player.getLookAngle();
WaterBulletJutsuEntity waterBullet = new WaterBulletJutsuEntity(player, shootSpeed.x, shootSpeed.y, shootSpeed.z);
waterBullet.setYRot(player.getYRot() - 180);
player.getLevel().addFreshEntity(waterBullet);
player.getLevel().playSound(null, player, NarutoSounds.WATER_BULLET_SHOOT.get(), SoundSource.PLAYERS, 1f, 1.0f);
player.level().addFreshEntity(waterBullet);
player.level().playSound(null, player, NarutoSounds.WATER_BULLET_SHOOT.get(), SoundSource.PLAYERS, 1f, 1.0f);
}, 10 + i * 15);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)

@Override
public void handleChannelling(Player player, INinjaData ninjaData, int ticksChanneled) {
if(player.isSprinting() || !player.isOnGround()) {
if(player.isSprinting() || !player.onGround()) {
ninjaData.addChakra(0.2f);
} else {
ninjaData.addChakra(1f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)
ninjaData.useChakra(CHAKRA_COST, 30);
ninjaData.useStamina(STAMINA_COST, 40);

if(player.level instanceof ServerLevel serverLevel) {
if(player.level() instanceof ServerLevel serverLevel) {
serverLevel.sendParticles(ParticleTypes.CLOUD,
player.getX(),
player.getY() + 0.1f,
Expand All @@ -56,9 +56,9 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)
ninjaData.getDoubleJumpData().canDoubleJumpServer = false;
player.fallDistance = 0;

player.getLevel().playSound(null,
player.level().playSound(null,
player, NarutoSounds.DOUBLE_JUMP.get(), SoundSource.PLAYERS, 1f, 1.0f);

player.getLevel().gameEvent(player, NarutoGameEvents.DOUBLE_JUMP.get(), player.position());
player.level().gameEvent(player, NarutoGameEvents.DOUBLE_JUMP.get(), player.position());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public SoundEvent castingFailSound() {

@Override
public boolean handleCost(Player player, INinjaData ninjaData, int chargeAmount) {
if(!player.isOnGround()) {
if(!player.onGround()) {
player.displayClientMessage(Component.translatable("jutsu.fail.notonground", Component.translatable("jutsu.leap").withStyle(ChatFormatting.YELLOW)), true);
return false;
}
Expand All @@ -53,8 +53,8 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)
float horScale = 2.41f;
PlayerUtil.setVelocity(player, lookVector.x * horScale, (lookVector.y * 0.6 + 0.8F)
, lookVector.z * horScale, true);
player.getLevel().playSound(null,
player.level().playSound(null,
player, NarutoSounds.LEAP.get(), SoundSource.PLAYERS, 0.5f, 1.0f);
player.getLevel().gameEvent(player, NarutoGameEvents.LEAP.get(), player.position());
player.level().gameEvent(player, NarutoGameEvents.LEAP.get(), player.position());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ public WaterChecks checkSteadyNormalFastPush(Player player) {
int blockX = (int)Math.floor(player.getX());
int blockZ = (int)Math.floor(player.getZ());
final int block1 = (int) Math.round(player.getY() - 0.56f);
boolean steadyCheck = triggerWaterWalk(player.level, new BlockPos(blockX, block1, blockZ));
boolean steadyCheck = triggerWaterWalk(player.level(), new BlockPos(blockX, block1, blockZ));

int block2 = (int) Math.round(player.getY());
int beforeBlock2 = (int) Math.round(player.yo);
boolean pushUpFast = triggerWaterWalk(player.level, new BlockPos(blockX, block2, blockZ));
if(player.level.isClientSide() && player.yo > player.getY()) {
boolean beforeYCheck = triggerWaterWalk(player.level, new BlockPos(blockX, beforeBlock2, blockZ));
boolean pushUpFast = triggerWaterWalk(player.level(), new BlockPos(blockX, block2, blockZ));
if(player.level().isClientSide() && player.yo > player.getY()) {
boolean beforeYCheck = triggerWaterWalk(player.level(), new BlockPos(blockX, beforeBlock2, blockZ));
if(!beforeYCheck && steadyCheck && player.yo - player.getY() < 0.9f) {
Vec3 vec = player.getDeltaMovement();
player.lerpMotion(vec.x(), 0, vec.z());
Expand All @@ -82,7 +82,7 @@ public WaterChecks checkSteadyNormalFastPush(Player player) {
}

int block3 = (int) Math.round(player.getY() - 0.47f);
boolean pushUpNormal = triggerWaterWalk(player.level, new BlockPos(blockX, block3, blockZ));
boolean pushUpNormal = triggerWaterWalk(player.level(), new BlockPos(blockX, block3, blockZ));

return new WaterChecks(steadyCheck, pushUpFast, pushUpNormal);
}
Expand Down Expand Up @@ -127,7 +127,7 @@ else if (checks.pushUpNormal) {
public boolean triggerWaterWalk(Level level, BlockPos blockPos) {
FluidState fluidState = level.getFluidState(blockPos);
BlockState blockState = level.getBlockState(blockPos);
return (fluidState.is(Fluids.WATER) || fluidState.is(Fluids.FLOWING_WATER)) && !blockState.getMaterial().blocksMotion();
return (fluidState.is(Fluids.WATER) || fluidState.is(Fluids.FLOWING_WATER)) && !blockState.blocksMotion();
}

@Override
Expand Down
Loading

0 comments on commit cc523a0

Please sign in to comment.