Skip to content

Commit

Permalink
chore: update from api-12
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriel Harris-Rouquette <[email protected]>
  • Loading branch information
gabizou committed Nov 3, 2024
2 parents bde75c7 + 6c45199 commit 163164f
Show file tree
Hide file tree
Showing 8 changed files with 381 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/main/java/org/spongepowered/api/block/entity/DecoratedPot.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.block.entity;

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.item.ItemType;

public interface DecoratedPot extends BlockEntity {

default Value.Mutable<ItemType> front() {
return this.requireValue(Keys.POT_FRONT_DECORATION).asMutable();
}

default Value.Mutable<ItemType> back() {
return this.requireValue(Keys.POT_BACK_DECORATION).asMutable();
}


default Value.Mutable<ItemType> left() {
return this.requireValue(Keys.POT_LEFT_DECORATION).asMutable();
}

default Value.Mutable<ItemType> right() {
return this.requireValue(Keys.POT_RIGHT_DECORATION).asMutable();
}

}
35 changes: 35 additions & 0 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.spongepowered.api.block.entity.BlockEntity;
import org.spongepowered.api.block.entity.CommandBlock;
import org.spongepowered.api.block.entity.CreakingHeart;
import org.spongepowered.api.block.entity.DecoratedPot;
import org.spongepowered.api.block.entity.EndGateway;
import org.spongepowered.api.block.entity.Jukebox;
import org.spongepowered.api.block.entity.Lectern;
Expand Down Expand Up @@ -236,6 +237,7 @@
import org.spongepowered.api.item.merchant.Merchant;
import org.spongepowered.api.item.merchant.TradeOffer;
import org.spongepowered.api.item.potion.PotionType;
import org.spongepowered.api.item.recipe.smithing.ArmorTrim;
import org.spongepowered.api.map.MapCanvas;
import org.spongepowered.api.map.MapInfo;
import org.spongepowered.api.map.decoration.MapDecoration;
Expand Down Expand Up @@ -411,6 +413,11 @@ public final class Keys {
*/
public static final Key<Value<ArmorMaterial>> ARMOR_MATERIAL = Keys.key(ResourceKey.sponge("armor_material"), ArmorMaterial.class);

/**
* The {@link ArmorTrim} of an armor {@link ItemStackLike ItemStack}. Can be modified.
*/
public static final Key<Value<ArmorTrim>> ARMOR_TRIM = Keys.key(ResourceKey.sponge("armor_trim"), ArmorTrim.class);

/**
* The type of {@link ArtType} shown by {@link Painting}s.
*/
Expand Down Expand Up @@ -2642,6 +2649,34 @@ public final class Keys {
*/
public static final Key<Value<PortionType>> PORTION_TYPE = Keys.key(ResourceKey.sponge("portion_type"), PortionType.class);

/**
* The {@link ItemType decoration} for a {@link DecoratedPot}.
*
* @see <a href="https://minecraft.wiki/w/Pottery_Sherd">Pottery Sherd</a>
*/
public static final Key<Value<ItemType>> POT_FRONT_DECORATION = Keys.key(ResourceKey.sponge("pot_front_decoration"), ItemType.class);

/**
* The {@link ItemType decoration} for a {@link DecoratedPot}.
*
* @see <a href="https://minecraft.wiki/w/Pottery_Sherd">Pottery Sherd</a>
*/
public static final Key<Value<ItemType>> POT_LEFT_DECORATION = Keys.key(ResourceKey.sponge("pot_left_decoration"), ItemType.class);

/**
* The {@link ItemType decoration} for a {@link DecoratedPot}.
*
* @see <a href="https://minecraft.wiki/w/Pottery_Sherd">Pottery Sherd</a>
*/
public static final Key<Value<ItemType>> POT_RIGHT_DECORATION = Keys.key(ResourceKey.sponge("pot_right_decoration"), ItemType.class);

/**
* The {@link ItemType decoration} for a {@link DecoratedPot}.
*
* @see <a href="https://minecraft.wiki/w/Pottery_Sherd">Pottery Sherd</a>
*/
public static final Key<Value<ItemType>> POT_BACK_DECORATION = Keys.key(ResourceKey.sponge("pot_back_decoration"), ItemType.class);

/**
* The potential max speed of a {@link Minecart}.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.item.recipe.smithing;

import org.spongepowered.api.Sponge;

import java.util.function.Supplier;

public interface ArmorTrim {

static ArmorTrim of(TrimMaterial material, TrimPattern pattern) {
return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern);
}

static ArmorTrim of(Supplier<? extends TrimMaterial> material, Supplier<? extends TrimPattern> pattern) {
return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern);
}
static ArmorTrim of(TrimMaterial material, Supplier<? extends TrimPattern> pattern) {
return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern);
}

static ArmorTrim of(Supplier<? extends TrimMaterial> material, TrimPattern pattern) {
return Sponge.game().factoryProvider().provide(Factory.class).create(material, pattern);
}

TrimMaterial material();

TrimPattern pattern();

interface Factory {

ArmorTrim create(TrimMaterial material, TrimPattern pattern);

default ArmorTrim create(Supplier<? extends TrimMaterial> material, Supplier<? extends TrimPattern> pattern) {
return create(material.get(), pattern.get());
}

default ArmorTrim create(Supplier<? extends TrimMaterial> material, TrimPattern pattern) {
return create(material.get(), pattern);
}

default ArmorTrim create(TrimMaterial material, Supplier<? extends TrimPattern> pattern) {
return create(material, pattern.get());
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.item.recipe.smithing;

import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.util.annotation.CatalogedBy;

@CatalogedBy(TrimMaterials.class)
public interface TrimMaterial extends DefaultedRegistryValue {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.item.recipe.smithing;

import org.spongepowered.api.ResourceKey;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.registry.DefaultedRegistryReference;
import org.spongepowered.api.registry.Registry;
import org.spongepowered.api.registry.RegistryKey;
import org.spongepowered.api.registry.RegistryScope;
import org.spongepowered.api.registry.RegistryScopes;
import org.spongepowered.api.registry.RegistryTypes;

@SuppressWarnings("unused")
@RegistryScopes(scopes = RegistryScope.ENGINE)
public final class TrimMaterials {

public static final DefaultedRegistryReference<TrimMaterial> AMETHYST = TrimMaterials.key(ResourceKey.minecraft("amethyst"));

public static final DefaultedRegistryReference<TrimMaterial> COPPER = TrimMaterials.key(ResourceKey.minecraft("copper"));

public static final DefaultedRegistryReference<TrimMaterial> DIAMOND = TrimMaterials.key(ResourceKey.minecraft("diamond"));

public static final DefaultedRegistryReference<TrimMaterial> EMERALD = TrimMaterials.key(ResourceKey.minecraft("emerald"));

public static final DefaultedRegistryReference<TrimMaterial> GOLD = TrimMaterials.key(ResourceKey.minecraft("gold"));

public static final DefaultedRegistryReference<TrimMaterial> IRON = TrimMaterials.key(ResourceKey.minecraft("iron"));

public static final DefaultedRegistryReference<TrimMaterial> LAPIS = TrimMaterials.key(ResourceKey.minecraft("lapis"));

public static final DefaultedRegistryReference<TrimMaterial> NETHERITE = TrimMaterials.key(ResourceKey.minecraft("netherite"));

public static final DefaultedRegistryReference<TrimMaterial> QUARTZ = TrimMaterials.key(ResourceKey.minecraft("quartz"));

public static final DefaultedRegistryReference<TrimMaterial> REDSTONE = TrimMaterials.key(ResourceKey.minecraft("redstone"));

private TrimMaterials() {
}

public static Registry<TrimMaterial> registry() {
return Sponge.server().registry(RegistryTypes.TRIM_MATERIAL);
}

private static DefaultedRegistryReference<TrimMaterial> key(final ResourceKey location) {
return RegistryKey.of(RegistryTypes.TRIM_MATERIAL, location).asDefaultedReference(Sponge::server);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of SpongeAPI, licensed under the MIT License (MIT).
*
* Copyright (c) SpongePowered <https://www.spongepowered.org>
* Copyright (c) contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.item.recipe.smithing;

import org.spongepowered.api.registry.DefaultedRegistryValue;
import org.spongepowered.api.util.annotation.CatalogedBy;

@CatalogedBy(TrimPatterns.class)
public interface TrimPattern extends DefaultedRegistryValue {
}
Loading

0 comments on commit 163164f

Please sign in to comment.