diff options
| author | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2021-05-03 16:38:41 -0700 |
| commit | e1e781bb2135ef78592226f1a3eaba4925702f1f (patch) | |
| tree | 8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/NumberAttribute.java | |
| download | worlds.jar-main.tar.xz worlds.jar-main.zip | |
Diffstat (limited to 'NET/worlds/scape/NumberAttribute.java')
| -rw-r--r-- | NET/worlds/scape/NumberAttribute.java | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/NET/worlds/scape/NumberAttribute.java b/NET/worlds/scape/NumberAttribute.java new file mode 100644 index 0000000..51e30a9 --- /dev/null +++ b/NET/worlds/scape/NumberAttribute.java @@ -0,0 +1,120 @@ +/* */ package NET.worlds.scape; +/* */ +/* */ import java.io.DataInputStream; +/* */ import java.io.DataOutputStream; +/* */ import java.io.IOException; +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public class NumberAttribute +/* */ extends Attribute +/* */ { +/* */ public NumberAttribute(int attrID) +/* */ { +/* 23 */ super(attrID); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ +/* 31 */ float value = 0.0F; +/* */ +/* */ +/* */ +/* */ public NumberAttribute() {} +/* */ +/* */ +/* */ public void set(float x) +/* */ { +/* 40 */ this.value = x; +/* */ +/* 42 */ noteChange(); +/* */ } +/* */ +/* */ public float get() +/* */ { +/* 47 */ return this.value; +/* */ } +/* */ +/* */ public void generateNetData(DataOutputStream s) +/* */ throws IOException +/* */ { +/* 53 */ s.writeFloat(this.value); +/* */ } +/* */ +/* */ public void setFromNetData(DataInputStream ds, int len) throws IOException +/* */ { +/* 58 */ this.value = ds.readFloat(); +/* */ } +/* */ +/* */ +/* */ +/* */ +/* */ +/* */ public Object properties(int index, int offset, int mode, Object value) +/* */ throws NoSuchPropertyException +/* */ { +/* 68 */ Object ret = null; +/* 69 */ switch (index - offset) { +/* */ case 0: +/* 71 */ if (mode == 0) { +/* 72 */ ret = FloatPropertyEditor.make( +/* 73 */ new Property(this, index, "value")); +/* 74 */ } else if (mode == 1) { +/* 75 */ ret = new Float(get()); +/* 76 */ } else if (mode == 2) +/* 77 */ set(((Float)value).floatValue()); +/* 78 */ break; +/* */ default: +/* 80 */ ret = super.properties(index, offset + 1, mode, value); +/* */ } +/* 82 */ return ret; +/* */ } +/* */ +/* */ +/* 86 */ private static Object classCookie = new Object(); +/* */ +/* */ public void saveState(Saver s) throws IOException +/* */ { +/* 90 */ s.saveVersion(0, classCookie); +/* 91 */ super.saveState(s); +/* */ +/* 93 */ s.saveFloat(this.value); +/* */ } +/* */ +/* */ public void restoreState(Restorer r) throws IOException, TooNewException +/* */ { +/* 98 */ switch (r.restoreVersion(classCookie)) { +/* */ case 0: +/* 100 */ super.restoreState(r); +/* 101 */ this.value = r.restoreFloat(); +/* 102 */ break; +/* */ default: +/* 104 */ throw new TooNewException(); +/* */ } +/* */ +/* 107 */ set(this.value); +/* */ } +/* */ +/* */ public String toString() +/* */ { +/* 112 */ return super.toString() + "[" + get() + "]"; +/* */ } +/* */ } + + +/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\NumberAttribute.class + * Java compiler version: 6 (50.0) + * JD-Core Version: 0.7.1 + */
\ No newline at end of file |