forked from FabricMC/fabric
move impl-suffixed packages to impl/
This commit is contained in:
parent
fd8e0b688d
commit
ce2cb882ce
34 changed files with 70 additions and 77 deletions
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.events;
|
||||
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.fabricmc.fabric.util.HandlerRegistry;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
|
@ -29,8 +29,8 @@ import java.util.function.BiConsumer;
|
|||
* your own methods and transparently add the resulting information to a Map.
|
||||
*/
|
||||
public final class ObjectBuilderEvent {
|
||||
public static final HandlerRegistry<BiConsumer<Block.Settings, Block>> BLOCK = new HandlerList<>(BiConsumer.class);
|
||||
public static final HandlerRegistry<BiConsumer<Item.Settings, Item>> ITEM = new HandlerList<>(BiConsumer.class);
|
||||
public static final HandlerRegistry<BiConsumer<Block.Settings, Block>> BLOCK = new HandlerArray<>(BiConsumer.class);
|
||||
public static final HandlerRegistry<BiConsumer<Item.Settings, Item>> ITEM = new HandlerArray<>(BiConsumer.class);
|
||||
|
||||
private ObjectBuilderEvent() {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.events;
|
||||
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.fabricmc.fabric.util.HandlerRegistry;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
@ -66,20 +66,20 @@ public final class PlayerInteractionEvent {
|
|||
/**
|
||||
* Event emitted when a player "attacks" a block.
|
||||
*/
|
||||
public static final HandlerRegistry<Block> ATTACK_BLOCK = new HandlerList<>(Block.class);
|
||||
public static final HandlerRegistry<Block> ATTACK_BLOCK = new HandlerArray<>(Block.class);
|
||||
|
||||
/**
|
||||
* Event emitted when a player "attacks" an entity.
|
||||
*/
|
||||
public static final HandlerRegistry<Entity> ATTACK_ENTITY = new HandlerList<>(Entity.class);
|
||||
public static final HandlerRegistry<Entity> ATTACK_ENTITY = new HandlerArray<>(Entity.class);
|
||||
|
||||
// TODO: For completeness' sake, but requires us to add a custom packet. Is it worth the complexity?
|
||||
/* public static final HandlerRegistry<Item> ATTACK_ITEM = new HandlerList<>(); */
|
||||
/* public static final HandlerRegistry<Item> ATTACK_ITEM = new HandlerArray<>(); */
|
||||
|
||||
/**
|
||||
* Event emitted when a player interacts with a block.
|
||||
*/
|
||||
public static final HandlerRegistry<BlockPositioned> INTERACT_BLOCK = new HandlerList<>(BlockPositioned.class);
|
||||
public static final HandlerRegistry<BlockPositioned> INTERACT_BLOCK = new HandlerArray<>(BlockPositioned.class);
|
||||
|
||||
/**
|
||||
* Event emitted when a player interacts with an entity.
|
||||
|
@ -90,12 +90,12 @@ public final class PlayerInteractionEvent {
|
|||
* only one event is currently provided, but it is accordingly named in
|
||||
* the case of a second event being necessary.
|
||||
*/
|
||||
public static final HandlerRegistry<EntityPositioned> INTERACT_ENTITY_POSITIONED = new HandlerList<>(EntityPositioned.class);
|
||||
public static final HandlerRegistry<EntityPositioned> INTERACT_ENTITY_POSITIONED = new HandlerArray<>(EntityPositioned.class);
|
||||
|
||||
/**
|
||||
* Event emitted when a player interacts with an item.
|
||||
*/
|
||||
public static final HandlerRegistry<Item> INTERACT_ITEM = new HandlerList<>(Item.class);
|
||||
public static final HandlerRegistry<Item> INTERACT_ITEM = new HandlerArray<>(Item.class);
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #ATTACK_BLOCK ATTACK_BLOCK} instead.
|
||||
|
|
|
@ -16,16 +16,14 @@
|
|||
|
||||
package net.fabricmc.fabric.events;
|
||||
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.fabricmc.fabric.util.HandlerRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.Profiler;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public final class ServerEvent {
|
||||
public static final HandlerRegistry<Consumer<MinecraftServer>> START = new HandlerList<>(Consumer.class);
|
||||
public static final HandlerRegistry<Consumer<MinecraftServer>> START = new HandlerArray<>(Consumer.class);
|
||||
|
||||
private ServerEvent() {
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.events;
|
||||
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.fabricmc.fabric.util.HandlerRegistry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.Profiler;
|
||||
|
@ -29,15 +29,15 @@ import java.util.function.Consumer;
|
|||
* You can use them as endpoints to tick your own, related logic "globally".
|
||||
*/
|
||||
public final class TickEvent {
|
||||
public static final HandlerRegistry<Consumer<MinecraftServer>> SERVER = new HandlerList<>(Consumer.class);
|
||||
public static final HandlerRegistry<Consumer<World>> WORLD = new HandlerList<>(Consumer.class);
|
||||
public static final HandlerRegistry<Consumer<MinecraftServer>> SERVER = new HandlerArray<>(Consumer.class);
|
||||
public static final HandlerRegistry<Consumer<World>> WORLD = new HandlerArray<>(Consumer.class);
|
||||
|
||||
private TickEvent() {
|
||||
|
||||
}
|
||||
|
||||
public static <T> void tick(HandlerRegistry<Consumer<T>> registry, T object, Profiler profiler) {
|
||||
Consumer<T>[] handlers = ((HandlerList<Consumer<T>>) registry).getBackingArray();
|
||||
Consumer<T>[] handlers = ((HandlerArray<Consumer<T>>) registry).getBackingArray();
|
||||
if (handlers.length > 0) {
|
||||
profiler.begin("fabric");
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.events.client;
|
||||
|
||||
import net.fabricmc.fabric.events.TickEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.fabricmc.fabric.util.HandlerRegistry;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
||||
|
@ -29,7 +29,7 @@ import java.util.function.Consumer;
|
|||
* @see TickEvent
|
||||
*/
|
||||
public final class ClientTickEvent {
|
||||
public static final HandlerRegistry<Consumer<MinecraftClient>> CLIENT = new HandlerList<>(Consumer.class);
|
||||
public static final HandlerRegistry<Consumer<MinecraftClient>> CLIENT = new HandlerArray<>(Consumer.class);
|
||||
|
||||
private ClientTickEvent() {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.events.client;
|
||||
|
||||
import net.fabricmc.fabric.client.texture.SpriteRegistry;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.fabricmc.fabric.util.HandlerRegistry;
|
||||
|
||||
public class SpriteEvent {
|
||||
|
@ -26,5 +26,5 @@ public class SpriteEvent {
|
|||
void registerSprites(SpriteRegistry registry);
|
||||
}
|
||||
|
||||
public static final HandlerRegistry<Provider> PROVIDE = new HandlerList<>(Provider.class);
|
||||
public static final HandlerRegistry<Provider> PROVIDE = new HandlerArray<>(Provider.class);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric;
|
||||
package net.fabricmc.fabric.impl;
|
||||
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.block.BreakInteractable;
|
||||
|
@ -29,7 +29,7 @@ import net.minecraft.world.World;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
public class FabricAPI implements ModInitializer {
|
||||
public class FabricAPIInitializer implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
PlayerInteractionEvent.BREAK_BLOCK.register((player, world, hand, pos, direction) -> {
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.client.texture.impl;
|
||||
package net.fabricmc.fabric.impl.client.texture;
|
||||
|
||||
import net.minecraft.class_1050;
|
||||
import net.minecraft.client.resource.metadata.AnimationResourceMetadata;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.registry.impl.listeners;
|
||||
package net.fabricmc.fabric.impl.registry;
|
||||
|
||||
import net.fabricmc.fabric.registry.ExtendedIdList;
|
||||
import net.fabricmc.fabric.registry.RegistryListener;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.registry.impl.listeners;
|
||||
package net.fabricmc.fabric.impl.registry;
|
||||
|
||||
import net.fabricmc.fabric.registry.ExtendedIdList;
|
||||
import net.fabricmc.fabric.registry.RegistryListener;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.registry.impl.listeners;
|
||||
package net.fabricmc.fabric.impl.registry;
|
||||
|
||||
import net.fabricmc.fabric.registry.ExtendedIdList;
|
||||
import net.fabricmc.fabric.registry.RegistryListener;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.registry.impl.listeners;
|
||||
package net.fabricmc.fabric.impl.registry;
|
||||
|
||||
import net.fabricmc.fabric.registry.RegistryListener;
|
||||
import net.minecraft.item.Item;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.registry.impl.listeners;
|
||||
package net.fabricmc.fabric.impl.registry;
|
||||
|
||||
import net.fabricmc.fabric.registry.ExtendedIdList;
|
||||
import net.fabricmc.fabric.registry.RegistryListener;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.resources.impl;
|
||||
package net.fabricmc.fabric.impl.resources;
|
||||
|
||||
import net.fabricmc.fabric.resources.ModResourcePack;
|
||||
import net.minecraft.resource.ResourcePack;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.resources.impl;
|
||||
package net.fabricmc.fabric.impl.resources;
|
||||
|
||||
import net.fabricmc.fabric.resources.ModResourcePack;
|
||||
import net.fabricmc.loader.ModInfo;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.resources.impl;
|
||||
package net.fabricmc.fabric.impl.resources;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import net.fabricmc.loader.FabricLoader;
|
|
@ -14,7 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.resources.impl;
|
||||
package net.fabricmc.fabric.impl.resources;
|
||||
|
||||
import net.fabricmc.fabric.resources.ModResourcePack;
|
||||
import net.fabricmc.loader.ModInfo;
|
|
@ -14,16 +14,18 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package net.fabricmc.fabric.util;
|
||||
package net.fabricmc.fabric.impl.util;
|
||||
|
||||
import net.fabricmc.fabric.util.HandlerRegistry;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
||||
public class HandlerList<T> implements HandlerRegistry<T> {
|
||||
public class HandlerArray<T> implements HandlerRegistry<T> {
|
||||
private final Class tClass;
|
||||
private T[] array;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public HandlerList(Class theClass) {
|
||||
public HandlerArray(Class theClass) {
|
||||
this.tClass = theClass;
|
||||
this.array = (T[]) Array.newInstance(tClass, 0);
|
||||
}
|
|
@ -18,9 +18,9 @@ package net.fabricmc.fabric.mixin.client.texture;
|
|||
|
||||
import com.google.common.base.Joiner;
|
||||
import net.fabricmc.fabric.client.texture.*;
|
||||
import net.fabricmc.fabric.client.texture.impl.FabricSprite;
|
||||
import net.fabricmc.fabric.impl.client.texture.FabricSprite;
|
||||
import net.fabricmc.fabric.events.client.SpriteEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.class_1050;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.resource.metadata.AnimationResourceMetadata;
|
||||
|
@ -85,7 +85,7 @@ public abstract class MixinSpriteAtlasTexture {
|
|||
//noinspection RedundantCast,ConstantConditions
|
||||
if ((SpriteAtlasTexture) (Object) this == MinecraftClient.getInstance().getSpriteAtlas()) {
|
||||
SpriteRegistry registry = new SpriteRegistry(sprites, (id) -> addSpriteToLoad(manager, id));
|
||||
for (SpriteEvent.Provider provider : ((HandlerList<SpriteEvent.Provider>) SpriteEvent.PROVIDE).getBackingArray()) {
|
||||
for (SpriteEvent.Provider provider : ((HandlerArray<SpriteEvent.Provider>) SpriteEvent.PROVIDE).getBackingArray()) {
|
||||
provider.registerSprites(registry);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.events.objectbuilder;
|
||||
|
||||
import net.fabricmc.fabric.events.ObjectBuilderEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.block.Block;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -30,7 +30,7 @@ import java.util.function.BiConsumer;
|
|||
public class MixinBlock {
|
||||
@Inject(method = "<init>(Lnet/minecraft/block/Block$Settings;)V", at = @At("RETURN"))
|
||||
public void init(Block.Settings builder, CallbackInfo info) {
|
||||
for (BiConsumer<Block.Settings, Block> consumer : ((HandlerList<BiConsumer<Block.Settings, Block>>) ObjectBuilderEvent.BLOCK).getBackingArray()) {
|
||||
for (BiConsumer<Block.Settings, Block> consumer : ((HandlerArray<BiConsumer<Block.Settings, Block>>) ObjectBuilderEvent.BLOCK).getBackingArray()) {
|
||||
consumer.accept(builder, (Block) (Object) this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.events.objectbuilder;
|
||||
|
||||
import net.fabricmc.fabric.events.ObjectBuilderEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.item.Item;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -30,7 +30,7 @@ import java.util.function.BiConsumer;
|
|||
public class MixinItem {
|
||||
@Inject(method = "<init>(Lnet/minecraft/item/Item$Settings;)V", at = @At("RETURN"))
|
||||
public void init(Item.Settings builder, CallbackInfo info) {
|
||||
for (BiConsumer<Item.Settings, Item> consumer : ((HandlerList<BiConsumer<Item.Settings, Item>>) ObjectBuilderEvent.ITEM).getBackingArray()) {
|
||||
for (BiConsumer<Item.Settings, Item> consumer : ((HandlerArray<BiConsumer<Item.Settings, Item>>) ObjectBuilderEvent.ITEM).getBackingArray()) {
|
||||
consumer.accept(builder, (Item) (Object) this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.events.playerinteraction;
|
||||
|
||||
import net.fabricmc.fabric.events.PlayerInteractionEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.network.ClientPlayNetworkHandler;
|
||||
import net.minecraft.client.network.ClientPlayerEntity;
|
||||
|
@ -52,7 +52,7 @@ public class MixinClientPlayerInteractionManager {
|
|||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/GameMode;isCreative()Z", ordinal = 0), method = "attackBlock", cancellable = true)
|
||||
public void attackBlock(BlockPos pos, Direction direction, CallbackInfoReturnable<Boolean> info) {
|
||||
for (PlayerInteractionEvent.Block handler : ((HandlerList<PlayerInteractionEvent.Block>) PlayerInteractionEvent.ATTACK_BLOCK).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.Block handler : ((HandlerArray<PlayerInteractionEvent.Block>) PlayerInteractionEvent.ATTACK_BLOCK).getBackingArray()) {
|
||||
ActionResult result = handler.interact(client.player, client.world, Hand.MAIN, pos, direction);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.setReturnValue(result == ActionResult.SUCCESS);
|
||||
|
@ -68,7 +68,7 @@ public class MixinClientPlayerInteractionManager {
|
|||
return;
|
||||
}
|
||||
|
||||
for (PlayerInteractionEvent.Block handler : ((HandlerList<PlayerInteractionEvent.Block>) PlayerInteractionEvent.ATTACK_BLOCK).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.Block handler : ((HandlerArray<PlayerInteractionEvent.Block>) PlayerInteractionEvent.ATTACK_BLOCK).getBackingArray()) {
|
||||
ActionResult result = handler.interact(client.player, client.world, Hand.MAIN, pos, direction);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.setReturnValue(result == ActionResult.SUCCESS);
|
||||
|
@ -80,7 +80,7 @@ public class MixinClientPlayerInteractionManager {
|
|||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;", ordinal = 0), method = "interactBlock", cancellable = true)
|
||||
public void interactBlock(ClientPlayerEntity player, ClientWorld world, BlockPos pos, Direction direction, Vec3d vec, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
PlayerInteractionEvent.BlockPositioned[] backingArray = ((HandlerList<PlayerInteractionEvent.BlockPositioned>) PlayerInteractionEvent.INTERACT_BLOCK).getBackingArray();
|
||||
PlayerInteractionEvent.BlockPositioned[] backingArray = ((HandlerArray<PlayerInteractionEvent.BlockPositioned>) PlayerInteractionEvent.INTERACT_BLOCK).getBackingArray();
|
||||
if (backingArray.length > 0) {
|
||||
float hitX = (float) (vec.x - pos.getX());
|
||||
float hitY = (float) (vec.y - pos.getY());
|
||||
|
@ -102,7 +102,7 @@ public class MixinClientPlayerInteractionManager {
|
|||
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/PlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;", ordinal = 0), method = "interactItem", cancellable = true)
|
||||
public void interactItem(PlayerEntity player, World world, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
for (PlayerInteractionEvent.Item handler : ((HandlerList<PlayerInteractionEvent.Item>) PlayerInteractionEvent.INTERACT_ITEM).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.Item handler : ((HandlerArray<PlayerInteractionEvent.Item>) PlayerInteractionEvent.INTERACT_ITEM).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, world, hand);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.setReturnValue(result);
|
||||
|
@ -114,7 +114,7 @@ public class MixinClientPlayerInteractionManager {
|
|||
|
||||
@Inject(at = @At("HEAD"), method = "attackEntity", cancellable = true)
|
||||
public void attackEntity(PlayerEntity player, Entity entity, CallbackInfo info) {
|
||||
for (PlayerInteractionEvent.Entity handler : ((HandlerList<PlayerInteractionEvent.Entity>) PlayerInteractionEvent.ATTACK_ENTITY).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.Entity handler : ((HandlerArray<PlayerInteractionEvent.Entity>) PlayerInteractionEvent.ATTACK_ENTITY).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, player.getEntityWorld(), Hand.MAIN /* TODO */, entity);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.cancel();
|
||||
|
@ -128,7 +128,7 @@ public class MixinClientPlayerInteractionManager {
|
|||
// TODO: Remove double Vec3d creation?
|
||||
Vec3d hitVec = new Vec3d(hitResult.pos.x - entity.x, hitResult.pos.y - entity.y, hitResult.pos.z - entity.z);
|
||||
|
||||
for (PlayerInteractionEvent.EntityPositioned handler : ((HandlerList<PlayerInteractionEvent.EntityPositioned>) PlayerInteractionEvent.INTERACT_ENTITY_POSITIONED).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.EntityPositioned handler : ((HandlerArray<PlayerInteractionEvent.EntityPositioned>) PlayerInteractionEvent.INTERACT_ENTITY_POSITIONED).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, player.getEntityWorld(), hand, entity, hitVec);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.setReturnValue(result);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.events.playerinteraction;
|
||||
|
||||
import net.fabricmc.fabric.events.PlayerInteractionEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.server.network.ServerPlayNetworkHandler;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.server.network.packet.PlayerInteractEntityServerPacket;
|
||||
|
@ -35,7 +35,7 @@ public class MixinServerPlayNetworkHandler {
|
|||
|
||||
@Inject(method = "onPlayerInteractEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;interactAt(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/math/Vec3d;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;"), cancellable = true)
|
||||
public void onPlayerInteractEntity(PlayerInteractEntityServerPacket packet, CallbackInfo info) {
|
||||
for (PlayerInteractionEvent.EntityPositioned handler : ((HandlerList<PlayerInteractionEvent.EntityPositioned>) PlayerInteractionEvent.INTERACT_ENTITY_POSITIONED).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.EntityPositioned handler : ((HandlerArray<PlayerInteractionEvent.EntityPositioned>) PlayerInteractionEvent.INTERACT_ENTITY_POSITIONED).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, player.getEntityWorld(), packet.getHand(), packet.getEntity(player.world), packet.getHitPosition());
|
||||
if (result != ActionResult.PASS) {
|
||||
info.cancel();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.events.playerinteraction;
|
||||
|
||||
import net.fabricmc.fabric.events.PlayerInteractionEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.util.ActionResult;
|
||||
|
@ -33,7 +33,7 @@ public class MixinServerPlayerEntity {
|
|||
public void onPlayerInteractEntity(Entity target, CallbackInfo info) {
|
||||
ServerPlayerEntity player = (ServerPlayerEntity) (Object) this;
|
||||
|
||||
for (PlayerInteractionEvent.Entity handler : ((HandlerList<PlayerInteractionEvent.Entity>) PlayerInteractionEvent.ATTACK_ENTITY).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.Entity handler : ((HandlerArray<PlayerInteractionEvent.Entity>) PlayerInteractionEvent.ATTACK_ENTITY).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, player.getEntityWorld(), Hand.MAIN, target);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.cancel();
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.events.playerinteraction;
|
||||
|
||||
import net.fabricmc.fabric.events.PlayerInteractionEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.client.network.packet.BlockUpdateClientPacket;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -44,7 +44,7 @@ public class MixinServerPlayerInteractionManager {
|
|||
|
||||
@Inject(at = @At("HEAD"), method = "method_14263", cancellable = true)
|
||||
public void startBlockBreak(BlockPos pos, Direction direction, CallbackInfo info) {
|
||||
for (PlayerInteractionEvent.Block handler : ((HandlerList<PlayerInteractionEvent.Block>) PlayerInteractionEvent.ATTACK_BLOCK).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.Block handler : ((HandlerArray<PlayerInteractionEvent.Block>) PlayerInteractionEvent.ATTACK_BLOCK).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, world, Hand.MAIN, pos, direction);
|
||||
if (result != ActionResult.PASS) {
|
||||
// The client might have broken the block on its side, so make sure to let it know.
|
||||
|
@ -57,7 +57,7 @@ public class MixinServerPlayerInteractionManager {
|
|||
|
||||
@Inject(at = @At("HEAD"), method = "interactBlock", cancellable = true)
|
||||
public void interactBlock(PlayerEntity player, World world, ItemStack stack, Hand hand, BlockPos pos, Direction direction, float hitX, float hitY, float hitZ, CallbackInfoReturnable<ActionResult> info) {
|
||||
for (PlayerInteractionEvent.BlockPositioned handler : ((HandlerList<PlayerInteractionEvent.BlockPositioned>) PlayerInteractionEvent.INTERACT_BLOCK).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.BlockPositioned handler : ((HandlerArray<PlayerInteractionEvent.BlockPositioned>) PlayerInteractionEvent.INTERACT_BLOCK).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, world, hand, pos, direction, hitX, hitY, hitZ);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.setReturnValue(result);
|
||||
|
@ -69,7 +69,7 @@ public class MixinServerPlayerInteractionManager {
|
|||
|
||||
@Inject(at = @At("HEAD"), method = "interactItem", cancellable = true)
|
||||
public void interactItem(PlayerEntity player, World world, ItemStack stack, Hand hand, CallbackInfoReturnable<ActionResult> info) {
|
||||
for (PlayerInteractionEvent.Item handler : ((HandlerList<PlayerInteractionEvent.Item>) PlayerInteractionEvent.INTERACT_ITEM).getBackingArray()) {
|
||||
for (PlayerInteractionEvent.Item handler : ((HandlerArray<PlayerInteractionEvent.Item>) PlayerInteractionEvent.INTERACT_ITEM).getBackingArray()) {
|
||||
ActionResult result = handler.interact(player, world, hand);
|
||||
if (result != ActionResult.PASS) {
|
||||
info.setReturnValue(result);
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.events.server;
|
||||
|
||||
import net.fabricmc.fabric.events.ServerEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.fabricmc.fabric.impl.util.HandlerArray;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
@ -30,7 +30,7 @@ import java.util.function.Consumer;
|
|||
public class MixinMinecraftServer {
|
||||
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;method_3791(Lnet/minecraft/server/ServerMetadata;)V", ordinal = 0), method = "run")
|
||||
public void afterSetupServer(CallbackInfo info) {
|
||||
for (Consumer<MinecraftServer> handler : ((HandlerList<Consumer<MinecraftServer>>) ServerEvent.START).getBackingArray()) {
|
||||
for (Consumer<MinecraftServer> handler : ((HandlerArray<Consumer<MinecraftServer>>) ServerEvent.START).getBackingArray()) {
|
||||
handler.accept((MinecraftServer) (Object) this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.events.tick;
|
||||
|
||||
import net.fabricmc.fabric.events.ServerEvent;
|
||||
import net.fabricmc.fabric.events.TickEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.minecraft.class_3689;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -28,7 +26,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.BooleanSupplier;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
public class MixinMinecraftServer {
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.events.tick;
|
||||
|
||||
import net.fabricmc.fabric.events.PlayerInteractionEvent;
|
||||
import net.fabricmc.fabric.events.TickEvent;
|
||||
import net.fabricmc.fabric.util.HandlerList;
|
||||
import net.minecraft.util.Profiler;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -27,8 +25,6 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
@Mixin(World.class)
|
||||
public class MixinWorld {
|
||||
@Shadow
|
||||
|
|
|
@ -19,10 +19,10 @@ package net.fabricmc.fabric.mixin.registry;
|
|||
import net.fabricmc.fabric.networking.CustomPayloadPacketRegistry;
|
||||
import net.fabricmc.fabric.registry.ListenableRegistry;
|
||||
import net.fabricmc.fabric.registry.RegistrySyncManager;
|
||||
import net.fabricmc.fabric.registry.impl.listeners.BootstrapBiomeRegistryListener;
|
||||
import net.fabricmc.fabric.registry.impl.listeners.BootstrapBlockRegistryListener;
|
||||
import net.fabricmc.fabric.registry.impl.listeners.BootstrapFluidRegistryListener;
|
||||
import net.fabricmc.fabric.registry.impl.listeners.BootstrapItemRegistryListener;
|
||||
import net.fabricmc.fabric.impl.registry.BootstrapBiomeRegistryListener;
|
||||
import net.fabricmc.fabric.impl.registry.BootstrapBlockRegistryListener;
|
||||
import net.fabricmc.fabric.impl.registry.BootstrapFluidRegistryListener;
|
||||
import net.fabricmc.fabric.impl.registry.BootstrapItemRegistryListener;
|
||||
import net.minecraft.Bootstrap;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.registry.client;
|
||||
|
||||
import net.fabricmc.fabric.registry.ListenableRegistry;
|
||||
import net.fabricmc.fabric.registry.impl.listeners.IdListUpdater;
|
||||
import net.fabricmc.fabric.impl.registry.IdListUpdater;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.render.block.BlockColorMap;
|
||||
import net.minecraft.client.render.block.BlockColorMapper;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
package net.fabricmc.fabric.mixin.registry.client;
|
||||
|
||||
import net.fabricmc.fabric.registry.ListenableRegistry;
|
||||
import net.fabricmc.fabric.registry.impl.listeners.IdListUpdater;
|
||||
import net.fabricmc.fabric.impl.registry.IdListUpdater;
|
||||
import net.minecraft.client.render.block.BlockColorMap;
|
||||
import net.minecraft.client.render.item.ItemColorMap;
|
||||
import net.minecraft.client.render.item.ItemColorMapper;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.resources;
|
||||
|
||||
import net.fabricmc.fabric.resources.impl.ModResourcePackUtil;
|
||||
import net.fabricmc.fabric.impl.resources.ModResourcePackUtil;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.resource.ReloadableResourceManager;
|
||||
import net.minecraft.resource.ResourcePack;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
package net.fabricmc.fabric.mixin.resources;
|
||||
|
||||
import net.fabricmc.fabric.resources.impl.ModDataPackSupplier;
|
||||
import net.fabricmc.fabric.impl.resources.ModDataPackSupplier;
|
||||
import net.minecraft.resource.ResourcePackContainer;
|
||||
import net.minecraft.resource.ResourcePackContainerManager;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"description": "Core API module providing key hooks and intercompatibility features.",
|
||||
"license": "Apache-2.0",
|
||||
"initializers": [
|
||||
"net.fabricmc.fabric.FabricAPI"
|
||||
"net.fabricmc.fabric.impl.FabricAPIInitializer"
|
||||
],
|
||||
"mixins": {
|
||||
"client": "net.fabricmc.fabric.mixins.client.json",
|
Loading…
Reference in a new issue