Skip to content

Commit

Permalink
Updated to 1.19.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MisterJulsen committed Oct 18, 2023
1 parent cc64c7a commit 63f491c
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 79 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.parchmentmc.librarian.forgegradle'


version = '1.0.0-1.19.2'
version = '1.0.0-1.19.3'
group = 'de.mrjulsen.mineify' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'mineify'

Expand All @@ -47,7 +47,7 @@ minecraft {
//
// Use non-default mappings at your own risk. They may not always work.
// Simply re-run your setup task after changing the mappings to update your workspace.
mappings channel: 'parchment', version: '1.19.2-2022.11.27-1.19.2'
mappings channel: 'parchment', version: '1.19.3-2023.06.25-1.19.3'

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Currently, this location cannot be changed from the default.

Expand Down Expand Up @@ -158,7 +158,7 @@ dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed
// 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.2-43.3.0'
minecraft 'net.minecraftforge:forge:1.19.3-44.1.0'

// https://mavenlibs.com/maven/dependency/org.jcraft/jorbis
// minecraftLibrary ("org.jcraft:jorbis:0.0.17")
Expand Down
8 changes: 6 additions & 2 deletions src/main/java/de/mrjulsen/mineify/blocks/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import java.util.function.Supplier;

import de.mrjulsen.mineify.ModMain;
import de.mrjulsen.mineify.events.ModCreativeTabs;
import de.mrjulsen.mineify.items.ModItems;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.CreativeModeTabs;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.eventbus.api.IEventBus;
Expand All @@ -17,7 +19,7 @@ public class ModBlocks {
public static final DeferredRegister<Block> BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ModMain.MOD_ID);


public static final RegistryObject<Block> SOUND_PLAYER = registerBlock("sound_player", () -> new SoundPlayer(), CreativeModeTab.TAB_REDSTONE);
public static final RegistryObject<Block> SOUND_PLAYER = registerBlock("sound_player", () -> new SoundPlayer(), CreativeModeTabs.REDSTONE_BLOCKS);


private static <T extends Block>RegistryObject<T> registerBlock(String name, Supplier<T> block, CreativeModeTab tab) {
Expand All @@ -28,7 +30,9 @@ private static <T extends Block>RegistryObject<T> registerBlock(String name, Sup

private static <T extends Block>RegistryObject<Item> registerBlockItem(String name, RegistryObject<T> block, CreativeModeTab tab) {
return ModItems.ITEMS.register(name, () -> {
return new BlockItem(block.get(), new Item.Properties().tab(tab));
BlockItem item = new BlockItem(block.get(), new Item.Properties());
ModCreativeTabs.setCreativeTab(item, tab);
return item;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ public ErrorMessageScreen(Screen last, Component title, Component message) {
protected void init() {
super.init();

this.addRenderableWidget(
new Button(this.width / 2 - 50, height - 40, 100, 20, CommonComponents.GUI_BACK, (p_96057_) -> {
this.addRenderableWidget(Button.builder(CommonComponents.GUI_BACK, (p_96057_) -> {
this.minecraft.setScreen(lastScreen);
}));
}).pos(this.width / 2 - 50, height - 40).size(100, 20).build());

this.messageLabel = MultiLineLabel.create(this.font, message, 256, 20);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.Util;
import net.minecraft.client.gui.components.Button;
import net.minecraft.client.gui.components.MultiLineLabel;
import net.minecraft.client.gui.components.Tooltip;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
Expand All @@ -29,26 +30,20 @@ public FFMPEGMissingScreen(Screen last) {
@Override
protected void init() {
super.init();
this.addRenderableWidget(
new Button(this.width / 2 - 100, 150, 200, 20, Component.translatable("gui.mineify.soundselection.upload.ffmpeg_missing.ffmpeg_web"), (p_96057_) -> {

this.addRenderableWidget(Button.builder(Component.translatable("gui.mineify.soundselection.upload.ffmpeg_missing.ffmpeg_web"), (p_96057_) -> {
Util.getPlatform().openUri(Constants.FFMPEG_WEB);
}, new Button.OnTooltip() {
@Override
public void onTooltip(Button pButton, PoseStack pPoseStack, int pMouseX, int pMouseY) {
FFMPEGMissingScreen.this.renderTooltip(pPoseStack, Component.literal(Constants.FFMPEG_WEB), pMouseX, pMouseY);
}
}));
}).pos(this.width / 2 - 100, 150).size(200, 20).tooltip(Tooltip.create(Component.literal(Constants.FFMPEG_WEB))).build());

this.addRenderableWidget(
new Button(this.width / 2 - 100, 175, 200, 20, Component.translatable("gui.mineify.soundselection.upload.ffmpeg_missing.show_folder"), (p_96057_) -> {
this.addRenderableWidget(Button.builder(Component.translatable("gui.mineify.soundselection.upload.ffmpeg_missing.show_folder"), (p_96057_) -> {
IOUtils.createDirectory(Constants.FFMPEG_HOME);
Util.getPlatform().openFile(new File(Constants.FFMPEG_HOME));
}));
}).pos(this.width / 2 - 100, 175).size(200, 20).build());

this.addRenderableWidget(
new Button(this.width / 2 - 50, 210, 100, 20, CommonComponents.GUI_BACK, (p_96057_) -> {
this.minecraft.setScreen(lastScreen);
}));
this.addRenderableWidget(Button.builder(CommonComponents.GUI_BACK, (p_96057_) -> {
IOUtils.createDirectory(Constants.FFMPEG_HOME);
Util.getPlatform().openFile(new File(Constants.FFMPEG_HOME));
}).pos(this.width / 2 - 50, 21).size(100, 20).build());

this.messageLabel = MultiLineLabel.create(this.font, message, 256, 10);
}
Expand All @@ -65,4 +60,9 @@ public void render(PoseStack pPoseStack, int pMouseX, int pMouseY, float pPartia
public boolean shouldCloseOnEsc() {
return true;
}

@Override
public void onClose() {
this.minecraft.setScreen(lastScreen);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ public void init() {

guiTop = this.height / 2 - HEIGHT / 2;

this.addRenderableWidget(new Button(this.width / 2 - 100, guiTop + 210, 97, 20, btnDoneTxt, (p) -> {
this.addRenderableWidget(Button.builder(btnDoneTxt, (p) -> {
this.onDone();
}));
}).pos(this.width / 2 - 100, guiTop + 210).size(97, 20).build());

this.addRenderableWidget(new Button(this.width / 2 + 4, guiTop + 210, 97, 20, btnCancelTxt, (p) -> {
this.addRenderableWidget(Button.builder(btnCancelTxt, (p) -> {
this.onCancel();
}));
}).pos(this.width / 2 + 4, guiTop + 210).size(97, 20).build());


/* Controls */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,30 +86,28 @@ protected void init() {
this.defaultControls.components.clear();
this.loadingScreenControls.components.clear();

cancelButton = this.loadingScreenControls.add(new Button(this.width / 2 - 50, this.height - 50, 100, 20,
CommonComponents.GUI_CANCEL, (p_100004_) -> {
cancelButton = this.loadingScreenControls.add(Button.builder(CommonComponents.GUI_CANCEL, (p_100004_) -> {
this.onClose();
}));
}).pos(this.width / 2 - 50, this.height - 50).size(100, 20).build());

this.defaultControls.add(new Button(this.width / 2 + 4 + (b ? 50 : 0), this.height - 30, 100 + (b ? 0 : 50), 20, CommonComponents.GUI_DONE, (p_100036_) -> {
this.defaultControls.add(Button.builder(CommonComponents.GUI_DONE, (p_100036_) -> {
this.onDone();
}));
}).pos(this.width / 2 + 4 + (b ? 50 : 0), this.height - 30).size(100 + (b ? 0 : 50), 20).build());

if (b) {
this.defaultControls.add(new Button(this.width / 2 - 50, this.height - 30, 100, 20,
textOpenFolder, (p_100004_) -> {
this.defaultControls.add(Button.builder(textOpenFolder, (p_100004_) -> {
Util.getPlatform().openFile(this.soundsDir);
}));
}).pos(this.width / 2 - 50, this.height - 30).size(100, 20).build());
}

this.defaultControls.add(new Button(this.width / 2 - 154, this.height - 30, 100 + (b ? 0 : 50), 20, textUpload, (p_100036_) -> {
this.defaultControls.add(Button.builder(textUpload, (p_100036_) -> {
ClientApi.showUploadDialog((path) -> {
if (path == null)
return;

onFilesDrop(new ArrayList<Path>(List.of(path)));
});
}));
}).pos(this.width / 2 - 154, this.height - 30).size(100 + (b ? 0 : 50), 20).build());

this.defaultControls.add(CycleButton.onOffBuilder(this.loop)
.withInitialValue(this.loop)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,30 +92,28 @@ protected void init() {
this.defaultControls.components.clear();
this.loadingScreenControls.components.clear();

cancelButton = this.loadingScreenControls.add(new Button(this.width / 2 - 50, this.height - 50, 100, 20,
CommonComponents.GUI_CANCEL, (p_100004_) -> {
cancelButton = this.loadingScreenControls.add(Button.builder(CommonComponents.GUI_CANCEL, (p_100004_) -> {
this.onClose();
}));
}).pos(this.width / 2 - 50, this.height - 50).size(100, 20).build());

this.defaultControls.add(new Button(this.width / 2 + 4 + (b ? 50 : 0), this.height - 30, 100 + (b ? 0 : 50), 20, textClose, (p_100036_) -> {
this.defaultControls.add(Button.builder(textClose, (p_100036_) -> {
this.onClose();
}));
}).pos(this.width / 2 + 4 + (b ? 50 : 0), this.height - 30).size(100 + (b ? 0 : 50), 20).build());

if (b) {
this.defaultControls.add(new Button(this.width / 2 - 50, this.height - 30, 100, 20,
textOpenFolder, (p_100004_) -> {
this.defaultControls.add(Button.builder(textOpenFolder, (p_100004_) -> {
Util.getPlatform().openFile(this.soundsDir);
}));
}).pos(this.width / 2 - 50, this.height - 30).size(100, 20).build());
}

this.defaultControls.add(new Button(this.width / 2 - 154, this.height - 30, 100 + (b ? 0 : 50), 20, textUpload, (p_100036_) -> {
this.defaultControls.add(Button.builder(textUpload, (p_100036_) -> {
ClientApi.showUploadDialog((path) -> {
if (path == null)
return;

onFilesDrop(new ArrayList<Path>(List.of(path)));
});
}));
}).pos(this.width / 2 - 154, this.height - 30).size(100 + (b ? 0 : 50), 20).build());

this.distanceSlider = this.addRenderableWidget(new ForgeSlider(this.width / 2 - 154, this.height - 55, 150, 20, textDistance, Component.literal(""), 1, ModCommonConfig.SOUND_BOARD_MAX_DISTANCE.get(), this.distance, 1, 1, true));
this.pitchSlider = this.addRenderableWidget(new ForgeSlider(this.width / 2 + 4, this.height - 55, 150, 20, textPitch, Component.literal(""), Constants.PITCH_MIN, Constants.PITCH_MAX, this.pitch, 0.01D, 4, true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public void init() {

guiTop = this.height / 2 - HEIGHT / 2;

this.addRenderableWidget(new Button(this.width / 2 - 100, guiTop + 100, 97, 20, CommonComponents.GUI_DONE, (p) -> {
this.addRenderableWidget(Button.builder(CommonComponents.GUI_DONE, (p) -> {
this.onDone();
}));
}).pos(this.width / 2 - 100, guiTop + 100).size(97, 20).build());

this.addRenderableWidget(new Button(this.width / 2 + 4, guiTop + 100, 97, 20, CommonComponents.GUI_CANCEL, (p) -> {
this.addRenderableWidget(Button.builder(CommonComponents.GUI_CANCEL, (p) -> {
this.onCancel();
}));
}).pos(this.width / 2 + 4, guiTop + 100).size(97, 20).build());

this.volumeSlider = this.addRenderableWidget(new CustomMessageSlider(this.width / 2 - 100, guiTop + 25, 200, 20, Component.literal(""), Component.literal(""), Constants.VOLUME_MIN, Constants.VOLUME_MAX, this.volume, 0.01D, 1, true, (slider) -> {
slider.setMessage(Component.literal(Component.translatable("gui.mineify.sound_config.volume").getString() + ": " + (int)(slider.getValue() * 100.0D) + "%"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,21 @@ public void init() {

guiTop = this.height / 2 - HEIGHT / 2;

this.addRenderableWidget(new Button(this.width / 2 - 100, guiTop + 160, 97, 20, btnDoneTxt, (p) -> {
this.addRenderableWidget(Button.builder(btnDoneTxt, (p) -> {
this.onDone();
}));
}).pos(this.width / 2 - 100, guiTop + 160).size(97, 20).build());

this.addRenderableWidget(new Button(this.width / 2 + 4, guiTop + 160, 97, 20, btnCancelTxt, (p) -> {
this.addRenderableWidget(Button.builder(btnCancelTxt, (p) -> {
this.onCancel();
}));
}).pos(this.width / 2 + 4, guiTop + 160).size(97, 20).build());


/* Controls */
this.addRenderableWidget(new Button(this.width / 2 - 100, guiTop + 25, 200, 20, textPlaylist, (p) -> {
this.addRenderableWidget(Button.builder(textPlaylist, (p) -> {
Minecraft.getInstance().setScreen(new PlaylistScreen(this, this.playlist, (data) -> {
this.playlist = data;
}));
}));
}).pos(this.width / 2 - 100, guiTop + 25).size(200, 20).build());

lockButton = new LockIconButton(this.width / 2 + 104, guiTop + 25, (button) -> {
this.locked = !locked;
Expand All @@ -107,21 +107,21 @@ public void init() {

//60, 85, 110

this.addRenderableWidget(new Button(this.width / 2 - 100, guiTop + 50, 200, 20, textZone, (p) -> {
this.addRenderableWidget(Button.builder(textZone, (p) -> {
Minecraft.getInstance().setScreen(new PlaybackAreaConfigScreen(this, new PlaybackArea(this.playbackArea), (success, data) -> {
if (success) {
this.playbackArea = data;
}
}));
}));
}).pos(this.width / 2 - 100, guiTop + 50).size(200, 20).build());

this.addRenderableWidget(new Button(this.width / 2 - 100, guiTop + 75, 200, 20, textSoundConfig, (p) -> {
this.addRenderableWidget(Button.builder(textSoundConfig, (p) -> {
Minecraft.getInstance().setScreen(new SoundConfigScreen(this, volume, pitch, (value) -> {
this.volume = value;
}, (value) -> {
this.pitch = value;
}));
}));
}).pos(this.width / 2 - 100, guiTop + 75).size(200, 20).build());

this.triggerButton = this.addRenderableWidget(CycleButton.<ETrigger>builder((p) -> {
return Component.translatable(p.getTranslationKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ public void init() {

guiTop = this.height / 2 - HEIGHT / 2;

this.doneButton = this.addRenderableWidget(new Button(this.width / 2 - 100, guiTop + 160, 97, 20, btnDoneTxt, (p) -> {
this.doneButton = this.addRenderableWidget(Button.builder(btnDoneTxt, (p) -> {
this.onDone();
}));
}).pos(this.width / 2 - 100, guiTop + 160).size(97, 20).build());

this.addRenderableWidget(new Button(this.width / 2 + 4, guiTop + 160, 97, 20, btnCancelTxt, (p) -> {
this.addRenderableWidget(Button.builder(btnCancelTxt, (p) -> {
this.onCancel();
}));
}).pos(this.width / 2 + 4, guiTop + 160).size(97, 20).build());

this.filenameBox = new EditBox(this.font, this.width / 2 - 100, guiTop + 40, 200, 20, Component.translatable("gui.mineify.upload.filename"));
this.filenameBox.setMaxLength(ModCommonConfig.MAX_FILENAME_LENGTH.get());
Expand Down Expand Up @@ -193,7 +193,7 @@ public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks)
Utils.renderTooltip(this, this.channelsButton, () -> { return Utils.getEnumTooltipData(this, ESoundChannels.class, width / 3); }, stack, mouseX, mouseY);
Utils.renderTooltip(this, this.qualitySlider, () -> { return Utils.getTooltipData(this, Component.translatable("gui.mineify.quality.description"), width / 3); }, stack, mouseX, mouseY);

if (!this.doneButton.active && mouseX >= this.doneButton.x && mouseX <= this.doneButton.x + this.doneButton.getWidth() && mouseY >= this.doneButton.y && mouseY <= this.doneButton.y + this.doneButton.getHeight()) {
if (!this.doneButton.active && mouseX >= this.doneButton.getX() && mouseX <= this.doneButton.getX() + this.doneButton.getWidth() && mouseY >= this.doneButton.getY() && mouseY <= this.doneButton.getY() + this.doneButton.getHeight()) {
this.renderTooltip(stack, Utils.getTooltipData(this, Component.translatable("gui.mineify.upload.file_duplicate"), width / 3), mouseX, mouseY, this.getMinecraft().font);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
import net.minecraft.commands.synchronization.ArgumentTypeInfos;
import net.minecraft.commands.synchronization.SingletonArgumentInfo;
import net.minecraft.core.Registry;
import net.minecraft.core.registries.Registries;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;

public class ModCommandArguments {

public static final DeferredRegister<ArgumentTypeInfo<?, ?>> COMMAND_ARGUMENTS = DeferredRegister.create(Registry.COMMAND_ARGUMENT_TYPE_REGISTRY, ModMain.MOD_ID);
public static final DeferredRegister<ArgumentTypeInfo<?, ?>> COMMAND_ARGUMENTS = DeferredRegister.create(Registries.COMMAND_ARGUMENT_TYPE, ModMain.MOD_ID);


public static final RegistryObject<ArgumentTypeInfo<?, ?>> SOUNDS = COMMAND_ARGUMENTS.register("sounds", () -> ArgumentTypeInfos.registerByClass(SoundsArgument.class, new SoundArgumentInfo()));
Expand Down
34 changes: 34 additions & 0 deletions src/main/java/de/mrjulsen/mineify/events/ModCreativeTabs.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package de.mrjulsen.mineify.events;

import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;

import de.mrjulsen.mineify.ModMain;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.ItemLike;
import net.minecraftforge.event.CreativeModeTabEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;

@EventBusSubscriber(modid = ModMain.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class ModCreativeTabs {

protected static Multimap<CreativeModeTab, ItemLike> itemsPerCreativeTab = HashMultimap.create();

@SubscribeEvent
public static void buildContents(CreativeModeTabEvent.BuildContents event) {
CreativeModeTab tab = event.getTab();
if (itemsPerCreativeTab.containsKey(tab))
for (ItemLike il : itemsPerCreativeTab.get(tab)) {
Item item = il.asItem();
event.accept(item);
}
}

public static void setCreativeTab(ItemLike itemlike, CreativeModeTab group) {
ModCreativeTabs.itemsPerCreativeTab.put(group, itemlike);
}

}
Loading

0 comments on commit 63f491c

Please sign in to comment.