summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/EntityPainting.java
blob: 3d59a8fcc7b838b0850b98cd5fc083dbf1d1572a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
package net.minecraft.server;

import java.util.*;

public class EntityPainting extends Entity {

    private int f;
    public int a;
    public int b;
    public int c;
    public int d;
    public EnumArt e;

    public EntityPainting(World world) {
        super(world);
        f = 0;
        a = 0;
        H = 0.0F;
        a(0.5F, 0.5F);
    }

    public EntityPainting(World world, int i, int j, int k, int l) {
        this(world);
        b = i;
        c = j;
        d = k;
        ArrayList arraylist = new ArrayList();
        EnumArt aenumart[] = EnumArt.values();
        int i1 = aenumart.length;

        for (int j1 = 0; j1 < i1; j1++) {
            EnumArt enumart = aenumart[j1];

            e = enumart;
            a(l);
            if (d()) {
                ((List) (arraylist)).add(((enumart)));
            }
        }

        if (((List) (arraylist)).size() > 0) {
            e = (EnumArt) ((List) (arraylist)).get(W.nextInt(((List) (arraylist)).size()));
        }
        a(l);
    }

    protected void a() {}

    public void a(int i) {
        a = i;
        x = v = i * 90;
        float f1 = e.A;
        float f2 = e.B;
        float f3 = e.A;

        if (i == 0 || i == 2) {
            f3 = 0.5F;
        } else {
            f1 = 0.5F;
        }
        f1 /= 32F;
        f2 /= 32F;
        f3 /= 32F;
        float f4 = (float) b + 0.5F;
        float f5 = (float) c + 0.5F;
        float f6 = (float) d + 0.5F;
        float f7 = 0.5625F;

        if (i == 0) {
            f6 -= f7;
        }
        if (i == 1) {
            f4 -= f7;
        }
        if (i == 2) {
            f6 += f7;
        }
        if (i == 3) {
            f4 += f7;
        }
        if (i == 0) {
            f4 -= d(e.A);
        }
        if (i == 1) {
            f6 += d(e.A);
        }
        if (i == 2) {
            f4 += d(e.A);
        }
        if (i == 3) {
            f6 -= d(e.A);
        }
        f5 += d(e.B);
        a(f4, f5, f6);
        float f8 = -0.00625F;

        z.c(f4 - f1 - f8, f5 - f2 - f8, f6 - f3 - f8, f4 + f1 + f8, f5 + f2 + f8, f6 + f3 + f8);
    }

    private float d(int i) {
        if (i == 32) {
            return 0.5F;
        }
        return i != 64 ? 0.0F : 0.5F;
    }

    public void b_() {
        if (f++ == 100 && !l.z) {
            f = 0;
            if (!d()) {
                q();
                l.a(((Entity) (new EntityItem(l, p, q, r, new ItemStack(Item.aq)))));
            }
        }
    }

    public boolean d() {
        if (this.l.a(((Entity) (this)), z).size() > 0) {
            return false;
        }
        int i = e.A / 16;
        int j = e.B / 16;
        int k = b;
        int l = c;
        int i1 = d;

        if (a == 0) {
            k = MathHelper.b(p - (double) ((float) e.A / 32F));
        }
        if (a == 1) {
            i1 = MathHelper.b(r - (double) ((float) e.A / 32F));
        }
        if (a == 2) {
            k = MathHelper.b(p - (double) ((float) e.A / 32F));
        }
        if (a == 3) {
            i1 = MathHelper.b(r - (double) ((float) e.A / 32F));
        }
        l = MathHelper.b(q - (double) ((float) e.B / 32F));
        for (int j1 = 0; j1 < i; j1++) {
            for (int k1 = 0; k1 < j; k1++) {
                Material material;

                if (a == 0 || a == 2) {
                    material = this.l.c(k + j1, l + k1, d);
                } else {
                    material = this.l.c(b, l + k1, i1 + j1);
                }
                if (!material.a()) {
                    return false;
                }
            }
        }

        List list = this.l.b(((Entity) (this)), z);

        for (int l1 = 0; l1 < list.size(); l1++) {
            if (list.get(l1) instanceof EntityPainting) {
                return false;
            }
        }

        return true;
    }

    public boolean c_() {
        return true;
    }

    public boolean a(Entity entity, int i) {
        if (!G && !l.z) {
            q();
            y();
            l.a(((Entity) (new EntityItem(l, p, q, r, new ItemStack(Item.aq)))));
        }
        return true;
    }

    public void a(NBTTagCompound nbttagcompound) {
        nbttagcompound.a("Dir", (byte) a);
        nbttagcompound.a("Motive", e.z);
        nbttagcompound.a("TileX", b);
        nbttagcompound.a("TileY", c);
        nbttagcompound.a("TileZ", d);
    }

    public void b(NBTTagCompound nbttagcompound) {
        a = ((int) (nbttagcompound.b("Dir")));
        b = nbttagcompound.d("TileX");
        c = nbttagcompound.d("TileY");
        d = nbttagcompound.d("TileZ");
        String s = nbttagcompound.h("Motive");
        EnumArt aenumart[] = EnumArt.values();
        int i = aenumart.length;

        for (int j = 0; j < i; j++) {
            EnumArt enumart = aenumart[j];

            if (enumart.z.equals(((s)))) {
                e = enumart;
            }
        }

        if (e == null) {
            e = EnumArt.a;
        }
        a(a);
    }
}