Skip to content

Commit

Permalink
Remove test items
Browse files Browse the repository at this point in the history
  • Loading branch information
StavWasPlayZ committed Aug 5, 2023
1 parent 02583b1 commit 7819cbb
Show file tree
Hide file tree
Showing 9 changed files with 135 additions and 160 deletions.
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");
// }

}
// }
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 src/main/java/com/cstav/genshinstrument/block/ModBlocks.java
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;
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
// }

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,10 +21,10 @@ public class ClientInitiator implements ClientModInitializer {

private static final List<Class<?>> LOAD_ME = List.of(
WindsongLyreScreen.class, VintageLyreScreen.class,
FloralZitherScreen.class, AratakisGreatAndGloriousDrumScreen.class,
FloralZitherScreen.class, AratakisGreatAndGloriousDrumScreen.class

//TODO remove after tests
BanjoInstrumentScreen.class
// BanjoInstrumentScreen.class
);


Expand Down
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;
// }
// }
12 changes: 6 additions & 6 deletions src/main/java/com/cstav/genshinstrument/item/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -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")
// )
// )
;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String, Supplier<Function<InteractionHand, Screen>>> getInstrumentMap() {
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/com/cstav/genshinstrument/sound/ModSounds.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand All @@ -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())
// }
;

/**
Expand Down

0 comments on commit 7819cbb

Please sign in to comment.