| 1 | package net.minecraft.client.data.models.model;
|
| 2 |
|
| 3 | import com.google.common.collect.Maps;
|
| 4 | import com.google.common.collect.Sets;
|
| 5 | import java.util.Map;
|
| 6 | import java.util.Set;
|
| 7 | import java.util.function.BiFunction;
|
| 8 | import java.util.stream.Stream;
|
| 9 | import net.fabricmc.api.EnvType;
|
| 10 | import net.fabricmc.api.Environment;
|
| 11 | import net.minecraft.client.resources.model.sprite.Material;
|
| 12 | import net.minecraft.core.registries.BuiltInRegistries;
|
| 13 | import net.minecraft.resources.Identifier;
|
| 14 | import net.minecraft.world.item.Item;
|
| 15 | import net.minecraft.world.level.block.Block;
|
| 16 | import net.minecraft.world.level.block.Blocks;
|
| 17 | import net.minecraft.world.level.block.state.properties.BedPart;
|
| 18 |
|
| 19 | @Environment(EnvType.CLIENT)
|
| 20 | public class TextureMapping {
|
| 21 | private final Map<TextureSlot, Material> slots = Maps.newHashMap();
|
| 22 | private final Set<TextureSlot> forcedSlots = Sets.newHashSet();
|
| 23 |
|
| 24 | public TextureMapping put(final TextureSlot slot, final Material material) {
|
| 25 | this.slots.put(slot, material);
|
| 26 | return this;
|
| 27 | }
|
| 28 |
|
| 29 | public TextureMapping putForced(final TextureSlot slot, final Material material) {
|
| 30 | this.slots.put(slot, material);
|
| 31 | this.forcedSlots.add(slot);
|
| 32 | return this;
|
| 33 | }
|
| 34 |
|
| 35 | public Stream<TextureSlot> getForced() {
|
| 36 | return this.forcedSlots.stream();
|
| 37 | }
|
| 38 |
|
| 39 | public TextureMapping copySlot(final TextureSlot from, final TextureSlot to) {
|
| 40 | return this.put(to, this.slots.get(from));
|
| 41 | }
|
| 42 |
|
| 43 | public TextureMapping copyForced(final TextureSlot from, final TextureSlot to) {
|
| 44 | return this.putForced(to, this.slots.get(from));
|
| 45 | }
|
| 46 |
|
| 47 | public Material get(final TextureSlot slot) {
|
| 48 | for (TextureSlot currentSlot = slot; currentSlot != null; currentSlot = currentSlot.getParent()) {
|
| 49 | Material result = this.slots.get(currentSlot);
|
| 50 | if (result != null) {
|
| 51 | return result;
|
| 52 | }
|
| 53 | }
|
| 54 |
|
| 55 | throw new IllegalStateException("Can't find texture for slot " + slot);
|
| 56 | }
|
| 57 |
|
| 58 | public TextureMapping copyAndUpdate(final TextureSlot slot, final Material material) {
|
| 59 | TextureMapping result = new TextureMapping();
|
| 60 | result.slots.putAll(this.slots);
|
| 61 | result.forcedSlots.addAll(this.forcedSlots);
|
| 62 | result.put(slot, material);
|
| 63 | return result;
|
| 64 | }
|
| 65 |
|
| 66 | public TextureMapping updateSlots(final BiFunction<TextureSlot, Material, Material> mapper) {
|
| 67 | this.slots.replaceAll(mapper);
|
| 68 | return this;
|
| 69 | }
|
| 70 |
|
| 71 | public TextureMapping forceAllTranslucent() {
|
| 72 | return this.updateSlots((var0, material) -> material.withForceTranslucent(true));
|
| 73 | }
|
| 74 |
|
| 75 | public static TextureMapping cube(final Block block) {
|
| 76 | Material texture = getBlockTexture(block);
|
| 77 | return cube(texture);
|
| 78 | }
|
| 79 |
|
| 80 | public static TextureMapping defaultTexture(final Block block) {
|
| 81 | Material texture = getBlockTexture(block);
|
| 82 | return defaultTexture(texture);
|
| 83 | }
|
| 84 |
|
| 85 | public static TextureMapping defaultTexture(final Material texture) {
|
| 86 | return new TextureMapping().put(TextureSlot.TEXTURE, texture);
|
| 87 | }
|
| 88 |
|
| 89 | public static TextureMapping cube(final Material all) {
|
| 90 | return new TextureMapping().put(TextureSlot.ALL, all);
|
| 91 | }
|
| 92 |
|
| 93 | public static TextureMapping cross(final Block block) {
|
| 94 | return singleSlot(TextureSlot.CROSS, getBlockTexture(block));
|
| 95 | }
|
| 96 |
|
| 97 | public static TextureMapping side(final Block block) {
|
| 98 | return singleSlot(TextureSlot.SIDE, getBlockTexture(block));
|
| 99 | }
|
| 100 |
|
| 101 | public static TextureMapping crossEmissive(final Block block) {
|
| 102 | return new TextureMapping().put(TextureSlot.CROSS, getBlockTexture(block)).put(TextureSlot.CROSS_EMISSIVE, getBlockTexture(block, "_emissive"));
|
| 103 | }
|
| 104 |
|
| 105 | public static TextureMapping cross(final Material cross) {
|
| 106 | return singleSlot(TextureSlot.CROSS, cross);
|
| 107 | }
|
| 108 |
|
| 109 | public static TextureMapping plant(final Block block) {
|
| 110 | return singleSlot(TextureSlot.PLANT, getBlockTexture(block));
|
| 111 | }
|
| 112 |
|
| 113 | public static TextureMapping plantEmissive(final Block block) {
|
| 114 | return new TextureMapping().put(TextureSlot.PLANT, getBlockTexture(block)).put(TextureSlot.CROSS_EMISSIVE, getBlockTexture(block, "_emissive"));
|
| 115 | }
|
| 116 |
|
| 117 | public static TextureMapping plant(final Material plant) {
|
| 118 | return singleSlot(TextureSlot.PLANT, plant);
|
| 119 | }
|
| 120 |
|
| 121 | public static TextureMapping rail(final Block block) {
|
| 122 | return singleSlot(TextureSlot.RAIL, getBlockTexture(block));
|
| 123 | }
|
| 124 |
|
| 125 | public static TextureMapping rail(final Material rail) {
|
| 126 | return singleSlot(TextureSlot.RAIL, rail);
|
| 127 | }
|
| 128 |
|
| 129 | public static TextureMapping wool(final Block block) {
|
| 130 | return singleSlot(TextureSlot.WOOL, getBlockTexture(block));
|
| 131 | }
|
| 132 |
|
| 133 | public static TextureMapping flowerbed(final Block block) {
|
| 134 | return new TextureMapping().put(TextureSlot.FLOWERBED, getBlockTexture(block)).put(TextureSlot.STEM, getBlockTexture(block, "_stem"));
|
| 135 | }
|
| 136 |
|
| 137 | public static TextureMapping wool(final Material cross) {
|
| 138 | return singleSlot(TextureSlot.WOOL, cross);
|
| 139 | }
|
| 140 |
|
| 141 | public static TextureMapping stem(final Block block) {
|
| 142 | return singleSlot(TextureSlot.STEM, getBlockTexture(block));
|
| 143 | }
|
| 144 |
|
| 145 | public static TextureMapping attachedStem(final Block stem, final Block upperStem) {
|
| 146 | return new TextureMapping().put(TextureSlot.STEM, getBlockTexture(stem)).put(TextureSlot.UPPER_STEM, getBlockTexture(upperStem));
|
| 147 | }
|
| 148 |
|
| 149 | public static TextureMapping pattern(final Block block) {
|
| 150 | return singleSlot(TextureSlot.PATTERN, getBlockTexture(block));
|
| 151 | }
|
| 152 |
|
| 153 | public static TextureMapping fan(final Block block) {
|
| 154 | return singleSlot(TextureSlot.FAN, getBlockTexture(block));
|
| 155 | }
|
| 156 |
|
| 157 | public static TextureMapping crop(final Material id) {
|
| 158 | return singleSlot(TextureSlot.CROP, id);
|
| 159 | }
|
| 160 |
|
| 161 | public static TextureMapping pane(final Block body, final Block edge) {
|
| 162 | return new TextureMapping().put(TextureSlot.PANE, getBlockTexture(body)).put(TextureSlot.EDGE, getBlockTexture(edge, "_top"));
|
| 163 | }
|
| 164 |
|
| 165 | public static TextureMapping singleSlot(final TextureSlot slot, final Material id) {
|
| 166 | return new TextureMapping().put(slot, id);
|
| 167 | }
|
| 168 |
|
| 169 | public static TextureMapping column(final Block block) {
|
| 170 | return new TextureMapping().put(TextureSlot.SIDE, getBlockTexture(block, "_side")).put(TextureSlot.END, getBlockTexture(block, "_top"));
|
| 171 | }
|
| 172 |
|
| 173 | public static TextureMapping cubeTop(final Block block) {
|
| 174 | return new TextureMapping().put(TextureSlot.SIDE, getBlockTexture(block, "_side")).put(TextureSlot.TOP, getBlockTexture(block, "_top"));
|
| 175 | }
|
| 176 |
|
| 177 | public static TextureMapping pottedAzalea(final Block block) {
|
| 178 | return new TextureMapping()
|
| 179 | .put(TextureSlot.PLANT, getBlockTexture(block, "_plant"))
|
| 180 | .put(TextureSlot.SIDE, getBlockTexture(block, "_side"))
|
| 181 | .put(TextureSlot.TOP, getBlockTexture(block, "_top"));
|
| 182 | }
|
| 183 |
|
| 184 | public static TextureMapping logColumn(final Block block) {
|
| 185 | return new TextureMapping()
|
| 186 | .put(TextureSlot.SIDE, getBlockTexture(block))
|
| 187 | .put(TextureSlot.END, getBlockTexture(block, "_top"))
|
| 188 | .put(TextureSlot.PARTICLE, getBlockTexture(block));
|
| 189 | }
|
| 190 |
|
| 191 | public static TextureMapping column(final Material side, final Material end) {
|
| 192 | return new TextureMapping().put(TextureSlot.SIDE, side).put(TextureSlot.END, end);
|
| 193 | }
|
| 194 |
|
| 195 | public static TextureMapping fence(final Block block) {
|
| 196 | return new TextureMapping()
|
| 197 | .put(TextureSlot.TEXTURE, getBlockTexture(block))
|
| 198 | .put(TextureSlot.SIDE, getBlockTexture(block, "_side"))
|
| 199 | .put(TextureSlot.TOP, getBlockTexture(block, "_top"));
|
| 200 | }
|
| 201 |
|
| 202 | public static TextureMapping customParticle(final Block block) {
|
| 203 | return new TextureMapping().put(TextureSlot.TEXTURE, getBlockTexture(block)).put(TextureSlot.PARTICLE, getBlockTexture(block, "_particle"));
|
| 204 | }
|
| 205 |
|
| 206 | public static TextureMapping cubeBottomTop(final Block block) {
|
| 207 | return new TextureMapping()
|
| 208 | .put(TextureSlot.SIDE, getBlockTexture(block, "_side"))
|
| 209 | .put(TextureSlot.TOP, getBlockTexture(block, "_top"))
|
| 210 | .put(TextureSlot.BOTTOM, getBlockTexture(block, "_bottom"));
|
| 211 | }
|
| 212 |
|
| 213 | public static TextureMapping cubeBottomTopWithWall(final Block block) {
|
| 214 | Material side = getBlockTexture(block);
|
| 215 | return new TextureMapping()
|
| 216 | .put(TextureSlot.WALL, side)
|
| 217 | .put(TextureSlot.SIDE, side)
|
| 218 | .put(TextureSlot.TOP, getBlockTexture(block, "_top"))
|
| 219 | .put(TextureSlot.BOTTOM, getBlockTexture(block, "_bottom"));
|
| 220 | }
|
| 221 |
|
| 222 | public static TextureMapping columnWithWall(final Block block) {
|
| 223 | Material side = getBlockTexture(block);
|
| 224 | return new TextureMapping()
|
| 225 | .put(TextureSlot.TEXTURE, side)
|
| 226 | .put(TextureSlot.WALL, side)
|
| 227 | .put(TextureSlot.SIDE, side)
|
| 228 | .put(TextureSlot.END, getBlockTexture(block, "_top"));
|
| 229 | }
|
| 230 |
|
| 231 | public static TextureMapping door(final Material top, final Material bottom) {
|
| 232 | return new TextureMapping().put(TextureSlot.TOP, top).put(TextureSlot.BOTTOM, bottom);
|
| 233 | }
|
| 234 |
|
| 235 | public static TextureMapping door(final Block block) {
|
| 236 | return new TextureMapping().put(TextureSlot.TOP, getBlockTexture(block, "_top")).put(TextureSlot.BOTTOM, getBlockTexture(block, "_bottom"));
|
| 237 | }
|
| 238 |
|
| 239 | public static TextureMapping bed(final Block block, final BedPart part) {
|
| 240 | TextureMapping mapping = new TextureMapping()
|
| 241 | .put(TextureSlot.UP, getBlockTexture(block, "_" + part + "_up"))
|
| 242 | .put(TextureSlot.EAST, getBlockTexture(block, "_" + part + "_east"))
|
| 243 | .put(TextureSlot.WEST, getBlockTexture(block, "_" + part + "_west"));
|
| 244 | if (part == BedPart.FOOT) {
|
| 245 | mapping.put(TextureSlot.SOUTH, getBlockTexture(block, "_" + part + "_south"));
|
| 246 | }
|
| 247 |
|
| 248 | return mapping;
|
| 249 | }
|
| 250 |
|
| 251 | public static TextureMapping particle(final Block block) {
|
| 252 | return new TextureMapping().put(TextureSlot.PARTICLE, getBlockTexture(block));
|
| 253 | }
|
| 254 |
|
| 255 | public static TextureMapping particle(final Material id) {
|
| 256 | return new TextureMapping().put(TextureSlot.PARTICLE, id);
|
| 257 | }
|
| 258 |
|
| 259 | public static TextureMapping fire0(final Block block) {
|
| 260 | return new TextureMapping().put(TextureSlot.FIRE, getBlockTexture(block, "_0"));
|
| 261 | }
|
| 262 |
|
| 263 | public static TextureMapping fire1(final Block block) {
|
| 264 | return new TextureMapping().put(TextureSlot.FIRE, getBlockTexture(block, "_1"));
|
| 265 | }
|
| 266 |
|
| 267 | public static TextureMapping lantern(final Block block) {
|
| 268 | return new TextureMapping().put(TextureSlot.LANTERN, getBlockTexture(block));
|
| 269 | }
|
| 270 |
|
| 271 | public static TextureMapping torch(final Block block) {
|
| 272 | return new TextureMapping().put(TextureSlot.TORCH, getBlockTexture(block));
|
| 273 | }
|
| 274 |
|
| 275 | public static TextureMapping torch(final Material id) {
|
| 276 | return new TextureMapping().put(TextureSlot.TORCH, id);
|
| 277 | }
|
| 278 |
|
| 279 | public static TextureMapping trialSpawner(final Block block, final String sideSuffix, final String topSuffix) {
|
| 280 | return new TextureMapping()
|
| 281 | .put(TextureSlot.SIDE, getBlockTexture(block, sideSuffix))
|
| 282 | .put(TextureSlot.TOP, getBlockTexture(block, topSuffix))
|
| 283 | .put(TextureSlot.BOTTOM, getBlockTexture(block, "_bottom"));
|
| 284 | }
|
| 285 |
|
| 286 | public static TextureMapping vault(final Block block, final String frontSuffix, final String sideSuffix, final String topSuffix, final String bottomSuffix) {
|
| 287 | return new TextureMapping()
|
| 288 | .put(TextureSlot.FRONT, getBlockTexture(block, frontSuffix))
|
| 289 | .put(TextureSlot.SIDE, getBlockTexture(block, sideSuffix))
|
| 290 | .put(TextureSlot.TOP, getBlockTexture(block, topSuffix))
|
| 291 | .put(TextureSlot.BOTTOM, getBlockTexture(block, bottomSuffix));
|
| 292 | }
|
| 293 |
|
| 294 | public static TextureMapping particleFromItem(final Item item) {
|
| 295 | return new TextureMapping().put(TextureSlot.PARTICLE, getItemTexture(item));
|
| 296 | }
|
| 297 |
|
| 298 | public static TextureMapping commandBlock(final Block block) {
|
| 299 | return new TextureMapping()
|
| 300 | .put(TextureSlot.SIDE, getBlockTexture(block, "_side"))
|
| 301 | .put(TextureSlot.FRONT, getBlockTexture(block, "_front"))
|
| 302 | .put(TextureSlot.BACK, getBlockTexture(block, "_back"));
|
| 303 | }
|
| 304 |
|
| 305 | public static TextureMapping orientableCube(final Block block) {
|
| 306 | return new TextureMapping()
|
| 307 | .put(TextureSlot.SIDE, getBlockTexture(block, "_side"))
|
| 308 | .put(TextureSlot.FRONT, getBlockTexture(block, "_front"))
|
| 309 | .put(TextureSlot.TOP, getBlockTexture(block, "_top"))
|
| 310 | .put(TextureSlot.BOTTOM, getBlockTexture(block, "_bottom"));
|
| 311 | }
|
| 312 |
|
| 313 | public static TextureMapping orientableCubeOnlyTop(final Block block) {
|
| 314 | return new TextureMapping()
|
| 315 | .put(TextureSlot.SIDE, getBlockTexture(block, "_side"))
|
| 316 | .put(TextureSlot.FRONT, getBlockTexture(block, "_front"))
|
| 317 | .put(TextureSlot.TOP, getBlockTexture(block, "_top"));
|
| 318 | }
|
| 319 |
|
| 320 | public static TextureMapping orientableCubeSameEnds(final Block block) {
|
| 321 | return new TextureMapping()
|
| 322 | .put(TextureSlot.SIDE, getBlockTexture(block, "_side"))
|
| 323 | .put(TextureSlot.FRONT, getBlockTexture(block, "_front"))
|
| 324 | .put(TextureSlot.END, getBlockTexture(block, "_end"));
|
| 325 | }
|
| 326 |
|
| 327 | public static TextureMapping top(final Block block) {
|
| 328 | return new TextureMapping().put(TextureSlot.TOP, getBlockTexture(block, "_top"));
|
| 329 | }
|
| 330 |
|
| 331 | public static TextureMapping craftingTable(final Block table, final Block bottomWood) {
|
| 332 | return new TextureMapping()
|
| 333 | .put(TextureSlot.PARTICLE, getBlockTexture(table, "_front"))
|
| 334 | .put(TextureSlot.DOWN, getBlockTexture(bottomWood))
|
| 335 | .put(TextureSlot.UP, getBlockTexture(table, "_top"))
|
| 336 | .put(TextureSlot.NORTH, getBlockTexture(table, "_front"))
|
| 337 | .put(TextureSlot.EAST, getBlockTexture(table, "_side"))
|
| 338 | .put(TextureSlot.SOUTH, getBlockTexture(table, "_side"))
|
| 339 | .put(TextureSlot.WEST, getBlockTexture(table, "_front"));
|
| 340 | }
|
| 341 |
|
| 342 | public static TextureMapping fletchingTable(final Block table, final Block bottomWood) {
|
| 343 | return new TextureMapping()
|
| 344 | .put(TextureSlot.PARTICLE, getBlockTexture(table, "_front"))
|
| 345 | .put(TextureSlot.DOWN, getBlockTexture(bottomWood))
|
| 346 | .put(TextureSlot.UP, getBlockTexture(table, "_top"))
|
| 347 | .put(TextureSlot.NORTH, getBlockTexture(table, "_front"))
|
| 348 | .put(TextureSlot.SOUTH, getBlockTexture(table, "_front"))
|
| 349 | .put(TextureSlot.EAST, getBlockTexture(table, "_side"))
|
| 350 | .put(TextureSlot.WEST, getBlockTexture(table, "_side"));
|
| 351 | }
|
| 352 |
|
| 353 | public static TextureMapping snifferEgg(final String suffix) {
|
| 354 | return new TextureMapping()
|
| 355 | .put(TextureSlot.PARTICLE, getBlockTexture(Blocks.SNIFFER_EGG, suffix + "_north"))
|
| 356 | .put(TextureSlot.BOTTOM, getBlockTexture(Blocks.SNIFFER_EGG, suffix + "_bottom"))
|
| 357 | .put(TextureSlot.TOP, getBlockTexture(Blocks.SNIFFER_EGG, suffix + "_top"))
|
| 358 | .put(TextureSlot.NORTH, getBlockTexture(Blocks.SNIFFER_EGG, suffix + "_north"))
|
| 359 | .put(TextureSlot.SOUTH, getBlockTexture(Blocks.SNIFFER_EGG, suffix + "_south"))
|
| 360 | .put(TextureSlot.EAST, getBlockTexture(Blocks.SNIFFER_EGG, suffix + "_east"))
|
| 361 | .put(TextureSlot.WEST, getBlockTexture(Blocks.SNIFFER_EGG, suffix + "_west"));
|
| 362 | }
|
| 363 |
|
| 364 | public static TextureMapping driedGhast(final String suffix) {
|
| 365 | return new TextureMapping()
|
| 366 | .put(TextureSlot.PARTICLE, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_north"))
|
| 367 | .put(TextureSlot.BOTTOM, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_bottom"))
|
| 368 | .put(TextureSlot.TOP, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_top"))
|
| 369 | .put(TextureSlot.NORTH, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_north"))
|
| 370 | .put(TextureSlot.SOUTH, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_south"))
|
| 371 | .put(TextureSlot.EAST, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_east"))
|
| 372 | .put(TextureSlot.WEST, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_west"))
|
| 373 | .put(TextureSlot.TENTACLES, getBlockTexture(Blocks.DRIED_GHAST, suffix + "_tentacles"));
|
| 374 | }
|
| 375 |
|
| 376 | public static TextureMapping campfire(final Block campfire) {
|
| 377 | return new TextureMapping().put(TextureSlot.LIT_LOG, getBlockTexture(campfire, "_log_lit")).put(TextureSlot.FIRE, getBlockTexture(campfire, "_fire"));
|
| 378 | }
|
| 379 |
|
| 380 | public static TextureMapping candleCake(final Block block, final boolean lit) {
|
| 381 | return new TextureMapping()
|
| 382 | .put(TextureSlot.PARTICLE, getBlockTexture(Blocks.CAKE, "_side"))
|
| 383 | .put(TextureSlot.BOTTOM, getBlockTexture(Blocks.CAKE, "_bottom"))
|
| 384 | .put(TextureSlot.TOP, getBlockTexture(Blocks.CAKE, "_top"))
|
| 385 | .put(TextureSlot.SIDE, getBlockTexture(Blocks.CAKE, "_side"))
|
| 386 | .put(TextureSlot.CANDLE, getBlockTexture(block, lit ? "_lit" : ""));
|
| 387 | }
|
| 388 |
|
| 389 | public static TextureMapping cauldron(final Material contentTextureLoc) {
|
| 390 | return new TextureMapping()
|
| 391 | .put(TextureSlot.PARTICLE, getBlockTexture(Blocks.CAULDRON, "_side"))
|
| 392 | .put(TextureSlot.SIDE, getBlockTexture(Blocks.CAULDRON, "_side"))
|
| 393 | .put(TextureSlot.TOP, getBlockTexture(Blocks.CAULDRON, "_top"))
|
| 394 | .put(TextureSlot.BOTTOM, getBlockTexture(Blocks.CAULDRON, "_bottom"))
|
| 395 | .put(TextureSlot.INSIDE, getBlockTexture(Blocks.CAULDRON, "_inner"))
|
| 396 | .put(TextureSlot.CONTENT, contentTextureLoc);
|
| 397 | }
|
| 398 |
|
| 399 | public static TextureMapping sculkShrieker(final boolean canSummon) {
|
| 400 | String innerTopString = canSummon ? "_can_summon" : "";
|
| 401 | return new TextureMapping()
|
| 402 | .put(TextureSlot.PARTICLE, getBlockTexture(Blocks.SCULK_SHRIEKER, "_bottom"))
|
| 403 | .put(TextureSlot.SIDE, getBlockTexture(Blocks.SCULK_SHRIEKER, "_side"))
|
| 404 | .put(TextureSlot.TOP, getBlockTexture(Blocks.SCULK_SHRIEKER, "_top"))
|
| 405 | .put(TextureSlot.INNER_TOP, getBlockTexture(Blocks.SCULK_SHRIEKER, innerTopString + "_inner_top"))
|
| 406 | .put(TextureSlot.BOTTOM, getBlockTexture(Blocks.SCULK_SHRIEKER, "_bottom"));
|
| 407 | }
|
| 408 |
|
| 409 | public static TextureMapping bars(final Block block) {
|
| 410 | return new TextureMapping().put(TextureSlot.BARS, getBlockTexture(block)).put(TextureSlot.EDGE, getBlockTexture(block));
|
| 411 | }
|
| 412 |
|
| 413 | public static TextureMapping layer0(final Item item) {
|
| 414 | return new TextureMapping().put(TextureSlot.LAYER0, getItemTexture(item));
|
| 415 | }
|
| 416 |
|
| 417 | public static TextureMapping layer0(final Block block) {
|
| 418 | return new TextureMapping().put(TextureSlot.LAYER0, getBlockTexture(block));
|
| 419 | }
|
| 420 |
|
| 421 | public static TextureMapping layer0(final Material id) {
|
| 422 | return new TextureMapping().put(TextureSlot.LAYER0, id);
|
| 423 | }
|
| 424 |
|
| 425 | public static TextureMapping layered(final Material layer0, final Material layer1) {
|
| 426 | return new TextureMapping().put(TextureSlot.LAYER0, layer0).put(TextureSlot.LAYER1, layer1);
|
| 427 | }
|
| 428 |
|
| 429 | public static TextureMapping layered(final Material layer0, final Material layer1, final Material layer2) {
|
| 430 | return new TextureMapping().put(TextureSlot.LAYER0, layer0).put(TextureSlot.LAYER1, layer1).put(TextureSlot.LAYER2, layer2);
|
| 431 | }
|
| 432 |
|
| 433 | public static Material getBlockTexture(final Block block) {
|
| 434 | Identifier id = BuiltInRegistries.BLOCK.getKey(block);
|
| 435 | return new Material(id.withPrefix("block/"));
|
| 436 | }
|
| 437 |
|
| 438 | public static Material getBlockTexture(final Block block, final String suffix) {
|
| 439 | Identifier id = BuiltInRegistries.BLOCK.getKey(block);
|
| 440 | return getBlockTexture(id, suffix);
|
| 441 | }
|
| 442 |
|
| 443 | private static Material getBlockTexture(final Identifier id, final String suffix) {
|
| 444 | return new Material(id.withPath(path -> "block/" + path + suffix));
|
| 445 | }
|
| 446 |
|
| 447 | public static Material getItemTexture(final Item block) {
|
| 448 | Identifier id = BuiltInRegistries.ITEM.getKey(block);
|
| 449 | return new Material(id.withPrefix("item/"));
|
| 450 | }
|
| 451 |
|
| 452 | public static Material getItemTexture(final Item item, final String suffix) {
|
| 453 | Identifier id = BuiltInRegistries.ITEM.getKey(item);
|
| 454 | return new Material(id.withPath(path -> "item/" + path + suffix));
|
| 455 | }
|
| 456 | }
|
| 457 |
|