Compare commits
No commits in common. "76c0540d572e8fb12c771bc066b385ca1b12a234" and "97e22459c5167bf683cb600740f7bcb73ca25c51" have entirely different histories.
76c0540d57
...
97e22459c5
@ -1,7 +1,6 @@
|
|||||||
package ru.dbotthepony.mc.otm.datagen.recipes
|
package ru.dbotthepony.mc.otm.datagen.recipes
|
||||||
|
|
||||||
import net.minecraft.data.recipes.*
|
import net.minecraft.data.recipes.*
|
||||||
import net.minecraft.tags.ItemTags
|
|
||||||
import net.minecraft.world.item.DyeColor
|
import net.minecraft.world.item.DyeColor
|
||||||
import net.minecraft.world.item.ItemStack
|
import net.minecraft.world.item.ItemStack
|
||||||
import net.minecraft.world.item.Items
|
import net.minecraft.world.item.Items
|
||||||
@ -436,12 +435,4 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
|
|||||||
|
|
||||||
builder.build(consumer)
|
builder.build(consumer)
|
||||||
}
|
}
|
||||||
|
|
||||||
for ((color, item) in MRegistry.STAR_CHAIR.allItems) {
|
|
||||||
MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
|
|
||||||
.rowB(color?.tag)
|
|
||||||
.row(MItemTags.TRITANIUM_PLATES, ItemTags.WOOL, MItemTags.TRITANIUM_PLATES)
|
|
||||||
.row(MItemTags.TRITANIUM_PLATES, MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES)
|
|
||||||
.build(consumer)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1384,9 +1384,6 @@ open class EditablePanel<out S : Screen>(
|
|||||||
parent?.updateBounds()
|
parent?.updateBounds()
|
||||||
}
|
}
|
||||||
|
|
||||||
open val ignoreWhenSizingToContents: Boolean
|
|
||||||
get() = false
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to tightly fit dimensions to all children
|
* Attempts to tightly fit dimensions to all children
|
||||||
*/
|
*/
|
||||||
@ -1408,11 +1405,9 @@ open class EditablePanel<out S : Screen>(
|
|||||||
for (child in visibleChildrenInternal) {
|
for (child in visibleChildrenInternal) {
|
||||||
when (child.dock) {
|
when (child.dock) {
|
||||||
Dock.NONE -> {
|
Dock.NONE -> {
|
||||||
if (!child.ignoreWhenSizingToContents) {
|
|
||||||
width = maxOf(width, child.x + child.width)
|
width = maxOf(width, child.x + child.width)
|
||||||
height = maxOf(height, child.y + child.height)
|
height = maxOf(height, child.y + child.height)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Dock.FILL -> {
|
Dock.FILL -> {
|
||||||
throw RuntimeException()
|
throw RuntimeException()
|
||||||
|
@ -34,9 +34,6 @@ open class FramePanel<out S : Screen>(
|
|||||||
var isActive = tabs.isEmpty()
|
var isActive = tabs.isEmpty()
|
||||||
protected set
|
protected set
|
||||||
|
|
||||||
override val ignoreWhenSizingToContents: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
init {
|
init {
|
||||||
tabs.add(this)
|
tabs.add(this)
|
||||||
}
|
}
|
||||||
@ -200,9 +197,6 @@ open class FramePanel<out S : Screen>(
|
|||||||
close()
|
close()
|
||||||
}
|
}
|
||||||
|
|
||||||
override val ignoreWhenSizingToContents: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
if (isPressed) {
|
if (isPressed) {
|
||||||
CLOSE_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height)
|
CLOSE_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height)
|
||||||
@ -229,9 +223,6 @@ open class FramePanel<out S : Screen>(
|
|||||||
isActive = !isActive
|
isActive = !isActive
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
override val ignoreWhenSizingToContents: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
override fun innerRender(graphics: MGUIGraphics, mouseX: Float, mouseY: Float, partialTick: Float) {
|
||||||
/*if (isPressed) {
|
/*if (isPressed) {
|
||||||
HELP_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height)
|
HELP_BUTTON_PRESSED.render(graphics, 0f, 0f, width, height)
|
||||||
|
@ -339,9 +339,6 @@ class DeviceControls<out S : MatteryScreen<*>>(
|
|||||||
|
|
||||||
private var upgradeWindow: FramePanel<S>? = null
|
private var upgradeWindow: FramePanel<S>? = null
|
||||||
|
|
||||||
override val ignoreWhenSizingToContents: Boolean
|
|
||||||
get() = true
|
|
||||||
|
|
||||||
private val buttons = ArrayList<EditablePanel<S>>()
|
private val buttons = ArrayList<EditablePanel<S>>()
|
||||||
|
|
||||||
private fun alignButtons() {
|
private fun alignButtons() {
|
||||||
@ -353,10 +350,8 @@ class DeviceControls<out S : MatteryScreen<*>>(
|
|||||||
var totalWidth = 0f
|
var totalWidth = 0f
|
||||||
var totalHeight = 0f
|
var totalHeight = 0f
|
||||||
|
|
||||||
val parent = parent!!
|
|
||||||
|
|
||||||
for (button in buttons) {
|
for (button in buttons) {
|
||||||
if (y != 0f && button.height + y > parent.height && (parent.dock == Dock.NONE || !parent.layoutInvalidated)) {
|
if (y != 0f && button.height + y > parent!!.height) {
|
||||||
totalHeight = totalHeight.coerceAtLeast(y - 2f)
|
totalHeight = totalHeight.coerceAtLeast(y - 2f)
|
||||||
y = 0f
|
y = 0f
|
||||||
x += currentWidth + 2f
|
x += currentWidth + 2f
|
||||||
|
@ -320,13 +320,13 @@ object MachinesConfig : AbstractConfig("machines") {
|
|||||||
|
|
||||||
val PASSIVE_LOSS: Decimal by builder
|
val PASSIVE_LOSS: Decimal by builder
|
||||||
.comment("Amount of energy lost per tick in % of energy stored")
|
.comment("Amount of energy lost per tick in % of energy stored")
|
||||||
.defineDecimal("PASSIVE_LOSS", Decimal("0.0000004"), Decimal.ZERO)
|
.defineDecimal("PASSIVE_LOSS", Decimal("0.000001"), Decimal.ZERO)
|
||||||
|
|
||||||
val ACTIVE_LOSS: Decimal by builder
|
val ACTIVE_LOSS: Decimal by builder
|
||||||
.comment("Amount of energy lost per tick in % of energy stored if Flywheel configuration is invalid")
|
.comment("Amount of energy lost per tick in % of energy stored if Flywheel configuration is invalid")
|
||||||
.comment("Keep in mind that all stored energy is instantly lost when controller is broken by any means")
|
.comment("Keep in mind that all stored energy is instantly lost when controller is broken by any means")
|
||||||
.comment("unless using mod which fully preserve blockentity metadata such as Mekanism cardboard box or Carry On")
|
.comment("unless using mod which fully preserve blockentity metadata such as Mekanism cardboard box or Carry On")
|
||||||
.defineDecimal("ACTIVE_LOSS", Decimal("0.00004"), Decimal.ZERO)
|
.defineDecimal("ACTIVE_LOSS", Decimal("0.0004"), Decimal.ZERO)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
builder.pop()
|
builder.pop()
|
||||||
|
@ -295,7 +295,31 @@ operator fun CraftingContainer.get(column: Int, row: Int, flop: Boolean): ItemSt
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun Container.sort(comparator: Comparator<ItemStack> = ItemStackSorter.DEFAULT) {
|
fun Container.sort(comparator: Comparator<ItemStack> = ItemStackSorter.DEFAULT) {
|
||||||
sortWithIndices(computeSortedIndices(comparator))
|
if (isEmpty)
|
||||||
|
return
|
||||||
|
|
||||||
|
val slots = slotIterator().filter { !it.isForbiddenForAutomation && it.getMaxStackSize() >= it.item.count }.toList()
|
||||||
|
|
||||||
|
if (slots.isEmpty())
|
||||||
|
return
|
||||||
|
|
||||||
|
val items = Object2ObjectOpenCustomHashMap<ItemStack, ItemStack>(ItemStackHashStrategy)
|
||||||
|
|
||||||
|
slots.forEach {
|
||||||
|
val get = items[it.item]
|
||||||
|
|
||||||
|
if (get == null) {
|
||||||
|
items[it.item] = it.item.copy()
|
||||||
|
} else {
|
||||||
|
get.count += it.item.count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val sortedItems = ObjectArrayList(items.values)
|
||||||
|
sortedItems.sortWith(comparator)
|
||||||
|
|
||||||
|
slots.forEach { it.remove() }
|
||||||
|
sortedItems.forEach { addItem(it, false) }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Container.sortWithIndices(sortedSlots: IntCollection) {
|
fun Container.sortWithIndices(sortedSlots: IntCollection) {
|
||||||
@ -313,12 +337,7 @@ fun Container.sortWithIndices(sortedSlots: IntCollection) {
|
|||||||
if (value in 0 until containerSize && seen.add(value)) {
|
if (value in 0 until containerSize && seen.add(value)) {
|
||||||
val slot = containerSlot(value)
|
val slot = containerSlot(value)
|
||||||
|
|
||||||
if (
|
if (slot.isNotEmpty && !slot.isForbiddenForAutomation && slot.item.count <= slot.getMaxStackSize()) {
|
||||||
slot.isNotEmpty &&
|
|
||||||
!slot.isForbiddenForAutomation &&
|
|
||||||
slot.item.count <= slot.getMaxStackSize() &&
|
|
||||||
(!slot.hasFilter || slot.getFilter() != slot.item.item || slot.getMaxStackSize() > 1)
|
|
||||||
) {
|
|
||||||
valid.add(slot)
|
valid.add(slot)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun canPrime(player: Player): Boolean {
|
fun canPrime(player: Player): Boolean {
|
||||||
return player.hasInfiniteMaterials() || player.inventory.clearOrCountMatchingItems(GUNPOWDER_PREDICATE, 0, player.inventoryMenu.craftSlots) > 0 &&
|
return player.inventory.clearOrCountMatchingItems(GUNPOWDER_PREDICATE, 0, player.inventoryMenu.craftSlots) > 0 &&
|
||||||
player.inventory.clearOrCountMatchingItems(IRON_NUGGET_PREDICATE, 0, player.inventoryMenu.craftSlots) > 0
|
player.inventory.clearOrCountMatchingItems(IRON_NUGGET_PREDICATE, 0, player.inventoryMenu.craftSlots) > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,7 +142,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun attackAt(itemStack: ItemStack, attacker: LivingEntity, pos: Vec3, aim: Vec3, hand: InteractionHand) {
|
fun attackAt(itemStack: ItemStack, attacker: LivingEntity, pos: Vec3, aim: Vec3, hand: InteractionHand) {
|
||||||
if (!isPrimed(itemStack) || attacker.level().isClientSide || attacker is Player && !attacker.isCreative && attacker.getAttackStrengthScale(0.4f) < 0.98f)
|
if (!isPrimed(itemStack) || attacker.level().isClientSide || attacker is Player && attacker.getAttackStrengthScale(0.4f) < 0.98f)
|
||||||
return
|
return
|
||||||
|
|
||||||
val (ex, ey, ez) = pos
|
val (ex, ey, ez) = pos
|
||||||
@ -221,7 +221,7 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
it.connection.send(ClientboundExplodePacket(ex, ey, ez, 1f, exp.toBlow, exp.hitPlayers[it], Explosion.BlockInteraction.DESTROY, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE))
|
it.connection.send(ClientboundExplodePacket(ex, ey, ez, 1f, exp.toBlow, exp.hitPlayers[it], Explosion.BlockInteraction.DESTROY, ParticleTypes.EXPLOSION, ParticleTypes.EXPLOSION_EMITTER, SoundEvents.GENERIC_EXPLODE))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!attacker.hasInfiniteMaterials()) {
|
if (attacker !is Player || !attacker.isCreative) {
|
||||||
unprime(itemStack)
|
unprime(itemStack)
|
||||||
|
|
||||||
val copy = itemStack.copy()
|
val copy = itemStack.copy()
|
||||||
@ -303,10 +303,8 @@ class ExplosiveHammerItem(durability: Int = 512) : Item(Properties().stacksTo(1)
|
|||||||
override fun finishUsingItem(stack: ItemStack, level: Level, entity: LivingEntity): ItemStack {
|
override fun finishUsingItem(stack: ItemStack, level: Level, entity: LivingEntity): ItemStack {
|
||||||
if (entity is Player && canPrime(entity)) {
|
if (entity is Player && canPrime(entity)) {
|
||||||
if (level is ServerLevel) {
|
if (level is ServerLevel) {
|
||||||
if (!entity.hasInfiniteMaterials()) {
|
|
||||||
entity.inventory.clearOrCountMatchingItems(GUNPOWDER_PREDICATE, 1, entity.inventoryMenu.craftSlots)
|
entity.inventory.clearOrCountMatchingItems(GUNPOWDER_PREDICATE, 1, entity.inventoryMenu.craftSlots)
|
||||||
entity.inventory.clearOrCountMatchingItems(IRON_NUGGET_PREDICATE, 1, entity.inventoryMenu.craftSlots)
|
entity.inventory.clearOrCountMatchingItems(IRON_NUGGET_PREDICATE, 1, entity.inventoryMenu.craftSlots)
|
||||||
}
|
|
||||||
|
|
||||||
prime(stack)
|
prime(stack)
|
||||||
}
|
}
|
||||||
|
@ -244,14 +244,12 @@ abstract class MatteryMenu(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mattery.hasExopack) {
|
|
||||||
chargeFlag = Delegate.Of(
|
chargeFlag = Delegate.Of(
|
||||||
getter = { slotIndex in mattery.slotsChargeFlag },
|
getter = { slotIndex in mattery.slotsChargeFlag },
|
||||||
setter = booleanInput(true) { if (mattery.hasExopack) { if (it) mattery.slotsChargeFlag.add(slotIndex) else mattery.slotsChargeFlag.remove(slotIndex) } }::accept
|
setter = booleanInput(true) { if (mattery.hasExopack) { if (it) mattery.slotsChargeFlag.add(slotIndex) else mattery.slotsChargeFlag.remove(slotIndex) } }::accept
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
open inner class EquipmentSlot(container: Container, index: Int, val type: net.minecraft.world.entity.EquipmentSlot) : InventorySlot(container, index) {
|
open inner class EquipmentSlot(container: Container, index: Int, val type: net.minecraft.world.entity.EquipmentSlot) : InventorySlot(container, index) {
|
||||||
constructor(type: net.minecraft.world.entity.EquipmentSlot) : this(inventory, 34 + type.ordinal, type)
|
constructor(type: net.minecraft.world.entity.EquipmentSlot) : this(inventory, 34 + type.ordinal, type)
|
||||||
|
Loading…
Reference in New Issue
Block a user