forked from dfu/MineColony
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmod_MineColony.java
217 lines (172 loc) · 10.3 KB
/
mod_MineColony.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
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
package net.minecraft.src;
import net.minecraft.client.Minecraft;
import java.util.Properties;
import java.io.IOException;
import java.io.File;
import java.io.FileInputStream;
import java.util.Map;
public class mod_MineColony extends BaseMod {
public static int blockLumberjackID = 95;
public static int blockMinerID = 96;
public static int blockWarehouseID = 97;
public static int blockFarmerID = 98;
public static int blockBankID = 99;
//public static int blockChangerID = 100;
private static final Properties minecolProps = new Properties();
public static Block hutLumberjack;
public static Block hutMiner;
public static Block hutWarehouse;
public static Block hutFarmer;
public static Block hutBank;
//public static Block changer;
public static Item scepterGold;
public static Item scepterSteel;
public static Item moneyGold;
public static Item moneySilver;
public static Item moneyBronze;
public void AddRecipes(CraftingManager recipes) {
//Defaults
recipes.addRecipe(new ItemStack(mod_MineColony.scepterGold, 1),
new Object[] { " X", "# ", Character.valueOf('#'), Item.stick,
Character.valueOf('X'), Item.ingotGold });
recipes.addRecipe(new ItemStack(mod_MineColony.scepterSteel, 1),
new Object[] { " X", "# ", Character.valueOf('#'), Item.stick,
Character.valueOf('X'), Item.ingotIron });
//Money (only gold can be made that caused by lack of materials, but
//money will be changeable at a bank)
recipes.addShapelessRecipe(new ItemStack(mod_MineColony.moneyGold, 25),
new Object[] { Item.ingotGold });
//Individual Huts
//Farmer
recipes.addRecipe(new ItemStack(blockFarmerID, 6,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.hoeDiamond });
recipes.addRecipe(new ItemStack(blockFarmerID, 4,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.hoeGold });
recipes.addRecipe(new ItemStack(blockFarmerID, 3,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.hoeSteel });
recipes.addRecipe(new ItemStack(blockFarmerID, 2,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.hoeStone });
recipes.addRecipe(new ItemStack(blockFarmerID, 1,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.hoeWood });
//LumberJack
recipes.addRecipe(new ItemStack(blockLumberjackID, 2,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.axeStone });
recipes.addRecipe(new ItemStack(blockLumberjackID, 6,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.axeDiamond });
recipes.addRecipe(new ItemStack(blockLumberjackID, 4,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.axeGold });
recipes.addRecipe(new ItemStack(blockLumberjackID, 3,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.axeSteel });
recipes.addRecipe(new ItemStack(blockLumberjackID, 1,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.axeWood });
//Miner
recipes.addRecipe(new ItemStack(blockMinerID, 6,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.pickaxeDiamond });
recipes.addRecipe(new ItemStack(blockMinerID, 4,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.pickaxeGold });
recipes.addRecipe(new ItemStack(blockMinerID, 3,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.pickaxeSteel });
recipes.addRecipe(new ItemStack(blockMinerID, 2,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.pickaxeStone });
recipes.addRecipe(new ItemStack(blockMinerID, 1,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.pickaxeWood });
//Warehouse
recipes.addRecipe(new ItemStack(blockWarehouseID, 1,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Block.crate });
//Bank
recipes.addRecipe(new ItemStack(blockBankID, 1,0),
new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.planks, Character.valueOf('X'), Item.ingotGold });
}
public mod_MineColony() {
try {
String mc_path = (new StringBuilder()).append(Minecraft.getMinecraftDir().getCanonicalPath()).append("/MineColony.properties").toString();
FileInputStream f = new FileInputStream(mc_path);
minecolProps.load(f);
blockLumberjackID = Integer.parseInt(minecolProps.getProperty("LumberjackBlockID"));
blockMinerID = Integer.parseInt(minecolProps.getProperty("MinerBlockID"));
blockFarmerID = Integer.parseInt(minecolProps.getProperty("FarmerBlockID"));
blockWarehouseID = Integer.parseInt(minecolProps.getProperty("WarehouseBlockID"));
blockBankID = Integer.parseInt(minecolProps.getProperty("BankBlockID"));
f.close();
}
catch (IOException e) {
ModLoader.getLogger().warning("[MineColony] could not open conf file.");
ModLoader.getLogger().warning("[MineColony] using default Block IDs\n");
}
int overrideID;
//huts
overrideID = ModLoader.addOverride("/terrain.png", "/Block_hutLumberjack.png");
hutLumberjack = (new BlockHutLumberjack(blockLumberjackID,overrideID)).setHardness(2.5F).setStepSound(Block.soundWoodFootstep).setBlockName("hutLumberjack");
overrideID = ModLoader.addOverride("/terrain.png", "/Block_hutMiner.png");
hutMiner = (new BlockHutMiner(blockMinerID,overrideID)).setHardness(2.5F).setStepSound(Block.soundWoodFootstep).setBlockName("hutMiner");
overrideID = ModLoader.addOverride("/terrain.png", "/Block_hutWarehouse.png");
hutWarehouse = (new BlockHutWarehouse(blockWarehouseID,overrideID)).setHardness(2.5F).setStepSound(Block.soundWoodFootstep).setBlockName("hutWarehouse");
overrideID = ModLoader.addOverride("/terrain.png", "/Block_hutFarmer.png");
hutFarmer = (new BlockHutFarmer(blockFarmerID,overrideID)).setHardness(2.5F).setStepSound(Block.soundWoodFootstep).setBlockName("hutFarmer");
overrideID = ModLoader.addOverride("/terrain.png", "/Block_hutBank.png");
hutBank = (new BlockHutBank(blockBankID,overrideID)).setHardness(2.5F).setStepSound(Block.soundWoodFootstep).setBlockName("hutBank");
//blocks
//items
overrideID = ModLoader.addOverride("/gui/items.png", "/gui/Item_scepterGold.png");
scepterGold = (new ItemScepter(ModLoader.getUniqueEntityId())).setIconIndex(overrideID).setFull3D().setItemName("scepterGold");
overrideID = ModLoader.addOverride("/gui/items.png", "/gui/Item_scepterSteel.png");
scepterSteel = (new ItemScepter(ModLoader.getUniqueEntityId())).setIconIndex(overrideID).setFull3D().setItemName("scepterSteel");
overrideID = ModLoader.addOverride("/gui/items.png", "/gui/Item_moneyGold.png");
moneyGold = (new ItemMoney(ModLoader.getUniqueEntityId())).setIconIndex(overrideID).setFull3D().setItemName("moneyGold");
overrideID = ModLoader.addOverride("/gui/items.png", "/gui/Item_moneySilver.png");
moneySilver = (new ItemMoney(ModLoader.getUniqueEntityId())).setIconIndex(overrideID).setFull3D().setItemName("moneySilver");
overrideID = ModLoader.addOverride("/gui/items.png", "/gui/Item_moneyBronze.png");
moneyBronze = (new ItemMoney(ModLoader.getUniqueEntityId())).setIconIndex(overrideID).setFull3D().setItemName("moneyBronze");
// These return int overrides for something
//blocks
ModLoader.RegisterBlock(hutLumberjack);
ModLoader.RegisterBlock(hutMiner);
ModLoader.RegisterBlock(hutWarehouse);
ModLoader.RegisterBlock(hutFarmer);
ModLoader.RegisterBlock(hutBank);
//entitys
ModLoader.RegisterEntityID(EntityLumberjack.class, "Lumberjack", ModLoader.getUniqueEntityId());
ModLoader.RegisterEntityID(EntityMiner.class, "Miner", ModLoader.getUniqueEntityId());
ModLoader.RegisterEntityID(EntityDeliveryMan.class, "DeliveryMan", ModLoader.getUniqueEntityId());
ModLoader.RegisterEntityID(EntityFarmer.class, "Farmer", ModLoader.getUniqueEntityId());
//register names
ModLoader.AddName(mod_MineColony.scepterGold, "Golden scepter");
ModLoader.AddName(mod_MineColony.scepterSteel, "Iron scepter");
ModLoader.AddName(mod_MineColony.hutLumberjack, "Lumberjack's chest");
ModLoader.AddName(mod_MineColony.hutMiner, "Miner's chest");
ModLoader.AddName(mod_MineColony.hutWarehouse, "Delivery man's chest");
ModLoader.AddName(mod_MineColony.hutBank, "Bank");
ModLoader.AddName(mod_MineColony.hutFarmer, "Farmer's chest");
ModLoader.AddName(mod_MineColony.moneyGold, "Gold coin");
ModLoader.AddName(mod_MineColony.moneySilver, "Silver coin");
ModLoader.AddName(mod_MineColony.moneyBronze, "Bronze coin");
ModLoader.RegisterTileEntity(TileEntityChanger.class, "Changer");
}
public void AddRenderer(Map map) {
map.put(EntityLumberjack.class, new RenderBiped(new ModelBiped(), 0.5F));
map.put(EntityMiner.class, new RenderBiped(new ModelBiped(), 0.5F));
map.put(EntityDeliveryMan.class, new RenderBiped(new ModelBiped(), 0.5F));
map.put(EntityFarmer.class, new RenderBiped(new ModelBiped(), 0.5F));
}
public GuiContainer OpenModGUI(EntityPlayer player, Object instance)
{
if ((instance instanceof TileEntityChanger))
return new GuiChanger(player.inventory, (TileEntityChanger)instance);
return null;
}
/*
public void RegisterTextureOverrides()
{
ModLoader.addOverride("/gui/items.png", "/gui/Item_scepterGold.png", scepterGoldID);
ModLoader.addOverride("/gui/items.png", "/gui/Item_scepterSteel.png", scepterSteelID);
ModLoader.addOverride("/terrain.png", "/Block_hutLumberjack.png", hutLumberjackID);
ModLoader.addOverride("/terrain.png", "/Block_hutMiner.png", hutMinerID);
ModLoader.addOverride("/terrain.png", "/Block_hutWarehouse.png", hutWarehouseID);
ModLoader.addOverride("/terrain.png", "/Block_hutFarmer.png", hutFarmerID);
}
*/
public String Version()
{
return "MineColony 0.411";
}
}