-
Notifications
You must be signed in to change notification settings - Fork 10
/
IronShulkerBoxesTypes.java
137 lines (124 loc) · 5.65 KB
/
IronShulkerBoxesTypes.java
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
package com.progwml6.ironshulkerbox.common.block;
import com.progwml6.ironshulkerbox.common.block.tileentity.CopperShulkerBoxTileEntity;
import com.progwml6.ironshulkerbox.common.block.tileentity.CrystalShulkerBoxTileEntity;
import com.progwml6.ironshulkerbox.common.block.tileentity.DiamondShulkerBoxTileEntity;
import com.progwml6.ironshulkerbox.common.block.tileentity.GenericIronShulkerBoxTileEntity;
import com.progwml6.ironshulkerbox.common.block.tileentity.GoldShulkerBoxTileEntity;
import com.progwml6.ironshulkerbox.common.block.tileentity.IronShulkerBoxTileEntity;
import com.progwml6.ironshulkerbox.common.block.tileentity.ObsidianShulkerBoxTileEntity;
import com.progwml6.ironshulkerbox.common.block.tileentity.SilverShulkerBoxTileEntity;
import net.minecraft.block.BlockState;
import net.minecraft.item.DyeColor;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nullable;
import java.util.Locale;
public enum IronShulkerBoxesTypes implements IStringSerializable {
IRON(54, 9, "_iron.png", IronShulkerBoxTileEntity.class, 184, 222, new ResourceLocation("ironshulkerbox", "textures/gui/iron_container.png"), 256, 256),
GOLD(81, 9, "_gold.png", IronShulkerBoxTileEntity.class, 184, 276, new ResourceLocation("ironshulkerbox", "textures/gui/gold_container.png"), 256, 276),
DIAMOND(108, 12, "_diamond.png", IronShulkerBoxTileEntity.class, 238, 276, new ResourceLocation("ironshulkerbox", "textures/gui/diamond_container.png"), 256, 276),
COPPER(45, 9, "_copper.png", IronShulkerBoxTileEntity.class, 184, 204, new ResourceLocation("ironshulkerbox", "textures/gui/copper_container.png"), 256, 256),
SILVER(72, 9, "_silver.png", IronShulkerBoxTileEntity.class, 184, 258, new ResourceLocation("ironshulkerbox", "textures/gui/silver_container.png"), 256, 276),
CRYSTAL(108, 12, "_crystal.png", IronShulkerBoxTileEntity.class, 238, 276, new ResourceLocation("ironshulkerbox", "textures/gui/diamond_container.png"), 256, 276),
OBSIDIAN(108, 12, "_obsidian.png", IronShulkerBoxTileEntity.class, 238, 276, new ResourceLocation("ironshulkerbox", "textures/gui/diamond_container.png"), 256, 276),
VANILLA(0, 0, "", null, 0, 0, null, 0, 0);
public final String name;
public final int size;
public final int rowLength;
public final String modelTexture;
public final Class<? extends TileEntity> clazz;
public final int xSize;
public final int ySize;
public final ResourceLocation guiTexture;
public final int textureXSize;
public final int textureYSize;
IronShulkerBoxesTypes(int size, int rowLength, String modelTexture, Class<? extends IronShulkerBoxTileEntity> clazz, int xSize, int ySize, ResourceLocation guiTexture, int textureXSize, int textureYSize) {
this.name = this.name().toLowerCase();
this.size = size;
this.rowLength = rowLength;
this.modelTexture = modelTexture;
this.clazz = clazz;
this.xSize = xSize;
this.ySize = ySize;
this.guiTexture = guiTexture;
this.textureXSize = textureXSize;
this.textureYSize = textureYSize;
}
public String getId() {
return this.name().toLowerCase(Locale.ROOT);
}
public String getEnglishName() {
return this.name;
}
@Override
public String getString() {
return this.getEnglishName();
}
public int getRowCount() {
return this.size / this.rowLength;
}
public boolean isTransparent() {
return this == CRYSTAL;
}
/*public static IronShulkerBoxesTypes get(ResourceLocation resourceLocation, DyeColor color) {
switch (resourceLocation.toString()) {
case BlockNames.IRON_SHULKER_BOX:
return IRON;
case BlockNames.GOLD_SHULKER_BOX:
return GOLD;
case BlockNames.DIAMOND_SHULKER_BOX:
return DIAMOND;
case BlockNames.COPPER_SHULKER_BOX:
return COPPER;
case BlockNames.SILVER_SHULKER_BOX:
return SILVER;
case BlockNames.CRYSTAL_SHULKER_BOX:
return CRYSTAL;
case BlockNames.OBSIDIAN_SHULKER_BOX:
return OBSIDIAN;
default:
return VANILLA;
}
}*/
public static BlockState get(IronShulkerBoxesTypes type, DyeColor color) {
switch (type) {
case IRON:
return ShulkerBoxesBlocks.IRON_SHULKER_BOXES.get(color.getId()).get().getDefaultState();
case GOLD:
return ShulkerBoxesBlocks.GOLD_SHULKER_BOXES.get(color.getId()).get().getDefaultState();
case DIAMOND:
return ShulkerBoxesBlocks.DIAMOND_SHULKER_BOXES.get(color.getId()).get().getDefaultState();
case CRYSTAL:
return ShulkerBoxesBlocks.CRYSTAL_SHULKER_BOXES.get(color.getId()).get().getDefaultState();
case COPPER:
return ShulkerBoxesBlocks.COPPER_SHULKER_BOXES.get(color.getId()).get().getDefaultState();
case SILVER:
return ShulkerBoxesBlocks.SILVER_SHULKER_BOXES.get(color.getId()).get().getDefaultState();
case OBSIDIAN:
return ShulkerBoxesBlocks.OBSIDIAN_SHULKER_BOXES.get(color.getId()).get().getDefaultState();
default:
return null;
}
}
public GenericIronShulkerBoxTileEntity makeEntity(@Nullable DyeColor colorIn) {
switch (this) {
case IRON:
return new IronShulkerBoxTileEntity(colorIn);
case GOLD:
return new GoldShulkerBoxTileEntity(colorIn);
case DIAMOND:
return new DiamondShulkerBoxTileEntity(colorIn);
case COPPER:
return new CopperShulkerBoxTileEntity(colorIn);
case SILVER:
return new SilverShulkerBoxTileEntity(colorIn);
case CRYSTAL:
return new CrystalShulkerBoxTileEntity(colorIn);
case OBSIDIAN:
return new ObsidianShulkerBoxTileEntity(colorIn);
default:
return null;
}
}
}