Skip to content

Commit

Permalink
Basic non-working 1.20.6 "port"
Browse files Browse the repository at this point in the history
  • Loading branch information
KiriCattus committed Jun 27, 2024
1 parent 241a90a commit bde1fdf
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 26 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
id 'eclipse'
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.41'
id 'net.neoforged.gradle.userdev' version '7.0.142'
id 'org.cadixdev.licenser' version '0.6.1'
}

Expand All @@ -22,7 +22,7 @@ base {
}

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

//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
Expand Down
14 changes: 7 additions & 7 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ org.gradle.debug=false
## Environment Properties

# The Minecraft version must agree with the Neo version to get a valid artifact
minecraft_version=1.20.4
minecraft_version=1.20.6
# The Minecraft version range can use any release version of Minecraft as bounds.
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
# as they do not follow standard versioning conventions.
minecraft_version_range=[1.20.4,1.21)
minecraft_version_range=[1.20.6,1.20.1)
# The Neo version must agree with the Minecraft version to get a valid artifact
neo_version=20.4.47-beta
neo_version=20.6.119
# The Neo version range can use any version of Neo as bounds or match the loader version range
neo_version_range=[20.4,)
neo_version_range=[20.6,)
# The loader version range can only use the major version of Neo/FML as bounds
loader_version_range=[2,)
loader_version_range=[4,)
# The mapping channel to use for mappings.
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
Expand All @@ -35,7 +35,7 @@ loader_version_range=[2,)
mapping_channel=official
# The mapping version to query from the mapping channel.
# This must match the format required by the mapping channel.
mapping_version=1.20.4
mapping_version=1.20.6

## Mod Properties

Expand All @@ -57,4 +57,4 @@ mod_authors=Curle
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
mod_description=A reimplementation of some of the features of the old Essentials mods, plus some personal twists intended for Public Servers.
# Pack version - this changes each minecraft release, in general.
pack_format_number=18
pack_format_number=41
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ pluginManagement {
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
}
7 changes: 4 additions & 3 deletions src/main/java/uk/gemwire/bareessentials/BareEssentials.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
import net.minecraft.world.level.GameRules;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.common.NeoForge;
import net.neoforged.neoforge.event.TickEvent;
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
import net.neoforged.neoforge.event.server.ServerStartedEvent;
import net.neoforged.neoforge.event.tick.ServerTickEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import uk.gemwire.bareessentials.commands.BareCommands;
Expand Down Expand Up @@ -60,7 +61,7 @@ public BareEssentials() {
forge.addListener(BareCommands::registerCommands);
}

@Mod.EventBusSubscriber(modid="bareessentials", bus= Mod.EventBusSubscriber.Bus.FORGE)
@EventBusSubscriber(modid = "bareessentials", bus = EventBusSubscriber.Bus.MOD)
static class Events {
@SubscribeEvent
public static void started(ServerStartedEvent e) {
Expand All @@ -80,7 +81,7 @@ public static void login(PlayerEvent.PlayerLoggedInEvent e) {
}

@SubscribeEvent
public static void tick(TickEvent.ServerTickEvent e) {
public static void tick(ServerTickEvent e) {
if (e.getServer().overworld().getDayTime() == 0)
Bank.getOrCreate(e.getServer().overworld()).updateBalances(e.getServer());
}
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/uk/gemwire/bareessentials/data/Bank.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package uk.gemwire.bareessentials.data;

import net.minecraft.core.HolderLookup;
import net.minecraft.locale.Language;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.LongTag;
Expand All @@ -47,14 +48,19 @@ public class Bank extends SavedData {
// The list of all Accounts currently loaded
public Map<UUID, Long> accounts;

public Bank(Map<UUID, Long> accts) { accounts = accts; }
public Bank() { accounts = new HashMap<>(); }
public Bank(Map<UUID, Long> accts) {
accounts = accts;
}

public Bank() {
accounts = new HashMap<>();
}

private static final SavedData.Factory<Bank> bankFactory
= new SavedData.Factory<>(Bank::new, Bank::load, null);

@Override
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag) {
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag, final @NotNull HolderLookup.Provider provider) {
CompoundTag tag = new CompoundTag();
for (var acc : accounts.entrySet()) {
tag.putLong(acc.getKey().toString(), acc.getValue());
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/uk/gemwire/bareessentials/data/Cooldowns.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package uk.gemwire.bareessentials.data;

import net.minecraft.commands.Commands;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -41,14 +42,19 @@ public class Cooldowns extends SavedData {
// User -> { Feature -> Game Time }
public Map<UUID, Map<String, Long>> cooldowns;

public Cooldowns(Map<UUID, Map<String, Long>> cooldowns) { this.cooldowns = cooldowns; }
public Cooldowns() { cooldowns = new HashMap<>(); }
public Cooldowns(Map<UUID, Map<String, Long>> cooldowns) {
this.cooldowns = cooldowns;
}

public Cooldowns() {
cooldowns = new HashMap<>();
}

private static final SavedData.Factory<Cooldowns> cooldownsFactory
= new SavedData.Factory<>(Cooldowns::new, Cooldowns::load, null);

@Override
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag) {
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag, final @NotNull HolderLookup.Provider provider) {
// Do not save or load cooldowns, they only exist temporarily.
return new CompoundTag();
}
Expand Down
12 changes: 9 additions & 3 deletions src/main/java/uk/gemwire/bareessentials/data/Homes.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
package uk.gemwire.bareessentials.data;

import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
Expand All @@ -39,14 +40,19 @@ public class Homes extends SavedData {
// The list of all Homes currently loaded
public Map<UUID, BlockPos> homes;

public Homes(Map<UUID, BlockPos> homes) { this.homes = homes; }
public Homes() { homes = new HashMap<>(); }
public Homes(Map<UUID, BlockPos> homes) {
this.homes = homes;
}

public Homes() {
homes = new HashMap<>();
}

private static final SavedData.Factory<Homes> homesFactory
= new SavedData.Factory<>(Homes::new, Homes::load, null);

@Override
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag) {
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag, final @NotNull HolderLookup.Provider provider) {
CompoundTag tag = new CompoundTag();
for (var acc : homes.entrySet()) {
CompoundTag pos = new CompoundTag();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.List;

public class PendingTeleports {

private static Logger logger = LogManager.getLogger();

public record TeleportRequest(ServerPlayer sender, ServerPlayer receiver, boolean pending, boolean tpahere) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
package uk.gemwire.bareessentials.invsee;

import net.minecraft.core.HolderLookup;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.server.level.ServerLevel;
Expand All @@ -40,11 +41,16 @@ public class SavedInventories extends SavedData {
// The list of all Inventories currently loaded
public Map<UUID, List<CompoundTag>> invs;

public SavedInventories(Map<UUID, List<CompoundTag>> invs) { this.invs = invs; }
public SavedInventories() { invs = new HashMap<>(); }
public SavedInventories(Map<UUID, List<CompoundTag>> invs) {
this.invs = invs;
}

public SavedInventories() {
invs = new HashMap<>();
}

@Override
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag) {
public @NotNull CompoundTag save(final @NotNull CompoundTag pCompoundTag, final @NotNull HolderLookup.Provider provider) {
CompoundTag tag = new CompoundTag();
for (var acc : invs.entrySet()) {
ListTag invs = new ListTag();
Expand Down

0 comments on commit bde1fdf

Please sign in to comment.