Skip to content
Closed

MC 1.21 #2509

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
group=org.spongepowered
version=11.0.0-SNAPSHOT
version=12.0.0-SNAPSHOT
organization=SpongePowered
projectUrl=https://www.spongepowered.org
projectDescription=A plugin API for Minecraft: Java Edition
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,24 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.spongepowered.api.world.portal;
package org.spongepowered.api.block.entity;

import org.spongepowered.api.util.annotation.DoNotStore;
import org.spongepowered.api.world.server.ServerLocation;
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.world.generation.structure.Structures;

/**
* Represents a {@link Portal} with a known shape.
* Represents a {@link Structures#TRIAL_CHAMBERS Trial} Spawner.
*/
@DoNotStore
public interface TwoDimensionalPortal extends Portal {
public interface TrialSpawner extends BlockEntity {

/**
* One corner of the portal.
* Trigger an immediate spawn of the next entity
*
* @return A location with the corner
*/
default ServerLocation minCorner() {
return this.origin();
}

/**
* One corner of the portal.
* <p>This will obey the restrictions of maximum simultaneous entities ({@link Keys#SPAWN_COUNT})
* unless the {@code force} flag is set.</p>
*
* @return A location with the corner
* @param force Whether to ignore spawning restrictions
*/
ServerLocation maxCorner();
void spawnImmediately(boolean force);

}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@
*/
package org.spongepowered.api.block.entity.carrier;

import org.spongepowered.api.item.recipe.crafting.RecipeInput;

import java.util.List;

public interface Campfire extends CarrierBlockEntity {

List<RecipeInput.Single> recipeInputs();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* 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.carrier;

import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.util.Ticks;

/**
* Represents a Crafter.
*/
public interface Crafter extends CarrierBlockEntity {

// TODO toggled off slots

/**
* {@link Keys#COOLDOWN}
* @return The amount of time in ticks until this crafter can craft another item.
*/
default Value.Mutable<Ticks> cooldown() {
return this.requireValue(Keys.COOLDOWN).asMutable();
}

/**
* Requests this {@link Crafter} to craft an item.
*
* @return true if an item was crafted
*/
boolean craftItem();
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.spongepowered.api.data.Keys;
import org.spongepowered.api.data.value.Value;
import org.spongepowered.api.item.recipe.Recipe;
import org.spongepowered.api.item.recipe.crafting.RecipeInput;
import org.spongepowered.api.util.Ticks;

/**
Expand Down Expand Up @@ -82,4 +83,6 @@ default Value.Mutable<Ticks> maxCookTime() {
return this.requireValue(Keys.MAX_COOK_TIME).asMutable();
}

RecipeInput.Single asRecipeInput();

}
70 changes: 52 additions & 18 deletions src/main/java/org/spongepowered/api/data/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@
import org.spongepowered.api.block.entity.Piston;
import org.spongepowered.api.block.entity.Sign;
import org.spongepowered.api.block.entity.StructureBlock;
import org.spongepowered.api.block.entity.TrialSpawner;
import org.spongepowered.api.block.entity.carrier.Beacon;
import org.spongepowered.api.block.entity.carrier.BrewingStand;
import org.spongepowered.api.block.entity.carrier.CarrierBlockEntity;
import org.spongepowered.api.block.entity.carrier.Crafter;
import org.spongepowered.api.block.entity.carrier.Hopper;
import org.spongepowered.api.block.entity.carrier.furnace.FurnaceBlockEntity;
import org.spongepowered.api.data.meta.BannerPatternLayer;
Expand Down Expand Up @@ -245,7 +247,6 @@
import org.spongepowered.api.util.Ticks;
import org.spongepowered.api.util.Transform;
import org.spongepowered.api.util.orientation.Orientation;
import org.spongepowered.api.util.weighted.WeightedSerializableObject;
import org.spongepowered.api.world.DefaultWorldKeys;
import org.spongepowered.api.world.SerializationBehavior;
import org.spongepowered.api.world.WorldType;
Expand All @@ -268,8 +269,8 @@
import org.spongepowered.api.world.generation.config.WorldGenerationConfig;
import org.spongepowered.api.world.generation.feature.DecorationStep;
import org.spongepowered.api.world.generation.feature.PlacedFeature;
import org.spongepowered.api.world.portal.PortalType;
import org.spongepowered.api.world.portal.PortalTypes;
import org.spongepowered.api.world.portal.Portal;
import org.spongepowered.api.world.portal.PortalLogic;
import org.spongepowered.api.world.server.ServerLocation;
import org.spongepowered.api.world.server.ServerWorld;
import org.spongepowered.api.world.server.WorldTemplate;
Expand Down Expand Up @@ -306,7 +307,7 @@ public final class Keys {
/**
* The acceleration of a {@link DamagingProjectile}.
*/
public static final Key<Value<Vector3d>> ACCELERATION = Keys.key(ResourceKey.sponge("acceleration"), Vector3d.class);
public static final Key<Value<Double>> ACCELERATION = Keys.key(ResourceKey.sponge("acceleration"), Double.class);

/**
* The item a {@link Living} entity is currently using.
Expand Down Expand Up @@ -422,12 +423,24 @@ public final class Keys {
*/
public static final Key<Value<Ticks>> ATTACK_TIME = Keys.key(ResourceKey.sponge("attack_time"), Ticks.class);

/**
* The attack damage of the auto spin attack a {@link Living} is doing.
* @see #IS_AUTO_SPIN_ATTACK
*/
public static final Key<Value<Double>> AUTO_SPIN_ATTACK_DAMAGE = Keys.key(ResourceKey.sponge("auto_spin_attack_damage"), Double.class);

/**
* Remaining ticks of the auto spin attack a {@link Living} is doing.
* @see #IS_AUTO_SPIN_ATTACK
*/
public static final Key<Value<Ticks>> AUTO_SPIN_ATTACK_TICKS = Keys.key(ResourceKey.sponge("auto_spin_attack_ticks"), Ticks.class);

/**
* The ItemStack of the auto spin attack a {@link Living} is doing.
* @see #IS_AUTO_SPIN_ATTACK
*/
public static final Key<Value<ItemStackSnapshot>> AUTO_SPIN_ATTACK_WEAPON = Keys.key(ResourceKey.sponge("auto_spin_attack_weapon"), ItemStackSnapshot.class);

/**
* The author of a {@link ItemTypes#WRITTEN_BOOK} {@link ItemStack}.
*/
Expand Down Expand Up @@ -726,10 +739,17 @@ public final class Keys {
*/
public static final Key<Value<ItemType>> CONTAINER_ITEM = Keys.key(ResourceKey.sponge("container_item"), ItemType.class);

/**
* The {@link ItemStack} a food {@link ItemStack} converts to when eaten.
*/
public static final Key<Value<ItemStack>> FOOD_CONVERTS_TO = Keys.key(ResourceKey.sponge("food_converts_to"), ItemStack.class);

/**
* The amount of ticks a {@link Hopper} has to wait before transferring the next item. (in Vanilla this is 8 ticks)
* or
* The amount of ticks a {@link EndGateway} has to wait for the next teleportation.
* or
* The amount of ticks a {@link Crafter} has to wait for the next craft.
*/
public static final Key<Value<Ticks>> COOLDOWN = Keys.key(ResourceKey.sponge("cooldown"), Ticks.class);

Expand Down Expand Up @@ -2071,7 +2091,7 @@ public final class Keys {
public static final Key<Value<ItemStackSnapshot>> ITEM_STACK_SNAPSHOT = Keys.key(ResourceKey.sponge("item_stack_snapshot"), ItemStackSnapshot.class);

/**
* The knockback strength applied by an {@link ArrowEntity}.
* The custom knockback strength applied by an {@link ArrowEntity}.
*
* <p>For the knockback provided by hits with a weapon according to the
* enchantment of the same name, see {@link #APPLIED_ENCHANTMENTS}.</p>
Expand Down Expand Up @@ -2327,9 +2347,9 @@ public final class Keys {
public static final Key<Value<Double>> MAX_HEALTH = Keys.key(ResourceKey.sponge("max_health"), Double.class);

/**
* The maximum number of entities around a {@link MobSpawner}.
* A spawner will not spawn entities if there are more
* entities around than this value permits.
* The maximum number of entities tracked by a {@link MobSpawner} or {@link TrialSpawner}
* <p>A spawner will not spawn entities if there are more
* entities tracked than this value permits.</p>
*/
public static final Key<Value<Integer>> MAX_NEARBY_ENTITIES = Keys.key(ResourceKey.sponge("max_nearby_entities"), Integer.class);

Expand All @@ -2342,7 +2362,7 @@ public final class Keys {

/**
* The maximum amount of ticks between two
* batches of entities spawned by a {@link MobSpawner}.
* batches of entities spawned by a {@link MobSpawner} or {@link TrialSpawner}
*/
public static final Key<Value<Ticks>> MAX_SPAWN_DELAY = Keys.key(ResourceKey.sponge("max_spawn_delay"), Ticks.class);

Expand All @@ -2364,7 +2384,7 @@ public final class Keys {

/**
* The minimum amount of ticks between two
* batches of entities spawned by a {@link MobSpawner}.
* batches of entities spawned by a {@link MobSpawner} or {@link TrialSpawner}
*/
public static final Key<Value<Ticks>> MIN_SPAWN_DELAY = Keys.key(ResourceKey.sponge("min_spawn_delay"), Ticks.class);

Expand Down Expand Up @@ -2401,20 +2421,20 @@ public final class Keys {
* Whether a {@link WorldType} is considered natural.
* <p>Natural worlds allow
* sleeping in beds and setting the respawn point,
* {@link PortalTypes#NETHER} portals to spawn {@link ZombifiedPiglin} and
* {@link BlockTypes#NETHER_PORTAL} portals to spawn {@link ZombifiedPiglin} and
* {@link ItemTypes#COMPASS} to work</p>
* Readonly
*/
public static final Key<Value<Boolean>> NATURAL_WORLD_TYPE = Keys.key(ResourceKey.sponge("natural_world_type"), Boolean.class);

/**
* The next entity that will be spawned by a {@link MobSpawner}.
* The next entity that will be spawned by a {@link MobSpawner} or {@link TrialSpawner}
*
* <p>Normally the entities to be spawned are determined by a random value
* applied to the {@link #SPAWNABLE_ENTITIES} weighted collection. If this
* value exists, it will override the random spawn with a definite one.</p>
*/
public static final Key<Value<WeightedSerializableObject<EntityArchetype>>> NEXT_ENTITY_TO_SPAWN = Keys.key(ResourceKey.sponge("next_entity_to_spawn"), new TypeToken<WeightedSerializableObject<EntityArchetype>>() {});
public static final Key<Value<EntityArchetype>> NEXT_ENTITY_TO_SPAWN = Keys.key(ResourceKey.sponge("next_entity_to_spawn"), EntityArchetype.class);

/**
* The pitch of a {@link BlockTypes#NOTE_BLOCK} {@link BlockState}.
Expand Down Expand Up @@ -2556,6 +2576,18 @@ public final class Keys {
*/
public static final Key<SetValue<Direction>> PORES = Keys.setKey(ResourceKey.sponge("pores"), Direction.class);

/**
* The {@link PortalLogic} an {@link Entity} is currently in.
*/
public static final Key<Value<PortalLogic>> PORTAL_LOGIC = Keys.key(ResourceKey.sponge("portal"), PortalLogic.class);

/**
* The {@link Portal} an {@link Entity} is currently in.
* <p>To modify this set the {@link #PORTAL_LOGIC} to use instead</p>
* Readonly
*/
public static final Key<Value<Portal>> PORTAL = Keys.key(ResourceKey.sponge("portal"), Portal.class);

/**
* The {@link PortionType} of a {@link BlockState}.
* e.g. {@link BlockTypes#OAK_DOOR}, {@link BlockTypes#ROSE_BUSH} or {@link BlockTypes#WHITE_BED}
Expand Down Expand Up @@ -2693,7 +2725,8 @@ public final class Keys {

/**
* Represents the {@link Key} for the remaining number of ticks to pass
* before another attempt to spawn entities is made by a {@link MobSpawner}.
* before another attempt to spawn entities is made by a {@link MobSpawner}
* or {@link TrialSpawner}
*/
public static final Key<Value<Ticks>> REMAINING_SPAWN_DELAY = Keys.key(ResourceKey.sponge("remaining_spawn_delay"), Ticks.class);

Expand Down Expand Up @@ -2938,7 +2971,7 @@ public final class Keys {
public static final Key<Value<Ticks>> SNEEZING_TIME = Keys.key(ResourceKey.sponge("sneezing_time"), Ticks.class);

/**
* The list of {@link EntityArchetype}s able to be spawned by a {@link MobSpawner}.
* The list of {@link EntityArchetype}s able to be spawned by a {@link MobSpawner} or {@link TrialSpawner}
*/
public static final Key<WeightedCollectionValue<EntityArchetype>> SPAWNABLE_ENTITIES = Keys.weightedKey(ResourceKey.sponge("spawnable_entities"), EntityArchetype.class);

Expand All @@ -2951,7 +2984,7 @@ public final class Keys {
public static final Key<Value<Double>> SPAWN_CHANCE = Keys.key(ResourceKey.sponge("spawn_chance"), Double.class);

/**
* How many entities a {@link MobSpawner} has spawned so far.
* How many entities a {@link MobSpawner} spawns at once.
*/
public static final Key<Value<Integer>> SPAWN_COUNT = Keys.key(ResourceKey.sponge("spawn_count"), Integer.class);

Expand All @@ -2972,7 +3005,8 @@ public final class Keys {
public static final Key<Value<Vector3i>> SPAWN_POSITION = Keys.key(ResourceKey.sponge("spawn_position"), Vector3i.class);

/**
* How far away from the {@link MobSpawner} the entities spawned by it may appear.
* How far away from the {@link MobSpawner} or {@link TrialSpawner}
* the entities spawned by it may appear.
*/
public static final Key<Value<Double>> SPAWN_RANGE = Keys.key(ResourceKey.sponge("spawn_range"), Double.class);

Expand Down Expand Up @@ -3388,7 +3422,7 @@ public final class Keys {

/**
* The logical height of a {@link WorldType}
* <p>Restricts teleportation via {@link ItemTypes#CHORUS_FRUIT} or {@link PortalType portal types}
* <p>Restricts teleportation via {@link ItemTypes#CHORUS_FRUIT} or {@link PortalLogic portal types}
* or portal generation
* to below the logical height.</p>
* Readonly
Expand Down
Loading