Skip to content

Commit 01a2e1b

Browse files
committed
2.0.0A7
1 parent e0ac05a commit 01a2e1b

File tree

179 files changed

+771
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

179 files changed

+771
-390
lines changed

config.json

+17-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
},
1919
"tetrahedrite":{
2020
"enabled":true,
21-
"count":16,
22-
"size":8,
21+
"count":8,
22+
"size":4,
2323
"minHeight":0,
2424
"maxHeight":64
2525
},
@@ -35,7 +35,7 @@
3535
"count":16,
3636
"size":8,
3737
"minHeight":0,
38-
"maxHeight":64
38+
"maxHeight":32
3939
},
4040
"lithium":{
4141
"enabled":true,
@@ -57,6 +57,20 @@
5757
"size":8,
5858
"minHeight":0,
5959
"maxHeight":64
60+
},
61+
"antimony":{
62+
"enabled":false,
63+
"count":4,
64+
"size":2,
65+
"minHeight":0,
66+
"maxHeight":16
67+
},
68+
"uranium":{
69+
"enabled":false,
70+
"count":4,
71+
"size":2,
72+
"minHeight":0,
73+
"maxHeight":64
6074
}
6175
}
6276
}

dev/.includes

+12-5
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@ header.js
22
translation.js
33

44
core/api/machine.js
5+
core/api/reactor.js
56
core/api/recipe.js
67
core/api/tool.js
78

89
block/block.js
910
block/machine_casing.js
1011
block/ore.js
1112

12-
generator/fire_generator.js
13-
generator/nuclear_reactor.js
14-
generator/solar_generator.js
15-
1613
item/material/circuit.js
14+
item/material/crushed_ore.js
1715
item/material/dust_impure.js
1816
item/material/dust.js
1917
item/material/electric.js
@@ -24,13 +22,22 @@ item/material/stick.js
2422

2523
item/tool/battery.js
2624
item/tool/cell.js
25+
item/tool/copper.js
2726
item/tool/iron.js
27+
item/tool/lead.js
28+
item/tool/tin.js
2829
item/tool/wire.js
2930

3031
machine/battery.js
31-
machine/blast_furnace.js
32+
machine/centrifuge.js
3233
machine/compressor.js
34+
machine/crude_blast_furnace.js
35+
machine/crusher.js
3336
machine/electric_furnace.js
3437
machine/macerator.js
3538

39+
machine/generator/fire_generator.js
40+
machine/generator/nuclear_reactor.js
41+
machine/generator/solar_generator.js
42+
3643
core/modapi.js

dev/block/block.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ CreateBlock = function(id,name,texture){
88
}
99

1010
ETRecipe.addBlockRecipe = function(output,input){
11-
Recipes.addShaped(output,["aaa","aaa","aaa"],["a",input[0].id,input[0].data]);
12-
Recipes.addShapeless({id:input[0].id,count:9,data:input[0].data},[{id:output.id,data:output.data}]);
11+
Recipes.addShaped({id:output.id,count:1,data:output.data},["aaa","aaa","aaa"],["a",input.id,input.data]);
12+
Recipes.addShapeless({id:input.id,count:9,data:input.data},[{id:output.id,data:output.data}]);
1313
}
1414

1515
CreateBlock("blockCopper" ,"Copper Block" ,[["copper_block" ,0]]);
@@ -24,14 +24,14 @@ CreateBlock("blockTungsten" ,"Tungsten Block" ,[["tungsten_block" ,0]
2424
CreateBlock("blockLeadAntimony","Lead-Antimony Block",[["lead_antimony_block",0]]);
2525

2626
Callback.addCallback("PreLoaded",function(){
27-
ETRecipe.addBlockRecipe({id:BlockID.blockCopper ,count:1,data:0},[{id:ItemID.ingotCopper ,data:0}]);
28-
ETRecipe.addBlockRecipe({id:BlockID.blockTin ,count:1,data:0},[{id:ItemID.ingotTin ,data:0}]);
29-
ETRecipe.addBlockRecipe({id:BlockID.blockLead ,count:1,data:0},[{id:ItemID.ingotLead ,data:0}]);
30-
ETRecipe.addBlockRecipe({id:BlockID.blockWroughtIron ,count:1,data:0},[{id:ItemID.ingotWroughtIron ,data:0}]);
31-
ETRecipe.addBlockRecipe({id:BlockID.blockSteel ,count:1,data:0},[{id:ItemID.ingotSteel ,data:0}]);
32-
ETRecipe.addBlockRecipe({id:BlockID.blockAntimony ,count:1,data:0},[{id:ItemID.ingotAntimony ,data:0}]);
33-
ETRecipe.addBlockRecipe({id:BlockID.blockLithium ,count:1,data:0},[{id:ItemID.ingotLithium ,data:0}]);
34-
ETRecipe.addBlockRecipe({id:BlockID.blockCarbon ,count:1,data:0},[{id:ItemID.dustCarbon ,data:0}]);
35-
ETRecipe.addBlockRecipe({id:BlockID.blockTungsten ,count:1,data:0},[{id:ItemID.dustTungsten ,data:0}]);
36-
ETRecipe.addBlockRecipe({id:BlockID.blockLeadAntimony,count:1,data:0},[{id:ItemID.ingotLeadAntimony,data:0}]);
27+
ETRecipe.addBlockRecipe({id:BlockID.blockCopper ,data:0},{id:ItemID.ingotCopper ,data:0});
28+
ETRecipe.addBlockRecipe({id:BlockID.blockTin ,data:0},{id:ItemID.ingotTin ,data:0});
29+
ETRecipe.addBlockRecipe({id:BlockID.blockLead ,data:0},{id:ItemID.ingotLead ,data:0});
30+
ETRecipe.addBlockRecipe({id:BlockID.blockWroughtIron ,data:0},{id:ItemID.ingotWroughtIron ,data:0});
31+
ETRecipe.addBlockRecipe({id:BlockID.blockSteel ,data:0},{id:ItemID.ingotSteel ,data:0});
32+
ETRecipe.addBlockRecipe({id:BlockID.blockAntimony ,data:0},{id:ItemID.ingotAntimony ,data:0});
33+
ETRecipe.addBlockRecipe({id:BlockID.blockLithium ,data:0},{id:ItemID.ingotLithium ,data:0});
34+
ETRecipe.addBlockRecipe({id:BlockID.blockCarbon ,data:0},{id:ItemID.dustCarbon ,data:0});
35+
ETRecipe.addBlockRecipe({id:BlockID.blockTungsten ,data:0},{id:ItemID.ingotTungsten ,data:0});
36+
ETRecipe.addBlockRecipe({id:BlockID.blockLeadAntimony,data:0},{id:ItemID.ingotLeadAntimony,data:0});
3737
});

dev/block/ore.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,26 @@ CreateOre("oreLead" ,"Lead Ore" ,[["lead_ore",0]] ,2,"lead"
3131
CreateOre("oreLithium" ,"Lithium Ore" ,[["lithium_ore",0]] ,2,"lithium" );
3232
CreateOre("oreGraphite" ,"Graphite Ore" ,[["graphite_ore",0]] ,2,"graphite" );
3333
CreateOre("oreTungsten" ,"Tungsten Ore" ,[["tungsten_ore",0]] ,2,"tungsten" );
34+
CreateOre("oreAntimony" ,"Antimony Ore" ,[["antimony_ore",0]] ,2,"antimony" );
35+
CreateOre("oreUranium" ,"Uranium Ore" ,[["uranium_ore",0]] ,2,"uranium" );
36+
37+
Callback.addCallback("PreLoaded",function(){
38+
Recipes.addFurnace(BlockID.oreCopper ,ItemID.ingotCopper );
39+
Recipes.addFurnace(BlockID.oreTetrahedrite,ItemID.ingotCopper );
40+
Recipes.addFurnace(BlockID.oreTin ,ItemID.ingotTin );
41+
Recipes.addFurnace(BlockID.oreLead ,ItemID.ingotLead );
42+
Recipes.addFurnace(BlockID.oreLithium ,ItemID.ingotLithium );
43+
Recipes.addFurnace(BlockID.oreGraphite ,ItemID.dustCarbon );
44+
Recipes.addFurnace(BlockID.oreTungsten ,ItemID.ingotTungsten);
45+
Recipes.addFurnace(BlockID.oreAntimony ,ItemID.ingotAntimony);
46+
Recipes.addFurnace(BlockID.oreUranium ,ItemID.ingotUranium );
47+
});
3448

3549
Block.registerDropFunction("oreGraphite",function(coords,id,data,level,enchant){
36-
var count = random(1 * (enchant.fortune + 1),4 * (enchant.fortune + 1));
37-
if(enchant.silk){
38-
return [[BlockID.oreGraphite,1,0]];
39-
}
40-
return [[ItemID.dustCarbon,count,0]];
41-
});
50+
if(level >= 2){
51+
if(enchant.silk){
52+
return [[id,1,data]];
53+
}
54+
return [[ItemID.dustCarbon,random(1 * (enchant.fortune + 1),4 * (enchant.fortune + 1)),0]];
55+
}
56+
},2);

dev/core/api/machine.js

+19-32
Original file line numberDiff line numberDiff line change
@@ -72,61 +72,50 @@ var ETMachine = {
7272
ICRender.getGroup("et-wire").add(id,-1);
7373

7474
if(state.defaultValues){
75+
state.defaultValues.tier = state.defaultValues.tier || 1;
7576
state.defaultValues.energy = 0;
7677
state.defaultValues.voltage = 0;
77-
state.defaultValues.voltageLast = 0;
78+
state.defaultValues.last_voltage = 0;
79+
state.defaultValues.energy_storage = state.defaultValues.energy_storage || 16384;
7880
} else {
7981
state.defaultValues = {
82+
tier:1,
8083
energy:0,
8184
voltage:0,
82-
voltageLast:0
85+
last_voltage:0,
86+
energy_storage:16384
8387
}
8488
}
8589

86-
state.getMaxVoltage = function(){
87-
return 8 << this.getTier() * 2;
88-
}
89-
90-
state.getTier = function(){
91-
return this.data.tier?this.data.tier:1;
92-
}
93-
94-
state.getEnergyStorage = function(){
95-
return this.data.energyStorage?this.data.energyStorage:16384;
96-
}
90+
state.getTier = function(){return this.data.tier;}
91+
state.getMaxVoltage = function(){return 8 << this.getTier() * 2;}
92+
state.getEnergyStorage = function(){return this.data.energy_storage;}
9793

9894
state.energyTick = state.energyTick || function(){
99-
this.data.voltageLast = this.data.voltage;
95+
this.data.last_voltage = this.data.voltage;
10096
this.data.voltage = 0;
10197
}
10298

99+
ETTool.addTooltip(id,Translation.translate("Power Tier: ") + state.defaultValues.tier);
103100
this.registerPrototype(id,state);
104101

105102
EnergyTileRegistry.addEnergyTypeForId(id,EU);
106103
},
107104

108105
registerGenerator:function(id,state){
109-
state.isEnergySource = function(){
110-
return true;
111-
}
112-
113-
state.canReceiveEnergy = function(){
114-
return false;
115-
}
106+
state.isEnergySource = function(){return true;}
107+
state.canReceiveEnergy = function(){return false;}
116108

117109
state.energyTick = state.energyTick || this.energyOutput;
118110

119111
this.registerMachine(id,state,EU);
120112
},
121113

122114
registerEnergyStorage:function(id,state){
123-
state.isEnergySource = function(){
124-
return true;
125-
}
126-
127-
state.energyReceive = state.energyReceive || this.energyReceive;
115+
state.isEnergySource = function(){return true;}
128116

129117
state.energyTick = state.energyTick || this.energyOutput;
118+
state.energyReceive = state.energyReceive || this.energyReceive;
130119

131120
this.registerMachine(id,state,EU);
132121
},
@@ -151,7 +140,7 @@ var ETMachine = {
151140
},
152141

153142
energyOutput:function(type,src){
154-
this.data.voltageLast = this.data.voltage;
143+
this.data.last_voltage = this.data.voltage;
155144
this.data.voltage = 0;
156145

157146
var output = this.getMaxVoltage();
@@ -164,22 +153,20 @@ var ETMachine = {
164153
Block.registerDropFunction(name,function(coords,id,data,level){
165154
BlockRenderer.unmapAtCoords(coords.x,coords.y,coords.z);
166155
var item = Player.getCarriedItem();
167-
if(Player.getSneaking()){
156+
if(getPlayerSneaking){
168157
if(ETTool.isTool(item.id,"Wrench")){
169158
ToolAPI.breakCarriedTool(8);
170159
World.setBlock(coords.x,coords.y,coords.z,0);
171160
return [[id,1,data]];
172161
}
173162
}
174-
if(level >= ToolAPI.getBlockDestroyLevel(id)){
175-
return [[dropID,1,dropData?dropData:0]];
176-
}
163+
if(level >= ToolAPI.getBlockDestroyLevel(id)){return [[dropID,1,dropData || 0]];}
177164
return [];
178165
});
179166

180167
Callback.addCallback("DestroyBlockStart",function(coords,block){
181168
var item = Player.getCarriedItem();
182-
if(Player.getSneaking() && block.id == BlockID[name] && ETTool.isTool(item.id,"Wrench")){
169+
if(getPlayerSneaking && block.id == BlockID[name] && ETTool.isTool(item.id,"Wrench")){
183170
Block.setTempDestroyTime(block.id,0);
184171
}
185172
});

dev/core/api/reactor.js

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
var ETReactor = {
2+
moduleIDs:{},
3+
4+
module:{},
5+
6+
data:{},
7+
8+
getData:function(id){
9+
return this.data[id];
10+
},
11+
12+
getModule:function(id){
13+
return this.module[id];
14+
},
15+
16+
getModuleType:function(id){
17+
if(this.getModule(id)){
18+
return this.getData(id).type;
19+
}
20+
},
21+
22+
registerModule:function(id,state,data){
23+
if(!this.getModule(id)){
24+
this.moduleIDs[id] = true;
25+
this.module[id] = state;
26+
this.data[id] = data;
27+
28+
Item.registerNameOverrideFunction(id,function(item,name){
29+
var item = Player.getCarriedItem();
30+
if(item.extra){return name + "\n§7" + Translation.translate("Durability: ") + item.extra.getInt("durability");}
31+
return name;
32+
});
33+
34+
Block.registerDropFunctionForID(id,function(){return [];});
35+
36+
Block.registerPlaceFunctionForID(id,function(coords,item){
37+
var x = coords.relative.x,y = coords.relative.y,z = coords.relative.z;
38+
var item = Player.getCarriedItem();
39+
World.setBlock(x,y,z,item.id,item.data);
40+
var tile = World.addTileEntity(x,y,z);
41+
if(item.extra){
42+
tile.defaultValues.durability = item.extra.getInt("durability");
43+
}
44+
});
45+
46+
var tile = TileEntity.getPrototype(id);
47+
if(tile){
48+
var prototype = TileEntity.getPrototype(id);
49+
if(prototype.defaultValues){
50+
prototype.defaultValues.durability = data.durability;
51+
} else {
52+
prototype.defaultValues = {
53+
durability:data.durability
54+
}
55+
}
56+
57+
prototype.$tick = prototype.tick || function() {};
58+
prototype.$destroyBlock = prototype.destroyBlock || function() {};
59+
60+
prototype.tick = function(){
61+
this.$tick();
62+
if(this.data.durability <= 0){
63+
World.setBlock(this.x,this.y,this.z,0)
64+
}
65+
}
66+
67+
prototype.destroyBlock = function(){
68+
this.$destroyBlock();
69+
var item = Player.getCarriedItem();
70+
if(ToolAPI.getBlockDestroyLevel(this.id) <= ToolAPI.getToolLevel(item.id)){
71+
var extra = new ItemExtraData();
72+
extra.putInt("durability",this.data.durability);
73+
dropItem(this.x + 0.5,this.y,this.z + 0.5,0,this.id,1,0,extra);
74+
}
75+
}
76+
} else {
77+
ETMachine.registerPrototype(id,{
78+
defaultValues:{
79+
durability:data.durability
80+
},
81+
82+
tick:function(){
83+
if(this.data.durability <= 0){
84+
World.setBlock(this.x,this.y,this.z,0)
85+
}
86+
},
87+
88+
destroyBlock:function(){
89+
var item = Player.getCarriedItem();
90+
if(ToolAPI.getBlockDestroyLevel(this.id) <= ToolAPI.getToolLevel(item.id)){
91+
var extra = new ItemExtraData();
92+
extra.putInt("durability",this.data.durability);
93+
dropItem(this.x + 0.5,this.y,this.z + 0.5,0,this.id,1,0,extra);
94+
}
95+
}
96+
});
97+
}
98+
}
99+
}
100+
}

0 commit comments

Comments
 (0)