Skip to content

Commit 6524536

Browse files
committed
3.1.2
1 parent f5afe2a commit 6524536

23 files changed

+160
-53
lines changed

dev/Block/Ore.js

+27-10
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ ToolAPI.registerBlockMaterial(BlockID.oreGraphite,"stone",2);
5252
Block.setDestroyTime(BlockID.oreGraphite,3);
5353
Block.setDestroyLevel("oreGraphite",2);
5454

55+
Block.registerDropFunction("oreGraphite",function(coords,id,data,level,enchant){
56+
if(level >= 2){
57+
if(enchant.silk){return [[id,1,data]];}
58+
return [[ItemID.dustCarbon,random(1 * (enchant.fortune + 1),4 * (enchant.fortune + 1)),0]];
59+
}
60+
return [];
61+
},2);
62+
5563
// 钨矿石
5664
IDRegistry.genBlockID("oreTungsten");
5765
Block.createBlock("oreTungsten",[
@@ -88,6 +96,23 @@ ToolAPI.registerBlockMaterial(BlockID.oreBauxite,"stone",2);
8896
Block.setDestroyTime(BlockID.oreBauxite,3);
8997
Block.setDestroyLevel("oreBauxite",2);
9098

99+
// 盐矿石
100+
IDRegistry.genBlockID("oreSalt");
101+
Block.createBlock("oreSalt",[
102+
{name:"Salt Ore",texture:[["salt_ore",0]],inCreative:true}
103+
],"opaque");
104+
ToolAPI.registerBlockMaterial(BlockID.oreSalt,"stone",1);
105+
Block.setDestroyTime(BlockID.oreSalt,3);
106+
Block.setDestroyLevel("oreSalt",1);
107+
108+
Block.registerDropFunction("oreSalt",function(coords,id,data,level,enchant){
109+
if(level >= 1){
110+
if(enchant.silk){return [[id,1,data]];}
111+
return [[ItemID.dustSalt,random(1 * (enchant.fortune + 1),4 * (enchant.fortune + 1)),0]];
112+
}
113+
return [];
114+
},1);
115+
91116
var VEIN = [
92117
// 煤炭矿脉
93118
{name:"Coal",ores:[{id:16,data:0}],minHeight:48,maxHeight:128,size:10},
@@ -114,7 +139,7 @@ var VEIN = [
114139
{name:"Galena",ores:[{id:BlockID.oreGalena,data:0},{id:BlockID.oreSilver,data:0}],minHeight:32,maxHeight:64,size:4},
115140

116141
// 岩盐矿脉
117-
{name:"Salt",ores:[{id:BlockID.oreSpodumene,data:0}],minHeight:48,maxHeight:64,size:2}
142+
{name:"Salt",ores:[{id:BlockID.oreSalt,data:0},{id:BlockID.oreSpodumene,data:0}],minHeight:48,maxHeight:64,size:2}
118143
];
119144

120145
Callback.addCallback("PreLoaded",function(){
@@ -154,12 +179,4 @@ Callback.addCallback("PreLoaded",function(){
154179
Tool.setHammerDestroyDrop(BlockID.oreBauxite,ItemID.oreChunkBauxite,4,0,true);
155180

156181
Recipe.addBlastFurnaceRecipe({id:BlockID.oreTungsten,data:0},[{id:ItemID.ingotTungsten,count:1,data:0},{id:ItemID.slag,count:1,data:0}]);
157-
});
158-
159-
Block.registerDropFunction("oreGraphite",function(coords,id,data,level,enchant){
160-
if(level >= 2){
161-
if(enchant.silk){return [[id,1,data]];}
162-
return [[ItemID.dustCarbon,random(1 * (enchant.fortune + 1),4 * (enchant.fortune + 1)),0]];
163-
}
164-
return [];
165-
},2);
182+
});

dev/Block/Scaffold.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ Machine.registerPrototype(BlockID.scaffoldWood,{
4141
},
4242

4343
tick:function(){
44-
this.deactive();
44+
this.renderer();
4545

4646
var bottom = World.getBlock(this.x,this.y - 1,this.z).id;
4747
if(bottom == 0){World.destroyBlock(this.x,this.y,this.z,true);}
4848
},
4949

50-
deactive:function(){
50+
renderer:function(){
5151
var top = World.getBlock(this.x,this.y + 1,this.z).id,bottom = World.getBlock(this.x,this.y - 1,this.z).id;
5252
if(top != this.id && bottom != this.id){this.data.meta = 0;}
5353
if(top != this.id && bottom == this.id){this.data.meta = 1;}
@@ -57,7 +57,7 @@ Machine.registerPrototype(BlockID.scaffoldWood,{
5757
},
5858

5959
destroy:function(){
60-
this.deactive();
60+
this.renderer();
6161
BlockRenderer.unmapAtCoords(this.x,this.y,this.z);
6262
}
6363
});
@@ -75,13 +75,13 @@ Machine.registerPrototype(BlockID.scaffoldIron,{
7575
},
7676

7777
tick:function(){
78-
this.deactive();
78+
this.renderer();
7979

8080
var bottom = World.getBlock(this.x,this.y - 1,this.z).id;
8181
if(bottom == 0){World.destroyBlock(this.x,this.y,this.z,true);}
8282
},
8383

84-
deactive:function(){
84+
renderer:function(){
8585
var top = World.getBlock(this.x,this.y + 1,this.z).id,bottom = World.getBlock(this.x,this.y - 1,this.z).id;
8686
if(top != this.id && bottom != this.id){this.data.meta = 0;}
8787
if(top != this.id && bottom == this.id){this.data.meta = 1;}
@@ -91,7 +91,7 @@ Machine.registerPrototype(BlockID.scaffoldIron,{
9191
},
9292

9393
destroy:function(){
94-
this.deactive();
94+
this.renderer();
9595
BlockRenderer.unmapAtCoords(this.x,this.y,this.z);
9696
}
9797
});

dev/Item/Cell.js

-13
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,54 @@
11
IDRegistry.genItemID("cellEmpty");
22
Item.createItem("cellEmpty","Liquid Cell (Empty)",{name:"empty_cell"});
33
Item.setLiquidClip(ItemID.cellEmpty,true);
4-
Tool.registerTool(ItemID.cellEmpty,"Cell");
54

65
IDRegistry.genItemID("cellWater");
76
Item.createItem("cellWater","Liquid Cell (Water)",{name:"water_cell"});
87
LiquidRegistry.registerItem("water",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellWater,data:0});
9-
Tool.registerTool(ItemID.cellWater,"Cell");
108

119
IDRegistry.genItemID("cellLava");
1210
Item.createItem("cellLava","Liquid Cell (Lava)",{name:"lava_cell"});
1311
LiquidRegistry.registerItem("lava",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellLava,data:0});
14-
Tool.registerTool(ItemID.cellLava,"Cell");
1512

1613
IDRegistry.genItemID("cellUranium235");
1714
Item.createItem("cellUranium235","Liquid Cell (Uranium-235)",{name:"uranium235_cell"});
1815
LiquidRegistry.registerItem("uranium235",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellUranium235,data:0});
19-
Tool.registerTool(ItemID.cellUranium235,"Cell");
2016

2117
IDRegistry.genItemID("cellUranium238");
2218
Item.createItem("cellUranium238","Liquid Cell (Uranium-238)",{name:"uranium238_cell"});
2319
LiquidRegistry.registerItem("uranium238",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellUranium238,data:0});
24-
Tool.registerTool(ItemID.cellUranium238,"Cell");
2520

2621
IDRegistry.genItemID("cellLithium6");
2722
Item.createItem("cellLithium6","Liquid Cell (Lithium-6)",{name:"lithium6_cell"});
2823
LiquidRegistry.registerItem("lithium6",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellLithium6,data:0});
29-
Tool.registerTool(ItemID.cellLithium6,"Cell");
3024

3125
IDRegistry.genItemID("cellLithium7");
3226
Item.createItem("cellLithium7","Liquid Cell (Lithium-7)",{name:"lithium7_cell"});
3327
LiquidRegistry.registerItem("lithium7",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellLithium7,data:0});
34-
Tool.registerTool(ItemID.cellLithium7,"Cell");
3528

3629
IDRegistry.genItemID("cellTritium");
3730
Item.createItem("cellTritium","Liquid Cell (Tritium)",{name:"tritium_cell"});
3831
LiquidRegistry.registerItem("tritium",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellTritium,data:0});
39-
Tool.registerTool(ItemID.cellTritium,"Cell");
4032

4133
IDRegistry.genItemID("cellDeuterium");
4234
Item.createItem("cellDeuterium","Liquid Cell (Deuterium)",{name:"deuterium_cell"});
4335
LiquidRegistry.registerItem("deuterium",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellDeuterium,data:0});
44-
Tool.registerTool(ItemID.cellDeuterium,"Cell");
4536

4637
IDRegistry.genItemID("cellHelium");
4738
Item.createItem("cellHelium","Liquid Cell (Helium)",{name:"helium_cell"});
4839
LiquidRegistry.registerItem("helium",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellHelium,data:0});
49-
Tool.registerTool(ItemID.cellHelium,"Cell");
5040

5141
IDRegistry.genItemID("cellHelium3");
5242
Item.createItem("cellHelium3","Liquid Cell (Helium-3)",{name:"helium3_cell"});
5343
LiquidRegistry.registerItem("helium3",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellHelium3,data:0});
54-
Tool.registerTool(ItemID.cellHelium3,"Cell");
5544

5645
IDRegistry.genItemID("cellDistilledWater");
5746
Item.createItem("cellDistilledWater","Liquid Cell (Distilled Water)",{name:"distilled_water_cell"});
5847
LiquidRegistry.registerItem("distilledWater",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellDistilledWater,data:0});
59-
Tool.registerTool(ItemID.cellDistilledWater,"Cell");
6048

6149
IDRegistry.genItemID("cellHeavyWater");
6250
Item.createItem("cellHeavyWater","Liquid Cell (Heavy Water)",{name:"heavy_water_cell"});
6351
LiquidRegistry.registerItem("heavyWater",{id:ItemID.cellEmpty,data:0},{id:ItemID.cellHeavyWater,data:0});
64-
Tool.registerTool(ItemID.cellHeavyWater,"Cell");
6552

6653
Item.registerUseFunction("cellEmpty",function(coords,item,block){
6754
if(block.id > 7 && block.id < 12 && block.data == 0){

dev/Machine/Superconductor.js

+17-16
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
2+
3+
// Block
4+
IDRegistry.genBlockID("superconductor");
5+
Block.createBlock("superconductor",[
6+
{name:"Superconductor",texture:[["superconductor",0]],inCreative:true},
7+
{name:"Superconductor",texture:[["superconductor",0]],inCreative:false}
8+
],"wire");
9+
10+
Block.setBlockShape(BlockID.superconductor,{x:0.375,y:0.375,z:0},{x:0.625,y:0.625,z:1},0);
11+
TileRenderer.setupWireModel(BlockID.superconductor,1,0.25,"et-wire",true);
12+
113
Item.addTooltip(BlockID.superconductor,Translation.translate("Power Tier: ") + 1);
214
Item.addTooltip(BlockID.superconductor,Translation.translate("Max Voltage: ") + power(1) + "EU/t");
315
Item.addTooltip(BlockID.superconductor,Translation.translate("Info: ") + Translation.translate("You can use it to connect to the Network Terminal to transmit energy."));
@@ -6,10 +18,13 @@ Callback.addCallback("PreLoaded",function(){
618
Recipes.addShaped({id:BlockID.superconductor,count:1,data:0},["dcd","aba","dcd"],["a",ItemID.wireTungsten,0,"b",ItemID.circuitTransformer,0,"c",ItemID.plateSteel,0,"d",ItemID.partSteel,0]);
719
});
820

21+
Block.registerDropFunction("superconductor",function(Coords,ID,Data){
22+
return [[BlockID.superconductor,1,0]];
23+
});
24+
925
Block.registerPlaceFunction(BlockID.superconductor,function(coords,item){
1026
Game.prevent();
11-
var block = World.getBlock(coords.x,coords.y,coords.z);
12-
var place = coords;
27+
var block = World.getBlock(coords.x,coords.y,coords.z),place = coords;
1328
if(!canTileBeReplaced(block.id,block.data)){
1429
place = coords.relative,block = World.getBlock(place.x,place.y,place.z);
1530
if(!canTileBeReplaced(block.id,block.data)){return;}
@@ -19,20 +34,6 @@ Block.registerPlaceFunction(BlockID.superconductor,function(coords,item){
1934
Player.decreaseCarriedItem(1);
2035
});
2136

22-
// Block
23-
IDRegistry.genBlockID("superconductor");
24-
Block.createBlock("superconductor",[
25-
{name:"Superconductor",texture:[["superconductor",0]],inCreative:true},
26-
{name:"Superconductor",texture:[["superconductor",0]],inCreative:false}
27-
],"wire");
28-
29-
Block.setBlockShape(BlockID.superconductor,{x:0.375,y:0.375,z:0},{x:0.625,y:0.625,z:1},0);
30-
TileRenderer.setupWireModel(BlockID.superconductor,1,0.25,"et-wire",true);
31-
32-
Block.registerDropFunction("superconductor",function(Coords,ID,Data){
33-
return [[BlockID.superconductor,1,0]];
34-
});
35-
3637
var GuiSuperconductorCoil = new UI.StandartWindow({
3738
standart:{
3839
header:{text:{text:Translation.translate("Superconductor")}},

dev/Resource/Material.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ var SMALL_STONE = {
4444
"Iron":{id:ItemID.oreChunkIron,count:1,data:0},
4545

4646
// 方铅矿脉
47-
"Galena":{id:ItemID.oreChunkGalena,count:1,data:0}
47+
"Galena":{id:ItemID.oreChunkGalena,count:1,data:0},
48+
49+
// 岩盐矿脉
50+
"Salt":{id:ItemID.dustSmallSalt,count:1,data:0}
4851
}
4952

5053
Block.registerDropFunction("smallStone",function(coords){

dev/block/glass_tank.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ for(var i = 0;i < 16;i++){
2020
Block.registerPlaceFunction(BlockID[id],function(coords,item){
2121
Game.prevent();
2222

23-
var place = coords;
23+
var block = World.getBlock(coords.x,coords.y,coords.z),place = coords;
2424
if(!canTileBeReplaced(block.id,block.data)){
2525
place = coords.relative,block = World.getBlock(place.x,place.y,place.z);
2626
if(!canTileBeReplaced(block.id,block.data)){return;}
2727
}
28-
2928
World.setBlock(place.x,place.y,place.z,item.id,item.data);
3029
var tile = World.addTileEntity(place.x,place.y,place.z);
3130
if(item.extra){
3231
tile.liquidStorage.addLiquid(item.extra.getString("liquid_stored"),item.extra.getFloat("liquid_amount"));
3332
}
33+
3434
Player.decreaseCarriedItem(1);
3535
});
3636

dev/core/api/tool.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ var Tool = {
55
if(!this.tool[type]){this.tool[type] = []}
66
this.tool[type].push(id);
77

8-
Item.setCategory(id,Native.ItemCategory.TOOL);
98
Item.addTooltip(id,Translation.translate("Tool Type: ") + Translation.translate(type));
109
},
1110

@@ -43,4 +42,12 @@ Callback.addCallback("DestroyBlock",function(coords,block,player){
4342
if(Tool.isTool(item.id,"Shovel") && material.dirt){
4443
Block.setTempDestroyTime(block.id,0.5);
4544
}
46-
});
45+
});
46+
47+
var OreIDs = {};
48+
for(id in BlockID){
49+
var tile = TileEntity.isTileEntityBlock(BlockID[id]);
50+
if(id[0] == "o" && id[1] == "r" && id[2] == "e" && !tile){
51+
OreIDs[BlockID[id]] = true;
52+
}
53+
}

dev/header.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ var ChunkRegistry = {
1111
chunk:{},
1212

1313
getChunk:function(x,z){
14-
return this.chunk[x + ":" + z];
14+
var chunk = this.chunk[x + ":" + z];
15+
if(chunk){return chunk;}
16+
return null;
1517
}
1618
},network = {}
1719

dev/item/tool/antimony.js

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Callback.addCallback("PreLoaded",function(){
3131
Item.addRepairItemIds(ItemID.axeAntimony,[ItemID.ingotAntimony]);
3232
Item.addRepairItemIds(ItemID.hoeAntimony,[ItemID.ingotAntimony]);
3333

34+
Item.setCategory(ItemID.swordAntimony,ItemCategory.TOOL);
35+
Item.setCategory(ItemID.shovelAntimony,ItemCategory.TOOL);
36+
Item.setCategory(ItemID.pickaxeAntimony,ItemCategory.TOOL);
37+
Item.setCategory(ItemID.axeAntimony,ItemCategory.TOOL);
38+
Item.setCategory(ItemID.hoeAntimony,ItemCategory.TOOL);
39+
3440
Item.addCreativeGroup("sword",Translation.translate("Sword"),[ItemID.swordAntimony]);
3541
Item.addCreativeGroup("shovel",Translation.translate("Shovel"),[ItemID.shovelAntimony]);
3642
Item.addCreativeGroup("pickaxe",Translation.translate("Pickaxe"),[ItemID.pickaxeAntimony]);

dev/item/tool/copper.js

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Callback.addCallback("PreLoaded",function(){
3131
Item.addRepairItemIds(ItemID.axeCopper,[ItemID.ingotCopper]);
3232
Item.addRepairItemIds(ItemID.hoeCopper,[ItemID.ingotCopper]);
3333

34+
Item.setCategory(ItemID.swordCopper,ItemCategory.TOOL);
35+
Item.setCategory(ItemID.shovelCopper,ItemCategory.TOOL);
36+
Item.setCategory(ItemID.pickaxeCopper,ItemCategory.TOOL);
37+
Item.setCategory(ItemID.axeCopper,ItemCategory.TOOL);
38+
Item.setCategory(ItemID.hoeCopper,ItemCategory.TOOL);
39+
3440
Item.addCreativeGroup("sword",Translation.translate("Sword"),[ItemID.swordCopper]);
3541
Item.addCreativeGroup("shovel",Translation.translate("Shovel"),[ItemID.shovelCopper]);
3642
Item.addCreativeGroup("pickaxe",Translation.translate("Pickaxe"),[ItemID.pickaxeCopper]);

dev/item/tool/flint.js

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Callback.addCallback("PreLoaded",function(){
3131
Item.addRepairItemIds(ItemID.axeFlint,[318]);
3232
Item.addRepairItemIds(ItemID.hoeFlint,[318]);
3333

34+
Item.setCategory(ItemID.swordFlint,ItemCategory.TOOL);
35+
Item.setCategory(ItemID.shovelFlint,ItemCategory.TOOL);
36+
Item.setCategory(ItemID.pickaxeFlint,ItemCategory.TOOL);
37+
Item.setCategory(ItemID.axeFlint,ItemCategory.TOOL);
38+
Item.setCategory(ItemID.hoeFlint,ItemCategory.TOOL);
39+
3440
Item.addCreativeGroup("sword",Translation.translate("Sword"),[ItemID.swordFlint]);
3541
Item.addCreativeGroup("shovel",Translation.translate("Shovel"),[ItemID.shovelFlint]);
3642
Item.addCreativeGroup("pickaxe",Translation.translate("Pickaxe"),[ItemID.pickaxeFlint]);

dev/item/tool/iron.js

+5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ Callback.addCallback("PreLoaded",function(){
2929
Item.addRepairItemIds(ItemID.mortarIron,[265]);
3030
Item.addRepairItemIds(ItemID.fileIron,[265]);
3131

32+
Item.setCategory(ItemID.wrenchIron,ItemCategory.TOOL);
33+
Item.setCategory(ItemID.cutterIron,ItemCategory.TOOL);
34+
Item.setCategory(ItemID.mortarIron,ItemCategory.TOOL);
35+
Item.setCategory(ItemID.fileIron,ItemCategory.TOOL);
36+
3237
Item.addCreativeGroup("hammer",Translation.translate("Hammer"),[ItemID.hammerIron]);
3338
Item.addCreativeGroup("wrench",Translation.translate("Wrench"),[ItemID.wrenchIron]);
3439
Item.addCreativeGroup("cutter",Translation.translate("Cutter"),[ItemID.cutterIron]);

dev/item/tool/lead.js

+6
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ Callback.addCallback("PreLoaded",function(){
3131
Item.addRepairItemIds(ItemID.axeLead,[ItemID.ingotLead]);
3232
Item.addRepairItemIds(ItemID.hoeLead,[ItemID.ingotLead]);
3333

34+
Item.setCategory(ItemID.swordLead,ItemCategory.TOOL);
35+
Item.setCategory(ItemID.shovelLead,ItemCategory.TOOL);
36+
Item.setCategory(ItemID.pickaxeLead,ItemCategory.TOOL);
37+
Item.setCategory(ItemID.axeLead,ItemCategory.TOOL);
38+
Item.setCategory(ItemID.hoeLead,ItemCategory.TOOL);
39+
3440
Item.addCreativeGroup("sword",Translation.translate("Sword"),[ItemID.swordLead]);
3541
Item.addCreativeGroup("shovel",Translation.translate("Shovel"),[ItemID.shovelLead]);
3642
Item.addCreativeGroup("pickaxe",Translation.translate("Pickaxe"),[ItemID.pickaxeLead]);

dev/item/tool/steel.js

+11
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ Callback.addCallback("PreLoaded",function(){
5757
Item.addRepairItemIds(ItemID.mortarSteel,[ItemID.ingotSteel]);
5858
Item.addRepairItemIds(ItemID.fileSteel,[ItemID.ingotSteel]);
5959

60+
Item.setCategory(ItemID.swordSteel,ItemCategory.TOOL);
61+
Item.setCategory(ItemID.shovelSteel,ItemCategory.TOOL);
62+
Item.setCategory(ItemID.pickaxeSteel,ItemCategory.TOOL);
63+
Item.setCategory(ItemID.axeSteel,ItemCategory.TOOL);
64+
Item.setCategory(ItemID.hoeSteel,ItemCategory.TOOL);
65+
Item.setCategory(ItemID.hammerSteel,ItemCategory.TOOL);
66+
Item.setCategory(ItemID.wrenchSteel,ItemCategory.TOOL);
67+
Item.setCategory(ItemID.cutterSteel,ItemCategory.TOOL);
68+
Item.setCategory(ItemID.mortarSteel,ItemCategory.TOOL);
69+
Item.setCategory(ItemID.fileSteel,ItemCategory.TOOL);
70+
6071
Item.addCreativeGroup("sword",Translation.translate("Sword"),[ItemID.swordSteel]);
6172
Item.addCreativeGroup("shovel",Translation.translate("Shovel"),[ItemID.shovelSteel]);
6273
Item.addCreativeGroup("pickaxe",Translation.translate("Pickaxe"),[ItemID.pickaxeSteel]);

0 commit comments

Comments
 (0)