i forgor to commit v1.2.4 so im commiting v1.2.5 instead

This commit is contained in:
radmanplays 2024-03-12 15:57:15 +03:30
parent e41df240a7
commit 8dfcd11bdf
43 changed files with 1935 additions and 39 deletions

View File

@ -101,7 +101,17 @@
+ }
+
> CHANGE 247 : 248 @ 247 : 248
> CHANGE 37 : 38 @ 37 : 38
~ return this.fullBlock && (!this.noRender);
> INSERT 162 : 165 @ 162
+ if (this.noRender || this.forceRender) {
+ return this.forceRender;
+ }
> CHANGE 47 : 48 @ 47 : 48
~ public void randomTick(World world, BlockPos blockpos, IBlockState iblockstate, EaglercraftRandom random) {

View File

@ -5,8 +5,13 @@
# Version: 1.0
# Author: lax1dude
> CHANGE 4 : 5 @ 4 : 5
> INSERT 2 : 4 @ 2
~ return "eagler";
+ import static net.lax1dude.eaglercraft.v1_8.EaglercraftVersion.projectForkName;
+
> CHANGE 2 : 3 @ 2 : 3
~ return projectForkName;
> EOF

View File

@ -137,7 +137,7 @@
> CHANGE 1 : 2 @ 1 : 2
~ public class Minecraft extends BaseData implements IThreadListener {
~ public class Minecraft extends ModData implements IThreadListener {
> CHANGE 2 : 3 @ 2 : 9

View File

@ -50,8 +50,10 @@
~ this.buttonList.add(lanButton = new GuiButton(7, this.width / 2 + 2, this.height / 4 + 96 + b0, 98, 20,
~ I18n.format(LANServerController.isLANOpen() ? "menu.closeLan" : "menu.openToLan", new Object[0])));
> CHANGE 4 : 9 @ 4 : 5
> CHANGE 4 : 11 @ 4 : 5
~ this.buttonList.add(new GuiButton(69420, this.width / 2 - 100, this.height / 4 + 73 + b0,
~ I18n.format("eaglerforge.menu.mods", new Object[0])));
~ lanButton.enabled = SingleplayerServerController.isWorldRunning();
~ if (!hasSentAutoSave) {
~ hasSentAutoSave = true;

View File

@ -9,9 +9,12 @@
> DELETE 4 @ 4 : 6
> INSERT 1 : 19 @ 1
> INSERT 1 : 22 @ 1
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModAPI;
+ import net.eaglerforge.api.ModData;
+ import net.lax1dude.eaglercraft.v1_8.EagRuntime;
+ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
+ import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
@ -36,11 +39,19 @@
> DELETE 5 @ 5 : 8
> DELETE 47 @ 47 : 48
> INSERT 32 : 33 @ 32
+ import net.minecraft.entity.player.PlayerCapabilities;
> DELETE 15 @ 15 : 16
> DELETE 2 @ 2 : 3
> INSERT 36 : 37 @ 36
> CHANGE 1 : 2 @ 1 : 6
~ import net.minecraft.network.play.client.*;
> INSERT 30 : 31 @ 30
+ import net.minecraft.network.play.server.S20PacketEntityProperties.Snapshot;
@ -54,9 +65,17 @@
> DELETE 18 @ 18 : 19
> DELETE 32 @ 32 : 34
> CHANGE 17 : 18 @ 17 : 26
> CHANGE 3 : 4 @ 3 : 4
~ import net.minecraft.util.*;
> DELETE 6 @ 6 : 8
> CHANGE 1 : 2 @ 1 : 2
~ public class NetHandlerPlayClient extends ModData implements INetHandlerPlayClient {
> CHANGE 1 : 2 @ 1 : 2
~ private final EaglercraftNetworkManager netManager;
@ -84,12 +103,160 @@
+ this.skinCache.destroy();
> INSERT 2 : 6 @ 2
> INSERT 2 : 154 @ 2
+ public ServerSkinCache getSkinCache() {
+ return this.skinCache;
+ }
+
+ public void loadModData(BaseData data) {
+ doneLoadingTerrain = data.getBoolean("doneLoadingTerrain");
+ currentServerMaxPlayers = data.getInt("doneLoadingTerrain");
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ data.set("doneLoadingTerrain", doneLoadingTerrain);
+ data.set("currentServerMaxPlayers", currentServerMaxPlayers);
+
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+
+ data.setCallbackVoid("sendPacketAnimation", () -> {
+ addToSendQueue(new C0APacketAnimation());
+ });
+ data.setCallbackVoidWithDataArg("sendPacketEntityAction", (BaseData args) -> {
+ addToSendQueue(new C0BPacketEntityAction(args.getInt("entityId"),
+ C0BPacketEntityAction.Action.valueOf(args.getString("action")), args.getInt("auxData")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketInput", (BaseData args) -> {
+ addToSendQueue(new C0CPacketInput(args.getFloat("strafeSpeed"), args.getFloat("forwardSpeed"),
+ args.getBoolean("jumping"), args.getBoolean("sneaking")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketCloseWindow", (BaseData args) -> {
+ addToSendQueue(new C0DPacketCloseWindow(args.getInt("windowId")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketClickWindow", (BaseData args) -> {
+ if (args.getBaseData("clickedItemRef") instanceof ItemStack) {
+ addToSendQueue(new C0EPacketClickWindow(args.getInt("windowId"), args.getInt("slotId"),
+ args.getInt("usedButton"), args.getInt("mode"), (ItemStack) args.getBaseData("clickedItemRef"),
+ args.getShort("actionNumber")));
+ } else {
+ addToSendQueue(new C0EPacketClickWindow(args.getInt("windowId"), args.getInt("slotId"),
+ args.getInt("usedButton"), args.getInt("mode"), null, args.getShort("actionNumber")));
+ }
+ });
+ data.setCallbackVoidWithDataArg("sendPacketConfirmTransaction", (BaseData args) -> {
+ addToSendQueue(new C0FPacketConfirmTransaction(args.getInt("windowId"), args.getShort("uid"),
+ args.getBoolean("accepted")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketKeepAlive", (BaseData args) -> {
+ addToSendQueue(new C00PacketKeepAlive(args.getInt("key")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketChatMessage", (BaseData args) -> {
+ addToSendQueue(new C01PacketChatMessage(args.getString("messageIn")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketUseEntity", (BaseData args) -> {
+ if (args.has("entityId")) {
+ if (args.has("hitVec")) {
+ addToSendQueue(new C02PacketUseEntity(args.getInt("entityId"),
+ Vec3.fromModData(args.getBaseData("hitVec"))));
+ } else {
+ addToSendQueue(new C02PacketUseEntity(args.getInt("entityId"),
+ C02PacketUseEntity.Action.valueOf(args.getString("action"))));
+ }
+ } else {
+ if (args.has("hitVec")) {
+ addToSendQueue(new C02PacketUseEntity((Entity) args.getBaseData("entityRef"),
+ Vec3.fromModData(args.getBaseData("hitVec"))));
+ } else {
+ addToSendQueue(new C02PacketUseEntity((Entity) args.getBaseData("entityRef"),
+ C02PacketUseEntity.Action.valueOf(args.getString("action"))));
+ }
+ }
+ });
+ data.setCallbackVoidWithDataArg("sendPacketPlayer", (BaseData args) -> {
+ addToSendQueue(new C03PacketPlayer(args.getBoolean("isOnGround")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketPlayerPosition", (BaseData args) -> {
+ addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(args.getDouble("posX"), args.getDouble("posY"),
+ args.getDouble("posZ"), args.getBoolean("isOnGround")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketPlayerLook", (BaseData args) -> {
+ addToSendQueue(new C03PacketPlayer.C05PacketPlayerLook(args.getFloat("playerYaw"),
+ args.getFloat("playerPitch"), args.getBoolean("isOnGround")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketPlayerPosLook", (BaseData args) -> {
+ addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(args.getDouble("playerX"),
+ args.getDouble("playerY"), args.getDouble("playerZ"), args.getFloat("playerYaw"),
+ args.getFloat("playerPitch"), args.getBoolean("isOnGround")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketPlayerDigging", (BaseData args) -> {
+ addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.valueOf(args.getString("action")),
+ BlockPos.fromModData(args.getBaseData("pos")), EnumFacing.valueOf(args.getString("facing"))));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketPlayerBlockPlacement", (BaseData args) -> {
+ if (args.has("positionIn")) {
+ addToSendQueue(new C08PacketPlayerBlockPlacement((BlockPos) args.getBaseData("posRef"),
+ args.getInt("placedBlockDirectionIn"), (ItemStack) args.getBaseData("stackRef"),
+ args.getFloat("facingXIn"), args.getFloat("facingYIn"), args.getFloat("facingZIn")));
+ } else {
+ addToSendQueue(new C08PacketPlayerBlockPlacement((ItemStack) args.getBaseData("stackRef")));
+ }
+ });
+ data.setCallbackVoidWithDataArg("sendPacketHeldItemChange", (BaseData args) -> {
+ addToSendQueue(new C09PacketHeldItemChange(args.getInt("slotId")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketCreativeInventoryAction", (BaseData args) -> {
+ addToSendQueue(new C10PacketCreativeInventoryAction(args.getInt("slotId"),
+ (ItemStack) args.getBaseData("stackRef")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketEnchantItem", (BaseData args) -> {
+ addToSendQueue(new C11PacketEnchantItem(args.getInt("windowId"), args.getInt("button")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketUpdateSign", (BaseData args) -> {
+ String[] parLineArr = getStringArr("lines");
+ ChatComponentText[] lineArr = new ChatComponentText[parLineArr.length];
+ for (int i = 0; i < parLineArr.length; i++) {
+ lineArr[i] = new ChatComponentText(parLineArr[i]);
+ }
+ addToSendQueue(new C12PacketUpdateSign(BlockPos.fromModData(args.getBaseData("pos")), lineArr));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketPlayerAbilities", (BaseData args) -> {
+ addToSendQueue(new C13PacketPlayerAbilities((PlayerCapabilities) args.getBaseData("capabilitiesRef")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketTabComplete", (BaseData args) -> {
+ if (args.has("target")) {
+ addToSendQueue(new C14PacketTabComplete(args.getString("msg"),
+ BlockPos.fromModData(args.getBaseData("target"))));
+ } else {
+ addToSendQueue(new C14PacketTabComplete(args.getString("msg")));
+ }
+ });
+ data.setCallbackVoidWithDataArg("sendPacketClientSettings", (BaseData args) -> {
+ addToSendQueue(new C15PacketClientSettings(args.getString("lang"), args.getInt("view"),
+ EntityPlayer.EnumChatVisibility.valueOf(args.getString("chatVisibility")),
+ args.getBoolean("enableColors"), args.getInt("modelPartFlags")));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketClientStatus", (BaseData args) -> {
+ addToSendQueue(
+ new C16PacketClientStatus(C16PacketClientStatus.EnumState.valueOf(args.getString("status"))));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketSpectate", (BaseData args) -> {
+ addToSendQueue(new C18PacketSpectate(new EaglercraftUUID(args.getString("uuid"))));
+ });
+ data.setCallbackVoidWithDataArg("sendPacketResourcePackStatus", (BaseData args) -> {
+ addToSendQueue(new C19PacketResourcePackStatus(args.getString("hash"),
+ C19PacketResourcePackStatus.Action.valueOf(args.getString("status"))));
+ });
+ return data;
+ }
+
> DELETE 1 @ 1 : 2
@ -146,9 +313,479 @@
> DELETE 2 @ 2 : 3
> DELETE 7 @ 7 : 8
> CHANGE 3 : 18 @ 3 : 4
> DELETE 23 @ 23 : 24
~ if (ModAPI.clientPacketSendEventsEnabled) {
~ ModData eventData = new ModData();
~ eventData.set("preventDefault", false);
~ setPropertiesFromPacket(eventData, parPacket);
~ // ModAPI.logger.info("Send packet ev ::
~ // "+getEventNameFromPacket(parPacket));
~ BaseData newEvent = ModAPI.callEvent(getEventNameFromPacket(parPacket), eventData);
~ if (newEvent.has("preventDefault") && newEvent.getBoolean("preventDefault") == true) {
~ return;
~ }
~ Packet newPacket = setPropertiesToPacket(newEvent, parPacket);
~ this.netManager.sendPacket(newPacket);
~ } else {
~ this.netManager.sendPacket(parPacket);
~ }
> INSERT 2 : 436 @ 2
+ public String getEventNameFromPacket(Packet packet) {
+ if (packet instanceof C0APacketAnimation) {
+ return "sendpacketanimation";
+ } else if (packet instanceof C0BPacketEntityAction) {
+ return "sendpacketentityaction";
+ } else if (packet instanceof C0CPacketInput) {
+ return "sendpacketinput";
+ } else if (packet instanceof C0DPacketCloseWindow) {
+ return "sendpacketclosewindow";
+ } else if (packet instanceof C0EPacketClickWindow) {
+ return "sendpacketclickwindow";
+ } else if (packet instanceof C0FPacketConfirmTransaction) {
+ return "sendpacketconfirmtransaction";
+ } else if (packet instanceof C00PacketKeepAlive) {
+ return "sendpacketkeepalive";
+ } else if (packet instanceof C01PacketChatMessage) {
+ return "sendpacketchatmessage";
+ } else if (packet instanceof C02PacketUseEntity) {
+ return "sendpacketuseentity";
+ } else if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {
+ return "sendpacketplayerposition";
+ } else if (packet instanceof C03PacketPlayer.C05PacketPlayerLook) {
+ return "sendpacketplayerlook";
+ } else if (packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
+ return "sendpacketplayerposlook";
+ } else if (packet instanceof C03PacketPlayer) {
+ return "sendpacketplayer";
+ } else if (packet instanceof C07PacketPlayerDigging) {
+ return "sendpacketplayerdigging";
+ } else if (packet instanceof C08PacketPlayerBlockPlacement) {
+ return "sendpacketplayerblockplacement";
+ } else if (packet instanceof C09PacketHeldItemChange) {
+ return "sendpackethelditemchange";
+ } else if (packet instanceof C10PacketCreativeInventoryAction) {
+ return "sendpacketcreativeinventoryaction";
+ } else if (packet instanceof C11PacketEnchantItem) {
+ return "sendpacketenchantitem";
+ } else if (packet instanceof C12PacketUpdateSign) {
+ return "sendpacketupdatesign";
+ } else if (packet instanceof C13PacketPlayerAbilities) {
+ return "sendpacketplayerabilities";
+ } else if (packet instanceof C14PacketTabComplete) {
+ return "sendpackettabcomplete";
+ } else if (packet instanceof C15PacketClientSettings) {
+ return "sendpacketclientsettings";
+ } else if (packet instanceof C16PacketClientStatus) {
+ return "sendpacketclientstatus";
+ } else if (packet instanceof C17PacketCustomPayload) {
+ return "sendpacketcustompayload";
+ } else if (packet instanceof C18PacketSpectate) {
+ return "sendpacketspectate";
+ } else if (packet instanceof C19PacketResourcePackStatus) {
+ return "sendpacketresourcepackstatus";
+ }
+ return "sendpacketunknown";
+ }
+
+ public void setPropertiesFromPacket(BaseData data, Packet packet) {
+ if (packet instanceof C0APacketAnimation) {
+ C0APacketAnimation newPacket = (C0APacketAnimation) packet;
+ // Nothing to do
+ return;
+ } else if (packet instanceof C0BPacketEntityAction) {
+ C0BPacketEntityAction newPacket = (C0BPacketEntityAction) packet;
+ data.set("entityID", newPacket.entityID);
+ data.set("action", newPacket.action.name());
+ data.set("auxData", newPacket.auxData);
+ return;
+ } else if (packet instanceof C0CPacketInput) {
+ C0CPacketInput newPacket = (C0CPacketInput) packet;
+ data.set("strafeSpeed", newPacket.strafeSpeed);
+ data.set("forwardSpeed", newPacket.forwardSpeed);
+ data.set("jumping", newPacket.jumping);
+ data.set("sneaking", newPacket.sneaking);
+ return;
+ } else if (packet instanceof C0DPacketCloseWindow) {
+ C0DPacketCloseWindow newPacket = (C0DPacketCloseWindow) packet;
+ data.set("windowId", newPacket.windowId);
+ return;
+ } else if (packet instanceof C0EPacketClickWindow) {
+ C0EPacketClickWindow newPacket = (C0EPacketClickWindow) packet;
+ data.set("windowId", newPacket.windowId);
+ data.set("slotId", newPacket.slotId);
+ data.set("usedButton", newPacket.usedButton);
+ data.set("actionNumber", newPacket.actionNumber);
+ if (newPacket.clickedItem != null) {
+ data.set("clickedItem", newPacket.clickedItem.makeModData());
+ }
+ data.set("mode", newPacket.mode);
+ return;
+ } else if (packet instanceof C0FPacketConfirmTransaction) {
+ C0FPacketConfirmTransaction newPacket = (C0FPacketConfirmTransaction) packet;
+ data.set("windowId", newPacket.windowId);
+ data.set("uid", newPacket.uid);
+ data.set("accepted", newPacket.accepted);
+ return;
+ } else if (packet instanceof C00PacketKeepAlive) {
+ C00PacketKeepAlive newPacket = (C00PacketKeepAlive) packet;
+ data.set("key", newPacket.key);
+ return;
+ } else if (packet instanceof C01PacketChatMessage) {
+ C01PacketChatMessage newPacket = (C01PacketChatMessage) packet;
+ data.set("message", newPacket.message);
+ return;
+ } else if (packet instanceof C02PacketUseEntity) {
+ C02PacketUseEntity newPacket = (C02PacketUseEntity) packet;
+ data.set("entityId", newPacket.entityId);
+ data.set("action", newPacket.action.name());
+ if (newPacket.hitVec != null) {
+ data.set("hitVec", newPacket.hitVec.makeModData());
+ }
+ return;
+ } else if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {
+ C03PacketPlayer.C04PacketPlayerPosition newPacket = (C03PacketPlayer.C04PacketPlayerPosition) packet;
+ data.set("x", newPacket.x);
+ data.set("y", newPacket.y);
+ data.set("z", newPacket.z);
+ data.set("yaw", newPacket.yaw);
+ data.set("pitch", newPacket.pitch);
+ data.set("onGround", newPacket.onGround);
+ data.set("moving", newPacket.moving);
+ data.set("rotating", newPacket.rotating);
+ return;
+ } else if (packet instanceof C03PacketPlayer.C05PacketPlayerLook) {
+ C03PacketPlayer.C05PacketPlayerLook newPacket = (C03PacketPlayer.C05PacketPlayerLook) packet;
+ data.set("x", newPacket.x);
+ data.set("y", newPacket.y);
+ data.set("z", newPacket.z);
+ data.set("yaw", newPacket.yaw);
+ data.set("pitch", newPacket.pitch);
+ data.set("onGround", newPacket.onGround);
+ data.set("moving", newPacket.moving);
+ data.set("rotating", newPacket.rotating);
+ return;
+ } else if (packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
+ C03PacketPlayer.C06PacketPlayerPosLook newPacket = (C03PacketPlayer.C06PacketPlayerPosLook) packet;
+ data.set("x", newPacket.x);
+ data.set("y", newPacket.y);
+ data.set("z", newPacket.z);
+ data.set("yaw", newPacket.yaw);
+ data.set("pitch", newPacket.pitch);
+ data.set("onGround", newPacket.onGround);
+ data.set("moving", newPacket.moving);
+ data.set("rotating", newPacket.rotating);
+ return;
+ } else if (packet instanceof C03PacketPlayer) {
+ C03PacketPlayer newPacket = (C03PacketPlayer) packet;
+ data.set("x", newPacket.x);
+ data.set("y", newPacket.y);
+ data.set("z", newPacket.z);
+ data.set("yaw", newPacket.yaw);
+ data.set("pitch", newPacket.pitch);
+ data.set("onGround", newPacket.onGround);
+ data.set("moving", newPacket.moving);
+ data.set("rotating", newPacket.rotating);
+ return;
+ } else if (packet instanceof C07PacketPlayerDigging) {
+ C07PacketPlayerDigging newPacket = (C07PacketPlayerDigging) packet;
+ data.set("position", newPacket.position.makeModData());
+ data.set("facing", newPacket.facing.name());
+ data.set("status", newPacket.status.name());
+ return;
+ } else if (packet instanceof C08PacketPlayerBlockPlacement) {
+ C08PacketPlayerBlockPlacement newPacket = (C08PacketPlayerBlockPlacement) packet;
+ data.set("placedBlockDirection", newPacket.placedBlockDirection);
+ data.set("facingX", newPacket.facingX);
+ data.set("facingY", newPacket.facingY);
+ data.set("facingZ", newPacket.facingZ);
+ data.set("position", newPacket.position.makeModData());
+ if (newPacket.stack != null) {
+ data.set("stack", newPacket.stack.makeModData());
+ }
+ return;
+ } else if (packet instanceof C09PacketHeldItemChange) {
+ C09PacketHeldItemChange newPacket = (C09PacketHeldItemChange) packet;
+ data.set("slotId", newPacket.slotId);
+ return;
+ } else if (packet instanceof C10PacketCreativeInventoryAction) {
+ C10PacketCreativeInventoryAction newPacket = (C10PacketCreativeInventoryAction) packet;
+ data.set("slotId", newPacket.slotId);
+ if (newPacket.stack != null) {
+ data.set("stack", newPacket.stack.makeModData());
+ }
+ return;
+ } else if (packet instanceof C11PacketEnchantItem) {
+ C11PacketEnchantItem newPacket = (C11PacketEnchantItem) packet;
+ data.set("windowId", newPacket.windowId);
+ data.set("button", newPacket.button);
+ return;
+ } else if (packet instanceof C12PacketUpdateSign) {
+ C12PacketUpdateSign newPacket = (C12PacketUpdateSign) packet;
+ if (newPacket.pos != null) {
+ data.set("pos", newPacket.pos.makeModData());
+ }
+ String[] stringArr = new String[newPacket.lines.length];
+ for (int i = 0; i < stringArr.length; i++) {
+ if (newPacket.lines[i] != null) {
+ stringArr[i] = newPacket.lines[i].getFormattedText();
+ }
+ }
+ data.set("lines", stringArr);
+ return;
+ } else if (packet instanceof C13PacketPlayerAbilities) {
+ C13PacketPlayerAbilities newPacket = (C13PacketPlayerAbilities) packet;
+ data.set("invulnerable", newPacket.invulnerable);
+ data.set("flying", newPacket.flying);
+ data.set("allowFlying", newPacket.allowFlying);
+ data.set("creativeMode", newPacket.creativeMode);
+ data.set("flySpeed", newPacket.flySpeed);
+ data.set("walkSpeed", newPacket.walkSpeed);
+ return;
+ } else if (packet instanceof C14PacketTabComplete) {
+ C14PacketTabComplete newPacket = (C14PacketTabComplete) packet;
+ data.set("message", newPacket.message);
+ if (newPacket.targetBlock != null) {
+ data.set("targetBlock", newPacket.targetBlock.makeModData());
+ }
+ return;
+ } else if (packet instanceof C15PacketClientSettings) {
+ C15PacketClientSettings newPacket = (C15PacketClientSettings) packet;
+ data.set("lang", newPacket.lang);
+ data.set("view", newPacket.view);
+ data.set("chatVisibility", newPacket.chatVisibility.name());
+ data.set("enableColors", newPacket.enableColors);
+ data.set("modelPartFlags", newPacket.modelPartFlags);
+ return;
+ } else if (packet instanceof C16PacketClientStatus) {
+ C16PacketClientStatus newPacket = (C16PacketClientStatus) packet;
+ data.set("status", newPacket.status.name());
+ return;
+ } else if (packet instanceof C17PacketCustomPayload) {
+ C17PacketCustomPayload newPacket = (C17PacketCustomPayload) packet;
+ data.set("channel", newPacket.channel);
+ return;
+ } else if (packet instanceof C18PacketSpectate) {
+ C18PacketSpectate newPacket = (C18PacketSpectate) packet;
+ data.set("id", newPacket.id.toString());
+ return;
+ } else if (packet instanceof C19PacketResourcePackStatus) {
+ C19PacketResourcePackStatus newPacket = (C19PacketResourcePackStatus) packet;
+ data.set("hash", newPacket.hash);
+ data.set("status", newPacket.status.name());
+ return;
+ }
+ }
+
+ public Packet setPropertiesToPacket(BaseData data, Packet packet) {
+ if (packet instanceof C0APacketAnimation) {
+ C0APacketAnimation newPacket = (C0APacketAnimation) packet;
+ // Nothing to do
+ return (Packet) newPacket;
+ } else if (packet instanceof C0BPacketEntityAction) {
+ C0BPacketEntityAction newPacket = (C0BPacketEntityAction) packet;
+ newPacket.entityID = data.getInt("entityID");
+ newPacket.auxData = data.getInt("auxData");
+ return (Packet) newPacket;
+ } else if (packet instanceof C0CPacketInput) {
+ C0CPacketInput newPacket = (C0CPacketInput) packet;
+ newPacket.strafeSpeed = data.getFloat("strafeSpeed");
+ newPacket.forwardSpeed = data.getFloat("forwardSpeed");
+ newPacket.jumping = data.getBoolean("jumping");
+ newPacket.sneaking = data.getBoolean("sneaking");
+ return (Packet) newPacket;
+ } else if (packet instanceof C0DPacketCloseWindow) {
+ C0DPacketCloseWindow newPacket = (C0DPacketCloseWindow) packet;
+ newPacket.windowId = data.getInt("windowId");
+ return (Packet) newPacket;
+ } else if (packet instanceof C0EPacketClickWindow) {
+ C0EPacketClickWindow newPacket = (C0EPacketClickWindow) packet;
+ newPacket.windowId = data.getInt("windowId");
+ newPacket.slotId = data.getInt("slotId");
+ newPacket.usedButton = data.getInt("usedButton");
+ newPacket.actionNumber = data.getShort("actionNumber");
+ newPacket.mode = data.getInt("mode");
+ if (data.has("clickedItem")) {
+ newPacket.clickedItem = (ItemStack) data.getRef("clickedItem");
+ }
+ return (Packet) newPacket;
+ } else if (packet instanceof C0FPacketConfirmTransaction) {
+ C0FPacketConfirmTransaction newPacket = (C0FPacketConfirmTransaction) packet;
+ newPacket.windowId = data.getInt("windowId");
+ newPacket.uid = data.getShort("uid");
+ newPacket.accepted = data.getBoolean("accepted");
+ return (Packet) newPacket;
+ } else if (packet instanceof C00PacketKeepAlive) {
+ C00PacketKeepAlive newPacket = (C00PacketKeepAlive) packet;
+ newPacket.key = data.getInt("key");
+ return (Packet) newPacket;
+ } else if (packet instanceof C01PacketChatMessage) {
+ C01PacketChatMessage newPacket = (C01PacketChatMessage) packet;
+ newPacket.message = data.getString("message");
+ return (Packet) newPacket;
+ } else if (packet instanceof C02PacketUseEntity) {
+ C02PacketUseEntity newPacket = (C02PacketUseEntity) packet;
+ newPacket.entityId = data.getInt("entityId");
+ newPacket.action = C02PacketUseEntity.Action.valueOf(data.getString("action"));
+ if (newPacket.hitVec != null) {
+ newPacket.hitVec.loadModData(data.getBaseData("hitVec"));
+ }
+ return (Packet) newPacket;
+ } else if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition) {
+ C03PacketPlayer.C04PacketPlayerPosition newPacket = (C03PacketPlayer.C04PacketPlayerPosition) packet;
+ newPacket.x = data.getDouble("x");
+ newPacket.y = data.getDouble("y");
+ newPacket.z = data.getDouble("z");
+ newPacket.yaw = data.getFloat("yaw");
+ newPacket.pitch = data.getFloat("pitch");
+ newPacket.onGround = data.getBoolean("onGround");
+ newPacket.moving = data.getBoolean("moving");
+ newPacket.rotating = data.getBoolean("rotating");
+ return (Packet) newPacket;
+ } else if (packet instanceof C03PacketPlayer.C05PacketPlayerLook) {
+ C03PacketPlayer.C05PacketPlayerLook newPacket = (C03PacketPlayer.C05PacketPlayerLook) packet;
+ newPacket.x = data.getDouble("x");
+ newPacket.y = data.getDouble("y");
+ newPacket.z = data.getDouble("z");
+ newPacket.yaw = data.getFloat("yaw");
+ newPacket.pitch = data.getFloat("pitch");
+ newPacket.onGround = data.getBoolean("onGround");
+ newPacket.moving = data.getBoolean("moving");
+ newPacket.rotating = data.getBoolean("rotating");
+ return (Packet) newPacket;
+ } else if (packet instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
+ C03PacketPlayer.C06PacketPlayerPosLook newPacket = (C03PacketPlayer.C06PacketPlayerPosLook) packet;
+ newPacket.x = data.getDouble("x");
+ newPacket.y = data.getDouble("y");
+ newPacket.z = data.getDouble("z");
+ newPacket.yaw = data.getFloat("yaw");
+ newPacket.pitch = data.getFloat("pitch");
+ newPacket.onGround = data.getBoolean("onGround");
+ newPacket.moving = data.getBoolean("moving");
+ newPacket.rotating = data.getBoolean("rotating");
+ return (Packet) newPacket;
+ } else if (packet instanceof C03PacketPlayer) {
+ C03PacketPlayer newPacket = (C03PacketPlayer) packet;
+ newPacket.x = data.getDouble("x");
+ newPacket.y = data.getDouble("y");
+ newPacket.z = data.getDouble("z");
+ newPacket.yaw = data.getFloat("yaw");
+ newPacket.pitch = data.getFloat("pitch");
+ newPacket.onGround = data.getBoolean("onGround");
+ newPacket.moving = data.getBoolean("moving");
+ newPacket.rotating = data.getBoolean("rotating");
+ return (Packet) newPacket;
+ } else if (packet instanceof C07PacketPlayerDigging) {
+ C07PacketPlayerDigging newPacket = (C07PacketPlayerDigging) packet;
+ newPacket.position = BlockPos.fromModData(data.getBaseData("position"));
+ newPacket.facing = EnumFacing.valueOf(data.getString("facing"));
+ newPacket.status = C07PacketPlayerDigging.Action.valueOf(data.getString("status"));
+ return (Packet) newPacket;
+ } else if (packet instanceof C08PacketPlayerBlockPlacement) {
+ C08PacketPlayerBlockPlacement newPacket = (C08PacketPlayerBlockPlacement) packet;
+ newPacket.placedBlockDirection = data.getInt("placedBlockDirection");
+ newPacket.facingX = data.getFloat("facingX");
+ newPacket.facingY = data.getFloat("facingY");
+ newPacket.facingZ = data.getFloat("facingZ");
+ newPacket.position = BlockPos.fromModData(data.getBaseData("position"));
+ if (data.has("stack")) {
+ newPacket.stack = (ItemStack) data.getRef("stack");
+ }
+ return (Packet) newPacket;
+ } else if (packet instanceof C09PacketHeldItemChange) {
+ C09PacketHeldItemChange newPacket = (C09PacketHeldItemChange) packet;
+ newPacket.slotId = data.getInt("slotId");
+ return (Packet) newPacket;
+ } else if (packet instanceof C10PacketCreativeInventoryAction) {
+ C10PacketCreativeInventoryAction newPacket = (C10PacketCreativeInventoryAction) packet;
+ if (data.has("stack")) {
+ newPacket.stack = (ItemStack) data.getRef("stack");
+ }
+ newPacket.slotId = data.getInt("slotId");
+ return (Packet) newPacket;
+ } else if (packet instanceof C11PacketEnchantItem) {
+ C11PacketEnchantItem newPacket = (C11PacketEnchantItem) packet;
+ newPacket.windowId = data.getInt("windowId");
+ newPacket.button = data.getInt("button");
+ return (Packet) newPacket;
+ } else if (packet instanceof C12PacketUpdateSign) {
+ C12PacketUpdateSign newPacket = (C12PacketUpdateSign) packet;
+ if (data.has("pos")) {
+ newPacket.pos = (BlockPos) data.getRef("pos");
+ }
+ String[] stringArr = data.getStringArr("lines");
+ for (int i = 0; i < stringArr.length; i++) {
+ if (stringArr[i] != null && (stringArr[i].length() != newPacket.lines[i].getFormattedText().length())) {
+ newPacket.lines[i] = new ChatComponentText(stringArr[i]);
+ }
+ }
+ return (Packet) newPacket;
+ } else if (packet instanceof C13PacketPlayerAbilities) {
+ C13PacketPlayerAbilities newPacket = (C13PacketPlayerAbilities) packet;
+ newPacket.invulnerable = data.getBoolean("invulnerable");
+ newPacket.flying = data.getBoolean("flying");
+ newPacket.allowFlying = data.getBoolean("allowFlying");
+ newPacket.creativeMode = data.getBoolean("creativeMode");
+ newPacket.flySpeed = data.getFloat("flySpeed");
+ newPacket.walkSpeed = data.getFloat("walkSpeed");
+ return (Packet) newPacket;
+ } else if (packet instanceof C14PacketTabComplete) {
+ C14PacketTabComplete newPacket = (C14PacketTabComplete) packet;
+ if (data.has("targetBlock")) {
+ newPacket.targetBlock = (BlockPos) data.getRef("targetBlock");
+ }
+ newPacket.message = data.getString("message");
+ return (Packet) newPacket;
+ } else if (packet instanceof C15PacketClientSettings) {
+ C15PacketClientSettings newPacket = (C15PacketClientSettings) packet;
+ newPacket.lang = data.getString("lang");
+ newPacket.view = data.getInt("view");
+ newPacket.chatVisibility = EntityPlayer.EnumChatVisibility.valueOf(data.getString("chatVisibility"));
+ newPacket.enableColors = data.getBoolean("enableColors");
+ newPacket.modelPartFlags = data.getInt("modelPartFlags");
+ return (Packet) newPacket;
+ } else if (packet instanceof C16PacketClientStatus) {
+ C16PacketClientStatus newPacket = (C16PacketClientStatus) packet;
+ newPacket.status = C16PacketClientStatus.EnumState.valueOf(data.getString("status"));
+ return (Packet) newPacket;
+ } else if (packet instanceof C17PacketCustomPayload) {
+ C17PacketCustomPayload newPacket = (C17PacketCustomPayload) packet;
+ newPacket.channel = data.getString("channel");
+ return (Packet) newPacket;
+ } else if (packet instanceof C18PacketSpectate) {
+ C18PacketSpectate newPacket = (C18PacketSpectate) packet;
+ newPacket.id = new EaglercraftUUID(data.getString("id"));
+ return (Packet) newPacket;
+ } else if (packet instanceof C19PacketResourcePackStatus) {
+ C19PacketResourcePackStatus newPacket = (C19PacketResourcePackStatus) packet;
+ newPacket.hash = data.getString("hash");
+ newPacket.status = C19PacketResourcePackStatus.Action.valueOf(data.getString("status"));
+ return (Packet) newPacket;
+ }
+ return packet;
+ }
+
> DELETE 1 @ 1 : 2
> CHANGE 23 : 37 @ 23 : 24
~ ModData eventData = new ModData();
~ eventData.set("preventDefault", false);
~ eventData.set("type", packetIn.type);
~ eventData.set("chat", packetIn.chatComponent.getFormattedText());
~ BaseData newEvent = ModAPI.callEvent("packetchat", eventData);
~ if (newEvent.has("preventDefault") && newEvent.getBoolean("preventDefault") == true) {
~ return;
~ }
~ packetIn.type = newEvent.has("type") ? newEvent.getByte("type") : packetIn.type;
~ if (newEvent.has("chat")
~ && (newEvent.getString("chat").length() != packetIn.chatComponent.getFormattedText().length())) {
~ packetIn.chatComponent = new ChatComponentText(newEvent.getString("chat"));
~ }
~
> DELETE 9 @ 9 : 10
@ -251,7 +888,27 @@
> DELETE 10 @ 10 : 11
> DELETE 9 @ 9 : 10
> CHANGE 9 : 28 @ 9 : 10
~ ModData eventData = new ModData();
~ eventData.set("preventDefault", false);
~ eventData.set("soundName", packetIn.soundName);
~ eventData.set("posX", packetIn.posX);
~ eventData.set("posY", packetIn.posY);
~ eventData.set("posZ", packetIn.posZ);
~ eventData.set("soundVolume", packetIn.soundVolume);
~ eventData.set("soundPitch", packetIn.soundPitch);
~ BaseData newEvent = ModAPI.callEvent("packetsoundeffect", eventData);
~ if (newEvent.has("preventDefault") && newEvent.getBoolean("preventDefault") == true) {
~ return;
~ }
~ packetIn.soundName = newEvent.has("soundName") ? newEvent.getString("soundName") : packetIn.soundName;
~ packetIn.posX = newEvent.has("posX") ? newEvent.getInt("posX") : packetIn.posX;
~ packetIn.posY = newEvent.has("posY") ? newEvent.getInt("posY") : packetIn.posY;
~ packetIn.posZ = newEvent.has("posZ") ? newEvent.getInt("posZ") : packetIn.posZ;
~ packetIn.soundVolume = newEvent.has("soundVolume") ? newEvent.getFloat("soundVolume") : packetIn.soundVolume;
~ packetIn.soundPitch = newEvent.has("soundPitch") ? newEvent.getInt("soundPitch") : packetIn.soundPitch;
~
> CHANGE 7 : 30 @ 7 : 31

View File

@ -5,8 +5,10 @@
# Version: 1.0
# Author: lax1dude
> CHANGE 4 : 6 @ 4 : 5
> CHANGE 4 : 8 @ 4 : 5
~ import net.eaglerforge.api.BaseData;
~ import net.eaglerforge.api.ModData;
~ import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
~
@ -24,7 +26,426 @@
~ public abstract class EntityPlayer extends EntityLivingBase implements ICommandSender {
> CHANGE 458 : 459 @ 458 : 459
> INSERT 65 : 481 @ 65
+ @Override
+ public void loadModData(BaseData data) {
+ super.loadModData(data);
+ cameraYaw = data.getFloat("cameraYaw");
+ chasingPosX = data.getDouble("chasingPosX");
+ chasingPosY = data.getDouble("chasingPosY");
+ chasingPosZ = data.getDouble("chasingPosZ");
+ experience = data.getFloat("experience");
+ experienceLevel = data.getInt("experienceLevel");
+ experienceTotal = data.getInt("experienceTotal");
+ if (fishEntity != null) {
+ fishEntity.loadModData(data.getBaseData("fishEntity"));
+ }
+ if (foodStats != null) {
+ foodStats.loadModData(data.getBaseData("foodStats"));
+ }
+ if (inventory != null) {
+ inventory.loadModData(data.getBaseData("inventory"));
+ }
+ flyToggleTimer = data.getInt("flyToggleTimer");
+ hasReducedDebug = data.getBoolean("hasReducedDebug");
+ lastXPSound = data.getInt("lastXPSound");
+ sleepTimer = data.getInt("sleepTimer");
+ sleeping = data.getBoolean("sleeping");
+ spawnForced = data.getBoolean("spawnForced");
+ speedInAir = data.getFloat("speedInAir");
+ speedOnGround = data.getFloat("speedOnGround");
+ xpCooldown = data.getInt("xpCooldown");
+ xpSeed = data.getInt("xpSeed");
+ if (itemInUse != null) {
+ itemInUse.loadModData(data.getBaseData("itemInUse"));
+ }
+
+ if (inventoryContainer != null) {
+ inventoryContainer.loadModData(data.getBaseData("inventoryContainer"));
+ }
+
+ if (openContainer != null) {
+ openContainer.loadModData(data.getBaseData("openContainer"));
+ }
+ if (capabilities != null) {
+ capabilities.loadModData(data.getBaseData("capabilities"));
+ }
+ }
+
+ @Override
+ public ModData makeModData() {
+ ModData data = super.makeModData();
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ data.set("cameraYaw", cameraYaw);
+ data.set("chasingPosX", chasingPosX);
+ data.set("chasingPosY", chasingPosY);
+ data.set("chasingPosZ", chasingPosZ);
+ data.set("experience", experience);
+ data.set("experienceLevel", experienceLevel);
+ data.set("experienceTotal", experienceTotal);
+ if (fishEntity != null) {
+ data.set("fishEntity", fishEntity.makeModData());
+ }
+ if (itemInUse != null) {
+ data.set("itemInUse", itemInUse.makeModData());
+ }
+ if (foodStats != null) {
+ data.set("foodStats", foodStats.makeModData());
+ }
+ data.set("flyToggleTimer", flyToggleTimer);
+ data.set("hasReducedDebug", hasReducedDebug);
+ data.set("itemInUseCount", itemInUseCount);
+ data.set("lastXPSound", lastXPSound);
+ data.set("sleepTimer", sleepTimer);
+ data.set("sleeping", sleeping);
+ data.set("spawnForced", spawnForced);
+ data.set("speedInAir", speedInAir);
+ data.set("speedOnGround", speedOnGround);
+ data.set("xpCooldown", xpCooldown);
+ data.set("xpSeed", xpSeed);
+
+ if (inventoryContainer != null) {
+ data.set("inventoryContainer", inventoryContainer.makeModData());
+ }
+
+ if (openContainer != null) {
+ data.set("openContainer", openContainer.makeModData());
+ }
+ if (inventory != null) {
+ data.set("inventory", inventory.makeModData());
+ }
+ if (capabilities != null) {
+ data.set("capabilities", capabilities.makeModData());
+ }
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+
+ // Todone: adding functions
+
+ data.setCallbackObject("getItemInUse", () -> {
+ if (getItemInUse() != null) {
+ return getItemInUse().makeModData();
+ } else {
+ return new ModData();
+ }
+ });
+ data.setCallbackInt("getItemInUseCount", () -> {
+ return getItemInUseCount();
+ });
+ data.setCallbackBoolean("isUsingItem", () -> {
+ return isUsingItem();
+ });
+ data.setCallbackInt("getItemInUseDuration", () -> {
+ return getItemInUseDuration();
+ });
+ data.setCallbackVoid("stopUsingItem", () -> {
+ stopUsingItem();
+ });
+ data.setCallbackVoid("clearItemInUse", () -> {
+ clearItemInUse();
+ });
+ data.setCallbackBoolean("isBlocking", () -> {
+ return isBlocking();
+ });
+ data.setCallbackInt("getMaxInPortalTime", () -> {
+ return getMaxInPortalTime();
+ });
+ data.setCallbackString("getSwimSound", () -> {
+ return getSwimSound();
+ });
+ data.setCallbackString("getSplashSound", () -> {
+ return getSplashSound();
+ });
+ data.setCallbackInt("getPortalCooldown", () -> {
+ return getPortalCooldown();
+ });
+ data.setCallbackVoidWithDataArg("playSound", (BaseData params) -> {
+ playSound(params.getString("s"), params.getFloat("f"), params.getFloat("f1"));
+ });
+ data.setCallbackVoidWithDataArg("updateItemUse", (BaseData params) -> {
+ updateItemUse((ItemStack) params.getRef("itemStackIn"), params.getInt("parInt1"));
+ });
+ data.setCallbackVoid("onItemUseFinish", () -> {
+ onItemUseFinish();
+ });
+ data.setCallbackVoidWithDataArg("handleStatusUpdate", (BaseData params) -> {
+ handleStatusUpdate(params.getByte("b0"));
+ });
+ data.setCallbackBoolean("isMovementBlocked", () -> {
+ return isMovementBlocked();
+ });
+ data.setCallbackVoid("closeScreen", () -> {
+ closeScreen();
+ });
+ data.setCallbackVoid("updateRidden", () -> {
+ updateRidden();
+ });
+ data.setCallbackVoid("preparePlayerToSpawn", () -> {
+ preparePlayerToSpawn();
+ });
+ data.setCallbackVoid("updateEntityActionState", () -> {
+ updateEntityActionState();
+ });
+ data.setCallbackVoid("onLivingUpdate", () -> {
+ onLivingUpdate();
+ });
+ data.setCallbackVoidWithDataArg("collideWithPlayer", (BaseData params) -> {
+ collideWithPlayer((Entity) params.getRef("parEntity"));
+ });
+ data.setCallbackInt("getScore", () -> {
+ return getScore();
+ });
+ data.setCallbackVoidWithDataArg("addScore", (BaseData params) -> {
+ addScore(params.getInt("parInt1"));
+ });
+ data.setCallbackString("getHurtSound", () -> {
+ return getHurtSound();
+ });
+ data.setCallbackString("getDeathSound", () -> {
+ return getDeathSound();
+ });
+ data.setCallbackVoidWithDataArg("addToPlayerScore", (BaseData params) -> {
+ addToPlayerScore((Entity) params.getRef("entity"), params.getInt("i"));
+ });
+ data.setCallbackObjectWithDataArg("dropOneItem", (BaseData params) -> {
+ return dropOneItem(params.getBoolean("flag")).makeModData();
+ });
+ data.setCallbackObjectWithDataArg("dropPlayerItemWithRandomChoice", (BaseData params) -> {
+ // The second argument (boolean) is not used.
+ return dropPlayerItemWithRandomChoice((ItemStack) params.getRef("itemStackIn"), false).makeModData();
+ });
+ data.setCallbackObjectWithDataArg("dropItem", (BaseData params) -> {
+ return dropItem((ItemStack) params.getRef("droppedItem"), params.getBoolean("dropAround"),
+ params.getBoolean("traceItem")).makeModData();
+ });
+ data.setCallbackVoidWithDataArg("joinEntityItemWithWorld", (BaseData params) -> {
+ joinEntityItemWithWorld((EntityItem) params.getRef("entityitem"));
+ });
+ data.setCallbackFloatWithDataArg("getToolDigEfficiency", (BaseData params) -> {
+ return getToolDigEfficiency((Block) params.getRef("parBlock"));
+ });
+ data.setCallbackBooleanWithDataArg("canHarvestBlock", (BaseData params) -> {
+ return canHarvestBlock((Block) params.getRef("blockToHarvest"));
+ });
+ data.setCallbackBooleanWithDataArg("canAttackPlayer", (BaseData params) -> {
+ return canAttackPlayer((EntityPlayer) params.getRef("entityplayer"));
+ });
+ data.setCallbackVoidWithDataArg("damageArmor", (BaseData params) -> {
+ damageArmor(params.getFloat("f"));
+ });
+ data.setCallbackInt("getTotalArmorValue", () -> {
+ return getTotalArmorValue();
+ });
+ data.setCallbackFloat("getArmorVisibility", () -> {
+ return getArmorVisibility();
+ });
+ data.setCallbackBooleanWithDataArg("interactWith", (BaseData params) -> {
+ return interactWith((Entity) params.getRef("parEntity"));
+ });
+ data.setCallbackObject("getCurrentEquippedItem", () -> {
+ if (getCurrentEquippedItem() != null) {
+ return getCurrentEquippedItem().makeModData();
+ } else {
+ return new ModData();
+ }
+ });
+ data.setCallbackVoid("destroyCurrentEquippedItem", () -> {
+ destroyCurrentEquippedItem();
+ });
+ data.setCallbackDouble("getYOffset", () -> {
+ return getYOffset();
+ });
+ data.setCallbackVoidWithDataArg("attackTargetEntityWithCurrentItem", (BaseData params) -> {
+ attackTargetEntityWithCurrentItem((Entity) params.getRef("entity"));
+ });
+ data.setCallbackVoid("respawnPlayer", () -> {
+ respawnPlayer();
+ });
+ data.setCallbackBoolean("isEntityInsideOpaqueBlock", () -> {
+ return isEntityInsideOpaqueBlock();
+ });
+ data.setCallbackBoolean("isUser", () -> {
+ return isUser();
+ });
+ data.setCallbackStringWithDataArg("trySleep", (BaseData params) -> {
+ return trySleep((BlockPos) params.getRef("blockpos")).name();
+ });
+ data.setCallbackVoidWithDataArg("wakeUpPlayer", (BaseData params) -> {
+ wakeUpPlayer(params.getBoolean("flag"), params.getBoolean("flag1"), params.getBoolean("flag2"));
+ });
+ data.setCallbackBoolean("isInBed", () -> {
+ return isInBed();
+ });
+ data.setCallbackFloat("getBedOrientationInDegrees", () -> {
+ return getBedOrientationInDegrees();
+ });
+ data.setCallbackBoolean("isPlayerSleeping", () -> {
+ return isPlayerSleeping();
+ });
+ data.setCallbackBoolean("isPlayerFullyAsleep", () -> {
+ return isPlayerFullyAsleep();
+ });
+ data.setCallbackInt("getSleepTimer", () -> {
+ return getSleepTimer();
+ });
+ data.setCallbackObject("getBedLocation", () -> {
+ if (getBedLocation() != null) {
+ return getBedLocation().makeModData();
+ } else {
+ return new ModData();
+ }
+ });
+ data.setCallbackBoolean("isSpawnForced", () -> {
+ return isSpawnForced();
+ });
+ data.setCallbackVoidWithDataArg("setSpawnPoint", (BaseData params) -> {
+ setSpawnPoint((BlockPos) params.getRef("pos"), params.getBoolean("forced"));
+ });
+ data.setCallbackVoidWithDataArg("moveEntityWithHeading", (BaseData params) -> {
+ moveEntityWithHeading(params.getFloat("f"), params.getFloat("f1"));
+ });
+ data.setCallbackFloat("getAIMoveSpeed", () -> {
+ return getAIMoveSpeed();
+ });
+ data.setCallbackVoidWithDataArg("addMovementStat", (BaseData params) -> {
+ addMovementStat(params.getDouble("parDouble1"), params.getDouble("parDouble2"),
+ params.getDouble("parDouble3"));
+ });
+ data.setCallbackVoidWithDataArg("addMountedMovementStat", (BaseData params) -> {
+ addMountedMovementStat(params.getDouble("parDouble1"), params.getDouble("parDouble2"),
+ params.getDouble("parDouble3"));
+ });
+ data.setCallbackVoidWithDataArg("fall", (BaseData params) -> {
+ fall(params.getFloat("f"), params.getFloat("f1"));
+ });
+ data.setCallbackVoid("resetHeight", () -> {
+ resetHeight();
+ });
+ data.setCallbackStringWithDataArg("getFallSoundString", (BaseData params) -> {
+ return getFallSoundString(params.getInt("i"));
+ });
+ data.setCallbackVoid("setInWeb", () -> {
+ setInWeb();
+ });
+ data.setCallbackObjectWithDataArg("getCurrentArmor", (BaseData params) -> {
+ if (getCurrentArmor(params.getInt("i")) != null) {
+ return getCurrentArmor(params.getInt("i")).makeModData();
+ } else {
+ return new ModData();
+ }
+ });
+ data.setCallbackVoidWithDataArg("addExperience", (BaseData params) -> {
+ addExperience(params.getInt("amount"));
+ });
+ data.setCallbackInt("getXPSeed", () -> {
+ return getXPSeed();
+ });
+ data.setCallbackVoidWithDataArg("removeExperienceLevel", (BaseData params) -> {
+ removeExperienceLevel(params.getInt("i"));
+ });
+ data.setCallbackVoidWithDataArg("addExperienceLevel", (BaseData params) -> {
+ addExperienceLevel(params.getInt("i"));
+ });
+ data.setCallbackInt("xpBarCap", () -> {
+ return xpBarCap();
+ });
+ data.setCallbackVoidWithDataArg("addExhaustion", (BaseData params) -> {
+ addExhaustion(params.getFloat("parFloat1"));
+ });
+ data.setCallbackObject("getFoodStats", () -> {
+ return getFoodStats().makeModData();
+ });
+ data.setCallbackBooleanWithDataArg("canEat", (BaseData params) -> {
+ return canEat(params.getBoolean("ignoreHunger"));
+ });
+ data.setCallbackBoolean("shouldHeal", () -> {
+ return shouldHeal();
+ });
+ data.setCallbackVoidWithDataArg("setItemInUse", (BaseData params) -> {
+ setItemInUse((ItemStack) params.getRef("itemstack"), params.getInt("i"));
+ });
+ data.setCallbackBoolean("isAllowEdit", () -> {
+ return isAllowEdit();
+ });
+ data.setCallbackBooleanWithDataArg("canPlayerEdit", (BaseData params) -> {
+ return canPlayerEdit((BlockPos) params.getRef("parBlockPos"),
+ EnumFacing.valueOf(params.getString("parEnumFacing")), (ItemStack) params.getRef("parItemStack"));
+ });
+ data.setCallbackBoolean("isPlayer", () -> {
+ return isPlayer();
+ });
+ data.setCallbackBoolean("getAlwaysRenderNameTagForRender", () -> {
+ return getAlwaysRenderNameTagForRender();
+ });
+ data.setCallbackVoidWithDataArg("clonePlayer", (BaseData params) -> {
+ clonePlayer((EntityPlayer) params.getRef("entityplayer"), params.getBoolean("flag"));
+ });
+ data.setCallbackBoolean("canTriggerWalking", () -> {
+ return canTriggerWalking();
+ });
+ data.setCallbackVoid("sendPlayerAbilities", () -> {
+ sendPlayerAbilities();
+ });
+ data.setCallbackString("getName", () -> {
+ return getName();
+ });
+ data.setCallbackObjectWithDataArg("getEquipmentInSlot", (BaseData params) -> {
+ if (getEquipmentInSlot(params.getInt("i")) != null) {
+ return getEquipmentInSlot(params.getInt("i")).makeModData();
+ } else {
+ return new ModData();
+ }
+ });
+ data.setCallbackObject("getHeldItem", () -> {
+ if (getHeldItem() != null) {
+ return getHeldItem();
+ } else {
+ return new ModData();
+ }
+ });
+ data.setCallbackVoidWithDataArg("setCurrentItemOrArmor", (BaseData params) -> {
+ setCurrentItemOrArmor(params.getInt("i"), (ItemStack) params.getRef("itemstack"));
+ });
+ data.setCallbackBooleanWithDataArg("isInvisibleToPlayer", (BaseData params) -> {
+ return isInvisibleToPlayer((EntityPlayer) params.getRef("entityplayer"));
+ });
+ data.setCallbackObjectArr("getInventory", () -> {
+ ItemStack[] inventory = getInventory();
+ ModData[] parDatas = new ModData[inventory.length];
+ for (int i = 0; i < inventory.length; i++) {
+ if (inventory[i] != null) {
+ parDatas[i] = inventory[i].makeModData();
+ }
+ }
+ return parDatas;
+ });
+ data.setCallbackBoolean("isPushedByWater", () -> {
+ return isPushedByWater();
+ });
+ data.setCallbackFloat("getEyeHeight", () -> {
+ return getEyeHeight();
+ });
+ data.setCallbackStringWithDataArg("getOfflineUUID", (BaseData params) -> {
+ return getOfflineUUID(params.getString("username")).toString();
+ });
+ data.setCallbackBooleanWithDataArg("replaceItemInInventory", (BaseData params) -> {
+ return replaceItemInInventory(params.getInt("i"), (ItemStack) params.getRef("itemstack"));
+ });
+ data.setCallbackBoolean("hasReducedDebug", () -> {
+ return hasReducedDebug();
+ });
+ data.setCallbackVoidWithDataArg("setReducedDebug", (BaseData params) -> {
+ setReducedDebug(params.getBoolean("reducedDebug"));
+ });
+ return data;
+ }
+
> CHANGE 393 : 394 @ 393 : 394
~ Collection<ScoreObjective> collection = this.getWorldScoreboard()

View File

@ -5,10 +5,70 @@
# Version: 1.0
# Author: lax1dude
> INSERT 3 : 4 @ 3
> INSERT 3 : 6 @ 3
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModData;
> DELETE 3 @ 3 : 4
> CHANGE 12 : 13 @ 12 : 13
~ public class InventoryPlayer extends ModData implements IInventory {
> INSERT 11 : 62 @ 11
+ public void loadModData(BaseData data) {
+ BaseData[] parItemStacks = data.getBaseDataArr("mainInventory");
+ for (int i = 0; i < parItemStacks.length && i < mainInventory.length; i++) {
+ if (mainInventory[i] != null) {
+ mainInventory[i].loadModData(parItemStacks[i]);
+ } else if (parItemStacks[i] != null && parItemStacks[i].getRef() instanceof ItemStack) {
+ mainInventory[i] = (ItemStack) parItemStacks[i].getRef();
+ }
+ }
+
+ BaseData[] parArmorStacks = data.getBaseDataArr("armorInventory");
+ for (int i = 0; i < parArmorStacks.length && i < armorInventory.length; i++) {
+ if (armorInventory[i] != null) {
+ armorInventory[i].loadModData(parArmorStacks[i]);
+ } else if (parItemStacks[i] != null && parItemStacks[i].getRef() instanceof ItemStack) {
+ armorInventory[i] = (ItemStack) parItemStacks[i].getRef();
+ }
+ }
+ currentItem = data.getInt("currentItem");
+ inventoryChanged = data.getBoolean("inventoryChanged");
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ ModData[] parBaseDatas = new ModData[mainInventory.length];
+ for (int i = 0; i < mainInventory.length; i++) {
+ if (mainInventory[i] != null) {
+ parBaseDatas[i] = mainInventory[i].makeModData();
+ }
+ }
+ data.set("mainInventory", parBaseDatas);
+
+ ModData[] parBaseDatasArmor = new ModData[armorInventory.length];
+ for (int i = 0; i < armorInventory.length; i++) {
+ if (armorInventory[i] != null) {
+ parBaseDatasArmor[i] = armorInventory[i].makeModData();
+ }
+ }
+ data.set("armorInventory", parBaseDatasArmor);
+
+ data.set("currentItem", currentItem);
+ data.set("inventoryChanged", inventoryChanged);
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ return data;
+ }
+
> EOF

View File

@ -0,0 +1,62 @@
# Eagler Context Redacted Diff
# Copyright (c) 2024 lax1dude. All rights reserved.
# Version: 1.0
# Author: lax1dude
> INSERT 2 : 5 @ 2
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModAPI;
+ import net.eaglerforge.api.ModData;
> CHANGE 2 : 3 @ 2 : 3
~ public class PlayerCapabilities extends ModData {
> INSERT 8 : 49 @ 8
+ public void loadModData(BaseData data) {
+ disableDamage = data.getBoolean("disableDamage");
+ isFlying = data.getBoolean("isFlying");
+ allowFlying = data.getBoolean("allowFlying");
+ isCreativeMode = data.getBoolean("isCreativeMode");
+ allowEdit = data.getBoolean("allowEdit");
+
+ flySpeed = data.getFloat("flySpeed");
+ walkSpeed = data.getFloat("walkSpeed");
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ data.set("disableDamage", disableDamage);
+ data.set("isFlying", isFlying);
+ data.set("allowFlying", allowFlying);
+ data.set("isCreativeMode", isCreativeMode);
+ data.set("allowEdit", allowEdit);
+ data.set("flySpeed", flySpeed);
+ data.set("walkSpeed", walkSpeed);
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ data.setCallbackFloat("getFlySpeed", () -> {
+ return getFlySpeed();
+ });
+ data.setCallbackFloat("getWalkSpeed", () -> {
+ return getWalkSpeed();
+ });
+ data.setCallbackVoidWithDataArg("setFlySpeed", (BaseData params) -> {
+ setFlySpeed(params.getFloat("speed"));
+ });
+ data.setCallbackVoidWithDataArg("setPlayerWalkSpeed", (BaseData params) -> {
+ setPlayerWalkSpeed(params.getFloat("speed"));
+ });
+ return data;
+ }
+
> EOF

View File

@ -5,4 +5,68 @@
# Version: 1.0
# Author: lax1dude
> INSERT 4 : 7 @ 4
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModData;
> INSERT 126 : 181 @ 126
+ @Override
+ public void loadModData(BaseData data) {
+ super.loadModData(data);
+ inGround = data.getBoolean("inGround");
+ xTile = data.getInt("xTile");
+ yTile = data.getInt("yTile");
+ zTile = data.getInt("zTile");
+ shake = data.getInt("shake");
+ ticksCatchable = data.getInt("ticksCatchable");
+ ticksCatchableDelay = data.getInt("ticksCatchableDelay");
+ ticksCaughtDelay = data.getInt("ticksCaughtDelay");
+ ticksInAir = data.getInt("ticksInAir");
+ ticksInGround = data.getInt("ticksInGround");
+ if (caughtEntity != null) {
+ caughtEntity.loadModData(data.getBaseData("caughtEntity"));
+ }
+ fishApproachAngle = data.getFloat("fishApproachAngle");
+ fishPitch = data.getDouble("fishPitch");
+ fishYaw = data.getDouble("fishYaw");
+ fishPosRotationIncrements = data.getInt("fishPosRotationIncrements");
+ fishX = data.getDouble("fishX");
+ fishY = data.getDouble("fishY");
+ fishZ = data.getDouble("fishZ");
+ }
+
+ @Override
+ public ModData makeModData() {
+ ModData data = super.makeModData();
+ data.set("inGround", inGround);
+ data.set("xTile", xTile);
+ data.set("yTile", yTile);
+ data.set("zTile", zTile);
+ data.set("shake", shake);
+ data.set("ticksCatchable", ticksCatchable);
+ data.set("ticksCatchableDelay", ticksCatchableDelay);
+ data.set("ticksCaughtDelay", ticksCaughtDelay);
+ data.set("ticksInAir", ticksInAir);
+ data.set("ticksInGround", ticksInGround);
+ if (caughtEntity != null) {
+ data.set("caughtEntity", caughtEntity.makeModData());
+ }
+ data.set("fishApproachAngle", fishApproachAngle);
+ data.set("fishPitch", fishPitch);
+ data.set("fishYaw", fishYaw);
+ data.set("fishPosRotationIncrements", fishPosRotationIncrements);
+ data.set("fishX", fishX);
+ data.set("fishY", fishY);
+ data.set("fishZ", fishZ);
+
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ return data;
+ }
+
> EOF

View File

@ -7,17 +7,66 @@
> DELETE 2 @ 2 : 4
> INSERT 3 : 7 @ 3
> INSERT 3 : 9 @ 3
+
+ import com.google.common.collect.Lists;
+ import com.google.common.collect.Sets;
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModData;
> DELETE 2 @ 2 : 5
> CHANGE 19 : 20 @ 19 : 20
> CHANGE 5 : 6 @ 5 : 6
~ public abstract class Container extends ModData {
> CHANGE 13 : 14 @ 13 : 14
~ this.inventoryItemStacks.add((ItemStack) null);
> INSERT 27 : 67 @ 27
+ public void loadModData(BaseData data) {
+ BaseData[] parItemStacks = data.getBaseDataArr("inventoryItemStacks");
+ for (int i = 0; i < parItemStacks.length && i < inventoryItemStacks.size(); i++) {
+ if (inventoryItemStacks.get(i) != null) {
+ inventoryItemStacks.get(i).loadModData(parItemStacks[i]);
+ } else if (parItemStacks[i] != null && parItemStacks[i].getRef() instanceof ItemStack) {
+ inventoryItemStacks.set(i, (ItemStack) parItemStacks[i].getRef());
+ }
+ }
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ ModData[] parBaseDatas = new ModData[inventoryItemStacks.size()];
+ for (int i = 0; i < inventoryItemStacks.size(); i++) {
+ if (inventoryItemStacks.get(i) != null) {
+ parBaseDatas[i] = inventoryItemStacks.get(i).makeModData();
+ }
+ }
+ data.set("inventoryItemStacks", parBaseDatas);
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ data.setCallbackObjectArr("getPlayerList", () -> {
+ ModData[] parPlayerList = new ModData[playerList.size()];
+ int i = 0;
+ for (EntityPlayer player : playerList) {
+ if (player != null) {
+ parPlayerList[i] = player.makeModData();
+ }
+ i++;
+ }
+ return parPlayerList;
+ });
+ return data;
+ }
+
> EOF

View File

@ -7,12 +7,57 @@
> DELETE 2 @ 2 : 3
> INSERT 1 : 4 @ 1
> INSERT 1 : 6 @ 1
+
+ import com.google.common.collect.Lists;
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModData;
> DELETE 1 @ 1 : 3
> CHANGE 5 : 6 @ 5 : 6
~ public class InventoryBasic extends ModData implements IInventory {
> INSERT 6 : 42 @ 6
+ public void loadModData(BaseData data) {
+ BaseData[] parItemStacks = data.getBaseDataArr("inventoryContents");
+ for (int i = 0; i < parItemStacks.length && i < inventoryContents.length; i++) {
+ if (inventoryContents[i] != null) {
+ inventoryContents[i].loadModData(parItemStacks[i]);
+ } else if (parItemStacks[i] != null && parItemStacks[i].getRef() instanceof ItemStack) {
+ inventoryContents[i] = (ItemStack) parItemStacks[i].getRef();
+ }
+ }
+
+ inventoryTitle = data.getString("inventoryTitle");
+ slotsCount = data.getInt("slotsCount");
+ hasCustomName = data.getBoolean("hasCustomName");
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ ModData[] parBaseDatas = new ModData[inventoryContents.length];
+ for (int i = 0; i < inventoryContents.length; i++) {
+ if (inventoryContents[i] != null) {
+ parBaseDatas[i] = inventoryContents[i].makeModData();
+ }
+ }
+ data.set("inventoryContents", parBaseDatas);
+ data.set("inventoryTitle", inventoryTitle);
+ data.set("slotsCount", slotsCount);
+ data.set("hasCustomName", hasCustomName);
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ return data;
+ }
+
> EOF

View File

@ -9,8 +9,11 @@
> DELETE 3 @ 3 : 4
> INSERT 1 : 9 @ 1
> INSERT 1 : 12 @ 1
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModData;
+ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
+ import net.lax1dude.eaglercraft.v1_8.HString;
+ import java.util.Set;
@ -20,13 +23,233 @@
+ import com.google.common.collect.Multimap;
+
> DELETE 13 @ 13 : 17
> CHANGE 13 : 14 @ 13 : 17
> CHANGE 185 : 186 @ 185 : 186
~ import net.minecraft.nbt.JsonToNBT;
> INSERT 12 : 13 @ 12
+ import net.minecraft.nbt.*;
> CHANGE 1 : 2 @ 1 : 2
~ public final class ItemStack extends ModData {
> INSERT 16 : 168 @ 16
+ public void loadModData(BaseData data) {
+ stackSize = data.getInt("amount");
+ animationsToGo = data.getInt("animationsToGo");
+ itemDamage = data.getInt("itemDamage");
+ if (itemFrame != null) {
+ itemFrame.loadModData(data.getBaseData("itemFrame"));
+ }
+ if (canDestroyCacheBlock != null) {
+ canDestroyCacheBlock.loadModData(data.getBaseData("canDestroyCacheBlock"));
+ }
+ if (canPlaceOnCacheBlock != null) {
+ canPlaceOnCacheBlock.loadModData(data.getBaseData("canPlaceOnCacheBlock"));
+ }
+ canDestroyCacheResult = data.getBoolean("canDestroyCacheResult");
+ canPlaceOnCacheResult = data.getBoolean("canPlaceOnCacheResult");
+ }
+
+ public static ItemStack fromModData(BaseData data) {
+ return new ItemStack(Item.getItemById(data.getInt("itemId")), data.getInt("amount"), data.getInt("itemDamage"));
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ data.set("amount", stackSize);
+ data.set("animationsToGo", animationsToGo);
+ data.set("itemId", item.getIdFromItem(item));
+ data.set("itemDamage", itemDamage);
+ if (itemFrame != null) {
+ data.set("itemFrame", itemFrame.makeModData());
+ }
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ if (canDestroyCacheBlock != null) {
+ data.set("canDestroyCacheBlock", canDestroyCacheBlock.makeModData());
+ }
+ data.set("canDestroyCacheResult", canDestroyCacheResult);
+ if (canPlaceOnCacheBlock != null) {
+ data.set("canPlaceOnCacheBlock", canPlaceOnCacheBlock.makeModData());
+ }
+ data.set("canPlaceOnCacheResult", canPlaceOnCacheResult);
+
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ data.setCallbackObject("getItem", () -> {
+ return getItem().makeModData();
+ });
+ data.setCallbackInt("getMaxStackSize", () -> {
+ return getMaxStackSize();
+ });
+ data.setCallbackBoolean("isStackable", () -> {
+ return isStackable();
+ });
+ data.setCallbackBoolean("isItemStackDamageable", () -> {
+ return isItemStackDamageable();
+ });
+ data.setCallbackBoolean("getHasSubtypes", () -> {
+ return getHasSubtypes();
+ });
+ data.setCallbackBoolean("isItemDamaged", () -> {
+ return isItemDamaged();
+ });
+ data.setCallbackInt("getItemDamage", () -> {
+ return getItemDamage();
+ });
+ data.setCallbackInt("getMetadata", () -> {
+ return getMetadata();
+ });
+ data.setCallbackVoidWithDataArg("setItemDamage", (BaseData params) -> {
+ setItemDamage(params.getInt("meta"));
+ });
+ data.setCallbackInt("getMaxDamage", () -> {
+ return getMaxDamage();
+ });
+ data.setCallbackObject("copy", () -> {
+ return copy().makeModData();
+ });
+ data.setCallbackString("getUnlocalizedName", () -> {
+ return getUnlocalizedName();
+ });
+ data.setCallbackString("toString", () -> {
+ return toString();
+ });
+ data.setCallbackInt("getMaxItemUseDuration", () -> {
+ return getMaxItemUseDuration();
+ });
+ data.setCallbackString("getDisplayName", () -> {
+ return getDisplayName();
+ });
+ data.setCallbackObjectWithDataArg("setDisplayName", (BaseData params) -> {
+ return setStackDisplayName(params.getString("displayName")).makeModData();
+ });
+ data.setCallbackVoid("clearCustomName", () -> {
+ clearCustomName();
+ });
+ data.setCallbackBoolean("hasDisplayName", () -> {
+ return hasDisplayName();
+ });
+ data.setCallbackBoolean("hasEffect", () -> {
+ return hasEffect();
+ });
+ data.setCallbackBoolean("isItemEnchantable", () -> {
+ return isItemEnchantable();
+ });
+ data.setCallbackVoidWithDataArg("addEnchantment", (BaseData params) -> {
+ if (params.getBaseData("ench") instanceof Enchantment) {
+ addEnchantment((Enchantment) params.getBaseData("ench"), params.getInt("level"));
+ }
+ });
+ data.setCallbackBoolean("isItemEnchanted", () -> {
+ return isItemEnchanted();
+ });
+ data.setCallbackBoolean("canEditBlocks", () -> {
+ return canEditBlocks();
+ });
+ data.setCallbackBoolean("isOnItemFrame", () -> {
+ return isOnItemFrame();
+ });
+ data.setCallbackInt("getRepairCost", () -> {
+ return getRepairCost();
+ });
+ data.setCallbackVoidWithDataArg("setRepairCost", (BaseData params) -> {
+ setRepairCost(params.getInt("cost"));
+ });
+ data.setCallbackVoidWithDataArg("setItem", (BaseData params) -> {
+ if (params.getBaseData("newItem") instanceof Item) {
+ setItem((Item) params.getBaseData("newItem"));
+ }
+ });
+ data.setCallbackBooleanWithDataArg("canDestroy", (BaseData params) -> {
+ return canDestroy(Block.getBlockById(params.getInt("blockId")));
+ });
+ data.setCallbackBooleanWithDataArg("canPlaceOn", (BaseData params) -> {
+ return canPlaceOn(Block.getBlockById(params.getInt("blockId")));
+ });
+ data.setCallbackString("toNBT", () -> {
+ return toNBT();
+ });
+ data.setCallbackVoidWithDataArg("fromNBT", (BaseData params) -> {
+ fromNBT(params.getString("nbt"));
+ });
+ data.setCallbackStringArr("getLore", () -> {
+ return getLore();
+ });
+ data.setCallbackVoidWithDataArg("setLore", (BaseData params) -> {
+ setLore(params.getStringArr("lore"));
+ });
+
+ return data;
+ }
+
> INSERT 91 : 106 @ 91
+ public String toNBT() {
+ NBTTagCompound nbt = new NBTTagCompound();
+ nbt = writeToNBT(nbt);
+ return nbt.toString();
+ }
+
+ public void fromNBT(String nbt) {
+ try {
+ NBTTagCompound nbtParsed = JsonToNBT.getTagFromJson(nbt);
+ this.readFromNBT(nbtParsed);
+ } catch (Exception e) {
+ // Swallowing the error!
+ }
+ }
+
> CHANGE 64 : 65 @ 64 : 65
~ public boolean attemptDamageItem(int amount, EaglercraftRandom rand) {
> CHANGE 249 : 250 @ 249 : 250
> INSERT 210 : 244 @ 210
+ public void setLore(String[] loreIn) {
+ if (this.stackTagCompound == null) {
+ this.stackTagCompound = new NBTTagCompound();
+ }
+ if (!this.stackTagCompound.hasKey("display", 10)) {
+ this.stackTagCompound.setTag("display", new NBTTagCompound());
+ }
+ NBTTagCompound display = this.stackTagCompound.getCompoundTag("display");
+ NBTTagList lore = new NBTTagList();
+ for (String strIn : loreIn) {
+ lore.appendTag(new NBTTagString(strIn));
+ }
+ display.setTag("Lore", lore);
+ }
+
+ public String[] getLore() {
+ if (this.stackTagCompound == null) {
+ return new String[0];
+ }
+ if (!this.stackTagCompound.hasKey("display", 10)) {
+ return new String[0];
+ }
+ NBTTagCompound display = this.stackTagCompound.getCompoundTag("display");
+ if (!display.hasKey("Lore", 9)) {
+ return new String[0];
+ }
+ NBTTagList lore = (NBTTagList) display.getTag("Lore");
+ String[] outStrArr = new String[lore.tagCount()];
+ for (int i = 0; i < outStrArr.length; i++) {
+ outStrArr[i] = lore.getStringTagAt(i);
+ }
+ return outStrArr;
+ }
+
> CHANGE 39 : 40 @ 39 : 40
~ s = s + HString.format("#%04d/%d%s",

View File

@ -9,4 +9,8 @@
+
> CHANGE 5 : 6 @ 5 : 6
~ public int key;
> EOF

View File

@ -9,4 +9,8 @@
+
> CHANGE 5 : 6 @ 5 : 6
~ public String message;
> EOF

View File

@ -9,4 +9,23 @@
+
> CHANGE 8 : 11 @ 8 : 11
~ public int entityId;
~ public C02PacketUseEntity.Action action;
~ public Vec3 hitVec;
> INSERT 14 : 24 @ 14
+ public C02PacketUseEntity(int entityIdentifier, C02PacketUseEntity.Action action) {
+ this.entityId = entityIdentifier;
+ this.action = action;
+ }
+
+ public C02PacketUseEntity(int entityIdentifier, Vec3 hitVec) {
+ this(entityIdentifier, C02PacketUseEntity.Action.INTERACT_AT);
+ this.hitVec = hitVec;
+ }
+
> EOF

View File

@ -9,4 +9,15 @@
+
> CHANGE 5 : 13 @ 5 : 13
~ public double x;
~ public double y;
~ public double z;
~ public float yaw;
~ public float pitch;
~ public boolean onGround;
~ public boolean moving;
~ public boolean rotating;
> EOF

View File

@ -9,4 +9,10 @@
+
> CHANGE 7 : 10 @ 7 : 10
~ public BlockPos position;
~ public EnumFacing facing;
~ public C07PacketPlayerDigging.Action status;
> EOF

View File

@ -9,4 +9,13 @@
+
> CHANGE 8 : 14 @ 8 : 14
~ public BlockPos position;
~ public int placedBlockDirection;
~ public ItemStack stack;
~ public float facingX;
~ public float facingY;
~ public float facingZ;
> EOF

View File

@ -9,4 +9,8 @@
+
> CHANGE 5 : 6 @ 5 : 6
~ public int slotId;
> EOF

View File

@ -9,4 +9,19 @@
+
> CHANGE 6 : 9 @ 6 : 9
~ public int entityID;
~ public C0BPacketEntityAction.Action action;
~ public int auxData;
> INSERT 14 : 20 @ 14
+ public C0BPacketEntityAction(int entityId, C0BPacketEntityAction.Action action, int auxData) {
+ this.entityID = entityId;
+ this.action = action;
+ this.auxData = auxData;
+ }
+
> EOF

View File

@ -9,4 +9,11 @@
+
> CHANGE 5 : 9 @ 5 : 9
~ public float strafeSpeed;
~ public float forwardSpeed;
~ public boolean jumping;
~ public boolean sneaking;
> EOF

View File

@ -9,4 +9,8 @@
+
> CHANGE 5 : 6 @ 5 : 6
~ public int windowId;
> EOF

View File

@ -9,4 +9,13 @@
+
> CHANGE 6 : 12 @ 6 : 12
~ public int windowId;
~ public int slotId;
~ public int usedButton;
~ public short actionNumber;
~ public ItemStack clickedItem;
~ public int mode;
> EOF

View File

@ -9,4 +9,10 @@
+
> CHANGE 5 : 8 @ 5 : 8
~ public int windowId;
~ public short uid;
~ public boolean accepted;
> EOF

View File

@ -9,4 +9,9 @@
+
> CHANGE 6 : 8 @ 6 : 8
~ public int slotId;
~ public ItemStack stack;
> EOF

View File

@ -9,4 +9,9 @@
+
> CHANGE 5 : 7 @ 5 : 7
~ public int windowId;
~ public int button;
> EOF

View File

@ -9,4 +9,9 @@
+
> CHANGE 7 : 9 @ 7 : 9
~ public BlockPos pos;
~ public IChatComponent[] lines;
> EOF

View File

@ -9,4 +9,13 @@
+
> CHANGE 6 : 12 @ 6 : 12
~ public boolean invulnerable;
~ public boolean flying;
~ public boolean allowFlying;
~ public boolean creativeMode;
~ public float flySpeed;
~ public float walkSpeed;
> EOF

View File

@ -13,4 +13,9 @@
> DELETE 4 @ 4 : 5
> CHANGE 2 : 4 @ 2 : 4
~ public String message;
~ public BlockPos targetBlock;
> EOF

View File

@ -5,7 +5,15 @@
# Version: 1.0
# Author: lax1dude
> INSERT 62 : 66 @ 62
> CHANGE 9 : 14 @ 9 : 14
~ public String lang;
~ public int view;
~ public EntityPlayer.EnumChatVisibility chatVisibility;
~ public boolean enableColors;
~ public int modelPartFlags;
> INSERT 48 : 52 @ 48
+
+ public int getViewDistance() {

View File

@ -9,4 +9,8 @@
+
> CHANGE 5 : 6 @ 5 : 6
~ public C16PacketClientStatus.EnumState status;
> EOF

View File

@ -12,4 +12,8 @@
+
+ import net.lax1dude.eaglercraft.v1_8.netty.ByteBuf;
> CHANGE 5 : 6 @ 5 : 6
~ public String channel;
> EOF

View File

@ -11,7 +11,7 @@
> CHANGE 7 : 8 @ 7 : 8
~ private EaglercraftUUID id;
~ public EaglercraftUUID id;
> CHANGE 4 : 5 @ 4 : 5

View File

@ -9,4 +9,9 @@
+
> CHANGE 5 : 7 @ 5 : 7
~ public String hash;
~ public C19PacketResourcePackStatus.Action status;
> EOF

View File

@ -9,4 +9,9 @@
+
> CHANGE 6 : 8 @ 6 : 8
~ public IChatComponent chatComponent;
~ public byte type;
> EOF

View File

@ -7,11 +7,13 @@
> DELETE 2 @ 2 : 3
> INSERT 2 : 5 @ 2
> INSERT 2 : 7 @ 2
+
+ import com.google.common.collect.Lists;
+
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModData;
> CHANGE 59 : 60 @ 59 : 60
@ -38,4 +40,29 @@
~ for (int k = 0; k < l; ++k) {
~ j = func_179757_a(arraylist.get(k).getSkylightArray().getData(), s21packetchunkdata$extracted.data, j);
> CHANGE 31 : 32 @ 31 : 32
~ public static class Extracted extends ModData {
> INSERT 2 : 20 @ 2
+
+ public ModData makeModData() {
+ ModData d = new ModData();
+ d.setCallbackVoid("reload", () -> {
+ loadModData(d);
+ });
+ d.set("data", data);
+ d.set("dataSize", dataSize);
+ d.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ return d;
+ }
+
+ public void loadModData(BaseData d) {
+ data = d.getByteArr("data");
+ dataSize = d.getInt("dataSize");
+ }
> EOF

View File

@ -13,4 +13,13 @@
> DELETE 4 @ 4 : 5
> CHANGE 2 : 8 @ 2 : 8
~ public String soundName;
~ public int posX;
~ public int posY = Integer.MAX_VALUE;
~ public int posZ;
~ public float soundVolume;
~ public int soundPitch;
> EOF

View File

@ -5,8 +5,10 @@
# Version: 1.0
# Author: lax1dude
> CHANGE 4 : 6 @ 4 : 6
> CHANGE 4 : 8 @ 4 : 6
~ import net.eaglerforge.api.BaseData;
~ import net.eaglerforge.api.ModData;
~ import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
~ import net.lax1dude.eaglercraft.v1_8.mojang.authlib.Property;
@ -20,4 +22,37 @@
~ for (int i = 0, l = this.players.size(); i < l; ++i) {
~ S38PacketPlayerListItem.AddPlayerData s38packetplayerlistitem$addplayerdata = this.players.get(i);
> CHANGE 71 : 72 @ 71 : 72
~ public class AddPlayerData extends ModData {
> INSERT 17 : 43 @ 17
+ public void loadModData(BaseData data) {
+ // Yep, all the fields are 'final', so i can be lazy here.
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ data.set("ping", ping);
+ if (gamemode != null) {
+ data.set("gamemode", gamemode.name());
+ }
+ if (displayName != null) {
+ data.set("displayNameFormatted", displayName.getFormattedText());
+ data.set("displayName", displayName.getUnformattedText());
+ }
+ if (profile != null && profile.name != null) {
+ data.set("profileName", profile.name);
+ }
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ return data;
+ }
+
> EOF

View File

@ -5,6 +5,66 @@
# Version: 1.0
# Author: lax1dude
> DELETE 6 @ 6 : 7
> INSERT 2 : 4 @ 2
+ import net.eaglerforge.api.BaseData;
+ import net.eaglerforge.api.ModData;
> DELETE 4 @ 4 : 5
> CHANGE 2 : 3 @ 2 : 3
~ public class FoodStats extends ModData {
> INSERT 12 : 60 @ 12
+ public void loadModData(BaseData data) {
+ foodLevel = data.getInt("foodLevel");
+ foodSaturationLevel = data.getFloat("foodSaturationLevel");
+ foodExhaustionLevel = data.getFloat("foodExhaustionLevel");
+ foodTimer = data.getInt("foodTimer");
+ prevFoodLevel = data.getInt("prevFoodLevel");
+ }
+
+ public ModData makeModData() {
+ ModData data = new ModData();
+ data.setCallbackObject("getRef", () -> {
+ return this;
+ });
+ data.setCallbackVoid("reload", () -> {
+ loadModData(data);
+ });
+ data.set("foodLevel", foodLevel);
+ data.set("foodSaturationLevel", foodSaturationLevel);
+ data.set("foodExhaustionLevel", foodExhaustionLevel);
+ data.set("foodTimer", foodTimer);
+ data.set("prevFoodLevel", prevFoodLevel);
+ data.setCallbackVoidWithDataArg("addStats", (BaseData params) -> {
+ addStats(params.getInt("foodLevelIn"), params.getFloat("foodSaturationModifier"));
+ });
+ data.setCallbackVoidWithDataArg("addExhaustion", (BaseData params) -> {
+ addExhaustion(params.getFloat("parFloat1"));
+ });
+ data.setCallbackVoidWithDataArg("setFoodLevel", (BaseData params) -> {
+ setFoodLevel(params.getInt("foodLevelIn"));
+ });
+ data.setCallbackVoidWithDataArg("setFoodSaturationLevel", (BaseData params) -> {
+ setFoodSaturationLevel(params.getFloat("foodSaturationLevelIn"));
+ });
+ data.setCallbackInt("getFoodLevel", () -> {
+ return getFoodLevel();
+ });
+ data.setCallbackInt("getPrevFoodLevel", () -> {
+ return getPrevFoodLevel();
+ });
+ data.setCallbackFloat("getSaturationLevel", () -> {
+ return getSaturationLevel();
+ });
+ data.setCallbackBoolean("needFood", () -> {
+ return needFood();
+ });
+ return data;
+ }
+
> EOF

View File

@ -5,11 +5,21 @@
# Version: 1.0
# Author: lax1dude
> INSERT 8 : 12 @ 8
> INSERT 7 : 8 @ 7
+ public String resourceName;
> INSERT 1 : 3 @ 1
+ public Object cachedPointer = null;
+
+ public String resourceName;
+
> INSERT 1 : 2 @ 1
+ this.resourceName = resourceName[0];
> INSERT 8 : 9 @ 8
+ this.resourceName = resourceName;
> EOF

View File

@ -8,6 +8,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.minecraft.client.ClientBrandRetriever;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.entity.Entity;
import net.minecraft.util.ChatComponentText;
import me.otterdev.UwUAPI;
import org.teavm.jso.JSBody;
@ -158,7 +159,7 @@ public class ModAPI {
newEvent("packetdisplayscoreboard");
newEvent("packetteams");
newEvent("packetparticles");
newEvent("packetentityproperties");
newEvent("packetentityproperties");*/
newEvent("sendpacketanimation");
newEvent("sendpacketentityaction");
@ -185,7 +186,10 @@ public class ModAPI {
newEvent("sendpacketclientstatus");
newEvent("sendpacketcustompayload");
newEvent("sendpacketspectate");
newEvent("sendpacketresourcepackstatus");*/
newEvent("sendpacketresourcepackstatus");
newEvent("packetsoundeffect");
newEvent("packetchat");
globalsFunctor(this);
globalsRequireFunctor(this);
globalsUpdateFunctor(this);
@ -268,9 +272,9 @@ public class ModAPI {
if (requiredList.contains("player") && mc.thePlayer != null) {
ModAPI.setGlobal("player", mc.thePlayer.makeModData());
}
/* if (requiredList.contains("network") && mc.thePlayer != null && mc.thePlayer.sendQueue != null) {
if (requiredList.contains("network") && mc.thePlayer != null && mc.thePlayer.sendQueue != null) {
ModAPI.setGlobal("network", mc.thePlayer.sendQueue.makeModData());
}*/
}
if (requiredList.contains("settings") && mc.gameSettings != null) {
ModAPI.setGlobal("settings", mc.gameSettings.makeModData());
}

View File

@ -12,7 +12,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "EaglerForge";
public static final String projectForkVersion = "v1.2.3";
public static final String projectForkVersion = "v1.2.5";
public static final String projectForkVendor = "radmanplays";
public static final String projectForkURL = "https://github.com/eaglerforge/EaglerForge";

View File

@ -27,7 +27,7 @@ public class GameProfile {
private final EaglercraftUUID id;
private final String name;
public final String name;
private final Multimap<String, Property> properties;