Fixes
-
Unloading of Screens and Browser Instances no longer just based on the Render class due to issues where if you werent looking in the direction of the screen then it wouldnt unload and close the browser resulting in videos staying playing even out of range! This has been finally fixed enjoy! Screens are limited to rendering only in 30 block radius using 360 degrees in calculation now not limited to a 180 degree calculations. basically now each screen entity now runs its on distance check for the players ontop of the player still utilizing the screenRenderer distance check to really ensure they only render when in distance.
-
Removed Debugging Logs spamming Console Logs sorry about this i forget to remove my logs sometimes lol!
-
Dynamic server url replacement was limited only to /index?streamName urls no longer so extra endpoints from the NodeJS application are possible now such as /getschedule endpoints to potentially display a table list of the current playing stream schedule :D
to utilise this you need to
ensure all your endpoints utilize a
?streamName query parameter in the urls
if they do this will dynamically
replace the server location of the
cloudflare tunnel for the clients
connected to the server to always
keep them in sync with the
tunnels location!
-
Also Please utilize port 30000 for your nodeJS application server!
-
Brought back the onTick in tileEntity to check for rendered screens to fix the issue with screens staying loaded!
New
- Customizable keybind for changing a screens url instead of needing to shift right click with a empty hand!
Note
- This nodeJS express server you may have to make yourself or look up some designs one key concept is the usage of this style routing point for the mod to properly get its location!
- OpenAI Explaination and NodeJs Code Snippet
To set up your first Node.js Express server application for serving a public static website from a public folder, follow these steps. Since you don't have Node.js installed, I'll include steps for that as well:
Step 1: Install Node.js
- Download Node.js from the official website: Node.js Download.
- Run the installer and follow the installation instructions.
Step 2: Create a new directory for your project
Open a terminal and create a new directory for your project:
mkdir my-express-app
cd my-express-app
Step 3: Initialize a new Node.js project
Initialize a new Node.js project using npm:
npm init -y
Step 4: Install required packages
Install the necessary packages for your Express server:
npm install express fs path sqlite3 cors cloudflared
Step 5: Create your Express server file
Create a new file named server.js
in your project directory and paste your existing code into it:
const express = require('express');
const fs = require('fs');
const path = require('path');
const sqlite3 = require('sqlite3').verbose();
const cors = require('cors');
const { tunnel } = require("cloudflared");
const app = express();
const PORT = 30000;
let tunnelLocation = `http://localhost:${PORT}`;
function getTunnelDomain(){
return tunnelLocation;
}
async function main(){
const { url, connections, child, stop } = tunnel({ "--url": 'localhost:30000' });
console.log("LINK:", await url);
tunnelLocation = await url;
const conns = await Promise.all(connections);
console.log("Connections Ready!", conns);
child.on("exit", (code) => {
console.log("tunnel process exited with code", code);
});
}
main();
app.get('/ping', (req, res) => {
res.send(JSON.stringify({ url: getTunnelDomain() }));
})
app.listen(PORT, () => {
console.log(`Server running at http://localhost:${PORT}/`);
});
Step 6: Create a public folder for your static website
Create a new folder named public
in your project directory and place your static website files (HTML, CSS, JS, etc.) inside this folder.
Step 7: Serve the static website files with Express
Modify your server.js
file to serve the static website files from the public
folder:
app.use(express.static(path.join(__dirname, 'public')));
app.get('/ping', (req, res) => {
res.send(JSON.stringify({ url: getTunnelDomain() }));
})
app.listen(PORT, () => {
console.log(`Server running at http://localhost:${PORT}/`);
});
Step 8: Start your Express server
Start your Express server by running the following command in your terminal:
node server.js
Your static website should now be accessible at http://localhost:30000/
.
Example code for a nodeJS express server to properly correlate with this mod!
const express = require('express');
const fs = require('fs');
const path = require('path');
const sqlite3 = require('sqlite3').verbose();
const cors = require('cors');
const { tunnel } = require("cloudflared");
const app = express();
const PORT = 30000;
let tunnelLocation = `http://localhost:${PORT}`;
function getTunnelDomain(){
return tunnelLocation;
}
//This is the main function to start up the cloudflare tunnel to expose this server publicly through a random location!
//Over https!
async function main(){
//This will server over http as cloudflare tunnels will handle the upgrading properly!
const { url, connections, child, stop } = tunnel({ "--url": 'localhost:30000' });
// show the url
console.log("LINK:", await url);
tunnelLocation = await url;
// wait for the all 4 connections to be established
const conns = await Promise.all(connections);
// show the connections
console.log("Connections Ready!", conns);
// stop the tunnel after 15 seconds
//setTimeout(stop, 15_000);
child.on("exit", (code) => {
console.log("tunnel process exited with code", code);
});
}
main();
//This Ping endpoint is very important! as it needs to return a json in the style of { url: "yourServerLocation" }
// For the Mod to properly relay and overwrite the http://%SERVER_LOCATION% placeholder
app.get('/ping', (req, res) => {
res.send(JSON.stringify({ url: getTunnelDomain() }));
})
Fixes
Client Side
- Fixed all screens loading when players join the server! or a locally running singleplayer world! Now properly loads screens in a set distance via client configurations Had to implement a custom HandleUpdateTag Function in the TileEntityScreen Class! which properly checks by distance and handles based on such to still allow screens to render when you get in distance of them along with proper unloading and loading again when going back and forth out of range now!
New Configurations
Server Side
- enable_node option which by default is false if you have a express server running on localhost:30000 then you can potentially ping its location and relay its location if you package it with cloudflare domain or tunnel to the mod itself to relay to your connected clients on the server the location and replaces the http://%SERVER_LOCATION% placeholder with this https://subdomain.try.cloudflare.com while keeping whatever /following locations so you can open the index page on this cloudflare site and potentially relay a streaming video player that serves in livestream manner to your users to recreate cinematic experiences a little easier!
Note
- This nodeJS express server you may have to make yourself or look up some designs one key concept is the usage of this style routing point for the mod to properly get its location!
- OpenAI Explaination and NodeJs Code Snippet
Example code for a nodeJS express server to properly correlate with this mod!
const express = require('express');
const fs = require('fs');
const path = require('path');
const sqlite3 = require('sqlite3').verbose();
const cors = require('cors');
const { tunnel } = require("cloudflared");
const app = express();
const PORT = 30000;
let tunnelLocation = `http://localhost:${PORT}`;
function getTunnelDomain(){
return tunnelLocation;
}
//This is the main function to start up the cloudflare tunnel to expose this server publicly through a random location!
//Over https!
async function main(){
//This will server over http as cloudflare tunnels will handle the upgrading properly!
const { url, connections, child, stop } = tunnel({ "--url": 'localhost:30000' });
// show the url
console.log("LINK:", await url);
tunnelLocation = await url;
// wait for the all 4 connections to be established
const conns = await Promise.all(connections);
// show the connections
console.log("Connections Ready!", conns);
// stop the tunnel after 15 seconds
//setTimeout(stop, 15_000);
child.on("exit", (code) => {
console.log("tunnel process exited with code", code);
});
}
main();
//This Ping endpoint is very important! as it needs to return a json in the style of { url: "yourServerLocation" }
// For the Mod to properly relay and overwrite the http://%SERVER_LOCATION% placeholder
app.get('/ping', (req, res) => {
res.send(JSON.stringify({ url: getTunnelDomain() }));
})
Implementations
- Includes the ability to dynamically serve a Stream server location from the server side of the mod to the clients!
- Screens can properly update locations to new servers on change dynamically!
- Includes Custom Screen Rendering Radius For making screens unload to create cinematic experience This still needs work done on it though..
- Custom Keybinds to open a browser as a Minecraft Screen!
- Utilizes a locally running NodeJS express server locally to dynamically serve the location of the server I will plan to release the NodeJS express server source code on github for the community to be able to utilize in the future for usage! but I want to implement support for other video formats besides just m3u8 formats!