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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
|
#pragma once
#include "..\Minecraft.World\ArrayWithLength.h"
class DynamicTexture;
class BufferedImage;
class HttpTexture;
class MemTexture;
class TexturePackRepository;
class HttpTextureProcessor;
class MemTextureProcessor;
class Options;
using namespace std;
class IntBuffer;
class PreStitchedTextureMap;
class ResourceLocation;
typedef enum _TEXTURE_NAME
{
TN__BLUR__MISC_PUMPKINBLUR,
// TN__BLUR__MISC_VIGNETTE, // Not currently used
TN__CLAMP__MISC_SHADOW,
// TN_ACHIEVEMENT_BG, // Not currently used
TN_ART_KZ,
TN_ENVIRONMENT_CLOUDS,
TN_ENVIRONMENT_RAIN,
TN_ENVIRONMENT_SNOW,
TN_GUI_GUI,
TN_GUI_ICONS,
TN_IT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TN_MOB_ENDERDRAGON_ENDEREYES,
TN__BLUR__MISC_GLINT,
TN_ITEM_BOOK,
TN_MISC_TUNNEL,
TN_MISC_PARTICLEFIELD,
TN_TERRAIN_MOON_PHASES,
// 1.2.3
TN_MOB_OCELOT,
TN_MOB_CAT_BLACK,
TN_MOB_CAT_RED,
TN_MOB_CAT_SIAMESE,
TN_MOB_VILLAGER_GOLEM,
TN_MOB_WITHER_SKELETON,
// TU14
TN_MOB_WOLF_COLLAR,
TN_MOB_ZOMBIE_VILLAGER,
// 1.6.4
TN_ITEM_LEASHKNOT,
TN_MISC_BEACON_BEAM,
TN_MOB_BAT,
TN_MOB_DONKEY,
TN_MOB_HORSE_BLACK,
TN_MOB_HORSE_BROWN,
TN_MOB_HORSE_CHESTNUT,
TN_MOB_HORSE_CREAMY,
TN_MOB_HORSE_DARKBROWN,
TN_MOB_HORSE_GRAY,
TN_MOB_HORSE_MARKINGS_BLACKDOTS,
TN_MOB_HORSE_MARKINGS_WHITE,
TN_MOB_HORSE_MARKINGS_WHITEDOTS,
TN_MOB_HORSE_MARKINGS_WHITEFIELD,
TN_MOB_HORSE_SKELETON,
TN_MOB_HORSE_WHITE,
TN_MOB_HORSE_ZOMBIE,
TN_MOB_MULE,
TN_MOB_HORSE_ARMOR_DIAMOND,
TN_MOB_HORSE_ARMOR_GOLD,
TN_MOB_HORSE_ARMOR_IRON,
TN_MOB_WITCH,
TN_MOB_WITHER,
TN_MOB_WITHER_ARMOR,
TN_MOB_WITHER_INVULNERABLE,
TN_TILE_TRAP_CHEST,
TN_TILE_LARGE_TRAP_CHEST,
//TN_TILE_XMAS_CHEST,
//TN_TILE_LARGE_XMAS_CHEST,
#ifdef _LARGE_WORLDS
TN_MISC_ADDITIONALMAPICONS,
#endif
TN_DEFAULT_FONT,
TN_ALT_FONT,
/* TN_SP1,
TN_SP2,
TN_SP3,
TN_SPF,
TN_THST,
TN_THIR,
TN_THGO,
TN_THDI,
TN_GPAN,
TN_GPCO,
TN_GPEN,
TN_GPFO,
TN_GPTO,
TN_GPBA,
TN_GPFA,
TN_GPME,
TN_GPMF,
TN_GPMM,
TN_GPSE,
TN_AH_0006,
TN_AH_0003,
TN_AH_0007,
TN_AH_0005,
TN_AH_0004,
TN_AH_0001,
TN_AH_0002,
TN_AT_0001,
TN_AT_0002,
TN_AT_0003,
TN_AT_0004,
TN_AT_0005,
TN_AT_0006,
TN_AT_0007,
TN_AT_0008,
TN_AT_0009,
TN_AT_0010,
TN_AT_0011,
TN_AT_0012,
TN_AP_0001,
TN_AP_0002,
TN_AP_0003,
TN_AP_0004,
TN_AP_0005,
TN_AP_0006,
TN_AP_0007,
TN_AP_0009,
TN_AP_0010,
TN_AP_0011,
TN_AP_0012,
TN_AP_0013,
TN_AP_0014,
TN_AP_0015,
TN_AP_0016,
TN_AP_0017,
TN_AP_0018,
TN_AA_0001,
TN_AT_0013,
TN_AT_0014,
TN_AT_0015,
TN_AT_0016,
TN_AT_0017,
TN_AT_0018,
TN_AP_0019,
TN_AP_0020,
TN_AP_0021,
TN_AP_0022,
TN_AP_0023,
TN_AH_0008,
TN_AH_0009,*/
TN_GUI_ITEMS,
TN_TERRAIN,
TN_COUNT,
}
TEXTURE_NAME;
class Textures
{
public:
static bool MIPMAP;
static C4JRender::eTextureFormat TEXTURE_FORMAT;
private:
static const wchar_t *preLoaded[TN_COUNT];
static int preLoadedIdx[TN_COUNT];
unordered_map<wstring, int> idMap;
unordered_map<wstring, intArray> pixelsMap;
unordered_map<int, BufferedImage *> loadedImages;
//IntBuffer *pixels; // 4J - removed so we don't have a permanent buffer kicking round using up 1MB
unordered_map<wstring, HttpTexture *> httpTextures;
// 4J-PB - Added for GTS textures
unordered_map<wstring,MemTexture *> memTextures;
Options *options;
private:
TexturePackRepository *skins;
BufferedImage *missingNo;
PreStitchedTextureMap *terrain;
PreStitchedTextureMap *items;
int lastBoundId;
public:
Textures(TexturePackRepository *skins, Options *options);
private:
void loadIndexedTextures(); // 4J Added
public:
intArray loadTexturePixels(TEXTURE_NAME texId, const wstring& resourceName);
private:
intArray loadTexturePixels(BufferedImage *img);
intArray loadTexturePixels(BufferedImage *img, intArray pixels);
void setTextureFormat(const wstring& resourceName); // 4J added
public:
void bindTexture(const wstring &resourceName);
void bindTexture(ResourceLocation *resource); // 4J Added
void bindTextureLayers(ResourceLocation *resource); // 4J added
// 4J Made public for use in XUI controls
void bind(int id);
ResourceLocation *getTextureLocation(shared_ptr<Entity> entity);
ResourceLocation *getTextureLocation(int iconType);
public:
void clearLastBoundId();
private:
int loadTexture(TEXTURE_NAME texId, const wstring& resourceName);
public:
int loadTexture(int idx); // 4J added
int getTexture(BufferedImage *img, C4JRender::eTextureFormat format = C4JRender::TEXTURE_FORMAT_RxGyBzAw, bool mipmap = true);
void loadTexture(BufferedImage *img, int id);
void loadTexture(BufferedImage *img, int id, bool blur, bool clamp);
private:
intArray anaglyph(intArray rawPixels);
public:
void replaceTexture(intArray rawPixels, int w, int h, int id);
void replaceTextureDirect(intArray rawPixels, int w, int h, int id); // 4J added as optimisation
void replaceTextureDirect(shortArray rawPixels, int w, int h, int id); // 4J added as optimisation
void releaseTexture(int id);
int loadHttpTexture(const wstring& url, const wstring& backup);
int loadHttpTexture(const wstring& url, int backup); // 4J added
bool hasHttpTexture(const wstring &url);
HttpTexture *addHttpTexture(const wstring& url, HttpTextureProcessor *processor);
void removeHttpTexture(const wstring& url);
// 4J-PB - for the GTS textures
int loadMemTexture(const wstring& url, const wstring& backup);
int loadMemTexture(const wstring& url, int backup);
MemTexture * addMemTexture(const wstring& url, MemTextureProcessor *processor);
//MemTexture * getMemTexture(const wstring& url, MemTextureProcessor *processor);
void removeMemTexture(const wstring& url);
void tick(bool updateTextures, bool tickDynamics = true); // 4J added updateTextures parameter & tickDynamics
public:
void reloadAll();
void stitch();
Icon *getMissingIcon(int type);
BufferedImage *readImage(TEXTURE_NAME texId, const wstring& name); // Moved this to public for Font.cpp access
// check list of title update textures to see if we need to use the UPDATE: drive
static bool IsTUImage(TEXTURE_NAME texId, const wstring& name);
static bool IsOriginalImage(TEXTURE_NAME texId, const wstring& name);
};
|