Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to 1.21 #263

Merged
merged 50 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
82e998a
Workaround to develop while maven.wispforest.io is down
IxPrumxI Jun 28, 2024
715eb10
Update Loom to 1.6-SNAPSHOT
IxPrumxI Jun 28, 2024
2b6c03d
Bump java to 21 and minecraft to 1.21
IxPrumxI Jun 28, 2024
a6f5569
Revert "Workaround to develop while maven.wispforest.io is down"
IxPrumxI Jun 28, 2024
e518d48
Update Repurposed Structures
IxPrumxI Jun 28, 2024
0802018
Some working porting to 1.21
IxPrumxI Jun 28, 2024
e65f95b
Finish packets work
IxPrumxI Jun 28, 2024
d912fe8
Finish porting to 1.21 (Needs testing)
IxPrumxI Jun 28, 2024
3441f00
Bump java version to 21 in build workflow
IxPrumxI Jun 28, 2024
c1575fc
oops
IxPrumxI Jun 28, 2024
008bcdd
To be reverted
IxPrumxI Jun 28, 2024
dabe6cc
Broken village generation
IxPrumxI Jun 28, 2024
3af09bb
Mixed up forget waystone and teleport to waystone packets
IxPrumxI Jun 29, 2024
d12b177
Fix tooltip crash
IxPrumxI Jun 29, 2024
c105ee2
Fix waystone scroll not saving data
IxPrumxI Jun 29, 2024
e5560e5
Don't delete whole villages
IxPrumxI Jun 29, 2024
14011fb
Fix teleport packet being ignored first try
IxPrumxI Jun 29, 2024
4347522
Remove unused mixin
IxPrumxI Jun 29, 2024
4680e21
fix error when using a new local void item
IxPrumxI Jun 29, 2024
abca1cd
mixed up the codec oops
IxPrumxI Jun 29, 2024
3e33ac6
Fix village waystone generation
IxPrumxI Jul 3, 2024
a74c40c
Revert "To be reverted"
IxPrumxI Jul 3, 2024
6a64a1b
Missing import
IxPrumxI Jul 3, 2024
fd38f7e
Update Journeymap-api to 2.0.0-1.21
IxPrumxI Jul 3, 2024
2ecdc70
Remove LazyDFU because it won't allow debugging on the ide
IxPrumxI Jul 3, 2024
176d4ac
Remove PinLib since it been abandoned since 1.19.3
IxPrumxI Jul 3, 2024
76a078e
Fix data path
IxPrumxI Jul 5, 2024
7534ae6
Update other stuff
IxPrumxI Jul 5, 2024
c00f3f2
Fix item recipe
IxPrumxI Jul 5, 2024
270e07e
oops
IxPrumxI Jul 5, 2024
449a815
Remove unused files
IxPrumxI Jul 5, 2024
eacad2a
Fix item path again
IxPrumxI Jul 5, 2024
ddb6689
Fix multidimensional teleport
IxPrumxI Jul 5, 2024
95bbcda
Fix abyss watcher not consuming the item
IxPrumxI Jul 10, 2024
6ceabe1
Make waystone mineable
IxPrumxI Jul 12, 2024
0f109aa
Invoke Remove Waystone Event when a waystone gets broken
IxPrumxI Jul 13, 2024
a66e318
FabricMC/fabric#3716 Stuff
IxPrumxI Jul 13, 2024
124220a
Add missing red nether brick waystone recipe advancement
IxPrumxI Jul 13, 2024
c342747
Maybe fix this for real
IxPrumxI Jul 13, 2024
49ff799
Reverting removing shearing waystones
IxPrumxI Jul 30, 2024
f7f177b
Reverting item model for modified waystone or linked local void
IxPrumxI Jul 30, 2024
52ef74f
Fix void totem crashing
IxPrumxI Jul 31, 2024
3a9dcf2
Fix void items desync
IxPrumxI Jul 31, 2024
d14487f
Fix discovering a waystone and being missing from the GUI
IxPrumxI Jul 31, 2024
9a6d7ba
Fix forget all command not revoking the ownership
IxPrumxI Jul 31, 2024
9204f7b
Un-focus search field when toggling it
IxPrumxI Jul 31, 2024
1e8eaa3
Allow spectator to teleport free of charge
IxPrumxI Jul 31, 2024
b95fedc
Fix local void config options
IxPrumxI Jul 31, 2024
96d98ef
Fix cost item rendering
IxPrumxI Jul 31, 2024
ca154fe
Fix shift right-clicking not removing bound waystone in void items
IxPrumxI Jul 31, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
matrix:
# Use these Java versions
java: [
17, # Current Java LTS & minimum supported by Minecraft
21, # Current Java LTS & minimum supported by Minecraft
]
# and run on both Linux and Windows
os: [ubuntu-20.04, windows-2022]
Expand All @@ -32,7 +32,7 @@ jobs:
- name: build
run: ./gradlew build
- name: capture build artifacts
if: ${{ runner.os == 'Linux' && matrix.java == '17' }} # Only upload artifacts built from latest java on one OS
if: ${{ runner.os == 'Linux' && matrix.java == '21' }} # Only upload artifacts built from latest java on one OS
uses: actions/upload-artifact@v2
with:
name: Artifacts
Expand Down
17 changes: 6 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21

archivesBaseName = project.archives_base_name
version = project.mod_version + "+mc" + project.minecraft_version
Expand Down Expand Up @@ -36,15 +36,10 @@ dependencies {

modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"

modRuntimeOnly "maven.modrinth:lazydfu:0.1.3"

modCompileOnly "curse.maven:repurposed-structures-fabric-${project.rs_project_id}:${project.rs_file_id}"

modApi group: 'info.journeymap', name: 'journeymap-api', version: project.journeymap_api_version, changing: true
modRuntimeOnly "curse.maven:journeymap-${project.jm_project_id}:${project.jm_file_id}"

modApi "maven.modrinth:pinlib:$project.pinlib_api_version"
modRuntimeOnly "maven.modrinth:pinlib:$project.pinlib_api_version"
modApi group: 'info.journeymap', name: 'journeymap-api-fabric', version: project.journeymap_api_version, changing: true
// modRuntimeOnly "curse.maven:journeymap-${project.jm_project_id}:${project.jm_file_id}"

annotationProcessor modImplementation("io.wispforest:owo-lib:${project.owo_version}")
include "io.wispforest:owo-sentinel:${project.owo_version}"
Expand All @@ -64,7 +59,7 @@ processResources {

tasks.withType(JavaCompile).configureEach {
it.options.encoding = "UTF-8"
it.options.release = 17
it.options.release = 21
}

java {
Expand Down
20 changes: 10 additions & 10 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
org.gradle.jvmargs=-Xmx2G
# Fabric Properties
# check these on https://fabricmc.net/versions.html
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.5
minecraft_version=1.21
yarn_mappings=1.21+build.4
loader_version=0.15.11
# Mod Properties
mod_version=3.3.2
mod_version=3.3.3
maven_group=wraith.waystones
archives_base_name=wraith-waystones
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_version=0.94.0+1.20.4
fabric_version=0.100.4+1.21
# Optional Dependencies
# Journeymap & api
journeymap_api_version=1.20-1.9-fabric-SNAPSHOT
jm_project_id=32274
jm_file_id=4950591
journeymap_api_version=2.0.0-1.21-SNAPSHOT
#jm_project_id=32274
#jm_file_id=5485233
rs_project_id=391366
rs_file_id=4998098
rs_file_id=5467551
# https://modrinth.com/mod/pinlib/
pinlib_api_version=0.2.1+mc1.19.3-beta
# https://maven.wispforest.io/io/wispforest/owo-lib/
owo_version=0.12.0+1.20.3
owo_version=0.12.10+1.21
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-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 2 additions & 6 deletions src/main/java/wraith/fwaystones/FabricWaystones.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import net.fabricmc.loader.api.FabricLoader;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import wraith.fwaystones.integration.pinlib.PinlibPlugin;
import wraith.fwaystones.packets.WaystonePacketHandler;
import wraith.fwaystones.registry.*;
import wraith.fwaystones.util.FWConfig;
import wraith.fwaystones.util.WaystonePacketHandler;
import wraith.fwaystones.util.WaystoneStorage;
import wraith.fwaystones.util.WaystonesEventManager;

Expand Down Expand Up @@ -38,12 +37,9 @@ public void onInitialize() {
CompatRegistry.init();
CustomScreenHandlerRegistry.registerScreenHandlers();
WaystonesEventManager.registerEvents();
WaystonePacketHandler.registerPackets();
WaystonePacketHandler.registerPacketHandlers();

if (FabricLoader.getInstance().isModLoaded("pinlib")) {
PinlibPlugin.init();
}

LOGGER.info("Has successfully been initialized.");
}

Expand Down
42 changes: 16 additions & 26 deletions src/main/java/wraith/fwaystones/block/WaystoneBlock.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package wraith.fwaystones.block;

import com.mojang.serialization.MapCodec;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.enums.DoubleBlockHalf;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.NbtComponent;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
Expand Down Expand Up @@ -43,10 +44,6 @@
import org.jetbrains.annotations.Nullable;
import wraith.fwaystones.FabricWaystones;
import wraith.fwaystones.access.PlayerEntityMixinAccess;
import wraith.fwaystones.integration.pinlib.PinlibPlugin;
import wraith.fwaystones.item.LocalVoidItem;
import wraith.fwaystones.item.WaystoneDebuggerItem;
import wraith.fwaystones.item.WaystoneScrollItem;
import wraith.fwaystones.registry.BlockEntityRegistry;
import wraith.fwaystones.util.Utils;

Expand Down Expand Up @@ -156,7 +153,7 @@ public float calcBlockBreakingDelta(BlockState state, PlayerEntity player, Block
public BlockState getPlacementState(ItemPlacementContext ctx) {
BlockPos blockPos = ctx.getBlockPos();

var nbt = ctx.getStack().getSubNbt("BlockEntityTag");
var nbt = ctx.getStack().get(DataComponentTypes.BLOCK_ENTITY_DATA);
boolean hasOwner = nbt != null && nbt.contains("waystone_owner");
var world = ctx.getWorld();
var fluidState = world.getFluidState(blockPos);
Expand Down Expand Up @@ -194,9 +191,9 @@ public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEnt
if (!world.isClient) {
ItemStack itemStack = new ItemStack(state.getBlock().asItem());
var compoundTag = new NbtCompound();
waystone.writeNbt(compoundTag);
waystone.writeNbt(compoundTag, waystone.getWorld().getRegistryManager());
if (FabricWaystones.CONFIG.store_waystone_data_on_sneak_break() && player.isSneaking() && !compoundTag.isEmpty()) {
itemStack.setSubNbt("BlockEntityTag", compoundTag);
itemStack.set(DataComponentTypes.CUSTOM_DATA, NbtComponent.of(compoundTag));
}
ItemScatterer.spawn(world, (double) topPos.getX() + 0.5D, (double) topPos.getY() + 0.5D, (double) topPos.getZ() + 0.5D, itemStack);
if (waystone.getCachedState().get(MOSSY)) {
Expand All @@ -205,6 +202,8 @@ public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEnt
} else {
waystone.generateLoot(player);
}

FabricWaystones.WAYSTONE_STORAGE.removeWaystone(waystone);
}

world.removeBlock(topPos, false);
Expand Down Expand Up @@ -233,14 +232,17 @@ public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
}


// protected ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) {
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit) {
if (world.isClient) {
return ActionResult.success(true);
}
BlockPos openPos = state.get(HALF) == DoubleBlockHalf.UPPER ? pos.down() : pos;
BlockState topState = world.getBlockState(openPos.up());
BlockState bottomState = world.getBlockState(openPos);
Hand hand = player.getActiveHand();
Item heldItem = player.getStackInHand(hand).getItem();
if (heldItem == Items.VINE) {
if (!topState.get(MOSSY)) {
Expand All @@ -252,18 +254,6 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
}
return ActionResult.PASS;
}
if (heldItem == Items.SHEARS) {
if (topState.get(MOSSY)) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happened to shearing the Waystones?

world.setBlockState(openPos.up(), topState.with(MOSSY, false));
world.setBlockState(openPos, bottomState.with(MOSSY, false));
var dropPos = openPos.up(2);
ItemScatterer.spawn(world, dropPos.getX() + 0.5F, dropPos.getY() + 0.5F, dropPos.getZ() + 0.5F, new ItemStack(Items.VINE));
}
return ActionResult.PASS;
}
if (heldItem instanceof WaystoneScrollItem || heldItem instanceof LocalVoidItem || heldItem instanceof WaystoneDebuggerItem) {
return ActionResult.PASS;
}

WaystoneBlockEntity blockEntity = (WaystoneBlockEntity) world.getBlockEntity(openPos);
if (blockEntity == null) {
Expand All @@ -277,8 +267,8 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
}
return ActionResult.success(false);
}
if (!FabricWaystones.CONFIG.discover_waystone_on_map_use() && FabricLoader.getInstance().isModLoaded("pinlib") && PinlibPlugin.tryUseOnMarkableBlock(player.getStackInHand(hand), world, openPos))
return ActionResult.SUCCESS;
// if (!FabricWaystones.CONFIG.discover_waystone_on_map_use() && FabricLoader.getInstance().isModLoaded("pinlib") && PinlibPlugin.tryUseOnMarkableBlock(player.getStackInHand(hand), world, openPos))
// return ActionResult.SUCCESS;

FabricWaystones.WAYSTONE_STORAGE.tryAddWaystone(blockEntity);
PlayerEntityMixinAccess playerAccess = (PlayerEntityMixinAccess) player;
Expand All @@ -294,7 +284,7 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
"fwaystones.missing_discover_item",
discoverAmount,
Text.translatable(discoverItem.getTranslationKey()).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.missing_discover_item.arg_color").getString()).get().left().get())
style.withColor(TextColor.parse(Text.translatable("fwaystones.missing_discover_item.arg_color").getString()).getOrThrow())
)
), false);
return ActionResult.FAIL;
Expand All @@ -304,15 +294,15 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
"fwaystones.discover_item_paid",
discoverAmount,
Text.translatable(discoverItem.getTranslationKey()).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.discover_item_paid.arg_color").getString()).get().left().get())
style.withColor(TextColor.parse(Text.translatable("fwaystones.discover_item_paid.arg_color").getString()).getOrThrow())
)
), false);
}
}
player.sendMessage(Text.translatable(
"fwaystones.discover_waystone",
Text.literal(blockEntity.getWaystoneName()).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.discover_waystone.arg_color").getString()).get().left().get())
style.withColor(TextColor.parse(Text.translatable("fwaystones.discover_waystone.arg_color").getString()).getOrThrow())
)
), false);
}
Expand Down
Loading