Skip to content

Commit

Permalink
fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
moehreag committed Jan 21, 2024
1 parent c33a9e2 commit c0a175e
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public class BlockContentRegistryTest implements ModInitializer, QuiltGameTest {
@Override
public void onInitialize(ModContainer mod) {
RegistryExtensions.register(Registries.BLOCK, new Identifier(MOD_ID, "oxidizable_iron_block"),
new OxidizableBlock(Oxidizable.OxidizationLevel.UNAFFECTED, AbstractBlock.Settings.copy(Blocks.IRON_BLOCK)),
new OxidizableBlock(Oxidizable.OxidizationLevel.UNAFFECTED, AbstractBlock.Settings.method_9630(Blocks.IRON_BLOCK)),
BlockContentRegistries.OXIDIZABLE, new ReversibleBlockEntry(Blocks.IRON_BLOCK, false));

BlockContentRegistries.ENCHANTING_BOOSTERS.put(Blocks.IRON_BLOCK, new ConstantBooster(3f));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package org.quiltmc.qsl.block.entity.test;

import com.mojang.serialization.MapCodec;
import org.jetbrains.annotations.Nullable;

import net.minecraft.block.AbstractBlock;
Expand All @@ -35,7 +36,7 @@

public class AngyBlock extends BlockWithEntity {
public AngyBlock(MapColor mapColor) {
super(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(mapColor));
super(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(mapColor));
}

@Override
Expand Down Expand Up @@ -68,6 +69,11 @@ public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEnt
return BlockEntityTypeTest.COLORFUL_BLOCK_ENTITY_TYPE.instantiate(pos, state);
}

@Override
protected MapCodec<? extends BlockWithEntity> getCodec() {
return null;
}

@Override
public BlockRenderType getRenderType(BlockState state) {
return BlockRenderType.MODEL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public interface ServerJoin extends CodecAware {
}

public record ServerJoinChat(String text, Style style) implements ServerJoin {
public static final Codec<ServerJoinChat> CODEC = RecordCodecBuilder.create(instance -> instance.group(Codec.STRING.fieldOf("text").forGetter(ServerJoinChat::text), Style.CODEC.fieldOf("style").forGetter(ServerJoinChat::style)).apply(instance, ServerJoinChat::new));
public static final Codec<ServerJoinChat> CODEC = RecordCodecBuilder.create(instance -> instance.group(Codec.STRING.fieldOf("text").forGetter(ServerJoinChat::text), Style.Serializer.CODEC.fieldOf("style").forGetter(ServerJoinChat::style)).apply(instance, ServerJoinChat::new));
public static final Identifier CODEC_ID = new Identifier("quilt_data_callback_testmod", "chat");

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

final class ChannelList extends EntryListWidget<ChannelList.Entry> {
ChannelList(MinecraftClient client, int width, int height, int top, int bottom, int itemHeight) {
super(client, width, height, top, bottom, itemHeight);
super(client, top, width, bottom-top, itemHeight);
}

@Override
Expand All @@ -39,7 +39,7 @@ void clear() {
}

@Override
public void appendNarrations(NarrationMessageBuilder arg) {
public void updateNarration(NarrationMessageBuilder arg) {
// TODO seems to be possibly accessibility related
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static int registerChannel(CommandContext<ServerCommandSource> context,
System.out.printf("Received packet on channel %s%n", channel);
});

context.getSource().sendSystemMessage(Text.of(String.format("Registered channel %s for %s", channel, executor.getEntityName())));
context.getSource().sendSystemMessage(Text.of(String.format("Registered channel %s for %s", channel, executor.getDisplayName())));

return 1;
}
Expand All @@ -119,7 +119,7 @@ private static int unregisterChannel(CommandContext<ServerCommandSource> context
}

ServerPlayNetworking.unregisterReceiver(player.networkHandler, channel);
context.getSource().sendSystemMessage(Text.of(String.format("Unregistered channel %s for %s", getIdentifier(context, "channel"), player.getEntityName())));
context.getSource().sendSystemMessage(Text.of(String.format("Unregistered channel %s for %s", getIdentifier(context, "channel"), player.getDisplayName())));

return 1;
}
Expand All @@ -128,7 +128,7 @@ private static int infoCommand(CommandContext<ServerCommandSource> context, Serv
ServerCommandSource source = context.getSource();
Set<Identifier> channels = ServerPlayNetworking.getSendable(player);

source.sendSystemMessage(Text.of(String.format("Available channels for player %s", player.getEntityName())));
source.sendSystemMessage(Text.of(String.format("Available channels for player %s", player.getDisplayName())));

for (Identifier channel : channels) {
source.sendSystemMessage(Text.of(channel.toString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,23 @@ public final class NetworkingEntityTrackingEventsTest implements EntityTrackingE
@Override
public void beforeStartTracking(Entity trackedEntity, ServerPlayerEntity player) {
if (trackedEntity instanceof ArmorStandEntity) {
player.sendMessage(Text.literal("About to be tracking ").append(trackedEntity.getEntityName()), false);
player.sendMessage(Text.literal("About to be tracking ").append(trackedEntity.getDisplayName()), false);
}
}

// Sends a message to the player when they're newly tracking an armour stand.
@Override
public void afterStartTracking(Entity trackedEntity, ServerPlayerEntity player) {
if (trackedEntity instanceof ArmorStandEntity) {
player.sendMessage(Text.literal("Tracking ").append(trackedEntity.getEntityName()), false);
player.sendMessage(Text.literal("Tracking ").append(trackedEntity.getDisplayName()), false);
}
}

// Sends a message to the player when they're no longer tracking an armour stand.
@Override
public void onStopTracking(Entity trackedEntity, ServerPlayerEntity player) {
if (trackedEntity instanceof ArmorStandEntity) {
player.sendMessage(Text.literal("No longer tracking ").append(trackedEntity.getEntityName()), false);
player.sendMessage(Text.literal("No longer tracking ").append(trackedEntity.getDisplayName()), false);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void onInitialize(ModContainer mod) {
}
});

register(TEST_BLOCK_ID, new Block(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(MapColor.BLACK)));
register(TEST_BLOCK_ID, new Block(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(MapColor.BLACK)));

if (!entryAddEventFoundBlock) {
throw new AssertionError("Registry entry add event was not invoked on the registration of block with id " + TEST_BLOCK_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class RegistryLibMonitorRegistrationTest implements ModInitializer {

@Override
public void onInitialize(ModContainer mod) {
register(TEST_BLOCK_A_ID, new Block(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(MapColor.BLACK)));
register(TEST_BLOCK_A_ID, new Block(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(MapColor.BLACK)));

var monitor = RegistryMonitor.create(Registries.BLOCK)
.filter(context -> context.id().getNamespace().equals("quilt_registry_test_monitors_registration"));
Expand All @@ -55,7 +55,7 @@ public void onInitialize(ModContainer mod) {
context.value(), context.id(), context.rawId(), context.registry());

if (context.id() == TEST_BLOCK_A_ID) {
context.register(TEST_BLOCK_B_ID, new Block(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(MapColor.BLACK)));
context.register(TEST_BLOCK_B_ID, new Block(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(MapColor.BLACK)));
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class RegistryLibMonitorTest implements ModInitializer {

@Override
public void onInitialize(ModContainer mod) {
Block blockA = register(TEST_BLOCK_A_ID, new Block(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(MapColor.BLACK)));
Block blockA = register(TEST_BLOCK_A_ID, new Block(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(MapColor.BLACK)));

var monitor = RegistryMonitor.create(Registries.BLOCK)
.filter(context -> context.id().getNamespace().equals("quilt_registry_test_monitors"));
Expand All @@ -61,7 +61,7 @@ public void onInitialize(ModContainer mod) {
upcomingSet.add(context.value());
});

Block blockB = register(TEST_BLOCK_B_ID, new Block(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(MapColor.BLACK)));
Block blockB = register(TEST_BLOCK_B_ID, new Block(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(MapColor.BLACK)));

if (!allSet.contains(blockA) || !allSet.contains(blockB)) {
throw new AssertionError("Entries " + allSet + " found by RegistryMonitor via forAll were not as expected");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private void printReg() {
@SuppressWarnings("unchecked")
static Identifier register(int i) {
var id = new Identifier(NAMESPACE, "entry_" + i);
var block = new Block(AbstractBlock.Settings.copy(Blocks.STONE).mapColor(MapColor.BLACK));
var block = new Block(AbstractBlock.Settings.method_9630(Blocks.STONE).mapColor(MapColor.BLACK));

Registry.register(Registries.BLOCK, id, block);
Registry.register(Registries.ITEM, id, new BlockItem(block, new Item.Settings()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import net.minecraft.block.Blocks;
import net.minecraft.command.CommandBuildContext;
import net.minecraft.command.CommandException;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.CowEntity;
import net.minecraft.registry.Registries;
Expand Down Expand Up @@ -108,10 +107,6 @@ private int swapTargeted(CommandContext<ServerCommandSource> context) throws Com
var target = new TeleportTarget(new Vec3d(0.5, 101, 0.5), Vec3d.ZERO, 0, 0);
QuiltDimensions.teleport(player, modWorld, target);

if (player.getWorld() != modWorld) {
throw new CommandException(Text.literal("Teleportation failed!"));
}

modWorld.setBlockState(new BlockPos(0, 100, 0), Blocks.DIAMOND_BLOCK.getDefaultState());
modWorld.setBlockState(new BlockPos(0, 101, 0), Blocks.TORCH.getDefaultState());
} else {
Expand Down

0 comments on commit c0a175e

Please sign in to comment.