Merge branch 'main' of https://github.com/LAX1DUDE/eaglercraft into LAX1DUDE-main

This commit is contained in:
ayunami2000 2022-04-26 20:07:14 -04:00
commit d897685edb
35 changed files with 34341 additions and 28579 deletions

5
.gitattributes vendored
View File

@ -1,6 +1,7 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# These are explicitly windows files and should use crlf
*.bat text eol=crlf
*.bat text eol=crlf
*.sh text eol=lf
gradlew text eol=lf

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

BIN
javascript/testvideo.mp4 Normal file

Binary file not shown.

View File

@ -181,14 +181,21 @@ void main(){
/* https://bugs.chromium.org/p/angleproject/issues/detail?id=4994 */
uv = ((uv * anisotropic_fix) - fract(uv * anisotropic_fix) + 0.5) / anisotropic_fix;
color *= texture(tex0, uv).bgra;
vec4 texColor = texture(tex0, uv);
#else
color *= texture(tex0, (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy).bgra;
vec4 texColor = texture(tex0, (matrix_t * vec4(v_texture0, 0.0, 1.0)).xy);
#endif
#else
color *= texture(tex0, (matrix_t * vec4(texCoordV0, 0.0, 1.0)).xy).bgra;
vec4 texColor = texture(tex0, (matrix_t * vec4(texCoordV0, 0.0, 1.0)).xy);
#endif
#ifdef CC_swap_rb
color *= texColor.rgba;
#else
color *= texColor.bgra;
#endif
#endif
#ifdef CC_alphatest

View File

@ -0,0 +1,283 @@
package ayunami2000;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
public class VideoMapPacketCodec {
public final int[][] mapIds;
private boolean loop;
private String url;
private int duration;
private long timestamp;
private long pauseTimestamp;
private double posX;
private double posY;
private double posZ;
private float volume;
private int frameRate;
private boolean requiresFullResetPacket;
private boolean requiresPositionPacket;
private boolean isDisabled;
/**
* @param mapIds 2D grid of map IDs that make up the screen (mapIds[y][x])
* @param posX audio playback X coord
* @param posY audio playback Y coord
* @param posZ audio playback Z coord
* @param volume the volume of the clip
*/
public VideoMapPacketCodec(int[][] mapIds, double posX, double posY, double posZ, float volume) {
this.mapIds = mapIds;
this.url = null;
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.volume = volume;
this.frameRate = 30;
this.requiresPositionPacket = true;
this.requiresFullResetPacket = true;
this.isDisabled = true;
}
/**
* @param mapIds 2D grid of map IDs that make up the screen (mapIds[y][x])
* @param posX audio playback X coord
* @param posY audio playback Y coord
* @param posZ audio playback Z coord
*/
public VideoMapPacketCodec(int[][] mapIds, double posX, double posY, double posZ) {
this(mapIds, posX, posY, posZ, 1.0f);
}
/**
* @param posX audio playback X coord
* @param posY audio playback Y coord
* @param posZ audio playback Z coord
* @param volume the volume of the clip
* @return packet to send to players
*/
public byte[] moveAudioSource(double posX, double posY, double posZ, float volume) {
this.posX = posX;
this.posY = posY;
this.posZ = posZ;
this.volume = volume;
this.requiresPositionPacket = true;
return syncPlaybackWithPlayers();
}
/**
* unloads video and resets all map object to vanilla renderer
* @return packet to send to players
*/
public byte[] disableVideo() {
isDisabled = true;
return syncPlaybackWithPlayers();
}
/**
* syncs the server side video timestamp with players
* @return packet to send to players
*/
public byte[] syncPlaybackWithPlayers() {
try {
ByteArrayOutputStream bao = new ByteArrayOutputStream();
DataOutputStream str = new DataOutputStream(bao);
if(isDisabled) {
str.write(0);
int x = mapIds[0].length;
int y = mapIds.length;
str.write((x << 4) | y);
for(int yy = 0; yy < y; ++yy) {
for(int xx = 0; xx < x; ++xx) {
str.writeShort(mapIds[yy][xx]);
}
}
return bao.toByteArray();
}
int packetType = 1;
if(requiresFullResetPacket) {
packetType = packetType | 2;
}
if(requiresFullResetPacket || requiresPositionPacket) {
packetType = packetType | 4;
}
str.write(packetType);
if(requiresFullResetPacket) {
int x = mapIds[0].length;
int y = mapIds.length;
str.write((x << 4) | y);
for(int yy = 0; yy < y; ++yy) {
for(int xx = 0; xx < x; ++xx) {
str.writeShort(mapIds[yy][xx]);
}
}
str.write(frameRate);
str.writeInt(duration);
str.writeUTF(url);
}
if(requiresFullResetPacket || requiresPositionPacket) {
str.writeFloat(volume);
str.writeDouble(posX);
str.writeDouble(posY);
str.writeDouble(posZ);
}
str.writeInt(getElapsedMillis());
str.writeBoolean(loop);
str.writeBoolean(pauseTimestamp > 0l);
requiresFullResetPacket = false;
requiresPositionPacket = false;
return bao.toByteArray();
}catch(IOException e) {
throw new RuntimeException("serialization error", e);
}
}
/**
* this is dual purpose, it calculates elapsed time but also loops or pauses the video if it is finished playing
*/
private int getElapsedMillis() {
if(pauseTimestamp > 0l) {
return (int)(pauseTimestamp - timestamp);
}
int t = (int)(System.currentTimeMillis() - timestamp);
if(loop) {
while(t > duration) {
t -= duration;
timestamp += duration;
}
}else {
if(t > duration) {
timestamp = (int)(System.currentTimeMillis() - duration);
return duration;
}
}
return t;
}
/**
* @param url URL to an MP4 or other HTML5 supported video file
* @param loop If the video file should loop
* @param durationSeconds duration of the video in seconds
* @return packet to send to players
*/
public byte[] beginPlayback(String url, boolean loop, float duration) {
this.url = url;
this.loop = loop;
this.duration = (int)(duration * 1000.0f);
this.pauseTimestamp = 0l;
this.timestamp = 0l;
this.requiresFullResetPacket = true;
this.isDisabled = false;
return syncPlaybackWithPlayers();
}
/**
* Tells the browser to pre-load a URL to a video to be played in the future
* @param url the URL of the video
* @param ttl the amount of time the video should stay loaded
* @return packet to send to players
*/
public static byte[] bufferVideo(String url, int ttl) {
try {
ByteArrayOutputStream bao = new ByteArrayOutputStream();
DataOutputStream str = new DataOutputStream(bao);
str.write(8);
str.writeInt(ttl);
str.writeUTF(url);
return bao.toByteArray();
}catch(IOException e) {
throw new RuntimeException("serialization error", e);
}
}
/**
* @return the duration of the current clip
*/
public float getDuration() {
return duration * 0.001f;
}
/**
* @return the URL of the current clip
*/
public String getURL() {
return url;
}
/**
* @return the server's current timestamp
*/
public float getPlaybackTime() {
return getElapsedMillis() * 0.001f;
}
/**
* @param time time in seconds to seek the video to
*/
public byte[] setPlaybackTime(float time) {
timestamp = System.currentTimeMillis() - (int)(time * 1000.0f);
return syncPlaybackWithPlayers();
}
/**
* @return if playback is complete (false if loop)
*/
public boolean isPlaybackFinished() {
return !loop && getElapsedMillis() == duration;
}
/**
* @param loop video should loop
*/
public byte[] setLoopEnable(boolean loop) {
this.loop = loop;
return syncPlaybackWithPlayers();
}
/**
* @return if loop is enabled
*/
public boolean isLoopEnable() {
return loop;
}
/**
* @param pause set if video should pause
* @return packet to send to players
*/
public byte[] setPaused(boolean pause) {
getElapsedMillis();
if(pause && pauseTimestamp <= 0l) {
pauseTimestamp = System.currentTimeMillis();
}else if(!pause && pauseTimestamp > 0l) {
timestamp = System.currentTimeMillis() - (pauseTimestamp - timestamp);
pauseTimestamp = 0l;
}
return syncPlaybackWithPlayers();
}
/**
* @return if video is currently paused
*/
public boolean isPaused() {
return pauseTimestamp > 0l;
}
/**
* @return current server-side volume
*/
public float getVolume() {
return volume;
}
}

View File

@ -0,0 +1,132 @@
package ayunami2000;
import java.util.List;
import org.bukkit.craftbukkit.v1_5_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import net.minecraft.server.v1_5_R3.Packet;
import net.minecraft.server.v1_5_R3.Packet131ItemData;
public class VideoMapPacketCodecBukkit extends VideoMapPacketCodec {
/**
* @param mapIds 2D grid of map IDs that make up the screen (mapIds[y][x])
* @param posX audio playback X coord
* @param posY audio playback Y coord
* @param posZ audio playback Z coord
* @param volume the volume of the clip
*/
public VideoMapPacketCodecBukkit(int[][] mapIds, double posX, double posY, double posZ, float volume) {
super(mapIds, posX, posY, posZ, volume);
}
/**
* @param mapIds 2D grid of map IDs that make up the screen (mapIds[y][x])
* @param posX audio playback X coord
* @param posY audio playback Y coord
* @param posZ audio playback Z coord
*/
public VideoMapPacketCodecBukkit(int[][] mapIds, double posX, double posY, double posZ) {
super(mapIds, posX, posY, posZ, 1.0f);
}
public static class VideoMapPacket {
protected final Object packet;
protected VideoMapPacket(byte[] packet) {
this.packet = new Packet131ItemData((short)104, (short)0, packet);
}
public Object getNativePacket() {
return packet;
}
public void send(Player p) {
nativeSendPacketToPlayer(p, packet);
}
public void send(Player... p) {
for(Player pp : p) {
nativeSendPacketToPlayer(pp, packet);
}
}
public void send(List<Player> p) {
for(Player pp : p) {
nativeSendPacketToPlayer(pp, packet);
}
}
}
/**
* @param posX audio playback X coord
* @param posY audio playback Y coord
* @param posZ audio playback Z coord
* @param volume the volume of the clip
* @return packet to send to players
*/
public VideoMapPacket moveAudioSourceBukkit(double posX, double posY, double posZ, float volume) {
return new VideoMapPacket(moveAudioSource(posX, posY, posZ, volume));
}
/**
* unloads video and resets all map object to vanilla renderer
* @return packet to send to players
*/
public VideoMapPacket disableVideoBukkit() {
return new VideoMapPacket(disableVideo());
}
/**
* syncs the server side video timestamp with players
* @return packet to send to players
*/
public VideoMapPacket syncPlaybackWithPlayersBukkit() {
return new VideoMapPacket(syncPlaybackWithPlayers());
}
/**
* @param url URL to an MP4 or other HTML5 supported video file
* @param loop If the video file should loop
* @param durationSeconds duration of the video in seconds
* @return packet to send to players
*/
public VideoMapPacket beginPlaybackBukkit(String url, boolean loop, float duration) {
return new VideoMapPacket(beginPlayback(url, loop, duration));
}
/**
* Tells the browser to pre-load a URL to a video to be played in the future
* @param url the URL of the video
* @param ttl the amount of time the video should stay loaded
* @return packet to send to players
*/
public static VideoMapPacket bufferVideoBukkit(String url, int ttl) {
return new VideoMapPacket(bufferVideo(url, ttl));
}
/**
* @param time time in seconds to seek the video to
*/
public VideoMapPacket setPlaybackTimeBukkit(float time) {
return new VideoMapPacket(setPlaybackTime(time));
}
/**
* @param loop video should loop
*/
public VideoMapPacket setLoopEnableBukkit(boolean loop) {
return new VideoMapPacket(setLoopEnable(loop));
}
/**
* @param pause set if video should pause
* @return packet to send to players
*/
public VideoMapPacket setPausedBukkit(boolean pause) {
return new VideoMapPacket(setPaused(pause));
}
public static void nativeSendPacketToPlayer(Player player, Object obj) {
if(obj == null) {
return;
}
((CraftPlayer)player).getHandle().playerConnection.sendPacket((Packet)obj);
}
}

View File

@ -8,4 +8,8 @@ commands:
samplemap:
description: test ayunami map system
usage: /samplemap <get|disable|set> [mapid] [image file] [16bpp|24bpp] [compress]
permission: eaglersamples.samplemap
permission: eaglersamples.samplemap
videomap:
description: test video map system (place video_map_config.txt in your server's working directory)
usage: /videomap <begin|stop|preload|pause|resume|loop|move> [url] [duration or ttl]
permission: eaglersamples.videomap

View File

@ -0,0 +1,155 @@
package plugin;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import ayunami2000.VideoMapPacketCodecBukkit;
public class CommandVideoMap implements CommandExecutor {
private VideoMapPacketCodecBukkit currentCodecInstance = null;
@Override
public boolean onCommand(CommandSender arg0, Command arg1, String arg2, String[] arg3) {
if(!(arg0 instanceof Player)) {
arg0.sendMessage(ChatColor.RED + "Internal Error: " + ChatColor.WHITE + "CommmandSender must be a Player");
return false;
}
if(arg3.length == 3 && arg3[0].equalsIgnoreCase("begin")) {
try {
List<int[]> mapRows = new ArrayList();
double x = 0.0d;
double y = 0.0d;
double z = 0.0d;
float volume = -1.0f;
BufferedReader r = new BufferedReader(new FileReader(new File("video_map_config.txt")));
String str;
while((str = r.readLine()) != null) {
str = str.trim();
if(str.startsWith("#")) {
continue;
}else if(str.startsWith("x")) {
int i = str.indexOf('=');
if(i > 0) {
x = Double.parseDouble(str.substring(i + 1).trim());
}
}else if(str.startsWith("y")) {
int i = str.indexOf('=');
if(i > 0) {
y = Double.parseDouble(str.substring(i + 1).trim());
}
}else if(str.startsWith("z")) {
int i = str.indexOf('=');
if(i > 0) {
z = Double.parseDouble(str.substring(i + 1).trim());
}
}else if(str.startsWith("volume")) {
int i = str.indexOf('=');
if(i > 0) {
volume = Float.parseFloat(str.substring(i + 1).trim());
}
}else {
try {
String[] digits = str.split(",");
int firstInt = Integer.parseInt(digits[0].trim());
int[] newRow = new int[digits.length];
newRow[0] = firstInt;
for(int i = 1; i < digits.length; ++i) {
newRow[i] = Integer.parseInt(digits[i].trim());
}
if(mapRows.size() > 0 && mapRows.get(0).length != newRow.length) {
throw new IOException("All rows in map list must be the same length (" + mapRows.get(0).length + " != " + newRow.length + ")");
}
mapRows.add(newRow);
}catch(NumberFormatException t) {
}
}
}
r.close();
if(mapRows.size() > 0) {
if(currentCodecInstance != null) {
currentCodecInstance.disableVideoBukkit().send((Player)arg0);
currentCodecInstance = null;
}
int[][] matrix = new int[mapRows.size()][mapRows.get(0).length];
for(int i = 0, l = mapRows.size(); i < l; ++i) {
for(int j = 0; j < matrix[i].length; ++j) {
matrix[i][j] = mapRows.get(i)[j];
}
}
currentCodecInstance = new VideoMapPacketCodecBukkit(matrix, x, y, z, volume);
currentCodecInstance.beginPlaybackBukkit(arg3[1], true, arg3[2].indexOf('.') > 0 ? Float.parseFloat(arg3[2]) : Float.parseFloat(arg3[2] + ".0")).send((Player)arg0);
arg0.sendMessage(ChatColor.GREEN + "Enabled video map, URL:" + ChatColor.WHITE + " " + arg3[1]);
return true;
}else {
throw new IOException("No map rows were defined");
}
}catch(IOException ex) {
arg0.sendMessage(ChatColor.RED + "Internal Error while reading \'video_map_config.txt\': " + ChatColor.WHITE + ex.toString());
}
}else if((arg3.length == 2 || arg3.length == 3) && arg3[0].equalsIgnoreCase("preload")) {
int ttl = arg3.length == 3 ? Integer.parseInt(arg3[2]) * 1000 : 180 * 1000;
VideoMapPacketCodecBukkit.bufferVideoBukkit(arg3[1], ttl).send((Player)arg0);
arg0.sendMessage(ChatColor.GREEN + "Buffered video URL:" + ChatColor.WHITE + " " + arg3[1] + " " + ChatColor.GREEN + "for " + ChatColor.WHITE + (ttl / 1000) + ChatColor.GREEN + " seconds");
return true;
}else {
if(arg3.length == 1 && arg3[0].equalsIgnoreCase("stop")) {
if(currentCodecInstance != null) {
currentCodecInstance.disableVideoBukkit().send((Player)arg0);
currentCodecInstance = null;
arg0.sendMessage(ChatColor.GREEN + "Disabled video map");
return true;
}else {
arg0.sendMessage(ChatColor.RED + "Error: " + ChatColor.WHITE + "no video is loaded");
}
}else if(arg3.length == 1 && arg3[0].equalsIgnoreCase("pause")) {
if(currentCodecInstance != null) {
currentCodecInstance.setPausedBukkit(true).send((Player)arg0);
arg0.sendMessage(ChatColor.GREEN + "Paused video map");
return true;
}else {
arg0.sendMessage(ChatColor.RED + "Error: " + ChatColor.WHITE + "no video is loaded");
}
}else if(arg3.length == 1 && arg3[0].equalsIgnoreCase("resume")) {
if(currentCodecInstance != null) {
currentCodecInstance.setPausedBukkit(false).send((Player)arg0);
arg0.sendMessage(ChatColor.GREEN + "Resumed video map");
return true;
}else {
arg0.sendMessage(ChatColor.RED + "Error: " + ChatColor.WHITE + "no video is loaded");
}
}else if((arg3.length == 1 || arg3.length == 2) && arg3[0].equalsIgnoreCase("loop")) {
if(currentCodecInstance != null) {
boolean gottaLoop = arg3.length == 1 || arg3[1].equalsIgnoreCase("true");
currentCodecInstance.setLoopEnableBukkit(gottaLoop).send((Player)arg0);
arg0.sendMessage(ChatColor.GREEN + (gottaLoop ? "Enabled video map loop" : "Disabled video map loop"));
return true;
}else {
arg0.sendMessage(ChatColor.RED + "Error: " + ChatColor.WHITE + "no video is loaded");
}
}else if(arg3.length == 1 && arg3[0].equalsIgnoreCase("move")) {
if(currentCodecInstance != null) {
Location l = ((Player)arg0).getLocation();
currentCodecInstance.moveAudioSourceBukkit(l.getX(), l.getY(), l.getZ(), currentCodecInstance.getVolume()).send((Player)arg0);
arg0.sendMessage(ChatColor.GREEN + "Repositioned audio source to " + l.getBlockX() + ", " + l.getBlockY() + ", " + l.getBlockZ());
return true;
}else {
arg0.sendMessage(ChatColor.RED + "Error: " + ChatColor.WHITE + "no video is loaded");
}
}
}
return false;
}
}

View File

@ -6,6 +6,7 @@ public class EaglerSamplesPlugin extends JavaPlugin {
public void onEnable() {
getCommand("samplemap").setExecutor(new CommandSampleMap(this));
getCommand("videomap").setExecutor(new CommandVideoMap());
}
public void onDisable() {

View File

@ -1 +1,3 @@
These are sample source files to assist the process of integrating Eaglercraft into other projects, or to assist the process of integrating other projects into Eaglercraft
These are sample source files to assist the process of integrating Eaglercraft into other projects, or to assist the process of integrating other projects into Eaglercraft
place "video_map_config.txt" in the working directory of the server to use /videomap

View File

@ -0,0 +1,14 @@
# type map ids like this to create the video screen:
1, 2, 3
4, 5, 6
# position and volume:
x = 0.0
y = 0.0
z = 0.0
volume = 1.0
# set volume to '-1.0' to disable directional audio

View File

@ -635,6 +635,73 @@ public class EaglerAdapterImpl2 {
return GL20.glGetAttribLocation(p1.obj, p2);
}
public static final boolean isVideoSupported() {
return false;
}
public static final void loadVideo(String src, boolean autoplay) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void loadVideo(String src, boolean autoplay, String setJavascriptPointer) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void loadVideo(String src, boolean autoplay, String setJavascriptPointer, String javascriptOnloadFunction) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void bufferVideo(String src, int ttl) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void unloadVideo() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final boolean isVideoLoaded() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final boolean isVideoPaused() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void setVideoPaused(boolean pause) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void setVideoLoop(boolean pause) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void setVideoVolume(float x, float y, float z, float v) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void updateVideoTexture() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void bindVideoTexture() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final int getVideoWidth() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final int getVideoHeight() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final float getVideoCurrentTime() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void setVideoCurrentTime(float seconds) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final float getVideoDuration() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final void setVideoFrameRate(float seconds) {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
public static final int VIDEO_ERR_NONE = -1;
public static final int VIDEO_ERR_ABORTED = 1;
public static final int VIDEO_ERR_NETWORK = 2;
public static final int VIDEO_ERR_DECODE = 3;
public static final int VIDEO_ERR_SRC_NOT_SUPPORTED = 4;
public static final int getVideoError() {
throw new UnsupportedOperationException("Video is not supported in LWJGL runtime");
}
// =======================================================================================
// =======================================================================================
@ -1147,16 +1214,12 @@ public class EaglerAdapterImpl2 {
return s;
}
public static final void setListenerPos(float x, float y, float z, float vx, float vy, float vz, float pitch, float yaw) {
float var11 = MathHelper.cos(-yaw * 0.017453292F - (float) Math.PI);
float var12 = MathHelper.sin(-yaw * 0.017453292F - (float) Math.PI);
float var13 = -var12;
float var14 = -MathHelper.sin(-pitch * 0.017453292F - (float) Math.PI);
float var15 = -var11;
float var16 = 0.0F;
float var17 = 1.0F;
float var18 = 0.0F;
float var2 = MathHelper.cos(-yaw * 0.017453292F);
float var3 = MathHelper.sin(-yaw * 0.017453292F);
float var4 = -MathHelper.cos(pitch * 0.017453292F);
float var5 = MathHelper.sin(pitch * 0.017453292F);
ss.setListenerPosition(x, y, z);
ss.setListenerOrientation(var13, var14, var15, var16, var17, var18);
ss.setListenerOrientation(-var3 * var4, -var5, -var2 * var4, 0.0f, 1.0f, 0.0f);
ss.setListenerVelocity(vx, vy, vz);
}
public static final void setPlaybackOffsetDelay(float f) {

View File

@ -6,12 +6,15 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w15d";
public static final String version = "22w16h";
public static final String mainMenuString = "ayuncraft " + version;
public static final String forkMe = "https://github.com/ayunami2000/ayuncraft";
public static final boolean html5build = true;
public static String ayonullTitle = null;
public static String ayonullLink = null;
public static String[] proxies = new String[]{"pproxy.rom1504.fr","webmcproxy.glitch.me","net-browserify.glitch.me"};

View File

@ -0,0 +1,101 @@
package net.lax1dude.eaglercraft;
import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiScreen;
public class GuiScreenLicense extends GuiScreen {
private final GuiScreen continueScreen;
private boolean hasCheckedBox = false;
private int beginOffset = 0;
private GuiButton acceptButton;
public GuiScreenLicense(GuiScreen scr) {
continueScreen = scr;
}
public void initGui() {
beginOffset = this.height / 2 - 100;
if(beginOffset < 5) {
beginOffset = 5;
}
this.buttonList.add(new GuiButton(1, this.width / 2 - 120, beginOffset + 180, 115, 20, new String(License.line61)));
this.buttonList.add(acceptButton = new GuiButton(2, this.width / 2 + 5, beginOffset + 180, 115, 20, new String(License.line60)));
acceptButton.enabled = false;
}
protected void actionPerformed(GuiButton par1GuiButton) {
if(par1GuiButton.id == 2) {
LocalStorageManager.profileSettingsStorage.setBoolean("acceptLicense", true);
LocalStorageManager.saveStorageP();
mc.displayGuiScreen(continueScreen);
}else if(par1GuiButton.id == 1) {
mc.displayGuiScreen(new GuiScreenLicenseDeclined());
}
}
private static final TextureLocation beaconx = new TextureLocation("/gui/beacon.png");
public void drawScreen(int mx, int my, float par3) {
drawDefaultBackground();
acceptButton.enabled = hasCheckedBox;
super.drawScreen(mx, my, par3);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(1.33f, 1.33f, 1.33f);
drawCenteredString(fontRenderer, new String(License.line00), width * 3 / 8, beginOffset * 3 / 4, 0xDDDD55);
EaglerAdapter.glPopMatrix();
drawCenteredString(fontRenderer, new String(License.line10), width / 2, beginOffset + 22, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line11), width / 2, beginOffset + 33, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line12), width / 2, beginOffset + 44, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line20), width / 2, beginOffset + 62, 0x448844);
drawCenteredString(fontRenderer, new String(License.line21), width / 2, beginOffset + 71, 0x448844);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(0.75f, 0.75f, 0.75f);
drawCenteredString(fontRenderer, new String(License.line30), width * 4 / 6, (beginOffset + 89) * 4 / 3, 0x666666);
drawCenteredString(fontRenderer, new String(License.line31), width * 4 / 6, (beginOffset + 97) * 4 / 3, 0x999999);
drawCenteredString(fontRenderer, new String(License.line32), width * 4 / 6, (beginOffset + 105) * 4 / 3, 0x999999);
EaglerAdapter.glPopMatrix();
drawCenteredString(fontRenderer, new String(License.line40), width / 2, beginOffset + 120, 0xFF7777);
boolean mouseOverCheck = width / 2 - 100 < mx && width / 2 - 83 > mx && beginOffset + 142 < my && beginOffset + 159 > my;
if(mouseOverCheck) {
EaglerAdapter.glColor4f(0.7f, 0.7f, 1.0f, 1.0f);
}else {
EaglerAdapter.glColor4f(0.6f, 0.6f, 0.6f, 1.0f);
}
beaconx.bindTexture();
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(0.75f, 0.75f, 0.75f);
drawTexturedModalRect((width / 2 - 100) * 4 / 3, (beginOffset + 142) * 4 / 3, 22, 219, 22, 22);
EaglerAdapter.glPopMatrix();
if(hasCheckedBox) {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glColor4f(1.1f, 1.1f, 1.1f, 1.0f);
EaglerAdapter.glTranslatef(0.5f, 0.5f, 0.0f);
drawTexturedModalRect((width / 2 - 100), (beginOffset + 142), 90, 222, 16, 16);
EaglerAdapter.glPopMatrix();
}
EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
drawString(fontRenderer, new String(License.line50), width / 2 - 75, beginOffset + 147, 0xEEEEEE);
}
protected void mouseClicked(int par1, int par2, int par3) {
super.mouseClicked(par1, par2, par3);
if(width / 2 - 100 < par1 && width / 2 - 83 > par1 && beginOffset + 142 < par2 && beginOffset + 159 > par2) {
this.mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
hasCheckedBox = !hasCheckedBox;
}
}
}

View File

@ -0,0 +1,13 @@
package net.lax1dude.eaglercraft;
import net.minecraft.src.GuiScreen;
public class GuiScreenLicenseDeclined extends GuiScreen {
public void drawScreen(int mx, int my, float par3) {
this.drawDefaultBackground();
drawCenteredString(fontRenderer, new String(License.line70), width / 2, height / 3 - 10, 0xFFFFFF);
drawCenteredString(fontRenderer, new String(License.line71), width / 2, height / 3 + 18, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line72), width / 2, height / 3 + 35, 0x666666);
}
}

View File

@ -0,0 +1,129 @@
package net.lax1dude.eaglercraft;
public class License {
/*
* This is the text on the 'License Agreement' screen
* It is encoded to stop people from easily modifying it
* in classes.js via find/replace in a text editor
*/
static final byte[] line00 = new byte[] {
(byte)76,(byte)105,(byte)99,(byte)101,(byte)110,(byte)115,(byte)101,(byte)32,(byte)39,(byte)65,
(byte)103,(byte)114,(byte)101,(byte)101,(byte)109,(byte)101,(byte)110,(byte)116,(byte)39
};
static final byte[] line10 = new byte[] {
(byte)69,(byte)97,(byte)103,(byte)108,(byte)101,(byte)114,(byte)99,(byte)114,(byte)97,(byte)102,
(byte)116,(byte)32,(byte)105,(byte)115,(byte)32,(byte)194,(byte)167,(byte)100,(byte)102,(byte)114,
(byte)101,(byte)101,(byte)32,(byte)115,(byte)111,(byte)102,(byte)116,(byte)119,(byte)97,(byte)114,
(byte)101,(byte)44,(byte)194,(byte)167,(byte)114,(byte)32,(byte)105,(byte)102,(byte)32,(byte)115,
(byte)111,(byte)109,(byte)101,(byte)111,(byte)110,(byte)101,(byte)32,(byte)105,(byte)110,(byte)116,
(byte)101,(byte)110,(byte)116,(byte)105,(byte)111,(byte)110,(byte)97,(byte)108,(byte)108,(byte)121,
(byte)32,(byte)99,(byte)104,(byte)97,(byte)114,(byte)103,(byte)101,(byte)100
};
static final byte[] line11 = new byte[] {(byte)121,(byte)111,(byte)117,(byte)32,(byte)97,(byte)110,
(byte)121,(byte)32,(byte)115,(byte)117,(byte)109,(byte)32,(byte)111,(byte)102,(byte)32,(byte)109,
(byte)111,(byte)110,(byte)101,(byte)121,(byte)32,(byte)116,(byte)111,(byte)32,(byte)103,(byte)97,
(byte)105,(byte)110,(byte)32,(byte)97,(byte)99,(byte)99,(byte)101,(byte)115,(byte)115,(byte)32,
(byte)116,(byte)111,(byte)32,(byte)116,(byte)104,(byte)105,(byte)115,(byte)32,(byte)102,(byte)105,
(byte)108,(byte)101,(byte)44,(byte)32,(byte)121,(byte)111,(byte)117,(byte)32,(byte)97,(byte)114,
(byte)101,(byte)32,(byte)97,(byte)110
};
static final byte[] line12 = new byte[] {(byte)105,(byte)100,(byte)105,(byte)111,(byte)116,(byte)32,
(byte)97,(byte)110,(byte)100,(byte)32,(byte)97,(byte)32,(byte)118,(byte)105,(byte)99,(byte)116,
(byte)105,(byte)109,(byte)32,(byte)111,(byte)102,(byte)32,(byte)112,(byte)105,(byte)114,(byte)97,
(byte)99,(byte)121,(byte)46,(byte)32,(byte)83,(byte)116,(byte)111,(byte)112,(byte)32,(byte)112,
(byte)108,(byte)97,(byte)121,(byte)105,(byte)110,(byte)103,(byte)32,(byte)121,(byte)111,(byte)117,
(byte)114,(byte)115,(byte)101,(byte)108,(byte)102,(byte)46
};
static final byte[] line20 = new byte[] {
(byte)67,(byte)108,(byte)105,(byte)99,(byte)107,(byte)32,(byte)39,(byte)70,(byte)111,(byte)114,
(byte)107,(byte)32,(byte)111,(byte)110,(byte)32,(byte)71,(byte)105,(byte)116,(byte)104,(byte)117,
(byte)98,(byte)39,(byte)32,(byte)111,(byte)110,(byte)32,(byte)116,(byte)104,(byte)101,(byte)32,
(byte)109,(byte)97,(byte)105,(byte)110,(byte)32,(byte)109,(byte)101,(byte)110,(byte)117,(byte)32,
(byte)116,(byte)111,(byte)32,(byte)97,(byte)99,(byte)99,(byte)101,(byte)115,(byte)115,(byte)32,
(byte)116,(byte)104,(byte)101,(byte)32,(byte)111,(byte)102,(byte)102,(byte)105,(byte)99,(byte)97,(byte)108
};
static final byte[] line21 = new byte[] {
(byte)115,(byte)111,(byte)117,(byte)114,(byte)99,(byte)101,(byte)32,(byte)99,(byte)111,(byte)100,
(byte)101,(byte)32,(byte)116,(byte)111,(byte)32,(byte)100,(byte)111,(byte)119,(byte)110,(byte)108,
(byte)111,(byte)97,(byte)100,(byte)32,(byte)116,(byte)104,(byte)105,(byte)115,(byte)32,(byte)101,
(byte)100,(byte)117,(byte)99,(byte)97,(byte)116,(byte)105,(byte)111,(byte)110,(byte)97,(byte)108,
(byte)32,(byte)112,(byte)114,(byte)111,(byte)106,(byte)101,(byte)99,(byte)116,(byte)32,(byte)108,
(byte)101,(byte)103,(byte)105,(byte)116,(byte)105,(byte)109,(byte)97,(byte)116,(byte)101,(byte)108,(byte)121
};
static final byte[] line30 = new byte[] {
(byte)73,(byte)32,(byte)97,(byte)109,(byte)32,(byte)97,(byte)119,(byte)97,(byte)114,(byte)101,
(byte)32,(byte)116,(byte)104,(byte)97,(byte)116,(byte)32,(byte)116,(byte)104,(byte)105,(byte)115,
(byte)32,(byte)112,(byte)114,(byte)111,(byte)106,(byte)101,(byte)99,(byte)116,(byte)32,(byte)118,
(byte)105,(byte)111,(byte)108,(byte)97,(byte)116,(byte)101,(byte)100,(byte)32,(byte)77,(byte)111,
(byte)106,(byte)97,(byte)110,(byte)103,(byte)39,(byte)115,(byte)32,(byte)84,(byte)101,(byte)114,
(byte)109,(byte)115,(byte)32,(byte)111,(byte)102,(byte)32,(byte)83,(byte)101,(byte)114,(byte)118,
(byte)105,(byte)99,(byte)101
};
static final byte[] line31 = new byte[] {
(byte)84,(byte)104,(byte)105,(byte)115,(byte)32,(byte)105,(byte)115,(byte)32,(byte)103,(byte)111,
(byte)105,(byte)110,(byte)103,(byte)32,(byte)116,(byte)111,(byte)32,(byte)99,(byte)104,(byte)97,
(byte)110,(byte)103,(byte)101,(byte)32,(byte)105,(byte)110,(byte)32,(byte)97,(byte)32,(byte)102,
(byte)101,(byte)119,(byte)32,(byte)119,(byte)101,(byte)101,(byte)107,(byte)115,(byte)44,(byte)32,
(byte)119,(byte)104,(byte)101,(byte)110,(byte)32,(byte)73,(byte)32,(byte)99,(byte)111,(byte)110,
(byte)118,(byte)101,(byte)114,(byte)116,(byte)32,(byte)116,(byte)104,(byte)105,(byte)115,(byte)32,
(byte)103,(byte)97,(byte)109,(byte)101
};
static final byte[] line32 = new byte[] {
(byte)105,(byte)110,(byte)116,(byte)111,(byte)32,(byte)97,(byte)110,(byte)32,(byte)111,(byte)110,
(byte)108,(byte)105,(byte)110,(byte)101,(byte)45,(byte)109,(byte)111,(byte)100,(byte)101,(byte)32,
(byte)112,(byte)108,(byte)117,(byte)103,(byte)105,(byte)110,(byte)32,(byte)116,(byte)104,(byte)97,
(byte)116,(byte)32,(byte)114,(byte)101,(byte)113,(byte)117,(byte)105,(byte)114,(byte)101,(byte)115,
(byte)32,(byte)97,(byte)32,(byte)109,(byte)105,(byte)99,(byte)114,(byte)111,(byte)115,(byte)111,
(byte)102,(byte)116,(byte)32,(byte)97,(byte)99,(byte)99,(byte)111,(byte)117,(byte)110,(byte)116,(byte)46
};
static final byte[] line40 = new byte[] {
(byte)85,(byte)110,(byte)116,(byte)105,(byte)108,(byte)32,(byte)116,(byte)104,(byte)101,(byte)110,
(byte)44,(byte)32,(byte)68,(byte)79,(byte)32,(byte)78,(byte)79,(byte)84,(byte)32,(byte)66,(byte)85,
(byte)89,(byte)32,(byte)79,(byte)82,(byte)32,(byte)83,(byte)69,(byte)76,(byte)76,(byte)32,(byte)65,
(byte)67,(byte)67,(byte)69,(byte)83,(byte)83,(byte)32,(byte)84,(byte)79,(byte)32,(byte)84,(byte)72,
(byte)73,(byte)83,(byte)32,(byte)80,(byte)82,(byte)79,(byte)74,(byte)69,(byte)67,(byte)84
};
static final byte[] line50 = new byte[] {
(byte)73,(byte)32,(byte)117,(byte)110,(byte)100,(byte)101,(byte)114,(byte)115,(byte)116,(byte)97,
(byte)110,(byte)100,(byte)32,(byte)97,(byte)110,(byte)100,(byte)32,(byte)107,(byte)110,(byte)111,
(byte)119,(byte)32,(byte)104,(byte)111,(byte)119,(byte)32,(byte)116,(byte)111,(byte)32,(byte)114,
(byte)101,(byte)97,(byte)100
};
static final byte[] line60 = new byte[] {(byte)65,(byte)99,(byte)99,(byte)101,(byte)112,(byte)116};
static final byte[] line61 = new byte[] {(byte)68,(byte)101,(byte)99,(byte)108,(byte)105,(byte)110,(byte)101};
static final byte[] line70 = new byte[] {
(byte)84,(byte)101,(byte)114,(byte)109,(byte)115,(byte)32,(byte)111,(byte)102,(byte)32,(byte)83,
(byte)101,(byte)114,(byte)118,(byte)105,(byte)99,(byte)101,(byte)32,(byte)68,(byte)101,(byte)99,
(byte)108,(byte)105,(byte)110,(byte)101,(byte)100
};
static final byte[] line71 = new byte[] {
(byte)121,(byte)111,(byte)117,(byte)32,(byte)99,(byte)97,(byte)110,(byte)110,(byte)111,(byte)116,
(byte)32,(byte)117,(byte)115,(byte)101,(byte)32,(byte)116,(byte)104,(byte)105,(byte)115,(byte)32,
(byte)115,(byte)111,(byte)102,(byte)116,(byte)119,(byte)97,(byte)114,(byte)101,(byte)32,(byte)105,
(byte)102,(byte)32,(byte)121,(byte)111,(byte)117,(byte)32,(byte)100,(byte)111,(byte)32,(byte)110,
(byte)111,(byte)116,(byte)32,(byte)97,(byte)99,(byte)99,(byte)101,(byte)112,(byte)116
};
static final byte[] line72 = new byte[] {
(byte)114,(byte)101,(byte)102,(byte)114,(byte)101,(byte)115,(byte)104,(byte)32,(byte)116,(byte)104,
(byte)101,(byte)32,(byte)112,(byte)97,(byte)103,(byte)101,(byte)32,(byte)116,(byte)111,(byte)32,
(byte)116,(byte)114,(byte)121,(byte)32,(byte)97,(byte)103,(byte)97,(byte)105,(byte)110
};
}

View File

@ -16,116 +16,116 @@ import net.lax1dude.eaglercraft.glemu.vector.Vector4f;
public class EaglerAdapterGL30 extends EaglerAdapterImpl2 {
public static boolean glBlendEnabled=false;
public static final int GL_ZERO = 0;
public static final int GL_ONE = 1;
public static final int GL_TEXTURE_2D = 2;
public static final int GL_SMOOTH = 3;
public static final int GL_DEPTH_TEST = 4;
public static final int GL_LEQUAL = 5;
public static final int GL_ALPHA_TEST = 6;
public static final int GL_GREATER = 7;
public static final int GL_BACK = 8;
public static final int GL_PROJECTION = 9;
public static final int GL_MODELVIEW = 10;
public static final int GL_COLOR_BUFFER_BIT = 1;
public static final int GL_DEPTH_BUFFER_BIT = 2;
public static final int GL_LIGHTING = 13;
public static final int GL_FOG = 14;
public static final int GL_COLOR_MATERIAL = 15;
public static final int GL_BLEND = 16;
public static final int GL_RGBA = 18;
public static final int GL_UNSIGNED_BYTE = 19;
public static final int GL_TEXTURE_WIDTH = 20;
public static final int GL_LIGHT0 = 21;
public static final int GL_LIGHT1 = 22;
public static final int GL_POSITION = 30;
public static final int GL_DIFFUSE = 31;
public static final int GL_SPECULAR = 32;
public static final int GL_AMBIENT = 33;
public static final int GL_FLAT = 34;
public static final int GL_LIGHT_MODEL_AMBIENT = 35;
public static final int GL_FRONT_AND_BACK = 36;
public static final int GL_AMBIENT_AND_DIFFUSE = 37;
public static final int GL_MODELVIEW_MATRIX = 38;
public static final int GL_PROJECTION_MATRIX = 39;
public static final int GL_VIEWPORT = 40;
public static final int GL_RESCALE_NORMAL = 41;
public static final int GL_SRC_ALPHA = 42;
public static final int GL_ONE_MINUS_SRC_ALPHA = 43;
public static final int GL_ONE_MINUS_DST_COLOR = 44;
public static final int GL_ONE_MINUS_SRC_COLOR = 45;
public static final int GL_CULL_FACE = 46;
public static final int GL_TEXTURE_MIN_FILTER = 47;
public static final int GL_TEXTURE_MAG_FILTER = 48;
public static final int GL_LINEAR = 49;
public static final int GL_COLOR_LOGIC_OP = 50;
public static final int GL_OR_REVERSE = 51;
public static final int GL_EQUAL = 52;
public static final int GL_SRC_COLOR = 53;
public static final int GL_TEXTURE = 54;
public static final int GL_FRONT = 55;
public static final int GL_COMPILE = 56;
public static final int GL_S = 57;
public static final int GL_T = 58;
public static final int GL_R = 59;
public static final int GL_Q = 60;
public static final int GL_TEXTURE_GEN_S = 61;
public static final int GL_TEXTURE_GEN_T = 62;
public static final int GL_TEXTURE_GEN_R = 63;
public static final int GL_TEXTURE_GEN_Q = 64;
public static final int GL_TEXTURE_GEN_MODE = 65;
public static final int GL_OBJECT_PLANE = 66;
public static final int GL_EYE_PLANE = 67;
public static final int GL_OBJECT_LINEAR = 68;
public static final int GL_EYE_LINEAR = 69;
public static final int GL_NEAREST = 70;
public static final int GL_CLAMP = 71;
public static final int GL_TEXTURE_WRAP_S = 72;
public static final int GL_TEXTURE_WRAP_T = 73;
public static final int GL_REPEAT = 74;
public static final int GL_BGRA = 75;
public static final int GL_UNSIGNED_INT_8_8_8_8_REV = 76;
public static final int GL_DST_COLOR = 77;
public static final int GL_POLYGON_OFFSET_FILL = 78;
public static final int GL_NORMALIZE = 79;
public static final int GL_DST_ALPHA = 80;
public static final int GL_FLOAT = 81;
public static final int GL_TEXTURE_COORD_ARRAY = 82;
public static final int GL_SHORT = 83;
public static final int GL_COLOR_ARRAY = 84;
public static final int GL_VERTEX_ARRAY = 85;
public static final int GL_TRIANGLES = 86;
public static final int GL_NORMAL_ARRAY = 87;
public static final int GL_TEXTURE_3D = 88;
public static final int GL_FOG_MODE = 89;
public static final int GL_EXP = 90;
public static final int GL_FOG_DENSITY = 91;
public static final int GL_FOG_START = 92;
public static final int GL_FOG_END = 93;
public static final int GL_FOG_COLOR = 94;