Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
Get ready for a release
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick1st committed May 21, 2022
1 parent e64b6dd commit 9b7d0b5
Show file tree
Hide file tree
Showing 23 changed files with 308 additions and 110 deletions.
4 changes: 2 additions & 2 deletions Common/src/main/java/nick1st/fancyvideo/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo;
package nick1st.fancyvideo; //NOSONAR

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public record Constants() {
//DLL Version
public static final int DLL_VERSION = 1;
public static final int DLL_VERSION = 2;
public static final String PLUGINSDIR = "plugins/";

// Mod info
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo;
package nick1st.fancyvideo; //NOSONAR

import nick1st.fancyvideo.config.SimpleConfig;
import nick1st.fancyvideo.platform.Services;
Expand Down
28 changes: 27 additions & 1 deletion Common/src/main/java/nick1st/fancyvideo/FancyVideoEvents.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
package nick1st.fancyvideo;
/*
* This file is part of the FancyVideo-API.
*
* The FancyVideo-API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The FancyVideo-API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* The FancyVideo-API uses VLCJ, Copyright 2009-2021 Caprica Software Limited,
* licensed under the GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* You should have received a copy of the GNU General Public License
* along with FancyVideo-API. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo; //NOSONAR

import nick1st.fancyvideo.api.DynamicResourceLocation;
import nick1st.fancyvideo.api.eventbus.EventPriority;
Expand All @@ -17,6 +42,7 @@ public record FancyVideoEvents() {
public static final String UNSUPPORTED2 = "Head to bit.ly/vlcBeta and try installing the latest version for your OS.";

@FancyVideoEvent(priority = EventPriority.SURPREME)
@SuppressWarnings("unused")
public static void addDefaultPlayer(PlayerRegistryEvent.AddPlayerEvent event) {
event.handler().registerPlayerOnFreeResLoc(fallback, SimpleMediaPlayer.class);
IntegerBuffer2D buffer = Util.injectableTextureFromJar("VLCMissing.png", FancyVideoEvent.class.getClassLoader(), 1024);
Expand Down
2 changes: 1 addition & 1 deletion Common/src/main/java/nick1st/fancyvideo/ShutdownHook.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo;
package nick1st.fancyvideo; //NOSONAR


import nick1st.fancyvideo.api.MediaPlayerHandler;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,41 @@
package nick1st.fancyvideo.api.internal.utils;
/*
* This file is part of the FancyVideo-API.
*
* The FancyVideo-API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The FancyVideo-API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* The FancyVideo-API uses VLCJ, Copyright 2009-2021 Caprica Software Limited,
* licensed under the GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* You should have received a copy of the GNU General Public License
* along with FancyVideo-API. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.api.internal.utils; //NOSONAR

import java.util.Arrays;

@SuppressWarnings("unused")
public class IntegerBuffer2D {
int[][] matrix;

public IntegerBuffer2D(int sizeOfBanks, int banks) {
matrix = new int[banks][sizeOfBanks];
}

@SuppressWarnings("This does copy matrix, but using low-level code")
public IntegerBuffer2D(IntegerBuffer2D toCopy) {
this(toCopy.getWidth(), toCopy.getHeight());
System.arraycopy(toCopy.matrix, 0, matrix, 0, toCopy.getHeight());
Expand Down Expand Up @@ -113,9 +140,9 @@ public IntegerBuffer2D bulkGet(int x, int y, int sizeX, int sizeY) {

/**
*
* @param toJoin
* @param toJoin All Arrays that should be joined together.
* @param side Only accepts 0 or 1. 0 for left, 1 for bottom.
* @return
* @return A joined buffer
*/
public static IntegerBuffer2D join(IntegerBuffer2D[] toJoin, short side) {
if (side != 0 && side != 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.config;
package nick1st.fancyvideo.config; //NOSONAR

import java.io.File;
import java.io.FileReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.config;
package nick1st.fancyvideo.config; //NOSONAR

import java.util.function.Predicate;

Expand Down
11 changes: 7 additions & 4 deletions Common/src/main/java/nick1st/fancyvideo/example/APIExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.example;
package nick1st.fancyvideo.example; //NOSONAR

import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
Expand All @@ -44,6 +44,7 @@ public class APIExample {
DynamicResourceLocation resourceLocation;

@FancyVideoEvent
@SuppressWarnings("unused")
public void init(PlayerRegistryEvent.AddPlayerEvent event) {
Constants.LOG.info("Setting up example media player");
resourceLocation = new DynamicResourceLocation(Constants.MOD_ID, "example");
Expand All @@ -57,8 +58,9 @@ public void init(PlayerRegistryEvent.AddPlayerEvent event) {
}

@FancyVideoEvent
@SuppressWarnings("unused")
public void drawBackground(DrawBackgroundEvent event) {
if (event.screen instanceof OptionsScreen && resourceLocation != null &&
if (event.getScreen() instanceof OptionsScreen && resourceLocation != null &&
MediaPlayerHandler.getInstance().getMediaPlayer(resourceLocation) instanceof MediaPlayerBase mediaPlayer) {
if (MediaPlayerHandler.getInstance().getMediaPlayer(resourceLocation).providesAPI()) {
if (!init) {
Expand All @@ -74,7 +76,7 @@ public void drawBackground(DrawBackgroundEvent event) {

RenderSystem.enableBlend();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
GuiComponent.blit(event.poseStack, 0, 0, 0.0F, 0.0F, width, height, width, height);
GuiComponent.blit(event.getPoseStack(), 0, 0, 0.0F, 0.0F, width, height, width, height);
RenderSystem.disableBlend();
} else {
// Generic Render Code for Screens
Expand All @@ -94,13 +96,14 @@ public void drawBackground(DrawBackgroundEvent event) {

RenderSystem.enableBlend();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
GuiComponent.blit(event.poseStack, 0, 0, 0.0F, 0.0F, width, height, width2, width2);
GuiComponent.blit(event.getPoseStack(), 0, 0, 0.0F, 0.0F, width, height, width2, width2);
RenderSystem.disableBlend();
}
}
}

@FancyVideoEvent(phase = EventPhase.PRE)
@SuppressWarnings("unused")
public void removePlayer(PlayerRegistryEvent.RemovePlayerEvent event) {
if (event.resourceLocation == resourceLocation) {
resourceLocation = null;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,42 @@
package nick1st.fancyvideo.example;
/*
* This file is part of the FancyVideo-API.
*
* The FancyVideo-API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The FancyVideo-API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* The FancyVideo-API uses VLCJ, Copyright 2009-2021 Caprica Software Limited,
* licensed under the GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* You should have received a copy of the GNU General Public License
* along with FancyVideo-API. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.example; //NOSONAR

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.gui.screens.Screen;
import nick1st.fancyvideo.api.eventbus.event.Event;

/**
* Event fired after the Background of a Screen is drawn.
* @since 0.2.0.0
*/
@SuppressWarnings("unused")
public class DrawBackgroundEvent extends Event {
public Screen screen;
public PoseStack poseStack;
private final Screen screen;
private PoseStack poseStack;

public DrawBackgroundEvent(Screen screen, PoseStack matrixStack) {
this.screen = screen;
Expand All @@ -22,4 +52,16 @@ public boolean isCancelable() {
public void onFinished() {
// I don't need any cleanup
}

public Screen getScreen() {
return screen;
}

public PoseStack getPoseStack() {
return poseStack;
}

public void setPoseStack(PoseStack poseStack) {
this.poseStack = poseStack;
}
}
4 changes: 2 additions & 2 deletions Common/src/main/java/nick1st/fancyvideo/internal/Arch.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.internal;
package nick1st.fancyvideo.internal; //NOSONAR

import com.sun.jna.Platform;
import com.sun.jna.Platform; //NOSONAR

public enum Arch {
x86,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.internal;
package nick1st.fancyvideo.internal; //NOSONAR

import nick1st.fancyvideo.Constants;
import org.apache.commons.compress.utils.IOUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.internal;
package nick1st.fancyvideo.internal; //NOSONAR

import nick1st.fancyvideo.Constants;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
package nick1st.fancyvideo.internal;
/*
* This file is part of the FancyVideo-API.
*
* The FancyVideo-API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The FancyVideo-API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* The FancyVideo-API uses VLCJ, Copyright 2009-2021 Caprica Software Limited,
* licensed under the GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* You should have received a copy of the GNU General Public License
* along with FancyVideo-API. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.internal; //NOSONAR

import net.minecraft.client.Minecraft;
import nick1st.fancyvideo.api.internal.utils.IntegerBuffer2D;
Expand Down
27 changes: 26 additions & 1 deletion Common/src/main/java/nick1st/fancyvideo/internal/Util.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,29 @@
package nick1st.fancyvideo.internal;
/*
* This file is part of the FancyVideo-API.
*
* The FancyVideo-API is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The FancyVideo-API is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* The FancyVideo-API uses VLCJ, Copyright 2009-2021 Caprica Software Limited,
* licensed under the GNU General Public License.
*
* You should have received a copy of the GNU General Public License
* along with VLCJ. If not, see <http://www.gnu.org/licenses/>.
*
* You should have received a copy of the GNU General Public License
* along with FancyVideo-API. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.internal; //NOSONAR

import nick1st.fancyvideo.Constants;
import nick1st.fancyvideo.api.internal.utils.IntegerBuffer2D;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.platform;
package nick1st.fancyvideo.platform; //NOSONAR

import nick1st.fancyvideo.Constants;
import nick1st.fancyvideo.platform.services.IPlatformHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
* Copyright 2022 Nick1st.
*/

package nick1st.fancyvideo.platform.services;
package nick1st.fancyvideo.platform.services; //NOSONAR

@SuppressWarnings("unused")
public interface IPlatformHelper {

/**
Expand Down
Loading

0 comments on commit 9b7d0b5

Please sign in to comment.