1
0
Fork 0

add eagler build sys

This commit is contained in:
HoosierTransfer 2024-05-14 16:42:45 -04:00
parent 9616a43afd
commit 11b196d681
7 changed files with 232 additions and 7 deletions

40
.github/workflows/eagler_build_sys.yml vendored Normal file
View File

@ -0,0 +1,40 @@
name: Eagler Build System
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: 'Setup Python'
uses: actions/setup-python@v2
with:
python-version: '3.x' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
- name: 'Run Optimization'
run: |
pip install -r resources/requirements.txt
python resources/optimize.py
- name: 'Setup Java'
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
- name: 'Compile EPK'
run: 'java -jar "resources/CompileEPK.jar" "resources/optimizedResources" "javascript/assets.epk"'
- name: 'Compile Javascript'
run: /usr/bin/env sh ./gradlew generateJavascript --no-daemon
- name: 'Make Offline Download'
run: 'java -cp "resources/MakeOfflineDownload.jar:resources/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/EaglercraftL_1.9_Offline_en_US.html" "javascript/EaglercraftX_1.8_Offline_International.html" "javascript/lang"'
- name: 'Zip Web Files'
run: 'zip web.zip javascript/classes.js javascript/assets.epk javascript/index.html'
- name: 'Output Offline Download'
uses: actions/upload-artifact@v3
with:
name: lambda
path: |
javascript/EaglercraftL_1.9_Offline_en_US.html
web.zip

View File

@ -185,6 +185,7 @@ import net.minecraft.network.play.server.S45PacketTitle;
import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.SPacketSetPassengers;
import net.minecraft.network.play.server.SPacketSoundEffect;
import net.minecraft.network.play.server.SPacketUnloadChunk;
import net.minecraft.potion.PotionEffect;
@ -917,6 +918,36 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
}
public void handleSetPassengers(SPacketSetPassengers packetIn) {
Entity entity = this.clientWorldController.getEntityByID(packetIn.getEntityId());
if (entity == null) {
logger.warn("Received passengers for unknown entity");
} else {
boolean flag = entity.isRidingOrBeingRiddenBy(this.gameController.thePlayer);
entity.ridingEntity = null;
for (int i : packetIn.getPassengerIds()) {
Entity entity1 = this.clientWorldController.getEntityByID(i);
if (entity1 == null) {
logger.warn("Received unknown passenger for " + entity);
} else {
entity.mountEntity(entity1);
if (entity1 == this.gameController.thePlayer && !flag) {
this.gameController.ingameGUI
.setRecordPlaying(
I18n.format("mount.onboard",
new Object[] { GameSettings.getKeyDisplayString(
this.gameController.gameSettings.keyBindSneak.getKeyCode()) }),
false);
}
}
}
}
}
/**
* +
* Invokes the entities' handleUpdateHealth method which is

View File

@ -1922,6 +1922,15 @@ public abstract class Entity implements ICommandSender {
return this.ridingEntity != null;
}
public boolean isRidingOrBeingRiddenBy(Entity entityIn) {
if (this.ridingEntity.isRidingOrBeingRiddenBy(entityIn))
return true;
if (this.ridingEntity.equals(entityIn))
return true;
return false;
}
/**
* +
* Returns if this entity is sneaking.

View File

@ -61,12 +61,17 @@ public class InventoryPlayer implements IInventory {
* pieces.
*/
public ItemStack[] armorInventory = new ItemStack[4];
public ItemStack[] offHandInventory = new ItemStack[1];
private final ItemStack[][] allInventories;
public int currentItem;
public EntityPlayer player;
private ItemStack itemStack;
public boolean inventoryChanged;
public InventoryPlayer(EntityPlayer playerIn) {
this.allInventories = new ItemStack[][] { this.mainInventory, this.armorInventory, this.offHandInventory };
this.player = playerIn;
}
@ -518,6 +523,15 @@ public class InventoryPlayer implements IInventory {
}
}
for (int k = 0; k < this.offHandInventory.length; ++k) {
if (this.offHandInventory[k] != null) {
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
nbttagcompound2.setByte("Slot", (byte) (k + 150));
this.offHandInventory[k].writeToNBT(nbttagcompound2);
parNBTTagList.appendTag(nbttagcompound2);
}
}
return parNBTTagList;
}
@ -529,6 +543,7 @@ public class InventoryPlayer implements IInventory {
public void readFromNBT(NBTTagList parNBTTagList) {
this.mainInventory = new ItemStack[36];
this.armorInventory = new ItemStack[4];
this.offHandInventory = new ItemStack[1];
for (int i = 0; i < parNBTTagList.tagCount(); ++i) {
NBTTagCompound nbttagcompound = parNBTTagList.getCompoundTagAt(i);
@ -537,10 +552,10 @@ public class InventoryPlayer implements IInventory {
if (itemstack != null) {
if (j >= 0 && j < this.mainInventory.length) {
this.mainInventory[j] = itemstack;
}
if (j >= 100 && j < this.armorInventory.length + 100) {
} else if (j >= 100 && j < this.armorInventory.length + 100) {
this.armorInventory[j - 100] = itemstack;
} else if (j >= 150 && j < this.offHandInventory.length + 150) {
this.offHandInventory[j - 150] = itemstack;
}
}
}
@ -552,7 +567,7 @@ public class InventoryPlayer implements IInventory {
* Returns the number of slots in the inventory.
*/
public int getSizeInventory() {
return this.mainInventory.length + 4;
return this.mainInventory.length + this.armorInventory.length + this.offHandInventory.length;
}
/**

View File

@ -69,6 +69,7 @@ import net.minecraft.network.play.server.S45PacketTitle;
import net.minecraft.network.play.server.S46PacketSetCompressionLevel;
import net.minecraft.network.play.server.S47PacketPlayerListHeaderFooter;
import net.minecraft.network.play.server.S48PacketResourcePackSend;
import net.minecraft.network.play.server.SPacketSetPassengers;
import net.minecraft.network.play.server.SPacketSoundEffect;
import net.minecraft.network.play.server.SPacketUnloadChunk;
@ -496,4 +497,6 @@ public interface INetHandlerPlayClient extends INetHandler {
void handleUnloadChunk(SPacketUnloadChunk var1);
void handleSoundEffectNew(SPacketSoundEffect var1);
void handleSetPassengers(SPacketSetPassengers var1);
}

View File

@ -0,0 +1,75 @@
package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.entity.Entity;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class SPacketMoveVehicle implements Packet<INetHandlerPlayClient> {
private double x;
private double y;
private double z;
private float yaw;
private float pitch;
public SPacketMoveVehicle() {
}
public SPacketMoveVehicle(Entity entityIn) {
this.x = entityIn.posX;
this.y = entityIn.posY;
this.z = entityIn.posZ;
this.yaw = entityIn.rotationYaw;
this.pitch = entityIn.rotationPitch;
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException {
this.x = buf.readDouble();
this.y = buf.readDouble();
this.z = buf.readDouble();
this.yaw = buf.readFloat();
this.pitch = buf.readFloat();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeDouble(this.x);
buf.writeDouble(this.y);
buf.writeDouble(this.z);
buf.writeFloat(this.yaw);
buf.writeFloat(this.pitch);
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient handler) {
// handler.handleMoveVehicle(this);
}
public double getX() {
return this.x;
}
public double getY() {
return this.y;
}
public double getZ() {
return this.z;
}
public float getYaw() {
return this.yaw;
}
public float getPitch() {
return this.pitch;
}
}

View File

@ -1,7 +1,59 @@
package net.minecraft.network.play.server;
import net.minecraft.network.PlaceholderPacket;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
public class SPacketSetPassengers extends PlaceholderPacket {
public class SPacketSetPassengers implements Packet<INetHandlerPlayClient> {
private int entityId;
private int[] passengerIds;
public SPacketSetPassengers() {
}
public SPacketSetPassengers(Entity entityIn) {
this.entityId = entityIn.getEntityId();
List<Entity> list = Collections.singletonList(entityIn.ridingEntity);
this.passengerIds = new int[list.size()];
for (int i = 0; i < list.size(); ++i) {
this.passengerIds[i] = ((Entity) list.get(i)).getEntityId();
}
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException {
this.entityId = buf.readVarIntFromBuffer();
this.passengerIds = buf.readVarIntArray();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeVarIntToBuffer(this.entityId);
buf.writeVarIntArray(this.passengerIds);
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient handler) {
handler.handleSetPassengers(this);
}
public int[] getPassengerIds() {
return this.passengerIds;
}
public int getEntityId() {
return this.entityId;
}
}