Dye wool and carpets in colored cauldrons with tiered water costs
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# AstraCauldron
|
||||
|
||||
Серверный мод котлов для **Minecraft 26.2 / NeoForge 26.2.0.79 / Java 25+**.
|
||||
Переименован и перенесён из AstraSoups. Требуется **AstraPlus 0.5.9+**.
|
||||
Переименован и перенесён из AstraSoups. Требуется **AstraPlus 0.5.58+**.
|
||||
Игроку достаточно ванильного клиента и актуального ресурспака AstraPlus/AstraPacks.
|
||||
|
||||
## Режимы котла
|
||||
@@ -21,6 +21,7 @@
|
||||
| ПКМ красителем по котлу с водой | Цветная вода; один краситель расходуется, объём сохраняется |
|
||||
| Ещё один краситель | Смешивание по ванильному алгоритму окрашивания с сохранением яркости |
|
||||
| Кожаная броня, кожаная конская броня или волчья броня по цветной воде | Предмет получает цвет воды; расходуется один уровень |
|
||||
| Шерсть или ковры по цветной воде | Ближайший из 16 цветов; до 16/32/64 предметов при 1/2/3 уровнях воды, расход как у стрел |
|
||||
| Любое обычное, взрывное или туманное зелье по пустому котлу | Один из трёх уровней зелья; возвращается стеклянная бутылочка |
|
||||
| Такое же зелье по котлу с зельем | Добавляется уровень до максимума 3 |
|
||||
| Стеклянная бутылочка по зелью | Одна обычная бутылочка этого зелья; минус один уровень |
|
||||
@@ -44,7 +45,7 @@
|
||||
длительности Java (1/8), а не полная длительность выпитого зелья.
|
||||
|
||||
Если жидкости хватает только на часть пачки, обрабатывается доступное количество,
|
||||
остальные стрелы остаются в руке. Последний расход опустошает котёл. Железная и прочая
|
||||
остальные стрелы, шерсть или ковры остаются в руке. Уже совпадающий цвет не расходует воду. Последний расход опустошает котёл. Железная и прочая
|
||||
неокрашиваемая броня не расходует воду. Имя, прочность, зачарования и остальные компоненты
|
||||
окрашиваемой брони сохраняются. Смывание краски чистой водой остаётся ванильным.
|
||||
|
||||
|
||||
+2
-2
@@ -3,10 +3,10 @@ plugins {
|
||||
id("net.neoforged.moddev") version "2.0.146"
|
||||
}
|
||||
group = "online.astradev"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
repositories { mavenCentral() }
|
||||
val astraPlusApi = providers.gradleProperty("astraPlusApi")
|
||||
.orElse("../AstraPlus/build/libs/AstraPlus-0.5.9-api.jar")
|
||||
.orElse("../AstraPlus/build/libs/AstraPlus-0.5.58-api.jar")
|
||||
dependencies {
|
||||
compileOnly(files(astraPlusApi))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter:5.11.4")
|
||||
|
||||
@@ -95,7 +95,7 @@ public final class LiquidPots implements AutoCloseable {
|
||||
var next = new Liquid(state.getValue(LayeredCauldronBlock.LEVEL), dye.getAsInt(), null);
|
||||
if (!change(pos, next)) { error(player); return true; }
|
||||
held.consume(1, player); setVisual(level, pos, next);
|
||||
say(player, "Вода окрашена. Добавьте краситель для смешивания или окуните кожаную броню."); return true;
|
||||
say(player, "Вода окрашена. Окуните кожаную броню, шерсть или ковры; красители можно смешивать."); return true;
|
||||
}
|
||||
if (state.is(Blocks.CAULDRON) && potion.isPresent()) {
|
||||
var next = new Liquid(1, potion.get().contents().getColor() & 0xFFFFFF, potion.get());
|
||||
@@ -112,6 +112,14 @@ public final class LiquidPots implements AutoCloseable {
|
||||
if (!change(pos, next)) { error(player); return true; }
|
||||
held.consume(1, player); setVisual(level,pos,next); return true;
|
||||
}
|
||||
var blocks = api.dyeBlocks(held, liquid.rgb, liquid.levels);
|
||||
if (blocks.isPresent()) {
|
||||
var batch = blocks.get(); var result = batch.result();
|
||||
if (!decrease(level,pos,liquid,batch.levelsUsed())) { error(player); return true; }
|
||||
int count = result.getCount();
|
||||
consumeAndGive(player,count,result); sound(level,blockPos);
|
||||
say(player,"Окрашено предметов: " + count + "."); return true;
|
||||
}
|
||||
var armor = api.dyeArmor(held, liquid.rgb);
|
||||
if (armor.isPresent()) {
|
||||
if (!decrease(level,pos,liquid,1)) { error(player); return true; }
|
||||
|
||||
@@ -21,6 +21,6 @@ side="SERVER"
|
||||
[[dependencies.astracauldron]]
|
||||
modId="astraplus"
|
||||
type="required"
|
||||
versionRange="[0.5.9,0.6)"
|
||||
versionRange="[0.5.58,0.6)"
|
||||
ordering="AFTER"
|
||||
side="SERVER"
|
||||
|
||||
@@ -218,6 +218,7 @@ public final class SoupVerification {
|
||||
&& !AstraCauldron.liquids().contains(level,plain),"all water bottle kinds fill vanilla water, never become soup");
|
||||
var dye = new ItemStack(Items.DYE.pick(DyeColor.RED));
|
||||
int red = api.mixDye(OptionalInt.empty(),dye).orElseThrow();
|
||||
checkDyedBlocks(level, api);
|
||||
var pos = new BlockPos(18,100,8);
|
||||
for (var armor : List.of(Items.LEATHER_HELMET,Items.LEATHER_CHESTPLATE,Items.LEATHER_LEGGINGS,Items.LEATHER_BOOTS,Items.LEATHER_HORSE_ARMOR,Items.WOLF_ARMOR)) {
|
||||
AstraCauldron.liquids().breakPot(level,pos); fill(level,pos);
|
||||
@@ -264,6 +265,38 @@ public final class SoupVerification {
|
||||
for(int i=0;i<2;i++)use(savedPotion,PotionContents.createItemStack(Items.POTION,Potions.LONG_NIGHT_VISION));
|
||||
var savedDye=new BlockPos(26,100,8); fill(level,savedDye); use(savedDye,dye.copy()); use(savedDye,new ItemStack(Items.LEATHER_HELMET));
|
||||
}
|
||||
private void checkDyedBlocks(ServerLevel level, online.astradev.plus.api.CauldronApi api) throws Exception {
|
||||
var pos = new BlockPos(30,100,8);
|
||||
for (var family : List.of(Items.WOOL, Items.CARPET)) {
|
||||
for (var color : DyeColor.values()) {
|
||||
var source = family.pick(color == DyeColor.WHITE ? DyeColor.BLACK : DyeColor.WHITE);
|
||||
int rgb = api.mixDye(OptionalInt.empty(), new ItemStack(Items.DYE.pick(color))).orElseThrow();
|
||||
var named = new ItemStack(source,64);
|
||||
named.set(DataComponents.CUSTOM_NAME,net.minecraft.network.chat.Component.literal("Keep textile name"));
|
||||
var batch = api.dyeBlocks(named,rgb,3).orElseThrow();
|
||||
require(batch.result().is(family.pick(color)) && batch.result().getCount()==64
|
||||
&& batch.result().getHoverName().getString().equals("Keep textile name")
|
||||
&& named.is(source) && named.getCount()==64,"textile palette and metadata: " + family.pick(color));
|
||||
}
|
||||
for (int water = 1; water <= 3; water++) for (int count : new int[]{1,16,17,32,33,64}) {
|
||||
AstraCauldron.liquids().breakPot(level,pos);
|
||||
level.setBlock(pos,Blocks.WATER_CAULDRON.defaultBlockState().setValue(LayeredCauldronBlock.LEVEL,water),3);
|
||||
player.getInventory().clearContent(); use(pos,new ItemStack(Items.DYE.pick(DyeColor.RED)));
|
||||
use(pos,new ItemStack(family.pick(DyeColor.WHITE),count));
|
||||
int converted = Math.min(count,water==3 ? 64 : water*16);
|
||||
int cost = converted<=16 ? 1 : converted<=32 ? 2 : 3;
|
||||
var remaining = AstraCauldron.liquids().get(level,pos);
|
||||
require(player.getInventory().countItem(family.pick(DyeColor.RED))==converted
|
||||
&& player.getInventory().countItem(family.pick(DyeColor.WHITE))==count-converted
|
||||
&& (remaining==null ? water==cost : remaining.levels()==water-cost),
|
||||
"textile batch/inventory/water: " + family.pick(DyeColor.WHITE) + " count=" + count + " levels=" + water);
|
||||
}
|
||||
}
|
||||
int red = api.mixDye(OptionalInt.empty(),new ItemStack(Items.DYE.pick(DyeColor.RED))).orElseThrow();
|
||||
require(api.dyeBlocks(new ItemStack(Items.WOOL.pick(DyeColor.RED)),red,3).isEmpty()
|
||||
&& api.dyeBlocks(new ItemStack(Items.STONE),red,3).isEmpty(),"matching colors and unsupported blocks rejected");
|
||||
AstraCauldron.liquids().breakPot(level,pos);
|
||||
}
|
||||
private static JsonElement encode(ItemStack stack, net.minecraft.core.HolderLookup.Provider registries) {
|
||||
return ItemStack.CODEC.encodeStart(net.minecraft.resources.RegistryOps.create(com.mojang.serialization.JsonOps.INSTANCE,registries),stack).getOrThrow();
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
param(
|
||||
[string]$ServerDirectory = 'C:/Users/ScarPC/Documents/NeoForge Server 26.2',
|
||||
[string]$Java = 'java',
|
||||
[int]$Port = 25639
|
||||
[int]$Port = 25639,
|
||||
[string]$PlusDirectory = ''
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$repo = Split-Path $PSScriptRoot -Parent
|
||||
$plus = Join-Path (Split-Path $repo -Parent) 'AstraPlus'
|
||||
if ($PlusDirectory) { $plus = (Resolve-Path -LiteralPath $PlusDirectory).Path }
|
||||
$run = Join-Path $repo ('build/verification-' + (Get-Date -Format 'yyyyMMdd-HHmmss') + '-' + [guid]::NewGuid().ToString('N').Substring(0,6))
|
||||
New-Item -ItemType Directory -Path (Join-Path $run 'mods') -Force | Out-Null
|
||||
$plusVersion = [regex]::Match((Get-Content "$plus/build.gradle.kts" -Raw), '(?m)^version = "([^"]+)"').Groups[1].Value
|
||||
|
||||
Reference in New Issue
Block a user