Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
StavWasPlayZ committed May 6, 2023
2 parents 8b68117 + da5d4f8 commit 1053a23
Show file tree
Hide file tree
Showing 22 changed files with 136 additions and 138 deletions.
24 changes: 10 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins {
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}

version = '2.3'
version = '2.4'
group = 'com.cstav.genshinstrument' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'genshinstrument'
archivesBaseName = 'genshinstrument-1.19.3'

// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Expand Down Expand Up @@ -131,6 +131,7 @@ dependencies {
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft 'net.minecraftforge:forge:1.19.3-44.1.23'
// minecraft 'not.real:fdorge:1.19.3-44.1.23'

// Real mod deobf dependency examples - these get remapped to your current mappings
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency
Expand Down Expand Up @@ -164,6 +165,12 @@ jar.finalizedBy('reobfJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
// publish.dependsOn('reobfJar')

java {
withSourcesJar()
// Compiling docs is weird
// withJavadocJar()
}

publishing {
publications {
mavenJava(MavenPublication) {
Expand All @@ -182,18 +189,7 @@ tasks.withType(JavaCompile).configureEach {
}



task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

artifacts {
archives sourcesJar
archives javadocJar
// archives javadocJar
}
8 changes: 5 additions & 3 deletions public/updates.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@

"2.2.1": "Texture fixes",

"2.3": "- More texture fixes\n- Better API implementation"
"2.3": "- More texture fixes\n- Better API implementation",

"2.4": "- Minor techincal fixes"
},

"promos": {
"1.19.3-latest": "2.3",
"1.19.3-recommended": "2.3"
"1.19.3-latest": "2.4",
"1.19.3-recommended": "2.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
import com.cstav.genshinstrument.sound.NoteSound;
import com.mojang.blaze3d.platform.InputConstants.Key;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.components.LinearLayoutWidget;
import net.minecraft.client.gui.components.LinearLayoutWidget.Orientation;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
Expand All @@ -28,6 +28,10 @@
public class AratakisGreatAndGloriousDrumScreen extends AbstractInstrumentScreen {
public static final String INSTRUMENT_ID = "glorious_drum";

public AratakisGreatAndGloriousDrumScreen(ItemStack instrument) {
super(instrument);
}

/**
* Maps keycodes to their respected note button
*/
Expand Down Expand Up @@ -79,7 +83,7 @@ private LinearLayoutWidget createRow(DrumButtonType type, float widthPercent) {
return layout;
}
private NoteButton createButton(DrumButtonType btnType, LinearLayoutWidget container, Key key, boolean isRight) {
final NoteButton btn = new DrumNoteButton(btnType, isRight, this);
final NoteButton btn = new DrumNoteButton(instrument, btnType, isRight, this);

container.addChild(btn);
notes.put(key.getValue(), btn);
Expand Down Expand Up @@ -126,11 +130,5 @@ public InstrumentThemeLoader getThemeLoader() {
public NoteSound[] getSounds() {
return ModSounds.GLORIOUS_DRUM;
}



public static void open() {
Minecraft.getInstance().setScreen(new AratakisGreatAndGloriousDrumScreen());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.cstav.genshinstrument.client.config.ModClientConfigs;
import com.cstav.genshinstrument.client.gui.screens.instrument.partial.note.NoteButton;

import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand All @@ -12,9 +13,10 @@ public class DrumNoteButton extends NoteButton {
public final DrumButtonType btnType;
public final boolean isRight;

public DrumNoteButton(final DrumButtonType btnType, boolean isLeft, AratakisGreatAndGloriousDrumScreen drumScreen) {
public DrumNoteButton(ItemStack drum, DrumButtonType btnType, boolean isLeft, AratakisGreatAndGloriousDrumScreen drumScreen) {
super(
btnType.getSound(), ModClientConfigs.DRUM_LABEL_TYPE.get().getLabelSupplier(),
drum, btnType.getSound(),
ModClientConfigs.DRUM_LABEL_TYPE.get().getLabelSupplier(),
btnType.getIndex(), 2,
drumScreen, 13, .34f, 1.01f
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.cstav.genshinstrument.client.gui.screens.options.instrument.FloralZitherOptionsScreen;
import com.cstav.genshinstrument.sound.NoteSound;

import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
Expand All @@ -22,6 +22,10 @@
public class FloralZitherScreen extends AbstractGridInstrumentScreen {
public static final String INSTRUMENT_ID = "floral_zither";

public FloralZitherScreen(ItemStack instrument) {
super(instrument);
}


@Override
protected ResourceLocation getInstrumentResourcesLocation() {
Expand All @@ -46,11 +50,5 @@ public NoteSound[] getSounds() {
protected AbstractInstrumentOptionsScreen initInstrumentOptionsScreen() {
return new FloralZitherOptionsScreen(this);
}



public static void open() {
Minecraft.getInstance().setScreen(new FloralZitherScreen());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@
import com.cstav.genshinstrument.client.keyMaps.KeyMappings;

import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

@OnlyIn(Dist.CLIENT)
public abstract class AbstractGridInstrumentScreen extends AbstractInstrumentScreen {
public static final int DEF_ROWS = 7, DEF_COLUMNS = 3;
public AbstractGridInstrumentScreen(ItemStack instrument) {
super(instrument);
}

public int columns() {
return DEF_COLUMNS;
Expand All @@ -29,7 +33,7 @@ public int rows() {
*/
public NoteGrid initNoteGrid() {
return new NoteGrid(
rows(), columns(), getSounds(), this
instrument, rows(), columns(), getSounds(), this
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand Down Expand Up @@ -83,9 +84,11 @@ public ResourceLocation getResourceFromRoot(final String path) {

protected final AbstractInstrumentOptionsScreen optionsScreen = initInstrumentOptionsScreen();

public AbstractInstrumentScreen() {
public final ItemStack instrument;
public AbstractInstrumentScreen(final ItemStack instrument) {
super(Component.empty());

this.instrument = instrument;
optionsScreen.setOnCloseRunnable(this::onOptionsClose);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.cstav.genshinstrument.client.gui.screens.instrument.partial.note;

import java.util.UUID;
import java.awt.Color;
import java.util.UUID;

import com.cstav.genshinstrument.client.config.ModClientConfigs;
import com.cstav.genshinstrument.client.gui.screens.instrument.partial.AbstractInstrumentScreen;
Expand All @@ -25,6 +25,7 @@
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundSource;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
Expand Down Expand Up @@ -53,7 +54,9 @@ public static int getSize() {

protected final Minecraft minecraft = Minecraft.getInstance();

protected NoteSound sound;
public NoteSound sound;
public final ItemStack instrument;

protected final int noteTextureRow, rowsInNoteTexture;
protected final Color colorTheme, pressedColorTheme;
protected final ResourceLocation rootLocation, noteLocation, noteBgLocation;
Expand All @@ -63,14 +66,16 @@ public static int getSize() {
//FIXME Actually figure out a formula instead of guessing
private float randomAssMultiplier1 = .9f, randomAssMultiplier2 = 1.025f;

public NoteButton(NoteSound sound, NoteLabelSupplier labelSupplier, int noteTextureRow, int rowsInNoteTexture,
public NoteButton(ItemStack instrument, NoteSound sound,
NoteLabelSupplier labelSupplier, int noteTextureRow, int rowsInNoteTexture,
AbstractInstrumentScreen instrumentScreen) {
super(Button.builder(null, (iAmADissapointmentAndAFailureToMyParents) -> {})
.size(getSize(), getSize())
);


this.sound = sound;
this.instrument = instrument;

this.labelSupplier = labelSupplier;
colorTheme = instrumentScreen.getThemeLoader().getNoteTheme();
Expand All @@ -84,9 +89,10 @@ public NoteButton(NoteSound sound, NoteLabelSupplier labelSupplier, int noteText
this.noteBgLocation = getResourceFromRoot(NOTE_BG_FILENAME);

}
public NoteButton(NoteSound sound, NoteLabelSupplier labelSupplier, int noteTextureRow, int rowsInNoteTexture,
public NoteButton(ItemStack instrument, NoteSound sound,
NoteLabelSupplier labelSupplier, int noteTextureRow, int rowsInNoteTexture,
AbstractInstrumentScreen instrumentScreen, int noteTextureWidth, float randomAssMultiplier1, float randomAssMultiplier2) {
this(sound, labelSupplier, noteTextureRow, rowsInNoteTexture, instrumentScreen);
this(instrument, sound, labelSupplier, noteTextureRow, rowsInNoteTexture, instrumentScreen);

this.noteTextureWidth = noteTextureWidth;
this.randomAssMultiplier1 = randomAssMultiplier1;
Expand Down Expand Up @@ -241,7 +247,7 @@ public void play(final boolean playLocally) {
if (playLocally)
playDownSound(minecraft.getSoundManager());

ModPacketHandler.sendToServer(new InstrumentPacket(sound));
ModPacketHandler.sendToServer(new InstrumentPacket(sound, instrument));

locked = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraft.client.gui.components.FrameWidget;
import net.minecraft.client.gui.components.GridWidget;
import net.minecraft.client.gui.components.GridWidget.RowHelper;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand All @@ -26,13 +27,16 @@ public class NoteGrid implements Iterable<NoteButton> {


private final NoteButton[][] notes;
public final int rows, columns;
private NoteSound[] noteSounds;

public NoteGrid(final int rows, final int columns, NoteSound[] noteSounds, AbstractInstrumentScreen instrumentScreen) {
public final int rows, columns;
public final ItemStack instrument;

public NoteGrid(ItemStack instrument, int rows, int columns, NoteSound[] noteSounds, AbstractInstrumentScreen instrumentScreen) {
this.rows = rows;
this.columns = columns;
this.noteSounds = noteSounds;
this.instrument = instrument;

// Construct the note grid
notes = new NoteButton[columns][rows];
Expand All @@ -57,8 +61,8 @@ public void updatePitch() {
);
}

protected NoteButton createNote(final int row, final int column, final AbstractInstrumentScreen instrumentScreen) {
return new NoteGridButton(row, column,
protected NoteButton createNote(int row, int column, AbstractInstrumentScreen instrumentScreen) {
return new NoteGridButton(instrument, row, column,
getSoundAt(noteSounds, row, column), getLabelSupplier(), rows
, instrumentScreen);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.cstav.genshinstrument.client.gui.screens.instrument.partial.note.label.NoteLabelSupplier;
import com.cstav.genshinstrument.sound.NoteSound;

import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand All @@ -13,9 +14,9 @@ public class NoteGridButton extends NoteButton {
public final int row, column,
maxRows;

public NoteGridButton(int row, int column, NoteSound sound, NoteLabelSupplier labelSupplier, int maxRows,
public NoteGridButton(ItemStack instrument, int row, int column, NoteSound sound, NoteLabelSupplier labelSupplier, int maxRows,
AbstractInstrumentScreen instrumentScreen) {
super(sound, labelSupplier, row, maxRows, instrumentScreen);
super(instrument, sound, labelSupplier, row, maxRows, instrumentScreen);


this.row = row;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import com.cstav.genshinstrument.sound.ModSounds;
import com.cstav.genshinstrument.sound.NoteSound;

import net.minecraft.client.Minecraft;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
Expand All @@ -22,6 +22,10 @@
public class VintageLyreScreen extends AbstractGridInstrumentScreen {
public static final String INSTRUMENT_ID = "vintage_lyre";

public VintageLyreScreen(ItemStack instrument) {
super(instrument);
}


@Override
protected ResourceLocation getInstrumentResourcesLocation() {
Expand All @@ -47,14 +51,8 @@ public NoteSound[] getSounds() {
@Override
public NoteGrid initNoteGrid() {
return new VintageNoteGrid(
rows(), columns(), getSounds(), this
instrument, rows(), columns(), getSounds(), this
);
}



public static void open() {
Minecraft.getInstance().setScreen(new VintageLyreScreen());
}

}
Loading

0 comments on commit 1053a23

Please sign in to comment.