Skip to content

Commit

Permalink
Update to 1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
LordDeatHunter committed Jan 16, 2024
1 parent e8f1d42 commit 7280e68
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 67 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'maven-publish'
}

Expand Down
14 changes: 7 additions & 7 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.2
yarn_mappings=1.20.2+build.4
loader_version=0.14.24
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.5
# Mod Properties
mod_version=3.3.2
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.90.7+1.20.2
fabric_version=0.94.0+1.20.4
# Optional Dependencies
# Journeymap & api
journeymap_api_version=1.20-1.9-fabric-SNAPSHOT
jm_project_id=32274
jm_file_id=4774255
jm_file_id=4950591
rs_project_id=391366
rs_file_id=4465193
rs_file_id=4998098
# 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.11.3+1.20.2
owo_version=0.12.0+1.20.3
19 changes: 12 additions & 7 deletions src/main/java/wraith/fwaystones/block/WaystoneBlock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
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;
Expand Down Expand Up @@ -60,7 +61,7 @@ public class WaystoneBlock extends BlockWithEntity implements Waterloggable {
public static final EnumProperty<DoubleBlockHalf> HALF = Properties.DOUBLE_BLOCK_HALF;
public static final BooleanProperty MOSSY = BooleanProperty.of("mossy");
public static final BooleanProperty WATERLOGGED = Properties.WATERLOGGED;

public static final MapCodec<WaystoneBlock> CODEC = createCodec(WaystoneBlock::new);
protected static final VoxelShape VOXEL_SHAPE_TOP;
protected static final VoxelShape VOXEL_SHAPE_BOTTOM;

Expand Down Expand Up @@ -103,6 +104,10 @@ public static WaystoneBlockEntity getEntity(World world, BlockPos pos) {
return world.getBlockEntity(pos) instanceof WaystoneBlockEntity waystone ? waystone : null;
}

public MapCodec<WaystoneBlock> getCodec() {
return CODEC;
}

@Override
public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
return state.get(HALF) == DoubleBlockHalf.UPPER ? null : new WaystoneBlockEntity(pos, state);
Expand Down Expand Up @@ -174,7 +179,7 @@ public VoxelShape getOutlineShape(BlockState state, BlockView view, BlockPos pos
}

@Override
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
public BlockState onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
BlockPos topPos;
BlockPos botPos;
if (state.get(HALF) == DoubleBlockHalf.UPPER) {
Expand All @@ -198,15 +203,15 @@ public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity pl
ItemScatterer.spawn(world, (double) topPos.getX() + 0.5D, (double) topPos.getY() + 0.5D, (double) topPos.getZ() + 0.5D, new ItemStack(Items.VINE));
}
} else {
waystone.checkLootInteraction(player);
waystone.generateLoot(player);
}
}

world.removeBlock(topPos, false);
world.removeBlock(botPos, false);
world.updateNeighbors(topPos, Blocks.AIR);

super.onBreak(world, pos, state, player);
return super.onBreak(world, pos, state, player);
}

@Override
Expand Down Expand Up @@ -289,7 +294,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()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.missing_discover_item.arg_color").getString()).get().left().get())
)
), false);
return ActionResult.FAIL;
Expand All @@ -299,15 +304,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()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.discover_item_paid.arg_color").getString()).get().left().get())
)
), 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()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.discover_waystone.arg_color").getString()).get().left().get())
)
), false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ public void setColor(int color) {
}

@Override
protected DefaultedList<ItemStack> getInvStackList() {
protected DefaultedList<ItemStack> method_11282() {
// getInvStackList
return this.inventory;
}

Expand Down Expand Up @@ -397,7 +398,7 @@ private boolean doTeleport(ServerPlayerEntity player, ServerWorld world, Telepor
"fwaystones.no_teleport_message.cooldown",
Text.literal(cooldownSeconds).styled(style ->
style.withColor(TextColor.parse(Text.translatable(
"fwaystones.no_teleport_message.cooldown.arg_color").getString()))
"fwaystones.no_teleport_message.cooldown.arg_color").getString()).get().left().get())
)
), false);
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/wraith/fwaystones/item/LocalVoidItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> too
tooltip.add(Text.translatable(
"fwaystones." + translationName + ".tooltip",
Text.literal(name).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones." + translationName + ".tooltip.arg_color").getString()))
style.withColor(TextColor.parse(Text.translatable("fwaystones." + translationName + ".tooltip.arg_color").getString()).get().left().get())
)
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han
text = Text.translatable(
"fwaystones.learned.infinite.multiple",
Text.literal(String.valueOf(learned)).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.learned.infinite.multiple.arg_color").getString()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.learned.infinite.multiple.arg_color").getString()).get().left().get())
)
);
} else {
Expand Down Expand Up @@ -83,7 +83,7 @@ public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> too
tooltip.add(Text.translatable(
"fwaystones.scroll.infinite_tooltip",
Text.literal(String.valueOf(count)).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.scroll.infinite_tooltip.arg_color").getString()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.scroll.infinite_tooltip.arg_color").getString()).get().left().get())
)
));
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/wraith/fwaystones/item/WaystoneItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> too
tooltip.add(Text.translatable(
"fwaystones.waystone_tooltip.name",
Text.literal(name).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.waystone_tooltip.name.arg_color").getString()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.waystone_tooltip.name.arg_color").getString()).get().left().get())
)
));
tooltip.add(Text.translatable("fwaystones.waystone_tooltip.global").append(" ")
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/wraith/fwaystones/item/WaystoneScrollItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public TypedActionResult<ItemStack> use(World world, PlayerEntity user, Hand han
text = Text.translatable(
"fwaystones.learned.multiple",
Text.literal(String.valueOf(learned)).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.learned.multiple.arg_color").getString()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.learned.multiple.arg_color").getString()).get().left().get())
)
);
} else {
Expand Down Expand Up @@ -122,7 +122,7 @@ public void appendTooltip(ItemStack stack, @Nullable World world, List<Text> too
tooltip.add(Text.translatable(
"fwaystones.scroll.tooltip",
Text.literal(String.valueOf(size)).styled(style ->
style.withColor(TextColor.parse(Text.translatable("fwaystones.scroll.tooltip.arg_color").getString()))
style.withColor(TextColor.parse(Text.translatable("fwaystones.scroll.tooltip.arg_color").getString()).get().left().get())
)
));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.minecraft.structure.StructureTemplateManager;
import net.minecraft.structure.pool.StructurePool;
import net.minecraft.structure.pool.StructurePoolBasedGenerator;
import net.minecraft.structure.pool.alias.StructurePoolAliasLookup;
import net.minecraft.util.math.random.Random;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.world.HeightLimitView;
Expand All @@ -25,10 +26,10 @@
@Mixin(StructurePoolBasedGenerator.class)
public class StructurePoolBasedGeneratorMixin {

@Inject(method = "generate(Lnet/minecraft/world/gen/noise/NoiseConfig;IZLnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/structure/StructureTemplateManager;Lnet/minecraft/world/HeightLimitView;Lnet/minecraft/util/math/random/Random;Lnet/minecraft/registry/Registry;Lnet/minecraft/structure/PoolStructurePiece;Ljava/util/List;Lnet/minecraft/util/shape/VoxelShape;)V",
at = @At(value = "INVOKE", target = "Ljava/util/Deque;addLast(Ljava/lang/Object;)V"),
@Inject(method = "generate(Lnet/minecraft/world/gen/noise/NoiseConfig;IZLnet/minecraft/world/gen/chunk/ChunkGenerator;Lnet/minecraft/structure/StructureTemplateManager;Lnet/minecraft/world/HeightLimitView;Lnet/minecraft/util/math/random/Random;Lnet/minecraft/registry/Registry;Lnet/minecraft/structure/PoolStructurePiece;Ljava/util/List;Lnet/minecraft/util/shape/VoxelShape;Lnet/minecraft/structure/pool/alias/StructurePoolAliasLookup;)V",
at = @At(value = "INVOKE", target = "Lnet/minecraft/structure/pool/StructurePoolBasedGenerator$StructurePoolGenerator;generatePiece(Lnet/minecraft/structure/PoolStructurePiece;Lorg/apache/commons/lang3/mutable/MutableObject;IZLnet/minecraft/world/HeightLimitView;Lnet/minecraft/world/gen/noise/NoiseConfig;Lnet/minecraft/structure/pool/alias/StructurePoolAliasLookup;)V"),
locals = LocalCapture.CAPTURE_FAILSOFT)
private static void preGenerate2(NoiseConfig noiseConfig, int maxSize, boolean modifyBoundingBox, ChunkGenerator chunkGenerator, StructureTemplateManager structureTemplateManager, HeightLimitView heightLimitView, Random random, Registry<StructurePool> structurePoolRegistry, PoolStructurePiece firstPiece, List<PoolStructurePiece> pieces, VoxelShape pieceShape, CallbackInfo ci, StructurePoolBasedGenerator.StructurePoolGenerator structurePoolGenerator) {
private static void preGenerate2(NoiseConfig noiseConfig, int maxSize, boolean modifyBoundingBox, ChunkGenerator chunkGenerator, StructureTemplateManager structureTemplateManager, HeightLimitView heightLimitView, Random random, Registry<StructurePool> structurePoolRegistry, PoolStructurePiece firstPiece, List<PoolStructurePiece> pieces, VoxelShape pieceShape, StructurePoolAliasLookup aliasLookup, CallbackInfo ci, StructurePoolBasedGenerator.StructurePoolGenerator structurePoolGenerator) {
onInit(structurePoolGenerator);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.structure.pool.StructurePool;
import net.minecraft.structure.pool.StructurePoolBasedGenerator;
import net.minecraft.structure.pool.StructurePoolElement;
import net.minecraft.structure.pool.alias.StructurePoolAliasLookup;
import net.minecraft.util.BlockRotation;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockBox;
Expand Down Expand Up @@ -59,49 +60,37 @@ public void setMaxWaystoneCount(int maxWaystoneCount) {
this.maxWaystoneCount = maxWaystoneCount;
}

@Inject(method = "generatePiece(Lnet/minecraft/structure/PoolStructurePiece;Lorg/apache/commons/lang3/mutable/MutableObject;IZLnet/minecraft/world/HeightLimitView;Lnet/minecraft/world/gen/noise/NoiseConfig;)V", at = @At(value = "HEAD"))
private void fabricwaystones_startGeneratePiece(PoolStructurePiece piece,
MutableObject<VoxelShape> pieceShape,
int minY,
boolean modifyBoundingBox,
HeightLimitView world,
NoiseConfig noiseConfig,
CallbackInfo ci) {
@Inject(method = "generatePiece", at = @At(value = "HEAD"))
private void fabricwaystones_startGeneratePiece(PoolStructurePiece piece, MutableObject<VoxelShape> pieceShape, int minY, boolean modifyBoundingBox, HeightLimitView world, NoiseConfig noiseConfig, StructurePoolAliasLookup aliasLookup, CallbackInfo ci) {
}

@Inject(method = "generatePiece(Lnet/minecraft/structure/PoolStructurePiece;Lorg/apache/commons/lang3/mutable/MutableObject;IZLnet/minecraft/world/HeightLimitView;Lnet/minecraft/world/gen/noise/NoiseConfig;)V",
@Inject(method = "generatePiece",
at = @At(value = "INVOKE", target = "Ljava/util/List;addAll(Ljava/util/Collection;)Z", ordinal = 0, shift = At.Shift.AFTER, remap = false),
locals = LocalCapture.CAPTURE_FAILSOFT)
private void fabricwaystones_limitWaystonePieceSpawning(
PoolStructurePiece piece,
MutableObject<VoxelShape> pieceShape,
int minY,
boolean modifyBoundingBox,
HeightLimitView world,
NoiseConfig noiseConfig,
CallbackInfo ci,
StructurePoolElement structurePoolElement,
BlockPos blockPos,
BlockRotation blockRotation,
StructurePool.Projection projection,
boolean bl,
MutableObject<VoxelShape> mutableObject,
BlockBox blockBox,
int i,
Iterator var15,
StructureTemplate.StructureBlockInfo structureBlockInfo,
Direction direction,
BlockPos blockPos2,
BlockPos blockPos3,
int j,
int k,
RegistryKey<StructurePool> registryKey,
Optional optional,
RegistryEntry<StructurePool> registryEntry,
RegistryEntry<StructurePool> registryEntry2,
MutableObject mutableObject2,
boolean bl2,
List<StructurePoolElement> list
private void fabricwaystones_limitWaystonePieceSpawning(PoolStructurePiece piece, MutableObject<VoxelShape> pieceShape, int minY, boolean modifyBoundingBox, HeightLimitView world, NoiseConfig noiseConfig, StructurePoolAliasLookup aliasLookup,
CallbackInfo ci,
StructurePoolElement structurePoolElement,
BlockPos blockPos,
BlockRotation blockRotation,
StructurePool.Projection projection,
boolean bl,
MutableObject<VoxelShape> mutableObject,
BlockBox blockBox,
int i,
Iterator var15,
StructureTemplate.StructureBlockInfo structureBlockInfo,
Direction direction,
BlockPos blockPos2,
BlockPos blockPos3,
int j,
int k,
RegistryKey<StructurePool> registryKey,
Optional optional,
RegistryEntry<StructurePool> registryEntry,
RegistryEntry<StructurePool> registryEntry2,
MutableObject mutableObject2,
boolean bl2,
List<StructurePoolElement> list
) {
if (!FabricWaystones.CONFIG.worldgen.generate_in_villages() ||
maxWaystoneCount < 0 ||
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package wraith.fwaystones.registry;

import net.fabricmc.fabric.api.client.rendering.v1.BlockEntityRendererRegistry;
import net.minecraft.client.render.block.entity.BlockEntityRendererFactories;
import wraith.fwaystones.block.WaystoneBlockEntityRenderer;

public final class CustomBlockEntityRendererRegistry {

public static void RegisterBlockEntityRenderers() {
BlockEntityRendererRegistry.register(BlockEntityRegistry.WAYSTONE_BLOCK_ENTITY, WaystoneBlockEntityRenderer::new);
BlockEntityRendererFactories.register(BlockEntityRegistry.WAYSTONE_BLOCK_ENTITY, WaystoneBlockEntityRenderer::new);
}

}

0 comments on commit 7280e68

Please sign in to comment.