-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
02583b1
commit 7819cbb
Showing
9 changed files
with
135 additions
and
160 deletions.
There are no files selected for viewing
42 changes: 21 additions & 21 deletions
42
src/main/java/com/cstav/genshinstrument/block/LyreInstrumentBlock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"); | ||
// } | ||
|
||
} | ||
// } |
25 changes: 8 additions & 17 deletions
25
src/main/java/com/cstav/genshinstrument/block/ModBlockEntities.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<InstrumentBlockEntity> INSTRUMENT_BE = regsiter("instrument_be", | ||
BlockEntityType.Builder.of((pos, state) -> new InstrumentBlockEntity(pos, state), ModBlocks.LYRE_BLOCK) | ||
.build(null) | ||
); | ||
// public static final BlockEntityType<InstrumentBlockEntity> INSTRUMENT_BE = regsiter("instrument_be", | ||
// BlockEntityType.Builder.of((pos, state) -> new InstrumentBlockEntity(pos, state), ModBlocks.LYRE_BLOCK) | ||
// .build(null) | ||
// ); | ||
|
||
private static <T extends BlockEntity> BlockEntityType<T> regsiter(final String name, final BlockEntityType<T> bet) { | ||
Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, new ResourceLocation(GInstrumentMod.MODID, name), bet); | ||
return bet; | ||
} | ||
// private static <T extends BlockEntity> BlockEntityType<T> regsiter(final String name, final BlockEntityType<T> bet) { | ||
// Registry.register(BuiltInRegistries.BLOCK_ENTITY_TYPE, new ResourceLocation(GInstrumentMod.MODID, name), bet); | ||
// return bet; | ||
// } | ||
} |
25 changes: 8 additions & 17 deletions
25
src/main/java/com/cstav/genshinstrument/block/ModBlocks.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
// } | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
158 changes: 79 additions & 79 deletions
158
...cstav/genshinstrument/client/gui/screens/instrument/test/banjo/BanjoInstrumentScreen.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} | ||
// 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; | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters