Skip to content

Commit

Permalink
update to 1.20.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Jun 14, 2023
1 parent c185abe commit b81657d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 28 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}

group = "me.machinemaker"
version = "0.2.1"
version = "0.3.0"

repositories {
mavenCentral()
Expand All @@ -20,7 +20,7 @@ repositories {
}

dependencies {
paperweight.paperDevBundle(libs.versions.paper)
paperweight.paperDevBundle(libs.versions.minecraft.map { "$it-R0.1-SNAPSHOT" })
implementation(libs.mirror)
implementation(libs.reflectionRemapper)

Expand Down Expand Up @@ -56,7 +56,7 @@ tasks {

processResources {
filteringCharset = Charsets.UTF_8.toString()
filesMatching(listOf("plugin.yml", "paper-plugin.yml")) {
filesMatching("paper-plugin.yml") {
expand("version" to version)
}
}
Expand All @@ -70,6 +70,6 @@ tasks {
}

runServer {
minecraftVersion("1.19.4")
minecraftVersion(libs.versions.minecraft.get())
}
}
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
paper = "1.19.4-R0.1-SNAPSHOT"
minecraft = "1.20.1"
junit = "5.9.1"
mirror = "0.1.2"
reflectionRemapper = "0.1.0-SNAPSHOT"
Expand Down
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,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 4 additions & 3 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum

Expand Down Expand Up @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi


# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ private record OverrideListing(VillagerTrades.ItemListing original) implements V
@SuppressWarnings("unchecked")
@Override
public @Nullable MerchantOffer getOffer(final Entity entity, final RandomSource random) {
if (!entity.getLevel().paperConfig().environment.treasureMaps.enabled) {
if (!entity.level().paperConfig().environment.treasureMaps.enabled) {
return null;
}
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import net.minecraft.world.entity.monster.ElderGuardian;
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.storage.loot.BuiltInLootTables;
import net.minecraft.world.level.storage.loot.LootContext;
import net.minecraft.world.level.storage.loot.LootParams;
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets;
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
import net.minecraft.world.phys.Vec3;
Expand Down Expand Up @@ -91,28 +91,27 @@ private static List<net.minecraft.world.item.ItemStack> rollLootTable(final Item
lootTable = BuiltInLootTables.BURIED_TREASURE;
}

final LootContext context = isChest ? createChestContext(player) : createEntityContext(player);
final LootParams params = isChest ? createChestParams(player) : createEntityParams(player);
final List<net.minecraft.world.item.ItemStack> items = new ArrayList<>();
Utils.getServer().getLootTables().get(lootTable).getRandomItems(context, items::add);
Utils.getServer().getLootData().getLootTable(lootTable).getRandomItems(params, items::add);
return items;

}

private static LootContext createChestContext(final ServerPlayer player) {
return new LootContext.Builder(player.getLevel())
private static LootParams createChestParams(final ServerPlayer player) {
return new LootParams.Builder(player.serverLevel())
.withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(player.blockPosition()))
.withLuck(player.getLuck())
.withParameter(LootContextParams.THIS_ENTITY, player)
.withLuck(player.getLuck())
.create(LootContextParamSets.CHEST);
}

private static LootContext createEntityContext(final ServerPlayer player) {
final ElderGuardian guardian = new ElderGuardian(EntityType.ELDER_GUARDIAN, player.getLevel());
return new LootContext.Builder(player.getLevel())
.withRandom(guardian.getRandom())
private static LootParams createEntityParams(final ServerPlayer player) {
final ElderGuardian guardian = new ElderGuardian(EntityType.ELDER_GUARDIAN, player.level());
return new LootParams.Builder(player.serverLevel())
.withParameter(LootContextParams.THIS_ENTITY, guardian)
.withParameter(LootContextParams.ORIGIN, player.position())
.withParameter(LootContextParams.DAMAGE_SOURCE, player.getLevel().damageSources().playerAttack(player))
.withParameter(LootContextParams.DAMAGE_SOURCE, player.serverLevel().damageSources().playerAttack(player))
.withOptionalParameter(LootContextParams.KILLER_ENTITY, player)
.withOptionalParameter(LootContextParams.DIRECT_KILLER_ENTITY, player)
.withParameter(LootContextParams.LAST_DAMAGE_PLAYER, player)
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name: TreasureMapsPlus
main: me.machinemaker.treasuremapsplus.TreasureMapsPlus
version: ${version}
author: Machine_Maker
api-version: 1.19
api-version: 1.20
load: STARTUP
6 changes: 0 additions & 6 deletions src/main/resources/plugin.yml

This file was deleted.

0 comments on commit b81657d

Please sign in to comment.