Implemented smelting with flux
This commit is contained in:
@@ -27,7 +27,7 @@ allprojects {
|
|||||||
gdxVersion = '1.9.8'
|
gdxVersion = '1.9.8'
|
||||||
roboVMVersion = '2.3.0'
|
roboVMVersion = '2.3.0'
|
||||||
aiVersion = '1.8.1'
|
aiVersion = '1.8.1'
|
||||||
uCoreVersion = ' d1af4c8'
|
uCoreVersion = 'd1af4c8'
|
||||||
|
|
||||||
getVersionString = {
|
getVersionString = {
|
||||||
String buildVersion = getBuildVersion()
|
String buildVersion = getBuildVersion()
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import io.anuke.mindustry.type.AmmoType;
|
|||||||
import io.anuke.mindustry.type.ContentList;
|
import io.anuke.mindustry.type.ContentList;
|
||||||
|
|
||||||
public class AmmoTypes implements ContentList {
|
public class AmmoTypes implements ContentList {
|
||||||
public static AmmoType bulletIron, bulletLead, bulletSteel, bulletThorium, bulletSilicon, bulletThermite, flakLead, flakExplosive, flakPlastic, flakSurge, shellLead, shellExplosive, shellPlastic, shellThorium, missileExplosive, missileIncindiary, missileSurge, artilleryLead, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary, basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
|
public static AmmoType bulletIron, bulletLead, bulletSteel, bulletThorium, bulletSilicon, bulletThermite, flakLead, flakExplosive, flakPlastic, flakSurge, missileExplosive, missileIncindiary, missileSurge, artilleryLead, artilleryThorium, artilleryPlastic, artilleryHoming, artilleryIncindiary, basicFlame, lancerLaser, lightning, spectreLaser, meltdownLaser, fuseShotgun, oil, water, lava, cryofluid;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load() {
|
public void load() {
|
||||||
@@ -67,28 +67,6 @@ public class AmmoTypes implements ContentList {
|
|||||||
smokeEffect = ShootFx.shootSmallSmoke;
|
smokeEffect = ShootFx.shootSmallSmoke;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
//shells
|
|
||||||
|
|
||||||
shellLead = new AmmoType(Items.lead, ShellBullets.lead, 1) {{
|
|
||||||
shootEffect = ShootFx.shootBig2;
|
|
||||||
smokeEffect = ShootFx.shootBigSmoke2;
|
|
||||||
}};
|
|
||||||
|
|
||||||
shellExplosive = new AmmoType(Items.blastCompound, ShellBullets.explosive, 1) {{
|
|
||||||
shootEffect = ShootFx.shootBig2;
|
|
||||||
smokeEffect = ShootFx.shootBigSmoke2;
|
|
||||||
}};
|
|
||||||
|
|
||||||
shellPlastic = new AmmoType(Items.plasteel, ShellBullets.plastic, 1) {{
|
|
||||||
shootEffect = ShootFx.shootBig2;
|
|
||||||
smokeEffect = ShootFx.shootBigSmoke2;
|
|
||||||
}};
|
|
||||||
|
|
||||||
shellThorium = new AmmoType(Items.thorium, ShellBullets.thorium, 1) {{
|
|
||||||
shootEffect = ShootFx.shootBig2;
|
|
||||||
smokeEffect = ShootFx.shootBigSmoke2;
|
|
||||||
}};
|
|
||||||
|
|
||||||
//missiles
|
//missiles
|
||||||
|
|
||||||
missileExplosive = new AmmoType(Items.blastCompound, MissileBullets.explosive, 1) {{
|
missileExplosive = new AmmoType(Items.blastCompound, MissileBullets.explosive, 1) {{
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ public class Items implements ContentList{
|
|||||||
coal = new Item("coal", Color.valueOf("272727")) {{
|
coal = new Item("coal", Color.valueOf("272727")) {{
|
||||||
explosiveness = 0.2f;
|
explosiveness = 0.2f;
|
||||||
flammability = 0.5f;
|
flammability = 0.5f;
|
||||||
fluxiness = 0.3f;
|
|
||||||
hardness = 2;
|
hardness = 2;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ public class CraftingBlocks extends BlockList implements ContentList {
|
|||||||
fuel = Items.coal;
|
fuel = Items.coal;
|
||||||
result = Items.steel;
|
result = Items.steel;
|
||||||
craftTime = 35f;
|
craftTime = 35f;
|
||||||
|
useFlux = true;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
arcsmelter = new PowerSmelter("arc-smelter") {{
|
arcsmelter = new PowerSmelter("arc-smelter") {{
|
||||||
@@ -31,6 +32,9 @@ public class CraftingBlocks extends BlockList implements ContentList {
|
|||||||
powerUse = 0.1f;
|
powerUse = 0.1f;
|
||||||
craftTime = 25f;
|
craftTime = 25f;
|
||||||
size = 2;
|
size = 2;
|
||||||
|
|
||||||
|
useFlux = true;
|
||||||
|
fluxNeeded = 2;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
siliconsmelter = new PowerSmelter("silicon-smelter") {{
|
siliconsmelter = new PowerSmelter("silicon-smelter") {{
|
||||||
@@ -79,6 +83,9 @@ public class CraftingBlocks extends BlockList implements ContentList {
|
|||||||
powerUse = 0.3f;
|
powerUse = 0.3f;
|
||||||
craftTime = 50f;
|
craftTime = 50f;
|
||||||
size = 2;
|
size = 2;
|
||||||
|
|
||||||
|
useFlux = true;
|
||||||
|
fluxNeeded = 4;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
alloyfuser = new PowerSmelter("alloy-fuser") {{
|
alloyfuser = new PowerSmelter("alloy-fuser") {{
|
||||||
@@ -89,6 +96,9 @@ public class CraftingBlocks extends BlockList implements ContentList {
|
|||||||
powerUse = 0.4f;
|
powerUse = 0.4f;
|
||||||
craftTime = 30f;
|
craftTime = 30f;
|
||||||
size = 3;
|
size = 3;
|
||||||
|
|
||||||
|
useFlux = true;
|
||||||
|
fluxNeeded = 4;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
cryofluidmixer = new LiquidMixer("cryofluidmixer") {{
|
cryofluidmixer = new LiquidMixer("cryofluidmixer") {{
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class WeaponBlocks extends BlockList implements ContentList {
|
|||||||
salvo = new ItemTurret("salvo") {{
|
salvo = new ItemTurret("salvo") {{
|
||||||
size = 2;
|
size = 2;
|
||||||
range = 100f;
|
range = 100f;
|
||||||
ammoTypes = new AmmoType[]{AmmoTypes.shellExplosive, AmmoTypes.shellLead, AmmoTypes.shellPlastic, AmmoTypes.shellThorium};
|
ammoTypes = new AmmoType[]{AmmoTypes.bulletIron, AmmoTypes.bulletLead, AmmoTypes.bulletSteel, AmmoTypes.bulletThermite, AmmoTypes.bulletThorium, AmmoTypes.bulletSilicon};
|
||||||
reload = 70f;
|
reload = 70f;
|
||||||
restitution = 0.03f;
|
restitution = 0.03f;
|
||||||
ammoEjectBack = 3f;
|
ammoEjectBack = 3f;
|
||||||
|
|||||||
@@ -1,127 +0,0 @@
|
|||||||
package io.anuke.mindustry.content.bullets;
|
|
||||||
|
|
||||||
import io.anuke.mindustry.content.fx.BulletFx;
|
|
||||||
import io.anuke.mindustry.content.fx.Fx;
|
|
||||||
import io.anuke.mindustry.entities.bullet.BasicBulletType;
|
|
||||||
import io.anuke.mindustry.entities.bullet.BulletType;
|
|
||||||
import io.anuke.mindustry.type.ContentList;
|
|
||||||
|
|
||||||
public class ShellBullets extends BulletList implements ContentList {
|
|
||||||
public static BulletType lead, leadShard, thorium, thoriumShard, plastic, plasticShard, explosive, explosiveShard, incindiary;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void load() {
|
|
||||||
|
|
||||||
lead = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
hiteffect = BulletFx.flakExplosion;
|
|
||||||
knockback = 0.8f;
|
|
||||||
lifetime = 90f;
|
|
||||||
drag = 0.01f;
|
|
||||||
bulletWidth = bulletHeight = 9f;
|
|
||||||
fragBullet = leadShard;
|
|
||||||
bulletShrink = 0.1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
leadShard = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
drag = 0.1f;
|
|
||||||
hiteffect = Fx.none;
|
|
||||||
despawneffect = Fx.none;
|
|
||||||
hitsize = 4;
|
|
||||||
lifetime = 20f;
|
|
||||||
bulletWidth = 9f;
|
|
||||||
bulletHeight = 11f;
|
|
||||||
bulletShrink = 1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
thorium = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
hiteffect = BulletFx.flakExplosion;
|
|
||||||
knockback = 0.8f;
|
|
||||||
lifetime = 90f;
|
|
||||||
drag = 0.01f;
|
|
||||||
bulletWidth = bulletHeight = 9f;
|
|
||||||
fragBullet = leadShard;
|
|
||||||
bulletShrink = 0.1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
thoriumShard = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
drag = 0.1f;
|
|
||||||
hiteffect = Fx.none;
|
|
||||||
despawneffect = Fx.none;
|
|
||||||
hitsize = 4;
|
|
||||||
lifetime = 20f;
|
|
||||||
bulletWidth = 9f;
|
|
||||||
bulletHeight = 11f;
|
|
||||||
bulletShrink = 1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
plastic = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
hiteffect = BulletFx.flakExplosion;
|
|
||||||
knockback = 0.8f;
|
|
||||||
lifetime = 90f;
|
|
||||||
drag = 0.01f;
|
|
||||||
bulletWidth = bulletHeight = 9f;
|
|
||||||
fragBullet = leadShard;
|
|
||||||
bulletShrink = 0.1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
plasticShard = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
drag = 0.1f;
|
|
||||||
hiteffect = Fx.none;
|
|
||||||
despawneffect = Fx.none;
|
|
||||||
hitsize = 4;
|
|
||||||
lifetime = 20f;
|
|
||||||
bulletWidth = 9f;
|
|
||||||
bulletHeight = 11f;
|
|
||||||
bulletShrink = 1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
explosive = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
hiteffect = BulletFx.flakExplosion;
|
|
||||||
knockback = 0.8f;
|
|
||||||
lifetime = 90f;
|
|
||||||
drag = 0.01f;
|
|
||||||
bulletWidth = bulletHeight = 9f;
|
|
||||||
fragBullet = leadShard;
|
|
||||||
bulletShrink = 0.1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
explosiveShard = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
drag = 0.1f;
|
|
||||||
hiteffect = Fx.none;
|
|
||||||
despawneffect = Fx.none;
|
|
||||||
hitsize = 4;
|
|
||||||
lifetime = 20f;
|
|
||||||
bulletWidth = 9f;
|
|
||||||
bulletHeight = 11f;
|
|
||||||
bulletShrink = 1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
incindiary = new BasicBulletType(3f, 0, "shell") {
|
|
||||||
{
|
|
||||||
hiteffect = BulletFx.flakExplosion;
|
|
||||||
knockback = 0.8f;
|
|
||||||
lifetime = 90f;
|
|
||||||
drag = 0.01f;
|
|
||||||
bulletWidth = bulletHeight = 9f;
|
|
||||||
fragBullet = leadShard;
|
|
||||||
bulletShrink = 0.1f;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -55,7 +55,6 @@ public class ContentLoader {
|
|||||||
new ArtilleryBullets(),
|
new ArtilleryBullets(),
|
||||||
new FlakBullets(),
|
new FlakBullets(),
|
||||||
new MissileBullets(),
|
new MissileBullets(),
|
||||||
new ShellBullets(),
|
|
||||||
new StandardBullets(),
|
new StandardBullets(),
|
||||||
new TurretBullets(),
|
new TurretBullets(),
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,16 @@ public abstract class BaseBlock {
|
|||||||
/**Returns the amount of items this block can accept.*/
|
/**Returns the amount of items this block can accept.*/
|
||||||
public int acceptStack(Item item, int amount, Tile tile, Unit source){
|
public int acceptStack(Item item, int amount, Tile tile, Unit source){
|
||||||
if(acceptItem(item, tile, tile) && hasItems && source.getTeam() == tile.getTeam()){
|
if(acceptItem(item, tile, tile) && hasItems && source.getTeam() == tile.getTeam()){
|
||||||
return Math.min(itemCapacity - tile.entity.items.totalItems(), amount);
|
return Math.min(getMaximumAccepted(tile, item), amount);
|
||||||
}else{
|
}else{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMaximumAccepted(Tile tile, Item item){
|
||||||
|
return itemCapacity - tile.entity.items.totalItems();
|
||||||
|
}
|
||||||
|
|
||||||
/**Remove a stack from this inventory, and return the amount removed.*/
|
/**Remove a stack from this inventory, and return the amount removed.*/
|
||||||
public int removeStack(Tile tile, Item item, int amount){
|
public int removeStack(Tile tile, Item item, int amount){
|
||||||
tile.entity.items.removeItem(item, amount);
|
tile.entity.items.removeItem(item, amount);
|
||||||
|
|||||||
@@ -33,6 +33,11 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
protected Item result;
|
protected Item result;
|
||||||
protected float powerUse;
|
protected float powerUse;
|
||||||
|
|
||||||
|
protected float minFlux = 0.2f;
|
||||||
|
protected int fluxNeeded = 1;
|
||||||
|
protected float baseFluxChance = 0.15f;
|
||||||
|
protected boolean useFlux = false;
|
||||||
|
|
||||||
protected float heatUpTime = 80f;
|
protected float heatUpTime = 80f;
|
||||||
protected float minHeat = 0.5f;
|
protected float minHeat = 0.5f;
|
||||||
|
|
||||||
@@ -42,13 +47,12 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
burnEffect = BlockFx.fuelburn;
|
burnEffect = BlockFx.fuelburn;
|
||||||
protected Color flameColor = Color.valueOf("ffc999");
|
protected Color flameColor = Color.valueOf("ffc999");
|
||||||
|
|
||||||
protected int capacity = 20;
|
|
||||||
|
|
||||||
public PowerSmelter(String name) {
|
public PowerSmelter(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
update = true;
|
update = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
|
itemCapacity = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -57,7 +61,7 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
bars.remove(BarType.inventory);
|
bars.remove(BarType.inventory);
|
||||||
|
|
||||||
for(ItemStack item : inputs){
|
for(ItemStack item : inputs){
|
||||||
bars.add(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.items.getItem(item.item) / capacity));
|
bars.add(new BlockBar(BarType.inventory, true, tile -> (float) tile.entity.items.getItem(item.item) / itemCapacity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,8 +74,8 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
stats.add(BlockStat.powerUse, powerUse * 60f);
|
stats.add(BlockStat.powerUse, powerUse * 60f);
|
||||||
stats.add(BlockStat.outputItem, result.toString());
|
stats.add(BlockStat.outputItem, result.toString());
|
||||||
stats.add(BlockStat.craftSpeed, 60f/craftTime);
|
stats.add(BlockStat.craftSpeed, 60f/craftTime);
|
||||||
stats.add(BlockStat.inputItemCapacity, capacity);
|
stats.add(BlockStat.inputItemCapacity, itemCapacity);
|
||||||
stats.add(BlockStat.outputItemCapacity, capacity);
|
stats.add(BlockStat.outputItemCapacity, itemCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -104,14 +108,31 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entity.items.getItem(result) >= capacity //output full
|
if(entity.items.getItem(result) >= itemCapacity //output full
|
||||||
|| entity.heat <= minHeat //not burning
|
|| entity.heat <= minHeat //not burning
|
||||||
|| !entity.timer.get(timerCraft, craftTime)){ //not yet time
|
|| !entity.timer.get(timerCraft, craftTime)){ //not yet time
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(ItemStack item : inputs){
|
boolean consumeInputs = false;
|
||||||
entity.items.removeItem(item.item, item.amount);
|
|
||||||
|
if(useFlux){
|
||||||
|
//remove flux materials if present
|
||||||
|
for(Item item : Item.all()){
|
||||||
|
if(item.fluxiness >= minFlux && tile.entity.items.getItem(item) >= fluxNeeded){
|
||||||
|
tile.entity.items.removeItem(item, fluxNeeded);
|
||||||
|
|
||||||
|
//chance of not consuming inputs if flux material present
|
||||||
|
consumeInputs = !Mathf.chance(item.fluxiness * baseFluxChance);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(consumeInputs) {
|
||||||
|
for (ItemStack item : inputs) {
|
||||||
|
entity.items.removeItem(item.item, item.amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offloadNear(tile, result);
|
offloadNear(tile, result);
|
||||||
@@ -123,13 +144,22 @@ public class PowerSmelter extends PowerBlock {
|
|||||||
|
|
||||||
for(ItemStack stack : inputs){
|
for(ItemStack stack : inputs){
|
||||||
if(stack.item == item){
|
if(stack.item == item){
|
||||||
return tile.entity.items.getItem(item) < capacity;
|
return tile.entity.items.getItem(item) < itemCapacity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(useFlux && item.fluxiness >= minFlux){
|
||||||
|
return tile.entity.items.getItem(item) < itemCapacity;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaximumAccepted(Tile tile, Item item) {
|
||||||
|
return itemCapacity - tile.entity.items.getItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Tile tile){
|
public void draw(Tile tile){
|
||||||
super.draw(tile);
|
super.draw(tile);
|
||||||
|
|||||||
@@ -26,24 +26,27 @@ public class Smelter extends Block{
|
|||||||
protected Item fuel;
|
protected Item fuel;
|
||||||
protected Item result;
|
protected Item result;
|
||||||
|
|
||||||
protected float craftTime = 20f; //time to craft one item, so max 3 items per second by default
|
protected float minFlux = 0.2f;
|
||||||
protected float burnDuration = 50f; //by default, the fuel will burn 45 frames, so that's 2.5 items/fuel at most
|
protected float baseFluxChance = 0.15f;
|
||||||
|
protected boolean useFlux = false;
|
||||||
|
|
||||||
|
protected float craftTime = 20f;
|
||||||
|
protected float burnDuration = 50f;
|
||||||
protected Effect craftEffect = BlockFx.smelt, burnEffect = BlockFx.fuelburn;
|
protected Effect craftEffect = BlockFx.smelt, burnEffect = BlockFx.fuelburn;
|
||||||
protected Color flameColor = Color.valueOf("ffb879");
|
protected Color flameColor = Color.valueOf("ffb879");
|
||||||
|
|
||||||
protected int capacity = 20;
|
|
||||||
|
|
||||||
public Smelter(String name) {
|
public Smelter(String name) {
|
||||||
super(name);
|
super(name);
|
||||||
update = true;
|
update = true;
|
||||||
hasItems = true;
|
hasItems = true;
|
||||||
solid = true;
|
solid = true;
|
||||||
|
itemCapacity = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBars(){
|
public void setBars(){
|
||||||
for(Item item : inputs){
|
for(Item item : inputs){
|
||||||
bars.add(new BlockBar(BarType.inventory, true, tile -> (float)tile.entity.items.getItem(item)/capacity));
|
bars.add(new BlockBar(BarType.inventory, true, tile -> (float)tile.entity.items.getItem(item)/itemCapacity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,8 +59,19 @@ public class Smelter extends Block{
|
|||||||
stats.add(BlockStat.inputItems, Arrays.toString(inputs));
|
stats.add(BlockStat.inputItems, Arrays.toString(inputs));
|
||||||
stats.add(BlockStat.outputItem, result.toString());
|
stats.add(BlockStat.outputItem, result.toString());
|
||||||
stats.add(BlockStat.craftSpeed, 60f/craftTime);
|
stats.add(BlockStat.craftSpeed, 60f/craftTime);
|
||||||
stats.add(BlockStat.inputItemCapacity, capacity);
|
stats.add(BlockStat.inputItemCapacity, itemCapacity);
|
||||||
stats.add(BlockStat.outputItemCapacity, capacity);
|
stats.add(BlockStat.outputItemCapacity, itemCapacity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
super.init();
|
||||||
|
|
||||||
|
for(Item item : inputs){
|
||||||
|
if(item.fluxiness >= minFlux && useFlux){
|
||||||
|
throw new IllegalArgumentException("'" + name + "' has input item '" + item.name + "', which is a flux, when useFlux is enabled. To prevent ambiguous item use, either remove this flux item from the inputs, or set useFlux to false.");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -90,20 +104,42 @@ public class Smelter extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(entity.items.getItem(result) >= capacity //output full
|
if(entity.items.getItem(result) >= itemCapacity //output full
|
||||||
|| entity.burnTime <= 0 //not burning
|
|| entity.burnTime <= 0 //not burning
|
||||||
|| !entity.timer.get(timerCraft, craftTime)){ //not yet time
|
|| !entity.timer.get(timerCraft, craftTime)){ //not yet time
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(Item item : inputs){
|
boolean consumeInputs = false;
|
||||||
entity.items.removeItem(item, 1);
|
|
||||||
|
if(useFlux){
|
||||||
|
//remove flux materials if present
|
||||||
|
for(Item item : Item.all()){
|
||||||
|
if(item.fluxiness >= minFlux && tile.entity.items.getItem(item) > 0){
|
||||||
|
tile.entity.items.removeItem(item, 1);
|
||||||
|
|
||||||
|
//chance of not consuming inputs if flux material present
|
||||||
|
consumeInputs = !Mathf.chance(item.fluxiness * baseFluxChance);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(consumeInputs) {
|
||||||
|
for (Item item : inputs) {
|
||||||
|
entity.items.removeItem(item, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
offloadNear(tile, result);
|
offloadNear(tile, result);
|
||||||
Effects.effect(craftEffect, flameColor, tile.drawx(), tile.drawy());
|
Effects.effect(craftEffect, flameColor, tile.drawx(), tile.drawy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaximumAccepted(Tile tile, Item item) {
|
||||||
|
return itemCapacity - tile.entity.items.getItem(item);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean acceptItem(Item item, Tile tile, Tile source){
|
public boolean acceptItem(Item item, Tile tile, Tile source){
|
||||||
boolean isInput = false;
|
boolean isInput = false;
|
||||||
@@ -115,7 +151,8 @@ public class Smelter extends Block{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (isInput && tile.entity.items.getItem(item) < capacity) || (item == fuel && tile.entity.items.getItem(fuel) < capacity);
|
return (isInput && tile.entity.items.getItem(item) < itemCapacity) || (item == fuel && tile.entity.items.getItem(fuel) < itemCapacity) ||
|
||||||
|
(useFlux && item.fluxiness >= minFlux && tile.entity.items.getItem(item) < itemCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user