Skip to content

Commit 645af7d

Browse files
committed
Merge branch 'api-11' into api-11-be-tick
2 parents 54ec594 + fcfb921 commit 645af7d

File tree

6 files changed

+69
-32
lines changed

6 files changed

+69
-32
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
group=org.spongepowered
2-
version=11.0.0-SNAPSHOT
2+
version=11.1.0-SNAPSHOT
33
organization=SpongePowered
44
projectUrl=https://www.spongepowered.org
55
projectDescription=A plugin API for Minecraft: Java Edition

src/main/java/org/spongepowered/api/data/Keys.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,6 +3113,11 @@ public final class Keys {
31133113
*/
31143114
public static final Key<Value<Vector3i>> TARGET_POSITION = Keys.key(ResourceKey.sponge("target_position"), Vector3i.class);
31153115

3116+
/**
3117+
* The teleport duration of a {@link DisplayEntity}
3118+
*/
3119+
public static final Key<Value<Ticks>> TELEPORT_DURATION = Keys.key(ResourceKey.sponge("teleport_duration"), Ticks.class);
3120+
31163121
/**
31173122
* The {@link TemperatureModifier} of a {@link Biome}.
31183123
* Readonly

src/main/java/org/spongepowered/api/effect/Viewer.java

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,52 @@ default void resetBlockChange(final Vector3i position) {
161161
*/
162162
void resetBlockChange(int x, int y, int z);
163163

164+
/**
165+
* Sends a client-only block breaking progress.
166+
*
167+
* @param position The position
168+
* @param progress The breaking progress from 0 to 1
169+
*/
170+
default void sendBlockProgress(final Vector3i position, final double progress) {
171+
Objects.requireNonNull(position, "position");
172+
this.sendBlockProgress(position.x(), position.y(), position.z(), progress);
173+
}
174+
175+
/**
176+
* Sends a client-only block breaking progress.
177+
*
178+
* @param x The x position
179+
* @param y The y position
180+
* @param z The z position
181+
* @param progress The breaking progress from 0 to 1
182+
*/
183+
void sendBlockProgress(int x, int y, int z, double progress);
184+
185+
/**
186+
* Resets the client's view of the provided position to actual
187+
* breaking progress.
188+
*
189+
* <p>This is useful for resetting what the client sees
190+
* after sending a {@link #sendBlockProgress block progress}.</p>
191+
*
192+
* @param position The position
193+
*/
194+
default void resetBlockProgress(final Vector3i position) {
195+
Objects.requireNonNull(position, "position");
196+
this.resetBlockProgress(position.x(), position.y(), position.z());
197+
}
198+
199+
/**
200+
* Resets the client's view of the provided position to actual
201+
* breaking progress.
202+
*
203+
* <p>This is useful for resetting what the client sees
204+
* after sending a {@link #sendBlockProgress block progress}.</p>
205+
*
206+
* @param x The x position
207+
* @param y The y position
208+
* @param z The z position
209+
*/
210+
void resetBlockProgress(int x, int y, int z);
211+
164212
}

src/main/java/org/spongepowered/api/entity/display/DisplayEntity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ default Ticks interpolationDelay() {
6464
return this.require(Keys.INTERPOLATION_DELAY);
6565
}
6666

67+
/**
68+
* Returns the duration of the teleportation
69+
*
70+
* @return the duration of the teleportation
71+
*/
72+
default Ticks teleportDuration() {
73+
return this.require(Keys.TELEPORT_DURATION);
74+
}
75+
6776
default BillboardType billboardType() {
6877
return this.require(Keys.BILLBOARD_TYPE);
6978
}

src/main/java/org/spongepowered/api/event/block/entity/BrewingEvent.java

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,12 @@
2525
package org.spongepowered.api.event.block.entity;
2626

2727
import org.spongepowered.api.block.entity.carrier.BrewingStand;
28-
import org.spongepowered.api.data.Transaction;
2928
import org.spongepowered.api.event.Cancellable;
3029
import org.spongepowered.api.event.Event;
30+
import org.spongepowered.api.event.item.inventory.AffectSlotEvent;
3131
import org.spongepowered.api.item.inventory.ItemStack;
3232
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
3333

34-
import java.util.List;
3534

3635
/**
3736
* Fires during the brewing process where {@link ItemStack}s are brewed into different {@link ItemStack}s
@@ -61,15 +60,7 @@ interface Start extends BrewingEvent, Cancellable {}
6160
/**
6261
* Fired when a fuel item is consumed to refill the fuel bar.
6362
*/
64-
interface ConsumeFuel extends BrewingEvent, Cancellable {
65-
66-
/**
67-
* The consumed fuel transaction.
68-
*
69-
* @return The consumed fuel transaction.
70-
*/
71-
Transaction<ItemStackSnapshot> fuel();
72-
63+
interface ConsumeFuel extends BrewingEvent, AffectSlotEvent, Cancellable {
7364
}
7465

7566
/**
@@ -85,14 +76,6 @@ interface Interrupt extends BrewingEvent {}
8576
/**
8677
* Fires when brewing finished.
8778
*/
88-
interface Finish extends BrewingEvent {
89-
90-
/**
91-
* Gets an immutable {@link List} of {@link ItemStackSnapshot}s that are the result
92-
* of the brew.
93-
*
94-
* @return The brewed items
95-
*/
96-
List<ItemStackSnapshot> brewedItemStacks();
79+
interface Finish extends BrewingEvent, AffectSlotEvent {
9780
}
9881
}

src/main/java/org/spongepowered/api/event/block/entity/CookingEvent.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,10 @@
2828
import org.spongepowered.api.block.entity.BlockEntity;
2929
import org.spongepowered.api.event.Cancellable;
3030
import org.spongepowered.api.event.Event;
31-
import org.spongepowered.api.event.item.inventory.AffectItemStackEvent;
31+
import org.spongepowered.api.event.item.inventory.AffectSlotEvent;
3232
import org.spongepowered.api.item.inventory.ItemStackSnapshot;
3333
import org.spongepowered.api.item.recipe.cooking.CookingRecipe;
3434

35-
import java.util.List;
3635
import java.util.Optional;
3736

3837
/**
@@ -74,7 +73,7 @@ interface Start extends CookingEvent, Cancellable {}
7473
* Fires whenever fuel is consumed to refill the current burn time.
7574
* Canceling this event prevents fuel from being consumed in a furnace In the current burn time to 0.
7675
*/
77-
interface ConsumeFuel extends CookingEvent, AffectItemStackEvent {}
76+
interface ConsumeFuel extends CookingEvent, AffectSlotEvent {}
7877

7978
/**
8079
* The cooking timer ticking up or down.
@@ -95,13 +94,6 @@ interface Tick extends CookingEvent, Cancellable {
9594
interface Interrupt extends CookingEvent {
9695
}
9796

98-
interface Finish extends CookingEvent {
99-
/**
100-
* Gets an immutable {@link List} of {@link ItemStackSnapshot}s that are the result of the cooking.
101-
* Always exactly one item.
102-
*
103-
* @return The cooked items
104-
*/
105-
List<ItemStackSnapshot> cookedItems();
97+
interface Finish extends CookingEvent, AffectSlotEvent {
10698
}
10799
}

0 commit comments

Comments
 (0)