Skip to content

Commit

Permalink
Update to 1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
jaquadro committed Jul 4, 2022
1 parent fdc3047 commit 931df81
Show file tree
Hide file tree
Showing 21 changed files with 122 additions and 130 deletions.
77 changes: 35 additions & 42 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,32 +1,16 @@
buildscript {
repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven { url = 'https://maven.minecraftforge.net' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7.+'
}
}

plugins {
id "com.jfrog.bintray" version "1.8.1"
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'idea'
apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'

version = "${minecraft_version}-${mod_version}"
group= "com.jaquadro.minecraft.storagedrawers" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "StorageDrawers"

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
// The mappings can be changed at any time and must be in the following format.
// Channel: Version:
Expand Down Expand Up @@ -61,6 +45,9 @@ minecraft {
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', 'storagedrawers'

mods {
storagedrawers {
source sourceSets.main
Expand All @@ -83,6 +70,28 @@ minecraft {
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', 'storagedrawers'

mods {
storagedrawers {
source sourceSets.main
}
}
}

// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

property 'forge.enabledGameTestNamespaces', 'storagedrawers'

mods {
storagedrawers {
source sourceSets.main
Expand Down Expand Up @@ -156,8 +165,8 @@ repositories {
dependencies {
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
compileOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}-forge:${jei_version}")

implementation fg.deobf("curse.maven:the-one-probe-245211:${top_id}")
implementation fg.deobf("curse.maven:jade-324717:${jade_id}")
Expand Down Expand Up @@ -189,18 +198,14 @@ jar {
manifest {
attributes([
"Specification-Title": "storagedrawers",
"Specification-Vendor": "Justin Aquadro",
"Specification-Vendor": "Texelsaur",
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": project.jar.archiveVersion,
"Implementation-Vendor" :"Justin Aquadro",
"Implementation-Vendor" :"Texelsaur",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
//include "com/jaquadro/minecraft/storagedrawers/**"
//include "assets/**"
//include "mcmod.info"
//include "pack.mcmeta"
}

jar.finalizedBy('reobfJar')
Expand Down Expand Up @@ -251,19 +256,7 @@ publishing.publications {
}
}

bintrayUpload.dependsOn build

bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['StorageDrawers']
publish = true
pkg {
repo = 'dev'
name = 'storagedrawers'
version {
name = project.jar.archiveVersion
released = new Date()
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}

18 changes: 9 additions & 9 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
org.gradle.jvmargs=-Xmx3G

minecraft_base_version=1.18
minecraft_version=1.18.2
forge_version=40.0.15
loader_version=38
mod_version=10.2.0
minecraft_base_version=1.19
minecraft_version=1.19
forge_version=41.0.63
loader_version=41
mod_version=11.0.0

# Mod dependency versions
jei_version=9.5.0.132
jade_id=3681449
jei_version=11.0.0.206
jade_id=3834997
# mt_version=3.0.24.81
# crafttweaker_version=7.0.0.45
top_id=3671753
top_id=3838419

# This determines the minimum version of forge required
# Only Change when mod need access to a feature in forge that is not available in earlier versions
min_forge_version=40.0.15
min_forge_version=41.0.63
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
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.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions gradlew
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
Expand Down
10 changes: 6 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
rootProject.name = "StorageDrawers-${minecraft_base_version}"

//include '..:Chameleon'
//project(':..:Chameleon').name = "Chameleon-${minecraft_base_version}"
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.RandomSource;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.player.Player;
Expand All @@ -26,7 +27,6 @@
import org.jetbrains.annotations.NotNull;

import java.util.EnumSet;
import java.util.Random;

public class BlockController extends HorizontalDirectionalBlock implements INetworked, EntityBlock
{
Expand Down Expand Up @@ -110,7 +110,7 @@ public void toggle (@NotNull Level level, @NotNull BlockPos pos, @NotNull Player
}

@Override
public void tick (@NotNull BlockState state, @NotNull ServerLevel world, @NotNull BlockPos pos, @NotNull Random rand) {
public void tick (@NotNull BlockState state, @NotNull ServerLevel world, @NotNull BlockPos pos, @NotNull RandomSource rand) {
if (world.isClientSide)
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.sounds.SoundSource;
Expand Down Expand Up @@ -220,14 +219,14 @@ public InteractionResult use (@NotNull BlockState state, @NotNull Level level, @
if (item.getItem() instanceof ItemUpgrade) {
if (!blockEntityDrawers.upgrades().canAddUpgrade(item)) {
if (!level.isClientSide)
player.displayClientMessage(new TranslatableComponent("message.storagedrawers.cannot_add_upgrade"), true);
player.displayClientMessage(Component.translatable("message.storagedrawers.cannot_add_upgrade"), true);

return InteractionResult.PASS;
}

if (!blockEntityDrawers.upgrades().addUpgrade(item)) {
if (!level.isClientSide)
player.displayClientMessage(new TranslatableComponent("message.storagedrawers.max_upgrades"), true);
player.displayClientMessage(Component.translatable("message.storagedrawers.max_upgrades"), true);

return InteractionResult.PASS;
}
Expand Down Expand Up @@ -259,7 +258,7 @@ else if (StorageDrawers.config.cache.enableDrawerUI) {
@Override
@NotNull
public Component getDisplayName () {
return new TranslatableComponent(getDescriptionId());
return Component.translatable(getDescriptionId());
}

@Nullable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
Expand All @@ -46,7 +47,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.function.Function;

public final class BasicDrawerModel
Expand Down Expand Up @@ -149,14 +149,13 @@ private static BlockModel getBlockModel (ResourceLocation location) {
Resource iresource = null;
Reader reader = null;
try {
iresource = Minecraft.getInstance().getResourceManager().getResource(location);
reader = new InputStreamReader(iresource.getInputStream(), StandardCharsets.UTF_8);
iresource = Minecraft.getInstance().getResourceManager().getResourceOrThrow(location);
reader = new InputStreamReader(iresource.open(), StandardCharsets.UTF_8);
return BlockModel.fromStream(reader);
} catch (IOException e) {
return null;
} finally {
IOUtils.closeQuietly(reader);
IOUtils.closeQuietly((Closeable)iresource);
}
}

Expand Down Expand Up @@ -302,7 +301,7 @@ public MergedModel (BakedModel mainModel, BakedModel... models) {

@Override
@NotNull
public List<BakedQuad> getQuads (@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand) {
public List<BakedQuad> getQuads (@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand) {
List<BakedQuad> quads = Lists.newArrayList();
quads.addAll(mainModel.getQuads(state, side, rand));
for (BakedModel model : models)
Expand Down Expand Up @@ -389,7 +388,7 @@ public boolean usesBlockLight () {

@NotNull
@Override
public List<BakedQuad> getQuads (@Nullable BlockState state, @Nullable Direction side, @NotNull Random rand, @NotNull IModelData extraData) {
public List<BakedQuad> getQuads (@Nullable BlockState state, @Nullable Direction side, @NotNull RandomSource rand, @NotNull IModelData extraData) {
List<BakedQuad> quads = Lists.newArrayList();
quads.addAll(mainModel.getQuads(state, side, rand, extraData));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction;
import net.minecraft.util.RandomSource;
import net.minecraft.world.level.block.state.BlockState;
import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public abstract class ProxyBuilderModel implements BakedModel
{
Expand All @@ -33,7 +33,7 @@ public ProxyBuilderModel (BakedModel parent) {

@Override
@NotNull
public List<BakedQuad> getQuads (BlockState state, Direction side, @NotNull Random rand) {
public List<BakedQuad> getQuads (BlockState state, Direction side, @NotNull RandomSource rand) {
if (proxy == null || stateCache != state)
setProxy(state);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import com.jaquadro.minecraft.storagedrawers.config.CommonConfig;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.item.ItemStack;

import java.util.ArrayList;
Expand Down Expand Up @@ -42,11 +40,11 @@ private void addContent(final List<Component> result, final BlockEntityDrawers t
if (!drawer.isEnabled())
continue;

Component name = new TranslatableComponent("tooltip.storagedrawers.waila.empty");
Component name = Component.translatable("tooltip.storagedrawers.waila.empty");

final ItemStack stack = drawer.getStoredItemPrototype();
if (!stack.isEmpty()) {
final MutableComponent stackName = new TranslatableComponent("").append(stack.getDisplayName());
final MutableComponent stackName = Component.translatable("").append(stack.getDisplayName());

if (showCounts) {
if (drawer.getStoredItemCount() == Integer.MAX_VALUE) {
Expand All @@ -69,7 +67,7 @@ else if (stacks > 0)
name = stackName;
}
}
result.add(new TranslatableComponent("tooltip.storagedrawers.waila.drawer", i + 1, name));
result.add(Component.translatable("tooltip.storagedrawers.waila.drawer", i + 1, name));
}

}
Expand All @@ -78,11 +76,11 @@ private void addStackLimit(List<Component> result, BlockEntityDrawers tile, IDra
if (!this.showStackLimit) return;

if (attr.isUnlimitedStorage() || tile.getDrawerAttributes().isUnlimitedVending())
result.add(new TranslatableComponent("tooltip.storagedrawers.waila.nolimit"));
result.add(Component.translatable("tooltip.storagedrawers.waila.nolimit"));
else {
int multiplier = tile.upgrades().getStorageMultiplier();
int limit = tile.getEffectiveDrawerCapacity() * multiplier;
result.add(new TranslatableComponent("tooltip.storagedrawers.waila.limit", limit, multiplier));
result.add(Component.translatable("tooltip.storagedrawers.waila.limit", limit, multiplier));
}
}

Expand All @@ -91,14 +89,14 @@ private void addStatus(List<Component> result, BlockEntityDrawers tile, IDrawerA

List<MutableComponent> attribs = new ArrayList<>();
if (attr.isItemLocked(LockAttribute.LOCK_POPULATED))
attribs.add(new TranslatableComponent("tooltip.storagedrawers.waila.locked"));
attribs.add(Component.translatable("tooltip.storagedrawers.waila.locked"));
if (attr.isVoid())
attribs.add(new TranslatableComponent("tooltip.storagedrawers.waila.void"));
attribs.add(Component.translatable("tooltip.storagedrawers.waila.void"));
//if (tile.getOwner() != null)
// attribs.add(new TranslationTextComponent("tooltip.storagedrawers.waila.protected"));

if (!attribs.isEmpty())
result.add(attribs.stream().reduce((a, b) ->
a.append(new TextComponent(", ")).append(b)).get());
a.append(Component.literal(", ")).append(b)).get());
}
}
Loading

0 comments on commit 931df81

Please sign in to comment.