recipes: armor trip recipes, decorated pot, fix network error (1.19.4)

This commit is contained in:
Bixilon 2023-03-14 20:09:54 +01:00
parent c5cba29fe9
commit e2a8d0a0cf
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
7 changed files with 155 additions and 11 deletions

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -20,10 +20,10 @@ import de.bixilon.minosoft.recipes.heat.BlastingRecipe
import de.bixilon.minosoft.recipes.heat.CampfireRecipe
import de.bixilon.minosoft.recipes.heat.SmeltingRecipe
import de.bixilon.minosoft.recipes.heat.SmokingRecipe
import de.bixilon.minosoft.recipes.special.BookCloningRecipe
import de.bixilon.minosoft.recipes.special.RepairItemRecipe
import de.bixilon.minosoft.recipes.special.SuspiciousStewRecipe
import de.bixilon.minosoft.recipes.special.TippedArrowRecipe
import de.bixilon.minosoft.recipes.smithing.SmithingRecipe
import de.bixilon.minosoft.recipes.smithing.SmithingTransformRecipe
import de.bixilon.minosoft.recipes.smithing.SmithingTrimRecipe
import de.bixilon.minosoft.recipes.special.*
import de.bixilon.minosoft.recipes.special.banner.BannerDuplicateRecipe
import de.bixilon.minosoft.recipes.special.banner.ShieldDecorationRecipe
import de.bixilon.minosoft.recipes.special.color.ArmorDyeRecipe
@ -51,6 +51,7 @@ object RecipeFactories : DefaultFactory<RecipeFactory<*>>(
ShulkerBoxColoringRecipe,
SuspiciousStewRecipe,
RepairItemRecipe,
DecoratedPotRecipe,
SmeltingRecipe,
BlastingRecipe,
@ -58,5 +59,5 @@ object RecipeFactories : DefaultFactory<RecipeFactory<*>>(
CampfireRecipe,
StoneCuttingRecipe,
SmithingRecipe,
SmithingRecipe, SmithingTransformRecipe, SmithingTrimRecipe,
)

View File

@ -41,6 +41,7 @@ class ShapedRecipe(
val category = if (buffer.versionId >= ProtocolVersions.V_22W42A) RecipeCategories[buffer.readVarInt()] else null
val ingredients = buffer.readArray(width * height) { buffer.readIngredient() }
val result = buffer.readItemStack()
val notification = if (buffer.versionId >= ProtocolVersions.V_1_19_4) buffer.readBoolean() else true // TODO: unknown version
return ShapedRecipe(
width = width,
height = height,

View File

@ -0,0 +1,24 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.recipes.smithing
import de.bixilon.minosoft.data.container.stack.ItemStack
import de.bixilon.minosoft.recipes.Ingredient
import de.bixilon.minosoft.recipes.Recipe
interface AbstractSmithingRecipe : Recipe {
val base: Ingredient
val ingredient: Ingredient
val result: ItemStack?
}

View File

@ -11,17 +11,20 @@
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.recipes
package de.bixilon.minosoft.recipes.smithing
import de.bixilon.minosoft.data.container.stack.ItemStack
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
import de.bixilon.minosoft.recipes.Ingredient
import de.bixilon.minosoft.recipes.RecipeCategories
import de.bixilon.minosoft.recipes.RecipeFactory
import de.bixilon.minosoft.util.KUtil.toResourceLocation
class SmithingRecipe(
val base: Ingredient,
val ingredient: Ingredient,
val result: ItemStack?,
) : Recipe {
override val base: Ingredient,
override val ingredient: Ingredient,
override val result: ItemStack?,
) : AbstractSmithingRecipe {
override val category: RecipeCategories? get() = null
companion object : RecipeFactory<SmithingRecipe> {

View File

@ -0,0 +1,43 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.recipes.smithing
import de.bixilon.minosoft.data.container.stack.ItemStack
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
import de.bixilon.minosoft.recipes.Ingredient
import de.bixilon.minosoft.recipes.RecipeCategories
import de.bixilon.minosoft.recipes.RecipeFactory
class SmithingTransformRecipe(
val template: Ingredient,
override val base: Ingredient,
override val ingredient: Ingredient,
override val result: ItemStack?,
) : AbstractSmithingRecipe {
override val category: RecipeCategories? get() = null
companion object : RecipeFactory<SmithingTransformRecipe> {
override val identifier = minecraft("smithing_transform")
override fun build(buffer: PlayInByteBuffer): SmithingTransformRecipe {
return SmithingTransformRecipe(
template = buffer.readIngredient(),
base = buffer.readIngredient(),
ingredient = buffer.readIngredient(),
result = buffer.readItemStack(),
)
}
}
}

View File

@ -0,0 +1,42 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.recipes.smithing
import de.bixilon.minosoft.data.container.stack.ItemStack
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.protocol.protocol.buffers.play.PlayInByteBuffer
import de.bixilon.minosoft.recipes.Ingredient
import de.bixilon.minosoft.recipes.RecipeCategories
import de.bixilon.minosoft.recipes.RecipeFactory
class SmithingTrimRecipe(
val template: Ingredient,
override val base: Ingredient,
override val ingredient: Ingredient,
) : AbstractSmithingRecipe {
override val result: ItemStack? get() = null // TODO
override val category: RecipeCategories? get() = null
companion object : RecipeFactory<SmithingTrimRecipe> {
override val identifier = minecraft("smithing_trim")
override fun build(buffer: PlayInByteBuffer): SmithingTrimRecipe {
return SmithingTrimRecipe(
template = buffer.readIngredient(),
base = buffer.readIngredient(),
ingredient = buffer.readIngredient(),
)
}
}
}

View File

@ -0,0 +1,30 @@
/*
* Minosoft
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.recipes.special
import de.bixilon.minosoft.data.registries.identified.Namespaces.minecraft
import de.bixilon.minosoft.recipes.RecipeCategories
class DecoratedPotRecipe(
override val category: RecipeCategories?,
) : SpecialRecipe {
companion object : SpecialRecipeFactory<DecoratedPotRecipe> {
override val identifier = minecraft("crafting_decorated_pot")
override fun build(category: RecipeCategories?): DecoratedPotRecipe {
return DecoratedPotRecipe(category)
}
}
}