|
29 | 29 | import org.spongepowered.api.block.BlockTypes; |
30 | 30 | import org.spongepowered.api.entity.living.player.Player; |
31 | 31 | import org.spongepowered.api.event.Cancellable; |
| 32 | +import org.spongepowered.api.event.CompositeEvent; |
32 | 33 | import org.spongepowered.api.event.action.InteractEvent; |
| 34 | +import org.spongepowered.api.event.entity.SpawnEntityEvent; |
| 35 | +import org.spongepowered.api.event.item.inventory.ChangeInventoryEvent; |
33 | 36 | import org.spongepowered.api.item.inventory.ItemStack; |
34 | 37 | import org.spongepowered.api.util.Direction; |
35 | 38 | import org.spongepowered.api.util.Tristate; |
36 | 39 | import org.spongepowered.api.world.server.ServerLocation; |
37 | 40 | import org.spongepowered.math.vector.Vector3d; |
38 | 41 |
|
| 42 | +import java.util.Optional; |
| 43 | + |
39 | 44 | /** |
40 | 45 | * Base event for all interactions involving a {@link BlockSnapshot} at a |
41 | 46 | * {@link ServerLocation}. |
@@ -101,7 +106,7 @@ interface Finish extends Primary, Cancellable { |
101 | 106 | * |
102 | 107 | * <p>This is usually right-click.</p> |
103 | 108 | */ |
104 | | - interface Secondary extends InteractBlockEvent, Cancellable { |
| 109 | + interface Secondary extends InteractBlockEvent { |
105 | 110 |
|
106 | 111 | Tristate originalUseItemResult(); |
107 | 112 |
|
@@ -143,43 +148,47 @@ interface Secondary extends InteractBlockEvent, Cancellable { |
143 | 148 | */ |
144 | 149 | Tristate useBlockResult(); |
145 | 150 |
|
146 | | - /** |
147 | | - * Sets whether the {@link Player#itemInHand} should be used. |
148 | | - * |
149 | | - * <ul> |
150 | | - * <li>FALSE: The {@link ItemStack} will never be used.</li> |
151 | | - * <li>UNDEFINED: The {@link ItemStack} will be used if the block fails. |
152 | | - * </li> |
153 | | - * <li>TRUE: The {@link ItemStack} will always be used.</li> |
154 | | - * </ul> |
155 | | - * |
156 | | - * <p>Note: These results may differ depending on implementation.</p> |
157 | | - * |
158 | | - * @param result Whether the {@link Player#itemInHand} should be used |
159 | | - */ |
160 | | - void setUseItemResult(Tristate result); |
161 | | - |
162 | | - /** |
163 | | - * Sets whether the interacted {@link BlockSnapshot} should be used. |
164 | | - * |
165 | | - * <ul> |
166 | | - * <li>FALSE: {@link BlockSnapshot} will never be used.</li> |
167 | | - * <li>UNDEFINED: {@link BlockSnapshot} will be used as normal.</li> |
168 | | - * <li>TRUE: {@link BlockSnapshot} will always be used.</li> |
169 | | - * </ul> |
170 | | - * |
171 | | - * <p>Note: These results may differ depending on implementation.</p> |
172 | | - * |
173 | | - * @param result Whether the interacted {@link BlockSnapshot} should be |
174 | | - * used |
175 | | - */ |
176 | | - void setUseBlockResult(Tristate result); |
177 | | - |
178 | 151 | /** |
179 | 152 | * Gets the point of interaction where the interaction occurred as a {@link Vector3d}. |
180 | 153 | * |
181 | 154 | * @return The interaction point |
182 | 155 | */ |
183 | 156 | Vector3d interactionPoint(); |
| 157 | + |
| 158 | + interface Pre extends Secondary, Cancellable { |
| 159 | + |
| 160 | + /** |
| 161 | + * Sets whether the {@link Player#itemInHand} should be used. |
| 162 | + * |
| 163 | + * <ul> |
| 164 | + * <li>FALSE: The {@link ItemStack} will never be used.</li> |
| 165 | + * <li>UNDEFINED: The {@link ItemStack} will be used if the block fails. |
| 166 | + * </li> |
| 167 | + * <li>TRUE: The {@link ItemStack} will always be used.</li> |
| 168 | + * </ul> |
| 169 | + * |
| 170 | + * <p>Note: These results may differ depending on implementation.</p> |
| 171 | + * |
| 172 | + * @param result Whether the {@link Player#itemInHand} should be used |
| 173 | + */ |
| 174 | + void setUseItemResult(Tristate result); |
| 175 | + |
| 176 | + /** |
| 177 | + * Sets whether the interacted {@link BlockSnapshot} should be used. |
| 178 | + * |
| 179 | + * <ul> |
| 180 | + * <li>FALSE: {@link BlockSnapshot} will never be used.</li> |
| 181 | + * <li>UNDEFINED: {@link BlockSnapshot} will be used as normal.</li> |
| 182 | + * <li>TRUE: {@link BlockSnapshot} will always be used.</li> |
| 183 | + * </ul> |
| 184 | + * |
| 185 | + * <p>Note: These results may differ depending on implementation.</p> |
| 186 | + * |
| 187 | + * @param result Whether the interacted {@link BlockSnapshot} should be |
| 188 | + * used |
| 189 | + */ |
| 190 | + void setUseBlockResult(Tristate result); |
| 191 | + } |
| 192 | + |
184 | 193 | } |
185 | 194 | } |
0 commit comments