Skip to content

Commit

Permalink
ported to MC 1.20
Browse files Browse the repository at this point in the history
  • Loading branch information
Theta-Dev committed Jul 7, 2023
1 parent 1c0c260 commit 3ba4188
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 32 deletions.
20 changes: 12 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ buildscript {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
}

version = "${mcversion}-${version_major}.${version_minor}"
group = "${author}.${modid}"
Expand All @@ -23,6 +26,11 @@ println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty '
minecraft {
mappings channel: project.mcp_channel, version: project.mcp_mappings

// This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game.
// It is REQUIRED to be set to true for this template to function.
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
copyIdeResources = true

runs {
client {
workingDirectory project.file("run/client").canonicalPath
Expand Down Expand Up @@ -114,10 +122,6 @@ repositories {
maven {
url = "https://maven.theillusivec4.top/"
}
maven {
name = "JEI Maven"
url "https://dvs1.progwml6.com/files/maven"
}
}

dependencies {
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ org.gradle.daemon=false
author=thetadev
modid=constructionwand

mcversion=1.19.4
forgeversion=45.0.23
mcversion=1.20.1
forgeversion=47.0.19
mcp_channel=official
mcp_mappings=1.19.4
mcp_mappings=1.20.1

# Source: https://maven.blamejared.com/vazkii/botania/Botania/
botania=1.19.2-437-FORGE
# Source: https://dvs1.progwml6.com/files/maven/mezz/jei/
jei_version=13.1.0.2
# Source: https://maven.blamejared.com/mezz/jei/
jei_version=15.2.0.22

version_major=2
version_minor=11
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.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public static void serverStarting(ServerStartingEvent e) {
@SubscribeEvent
public static void logOut(PlayerEvent.PlayerLoggedOutEvent e) {
Player player = e.getEntity();
if(player.level.isClientSide) return;
if(player.level().isClientSide) return;
ConstructionWand.instance.undoHistory.removePlayer(player);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void renderBlockHighlight(RenderHighlightEvent.Block event) {
// from the last placement are lagging
if(wandJob == null || !compareRTR(wandJob.rayTraceResult, rtr) || !(wandJob.wand.equals(wand))
|| wandJob.blockCount() < 2) {
wandJob = ItemWand.getWandJob(player, player.level, rtr, wand);
wandJob = ItemWand.getWandJob(player, player.level(), rtr, wand);
}
blocks = wandJob.getBlockPositions();
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/thetadev/constructionwand/client/ScreenWand.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package thetadev.constructionwand.client;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.screens.Screen;
Expand Down Expand Up @@ -45,10 +45,10 @@ protected void init() {
}

@Override
public void render(@Nonnull PoseStack matrixStack, int mouseX, int mouseY, float partialTicks) {
renderBackground(matrixStack);
drawCenteredString(matrixStack, font, wand.getDisplayName(), width / 2, height / 2 - FIELD_HEIGHT / 2 - SPACING_HEIGHT, 16777215);
super.render(matrixStack, mouseX, mouseY, partialTicks);
public void render(@Nonnull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) {
renderBackground(guiGraphics);
guiGraphics.drawCenteredString(font, wand.getDisplayName(), width / 2, height / 2 - FIELD_HEIGHT / 2 - SPACING_HEIGHT, 16777215);
super.render(guiGraphics, mouseX, mouseY, partialTicks);
}

@Override
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/thetadev/constructionwand/items/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.RegisterColorHandlersEvent;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
Expand Down Expand Up @@ -80,12 +80,12 @@ public static void registerItemColors(RegisterColorHandlersEvent.Item event) {
}

@SubscribeEvent
public static void addCreative(CreativeModeTabEvent.BuildContents event) {
if (event.getTab() == CreativeModeTabs.TOOLS_AND_UTILITIES) {
public static void addCreative(BuildCreativeModeTabContentsEvent event) {
if (event.getTabKey() == CreativeModeTabs.TOOLS_AND_UTILITIES) {
for(RegistryObject<Item> itemSupplier : WANDS) {
event.accept(itemSupplier);
}
} else if (event.getTab() == CreativeModeTabs.INGREDIENTS) {
} else if (event.getTabKey() == CreativeModeTabs.INGREDIENTS) {
for(RegistryObject<Item> itemSupplier : CORES) {
event.accept(itemSupplier);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void removePlayer(Player player) {
}

public void updateClient(Player player, boolean ctrlDown) {
Level world = player.level;
Level world = player.level();
if(world.isClientSide) return;

// Set state of CTRL key
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
modLoader = "javafml"
loaderVersion = "[45,)"
loaderVersion = "[46,)"
license = "MIT License"
[[mods]]
modId="constructionwand"
Expand All @@ -20,12 +20,12 @@ This is my first minecraft mod. May the odds be ever in your favor.
[[dependencies.constructionwand]]
modId="forge"
mandatory = true
versionRange = "[45,)"
versionRange = "[46,)"
ordering = "NONE"
side="BOTH"
[[dependencies.constructionwand]]
modId="minecraft"
mandatory = true
versionRange = "[1.19.4, 1.20)"
versionRange = "[1.20, 1.21)"
ordering = "NONE"
side="BOTH"
4 changes: 1 addition & 3 deletions src/main/resources/pack.mcmeta
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"pack": {
"description": "ConstructionWand resources",
"pack_format": 13,
"forge:resource_pack_format": 13,
"forge:data_pack_format": 12
"pack_format": 15
}
}

0 comments on commit 3ba4188

Please sign in to comment.