Skip to content

Commit

Permalink
Merge branch 'dev' into 1.19.4
Browse files Browse the repository at this point in the history
  • Loading branch information
StavWasPlayZ committed Aug 5, 2023
2 parents 5295930 + 7819cbb commit c6fafcf
Show file tree
Hide file tree
Showing 14 changed files with 160 additions and 185 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,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;
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;
// }
// }
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
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 @@ -27,13 +27,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
24 changes: 0 additions & 24 deletions src/main/java/com/cstav/genshinstrument/mixin/util/CommonUtil.java

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Loading

0 comments on commit c6fafcf

Please sign in to comment.