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

23w45a porting fixes #3421

Merged
merged 1 commit into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;

import net.minecraft.block.Blocks;
import net.minecraft.command.argument.DimensionArgumentType;
Expand Down Expand Up @@ -51,6 +52,7 @@ public class FabricDimensionTest implements ModInitializer {
// The dimension options refer to the JSON-file in the dimension subfolder of the data pack,
// which will always share its ID with the world that is created from it
private static final RegistryKey<DimensionOptions> DIMENSION_KEY = RegistryKey.of(RegistryKeys.DIMENSION, new Identifier("fabric_dimension", "void"));
private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(Text.literal("Teleportation failed!"));

private static RegistryKey<World> WORLD_KEY = RegistryKey.of(RegistryKeys.WORLD, DIMENSION_KEY.getValue());

Expand Down Expand Up @@ -110,7 +112,7 @@ public void onInitialize() {
});
}

private int swapTargeted(CommandContext<ServerCommandSource> context) {
private int swapTargeted(CommandContext<ServerCommandSource> context) throws CommandSyntaxException {
ServerPlayerEntity player = context.getSource().getPlayer();

if (player == null) {
Expand All @@ -126,7 +128,7 @@ private int swapTargeted(CommandContext<ServerCommandSource> context) {
FabricDimensions.teleport(player, modWorld, target);

if (player.getWorld() != modWorld) {
throw new RuntimeException("Teleportation failed!");
throw FAILED_EXCEPTION.create();
}

modWorld.setBlockState(new BlockPos(0, 100, 0), Blocks.DIAMOND_BLOCK.getDefaultState());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ protected FabricBlockSettings(AbstractBlock.Settings settings) {
this.instrument(otherAccessor.getInstrument());
thisAccessor.setReplaceable(otherAccessor.getReplaceable());

// Not copied in vanilla: field definition order
// Vanilla did not copy those fields until 23w45a, which introduced
// copyShallow method (maintaining the behavior previously used by the copy method)
// and the copy method that copies those fields as well. copyShallow is now
// deprecated. To maintain compatibility and since this behavior seems to be the
// more proper way, this copies all the fields, not just the shallow ones.
// Fields are added by field definition order.
this.jumpVelocityMultiplier(otherAccessor.getJumpVelocityMultiplier());
this.drops(otherAccessor.getLootTableId());
this.allowsSpawning(otherAccessor.getAllowsSpawningPredicate());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public BlockSetTypeBuilder buttonClickOnSound(SoundEvent buttonClickOnSound) {
public static BlockSetTypeBuilder copyOf(BlockSetTypeBuilder builder) {
BlockSetTypeBuilder copy = new BlockSetTypeBuilder();
copy.openableByHand(builder.openableByHand);
copy.openableByWindCharge(builder.openableByWindCharge);
copy.buttonActivatedByArrows(builder.buttonActivatedByArrows);
copy.pressurePlateActivationRule(builder.pressurePlateActivationRule);
copy.soundGroup(builder.soundGroup);
Expand All @@ -234,6 +235,7 @@ public static BlockSetTypeBuilder copyOf(BlockSetTypeBuilder builder) {
public static BlockSetTypeBuilder copyOf(BlockSetType setType) {
BlockSetTypeBuilder copy = new BlockSetTypeBuilder();
copy.openableByHand(setType.canOpenByHand());
copy.openableByWindCharge(setType.canOpenByWindCharge());
copy.buttonActivatedByArrows(setType.canButtonBeActivatedByArrows());
copy.pressurePlateActivationRule(setType.pressurePlateSensitivity());
copy.soundGroup(setType.soundType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ transitive-accessible field net/minecraft/client/MinecraftClient attackCooldown
transitive-accessible method net/minecraft/block/Blocks createFlowerPotBlock (Lnet/minecraft/block/Block;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createLeavesBlock (Lnet/minecraft/sound/BlockSoundGroup;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createLogBlock (Lnet/minecraft/block/MapColor;Lnet/minecraft/block/MapColor;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createLogBlock (Lnet/minecraft/block/MapColor;Lnet/minecraft/block/MapColor;Lnet/minecraft/sound/BlockSoundGroup;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createNetherStemBlock (Lnet/minecraft/block/MapColor;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createStoneButtonBlock ()Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createWoodenButtonBlock (Lnet/minecraft/block/BlockSetType;)Lnet/minecraft/block/Block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ transitive-accessible field net/minecraft/client/MinecraftClient attackCooldown
transitive-accessible method net/minecraft/block/Blocks createFlowerPotBlock (Lnet/minecraft/block/Block;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createLeavesBlock (Lnet/minecraft/sound/BlockSoundGroup;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createLogBlock (Lnet/minecraft/block/MapColor;Lnet/minecraft/block/MapColor;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createLogBlock (Lnet/minecraft/block/MapColor;Lnet/minecraft/block/MapColor;Lnet/minecraft/sound/BlockSoundGroup;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createNetherStemBlock (Lnet/minecraft/block/MapColor;)Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createStoneButtonBlock ()Lnet/minecraft/block/Block;
transitive-accessible method net/minecraft/block/Blocks createWoodenButtonBlock (Lnet/minecraft/block/BlockSetType;)Lnet/minecraft/block/Block;
Expand Down
Loading