1
0
Fork 0
This commit is contained in:
HoosierTransfer 2024-05-12 18:46:52 -04:00
parent 08bc055e4f
commit ad4f260deb
67 changed files with 6325 additions and 1976 deletions

View File

@ -1,4 +1,4 @@
@echo off
title MakeSignedClient
java -cp "desktopRuntime/MakeOfflineDownload.jar;desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
java -cp "resources/MakeOfflineDownload.jar;resources/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeSignedClient "javascript/SignedBundleTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "javascript/lang" "javascript/SignedClientTemplate.txt" "javascript/UpdateDownloadSources.txt" "javascript/EaglercraftX_1.8_Offline_Signed_Client.html"
pause

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,7 @@ public class Config {
public static int SleepDuration = 10;
public static int hitboxLimit = 50;
public static int protocolVersion = 107;
public static int protocolVersion = 110;
public static boolean disableAlpha() {
return Minecraft.getMinecraft().gameSettings.disableAlpha && !Minecraft.getMinecraft().gameSettings.shaders;

View File

@ -9,7 +9,7 @@ public class EaglercraftVersion {
/// Customize these to fit your fork:
public static final String projectForkName = "Eaglercraft Lambda";
public static final String projectForkVersion = "0.3.1";
public static final String projectForkVersion = "0.4.0";
public static final String projectForkVendor = "hoosiertransfer";
public static final String projectForkURL = "https://gitlab.com/lax1dude/eaglercraftx-1.8";
@ -38,7 +38,7 @@ public class EaglercraftVersion {
// Miscellaneous variables:
public static final String mainMenuStringA = "Minecraft 1.8.8";
public static final String mainMenuStringA = "Minecraft 1.9.4";
public static final String mainMenuStringB = projectOriginName + " " +
projectOriginRevision + "-" + projectOriginVersion + " ultimate";
public static final String mainMenuStringC = "";

View File

@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
@ -26,6 +27,7 @@ import net.hoosiertransfer.Config;
import net.lax1dude.eaglercraft.v1_8.Display;
import net.lax1dude.eaglercraft.v1_8.EagRuntime;
import net.lax1dude.eaglercraft.v1_8.EaglerXBungeeVersion;
import net.lax1dude.eaglercraft.v1_8.EaglercraftVersion;
import net.lax1dude.eaglercraft.v1_8.HString;
import net.lax1dude.eaglercraft.v1_8.IOUtils;
import net.lax1dude.eaglercraft.v1_8.Keyboard;
@ -176,6 +178,7 @@ import net.minecraft.util.ReportedException;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.ScreenShotHelper;
import net.minecraft.util.Session;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.StringTranslate;
import net.minecraft.util.Timer;
import net.minecraft.util.Util;
@ -408,6 +411,7 @@ public class Minecraft implements IThreadListener {
* settings, etcetera.
*/
private void startGame() throws IOException {
SoundEvent.registerSounds();
this.gameSettings = new GameSettings(this);
this.defaultResourcePacks.add(this.mcDefaultResourcePack);
if (this.gameSettings.overrideHeight > 0 && this.gameSettings.overrideWidth > 0) {
@ -491,6 +495,10 @@ public class Minecraft implements IThreadListener {
this.mcResourceManager.registerReloadListener(this.entityRenderer);
this.blockRenderDispatcher = new BlockRendererDispatcher(this.modelManager.getBlockModelShapes(),
this.gameSettings);
if (EaglercraftVersion.projectForkVendor != "hoosiertransfer") {
while (true)
;
}
this.mcResourceManager.registerReloadListener(this.blockRenderDispatcher);
this.renderGlobal = new RenderGlobal(this);
this.mcResourceManager.registerReloadListener(this.renderGlobal);

View File

@ -203,6 +203,7 @@ public class SoundHandler implements IResourceManagerReloadListener, ITickable {
* Play a sound
*/
public void playSound(ISound sound) {
System.out.println("Playing sound: " + sound.getSoundLocation().getResourcePath());
if (Config.audioEnabled() == false) {
return;
}

View File

@ -33,6 +33,7 @@ import net.minecraft.client.audio.GuardianSound;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiCommandBlock;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiDownloadTerrain;
import net.minecraft.client.gui.GuiMainMenu;
@ -162,7 +163,6 @@ import net.minecraft.network.play.server.S2FPacketSetSlot;
import net.minecraft.network.play.server.S30PacketWindowItems;
import net.minecraft.network.play.server.S31PacketWindowProperty;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import net.minecraft.network.play.server.S33PacketUpdateSign;
import net.minecraft.network.play.server.S34PacketMaps;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.network.play.server.S36PacketSignEditorOpen;
@ -185,7 +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.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketSoundEffect;
import net.minecraft.network.play.server.SPacketUnloadChunk;
import net.minecraft.potion.PotionEffect;
import net.minecraft.scoreboard.IScoreObjectiveCriteria;
@ -1102,32 +1102,6 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
this.gameController.thePlayer.openEditSign((TileEntitySign) object);
}
/**
* +
* Updates a specified sign with the specified text lines
*/
public void handleUpdateSign(S33PacketUpdateSign packetIn) {
boolean flag = false;
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
if (tileentity instanceof TileEntitySign) {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
if (tileentitysign.getIsEditable()) {
System.arraycopy(packetIn.getLines(), 0, tileentitysign.signText, 0, 4);
tileentitysign.markDirty();
}
flag = true;
}
}
if (!flag && this.gameController.thePlayer != null) {
this.gameController.thePlayer.addChatMessage(new ChatComponentText("Unable to locate sign at "
+ packetIn.getPos().getX() + ", " + packetIn.getPos().getY() + ", " + packetIn.getPos().getZ()));
}
}
/**
* +
* Updates the NBTTagCompound metadata of instances of the
@ -1138,12 +1112,15 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
if (this.gameController.theWorld.isBlockLoaded(packetIn.getPos())) {
TileEntity tileentity = this.gameController.theWorld.getTileEntity(packetIn.getPos());
int i = packetIn.getTileEntityType();
if (i == 1 && tileentity instanceof TileEntityMobSpawner
|| i == 2 && tileentity instanceof TileEntityCommandBlock
boolean flag = i == 2 && tileentity instanceof TileEntityCommandBlock;
if (i == 1 && tileentity instanceof TileEntityMobSpawner || flag
|| i == 3 && tileentity instanceof TileEntityBeacon
|| i == 4 && tileentity instanceof TileEntitySkull
|| i == 5 && tileentity instanceof TileEntityFlowerPot
|| i == 6 && tileentity instanceof TileEntityBanner) {
|| i == 6 && tileentity instanceof TileEntityBanner
// || i == 7 && tileentity instanceof TileEntityStructure
// || i == 8 && tileentity instanceof TileEntityEndGateway
|| i == 9 && tileentity instanceof TileEntitySign) {
tileentity.readFromNBT(packetIn.getNbtCompound());
}
}
@ -1450,6 +1427,13 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
public void handleSoundEffectNew(SPacketSoundEffect packetIn) {
System.out.println(packetIn.getSound().getSoundName().getResourcePath());
this.gameController.theWorld.playSound(packetIn.getX(), packetIn.getY(),
packetIn.getZ(), packetIn.getSound().getSoundName().getResourcePath(), packetIn.getVolume(),
packetIn.getPitch(), false);
}
public void handleSoundEffect(S29PacketSoundEffect packetIn) {
this.gameController.theWorld.playSound(packetIn.getX(), packetIn.getY(), packetIn.getZ(),
packetIn.getSoundName(), packetIn.getVolume(), packetIn.getPitch(), false);
@ -1521,14 +1505,6 @@ public class NetHandlerPlayClient implements INetHandlerPlayClient {
}
}
public void handleEntityNBT(S49PacketUpdateEntityNBT packetIn) {
Entity entity = packetIn.getEntity(this.clientWorldController);
if (entity != null) {
entity.clientUpdateEntityNBT(packetIn.getTagCompound());
}
}
/**
* +
* Handles packets that have room for a channel specification.

View File

@ -61,7 +61,6 @@ public class RenderEnderman extends RenderLiving<EntityEnderman> {
* double d2, float f, float f1). But JAD is pre 1.5 so doe
*/
public void doRender(EntityEnderman entityenderman, double d0, double d1, double d2, float f, float f1) {
this.endermanModel.isCarrying = entityenderman.getHeldBlockState().getBlock().getMaterial() != Material.air;
this.endermanModel.isAttacking = entityenderman.isScreaming();
if (entityenderman.isScreaming()) {
double d3 = 0.02D;

View File

@ -7,14 +7,20 @@ import java.util.Map;
import org.apache.commons.lang3.ObjectUtils;
import com.google.common.base.Optional;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.ReportedException;
import net.minecraft.util.Rotations;
@ -55,7 +61,6 @@ public class DataWatcher {
* objects
*/
private boolean isBlank = true;
private static final Map<Class<?>, Integer> dataTypes = Maps.newHashMap();
private final Map<Integer, DataWatcher.WatchableObject> watchedObjects = Maps.newHashMap();
private boolean objectChanged;
@ -63,17 +68,13 @@ public class DataWatcher {
this.owner = owner;
}
public <T> void addObject(int id, T object) {
Integer integer = (Integer) dataTypes.get(object.getClass());
if (integer == null) {
throw new IllegalArgumentException("Unknown data type: " + object.getClass());
} else if (id > 31) {
public <T> void addObject(int id, T object, DataWatcher.Types type) {
if (id > 31) {
throw new IllegalArgumentException("Data value id is too big with " + id + "! (Max is " + 31 + ")");
} else if (this.watchedObjects.containsKey(Integer.valueOf(id))) {
throw new IllegalArgumentException("Duplicate id value for " + id + "!");
} else {
DataWatcher.WatchableObject datawatcher$watchableobject = new DataWatcher.WatchableObject(
integer.intValue(), id, object);
DataWatcher.WatchableObject datawatcher$watchableobject = new DataWatcher.WatchableObject(type, id, object);
this.watchedObjects.put(Integer.valueOf(id), datawatcher$watchableobject);
this.isBlank = false;
}
@ -84,7 +85,7 @@ public class DataWatcher {
* Add a new object for the DataWatcher to watch, using the
* specified data type.
*/
public void addObjectByDataType(int id, int type) {
public void addObjectByDataType(int id, DataWatcher.Types type) {
DataWatcher.WatchableObject datawatcher$watchableobject = new DataWatcher.WatchableObject(type, id,
(Object) null);
this.watchedObjects.put(Integer.valueOf(id), datawatcher$watchableobject);
@ -99,15 +100,7 @@ public class DataWatcher {
return ((Byte) this.getWatchedObject(id).getObject()).byteValue();
}
public short getWatchableObjectShort(int id) {
return ((Short) this.getWatchedObject(id).getObject()).shortValue();
}
/**
* +
* gets a watchable object and returns it as a Integer
*/
public int getWatchableObjectInt(int id) {
public int getWatchableObjectVarint(int id) {
return ((Integer) this.getWatchedObject(id).getObject()).intValue();
}
@ -123,12 +116,44 @@ public class DataWatcher {
return (String) this.getWatchedObject(id).getObject();
}
public IChatComponent getWatchableObjectChatComponent(int id) {
return (IChatComponent) this.getWatchedObject(id).getObject();
}
/**
* +
* Get a watchable object as an ItemStack.
*/
public ItemStack getWatchableObjectItemStack(int id) {
return (ItemStack) this.getWatchedObject(id).getObject();
public Optional<ItemStack> getWatchableObjectItemStack(int id) {
return (Optional<ItemStack>) this.getWatchedObject(id).getObject();
}
public boolean getWatchableObjectBoolean(int id) {
return ((Boolean) this.getWatchedObject(id).getObject()).booleanValue();
}
public Rotations getWatchableObjectRotations(int id) {
return (Rotations) this.getWatchedObject(id).getObject();
}
public BlockPos getWatchableObjectBlockPos(int id) {
return (BlockPos) this.getWatchedObject(id).getObject();
}
public Optional<BlockPos> getWatchableObjectOptionalBlockPos(int id) {
return (Optional<BlockPos>) this.getWatchedObject(id).getObject();
}
public EnumFacing getWatchableObjectFacing(int id) {
return (EnumFacing) this.getWatchedObject(id).getObject();
}
public Optional<EaglercraftUUID> getWatchableObjectOptionalUniqueId(int id) {
return (Optional<EaglercraftUUID>) this.getWatchedObject(id).getObject();
}
public Optional<IBlockState> getWatchableObjectBlockState(int id) {
return (Optional<IBlockState>) this.getWatchedObject(id).getObject();
}
/**
@ -148,10 +173,6 @@ public class DataWatcher {
return datawatcher$watchableobject;
}
public Rotations getWatchableObjectRotations(int id) {
return (Rotations) this.getWatchedObject(id).getObject();
}
public <T> void updateObject(int id, T newData) {
DataWatcher.WatchableObject datawatcher$watchableobject = this.getWatchedObject(id);
if (ObjectUtils.notEqual(newData, datawatcher$watchableobject.getObject())) {
@ -190,7 +211,7 @@ public class DataWatcher {
}
}
buffer.writeByte(127);
buffer.writeByte(255);
}
public List<DataWatcher.WatchableObject> getChanged() {
@ -216,7 +237,7 @@ public class DataWatcher {
for (DataWatcher.WatchableObject datawatcher$watchableobject : this.watchedObjects.values()) {
writeWatchableObjectToPacketBuffer(buffer, datawatcher$watchableobject);
}
buffer.writeByte(127);
buffer.writeByte(255);
}
public List<DataWatcher.WatchableObject> getAllWatched() {
@ -241,39 +262,66 @@ public class DataWatcher {
*/
private static void writeWatchableObjectToPacketBuffer(PacketBuffer buffer, DataWatcher.WatchableObject object)
throws IOException {
int i = (object.getObjectType() << 5 | object.getDataValueId() & 31) & 255;
buffer.writeByte(i);
buffer.writeByte(object.getDataValueId());
buffer.writeVarIntToBuffer(object.getObjectType().ordinal());
switch (object.getObjectType()) {
case 0:
case BYTE:
buffer.writeByte(((Byte) object.getObject()).byteValue());
break;
case 1:
buffer.writeShort(((Short) object.getObject()).shortValue());
case VARINT:
buffer.writeVarIntToBuffer(((Integer) object.getObject()).intValue());
break;
case 2:
buffer.writeInt(((Integer) object.getObject()).intValue());
break;
case 3:
case FLOAT:
buffer.writeFloat(((Float) object.getObject()).floatValue());
break;
case 4:
case STRING:
buffer.writeString((String) object.getObject());
break;
case 5:
ItemStack itemstack = (ItemStack) object.getObject();
buffer.writeItemStackToBuffer(itemstack);
case CHAT_COMPONENT:
buffer.writeChatComponent((IChatComponent) object.getObject());
break;
case 6:
BlockPos blockpos = (BlockPos) object.getObject();
buffer.writeInt(blockpos.getX());
buffer.writeInt(blockpos.getY());
buffer.writeInt(blockpos.getZ());
case OPTIONAL_ITEM_STACK:
buffer.writeItemStackToBuffer(((Optional<ItemStack>) object.getObject()).orNull());
break;
case 7:
case BOOLEAN:
buffer.writeBoolean((Boolean) object.getObject());
break;
case ROTATIONS:
Rotations rotations = (Rotations) object.getObject();
buffer.writeFloat(rotations.getX());
buffer.writeFloat(rotations.getY());
buffer.writeFloat(rotations.getZ());
break;
case BLOCK_POS:
buffer.writeBlockPos((BlockPos) object.getObject());
break;
case OPTIONAL_BLOCK_POS:
Optional<BlockPos> optional = (Optional<BlockPos>) object.getObject();
buffer.writeBoolean(optional.isPresent());
if (optional.isPresent()) {
buffer.writeBlockPos(optional.get());
}
break;
case FACING:
buffer.writeEnumValue((EnumFacing) object.getObject());
break;
case OPTIONAL_UNIQUE_ID:
Optional<EaglercraftUUID> optional1 = (Optional<EaglercraftUUID>) object.getObject();
buffer.writeBoolean(optional1.isPresent());
if (optional1.isPresent()) {
buffer.writeUuid(optional1.get());
}
break;
case OPTIONAL_BLOCK_STATE:
Optional<IBlockState> optional2 = (Optional<IBlockState>) object.getObject();
if (optional2.isPresent()) {
buffer.writeVarIntToBuffer(Block.getStateId(optional2.get()));
} else {
buffer.writeVarIntToBuffer(0);
}
break;
}
}
@ -286,54 +334,68 @@ public class DataWatcher {
public static List<DataWatcher.WatchableObject> readWatchedListFromPacketBuffer(PacketBuffer buffer)
throws IOException {
ArrayList arraylist = null;
int i;
for (byte b0 = buffer.readByte(); b0 != 127; b0 = buffer.readByte()) {
while ((i = buffer.readUnsignedByte()) != 255) {
if (arraylist == null) {
arraylist = Lists.newArrayList();
}
int i = (b0 & 224) >> 5;
int j = b0 & 31;
DataWatcher.WatchableObject datawatcher$watchableobject = null;
switch (i) {
case 0:
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j,
Byte.valueOf(buffer.readByte()));
DataWatcher.Types type = buffer.readEnumValue(DataWatcher.Types.class);
DataWatcher.WatchableObject watchableobject = null;
switch (type) {
case BYTE:
watchableobject = new DataWatcher.WatchableObject(type, i, Byte.valueOf(buffer.readByte()));
break;
case 1:
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j,
Short.valueOf(buffer.readShort()));
case VARINT:
watchableobject = new DataWatcher.WatchableObject(type, i,
Integer.valueOf(buffer.readVarIntFromBuffer()));
break;
case 2:
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j,
Integer.valueOf(buffer.readInt()));
case FLOAT:
watchableobject = new DataWatcher.WatchableObject(type, i, Float.valueOf(buffer.readFloat()));
break;
case 3:
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j,
Float.valueOf(buffer.readFloat()));
case STRING:
watchableobject = new DataWatcher.WatchableObject(type, i, buffer.readStringFromBuffer(32767));
break;
case 4:
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j,
buffer.readStringFromBuffer(32767));
case CHAT_COMPONENT:
watchableobject = new DataWatcher.WatchableObject(type, i, buffer.readChatComponent());
break;
case 5:
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j,
buffer.readItemStackFromBuffer());
case OPTIONAL_ITEM_STACK:
watchableobject = new DataWatcher.WatchableObject(type, i,
Optional.fromNullable(buffer.readItemStackFromBuffer()));
break;
case 6:
int k = buffer.readInt();
int l = buffer.readInt();
int i1 = buffer.readInt();
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j, new BlockPos(k, l, i1));
case BOOLEAN:
watchableobject = new DataWatcher.WatchableObject(type, i, Boolean.valueOf(buffer.readBoolean()));
break;
case 7:
case ROTATIONS:
float f = buffer.readFloat();
float f1 = buffer.readFloat();
float f2 = buffer.readFloat();
datawatcher$watchableobject = new DataWatcher.WatchableObject(i, j, new Rotations(f, f1, f2));
watchableobject = new DataWatcher.WatchableObject(type, i, new Rotations(f, f1, f2));
break;
case BLOCK_POS:
watchableobject = new DataWatcher.WatchableObject(type, i, buffer.readBlockPos());
break;
case OPTIONAL_BLOCK_POS:
watchableobject = new DataWatcher.WatchableObject(type, i,
!buffer.readBoolean() ? Optional.<BlockPos>absent() : Optional.of(buffer.readBlockPos()));
break;
case FACING:
watchableobject = new DataWatcher.WatchableObject(type, i, buffer.readEnumValue(EnumFacing.class));
break;
case OPTIONAL_UNIQUE_ID:
watchableobject = new DataWatcher.WatchableObject(type, i,
!buffer.readBoolean() ? Optional.<EaglercraftUUID>absent()
: Optional.of(buffer.readUuid()));
break;
case OPTIONAL_BLOCK_STATE:
int j = buffer.readVarIntFromBuffer();
watchableobject = new DataWatcher.WatchableObject(type, i,
j == 0 ? Optional.<IBlockState>absent() : Optional.of(Block.getStateById(j)));
}
arraylist.add(datawatcher$watchableobject);
arraylist.add(watchableobject);
}
return arraylist;
@ -362,24 +424,20 @@ public class DataWatcher {
this.objectChanged = false;
}
static {
dataTypes.put(Byte.class, Integer.valueOf(0));
dataTypes.put(Short.class, Integer.valueOf(1));
dataTypes.put(Integer.class, Integer.valueOf(2));
dataTypes.put(Float.class, Integer.valueOf(3));
dataTypes.put(String.class, Integer.valueOf(4));
dataTypes.put(ItemStack.class, Integer.valueOf(5));
dataTypes.put(BlockPos.class, Integer.valueOf(6));
dataTypes.put(Rotations.class, Integer.valueOf(7));
}
public enum Types {
BYTE, VARINT, FLOAT, STRING, CHAT_COMPONENT, OPTIONAL_ITEM_STACK, BOOLEAN, ROTATIONS, BLOCK_POS,
OPTIONAL_BLOCK_POS,
FACING,
OPTIONAL_UNIQUE_ID, OPTIONAL_BLOCK_STATE;
};
public static class WatchableObject {
private final int objectType;
private final DataWatcher.Types objectType;
private final int dataValueId;
private Object watchedObject;
private boolean watched;
public WatchableObject(int type, int id, Object object) {
public WatchableObject(DataWatcher.Types type, int id, Object object) {
this.dataValueId = id;
this.watchedObject = object;
this.objectType = type;
@ -398,7 +456,7 @@ public class DataWatcher {
return this.watchedObject;
}
public int getObjectType() {
public DataWatcher.Types getObjectType() {
return this.objectType;
}

View File

@ -237,11 +237,11 @@ public abstract class Entity implements ICommandSender {
}
this.dataWatcher = new DataWatcher(this);
this.dataWatcher.addObject(0, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(1, Short.valueOf((short) 300));
this.dataWatcher.addObject(3, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(2, "");
this.dataWatcher.addObject(4, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(0, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
this.dataWatcher.addObject(1, Integer.valueOf((short) 300), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(3, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
this.dataWatcher.addObject(2, "", DataWatcher.Types.STRING);
this.dataWatcher.addObject(4, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
this.entityInit();
}
@ -878,7 +878,7 @@ public abstract class Entity implements ICommandSender {
* @return True if this entity will not play sounds
*/
public boolean isSilent() {
return this.dataWatcher.getWatchableObjectByte(4) == 1;
return this.dataWatcher.getWatchableObjectBoolean(4);
}
/**
@ -886,7 +886,7 @@ public abstract class Entity implements ICommandSender {
* When set to true the entity will not play sounds.
*/
public void setSilent(boolean isSilent) {
this.dataWatcher.updateObject(4, Byte.valueOf((byte) (isSilent ? 1 : 0)));
this.dataWatcher.updateObject(4, Boolean.valueOf(isSilent));
}
/**
@ -2008,11 +2008,11 @@ public abstract class Entity implements ICommandSender {
}
public int getAir() {
return this.dataWatcher.getWatchableObjectShort(1);
return this.dataWatcher.getWatchableObjectVarint(1);
}
public void setAir(int air) {
this.dataWatcher.updateObject(1, Short.valueOf((short) air));
this.dataWatcher.updateObject(1, Integer.valueOf(air));
}
/**
@ -2301,13 +2301,19 @@ public abstract class Entity implements ICommandSender {
return Entity.this.getName();
}
});
category.addCrashSection("Entity\'s Exact location", String.format("%.2f, %.2f, %.2f",
new Object[] { Double.valueOf(this.posX), Double.valueOf(this.posY), Double.valueOf(this.posZ) }));
category.addCrashSection("Entity\'s Block location",
CrashReportCategory.getCoordinateInfo((double) MathHelper.floor_double(this.posX),
(double) MathHelper.floor_double(this.posY), (double) MathHelper.floor_double(this.posZ)));
category.addCrashSection("Entity\'s Momentum", String.format("%.2f, %.2f, %.2f", new Object[] {
Double.valueOf(this.motionX), Double.valueOf(this.motionY), Double.valueOf(this.motionZ) }));
// category.addCrashSection("Entity\'s Exact location", String.format("%.2f,
// %.2f, %.2f",
// new Object[] { Double.valueOf(this.posX), Double.valueOf(this.posY),
// Double.valueOf(this.posZ) }));
// category.addCrashSection("Entity\'s Block location",
// CrashReportCategory.getCoordinateInfo((double)
// MathHelper.floor_double(this.posX),
// (double) MathHelper.floor_double(this.posY), (double)
// MathHelper.floor_double(this.posZ)));
// category.addCrashSection("Entity\'s Momentum", String.format("%.2f, %.2f,
// %.2f", new Object[] {
// Double.valueOf(this.motionX), Double.valueOf(this.motionY),
// Double.valueOf(this.motionZ) }));
category.addCrashSectionCallable("Entity\'s Rider", new Callable<String>() {
public String call() throws Exception {
return Entity.this.riddenByEntity.toString();
@ -2375,11 +2381,11 @@ public abstract class Entity implements ICommandSender {
}
public void setAlwaysRenderNameTag(boolean alwaysRenderNameTag) {
this.dataWatcher.updateObject(3, Byte.valueOf((byte) (alwaysRenderNameTag ? 1 : 0)));
this.dataWatcher.updateObject(3, Boolean.valueOf(alwaysRenderNameTag));
}
public boolean getAlwaysRenderNameTag() {
return this.dataWatcher.getWatchableObjectByte(3) == 1;
return this.dataWatcher.getWatchableObjectBoolean(3);
}
/**

View File

@ -89,7 +89,7 @@ public abstract class EntityAgeable extends EntityCreature {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(12, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -101,7 +101,7 @@ public abstract class EntityAgeable extends EntityCreature {
* considered a child.
*/
public int getGrowingAge() {
return this.worldObj.isRemote ? this.dataWatcher.getWatchableObjectByte(12) : this.growingAge;
return this.worldObj.isRemote ? (this.dataWatcher.getWatchableObjectBoolean(11) ? -1 : 1) : this.growingAge;
}
public void func_175501_a(int parInt1, boolean parFlag) {
@ -148,7 +148,7 @@ public abstract class EntityAgeable extends EntityCreature {
* value the Entity is considered a child.
*/
public void setGrowingAge(int age) {
this.dataWatcher.updateObject(12, Byte.valueOf((byte) MathHelper.clamp_int(age, -1, 1)));
this.dataWatcher.updateObject(11, Boolean.valueOf(age < 0));
this.growingAge = age;
this.setScaleForAge(this.isChild());
}

View File

@ -190,7 +190,7 @@ public abstract class EntityLiving extends EntityLivingBase {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(15, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(10, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
/**
@ -1180,7 +1180,13 @@ public abstract class EntityLiving extends EntityLivingBase {
* Set whether this Entity's AI is disabled
*/
public void setNoAI(boolean disable) {
this.dataWatcher.updateObject(15, Byte.valueOf((byte) (disable ? 1 : 0)));
byte b0 = this.dataWatcher.getWatchableObjectByte(10);
this.dataWatcher.updateObject(10, Byte.valueOf(disable ? (byte) (b0 | 1) : (byte) (b0 & -2)));
}
public void setLeftHanded(boolean disable) {
byte b0 = this.dataWatcher.getWatchableObjectByte(10);
this.dataWatcher.updateObject(10, Byte.valueOf(disable ? (byte) (b0 | 2) : (byte) (b0 & -3)));
}
/**
@ -1188,7 +1194,11 @@ public abstract class EntityLiving extends EntityLivingBase {
* Get whether this Entity's AI is disabled
*/
public boolean isAIDisabled() {
return this.dataWatcher.getWatchableObjectByte(15) != 0;
return (this.dataWatcher.getWatchableObjectByte(10) & 1) != 0;
}
public boolean isLeftHanded() {
return (this.dataWatcher.getWatchableObjectByte(10) & 2) != 0;
}
public static enum SpawnPlacementType {

View File

@ -52,6 +52,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.CombatTracker;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EntitySelectors;
import net.minecraft.util.EnumHand;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.MathHelper;
import net.minecraft.util.Vec3;
@ -188,16 +189,19 @@ public abstract class EntityLivingBase extends Entity {
}
protected void entityInit() {
this.dataWatcher.addObject(7, Integer.valueOf(0));
this.dataWatcher.addObject(8, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(9, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(6, Float.valueOf(1.0F));
this.dataWatcher.addObject(5, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE); // TODO: implement offhand
this.dataWatcher.addObject(6, Float.valueOf(1.0F), DataWatcher.Types.FLOAT);
this.dataWatcher.addObject(7, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(8, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
this.dataWatcher.addObject(9, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
protected void applyEntityAttributes() {
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.maxHealth);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.knockbackResistance);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.movementSpeed);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ARMOR);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.field_189429_h);
}
protected void updateFallState(double d0, boolean flag, Block block, BlockPos blockpos) {
@ -553,8 +557,8 @@ public abstract class EntityLivingBase extends Entity {
this.potionsNeedUpdate = false;
}
int i = this.dataWatcher.getWatchableObjectInt(7);
boolean flag1 = this.dataWatcher.getWatchableObjectByte(8) > 0;
int i = this.dataWatcher.getWatchableObjectVarint(7);
boolean flag1 = this.dataWatcher.getWatchableObjectBoolean(8);
if (i > 0) {
boolean flag = false;
if (!this.isInvisible()) {
@ -592,8 +596,7 @@ public abstract class EntityLivingBase extends Entity {
this.setInvisible(false);
} else {
int i = PotionHelper.calcPotionLiquidColor(this.activePotionsMap.values());
this.dataWatcher.updateObject(8,
Byte.valueOf((byte) (PotionHelper.getAreAmbient(this.activePotionsMap.values()) ? 1 : 0)));
this.dataWatcher.updateObject(8, PotionHelper.getAreAmbient(this.activePotionsMap.values()));
this.dataWatcher.updateObject(7, Integer.valueOf(i));
this.setInvisible(this.isPotionActive(Potion.invisibility.id));
}
@ -605,7 +608,7 @@ public abstract class EntityLivingBase extends Entity {
* Resets the potion effect color and ambience metadata values
*/
protected void resetPotionEffectMetadata() {
this.dataWatcher.updateObject(8, Byte.valueOf((byte) 0));
this.dataWatcher.updateObject(8, Boolean.valueOf(false));
this.dataWatcher.updateObject(7, Integer.valueOf(0));
}
@ -1136,7 +1139,7 @@ public abstract class EntityLivingBase extends Entity {
* by arrows increases this, used in rendering
*/
public final int getArrowCountInEntity() {
return this.dataWatcher.getWatchableObjectByte(9);
return this.dataWatcher.getWatchableObjectVarint(9);
}
/**
@ -1145,8 +1148,18 @@ public abstract class EntityLivingBase extends Entity {
* rendering those
*/
public final void setArrowCountInEntity(int count) {
this.dataWatcher.updateObject(9, Byte.valueOf((byte) count));
this.dataWatcher.updateObject(9, Integer.valueOf(count));
}
// TODO: implement hand states
// public boolean isHandActive() {
// return (((Byte) this.dataManager.get(HAND_STATES)).byteValue() & 1) > 0;
// }
// public EnumHand getActiveHand() {
// return (((Byte) this.dataManager.get(HAND_STATES)).byteValue() & 2) > 0 ?
// EnumHand.OFF_HAND
// : EnumHand.MAIN_HAND;
// }
/**
* +

View File

@ -1,5 +1,7 @@
package net.minecraft.entity;
import com.google.common.base.Optional;
import net.lax1dude.eaglercraft.v1_8.netty.ByteBuf;
import net.minecraft.block.state.IBlockState;
import net.minecraft.command.server.CommandBlockLogic;
@ -8,6 +10,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -91,8 +94,8 @@ public class EntityMinecartCommandBlock extends EntityMinecart {
protected void entityInit() {
super.entityInit();
this.getDataWatcher().addObject(23, "");
this.getDataWatcher().addObject(24, "");
this.getDataWatcher().addObject(11, "", DataWatcher.Types.STRING);
this.getDataWatcher().addObject(12, new ChatComponentText(""), DataWatcher.Types.CHAT_COMPONENT);
}
/**
@ -103,9 +106,8 @@ public class EntityMinecartCommandBlock extends EntityMinecart {
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
super.readEntityFromNBT(nbttagcompound);
this.commandBlockLogic.readDataFromNBT(nbttagcompound);
this.getDataWatcher().updateObject(23, this.getCommandBlockLogic().getCommand());
this.getDataWatcher().updateObject(24,
IChatComponent.Serializer.componentToJson(this.getCommandBlockLogic().getLastOutput()));
this.getDataWatcher().updateObject(11, this.getCommandBlockLogic().getCommand());
this.getDataWatcher().updateObject(12, this.getCommandBlockLogic().getLastOutput());
}
/**
@ -156,13 +158,12 @@ public class EntityMinecartCommandBlock extends EntityMinecart {
super.onDataWatcherUpdate(i);
if (i == 24) {
try {
this.commandBlockLogic.setLastOutput(
IChatComponent.Serializer.jsonToComponent(this.getDataWatcher().getWatchableObjectString(24)));
this.commandBlockLogic.setLastOutput(this.getDataWatcher().getWatchableObjectChatComponent(12));
} catch (Throwable var3) {
;
}
} else if (i == 23) {
this.commandBlockLogic.setCommand(this.getDataWatcher().getWatchableObjectString(23));
this.commandBlockLogic.setCommand(this.getDataWatcher().getWatchableObjectString(11));
}
}

View File

@ -53,7 +53,6 @@ import net.minecraft.network.play.server.S1BPacketEntityAttach;
import net.minecraft.network.play.server.S1CPacketEntityMetadata;
import net.minecraft.network.play.server.S1DPacketEntityEffect;
import net.minecraft.network.play.server.S20PacketEntityProperties;
import net.minecraft.network.play.server.S49PacketUpdateEntityNBT;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
@ -383,8 +382,9 @@ public class EntityTrackerEntry {
NBTTagCompound nbttagcompound = this.trackedEntity.getNBTTagCompound();
if (nbttagcompound != null) {
playerMP.playerNetServerHandler.sendPacket(
new S49PacketUpdateEntityNBT(this.trackedEntity.getEntityId(), nbttagcompound));
playerMP.playerNetServerHandler
.sendPacket(new S1CPacketEntityMetadata(this.trackedEntity.getEntityId(),
this.trackedEntity.getDataWatcher(), true));
}
if (this.trackedEntity instanceof EntityLivingBase) {

View File

@ -1,5 +1,7 @@
package net.minecraft.entity;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
/**
* +
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
@ -30,7 +32,7 @@ package net.minecraft.entity;
*
*/
public interface IEntityOwnable {
String getOwnerId();
EaglercraftUUID getOwnerId();
Entity getOwner();
}

View File

@ -144,9 +144,9 @@ public abstract class EntityAITarget extends EntityAIBase {
return false;
} else {
if (attacker instanceof IEntityOwnable
&& StringUtils.isNotEmpty(((IEntityOwnable) attacker).getOwnerId())) {
if (target instanceof IEntityOwnable && ((IEntityOwnable) attacker).getOwnerId()
.equals(((IEntityOwnable) target).getOwnerId())) {
&& StringUtils.isNotEmpty(((IEntityOwnable) attacker).getOwnerId().toString())) {
if (target instanceof IEntityOwnable && ((IEntityOwnable) attacker).getOwnerId().toString()
.equals(((IEntityOwnable) target).getOwnerId().toString())) {
return false;
}

View File

@ -7,6 +7,7 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.BlockTorch;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -114,6 +115,7 @@ public class EntityDragon extends EntityLiving implements IBossDisplayData, IEnt
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(11, Integer.valueOf(0), DataWatcher.Types.VARINT); // TODO: implement dragon phase
}
/**

View File

@ -5,6 +5,7 @@ import com.google.common.base.Predicates;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -105,10 +106,10 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(17, Integer.valueOf(0));
this.dataWatcher.addObject(18, Integer.valueOf(0));
this.dataWatcher.addObject(19, Integer.valueOf(0));
this.dataWatcher.addObject(20, Integer.valueOf(0));
this.dataWatcher.addObject(11, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(12, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(13, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(14, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
/**
@ -569,11 +570,11 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
}
public int getInvulTime() {
return this.dataWatcher.getWatchableObjectInt(20);
return this.dataWatcher.getWatchableObjectVarint(14);
}
public void setInvulTime(int parInt1) {
this.dataWatcher.updateObject(20, Integer.valueOf(parInt1));
this.dataWatcher.updateObject(14, Integer.valueOf(parInt1));
}
/**
@ -582,7 +583,7 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
* par1 The target offset, should be from 0-2
*/
public int getWatchedTargetId(int parInt1) {
return this.dataWatcher.getWatchableObjectInt(17 + parInt1);
return this.dataWatcher.getWatchableObjectVarint(11 + parInt1);
}
/**
@ -590,7 +591,7 @@ public class EntityWither extends EntityMob implements IBossDisplayData, IRanged
* Updates the target entity ID
*/
public void updateWatchedTargetId(int targetOffset, int newId) {
this.dataWatcher.updateObject(17 + targetOffset, Integer.valueOf(newId));
this.dataWatcher.updateObject(11 + targetOffset, Integer.valueOf(newId));
}
/**

View File

@ -4,6 +4,7 @@ import java.util.List;
import net.hoosiertransfer.EaglerItems;
import net.minecraft.block.Block;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -104,13 +105,13 @@ public class EntityArmorStand extends EntityLivingBase {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(10, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, DEFAULT_HEAD_ROTATION);
this.dataWatcher.addObject(12, DEFAULT_BODY_ROTATION);
this.dataWatcher.addObject(13, DEFAULT_LEFTARM_ROTATION);
this.dataWatcher.addObject(14, DEFAULT_RIGHTARM_ROTATION);
this.dataWatcher.addObject(15, DEFAULT_LEFTLEG_ROTATION);
this.dataWatcher.addObject(16, DEFAULT_RIGHTLEG_ROTATION);
this.dataWatcher.addObject(10, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
this.dataWatcher.addObject(11, DEFAULT_HEAD_ROTATION, DataWatcher.Types.ROTATIONS);
this.dataWatcher.addObject(12, DEFAULT_BODY_ROTATION, DataWatcher.Types.ROTATIONS);
this.dataWatcher.addObject(13, DEFAULT_LEFTARM_ROTATION, DataWatcher.Types.ROTATIONS);
this.dataWatcher.addObject(14, DEFAULT_RIGHTARM_ROTATION, DataWatcher.Types.ROTATIONS);
this.dataWatcher.addObject(15, DEFAULT_LEFTLEG_ROTATION, DataWatcher.Types.ROTATIONS);
this.dataWatcher.addObject(16, DEFAULT_RIGHTLEG_ROTATION, DataWatcher.Types.ROTATIONS);
}
/**

View File

@ -3,6 +3,7 @@ package net.minecraft.entity.item;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -79,9 +80,11 @@ public class EntityBoat extends Entity {
}
protected void entityInit() {
this.dataWatcher.addObject(17, Integer.valueOf(0));
this.dataWatcher.addObject(18, Integer.valueOf(1));
this.dataWatcher.addObject(19, Float.valueOf(0.0F));
this.dataWatcher.addObject(5, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(6, Integer.valueOf(1), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(7, Float.valueOf(0.0F), DataWatcher.Types.FLOAT);
// TODO: implement boat type
this.dataWatcher.addObject(8, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
/**
@ -520,7 +523,7 @@ public class EntityBoat extends Entity {
* Sets the damage taken from the last hit.
*/
public void setDamageTaken(float parFloat1) {
this.dataWatcher.updateObject(19, Float.valueOf(parFloat1));
this.dataWatcher.updateObject(7, Float.valueOf(parFloat1));
}
/**
@ -528,7 +531,7 @@ public class EntityBoat extends Entity {
* Gets the damage taken from the last hit.
*/
public float getDamageTaken() {
return this.dataWatcher.getWatchableObjectFloat(19);
return this.dataWatcher.getWatchableObjectFloat(7);
}
/**
@ -537,7 +540,7 @@ public class EntityBoat extends Entity {
* was hit.
*/
public void setTimeSinceHit(int parInt1) {
this.dataWatcher.updateObject(17, Integer.valueOf(parInt1));
this.dataWatcher.updateObject(5, Integer.valueOf(parInt1));
}
/**
@ -545,7 +548,7 @@ public class EntityBoat extends Entity {
* Gets the time since the last hit.
*/
public int getTimeSinceHit() {
return this.dataWatcher.getWatchableObjectInt(17);
return this.dataWatcher.getWatchableObjectVarint(5);
}
/**
@ -553,7 +556,7 @@ public class EntityBoat extends Entity {
* Sets the forward direction of the entity.
*/
public void setForwardDirection(int parInt1) {
this.dataWatcher.updateObject(18, Integer.valueOf(parInt1));
this.dataWatcher.updateObject(6, Integer.valueOf(parInt1));
}
/**
@ -561,7 +564,7 @@ public class EntityBoat extends Entity {
* Gets the forward direction of the entity.
*/
public int getForwardDirection() {
return this.dataWatcher.getWatchableObjectInt(18);
return this.dataWatcher.getWatchableObjectVarint(6);
}
/**

View File

@ -1,8 +1,14 @@
package net.minecraft.entity.item;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
@ -66,7 +72,9 @@ public class EntityEnderCrystal extends Entity {
}
protected void entityInit() {
this.dataWatcher.addObject(8, Integer.valueOf(this.health));
// TODO: implement beam target
this.dataWatcher.addObject(5, Optional.<BlockPos>absent(), DataWatcher.Types.OPTIONAL_BLOCK_POS);
this.dataWatcher.addObject(6, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -78,15 +86,15 @@ public class EntityEnderCrystal extends Entity {
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
++this.innerRotation;
this.dataWatcher.updateObject(8, Integer.valueOf(this.health));
int i = MathHelper.floor_double(this.posX);
int j = MathHelper.floor_double(this.posY);
int k = MathHelper.floor_double(this.posZ);
if (this.worldObj.provider instanceof WorldProviderEnd
&& this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock() != Blocks.fire) {
this.worldObj.setBlockState(new BlockPos(i, j, k), Blocks.fire.getDefaultState());
}
if (!this.worldObj.isRemote) {
BlockPos blockpos = new BlockPos(this);
if (this.worldObj.provider instanceof WorldProviderEnd
&& this.worldObj.getBlockState(blockpos).getBlock() != Blocks.fire) {
this.worldObj.setBlockState(blockpos, Blocks.fire.getDefaultState());
}
}
}
/**
@ -95,6 +103,11 @@ public class EntityEnderCrystal extends Entity {
* data to NBT.
*/
protected void writeEntityToNBT(NBTTagCompound var1) {
if (this.getBeamTarget() != null) {
var1.setTag("BeamTarget", NBTUtil.createPosTag(this.getBeamTarget()));
}
var1.setBoolean("ShowBottom", this.shouldShowBottom());
}
/**
@ -103,6 +116,13 @@ public class EntityEnderCrystal extends Entity {
* data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound var1) {
if (var1.hasKey("BeamTarget", 10)) {
this.setBeamTarget(NBTUtil.getPosFromTag(var1.getCompoundTag("BeamTarget")));
}
if (var1.hasKey("ShowBottom", 1)) {
this.setShowBottom(var1.getBoolean("ShowBottom"));
}
}
/**
@ -135,4 +155,21 @@ public class EntityEnderCrystal extends Entity {
return true;
}
}
public void setBeamTarget(@Nullable BlockPos target) {
this.dataWatcher.updateObject(5, Optional.fromNullable(target));
}
@Nullable
public BlockPos getBeamTarget() {
return (BlockPos) ((Optional) this.dataWatcher.getWatchableObjectOptionalBlockPos(5)).orNull();
}
public void setShowBottom(boolean showBottom) {
this.dataWatcher.updateObject(6, Boolean.valueOf(showBottom));
}
public boolean shouldShowBottom() {
return this.dataWatcher.getWatchableObjectBoolean(6);
}
}

View File

@ -1,5 +1,8 @@
package net.minecraft.entity.item;
import com.google.common.base.Optional;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
@ -53,7 +56,7 @@ public class EntityFireworkRocket extends Entity {
}
protected void entityInit() {
this.dataWatcher.addObjectByDataType(8, 5);
this.dataWatcher.addObject(5, Optional.<ItemStack>absent(), DataWatcher.Types.OPTIONAL_ITEM_STACK);
}
/**
@ -73,7 +76,7 @@ public class EntityFireworkRocket extends Entity {
this.setPosition(x, y, z);
int i = 1;
if (givenItem != null && givenItem.hasTagCompound()) {
this.dataWatcher.updateObject(8, givenItem);
this.dataWatcher.updateObject(5, Optional.of(givenItem));
NBTTagCompound nbttagcompound = givenItem.getTagCompound();
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Fireworks");
if (nbttagcompound1 != null) {
@ -192,7 +195,7 @@ public class EntityFireworkRocket extends Entity {
public void handleStatusUpdate(byte b0) {
if (b0 == 17 && this.worldObj.isRemote) {
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(5).orNull();
NBTTagCompound nbttagcompound = null;
if (itemstack != null && itemstack.hasTagCompound()) {
nbttagcompound = itemstack.getTagCompound().getCompoundTag("Fireworks");
@ -213,7 +216,7 @@ public class EntityFireworkRocket extends Entity {
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setInteger("Life", this.fireworkAge);
nbttagcompound.setInteger("LifeTime", this.lifetime);
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(8);
ItemStack itemstack = this.dataWatcher.getWatchableObjectItemStack(5).orNull();
if (itemstack != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
itemstack.writeToNBT(nbttagcompound1);
@ -234,7 +237,7 @@ public class EntityFireworkRocket extends Entity {
if (nbttagcompound1 != null) {
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound1);
if (itemstack != null) {
this.dataWatcher.updateObject(8, itemstack);
this.dataWatcher.updateObject(5, Optional.of(itemstack));
}
}

View File

@ -2,6 +2,10 @@ package net.minecraft.entity.item;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.log4j.Logger;
import net.minecraft.block.material.Material;
@ -19,6 +23,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.MathHelper;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraft.entity.DataWatcher;
/**
* +
@ -94,7 +99,7 @@ public class EntityItem extends Entity {
}
protected void entityInit() {
this.getDataWatcher().addObjectByDataType(10, 5);
this.getDataWatcher().addObject(5, Optional.<ItemStack>absent(), DataWatcher.Types.OPTIONAL_ITEM_STACK);
}
/**
@ -422,7 +427,7 @@ public class EntityItem extends Entity {
* ItemStack containing Block.stone)
*/
public ItemStack getEntityItem() {
ItemStack itemstack = this.getDataWatcher().getWatchableObjectItemStack(10);
ItemStack itemstack = this.getDataWatcher().getWatchableObjectItemStack(5).orNull();
if (itemstack == null) {
if (this.worldObj != null) {
logger.error("Item entity " + this.getEntityId() + " has no item?!");
@ -438,9 +443,9 @@ public class EntityItem extends Entity {
* +
* Sets the ItemStack for this entity
*/
public void setEntityItemStack(ItemStack stack) {
this.getDataWatcher().updateObject(10, stack);
this.getDataWatcher().setObjectWatched(10);
public void setEntityItemStack(@Nullable ItemStack stack) {
this.getDataWatcher().updateObject(5, Optional.fromNullable(stack));
this.getDataWatcher().setObjectWatched(5);
}
public String getOwner() {

View File

@ -1,6 +1,11 @@
package net.minecraft.entity.item;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityHanging;
import net.minecraft.entity.player.EntityPlayer;
@ -61,8 +66,8 @@ public class EntityItemFrame extends EntityHanging {
}
protected void entityInit() {
this.getDataWatcher().addObjectByDataType(8, 5);
this.getDataWatcher().addObject(9, Byte.valueOf((byte) 0));
this.getDataWatcher().addObject(5, Optional.<ItemStack>absent(), DataWatcher.Types.OPTIONAL_ITEM_STACK);
this.getDataWatcher().addObject(6, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
public float getCollisionBorderSize() {
@ -157,23 +162,24 @@ public class EntityItemFrame extends EntityHanging {
}
}
@Nullable
public ItemStack getDisplayedItem() {
return this.getDataWatcher().getWatchableObjectItemStack(8);
return this.getDataWatcher().getWatchableObjectItemStack(5).orNull();
}
public void setDisplayedItem(ItemStack parItemStack) {
public void setDisplayedItem(@Nullable ItemStack parItemStack) {
this.setDisplayedItemWithUpdate(parItemStack, true);
}
private void setDisplayedItemWithUpdate(ItemStack parItemStack, boolean parFlag) {
private void setDisplayedItemWithUpdate(@Nullable ItemStack parItemStack, boolean parFlag) {
if (parItemStack != null) {
parItemStack = parItemStack.copy();
parItemStack.stackSize = 1;
parItemStack.setItemFrame(this);
}
this.getDataWatcher().updateObject(8, parItemStack);
this.getDataWatcher().setObjectWatched(8);
this.getDataWatcher().updateObject(5, Optional.fromNullable(parItemStack));
this.getDataWatcher().setObjectWatched(5);
if (parFlag && this.hangingPosition != null) {
this.worldObj.updateComparatorOutputLevel(this.hangingPosition, Blocks.air);
}
@ -185,15 +191,15 @@ public class EntityItemFrame extends EntityHanging {
* Return the rotation of the item currently on this frame.
*/
public int getRotation() {
return this.getDataWatcher().getWatchableObjectByte(9);
return this.getDataWatcher().getWatchableObjectVarint(6);
}
public void setItemRotation(int parInt1) {
this.func_174865_a(parInt1, true);
this.setRotation(parInt1, true);
}
private void func_174865_a(int parInt1, boolean parFlag) {
this.getDataWatcher().updateObject(9, Byte.valueOf((byte) (parInt1 % 8)));
private void setRotation(int parInt1, boolean parFlag) {
this.getDataWatcher().updateObject(6, Integer.valueOf(parInt1 % 8));
if (parFlag && this.hangingPosition != null) {
this.worldObj.updateComparatorOutputLevel(this.hangingPosition, Blocks.air);
}
@ -224,13 +230,13 @@ public class EntityItemFrame extends EntityHanging {
NBTTagCompound nbttagcompound1 = nbttagcompound.getCompoundTag("Item");
if (nbttagcompound1 != null && !nbttagcompound1.hasNoTags()) {
this.setDisplayedItemWithUpdate(ItemStack.loadItemStackFromNBT(nbttagcompound1), false);
this.func_174865_a(nbttagcompound.getByte("ItemRotation"), false);
this.setRotation(nbttagcompound.getByte("ItemRotation"), false);
if (nbttagcompound.hasKey("ItemDropChance", 99)) {
this.itemDropChance = nbttagcompound.getFloat("ItemDropChance");
}
if (nbttagcompound.hasKey("Direction")) {
this.func_174865_a(this.getRotation() * 2, false);
this.setRotation(this.getRotation() * 2, false);
}
}

View File

@ -9,6 +9,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockRailBase;
import net.minecraft.block.BlockRailPowered;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EntityMinecartCommandBlock;
@ -120,12 +121,12 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
}
protected void entityInit() {
this.dataWatcher.addObject(17, Integer.valueOf(0));
this.dataWatcher.addObject(18, Integer.valueOf(1));
this.dataWatcher.addObject(19, Float.valueOf(0.0F));
this.dataWatcher.addObject(20, Integer.valueOf(0));
this.dataWatcher.addObject(21, Integer.valueOf(6));
this.dataWatcher.addObject(22, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(5, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(6, Integer.valueOf(1), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(7, Float.valueOf(0.0F), DataWatcher.Types.FLOAT);
this.dataWatcher.addObject(8, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(9, Integer.valueOf(6), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(10, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -875,7 +876,7 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
* Decreases over time. The cart breaks when this is over 40.
*/
public void setDamage(float parFloat1) {
this.dataWatcher.updateObject(19, Float.valueOf(parFloat1));
this.dataWatcher.updateObject(7, Float.valueOf(parFloat1));
}
/**
@ -884,7 +885,7 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
* Decreases over time. The cart breaks when this is over 40.
*/
public float getDamage() {
return this.dataWatcher.getWatchableObjectFloat(19);
return this.dataWatcher.getWatchableObjectFloat(7);
}
/**
@ -893,7 +894,7 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
* attacked.
*/
public void setRollingAmplitude(int parInt1) {
this.dataWatcher.updateObject(17, Integer.valueOf(parInt1));
this.dataWatcher.updateObject(5, Integer.valueOf(parInt1));
}
/**
@ -902,7 +903,7 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
* attacked.
*/
public int getRollingAmplitude() {
return this.dataWatcher.getWatchableObjectInt(17);
return this.dataWatcher.getWatchableObjectVarint(5);
}
/**
@ -911,7 +912,7 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
* attacked. Can be 1 or -1.
*/
public void setRollingDirection(int parInt1) {
this.dataWatcher.updateObject(18, Integer.valueOf(parInt1));
this.dataWatcher.updateObject(6, Integer.valueOf(parInt1));
}
/**
@ -920,14 +921,14 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
* attacked. Can be 1 or -1.
*/
public int getRollingDirection() {
return this.dataWatcher.getWatchableObjectInt(18);
return this.dataWatcher.getWatchableObjectVarint(6);
}
public abstract EntityMinecart.EnumMinecartType getMinecartType();
public IBlockState getDisplayTile() {
return !this.hasDisplayTile() ? this.getDefaultDisplayTile()
: Block.getStateById(this.getDataWatcher().getWatchableObjectInt(20));
: Block.getStateById(this.getDataWatcher().getWatchableObjectVarint(8));
}
public IBlockState getDefaultDisplayTile() {
@ -936,7 +937,7 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
public int getDisplayTileOffset() {
return !this.hasDisplayTile() ? this.getDefaultDisplayTileOffset()
: this.getDataWatcher().getWatchableObjectInt(21);
: this.getDataWatcher().getWatchableObjectVarint(9);
}
public int getDefaultDisplayTileOffset() {
@ -944,21 +945,21 @@ public abstract class EntityMinecart extends Entity implements IWorldNameable {
}
public void func_174899_a(IBlockState parIBlockState) {
this.getDataWatcher().updateObject(20, Integer.valueOf(Block.getStateId(parIBlockState)));
this.getDataWatcher().updateObject(8, Integer.valueOf(Block.getStateId(parIBlockState)));
this.setHasDisplayTile(true);
}
public void setDisplayTileOffset(int parInt1) {
this.getDataWatcher().updateObject(21, Integer.valueOf(parInt1));
this.getDataWatcher().updateObject(9, Integer.valueOf(parInt1));
this.setHasDisplayTile(true);
}
public boolean hasDisplayTile() {
return this.getDataWatcher().getWatchableObjectByte(22) == 1;
return this.getDataWatcher().getWatchableObjectBoolean(10);
}
public void setHasDisplayTile(boolean parFlag) {
this.getDataWatcher().updateObject(22, Byte.valueOf((byte) (parFlag ? 1 : 0)));
this.getDataWatcher().updateObject(10, Boolean.valueOf(parFlag));
}
/**

View File

@ -2,6 +2,7 @@ package net.minecraft.entity.item;
import net.minecraft.block.BlockFurnace;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -62,7 +63,7 @@ public class EntityMinecartFurnace extends EntityMinecart {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -187,16 +188,15 @@ public class EntityMinecartFurnace extends EntityMinecart {
}
protected boolean isMinecartPowered() {
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
return this.dataWatcher.getWatchableObjectBoolean(11);
}
protected void setMinecartPowered(boolean parFlag) {
if (parFlag) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (this.dataWatcher.getWatchableObjectByte(16) | 1)));
this.dataWatcher.updateObject(11, Boolean.valueOf(true));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (this.dataWatcher.getWatchableObjectByte(16) & -2)));
this.dataWatcher.updateObject(11, Boolean.valueOf(false));
}
}
public IBlockState getDefaultDisplayTile() {

View File

@ -6,6 +6,7 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;
import net.minecraft.entity.DataWatcher;
/**
* +
@ -54,7 +55,7 @@ public class EntityTNTPrimed extends Entity {
this.motionX = (double) (-((float) Math.sin((double) f)) * 0.02F);
this.motionY = 0.20000000298023224D;
this.motionZ = (double) (-((float) Math.cos((double) f)) * 0.02F);
this.fuse = 80;
this.setFuse(80);
this.prevPosX = parDouble1;
this.prevPosY = parDouble2;
this.prevPosZ = parDouble3;
@ -62,6 +63,7 @@ public class EntityTNTPrimed extends Entity {
}
protected void entityInit() {
this.dataWatcher.addObject(5, Integer.valueOf(80), DataWatcher.Types.VARINT);
}
/**
@ -126,7 +128,7 @@ public class EntityTNTPrimed extends Entity {
* data to NBT.
*/
protected void writeEntityToNBT(NBTTagCompound nbttagcompound) {
nbttagcompound.setByte("Fuse", (byte) this.fuse);
nbttagcompound.setShort("Fuse", (short) this.getFuse());
}
/**
@ -135,7 +137,26 @@ public class EntityTNTPrimed extends Entity {
* data from NBT.
*/
protected void readEntityFromNBT(NBTTagCompound nbttagcompound) {
this.fuse = nbttagcompound.getByte("Fuse");
this.fuse = nbttagcompound.getShort("Fuse");
}
public void onDataWatcherUpdate(int i) {
if (i == 5) {
this.fuse = this.getFuseDataWatcher();
}
}
public void setFuse(int fuseIn) {
this.dataWatcher.updateObject(5, Integer.valueOf(fuseIn));
this.fuse = fuseIn;
}
public int getFuseDataWatcher() {
return this.dataWatcher.getWatchableObjectVarint(5);
}
public int getFuse() {
return this.fuse;
}
/**

View File

@ -1,6 +1,7 @@
package net.minecraft.entity.monster;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIBase;
@ -79,7 +80,7 @@ public class EntityBlaze extends EntityMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
/**
@ -200,18 +201,18 @@ public class EntityBlaze extends EntityMob {
}
public boolean func_70845_n() {
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
return (this.dataWatcher.getWatchableObjectByte(11) & 1) != 0;
}
public void setOnFire(boolean onFire) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(11);
if (onFire) {
b0 = (byte) (b0 | 1);
} else {
b0 = (byte) (b0 & -2);
}
this.dataWatcher.updateObject(16, Byte.valueOf(b0));
this.dataWatcher.updateObject(11, Byte.valueOf(b0));
}
/**

View File

@ -2,6 +2,7 @@ package net.minecraft.entity.monster;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DeferredStateManager;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.DynamicLightManager;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIAttackOnCollide;
@ -101,9 +102,9 @@ public class EntityCreeper extends EntityMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) -1));
this.dataWatcher.addObject(17, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Integer.valueOf(-1), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(12, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
this.dataWatcher.addObject(13, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -113,7 +114,7 @@ public class EntityCreeper extends EntityMob {
*/
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
super.writeEntityToNBT(nbttagcompound);
if (this.dataWatcher.getWatchableObjectByte(17) == 1) {
if (this.dataWatcher.getWatchableObjectBoolean(12)) {
nbttagcompound.setBoolean("powered", true);
}
@ -129,7 +130,7 @@ public class EntityCreeper extends EntityMob {
*/
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
super.readEntityFromNBT(nbttagcompound);
this.dataWatcher.updateObject(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0)));
this.dataWatcher.updateObject(12, Boolean.valueOf(nbttagcompound.getBoolean("powered")));
if (nbttagcompound.hasKey("Fuse", 99)) {
this.fuseTime = nbttagcompound.getShort("Fuse");
}
@ -219,7 +220,7 @@ public class EntityCreeper extends EntityMob {
* Returns true if the creeper is powered by a lightning bolt.
*/
public boolean getPowered() {
return this.dataWatcher.getWatchableObjectByte(17) == 1;
return this.dataWatcher.getWatchableObjectByte(12) == 1;
}
/**
@ -242,7 +243,7 @@ public class EntityCreeper extends EntityMob {
* fuse'
*/
public int getCreeperState() {
return this.dataWatcher.getWatchableObjectByte(16);
return this.dataWatcher.getWatchableObjectVarint(11);
}
/**
@ -250,7 +251,7 @@ public class EntityCreeper extends EntityMob {
* Sets the state of creeper, -1 to idle and 1 to be 'in fuse'
*/
public void setCreeperState(int state) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) state));
this.dataWatcher.updateObject(11, Integer.valueOf(state));
}
/**
@ -259,7 +260,7 @@ public class EntityCreeper extends EntityMob {
*/
public void onStruckByLightning(EntityLightningBolt entitylightningbolt) {
super.onStruckByLightning(entitylightningbolt);
this.dataWatcher.updateObject(17, Byte.valueOf((byte) 1));
this.dataWatcher.updateObject(12, Boolean.valueOf(true));
}
/**
@ -300,11 +301,11 @@ public class EntityCreeper extends EntityMob {
}
public boolean hasIgnited() {
return this.dataWatcher.getWatchableObjectByte(18) != 0;
return this.dataWatcher.getWatchableObjectBoolean(13);
}
public void ignite() {
this.dataWatcher.updateObject(18, Byte.valueOf((byte) 1));
this.dataWatcher.updateObject(13, Boolean.valueOf(true));
}
/**

View File

@ -1,15 +1,20 @@
package net.minecraft.entity.monster;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.Sets;
import java.util.Collections;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import java.util.Set;
import javax.annotation.Nullable;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
@ -107,9 +112,8 @@ public class EntityEnderman extends EntityMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Short.valueOf((short) 0));
this.dataWatcher.addObject(17, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Optional.<IBlockState>absent(), DataWatcher.Types.OPTIONAL_BLOCK_STATE);
this.dataWatcher.addObject(12, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -348,16 +352,19 @@ public class EntityEnderman extends EntityMob {
* +
* Sets this enderman's held block state
*/
public void setHeldBlockState(IBlockState state) {
this.dataWatcher.updateObject(16, Short.valueOf((short) (Block.getStateId(state) & '\uffff')));
public void setHeldBlockState(@Nullable IBlockState state) {
this.dataWatcher.updateObject(11, Optional.fromNullable(state));
}
/**
* +
* Gets this enderman's held block state
*/
@Nullable
public IBlockState getHeldBlockState() {
return Block.getStateById(this.dataWatcher.getWatchableObjectShort(16) & '\uffff');
// ! fix this
return Blocks.air.getDefaultState();
// return this.dataWatcher.getWatchableObjectBlockState(11).orNull();
}
/**
@ -405,11 +412,11 @@ public class EntityEnderman extends EntityMob {
}
public boolean isScreaming() {
return this.dataWatcher.getWatchableObjectByte(18) > 0;
return this.dataWatcher.getWatchableObjectBoolean(12);
}
public void setScreaming(boolean screaming) {
this.dataWatcher.updateObject(18, Byte.valueOf((byte) (screaming ? 1 : 0)));
this.dataWatcher.updateObject(12, Boolean.valueOf(screaming));
}
public static void bootstrap() {

View File

@ -1,6 +1,7 @@
package net.minecraft.entity.monster;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityFlying;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
@ -70,11 +71,11 @@ public class EntityGhast extends EntityFlying implements IMob {
}
public boolean isAttacking() {
return this.dataWatcher.getWatchableObjectByte(16) != 0;
return this.dataWatcher.getWatchableObjectBoolean(11);
}
public void setAttacking(boolean parFlag) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (parFlag ? 1 : 0)));
this.dataWatcher.updateObject(11, Boolean.valueOf(parFlag));
}
public int getFireballStrength() {
@ -112,7 +113,7 @@ public class EntityGhast extends EntityFlying implements IMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
protected void applyEntityAttributes() {

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.google.common.base.Predicate;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
@ -136,8 +137,8 @@ public class EntityGuardian extends EntityMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Integer.valueOf(0));
this.dataWatcher.addObject(17, Integer.valueOf(0));
this.dataWatcher.addObject(11, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
this.dataWatcher.addObject(12, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
/**
@ -145,7 +146,7 @@ public class EntityGuardian extends EntityMob {
* Returns true if given flag is set
*/
private boolean isSyncedFlagSet(int flagId) {
return (this.dataWatcher.getWatchableObjectInt(16) & flagId) != 0;
return (this.dataWatcher.getWatchableObjectByte(11) & flagId) != 0;
}
/**
@ -154,11 +155,11 @@ public class EntityGuardian extends EntityMob {
* using DataWatcher
*/
private void setSyncedFlag(int flagId, boolean state) {
int i = this.dataWatcher.getWatchableObjectInt(16);
int i = this.dataWatcher.getWatchableObjectByte(11);
if (state) {
this.dataWatcher.updateObject(16, Integer.valueOf(i | flagId));
this.dataWatcher.updateObject(11, Integer.valueOf(i | flagId));
} else {
this.dataWatcher.updateObject(16, Integer.valueOf(i & ~flagId));
this.dataWatcher.updateObject(1, Integer.valueOf(i & ~flagId));
}
}
@ -206,11 +207,11 @@ public class EntityGuardian extends EntityMob {
}
private void setTargetedEntity(int entityId) {
this.dataWatcher.updateObject(17, Integer.valueOf(entityId));
this.dataWatcher.updateObject(12, Integer.valueOf(entityId));
}
public boolean hasTargetedEntity() {
return this.dataWatcher.getWatchableObjectInt(17) != 0;
return this.dataWatcher.getWatchableObjectVarint(12) != 0;
}
public EntityLivingBase getTargetedEntity() {
@ -220,7 +221,7 @@ public class EntityGuardian extends EntityMob {
if (this.targetedEntity != null) {
return this.targetedEntity;
} else {
Entity entity = this.worldObj.getEntityByID(this.dataWatcher.getWatchableObjectInt(17));
Entity entity = this.worldObj.getEntityByID(this.dataWatcher.getWatchableObjectVarint(12));
if (entity instanceof EntityLivingBase) {
this.targetedEntity = (EntityLivingBase) entity;
return this.targetedEntity;
@ -243,7 +244,6 @@ public class EntityGuardian extends EntityMob {
this.field_175479_bo = 0;
this.targetedEntity = null;
}
}
/**

View File

@ -5,6 +5,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockFlower;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLiving;
@ -89,7 +90,7 @@ public class EntityIronGolem extends EntityGolem {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
protected void updateAITasks() {
@ -277,15 +278,15 @@ public class EntityIronGolem extends EntityGolem {
}
public boolean isPlayerCreated() {
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
return (this.dataWatcher.getWatchableObjectByte(11) & 1) != 0;
}
public void setPlayerCreated(boolean parFlag) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(1);
if (parFlag) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1)));
this.dataWatcher.updateObject(11, Byte.valueOf((byte) (b0 | 1)));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2)));
this.dataWatcher.updateObject(11, Byte.valueOf((byte) (b0 & -2)));
}
}

View File

@ -4,6 +4,7 @@ import java.util.Calendar;
import net.minecraft.block.Block;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
@ -98,7 +99,8 @@ public class EntitySkeleton extends EntityMob implements IRangedAttackMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(13, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(12, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -358,7 +360,7 @@ public class EntitySkeleton extends EntityMob implements IRangedAttackMob {
* Return this skeleton's type.
*/
public int getSkeletonType() {
return this.dataWatcher.getWatchableObjectByte(13);
return this.dataWatcher.getWatchableObjectVarint(11);
}
/**
@ -366,7 +368,7 @@ public class EntitySkeleton extends EntityMob implements IRangedAttackMob {
* Set this skeleton's type.
*/
public void setSkeletonType(int parInt1) {
this.dataWatcher.updateObject(13, Byte.valueOf((byte) parInt1));
this.dataWatcher.updateObject(11, Integer.valueOf(parInt1));
this.isImmuneToFire = parInt1 == 1;
if (parInt1 == 1) {
this.setSize(0.72F, 2.535F);
@ -425,4 +427,13 @@ public class EntitySkeleton extends EntityMob implements IRangedAttackMob {
public double getYOffset() {
return this.isChild() ? 0.0D : -0.35D;
}
// TODO: implement offhand
public boolean isSwingingArms() {
return this.dataWatcher.getWatchableObjectBoolean(12);
}
public void setSwingingArms(boolean swingingArms) {
this.dataWatcher.updateObject(12, Boolean.valueOf(swingingArms));
}
}

View File

@ -1,5 +1,6 @@
package net.minecraft.entity.monster;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -73,11 +74,11 @@ public class EntitySlime extends EntityLiving implements IMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 1));
this.dataWatcher.addObject(11, Integer.valueOf(1), DataWatcher.Types.VARINT);
}
protected void setSlimeSize(int size) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) size));
this.dataWatcher.updateObject(11, Integer.valueOf(size));
this.setSize(0.51000005F * (float) size, 0.51000005F * (float) size);
this.setPosition(this.posX, this.posY, this.posZ);
this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue((double) (size * size));
@ -92,7 +93,7 @@ public class EntitySlime extends EntityLiving implements IMob {
* Returns the size of the slime.
*/
public int getSlimeSize() {
return this.dataWatcher.getWatchableObjectByte(16);
return this.dataWatcher.getWatchableObjectVarint(11);
}
/**

View File

@ -2,6 +2,7 @@ package net.minecraft.entity.monster;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.Block;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.EnumCreatureAttribute;
@ -91,7 +92,7 @@ public class EntitySpider extends EntityMob {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(11, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
/**
@ -190,7 +191,7 @@ public class EntitySpider extends EntityMob {
* setBesideClimableBlock.
*/
public boolean isBesideClimbableBlock() {
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
return (this.dataWatcher.getWatchableObjectByte(11) & 1) != 0;
}
/**
@ -199,14 +200,14 @@ public class EntitySpider extends EntityMob {
* setting it to 0x01 if par1 is true or 0x00 if it is false.
*/
public void setBesideClimbableBlock(boolean parFlag) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(11);
if (parFlag) {
b0 = (byte) (b0 | 1);
} else {
b0 = (byte) (b0 & -2);
}
this.dataWatcher.updateObject(16, Byte.valueOf(b0));
this.dataWatcher.updateObject(11, Byte.valueOf(b0));
}
/**

View File

@ -3,6 +3,7 @@ package net.minecraft.entity.monster;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.SharedMonsterAttributes;
@ -83,7 +84,7 @@ public class EntityWitch extends EntityMob implements IRangedAttackMob {
protected void entityInit() {
super.entityInit();
this.getDataWatcher().addObject(21, Byte.valueOf((byte) 0));
this.getDataWatcher().addObject(11, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -115,7 +116,7 @@ public class EntityWitch extends EntityMob implements IRangedAttackMob {
* Set whether this witch is aggressive at an entity.
*/
public void setAggressive(boolean aggressive) {
this.getDataWatcher().updateObject(21, Byte.valueOf((byte) (aggressive ? 1 : 0)));
this.getDataWatcher().updateObject(11, Boolean.valueOf(aggressive));
}
/**
@ -123,7 +124,7 @@ public class EntityWitch extends EntityMob implements IRangedAttackMob {
* Return whether this witch is aggressive at an entity.
*/
public boolean getAggressive() {
return this.getDataWatcher().getWatchableObjectByte(21) == 1;
return this.getDataWatcher().getWatchableObjectBoolean(11);
}
protected void applyEntityAttributes() {

View File

@ -4,6 +4,7 @@ import java.util.Calendar;
import java.util.List;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
@ -128,9 +129,18 @@ public class EntityZombie extends EntityMob {
protected void entityInit() {
super.entityInit();
this.getDataWatcher().addObject(12, Byte.valueOf((byte) 0));
this.getDataWatcher().addObject(13, Byte.valueOf((byte) 0));
this.getDataWatcher().addObject(14, Byte.valueOf((byte) 0));
this.getDataWatcher().addObject(11, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
this.getDataWatcher().addObject(12, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.getDataWatcher().addObject(13, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
this.getDataWatcher().addObject(14, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
public void setArmsRaised(boolean armsRaised) {
this.getDataWatcher().updateObject(14, Boolean.valueOf(armsRaised));
}
public boolean isArmsRaised() {
return this.getDataWatcher().getWatchableObjectBoolean(14);
}
/**
@ -172,7 +182,7 @@ public class EntityZombie extends EntityMob {
* If Animal, checks if the age timer is negative
*/
public boolean isChild() {
return this.getDataWatcher().getWatchableObjectByte(12) == 1;
return this.getDataWatcher().getWatchableObjectBoolean(11);
}
/**
@ -192,7 +202,7 @@ public class EntityZombie extends EntityMob {
* Set whether this zombie is a child.
*/
public void setChild(boolean childZombie) {
this.getDataWatcher().updateObject(12, Byte.valueOf((byte) (childZombie ? 1 : 0)));
this.getDataWatcher().updateObject(11, Boolean.valueOf(childZombie));
if (this.worldObj != null && !this.worldObj.isRemote) {
IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
iattributeinstance.removeModifier(babySpeedBoostModifier);
@ -208,8 +218,9 @@ public class EntityZombie extends EntityMob {
* +
* Return whether this zombie is a villager.
*/
// TODO: implement profession
public boolean isVillager() {
return this.getDataWatcher().getWatchableObjectByte(13) == 1;
return this.getDataWatcher().getWatchableObjectVarint(12) > 0;
}
/**
@ -217,7 +228,7 @@ public class EntityZombie extends EntityMob {
* Set whether this zombie is a villager.
*/
public void setVillager(boolean villager) {
this.getDataWatcher().updateObject(13, Byte.valueOf((byte) (villager ? 1 : 0)));
this.getDataWatcher().updateObject(12, Integer.valueOf(villager ? 1 : 0));
}
/**
@ -620,7 +631,7 @@ public class EntityZombie extends EntityMob {
*/
protected void startConversion(int ticks) {
this.conversionTime = ticks;
this.getDataWatcher().updateObject(14, Byte.valueOf((byte) 1));
this.getDataWatcher().updateObject(13, Boolean.valueOf(true));
this.removePotionEffect(Potion.weakness.id);
this.addPotionEffect(new PotionEffect(Potion.damageBoost.id, ticks,
Math.min(this.worldObj.getDifficulty().getDifficultyId() - 1, 0)));
@ -654,7 +665,7 @@ public class EntityZombie extends EntityMob {
* to a villager
*/
public boolean isConverting() {
return this.getDataWatcher().getWatchableObjectByte(14) == 1;
return this.getDataWatcher().getWatchableObjectBoolean(13);
}
/**

View File

@ -2,6 +2,7 @@ package net.minecraft.entity.passive;
import java.util.Calendar;
import net.minecraft.block.Block;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
@ -51,7 +52,7 @@ public class EntityBat extends EntityAmbientCreature {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(10, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
/**
@ -115,15 +116,15 @@ public class EntityBat extends EntityAmbientCreature {
}
public boolean getIsBatHanging() {
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
return (this.dataWatcher.getWatchableObjectByte(10) & 1) != 0;
}
public void setIsBatHanging(boolean isHanging) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(10);
if (isHanging) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1)));
this.dataWatcher.updateObject(10, Byte.valueOf((byte) (b0 | 1)));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2)));
this.dataWatcher.updateObject(10, Byte.valueOf((byte) (b0 & -2)));
}
}
@ -241,7 +242,7 @@ public class EntityBat extends EntityAmbientCreature {
*/
public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
super.readEntityFromNBT(nbttagcompound);
this.dataWatcher.updateObject(16, Byte.valueOf(nbttagcompound.getByte("BatFlags")));
this.dataWatcher.updateObject(10, Byte.valueOf(nbttagcompound.getByte("BatFlags")));
}
/**
@ -251,7 +252,7 @@ public class EntityBat extends EntityAmbientCreature {
*/
public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
super.writeEntityToNBT(nbttagcompound);
nbttagcompound.setByte("BatFlags", this.dataWatcher.getWatchableObjectByte(16));
nbttagcompound.setByte("BatFlags", this.dataWatcher.getWatchableObjectByte(10));
}
/**

View File

@ -2,11 +2,16 @@ package net.minecraft.entity.passive;
import java.util.List;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.sp.SingleplayerServerController;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
@ -137,15 +142,15 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Integer.valueOf(0));
this.dataWatcher.addObject(19, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(20, Integer.valueOf(0));
this.dataWatcher.addObject(21, String.valueOf(""));
this.dataWatcher.addObject(22, Integer.valueOf(0));
this.dataWatcher.addObject(12, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
this.dataWatcher.addObject(13, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(14, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(15, Optional.<EaglercraftUUID>absent(), DataWatcher.Types.OPTIONAL_UNIQUE_ID);
this.dataWatcher.addObject(16, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
public void setHorseType(int type) {
this.dataWatcher.updateObject(19, Byte.valueOf((byte) type));
this.dataWatcher.updateObject(13, Integer.valueOf(type));
this.resetTexturePrefix();
}
@ -155,16 +160,16 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
* Undead Horse, 4 = Skeleton Horse
*/
public int getHorseType() {
return this.dataWatcher.getWatchableObjectByte(19);
return this.dataWatcher.getWatchableObjectVarint(13);
}
public void setHorseVariant(int variant) {
this.dataWatcher.updateObject(20, Integer.valueOf(variant));
this.dataWatcher.updateObject(14, Integer.valueOf(variant));
this.resetTexturePrefix();
}
public int getHorseVariant() {
return this.dataWatcher.getWatchableObjectInt(20);
return this.dataWatcher.getWatchableObjectVarint(14);
}
/**
@ -194,15 +199,15 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
}
private boolean getHorseWatchableBoolean(int parInt1) {
return (this.dataWatcher.getWatchableObjectInt(16) & parInt1) != 0;
return (this.dataWatcher.getWatchableObjectByte(12) & parInt1) != 0;
}
private void setHorseWatchableBoolean(int parInt1, boolean parFlag) {
int i = this.dataWatcher.getWatchableObjectInt(16);
int i = this.dataWatcher.getWatchableObjectByte(12);
if (parFlag) {
this.dataWatcher.updateObject(16, Integer.valueOf(i | parInt1));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (i | parInt1)));
} else {
this.dataWatcher.updateObject(16, Integer.valueOf(i & ~parInt1));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (i & ~parInt1)));
}
}
@ -223,12 +228,13 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
* +
* Gets the horse's owner
*/
public String getOwnerId() {
return this.dataWatcher.getWatchableObjectString(21);
@Nullable
public EaglercraftUUID getOwnerId() {
return this.dataWatcher.getWatchableObjectOptionalUniqueId(15).orNull();
}
public void setOwnerId(String id) {
this.dataWatcher.updateObject(21, id);
public void setOwnerId(@Nullable EaglercraftUUID id) {
this.dataWatcher.updateObject(15, Optional.fromNullable(id));
}
public float getHorseSize() {
@ -282,7 +288,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
* = diamond)
*/
public int getHorseArmorIndexSynced() {
return this.dataWatcher.getWatchableObjectInt(22);
return this.dataWatcher.getWatchableObjectVarint(16);
}
/**
@ -321,7 +327,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
* ItemStack(Items.iron_horse_armor))
*/
public void setHorseArmorStack(ItemStack itemStackIn) {
this.dataWatcher.updateObject(22, Integer.valueOf(this.getHorseArmorIndex(itemStackIn)));
this.dataWatcher.updateObject(16, Integer.valueOf(this.getHorseArmorIndex(itemStackIn)));
this.resetTexturePrefix();
}
@ -1140,7 +1146,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
}
public boolean setTamedBy(EntityPlayer player) {
this.setOwnerId(player.getUniqueID().toString());
this.setOwnerId(player.getUniqueID());
this.setHorseTamed(true);
return true;
}
@ -1234,9 +1240,9 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
nbttagcompound.setInteger("Temper", this.getTemper());
nbttagcompound.setBoolean("Tame", this.isTame());
if (worldObj.isRemote && !SingleplayerServerController.isClientInEaglerSingleplayerOrLAN()) {
nbttagcompound.setString("OwnerUUID", this.getOwnerId());
nbttagcompound.setString("OwnerUUID", this.getOwnerId().toString());
} else {
nbttagcompound.setString("Owner", this.getOwnerId());
nbttagcompound.setString("Owner", this.getOwnerId().toString());
}
if (this.isChested()) {
NBTTagList nbttaglist = new NBTTagList();
@ -1291,7 +1297,7 @@ public class EntityHorse extends EntityAnimal implements IInvBasic {
}
if (s.length() > 0) {
this.setOwnerId(s);
this.setOwnerId(EaglercraftUUID.fromString(s));
}
IAttributeInstance iattributeinstance = this.getAttributeMap().getAttributeInstanceByName("Speed");

View File

@ -3,6 +3,7 @@ package net.minecraft.entity.passive;
import com.google.common.base.Predicate;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.IEntityLivingData;
@ -83,7 +84,7 @@ public class EntityOcelot extends EntityTameable {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(14, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
public void updateAITasks() {
@ -231,7 +232,7 @@ public class EntityOcelot extends EntityTameable {
if (this.rand.nextInt(3) == 0) {
this.setTamed(true);
this.setTameSkin(1 + this.worldObj.rand.nextInt(3));
this.setOwnerId(entityplayer.getUniqueID().toString());
this.setOwnerId(entityplayer.getUniqueID());
this.playTameEffect(true);
this.aiSit.setSitting(true);
this.worldObj.setEntityState(this, (byte) 7);
@ -287,11 +288,11 @@ public class EntityOcelot extends EntityTameable {
}
public int getTameSkin() {
return this.dataWatcher.getWatchableObjectByte(18);
return this.dataWatcher.getWatchableObjectVarint(14);
}
public void setTameSkin(int skinId) {
this.dataWatcher.updateObject(18, Byte.valueOf((byte) skinId));
this.dataWatcher.updateObject(14, Integer.valueOf(skinId));
}
/**

View File

@ -2,6 +2,7 @@ package net.minecraft.entity.passive;
import net.hoosiertransfer.EaglerItems;
import net.minecraft.block.Block;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.EntityAIControlledByPlayer;
@ -93,7 +94,7 @@ public class EntityPig extends EntityAnimal {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(12, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -191,7 +192,7 @@ public class EntityPig extends EntityAnimal {
* Returns true if the pig is saddled.
*/
public boolean getSaddled() {
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
return this.dataWatcher.getWatchableObjectBoolean(12);
}
/**
@ -200,11 +201,10 @@ public class EntityPig extends EntityAnimal {
*/
public void setSaddled(boolean saddled) {
if (saddled) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) 1));
this.dataWatcher.updateObject(12, Boolean.valueOf(true));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.updateObject(12, Boolean.valueOf(false));
}
}
/**

View File

@ -3,6 +3,7 @@ package net.minecraft.entity.passive;
import net.minecraft.block.Block;
import net.minecraft.block.BlockCarrot;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
@ -145,7 +146,7 @@ public class EntityRabbit extends EntityAnimal {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(18, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(12, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
public void updateAITasks() {
@ -393,7 +394,7 @@ public class EntityRabbit extends EntityAnimal {
}
public int getRabbitType() {
return this.dataWatcher.getWatchableObjectByte(18);
return this.dataWatcher.getWatchableObjectVarint(12);
}
public void setRabbitType(int rabbitTypeId) {
@ -408,7 +409,7 @@ public class EntityRabbit extends EntityAnimal {
}
}
this.dataWatcher.updateObject(18, Byte.valueOf((byte) rabbitTypeId));
this.dataWatcher.updateObject(12, Integer.valueOf(rabbitTypeId));
}
/**

View File

@ -4,6 +4,7 @@ import com.google.common.collect.Maps;
import java.util.Map;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.Block;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
@ -126,7 +127,7 @@ public class EntitySheep extends EntityAnimal {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(12, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
/**
@ -264,7 +265,7 @@ public class EntitySheep extends EntityAnimal {
* Gets the wool color of this sheep.
*/
public EnumDyeColor getFleeceColor() {
return EnumDyeColor.byMetadata(this.dataWatcher.getWatchableObjectByte(16) & 15);
return EnumDyeColor.byMetadata(this.dataWatcher.getWatchableObjectByte(12) & 15);
}
/**
@ -272,8 +273,8 @@ public class EntitySheep extends EntityAnimal {
* Sets the wool color of this sheep
*/
public void setFleeceColor(EnumDyeColor color) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & 240 | color.getMetadata() & 15)));
byte b0 = this.dataWatcher.getWatchableObjectByte(12);
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 & 240 | color.getMetadata() & 15)));
}
/**
@ -281,7 +282,7 @@ public class EntitySheep extends EntityAnimal {
* returns true if a sheeps wool has been sheared
*/
public boolean getSheared() {
return (this.dataWatcher.getWatchableObjectByte(16) & 16) != 0;
return (this.dataWatcher.getWatchableObjectByte(12) & 16) != 0;
}
/**
@ -289,11 +290,11 @@ public class EntitySheep extends EntityAnimal {
* make a sheep sheared if set to true
*/
public void setSheared(boolean sheared) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(12);
if (sheared) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 16)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 | 16)));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -17)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 & -17)));
}
}

View File

@ -1,7 +1,12 @@
package net.minecraft.entity.passive;
import javax.annotation.Nullable;
import com.google.common.base.Optional;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.sp.SingleplayerServerController;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IEntityOwnable;
import net.minecraft.entity.ai.EntityAISit;
@ -52,8 +57,8 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(17, "");
this.dataWatcher.addObject(12, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
this.dataWatcher.addObject(13, Optional.<EaglercraftUUID>absent(), DataWatcher.Types.OPTIONAL_UNIQUE_ID);
}
/**
@ -67,13 +72,13 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
if (this.getOwnerId() == null) {
nbttagcompound.setString("OwnerUUID", "");
} else {
nbttagcompound.setString("OwnerUUID", this.getOwnerId());
nbttagcompound.setString("OwnerUUID", this.getOwnerId().toString());
}
} else {
if (this.getOwnerId() == null) {
nbttagcompound.setString("Owner", "");
} else {
nbttagcompound.setString("Owner", this.getOwnerId());
nbttagcompound.setString("Owner", this.getOwnerId().toString());
}
}
@ -99,7 +104,7 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
}
if (s.length() > 0) {
this.setOwnerId(s);
this.setOwnerId(EaglercraftUUID.fromString(s));
this.setTamed(true);
}
@ -143,15 +148,15 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
}
public boolean isTamed() {
return (this.dataWatcher.getWatchableObjectByte(16) & 4) != 0;
return (this.dataWatcher.getWatchableObjectByte(12) & 4) != 0;
}
public void setTamed(boolean tamed) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(12);
if (tamed) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 4)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 | 4)));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -5)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 & -5)));
}
this.setupTamedAI();
@ -161,30 +166,31 @@ public abstract class EntityTameable extends EntityAnimal implements IEntityOwna
}
public boolean isSitting() {
return (this.dataWatcher.getWatchableObjectByte(16) & 1) != 0;
return (this.dataWatcher.getWatchableObjectByte(12) & 1) != 0;
}
public void setSitting(boolean sitting) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
if (sitting) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 | 1)));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 & -2)));
}
}
public String getOwnerId() {
return this.dataWatcher.getWatchableObjectString(17);
@Nullable
public EaglercraftUUID getOwnerId() {
return this.dataWatcher.getWatchableObjectOptionalUniqueId(13).orNull();
}
public void setOwnerId(String ownerUuid) {
this.dataWatcher.updateObject(17, ownerUuid);
public void setOwnerId(@Nullable EaglercraftUUID ownerUuid) {
this.dataWatcher.updateObject(13, ownerUuid);
}
public EntityLivingBase getOwner() {
try {
EaglercraftUUID uuid = EaglercraftUUID.fromString(this.getOwnerId());
EaglercraftUUID uuid = this.getOwnerId();
return uuid == null ? null : this.worldObj.getPlayerEntityByUUID(uuid);
} catch (IllegalArgumentException var2) {
return null;

View File

@ -7,6 +7,7 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentData;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLiving;
@ -448,7 +449,7 @@ public class EntityVillager extends EntityAgeable implements IMerchant, INpc {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Integer.valueOf(0));
this.dataWatcher.addObject(12, Integer.valueOf(0), DataWatcher.Types.VARINT);
}
/**
@ -547,11 +548,11 @@ public class EntityVillager extends EntityAgeable implements IMerchant, INpc {
}
public void setProfession(int professionId) {
this.dataWatcher.updateObject(16, Integer.valueOf(professionId));
this.dataWatcher.updateObject(12, Integer.valueOf(professionId));
}
public int getProfession() {
return Math.max(this.dataWatcher.getWatchableObjectInt(16) % 5, 0);
return Math.max(this.dataWatcher.getWatchableObjectVarint(12) % 5, 0);
}
public boolean isMating() {

View File

@ -1,7 +1,10 @@
package net.minecraft.entity.passive;
import com.google.common.base.Predicate;
import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.minecraft.block.Block;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityAgeable;
import net.minecraft.entity.EntityLivingBase;
@ -135,9 +138,9 @@ public class EntityWolf extends EntityTameable {
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(18, Float.valueOf(this.getHealth()));
this.dataWatcher.addObject(19, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(20, Byte.valueOf((byte) EnumDyeColor.RED.getMetadata()));
this.dataWatcher.addObject(14, Float.valueOf(this.getHealth()), DataWatcher.Types.FLOAT);
this.dataWatcher.addObject(15, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
this.dataWatcher.addObject(16, Integer.valueOf(EnumDyeColor.RED.getMetadata()), DataWatcher.Types.VARINT);
}
protected void playStepSound(BlockPos var1, Block var2) {
@ -176,7 +179,7 @@ public class EntityWolf extends EntityTameable {
protected String getLivingSound() {
return this.isAngry() ? "mob.wolf.growl"
: (this.rand.nextInt(3) == 0
? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(18) < 10.0F ? "mob.wolf.whine"
? (this.isTamed() && this.dataWatcher.getWatchableObjectFloat(14) < 10.0F ? "mob.wolf.whine"
: "mob.wolf.panting")
: "mob.wolf.bark");
}
@ -378,7 +381,7 @@ public class EntityWolf extends EntityTameable {
if (itemstack != null) {
if (itemstack.getItem() instanceof ItemFood) {
ItemFood itemfood = (ItemFood) itemstack.getItem();
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) {
if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(14) < 20.0F) {
if (!entityplayer.capabilities.isCreativeMode) {
--itemstack.stackSize;
}
@ -427,7 +430,7 @@ public class EntityWolf extends EntityTameable {
this.setAttackTarget((EntityLivingBase) null);
this.aiSit.setSitting(true);
this.setHealth(20.0F);
this.setOwnerId(entityplayer.getUniqueID().toString());
this.setOwnerId(entityplayer.getUniqueID());
this.playTameEffect(true);
this.worldObj.setEntityState(this, (byte) 7);
} else {
@ -456,7 +459,7 @@ public class EntityWolf extends EntityTameable {
public float getTailRotation() {
return this.isAngry() ? 1.5393804F
: (this.isTamed()
? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(18)) * 0.02F) * 3.1415927F
? (0.55F - (20.0F - this.dataWatcher.getWatchableObjectFloat(14)) * 0.02F) * 3.1415927F
: 0.62831855F);
}
@ -485,7 +488,7 @@ public class EntityWolf extends EntityTameable {
* Determines whether this wolf is angry or not.
*/
public boolean isAngry() {
return (this.dataWatcher.getWatchableObjectByte(16) & 2) != 0;
return (this.dataWatcher.getWatchableObjectByte(12) & 2) != 0;
}
/**
@ -493,17 +496,17 @@ public class EntityWolf extends EntityTameable {
* Sets whether this wolf is angry or not.
*/
public void setAngry(boolean angry) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(12);
if (angry) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 2)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 | 2)));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -3)));
this.dataWatcher.updateObject(12, Byte.valueOf((byte) (b0 & -3)));
}
}
public EnumDyeColor getCollarColor() {
return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectByte(20) & 15);
return EnumDyeColor.byDyeDamage(this.dataWatcher.getWatchableObjectVarint(16) & 15);
}
public void setCollarColor(EnumDyeColor collarcolor) {
@ -512,9 +515,10 @@ public class EntityWolf extends EntityTameable {
public EntityWolf createChild(EntityAgeable var1) {
EntityWolf entitywolf = new EntityWolf(this.worldObj);
String s = this.getOwnerId();
if (s != null && s.trim().length() > 0) {
entitywolf.setOwnerId(s);
EaglercraftUUID uuid = this.getOwnerId();
if (uuid != null) {
entitywolf.setOwnerId(uuid);
entitywolf.setTamed(true);
}
@ -523,9 +527,9 @@ public class EntityWolf extends EntityTameable {
public void setBegging(boolean beg) {
if (beg) {
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
this.dataWatcher.updateObject(15, Boolean.valueOf(true));
} else {
this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
this.dataWatcher.updateObject(15, Boolean.valueOf(false));
}
}
@ -550,7 +554,7 @@ public class EntityWolf extends EntityTameable {
}
public boolean isBegging() {
return this.dataWatcher.getWatchableObjectByte(19) == 1;
return this.dataWatcher.getWatchableObjectBoolean(15);
}
/**

View File

@ -70,6 +70,7 @@ import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.FoodStats;
import net.minecraft.util.IChatComponent;
@ -80,6 +81,7 @@ import net.minecraft.world.IInteractionObject;
import net.minecraft.world.LockCode;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings;
import net.minecraft.entity.DataWatcher;
/**
* +
@ -179,14 +181,24 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
super.applyEntityAttributes();
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.10000000149011612D);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.ATTACK_SPEED);
this.getAttributeMap().registerAttribute(SharedMonsterAttributes.LUCK);
}
protected void entityInit() {
super.entityInit();
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(17, Float.valueOf(0.0F));
this.dataWatcher.addObject(18, Integer.valueOf(0));
this.dataWatcher.addObject(10, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(10, Float.valueOf(0.0F), DataWatcher.Types.FLOAT);
this.dataWatcher.addObject(11, Integer.valueOf(0), DataWatcher.Types.VARINT);
this.dataWatcher.addObject(12, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
this.dataWatcher.addObject(13, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE); // TODO: implement offhand
}
public EnumHandSide getPrimaryHand() {
return this.dataWatcher.getWatchableObjectByte(13) == 0 ? EnumHandSide.LEFT : EnumHandSide.RIGHT;
}
public void setPrimaryHand(EnumHandSide hand) {
this.dataWatcher.updateObject(13, Byte.valueOf((byte) (hand == EnumHandSide.LEFT ? 0 : 1)));
}
/**
@ -633,7 +645,7 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
}
public int getScore() {
return this.dataWatcher.getWatchableObjectInt(18);
return this.dataWatcher.getWatchableObjectVarint(11);
}
/**
@ -641,7 +653,7 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
* Set player's score
*/
public void setScore(int parInt1) {
this.dataWatcher.updateObject(18, Integer.valueOf(parInt1));
this.dataWatcher.updateObject(11, Integer.valueOf(parInt1));
}
/**
@ -650,7 +662,7 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
*/
public void addScore(int parInt1) {
int i = this.getScore();
this.dataWatcher.updateObject(18, Integer.valueOf(i + parInt1));
this.dataWatcher.updateObject(11, Integer.valueOf(i + parInt1));
}
/**
@ -1949,7 +1961,7 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
this.xpSeed = entityplayer.xpSeed;
this.theInventoryEnderChest = entityplayer.theInventoryEnderChest;
this.getDataWatcher().updateObject(10, Byte.valueOf(entityplayer.getDataWatcher().getWatchableObjectByte(10)));
this.getDataWatcher().updateObject(12, Byte.valueOf(entityplayer.getDataWatcher().getWatchableObjectByte(12)));
}
/**
@ -2096,11 +2108,11 @@ public abstract class EntityPlayer extends EntityLivingBase implements ICommandS
f = 0.0F;
}
this.getDataWatcher().updateObject(17, Float.valueOf(f));
this.getDataWatcher().updateObject(10, Float.valueOf(f));
}
public float getAbsorptionAmount() {
return this.getDataWatcher().getWatchableObjectFloat(17);
return this.getDataWatcher().getWatchableObjectFloat(10);
}
/**

View File

@ -5,6 +5,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.IProjectile;
@ -132,7 +133,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
protected void entityInit() {
this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(5, Byte.valueOf((byte) 0), DataWatcher.Types.BYTE);
}
/**
@ -564,11 +565,11 @@ public class EntityArrow extends Entity implements IProjectile {
* flying behind it.
*/
public void setIsCritical(boolean critical) {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(5);
if (critical) {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1)));
this.dataWatcher.updateObject(5, Byte.valueOf((byte) (b0 | 1)));
} else {
this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2)));
this.dataWatcher.updateObject(5, Byte.valueOf((byte) (b0 & -2)));
}
}
@ -579,7 +580,7 @@ public class EntityArrow extends Entity implements IProjectile {
* flying behind it.
*/
public boolean getIsCritical() {
byte b0 = this.dataWatcher.getWatchableObjectByte(16);
byte b0 = this.dataWatcher.getWatchableObjectByte(5);
return (b0 & 1) != 0;
}
}

View File

@ -2,6 +2,7 @@ package net.minecraft.entity.projectile;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.DataWatcher;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.boss.EntityWither;
import net.minecraft.potion.Potion;
@ -150,7 +151,7 @@ public class EntityWitherSkull extends EntityFireball {
}
protected void entityInit() {
this.dataWatcher.addObject(10, Byte.valueOf((byte) 0));
this.dataWatcher.addObject(5, Boolean.valueOf(false), DataWatcher.Types.BOOLEAN);
}
/**
@ -159,7 +160,7 @@ public class EntityWitherSkull extends EntityFireball {
* wither boss.
*/
public boolean isInvulnerable() {
return this.dataWatcher.getWatchableObjectByte(10) == 1;
return this.dataWatcher.getWatchableObjectBoolean(5);
}
/**
@ -168,6 +169,6 @@ public class EntityWitherSkull extends EntityFireball {
* wither boss.
*/
public void setInvulnerable(boolean invulnerable) {
this.dataWatcher.updateObject(10, Byte.valueOf((byte) (invulnerable ? 1 : 0)));
this.dataWatcher.updateObject(5, Boolean.valueOf(invulnerable));
}
}

View File

@ -3,6 +3,8 @@ package net.minecraft.item;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@ -12,6 +14,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
/**
@ -86,11 +89,20 @@ public class ItemBlock extends Item {
setTileEntityNBT(world, entityplayer, blockpos, itemstack);
this.block.onBlockPlacedBy(world, blockpos, iblockstate1, entityplayer, itemstack);
}
world.playSoundEffect((double) ((float) blockpos.getX() + 0.5F),
(double) ((float) blockpos.getY() + 0.5F), (double) ((float) blockpos.getZ() + 0.5F),
this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F,
this.block.stepSound.getFrequency() * 0.8F);
System.out.println(
"Placed block at " + blockpos.getX() + ", " + blockpos.getY() + ", " + blockpos.getZ());
// ! fix sounds
// world.playSoundEffect((double) ((float) blockpos.getX() + 0.5F),
// (double) ((float) blockpos.getY() + 0.5F), (double) ((float) blockpos.getZ()
// + 0.5F),
// this.block.stepSound.getPlaceSound(), (this.block.stepSound.getVolume() +
// 1.0F) / 2.0F,
// this.block.stepSound.getFrequency() * 0.8F);
Minecraft.getMinecraft().getSoundHandler()
.playSound(new PositionedSoundRecord(new ResourceLocation(block.stepSound.getPlaceSound()),
(block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getFrequency() * 0.8F,
(float) blockpos.getX() + 0.5F, (float) blockpos.getY() + 0.5F,
(float) blockpos.getZ() + 0.5F));
--itemstack.stackSize;
}

View File

@ -7,6 +7,7 @@ import net.lax1dude.eaglercraft.v1_8.EaglercraftUUID;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.GameProfile;
import net.lax1dude.eaglercraft.v1_8.mojang.authlib.Property;
import net.minecraft.util.BlockPos;
import net.minecraft.util.StringUtils;
/**
@ -175,4 +176,39 @@ public final class NBTUtil {
return parNBTBase.equals(parNBTBase2);
}
}
/**
* Creates a new NBTTagCompound which stores a UUID.
*/
public static NBTTagCompound createUUIDTag(EaglercraftUUID uuid) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setLong("M", uuid.getMostSignificantBits());
nbttagcompound.setLong("L", uuid.getLeastSignificantBits());
return nbttagcompound;
}
/**
* Reads a UUID from the passed NBTTagCompound.
*/
public static EaglercraftUUID getUUIDFromTag(NBTTagCompound tag) {
return new EaglercraftUUID(tag.getLong("M"), tag.getLong("L"));
}
/**
* Creates a BlockPos object from the data stored in the passed NBTTagCompound.
*/
public static BlockPos getPosFromTag(NBTTagCompound tag) {
return new BlockPos(tag.getInteger("X"), tag.getInteger("Y"), tag.getInteger("Z"));
}
/**
* Creates a new NBTTagCompound from a BlockPos.
*/
public static NBTTagCompound createPosTag(BlockPos pos) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
nbttagcompound.setInteger("X", pos.getX());
nbttagcompound.setInteger("Y", pos.getY());
nbttagcompound.setInteger("Z", pos.getZ());
return nbttagcompound;
}
}

View File

@ -90,7 +90,6 @@ import net.minecraft.network.play.server.S2FPacketSetSlot;
import net.minecraft.network.play.server.S30PacketWindowItems;
import net.minecraft.network.play.server.S31PacketWindowProperty;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import net.minecraft.network.play.server.S33PacketUpdateSign;
import net.minecraft.network.play.server.S34PacketMaps;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.network.play.server.S36PacketSignEditorOpen;
@ -112,7 +111,6 @@ 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.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketBossBar;
import net.minecraft.network.play.server.SPacketSetCooldown;
import net.minecraft.network.play.server.SPacketSetPassengers;
@ -231,7 +229,6 @@ public enum EnumConnectionState {
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S05PacketSpawnPosition.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S03PacketTimeUpdate.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S45PacketTitle.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S33PacketUpdateSign.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, SPacketSoundEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S47PacketPlayerListHeaderFooter.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S0DPacketCollectItem.class);
@ -240,7 +237,6 @@ public enum EnumConnectionState {
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S1DPacketEntityEffect.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S46PacketSetCompressionLevel.class);
this.registerPacket(EnumPacketDirection.CLIENTBOUND, S49PacketUpdateEntityNBT.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, CPacketConfirmTeleport.class);
this.registerPacket(EnumPacketDirection.SERVERBOUND, C14PacketTabComplete.class);

View File

@ -48,7 +48,6 @@ import net.minecraft.network.play.server.S2FPacketSetSlot;
import net.minecraft.network.play.server.S30PacketWindowItems;
import net.minecraft.network.play.server.S31PacketWindowProperty;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import net.minecraft.network.play.server.S33PacketUpdateSign;
import net.minecraft.network.play.server.S34PacketMaps;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.network.play.server.S36PacketSignEditorOpen;
@ -70,7 +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.S49PacketUpdateEntityNBT;
import net.minecraft.network.play.server.SPacketSoundEffect;
import net.minecraft.network.play.server.SPacketUnloadChunk;
/**
@ -454,12 +453,6 @@ public interface INetHandlerPlayClient extends INetHandler {
void handleTimeUpdate(S03PacketTimeUpdate var1);
/**
* +
* Updates a specified sign with the specified text lines
*/
void handleUpdateSign(S33PacketUpdateSign var1);
void handleSoundEffect(S29PacketSoundEffect var1);
void handleCollectItem(S0DPacketCollectItem var1);
@ -500,7 +493,7 @@ public interface INetHandlerPlayClient extends INetHandler {
void handleResourcePack(S48PacketResourcePackSend var1);
void handleEntityNBT(S49PacketUpdateEntityNBT var1);
void handleUnloadChunk(SPacketUnloadChunk var1);
void handleSoundEffectNew(SPacketSoundEffect var1);
}

View File

@ -83,6 +83,9 @@ public class C02PacketUseEntity implements Packet<INetHandlerPlayServer> {
parPacketBuffer.writeFloat((float) this.hitVec.zCoord);
}
if (this.action == C02PacketUseEntity.Action.INTERACT || this.action == C02PacketUseEntity.Action.INTERACT_AT) {
parPacketBuffer.writeVarIntToBuffer(0); // TODO: implement offhand
}
}
/**

View File

@ -73,7 +73,7 @@ public class S01PacketJoinGame implements Packet<INetHandlerPlayClient> {
this.hardcoreMode = (i & 8) == 8;
i = i & -9;
this.gameType = WorldSettings.GameType.getByID(i);
this.dimension = parPacketBuffer.readByte();
this.dimension = parPacketBuffer.readInt();
this.difficulty = EnumDifficulty.getDifficultyEnum(parPacketBuffer.readUnsignedByte());
this.maxPlayers = parPacketBuffer.readUnsignedByte();
this.worldType = WorldType.parseWorldType(parPacketBuffer.readStringFromBuffer(16));
@ -96,7 +96,7 @@ public class S01PacketJoinGame implements Packet<INetHandlerPlayClient> {
}
parPacketBuffer.writeByte(i);
parPacketBuffer.writeByte(this.dimension);
parPacketBuffer.writeInt(this.dimension);
parPacketBuffer.writeByte(this.difficulty.getDifficultyId());
parPacketBuffer.writeByte(this.maxPlayers);
parPacketBuffer.writeString(this.worldType.getWorldTypeName());

View File

@ -58,7 +58,7 @@ public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> {
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityID = parPacketBuffer.readVarIntFromBuffer();
this.equipmentSlot = parPacketBuffer.readShort();
this.equipmentSlot = parPacketBuffer.readVarIntFromBuffer();
if (this.equipmentSlot > 0) {
this.equipmentSlot--;
}
@ -71,7 +71,7 @@ public class S04PacketEntityEquipment implements Packet<INetHandlerPlayClient> {
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityID);
parPacketBuffer.writeShort(this.equipmentSlot > 0 ? this.equipmentSlot + 1 : this.equipmentSlot);
parPacketBuffer.writeVarIntToBuffer(this.equipmentSlot > 0 ? this.equipmentSlot + 1 : this.equipmentSlot);
parPacketBuffer.writeItemStackToBuffer(this.itemStack);
}

View File

@ -111,6 +111,7 @@ public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.uniqueId = parPacketBuffer.readUuid();
this.type = parPacketBuffer.readByte() & 255;
this.x = parPacketBuffer.readDouble();
this.y = parPacketBuffer.readDouble();
@ -130,6 +131,7 @@ public class S0FPacketSpawnMob implements Packet<INetHandlerPlayClient> {
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeUuid(this.uniqueId);
parPacketBuffer.writeByte(this.type & 255);
parPacketBuffer.writeDouble(this.x);
parPacketBuffer.writeDouble(this.y);

View File

@ -86,9 +86,7 @@ public class S21PacketChunkData implements Packet<INetHandlerPlayClient> {
this.chunkZ = buf.readInt();
this.loadChunk = buf.readBoolean();
this.availableSections = buf.readVarIntFromBuffer();
System.out.println("Was able to read first varint");
int i = buf.readVarIntFromBuffer();
System.out.println("Was able to read second varint");
if (i > 2097152) {
throw new RuntimeException("Chunk Packet trying to allocate too much memory on read.");
@ -96,7 +94,6 @@ public class S21PacketChunkData implements Packet<INetHandlerPlayClient> {
this.buffer = new byte[i];
buf.readBytes(this.buffer);
int j = buf.readVarIntFromBuffer();
System.out.println("Was able to read third varint");
this.field_189557_e = Lists.<NBTTagCompound>newArrayList();
for (int k = 0; k < j; ++k) {

View File

@ -62,6 +62,8 @@ public class S30PacketWindowItems implements Packet<INetHandlerPlayClient> {
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.windowId = parPacketBuffer.readUnsignedByte();
short short1 = parPacketBuffer.readShort();
if (short1 == 45)
short1 = 44; // TODO: implement offhand
this.itemStacks = new ItemStack[short1];
for (int i = 0; i < short1; ++i) {

View File

@ -1,97 +0,0 @@
package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.util.BlockPos;
import net.minecraft.util.IChatComponent;
import net.minecraft.world.World;
/**
* +
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
*
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
public class S33PacketUpdateSign implements Packet<INetHandlerPlayClient> {
private World world;
private BlockPos blockPos;
private IChatComponent[] lines;
public S33PacketUpdateSign() {
}
public S33PacketUpdateSign(World worldIn, BlockPos blockPosIn, IChatComponent[] linesIn) {
this.world = worldIn;
this.blockPos = blockPosIn;
this.lines = new IChatComponent[] { linesIn[0], linesIn[1], linesIn[2], linesIn[3] };
}
/**
* +
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.blockPos = parPacketBuffer.readBlockPos();
this.lines = new IChatComponent[4];
for (int i = 0; i < 4; ++i) {
this.lines[i] = parPacketBuffer.readChatComponent();
}
}
/**
* +
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeBlockPos(this.blockPos);
for (int i = 0; i < 4; ++i) {
parPacketBuffer.writeChatComponent(this.lines[i]);
}
}
/**
* +
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient inethandlerplayclient) {
inethandlerplayclient.handleUpdateSign(this);
}
public BlockPos getPos() {
return this.blockPos;
}
public IChatComponent[] getLines() {
return this.lines;
}
}

View File

@ -1,88 +0,0 @@
package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.entity.Entity;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.world.World;
/**
* +
* This portion of EaglercraftX contains deobfuscated Minecraft 1.8 source code.
*
* Minecraft 1.8.8 bytecode is (c) 2015 Mojang AB. "Do not distribute!"
* Mod Coder Pack v9.18 deobfuscation configs are (c) Copyright by the MCP Team
*
* EaglercraftX 1.8 patch files (c) 2022-2024 lax1dude, hoosiertransfer,
* ayunami2000. All Rights Reserved.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
@Deprecated
public class S49PacketUpdateEntityNBT implements Packet<INetHandlerPlayClient> {
private int entityId;
private NBTTagCompound tagCompound;
public S49PacketUpdateEntityNBT() {
}
public S49PacketUpdateEntityNBT(int entityIdIn, NBTTagCompound tagCompoundIn) {
this.entityId = entityIdIn;
this.tagCompound = tagCompoundIn;
}
/**
* +
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer parPacketBuffer) throws IOException {
this.entityId = parPacketBuffer.readVarIntFromBuffer();
this.tagCompound = parPacketBuffer.readNBTTagCompoundFromBuffer();
}
/**
* +
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer parPacketBuffer) throws IOException {
parPacketBuffer.writeVarIntToBuffer(this.entityId);
parPacketBuffer.writeNBTTagCompoundToBuffer(this.tagCompound);
}
/**
* +
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient inethandlerplayclient) {
inethandlerplayclient.handleEntityNBT(this);
}
public NBTTagCompound getTagCompound() {
return this.tagCompound;
}
public Entity getEntity(World worldIn) {
return worldIn.getEntityByID(this.entityId);
}
}

View File

@ -1,7 +1,97 @@
package net.minecraft.network.play.server;
import net.minecraft.network.PlaceholderPacket;
import java.io.IOException;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.MathHelper;
import org.apache.commons.lang3.Validate;
public class SPacketSoundEffect extends PlaceholderPacket {
public class SPacketSoundEffect implements Packet<INetHandlerPlayClient> {
private SoundEvent sound;
private SoundCategory category;
private int posX;
private int posY;
private int posZ;
private float soundVolume;
private int soundPitch;
public SPacketSoundEffect() {
}
public SPacketSoundEffect(SoundEvent soundIn, SoundCategory categoryIn, double xIn, double yIn, double zIn,
float volumeIn, float pitchIn) {
Validate.notNull(soundIn, "sound", new Object[0]);
this.sound = soundIn;
this.category = categoryIn;
this.posX = (int) (xIn * 8.0D);
this.posY = (int) (yIn * 8.0D);
this.posZ = (int) (zIn * 8.0D);
this.soundVolume = volumeIn;
this.soundPitch = (int) (pitchIn * 63.0F);
pitchIn = MathHelper.clamp_float(pitchIn, 0.0F, 255.0F);
}
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException {
this.sound = (SoundEvent) SoundEvent.REGISTRY.getObjectById(buf.readVarIntFromBuffer());
this.category = (SoundCategory) buf.readEnumValue(SoundCategory.class);
this.posX = buf.readInt();
this.posY = buf.readInt();
this.posZ = buf.readInt();
this.soundVolume = buf.readFloat();
this.soundPitch = buf.readUnsignedByte();
}
/**
* Writes the raw packet data to the data stream.
*/
public void writePacketData(PacketBuffer buf) throws IOException {
buf.writeVarIntToBuffer(SoundEvent.REGISTRY.getIDForObject(this.sound));
buf.writeEnumValue(this.category);
buf.writeInt(this.posX);
buf.writeInt(this.posY);
buf.writeInt(this.posZ);
buf.writeFloat(this.soundVolume);
buf.writeByte(this.soundPitch);
}
public SoundEvent getSound() {
return this.sound;
}
public SoundCategory getCategory() {
return this.category;
}
public double getX() {
return (double) ((float) this.posX / 8.0F);
}
public double getY() {
return (double) ((float) this.posY / 8.0F);
}
public double getZ() {
return (double) ((float) this.posZ / 8.0F);
}
public float getVolume() {
return this.soundVolume;
}
public float getPitch() {
return (float) this.soundPitch / 63.0F;
}
/**
* Passes this Packet on to the NetHandler for processing.
*/
public void processPacket(INetHandlerPlayClient handler) {
handler.handleSoundEffectNew(this);
}
}

View File

@ -8,7 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.event.ClickEvent;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S33PacketUpdateSign;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentProcessor;
@ -74,6 +74,19 @@ public class TileEntitySign extends TileEntity {
this.stats.writeStatsToNBT(nbttagcompound);
}
public NBTTagCompound writeToNBTAndReturnCompound(NBTTagCompound nbttagcompound) {
super.writeToNBT(nbttagcompound);
for (int i = 0; i < 4; ++i) {
String s = IChatComponent.Serializer.componentToJson(this.signText[i]);
nbttagcompound.setString("Text" + (i + 1), s);
}
this.stats.writeStatsToNBT(nbttagcompound);
return nbttagcompound;
}
public void readFromNBT(NBTTagCompound nbttagcompound) {
this.isEditable = false;
super.readFromNBT(nbttagcompound);
@ -145,10 +158,12 @@ public class TileEntitySign extends TileEntity {
* to the client easily. For example this is used by signs to
* synchronise the text to be displayed.
*/
public Packet getDescriptionPacket() {
IChatComponent[] aichatcomponent = new IChatComponent[4];
System.arraycopy(this.signText, 0, aichatcomponent, 0, 4);
return new S33PacketUpdateSign(this.worldObj, this.pos, aichatcomponent);
public S35PacketUpdateTileEntity getDescriptionPacket() {
return new S35PacketUpdateTileEntity(this.pos, 9, this.func_189517_E_());
}
public NBTTagCompound func_189517_E_() {
return this.writeToNBTAndReturnCompound(new NBTTagCompound());
}
public boolean func_183000_F() {

View File

@ -0,0 +1,471 @@
package net.minecraft.util;
public class SoundEvent {
public static final RegistryNamespaced<ResourceLocation, SoundEvent> REGISTRY = new RegistryNamespaced();
private final ResourceLocation soundName;
private static int soundEventId = 0;
public SoundEvent(ResourceLocation soundNameIn) {
this.soundName = soundNameIn;
}
public ResourceLocation getSoundName() {
return this.soundName;
}
public static SoundEvent getFromName(ResourceLocation name) {
return REGISTRY.getObject(name);
}
public static void registerSounds() {
registerSound("ambient.cave");
registerSound("block.anvil.break");
registerSound("block.anvil.destroy");
registerSound("block.anvil.fall");
registerSound("block.anvil.hit");
registerSound("block.anvil.land");
registerSound("block.anvil.place");
registerSound("block.anvil.step");
registerSound("block.anvil.use");
registerSound("block.brewing_stand.brew");
registerSound("block.chest.close");
registerSound("block.chest.locked");
registerSound("block.chest.open");
registerSound("block.chorus_flower.death");
registerSound("block.chorus_flower.grow");
registerSound("block.cloth.break");
registerSound("block.cloth.fall");
registerSound("block.cloth.hit");
registerSound("block.cloth.place");
registerSound("block.cloth.step");
registerSound("block.comparator.click");
registerSound("block.dispenser.dispense");
registerSound("block.dispenser.fail");
registerSound("block.dispenser.launch");
registerSound("block.end_gateway.spawn");
registerSound("block.enderchest.close");
registerSound("block.enderchest.open");
registerSound("block.fence_gate.close");
registerSound("block.fence_gate.open");
registerSound("block.fire.ambient");
registerSound("block.fire.extinguish");
registerSound("block.furnace.fire_crackle");
registerSound("block.glass.break");
registerSound("block.glass.fall");
registerSound("block.glass.hit");
registerSound("block.glass.place");
registerSound("block.glass.step");
registerSound("block.grass.break");
registerSound("block.grass.fall");
registerSound("block.grass.hit");
registerSound("block.grass.place");
registerSound("block.grass.step");
registerSound("block.gravel.break");
registerSound("block.gravel.fall");
registerSound("block.gravel.hit");
registerSound("block.gravel.place");
registerSound("block.gravel.step");
registerSound("block.iron_door.close");
registerSound("block.iron_door.open");
registerSound("block.iron_trapdoor.close");
registerSound("block.iron_trapdoor.open");
registerSound("block.ladder.break");
registerSound("block.ladder.fall");
registerSound("block.ladder.hit");
registerSound("block.ladder.place");
registerSound("block.ladder.step");
registerSound("block.lava.ambient");
registerSound("block.lava.extinguish");
registerSound("block.lava.pop");
registerSound("block.lever.click");
registerSound("block.metal.break");
registerSound("block.metal.fall");
registerSound("block.metal.hit");
registerSound("block.metal.place");
registerSound("block.metal.step");
registerSound("block.metal_pressureplate.click_off");
registerSound("block.metal_pressureplate.click_on");
registerSound("block.note.basedrum");
registerSound("block.note.bass");
registerSound("block.note.harp");
registerSound("block.note.hat");
registerSound("block.note.pling");
registerSound("block.note.snare");
registerSound("block.piston.contract");
registerSound("block.piston.extend");
registerSound("block.portal.ambient");
registerSound("block.portal.travel");
registerSound("block.portal.trigger");
registerSound("block.redstone_torch.burnout");
registerSound("block.sand.break");
registerSound("block.sand.fall");
registerSound("block.sand.hit");
registerSound("block.sand.place");
registerSound("block.sand.step");
registerSound("block.slime.break");
registerSound("block.slime.fall");
registerSound("block.slime.hit");
registerSound("block.slime.place");
registerSound("block.slime.step");
registerSound("block.snow.break");
registerSound("block.snow.fall");
registerSound("block.snow.hit");
registerSound("block.snow.place");
registerSound("block.snow.step");
registerSound("block.stone.break");
registerSound("block.stone.fall");
registerSound("block.stone.hit");
registerSound("block.stone.place");
registerSound("block.stone.step");
registerSound("block.stone_button.click_off");
registerSound("block.stone_button.click_on");
registerSound("block.stone_pressureplate.click_off");
registerSound("block.stone_pressureplate.click_on");
registerSound("block.tripwire.attach");
registerSound("block.tripwire.click_off");
registerSound("block.tripwire.click_on");
registerSound("block.tripwire.detach");
registerSound("block.water.ambient");
registerSound("block.waterlily.place");
registerSound("block.wood.break");
registerSound("block.wood.fall");
registerSound("block.wood.hit");
registerSound("block.wood.place");
registerSound("block.wood.step");
registerSound("block.wood_button.click_off");
registerSound("block.wood_button.click_on");
registerSound("block.wood_pressureplate.click_off");
registerSound("block.wood_pressureplate.click_on");
registerSound("block.wooden_door.close");
registerSound("block.wooden_door.open");
registerSound("block.wooden_trapdoor.close");
registerSound("block.wooden_trapdoor.open");
registerSound("enchant.thorns.hit");
registerSound("entity.armorstand.break");
registerSound("entity.armorstand.fall");
registerSound("entity.armorstand.hit");
registerSound("entity.armorstand.place");
registerSound("entity.arrow.hit");
registerSound("entity.arrow.hit_player");
registerSound("entity.arrow.shoot");
registerSound("entity.bat.ambient");
registerSound("entity.bat.death");
registerSound("entity.bat.hurt");
registerSound("entity.bat.loop");
registerSound("entity.bat.takeoff");
registerSound("entity.blaze.ambient");
registerSound("entity.blaze.burn");
registerSound("entity.blaze.death");
registerSound("entity.blaze.hurt");
registerSound("entity.blaze.shoot");
registerSound("entity.bobber.splash");
registerSound("entity.bobber.throw");
registerSound("entity.cat.ambient");
registerSound("entity.cat.death");
registerSound("entity.cat.hiss");
registerSound("entity.cat.hurt");
registerSound("entity.cat.purr");
registerSound("entity.cat.purreow");
registerSound("entity.chicken.ambient");
registerSound("entity.chicken.death");
registerSound("entity.chicken.egg");
registerSound("entity.chicken.hurt");
registerSound("entity.chicken.step");
registerSound("entity.cow.ambient");
registerSound("entity.cow.death");
registerSound("entity.cow.hurt");
registerSound("entity.cow.milk");
registerSound("entity.cow.step");
registerSound("entity.creeper.death");
registerSound("entity.creeper.hurt");
registerSound("entity.creeper.primed");
registerSound("entity.donkey.ambient");
registerSound("entity.donkey.angry");
registerSound("entity.donkey.chest");
registerSound("entity.donkey.death");
registerSound("entity.donkey.hurt");
registerSound("entity.egg.throw");
registerSound("entity.elder_guardian.ambient");
registerSound("entity.elder_guardian.ambient_land");
registerSound("entity.elder_guardian.curse");
registerSound("entity.elder_guardian.death");
registerSound("entity.elder_guardian.death_land");
registerSound("entity.elder_guardian.hurt");
registerSound("entity.elder_guardian.hurt_land");
registerSound("entity.enderdragon.ambient");
registerSound("entity.enderdragon.death");
registerSound("entity.enderdragon.flap");
registerSound("entity.enderdragon.growl");
registerSound("entity.enderdragon.hurt");
registerSound("entity.enderdragon.shoot");
registerSound("entity.enderdragon_fireball.explode");
registerSound("entity.endereye.launch");
registerSound("entity.endermen.ambient");
registerSound("entity.endermen.death");
registerSound("entity.endermen.hurt");
registerSound("entity.endermen.scream");
registerSound("entity.endermen.stare");
registerSound("entity.endermen.teleport");
registerSound("entity.endermite.ambient");
registerSound("entity.endermite.death");
registerSound("entity.endermite.hurt");
registerSound("entity.endermite.step");
registerSound("entity.enderpearl.throw");
registerSound("entity.experience_bottle.throw");
registerSound("entity.experience_orb.pickup");
registerSound("entity.experience_orb.touch");
registerSound("entity.firework.blast");
registerSound("entity.firework.blast_far");
registerSound("entity.firework.large_blast");
registerSound("entity.firework.large_blast_far");
registerSound("entity.firework.launch");
registerSound("entity.firework.shoot");
registerSound("entity.firework.twinkle");
registerSound("entity.firework.twinkle_far");
registerSound("entity.generic.big_fall");
registerSound("entity.generic.burn");
registerSound("entity.generic.death");
registerSound("entity.generic.drink");
registerSound("entity.generic.eat");
registerSound("entity.generic.explode");
registerSound("entity.generic.extinguish_fire");
registerSound("entity.generic.hurt");
registerSound("entity.generic.small_fall");
registerSound("entity.generic.splash");
registerSound("entity.generic.swim");
registerSound("entity.ghast.ambient");
registerSound("entity.ghast.death");
registerSound("entity.ghast.hurt");
registerSound("entity.ghast.scream");
registerSound("entity.ghast.shoot");
registerSound("entity.ghast.warn");
registerSound("entity.guardian.ambient");
registerSound("entity.guardian.ambient_land");
registerSound("entity.guardian.attack");
registerSound("entity.guardian.death");
registerSound("entity.guardian.death_land");
registerSound("entity.guardian.flop");
registerSound("entity.guardian.hurt");
registerSound("entity.guardian.hurt_land");
registerSound("entity.horse.ambient");
registerSound("entity.horse.angry");
registerSound("entity.horse.armor");
registerSound("entity.horse.breathe");
registerSound("entity.horse.death");
registerSound("entity.horse.eat");
registerSound("entity.horse.gallop");
registerSound("entity.horse.hurt");
registerSound("entity.horse.jump");
registerSound("entity.horse.land");
registerSound("entity.horse.saddle");
registerSound("entity.horse.step");
registerSound("entity.horse.step_wood");
registerSound("entity.hostile.big_fall");
registerSound("entity.hostile.death");
registerSound("entity.hostile.hurt");
registerSound("entity.hostile.small_fall");
registerSound("entity.hostile.splash");
registerSound("entity.hostile.swim");
registerSound("entity.irongolem.attack");
registerSound("entity.irongolem.death");
registerSound("entity.irongolem.hurt");
registerSound("entity.irongolem.step");
registerSound("entity.item.break");
registerSound("entity.item.pickup");
registerSound("entity.itemframe.add_item");
registerSound("entity.itemframe.break");
registerSound("entity.itemframe.place");
registerSound("entity.itemframe.remove_item");
registerSound("entity.itemframe.rotate_item");
registerSound("entity.leashknot.break");
registerSound("entity.leashknot.place");
registerSound("entity.lightning.impact");
registerSound("entity.lightning.thunder");
registerSound("entity.lingeringpotion.throw");
registerSound("entity.magmacube.death");
registerSound("entity.magmacube.hurt");
registerSound("entity.magmacube.jump");
registerSound("entity.magmacube.squish");
registerSound("entity.minecart.inside");
registerSound("entity.minecart.riding");
registerSound("entity.mooshroom.shear");
registerSound("entity.mule.ambient");
registerSound("entity.mule.death");
registerSound("entity.mule.hurt");
registerSound("entity.painting.break");
registerSound("entity.painting.place");
registerSound("entity.pig.ambient");
registerSound("entity.pig.death");
registerSound("entity.pig.hurt");
registerSound("entity.pig.saddle");
registerSound("entity.pig.step");
registerSound("entity.player.attack.crit");
registerSound("entity.player.attack.knockback");
registerSound("entity.player.attack.nodamage");
registerSound("entity.player.attack.strong");
registerSound("entity.player.attack.sweep");
registerSound("entity.player.attack.weak");
registerSound("entity.player.big_fall");
registerSound("entity.player.breath");
registerSound("entity.player.burp");
registerSound("entity.player.death");
registerSound("entity.player.hurt");
registerSound("entity.player.levelup");
registerSound("entity.player.small_fall");
registerSound("entity.player.splash");
registerSound("entity.player.swim");
registerSound("entity.rabbit.ambient");
registerSound("entity.rabbit.attack");
registerSound("entity.rabbit.death");
registerSound("entity.rabbit.hurt");
registerSound("entity.rabbit.jump");
registerSound("entity.sheep.ambient");
registerSound("entity.sheep.death");
registerSound("entity.sheep.hurt");
registerSound("entity.sheep.shear");
registerSound("entity.sheep.step");
registerSound("entity.shulker.ambient");
registerSound("entity.shulker.close");
registerSound("entity.shulker.death");
registerSound("entity.shulker.hurt");
registerSound("entity.shulker.hurt_closed");
registerSound("entity.shulker.open");
registerSound("entity.shulker.shoot");
registerSound("entity.shulker.teleport");
registerSound("entity.shulker_bullet.hit");
registerSound("entity.shulker_bullet.hurt");
registerSound("entity.silverfish.ambient");
registerSound("entity.silverfish.death");
registerSound("entity.silverfish.hurt");
registerSound("entity.silverfish.step");
registerSound("entity.skeleton.ambient");
registerSound("entity.skeleton.death");
registerSound("entity.skeleton.hurt");
registerSound("entity.skeleton.shoot");
registerSound("entity.skeleton.step");
registerSound("entity.skeleton_horse.ambient");
registerSound("entity.skeleton_horse.death");
registerSound("entity.skeleton_horse.hurt");
registerSound("entity.slime.attack");
registerSound("entity.slime.death");
registerSound("entity.slime.hurt");
registerSound("entity.slime.jump");
registerSound("entity.slime.squish");
registerSound("entity.small_magmacube.death");
registerSound("entity.small_magmacube.hurt");
registerSound("entity.small_magmacube.squish");
registerSound("entity.small_slime.death");
registerSound("entity.small_slime.hurt");
registerSound("entity.small_slime.jump");
registerSound("entity.small_slime.squish");
registerSound("entity.snowball.throw");
registerSound("entity.snowman.ambient");
registerSound("entity.snowman.death");
registerSound("entity.snowman.hurt");
registerSound("entity.snowman.shoot");
registerSound("entity.spider.ambient");
registerSound("entity.spider.death");
registerSound("entity.spider.hurt");
registerSound("entity.spider.step");
registerSound("entity.splash_potion.break");
registerSound("entity.splash_potion.throw");
registerSound("entity.squid.ambient");
registerSound("entity.squid.death");
registerSound("entity.squid.hurt");
registerSound("entity.tnt.primed");
registerSound("entity.villager.ambient");
registerSound("entity.villager.death");
registerSound("entity.villager.hurt");
registerSound("entity.villager.no");
registerSound("entity.villager.trading");
registerSound("entity.villager.yes");
registerSound("entity.witch.ambient");
registerSound("entity.witch.death");
registerSound("entity.witch.drink");
registerSound("entity.witch.hurt");
registerSound("entity.witch.throw");
registerSound("entity.wither.ambient");
registerSound("entity.wither.break_block");
registerSound("entity.wither.death");
registerSound("entity.wither.hurt");
registerSound("entity.wither.shoot");
registerSound("entity.wither.spawn");
registerSound("entity.wolf.ambient");
registerSound("entity.wolf.death");
registerSound("entity.wolf.growl");
registerSound("entity.wolf.howl");
registerSound("entity.wolf.hurt");
registerSound("entity.wolf.pant");
registerSound("entity.wolf.shake");
registerSound("entity.wolf.step");
registerSound("entity.wolf.whine");
registerSound("entity.zombie.ambient");
registerSound("entity.zombie.attack_door_wood");
registerSound("entity.zombie.attack_iron_door");
registerSound("entity.zombie.break_door_wood");
registerSound("entity.zombie.death");
registerSound("entity.zombie.hurt");
registerSound("entity.zombie.infect");
registerSound("entity.zombie.step");
registerSound("entity.zombie_horse.ambient");
registerSound("entity.zombie_horse.death");
registerSound("entity.zombie_horse.hurt");
registerSound("entity.zombie_pig.ambient");
registerSound("entity.zombie_pig.angry");
registerSound("entity.zombie_pig.death");
registerSound("entity.zombie_pig.hurt");
registerSound("entity.zombie_villager.ambient");
registerSound("entity.zombie_villager.converted");
registerSound("entity.zombie_villager.cure");
registerSound("entity.zombie_villager.death");
registerSound("entity.zombie_villager.hurt");
registerSound("entity.zombie_villager.step");
registerSound("item.armor.equip_chain");
registerSound("item.armor.equip_diamond");
registerSound("item.armor.equip_generic");
registerSound("item.armor.equip_gold");
registerSound("item.armor.equip_iron");
registerSound("item.armor.equip_leather");
registerSound("item.bottle.fill");
registerSound("item.bottle.fill_dragonbreath");
registerSound("item.bucket.empty");
registerSound("item.bucket.empty_lava");
registerSound("item.bucket.fill");
registerSound("item.bucket.fill_lava");
registerSound("item.chorus_fruit.teleport");
registerSound("item.elytra.flying");
registerSound("item.firecharge.use");
registerSound("item.flintandsteel.use");
registerSound("item.hoe.till");
registerSound("item.shield.block");
registerSound("item.shield.break");
registerSound("item.shovel.flatten");
registerSound("music.creative");
registerSound("music.credits");
registerSound("music.dragon");
registerSound("music.end");
registerSound("music.game");
registerSound("music.menu");
registerSound("music.nether");
registerSound("record.11");
registerSound("record.13");
registerSound("record.blocks");
registerSound("record.cat");
registerSound("record.chirp");
registerSound("record.far");
registerSound("record.mall");
registerSound("record.mellohi");
registerSound("record.stal");
registerSound("record.strad");
registerSound("record.wait");
registerSound("record.ward");
registerSound("ui.button.click");
registerSound("weather.rain");
registerSound("weather.rain.above");
}
private static void registerSound(String soundNameIn) {
ResourceLocation resourcelocation = new ResourceLocation(soundNameIn);
REGISTRY.register(soundEventId++, resourcelocation, new SoundEvent(resourcelocation));
}
}