From e528a36ed9fc9e521d1e1ba004794d28f686e50f Mon Sep 17 00:00:00 2001 From: "Josiah (Gaming32) Glosson" Date: Wed, 12 Jul 2023 11:14:06 -0500 Subject: [PATCH] Remove all OptionsList references --- .../blocks/FaithPlateTargetBlock.java | 7 +++-- .../blockentities/CatapultBlockEntity.java | 22 +++++++-------- .../portalcubed/client/PortalCubedClient.java | 27 ------------------- .../packet/PortalCubedServerPackets.java | 14 ---------- .../assets/portalcubed/lang/en_us.json | 8 +++--- 5 files changed, 16 insertions(+), 62 deletions(-) diff --git a/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateTargetBlock.java b/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateTargetBlock.java index 794fa00d..7fe51342 100644 --- a/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateTargetBlock.java +++ b/src/main/java/com/fusionflux/portalcubed/blocks/FaithPlateTargetBlock.java @@ -37,10 +37,9 @@ public InteractionResult use(BlockState state, Level world, BlockPos pos, Player final Vec3 destPos = Vec3.atCenterOf(hit.getBlockPos()) .add(Vec3.atLowerCornerOf(hit.getDirection().getNormal()).scale(-0.5)); final CompoundTag catapultNbt = new CompoundTag(); - catapultNbt.putString("OptionsListData", String.format( - "{destX:%1$f,destY:%2$f,destZ:%3$f,angle:45}", // It's Gson lenient, so we don't need quotes - destPos.x, destPos.y, destPos.z - )); + catapultNbt.putDouble("DestX", destPos.x); + catapultNbt.putDouble("DestY", destPos.y); + catapultNbt.putDouble("DestZ", destPos.z); BlockItem.setBlockEntityData(result, PortalCubedBlocks.CATAPULT_BLOCK_ENTITY, catapultNbt); final CompoundTag display = new CompoundTag(); diff --git a/src/main/java/com/fusionflux/portalcubed/blocks/blockentities/CatapultBlockEntity.java b/src/main/java/com/fusionflux/portalcubed/blocks/blockentities/CatapultBlockEntity.java index 259c80b2..2ed50e5f 100644 --- a/src/main/java/com/fusionflux/portalcubed/blocks/blockentities/CatapultBlockEntity.java +++ b/src/main/java/com/fusionflux/portalcubed/blocks/blockentities/CatapultBlockEntity.java @@ -1,8 +1,6 @@ -// TODO: Reimplement GUI without optionslist package com.fusionflux.portalcubed.blocks.blockentities; import com.fusionflux.portalcubed.blocks.PortalCubedBlocks; -import eu.midnightdust.lib.config.MidnightConfig; import net.fabricmc.fabric.api.screenhandler.v1.ExtendedScreenHandlerFactory; import net.minecraft.core.BlockPos; import net.minecraft.nbt.CompoundTag; @@ -24,16 +22,9 @@ import org.jetbrains.annotations.Nullable; public class CatapultBlockEntity extends BlockEntity implements ExtendedScreenHandlerFactory { - @MidnightConfig.Entry(min = -30_000_000, max = 30_000_000) private double destX; - - @MidnightConfig.Entry(min = -2032, max = 4064) private double destY; - - @MidnightConfig.Entry(min = -30_000_000, max = 30_000_000) private double destZ; - - @MidnightConfig.Entry(min = 0, max = 90) private double angle = 45; public CatapultBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { @@ -49,12 +40,18 @@ public CatapultBlockEntity(BlockPos pos, BlockState state) { @Override public void load(CompoundTag nbt) { -// OptionsListData.read(nbt, this); + destX = nbt.getDouble("DestX"); + destY = nbt.getDouble("DestY"); + destZ = nbt.getDouble("DestZ"); + angle = nbt.contains("Angle") ? nbt.getDouble("Angle") : 45; } @Override protected void saveAdditional(CompoundTag nbt) { -// OptionsListData.write(nbt, this); + nbt.putDouble("DestX", destX); + nbt.putDouble("DestY", destY); + nbt.putDouble("DestZ", destZ); + nbt.putDouble("Angle", angle); } @NotNull @@ -78,8 +75,7 @@ public Component getDisplayName() { @Nullable @Override public AbstractContainerMenu createMenu(int i, Inventory playerInventory, Player playerEntity) { - return null; -// return new OptionsListScreenHandler(i, worldPosition); + return null; // TODO: Implement GUI } @Override diff --git a/src/main/java/com/fusionflux/portalcubed/client/PortalCubedClient.java b/src/main/java/com/fusionflux/portalcubed/client/PortalCubedClient.java index fdb4c339..fcbd4442 100644 --- a/src/main/java/com/fusionflux/portalcubed/client/PortalCubedClient.java +++ b/src/main/java/com/fusionflux/portalcubed/client/PortalCubedClient.java @@ -152,7 +152,6 @@ public void onInitializeClient(ModContainer mod) { MenuScreens.register(PortalCubed.FAITH_PLATE_SCREEN_HANDLER, FaithPlateScreen::new); MenuScreens.register(PortalCubed.VELOCITY_HELPER_SCREEN_HANDLER, VelocityHelperScreen::new); -// MenuScreens.register(PortalCubed.OPTIONS_LIST_SCREEN_HANDLER, OptionsListScreen::new); registerEntityRenderers(); registerColorProviders(); @@ -425,32 +424,6 @@ Items.LIGHT, new ResourceLocation("level") BufferUploader.drawWithShader(bufferBuilder.end()); }); - // TODO: Note for gaming don't use camera setup for portal rendering - // RecoilEvents.CAMERA_SETUP.register((camera, cameraEntity, perspective, tickDelta, ctrl) -> { - // final Vec3 entityPos = cameraEntity.getPosition(tickDelta); - // final Vec3 startPos = entityPos.add(ctrl.getPos().subtract(entityPos).normalize().scale(0.1)); - // final Vec3 endPos = ctrl.getPos(); - // final var transformed = PortalDirectionUtils.simpleTransformPassingVector( - // cameraEntity, startPos, endPos, p -> p.getNormal().y < 0 - // ); - // if (transformed != null) { - // cameraTransformedThroughPortal = transformed.second(); - // ctrl.setPos(transformed.first()); - // final Quaternionf cameraRot = camera.rotation().mul( - // cameraTransformedThroughPortal.getTransformQuat().toQuaternionf() - // ); - // camera.getLookVector().set(0.0F, 0.0F, 1.0F).rotate(cameraRot); - // camera.getUpVector().set(0.0F, 1.0F, 0.0F).rotate(cameraRot); - // camera.getLeftVector().set(1.0F, 0.0F, 0.0F).rotate(cameraRot); - // if (camera.isDetached()) { - // ((CameraExt)camera).backCameraUp(transformed.first()); - // ctrl.setPos(camera.getPosition()); - // } - // } else { - // cameraTransformedThroughPortal = null; - // } - // }); - //noinspection UnstableApiUsage ItemGroupEvents.modifyEntriesEvent(CreativeModeTabs.TOOLS_AND_UTILITIES).register(e -> e.addAfter( i -> i.getItem() instanceof RecordItem, diff --git a/src/main/java/com/fusionflux/portalcubed/packet/PortalCubedServerPackets.java b/src/main/java/com/fusionflux/portalcubed/packet/PortalCubedServerPackets.java index 52b857b4..68816f3f 100644 --- a/src/main/java/com/fusionflux/portalcubed/packet/PortalCubedServerPackets.java +++ b/src/main/java/com/fusionflux/portalcubed/packet/PortalCubedServerPackets.java @@ -47,7 +47,6 @@ public class PortalCubedServerPackets { public static final ResourceLocation GRAB_KEY_PRESSED = id("grab_key_pressed"); public static final ResourceLocation REMOVE_PORTALS = id("remove_portals"); public static final ResourceLocation VELOCITY_HELPER_CONFIGURE = id("velocity_helper_configure"); - public static final ResourceLocation OPTIONS_LIST_CONFIGURE = id("options_list_configure"); public static final ResourceLocation PLAY_BOUNCE_SOUND = id("play_bounce_sound"); public static final ResourceLocation CROWBAR_ATTACK = id("crowbar_attack"); public static final ResourceLocation LEFT_CLICK = id("left_click"); @@ -143,23 +142,10 @@ public static void onVelocityHelperConfigure(MinecraftServer server, ServerPlaye )); } - public static void onOptionsListConfigure(MinecraftServer server, ServerPlayer player, @SuppressWarnings("unused") ServerGamePacketListenerImpl handler, @SuppressWarnings("unused") FriendlyByteBuf buf, @SuppressWarnings("unused") PacketSender sender) { -// final BlockPos origin = buf.readBlockPos(); -// final String json = buf.readUtf(); -// server.execute(() -> { -// if (!(player.level().getBlockEntity(origin) instanceof OptionsListBlockEntity optionsListBlockEntity) || !player.isCreative()) { -// return; -// } -// OptionsListData.read(json, optionsListBlockEntity); -// optionsListBlockEntity.updateListeners(); -// }); - } - public static void registerPackets() { ServerPlayNetworking.registerGlobalReceiver(GRAB_KEY_PRESSED, PortalCubedServerPackets::onGrabKeyPressed); ServerPlayNetworking.registerGlobalReceiver(REMOVE_PORTALS, PortalCubedServerPackets::onRemovePortalKeyPressed); ServerPlayNetworking.registerGlobalReceiver(VELOCITY_HELPER_CONFIGURE, PortalCubedServerPackets::onVelocityHelperConfigure); - ServerPlayNetworking.registerGlobalReceiver(OPTIONS_LIST_CONFIGURE, PortalCubedServerPackets::onOptionsListConfigure); ServerPlayNetworking.registerGlobalReceiver( PLAY_BOUNCE_SOUND, (server, player, handler, buf, responseSender) -> PortalCubed.playBounceSound(player) ); diff --git a/src/main/resources/assets/portalcubed/lang/en_us.json b/src/main/resources/assets/portalcubed/lang/en_us.json index 0ab987c1..186cd586 100644 --- a/src/main/resources/assets/portalcubed/lang/en_us.json +++ b/src/main/resources/assets/portalcubed/lang/en_us.json @@ -491,8 +491,8 @@ "portalcubed.ponder.auto_portal.text_5": "This portal is green because the Auto Portal is still set to secondary.", "portalcubed.ponder.auto_portal.text_6": "Sneak right-click with a hammer to reset the portal\u0027s base color.", - "optionslist.portalcubed.catapult.destX": "Destination X", - "optionslist.portalcubed.catapult.destY": "Destination Y", - "optionslist.portalcubed.catapult.destZ": "Destination Z", - "optionslist.portalcubed.catapult.angle": "Launch Angle" + "portalcubed.catapult.destX": "Destination X", + "portalcubed.catapult.destY": "Destination Y", + "portalcubed.catapult.destZ": "Destination Z", + "portalcubed.catapult.angle": "Launch Angle" } \ No newline at end of file