Skip to content

Commit

Permalink
Update to MC 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Feb 4, 2024
1 parent 3fae35d commit 20cb7ef
Show file tree
Hide file tree
Showing 25 changed files with 151 additions and 146 deletions.
37 changes: 16 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
// For those who want the bleeding edge
buildscript {
repositories {
mavenCentral()
maven { url = 'https://maven.minecraftforge.net' }
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}

plugins {
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'com.github.kt3k.coveralls' version '2.12.0'
id 'com.diffplug.spotless' version '5.14.3'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'com.github.johnrengelman.shadow' version '8.1.1'
id 'com.modrinth.minotaur' version '2.+'
}

Expand Down Expand Up @@ -117,7 +107,9 @@ dependencies {

modLib "org.graalvm.sdk:graal-sdk:22.3.2"
shadow "org.graalvm.sdk:graal-sdk:22.3.2"
modLib "org.graalvm.js:js:22.3.2"
modLib ("org.graalvm.js:js:22.3.2") {
exclude group: 'com.ibm.icu', module: 'icu4j'
}
shadow "org.graalvm.js:js:22.3.2"


Expand Down Expand Up @@ -187,6 +179,7 @@ else
version = "${project.minecraft_version}-${project.mod_version}-${build_number}"

jar {
archiveClassifier.set('slim')
manifest {
attributes([
"Specification-Title": "${project.name}",
Expand All @@ -199,7 +192,6 @@ jar {
])
}
}
jar.finalizedBy('reobfShadowJar')

task signJar(type: SignJar, dependsOn: jar) {
onlyIf {
Expand All @@ -217,7 +209,7 @@ build.dependsOn signJar

task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
archiveClassifier.set('deobf')
manifest {
attributes([
"Specification-Title": "${project.name}",
Expand Down Expand Up @@ -246,18 +238,21 @@ task javadocJar(type: Jar, dependsOn: javadoc) {
shadowJar {
mergeServiceFiles() // To fix graal issue: https://github.com/oracle/graaljs/issues/125
configurations = [project.configurations.shadow]
classifier '' // Replace the default JAR
archiveClassifier.set(''); // Replace the default JAR
// To avoid clashes with other mods
relocate 'org.graalvm', 'org.cyclops.integratedscripting.vendors.org.graalvm'
relocate 'com.oracle', 'org.cyclops.integratedscripting.vendors.com.oracle'
relocate 'com.ibm', 'org.cyclops.integratedscripting.vendors.com.ibm'
finalizedBy 'reobfShadowJar'
}

assemble.dependsOn shadowJar
reobf {
shadowJar {} // Reobfuscate the shadowed JAR
}

artifacts {
archives shadowJar
archives deobfJar
archives sourcesJar
archives javadocJar
Expand All @@ -274,7 +269,7 @@ curseforge {
id = "889785" // my project url is http://minecraft.curseforge.com/mc-mods/889785/
releaseType = project.project.release_type
addGameVersion project.minecraft_version
mainArtifact(jar) {
mainArtifact(shadowJar) {
relations {
requiredDependency 'cyclops-core'
requiredDependency 'integrated-dynamics'
Expand Down Expand Up @@ -303,7 +298,7 @@ modrinth {
projectId = "uDJkuFRe"
versionNumber = project.minecraft_version + '-' + project.mod_version
versionType = project.release_type
uploadFile = jar
uploadFile = shadowJar
gameVersions = [ project.minecraft_version ]
changelog = ""
if (new File("resources/changelog/${project.version}.txt").exists()) {
Expand Down Expand Up @@ -342,7 +337,7 @@ publishing {

publications { PublicationContainer publicationContainer ->
publicationContainer.register("maven", MavenPublication) { MavenPublication publication ->
publication.artifacts = [jar, javadocJar, deobfJar, sourcesJar]
publication.artifacts = [shadowJar, javadocJar, deobfJar, sourcesJar]
publication.artifactId = project.archivesBaseName.toLowerCase() // GH can't handle uppercase...
}
}
Expand All @@ -359,8 +354,8 @@ idea {

jacocoTestReport {
reports {
xml.enabled = true
html.enabled = true
xml.required = true
html.required = true
}
}

Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
mod_version=1.0.0
minecraft_version=1.19.2
forge_version=43.0.8
cyclopscore_version=1.18.11-397
integrateddynamics_version=1.19.2-1.20.2-680
minecraft_version=1.20.1
forge_version=47.0.1
cyclopscore_version=1.19.0-405
integrateddynamics_version=1.20.1-1.21.0-699
release_type=release
fingerprint=bd0353b3e8a2810d60dd584e256e364bc3bedd44

commoncapabilities_version=1.19.2-2.9.0-88
commoncapabilities_version=1.20.1-2.9.0-98

# Workaround for Spotless bug
# https://github.com/diffplug/spotless/issues/834
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.MinecraftForge;
Expand All @@ -19,7 +20,6 @@
import org.cyclops.cyclopscore.config.ConfigHandler;
import org.cyclops.cyclopscore.helper.MinecraftHelpers;
import org.cyclops.cyclopscore.infobook.IInfoBookRegistry;
import org.cyclops.cyclopscore.init.ItemGroupMod;
import org.cyclops.cyclopscore.init.ModBaseVersionable;
import org.cyclops.cyclopscore.proxy.IClientProxy;
import org.cyclops.cyclopscore.proxy.ICommonProxy;
Expand Down Expand Up @@ -140,8 +140,9 @@ protected void afterSetup(FMLLoadCompleteEvent event) {
}

@Override
public CreativeModeTab constructDefaultCreativeModeTab() {
return new ItemGroupMod(this, () -> RegistryEntries.ITEM_SCRIPTING_DISK);
protected CreativeModeTab.Builder constructDefaultCreativeModeTab(CreativeModeTab.Builder builder) {
return super.constructDefaultCreativeModeTab(builder)
.icon(() -> new ItemStack(RegistryEntries.ITEM_SCRIPTING_DISK));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material;
import org.cyclops.cyclopscore.config.extendedconfig.BlockConfig;
import org.cyclops.integratedscripting.IntegratedScripting;

Expand All @@ -17,7 +16,7 @@ public BlockMendesiteConfig() {
super(
IntegratedScripting._instance,
"mendesite",
eConfig -> new Block(Block.Properties.of(Material.CLAY)
eConfig -> new Block(Block.Properties.of()
.sound(SoundType.SNOW)
.strength(1.5F)
.noOcclusion()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.Material;
import org.cyclops.cyclopscore.config.extendedconfig.BlockConfig;
import org.cyclops.integratedscripting.IntegratedScripting;

Expand All @@ -16,7 +15,7 @@ public BlockScriptingDriveConfig() {
super(
IntegratedScripting._instance,
"scripting_drive",
eConfig -> new BlockScriptingDrive(Block.Properties.of(Material.HEAVY_METAL)
eConfig -> new BlockScriptingDrive(Block.Properties.of()
.strength(2.0F, 5.0F)
.sound(SoundType.METAL)),
getDefaultItemConstructor(IntegratedScripting._instance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.items.CapabilityItemHandler;
import org.cyclops.cyclopscore.datastructure.DimPos;
import org.cyclops.cyclopscore.inventory.SimpleInventory;
import org.cyclops.cyclopscore.persist.IDirtyMarkListener;
Expand Down Expand Up @@ -45,7 +45,7 @@ public BlockEntityScriptingDrive(BlockPos blockPos, BlockState blockState) {
super(RegistryEntries.BLOCK_ENTITY_SCRIPTING_DRIVE, blockPos, blockState, BlockEntityScriptingDrive.INVENTORY_SIZE, 1);
getInventory().addDirtyMarkListener(this);

addCapabilityInternal(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, LazyOptional.of(() -> getInventory().getItemHandler()));
addCapabilityInternal(ForgeCapabilities.ITEM_HANDLER, LazyOptional.of(() -> getInventory().getItemHandler()));
addCapabilityInternal(NetworkElementProviderConfig.CAPABILITY, LazyOptional.of(() -> new NetworkElementProviderSingleton() {
@Override
public INetworkElement createNetworkElement(Level world, BlockPos blockPos) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package org.cyclops.integratedscripting.client.gui.component.input;

import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.Widget;
import net.minecraft.client.gui.components.events.GuiEventListener;
import net.minecraft.client.gui.narration.NarratedElementType;
import net.minecraft.client.gui.narration.NarrationElementOutput;
Expand All @@ -15,14 +14,13 @@
import net.minecraft.util.FormattedCharSequence;
import org.cyclops.cyclopscore.client.gui.component.button.ButtonText;
import org.cyclops.cyclopscore.helper.Helpers;
import org.cyclops.cyclopscore.helper.RenderHelpers;
import org.cyclops.integratedscripting.Reference;

/**
* Shows a confirm/cancel dialog
* @author rubensworks
*/
public class WidgetDialog extends AbstractWidget implements Widget, GuiEventListener {
public class WidgetDialog extends AbstractWidget implements GuiEventListener {

private static final ResourceLocation TEXTURE = new ResourceLocation(Reference.MOD_ID, "textures/gui/dialog.png");
public static final int WIDTH = 216;
Expand All @@ -48,27 +46,26 @@ public WidgetDialog(Font font, int x, int y, Screen parent,
this.buttonCancel = new ButtonText(x + WIDTH - 50 - 50, y + HEIGHT - 15 - 5, 50, 15, cancel, cancel, cancelCallback, true);
}

protected void drawBackground(PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) {
protected void drawBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
// Gray-out background
RenderSystem.setShaderColor(0F, 0F, 0F, 0.95F);
fill(matrixStack, 0, 0, parent.width, parent.height, Helpers.RGBAToInt(50, 50, 50, 100));
guiGraphics.fill(0, 0, parent.width, parent.height, Helpers.RGBAToInt(50, 50, 50, 100));
RenderSystem.setShaderColor(1, 1, 1, 1);

// Draw dialog texture
RenderHelpers.bindTexture(TEXTURE);
blit(matrixStack, x, y, 0, 0, WIDTH, HEIGHT);
guiGraphics.blit(TEXTURE, getX(), getY(), 0, 0, WIDTH, HEIGHT);
}

@Override
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks) {
drawBackground(poseStack, mouseX, mouseY, partialTicks);
protected void renderWidget(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
drawBackground(guiGraphics, mouseX, mouseY, partialTicks);

this.buttonConfirm.render(poseStack, mouseX, mouseY, partialTicks);
this.buttonCancel.render(poseStack, mouseX, mouseY, partialTicks);
this.buttonConfirm.render(guiGraphics, mouseX, mouseY, partialTicks);
this.buttonCancel.render(guiGraphics, mouseX, mouseY, partialTicks);

drawCenteredString(poseStack, font, title, this.x + this.width / 2, this.y + 4, 16777215);
guiGraphics.drawCenteredString(font, title, this.getX() + this.width / 2, this.getY() + 4, 16777215);
FormattedCharSequence formattedcharsequence = message.getVisualOrderText();
this.font.draw(poseStack, message, (float) (this.x + this.width / 2 - font.width(formattedcharsequence) / 2), (float) (this.y + 25), 4210752);
guiGraphics.drawString(font, message, (this.getX() + this.width / 2 - font.width(formattedcharsequence) / 2), (this.getY() + 25), 4210752, false);
}

@Override
Expand All @@ -79,7 +76,7 @@ public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) {
}

@Override
public void updateNarration(NarrationElementOutput narrationElementOutput) {
protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput) {
narrationElementOutput.add(NarratedElementType.TITLE, message);
}
}
Loading

0 comments on commit 20cb7ef

Please sign in to comment.