Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anuken
2019-03-26 11:05:55 -04:00
5 changed files with 16 additions and 9 deletions

View File

@@ -155,7 +155,7 @@ public class PlacementFragment extends Fragment{
button.update(() -> { //color unplacable things gray
TileEntity core = player.getClosestCore();
Color color = core != null && (core.items.has(block.buildRequirements) || state.rules.infiniteResources) ? Color.WHITE : Color.GRAY;
Color color = core != null && (core.items.has(block.buildRequirements, state.rules.buildCostMultiplier) || state.rules.infiniteResources) ? Color.WHITE : Color.GRAY;
button.forEach(elem -> elem.setColor(color));
button.setChecked(input.block == block);
});

View File

@@ -50,6 +50,13 @@ public class ItemModule extends BlockModule{
return true;
}
public boolean has(ItemStack[] stacks, float multiplier){
for(ItemStack stack : stacks){
if(!has(stack.item, Math.round(stack.amount * multiplier))) return false;
}
return true;
}
/**
* Returns true if this entity has at least one of each item in each stack.
*/