Compare commits

..

No commits in common. "9d5a1e7d1b6770975eb0f1514903949567057e24" and "11f28fef5346f2fe7c619da2d1af78aac1a1831b" have entirely different histories.

6 changed files with 30 additions and 111 deletions

View File

@ -21,19 +21,11 @@ The textures are compiled into `resources.mc` using [laxdude](https://github.com
As of right now there is no system to compile an offline download, so you will have to manually copy and paste the javascript from `web/js/app.js` into the HTML file, for the `resources.mc` just encode the file using [Base64](https://www.base64encode.org/) and paste it into the assets div.
# Multiplayer
Steps to setup a multiplayer server:
Multiplayer has been successfully rewritten and thoroughly tested. It seems to be pretty stable but it had to be removed due to a glitch in Singleplayer's chunk loading, the issue lies within Alpha's multiplayer code somewhere and I am unable to pinpoint the exact cause of the issue so until I am able to figure it out, multiplayer will not be avalible.
1. Make sure have to have Java 8 (or higher) installed.
2. Download the [Alpha.jar](https://github.com/PeytonPlayz595/Alpha-v1.2.6/blob/main/minecraft_server/Alpha.jar)
3. Run the server by using `java -jar Alpha.jar`
4. Make sure to have the latest version of NodeJS installed
5. Download or clone my [ws-tcp-bridge repo](https://github.com/PeytonPlayz595/ws-tcp-bridge/) and extract it into a folder
6. CD into the folder of the extracted repo
7. Proxy the Minecraft server to WebSockets by running `node ws-tcp-bridge --websocket <WebSocket_Port> --minecraft localhost:<Minecraft_Port>`
If you are really impatient and cannot wait then go through the commit history and find commit 62af5c9 titled "oops" and download the offline download from there, **THIS VERSION IS BUGGED AND CHUNK LOADING IN SINGLEPLAYER IS EXTREMELY BROKEN, SOME (IF NOT MOST) CHUNKS MAY NOT EVEN SAVE AT ALL!**
Note: Replace "<WebSocket_Port>" with the port you want clients to use when connecting to the server, replace "<Minecraft_Port>" with the port you are hosting the Minecraft Server on.
WebSockify will probably work better but I'm not gonna write a guide for you, if you want to use it you're gonna have to figure it out yourself.
If you do decide to use this version (not recommended) just download the Alpha v1.2.6 server software from web archive and use websockify to proxy it to websockets.
# Texture Packs
This is pretty much self explanitory, just make sure that the texture pack has the same file structure as in `resources/`, and then add the files to a ZIP archive, if a texture pack does not work then most likely it is not for this version of Minecraft. You're probably gonna have to make your own texture pack because texture packs for Alpha are very rare these days.

View File

@ -2,7 +2,7 @@ package net.PeytonPlayz585;
public class Location {
private double x,y,z;
public int x,y,z;
public Location(int x, int y, int z) {
this.x = x;
@ -10,28 +10,4 @@ public class Location {
this.z = z;
}
public Location(double x, double y, double z) {
this.x = x;
this.y = y;
this.z = z;
}
public Location(float x, float y, float z) {
this.x = x;
this.y = y;
this.z = z;
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public double getZ() {
return this.z;
}
}

View File

@ -1,36 +1,31 @@
package net.PeytonPlayz585;
import java.util.ArrayList;
import java.util.List;
import net.PeytonPlayzt585.entity.CreatureType;
import net.minecraft.server.MinecraftServer;
import net.minecraft.src.Block;
import net.minecraft.src.Chunk;
import net.minecraft.src.Entity;
import net.minecraft.src.EntityLiving;
import net.minecraft.src.EntityPlayer;
import net.minecraft.src.IProgressUpdate;
import net.minecraft.src.WorldProvider;
public class World {
public static Block getBlockAt(Location location) {
return Block.blocksList[MinecraftServer.worldMngr.getBlockId((int)location.getX(), (int)location.getY(), (int)location.getZ())];
public static Block getBlockAt(int var1, int var2, int var3) {
return Block.blocksList[MinecraftServer.worldMngr.getBlockId(var1, var2, var3)];
}
public static Chunk getChunkFromBlockCoords(Location location) {
return MinecraftServer.worldMngr.getChunkFromBlockCoords((int)location.getX(), (int)location.getZ());
public static Chunk getChunkFromBlockCoords(int var1, int var2) {
return MinecraftServer.worldMngr.getChunkFromBlockCoords(var1, var2);
}
public static Chunk getChunkFromChunkCoords(Location location) {
return MinecraftServer.worldMngr.getChunkFromChunkCoords((int)location.getX(), (int)location.getZ());
public static Chunk getChunkFromChunkCoords(int var1, int var2) {
return MinecraftServer.worldMngr.getChunkFromChunkCoords(var1, var2);
}
public static boolean isChunkLoaded(Location location) {
Chunk chunk = getChunkFromChunkCoords(location);
public static boolean isChunkLoaded(int var1, int var2) {
Chunk chunk = getChunkFromChunkCoords(var1, var2);
if(chunk == null) {
chunk = getChunkFromBlockCoords(location);
chunk = getChunkFromBlockCoords(var1, var2);
if(chunk == null) {
return false;
@ -39,42 +34,30 @@ public class World {
return chunk.func_347_a();
}
public static boolean loadChunk(Location location, boolean var1) {
Chunk chunk = MinecraftServer.worldMngr.A.loadChunk((int)location.getX(), (int)location.getZ());
public static boolean loadChunk(int x, int y, boolean var1) {
Chunk chunk = MinecraftServer.worldMngr.A.loadChunk(x, y);
if(chunk == null) {
return false;
}
return true;
}
public static void spawnCreature(CreatureType type, Location location) {
public static void spawnCreature(CreatureType type, double x, double y, double z) {
Entity entity = type.nameToEntity(type.name());
entity.func_107_c(location.getX(), location.getY(), location.getZ(), MinecraftServer.worldMngr.rand.nextFloat() * 360.0F, 0.0F);
entity.func_107_c(x, y, z, MinecraftServer.worldMngr.rand.nextFloat() * 360.0F, 0.0F);
MinecraftServer.worldMngr.entityJoinedWorld(entity);
}
public static List<Entity> getEntities() {
List<Entity> list = new ArrayList<Entity>();
for(int i = 0; i > MinecraftServer.worldMngr.field_815_a.size(); i++) {
Entity entity = (Entity)MinecraftServer.worldMngr.field_815_a.get(i);
if(entity != null) {
list.add(entity);
}
}
return list;
public static void spawnCreature(CreatureType type, float x, float y, float z) {
Entity entity = type.nameToEntity(type.name());
entity.func_107_c(x, y, z, MinecraftServer.worldMngr.rand.nextFloat() * 360.0F, 0.0F);
MinecraftServer.worldMngr.entityJoinedWorld(entity);
}
public static List<EntityLiving> getLivingEntities() {
List<EntityLiving> list = new ArrayList<EntityLiving>();
for(int i = 0; i > MinecraftServer.worldMngr.field_815_a.size(); i++) {
Entity entity = (Entity)MinecraftServer.worldMngr.field_815_a.get(i);
if(entity != null) {
if(entity instanceof EntityLiving) {
list.add((EntityLiving)entity);
}
}
}
return list;
public static void spawnCreature(CreatureType type, int x, int y, int z) {
Entity entity = type.nameToEntity(type.name());
entity.func_107_c(x, y, z, MinecraftServer.worldMngr.rand.nextFloat() * 360.0F, 0.0F);
MinecraftServer.worldMngr.entityJoinedWorld(entity);
}
public static Location getSpawnLocation() {
@ -84,10 +67,10 @@ public class World {
return new Location(x, y, z);
}
public static void setSpawnLocation(Location location) {
MinecraftServer.worldMngr.spawnX = (int) location.getX();
MinecraftServer.worldMngr.spawnY = (int) location.getY();
MinecraftServer.worldMngr.spawnZ = (int) location.getZ();
public static void setSpawnLocation(int x, int y, int z) {
MinecraftServer.worldMngr.spawnX = x;
MinecraftServer.worldMngr.spawnY = y;
MinecraftServer.worldMngr.spawnZ = z;
}
public static long getWorldTime() {

View File

@ -1,11 +0,0 @@
package net.PeytonPlayz585.events.chunk;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ChunkLoadEvent {
}

View File

@ -1,12 +0,0 @@
package net.PeytonPlayz585.events.chunk;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ChunkUnloadEvent {
}

View File

@ -180,8 +180,7 @@ public class NetworkManager {
ByteBuffer stream = ByteBuffer.allocate(cap);
stream.put(b);
stream.limit(stream.position());
stream.rewind();
stream.flip();
DataInputStream packetStream = new DataInputStream(new ByteBufferDirectInputStream(stream));
while(stream.hasRemaining()) {
stream.mark();
@ -276,10 +275,6 @@ public class NetworkManager {
}
}
if(!isConnectionOpen() && !this.isTerminating) {
this.networkShutdown("Lost connection!");
}
if(this.isTerminating && this.readPackets.isEmpty()) {
this.netHandler.handleErrorMessage(this.terminationReason);
}
@ -316,10 +311,6 @@ public class NetworkManager {
var0.sendPacket();
}
boolean isConnectionOpen() {
return networkSocket.isConnected();
}
static Thread getReadThread(NetworkManager var0) {
return var0.readThread;
}