diff --git a/src/main/java/com/cstav/genshinstrument/block/LyreInstrumentBlock.java b/src/main/java/com/cstav/genshinstrument/block/LyreInstrumentBlock.java index f2387b8..13960d7 100644 --- a/src/main/java/com/cstav/genshinstrument/block/LyreInstrumentBlock.java +++ b/src/main/java/com/cstav/genshinstrument/block/LyreInstrumentBlock.java @@ -1,29 +1,29 @@ -package com.cstav.genshinstrument.block; +// package com.cstav.genshinstrument.block; -import com.cstav.genshinstrument.block.partial.AbstractInstrumentBlock; -import com.cstav.genshinstrument.block.partial.InstrumentBlockEntity; -import com.cstav.genshinstrument.networking.OpenInstrumentPacketSender; -import com.cstav.genshinstrument.util.ServerUtil; +// import com.cstav.genshinstrument.block.partial.AbstractInstrumentBlock; +// import com.cstav.genshinstrument.block.partial.InstrumentBlockEntity; +// import com.cstav.genshinstrument.networking.OpenInstrumentPacketSender; +// import com.cstav.genshinstrument.util.ServerUtil; -import net.minecraft.core.BlockPos; -import net.minecraft.world.level.block.state.BlockState; +// import net.minecraft.core.BlockPos; +// import net.minecraft.world.level.block.state.BlockState; -//TODO remove after tests -public class LyreInstrumentBlock extends AbstractInstrumentBlock { +// //TODO remove after tests +// public class LyreInstrumentBlock extends AbstractInstrumentBlock { - public LyreInstrumentBlock(Properties pProperties) { - super(pProperties); - } +// public LyreInstrumentBlock(Properties pProperties) { +// super(pProperties); +// } - @Override - public InstrumentBlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { - return new InstrumentBlockEntity(pPos, pState); - } +// @Override +// public InstrumentBlockEntity newBlockEntity(BlockPos pPos, BlockState pState) { +// return new InstrumentBlockEntity(pPos, pState); +// } - @Override - protected OpenInstrumentPacketSender instrumentPacketSender() { - return (player, hand) -> ServerUtil.sendInternalOpenPacket(player, hand, "windsong_lyre"); - } +// @Override +// protected OpenInstrumentPacketSender instrumentPacketSender() { +// return (player, hand) -> ServerUtil.sendInternalOpenPacket(player, hand, "windsong_lyre"); +// } -} \ No newline at end of file +// } \ No newline at end of file diff --git a/src/main/java/com/cstav/genshinstrument/block/ModBlockEntities.java b/src/main/java/com/cstav/genshinstrument/block/ModBlockEntities.java index df6995a..d4c69b4 100644 --- a/src/main/java/com/cstav/genshinstrument/block/ModBlockEntities.java +++ b/src/main/java/com/cstav/genshinstrument/block/ModBlockEntities.java @@ -1,24 +1,15 @@ package com.cstav.genshinstrument.block; -import com.cstav.genshinstrument.GInstrumentMod; -import com.cstav.genshinstrument.block.partial.InstrumentBlockEntity; - -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.entity.BlockEntity; -import net.minecraft.world.level.block.entity.BlockEntityType; - public abstract class ModBlockEntities { public static void load() {}; - public static final BlockEntityType INSTRUMENT_BE = regsiter("instrument_be", - BlockEntityType.Builder.of((pos, state) -> new InstrumentBlockEntity(pos, state), ModBlocks.LYRE_BLOCK) - .build(null) - ); + // public static final BlockEntityType INSTRUMENT_BE = regsiter("instrument_be", + // BlockEntityType.Builder.of((pos, state) -> new InstrumentBlockEntity(pos, state), ModBlocks.LYRE_BLOCK) + // .build(null) + // ); - private static BlockEntityType regsiter(final String name, final BlockEntityType bet) { - Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, new ResourceLocation(GInstrumentMod.MODID, name), bet); - return bet; - } + // private static BlockEntityType regsiter(final String name, final BlockEntityType bet) { + // Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, new ResourceLocation(GInstrumentMod.MODID, name), bet); + // return bet; + // } } diff --git a/src/main/java/com/cstav/genshinstrument/block/ModBlocks.java b/src/main/java/com/cstav/genshinstrument/block/ModBlocks.java index 2aa56b4..8c4e267 100644 --- a/src/main/java/com/cstav/genshinstrument/block/ModBlocks.java +++ b/src/main/java/com/cstav/genshinstrument/block/ModBlocks.java @@ -1,26 +1,17 @@ package com.cstav.genshinstrument.block; -import com.cstav.genshinstrument.GInstrumentMod; - -import net.minecraft.core.Registry; -import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.Blocks; -import net.minecraft.world.level.block.state.BlockBehaviour.Properties; - public abstract class ModBlocks { public static void load() {}; - //NOTE for testing purposes - public static final Block - LYRE_BLOCK = register("lyre_block", new LyreInstrumentBlock(Properties.copy(Blocks.OAK_WOOD))) - ; + // //NOTE for testing purposes + // public static final Block + // LYRE_BLOCK = register("lyre_block", new LyreInstrumentBlock(Properties.copy(Blocks.OAK_WOOD))) + // ; - private static Block register(final String name, final Block block) { - Registry.register(BuiltInRegistries.BLOCK, new ResourceLocation(GInstrumentMod.MODID, name), block); - return block; - } + // private static Block register(final String name, final Block block) { + // Registry.register(BuiltInRegistries.BLOCK, new ResourceLocation(GInstrumentMod.MODID, name), block); + // return block; + // } } diff --git a/src/main/java/com/cstav/genshinstrument/block/partial/InstrumentBlockEntity.java b/src/main/java/com/cstav/genshinstrument/block/partial/InstrumentBlockEntity.java index 3af0444..cdb12b6 100644 --- a/src/main/java/com/cstav/genshinstrument/block/partial/InstrumentBlockEntity.java +++ b/src/main/java/com/cstav/genshinstrument/block/partial/InstrumentBlockEntity.java @@ -4,8 +4,6 @@ import java.util.Set; import java.util.UUID; -import com.cstav.genshinstrument.block.ModBlockEntities; - import net.minecraft.core.BlockPos; import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -20,8 +18,8 @@ public InstrumentBlockEntity(BlockEntityType pType, BlockPos pPos, BlockState } //TODO remove after tests - public InstrumentBlockEntity(BlockPos pPos, BlockState pBlockState) { - super(ModBlockEntities.INSTRUMENT_BE, pPos, pBlockState); - } + // public InstrumentBlockEntity(BlockPos pPos, BlockState pBlockState) { + // super(ModBlockEntities.INSTRUMENT_BE, pPos, pBlockState); + // } } \ No newline at end of file diff --git a/src/main/java/com/cstav/genshinstrument/client/ClientInitiator.java b/src/main/java/com/cstav/genshinstrument/client/ClientInitiator.java index eb31a8b..af32a82 100644 --- a/src/main/java/com/cstav/genshinstrument/client/ClientInitiator.java +++ b/src/main/java/com/cstav/genshinstrument/client/ClientInitiator.java @@ -7,7 +7,6 @@ import com.cstav.genshinstrument.client.gui.screens.instrument.drum.AratakisGreatAndGloriousDrumScreen; import com.cstav.genshinstrument.client.gui.screens.instrument.floralzither.FloralZitherScreen; import com.cstav.genshinstrument.client.gui.screens.instrument.partial.InstrumentThemeLoader; -import com.cstav.genshinstrument.client.gui.screens.instrument.test.banjo.BanjoInstrumentScreen; import com.cstav.genshinstrument.client.gui.screens.instrument.vintagelyre.VintageLyreScreen; import com.cstav.genshinstrument.client.gui.screens.instrument.windsonglyre.WindsongLyreScreen; import com.cstav.genshinstrument.event.ClientEvents; @@ -22,10 +21,10 @@ public class ClientInitiator implements ClientModInitializer { private static final List> LOAD_ME = List.of( WindsongLyreScreen.class, VintageLyreScreen.class, - FloralZitherScreen.class, AratakisGreatAndGloriousDrumScreen.class, + FloralZitherScreen.class, AratakisGreatAndGloriousDrumScreen.class //TODO remove after tests - BanjoInstrumentScreen.class + // BanjoInstrumentScreen.class ); diff --git a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGridButton.java b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGridButton.java index 27e9fd6..a05e5fb 100644 --- a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGridButton.java +++ b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/partial/note/NoteGridButton.java @@ -1,3 +1,6 @@ +//TODO Move to the below package: +// package com.cstav.genshinstrument.client.gui.screens.instrument.partial.notegrid; +// Applies to all notegrid implementations, see Forge repository package com.cstav.genshinstrument.client.gui.screens.instrument.partial.note; import com.cstav.genshinstrument.client.config.ModClientConfigs; diff --git a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/test/banjo/BanjoInstrumentScreen.java b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/test/banjo/BanjoInstrumentScreen.java index 9866630..114f7b4 100644 --- a/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/test/banjo/BanjoInstrumentScreen.java +++ b/src/main/java/com/cstav/genshinstrument/client/gui/screens/instrument/test/banjo/BanjoInstrumentScreen.java @@ -1,79 +1,79 @@ -package com.cstav.genshinstrument.client.gui.screens.instrument.test.banjo; - -import com.cstav.genshinstrument.GInstrumentMod; -import com.cstav.genshinstrument.client.gui.screens.instrument.floralzither.FloralZitherScreen; -import com.cstav.genshinstrument.client.gui.screens.instrument.partial.AbstractGridInstrumentScreen; -import com.cstav.genshinstrument.client.gui.screens.instrument.partial.InstrumentThemeLoader; -import com.cstav.genshinstrument.sound.ModSounds; -import com.cstav.genshinstrument.sound.NoteSound; - -import net.fabricmc.api.EnvType; -import net.fabricmc.api.Environment; -import net.minecraft.client.Minecraft; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.InteractionHand; - -//TODO remove after tests -@Environment(EnvType.CLIENT) -public class BanjoInstrumentScreen extends AbstractGridInstrumentScreen { - public static final String INSTRUMENT_ID = "banjo"; - public static final String[] NOTES_LAYOUT = {"F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F"}; - - - @Override - public int rows() { - return 8; - } - - @SuppressWarnings("resource") - public int getNoteSize() { - final int guiScale = Minecraft.getInstance().options.guiScale().get(); - - return switch (guiScale) { - case 0 -> 40; - case 1 -> 35; - case 2 -> 41; - case 3 -> 48; - case 4 -> 41; - default -> guiScale * 18; - }; - } - - - public BanjoInstrumentScreen(InteractionHand hand) { - super(hand); - } - @Override - public ResourceLocation getInstrumentId() { - return new ResourceLocation(GInstrumentMod.MODID, INSTRUMENT_ID); - } - - - @Override - public ResourceLocation getSourcePath() { - return new ResourceLocation(GInstrumentMod.MODID, FloralZitherScreen.INSTRUMENT_ID); - } - - - @Override - public NoteSound[] getSounds() { - return ModSounds.BANJO; - } - - @Override - public String[] noteLayout() { - return NOTES_LAYOUT; - } - - @Override - public boolean isSSTI() { - return true; - } - - - private static final InstrumentThemeLoader THEME_LOADER = initThemeLoader(GInstrumentMod.MODID, FloralZitherScreen.INSTRUMENT_ID); - @Override - public InstrumentThemeLoader getThemeLoader() { - return THEME_LOADER; - } -} \ No newline at end of file +// package com.cstav.genshinstrument.client.gui.screens.instrument.test.banjo; + +// import com.cstav.genshinstrument.GInstrumentMod; +// import com.cstav.genshinstrument.client.gui.screens.instrument.floralzither.FloralZitherScreen; +// import com.cstav.genshinstrument.client.gui.screens.instrument.partial.AbstractGridInstrumentScreen; +// import com.cstav.genshinstrument.client.gui.screens.instrument.partial.InstrumentThemeLoader; +// import com.cstav.genshinstrument.sound.ModSounds; +// import com.cstav.genshinstrument.sound.NoteSound; + +// import net.fabricmc.api.EnvType; +// import net.fabricmc.api.Environment; +// import net.minecraft.client.Minecraft; +// import net.minecraft.resources.ResourceLocation; +// import net.minecraft.world.InteractionHand; + +// //TODO remove after tests +// @Environment(EnvType.CLIENT) +// public class BanjoInstrumentScreen extends AbstractGridInstrumentScreen { +// public static final String INSTRUMENT_ID = "banjo"; +// public static final String[] NOTES_LAYOUT = {"F#", "G", "G#", "A", "A#", "B", "C", "C#", "D", "D#", "E", "F"}; + + +// @Override +// public int rows() { +// return 8; +// } + +// @SuppressWarnings("resource") +// public int getNoteSize() { +// final int guiScale = Minecraft.getInstance().options.guiScale().get(); + +// return switch (guiScale) { +// case 0 -> 40; +// case 1 -> 35; +// case 2 -> 41; +// case 3 -> 48; +// case 4 -> 41; +// default -> guiScale * 18; +// }; +// } + + +// public BanjoInstrumentScreen(InteractionHand hand) { +// super(hand); +// } +// @Override +// public ResourceLocation getInstrumentId() { +// return new ResourceLocation(GInstrumentMod.MODID, INSTRUMENT_ID); +// } + + +// @Override +// public ResourceLocation getSourcePath() { +// return new ResourceLocation(GInstrumentMod.MODID, FloralZitherScreen.INSTRUMENT_ID); +// } + + +// @Override +// public NoteSound[] getSounds() { +// return ModSounds.BANJO; +// } + +// @Override +// public String[] noteLayout() { +// return NOTES_LAYOUT; +// } + +// @Override +// public boolean isSSTI() { +// return true; +// } + + +// private static final InstrumentThemeLoader THEME_LOADER = initThemeLoader(GInstrumentMod.MODID, FloralZitherScreen.INSTRUMENT_ID); +// @Override +// public InstrumentThemeLoader getThemeLoader() { +// return THEME_LOADER; +// } +// } \ No newline at end of file diff --git a/src/main/java/com/cstav/genshinstrument/item/InstrumentItem.java b/src/main/java/com/cstav/genshinstrument/item/InstrumentItem.java index 52b99ff..0730e4e 100644 --- a/src/main/java/com/cstav/genshinstrument/item/InstrumentItem.java +++ b/src/main/java/com/cstav/genshinstrument/item/InstrumentItem.java @@ -4,8 +4,8 @@ import com.cstav.genshinstrument.client.gui.screens.instrument.partial.AbstractInstrumentScreen; import com.cstav.genshinstrument.event.PosePlayerArmEvent; import com.cstav.genshinstrument.event.PosePlayerArmEvent.PosePlayerArmEventArgs; -import com.cstav.genshinstrument.mixin.util.CommonUtil; import com.cstav.genshinstrument.networking.OpenInstrumentPacketSender; +import com.cstav.genshinstrument.util.CommonUtil; import com.cstav.genshinstrument.util.ServerUtil; import net.fabricmc.api.EnvType; diff --git a/src/main/java/com/cstav/genshinstrument/item/ModItems.java b/src/main/java/com/cstav/genshinstrument/item/ModItems.java index 75346fd..975c5a3 100644 --- a/src/main/java/com/cstav/genshinstrument/item/ModItems.java +++ b/src/main/java/com/cstav/genshinstrument/item/ModItems.java @@ -28,13 +28,13 @@ public abstract class ModItems { )), GLORIOUS_DRUM = register("glorious_drum", new InstrumentItem( (player, hand) -> sendInternalOpenPacket(player, hand, "glorious_drum") - )), + )) - //TODO remove after tests - BANJO = register("banjo", new InstrumentItem( - (player, hand) -> sendInternalOpenPacket(player, hand, "banjo") - ) - ) + // //TODO remove after tests + // BANJO = register("banjo", new InstrumentItem( + // (player, hand) -> sendInternalOpenPacket(player, hand, "banjo") + // ) + // ) ; diff --git a/src/main/java/com/cstav/genshinstrument/mixin/util/CommonUtil.java b/src/main/java/com/cstav/genshinstrument/mixin/util/CommonUtil.java deleted file mode 100644 index 2239282..0000000 --- a/src/main/java/com/cstav/genshinstrument/mixin/util/CommonUtil.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.cstav.genshinstrument.mixin.util; - -import java.util.Optional; - -import net.minecraft.world.InteractionHand; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.Item; - -public abstract class CommonUtil { - - @SuppressWarnings("unchecked") - public static Optional getItemInHands(final Class item, final Player player) { - final Item mainItem = player.getItemInHand(InteractionHand.MAIN_HAND).getItem(), - offItem = player.getItemInHand(InteractionHand.OFF_HAND).getItem(); - - if (item.isInstance(mainItem)) - return Optional.of((T)mainItem); - else if (item.isInstance(offItem)) - return Optional.of((T)offItem); - - return Optional.empty(); - } - -} diff --git a/src/main/java/com/cstav/genshinstrument/networking/packets/INoteIdentifierSender.java b/src/main/java/com/cstav/genshinstrument/networking/packets/INoteIdentifierSender.java index 3f8fde0..930936e 100644 --- a/src/main/java/com/cstav/genshinstrument/networking/packets/INoteIdentifierSender.java +++ b/src/main/java/com/cstav/genshinstrument/networking/packets/INoteIdentifierSender.java @@ -1,3 +1,6 @@ +//TODO rename "packets" package to packet: +// package com.cstav.genshinstrument.networking.packet; +// Applies to all the other residents of the packets package package com.cstav.genshinstrument.networking.packets; import java.util.List; diff --git a/src/main/java/com/cstav/genshinstrument/networking/packets/instrument/OpenInstrumentPacket.java b/src/main/java/com/cstav/genshinstrument/networking/packets/instrument/OpenInstrumentPacket.java index 37494eb..c6b3f07 100644 --- a/src/main/java/com/cstav/genshinstrument/networking/packets/instrument/OpenInstrumentPacket.java +++ b/src/main/java/com/cstav/genshinstrument/networking/packets/instrument/OpenInstrumentPacket.java @@ -7,7 +7,6 @@ import com.cstav.genshinstrument.client.gui.screens.instrument.drum.AratakisGreatAndGloriousDrumScreen; import com.cstav.genshinstrument.client.gui.screens.instrument.floralzither.FloralZitherScreen; -import com.cstav.genshinstrument.client.gui.screens.instrument.test.banjo.BanjoInstrumentScreen; import com.cstav.genshinstrument.client.gui.screens.instrument.vintagelyre.VintageLyreScreen; import com.cstav.genshinstrument.client.gui.screens.instrument.windsonglyre.WindsongLyreScreen; import com.cstav.genshinstrument.networking.IModPacket; @@ -25,10 +24,10 @@ public class OpenInstrumentPacket implements IModPacket { "windsong_lyre", () -> WindsongLyreScreen::new, "vintage_lyre", () -> VintageLyreScreen::new, "floral_zither", () -> FloralZitherScreen::new, - "glorious_drum", () -> AratakisGreatAndGloriousDrumScreen::new, + "glorious_drum", () -> AratakisGreatAndGloriousDrumScreen::new - //TODO remove after tests - "banjo", () -> BanjoInstrumentScreen::new + // //TODO remove after tests + // "banjo", () -> BanjoInstrumentScreen::new ); protected Map>> getInstrumentMap() { diff --git a/src/main/java/com/cstav/genshinstrument/sound/ModSounds.java b/src/main/java/com/cstav/genshinstrument/sound/ModSounds.java index 4bd3dfb..59f4788 100644 --- a/src/main/java/com/cstav/genshinstrument/sound/ModSounds.java +++ b/src/main/java/com/cstav/genshinstrument/sound/ModSounds.java @@ -3,12 +3,9 @@ import static com.cstav.genshinstrument.sound.NoteSoundRegistrer.createInstrumentNotes; import static com.cstav.genshinstrument.sound.NoteSoundRegistrer.registerNote; -import java.util.Optional; - import com.cstav.genshinstrument.GInstrumentMod; import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.level.block.state.properties.NoteBlockInstrument; public class ModSounds { @@ -22,12 +19,12 @@ public class ModSounds { GLORIOUS_DRUM = new NoteSound[] { registerNote(loc("glorious_drum_don")), registerNote(loc("glorious_drum_ka"), true) - }, - - // TODO remove after tests - BANJO = new NoteSound[] { - new NoteSound(NoteBlockInstrument.BANJO.getSoundEvent().value(), Optional.empty()) } + + // // TODO remove after tests + // BANJO = new NoteSound[] { + // new NoteSound(NoteBlockInstrument.BANJO.getSoundEvent().value(), Optional.empty()) + // } ; /** diff --git a/src/main/java/com/cstav/genshinstrument/util/CommonUtil.java b/src/main/java/com/cstav/genshinstrument/util/CommonUtil.java index 03ac5af..4ab5aa7 100644 --- a/src/main/java/com/cstav/genshinstrument/util/CommonUtil.java +++ b/src/main/java/com/cstav/genshinstrument/util/CommonUtil.java @@ -1,16 +1,32 @@ package com.cstav.genshinstrument.util; import java.util.List; +import java.util.Optional; import com.google.common.collect.Lists; import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.InteractionHand; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.level.Level; import net.minecraft.world.phys.AABB; public abstract class CommonUtil { + @SuppressWarnings("unchecked") + public static Optional getItemInHands(final Class item, final Player player) { + final Item mainItem = player.getItemInHand(InteractionHand.MAIN_HAND).getItem(), + offItem = player.getItemInHand(InteractionHand.OFF_HAND).getItem(); + + if (item.isInstance(mainItem)) + return Optional.of((T)mainItem); + else if (item.isInstance(offItem)) + return Optional.of((T)offItem); + + return Optional.empty(); + } + /** * @return What the default level shouldve returned, but without any conditions */ @@ -24,6 +40,7 @@ public static List getPlayersInArea(final Level level, final AABB area) return list; } + /** * @param dir The directory location at which to grab the specified resource * @param path The desired path to obtain from the {@code dir} @@ -36,6 +53,7 @@ public static ResourceLocation getResourceFrom(final ResourceLocation dir, final ); } + /** * Provides a similar behaviour to python's indexing,