Various fix

This commit is contained in:
IzzelAliz 2020-06-15 19:22:10 +08:00
parent 427548b2b1
commit 64d1d5eab1
187 changed files with 2312 additions and 1177 deletions

View File

@ -79,4 +79,7 @@ mixin {
compileJava {
options.compilerArgs << '-XDignore.symbol.file' << '-XDenableSunApiLintControl'
options.encoding = 'UTF-8'
options.compilerArgs += [
"-AreobfTsrgFiles=${project.file('extra_mapping.tsrg').canonicalPath}"
]
}

View File

@ -0,0 +1,11 @@
net/minecraft/world/IWorld net/minecraft/world/IWorld
addEntity (Lnet/minecraft/entity/Entity;)Z func_217376_c
net/minecraft/world/World net/minecraft/world/World
addEntity (Lnet/minecraft/entity/Entity;)Z func_217376_c
getClosestPlayer (Lnet/minecraft/entity/EntityPredicate;Lnet/minecraft/entity/LivingEntity;)Lnet/minecraft/entity/player/PlayerEntity; func_217370_a
net/minecraft/world/IWorld net/minecraft/world/IWorld
setBlockState (Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z func_180501_a
net/minecraft/entity/monster/MonsterEntity net/minecraft/entity/monster/MonsterEntity
setAttackTarget (Lnet/minecraft/entity/LivingEntity;)V func_70624_b
net/minecraft/entity/passive/WolfEntity net/minecraft/entity/passive/WolfEntity
setHealth (F)V func_70606_j

View File

@ -0,0 +1,10 @@
package io.izzel.arclight.common.bridge.block;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface NoteBlockBridge {
void bridge$play(World worldIn, BlockPos pos, BlockState state);
}

View File

@ -0,0 +1,8 @@
package io.izzel.arclight.common.bridge.entity.monster;
import net.minecraft.entity.LivingEntity;
public interface EndermanEntityBridge {
void bridge$updateTarget(LivingEntity livingEntity);
}

View File

@ -0,0 +1,11 @@
package io.izzel.arclight.common.bridge.item;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.world.World;
public interface BlockItemBridge {
boolean bridge$noCollisionInSel(World world, BlockState state, BlockPos pos, ISelectionContext context);
}

View File

@ -1,5 +1,10 @@
package io.izzel.arclight.common.bridge.network.play;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.nbt.StringNBT;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.server.ServerWorld;
import org.bukkit.Location;
import org.bukkit.event.player.PlayerTeleportEvent;
@ -11,4 +16,14 @@ public interface ServerPlayNetHandlerBridge {
void bridge$disconnect(String str);
void bridge$teleport(Location dest);
boolean bridge$worldNoCollision(ServerWorld world, Entity entity, AxisAlignedBB aabb);
StringNBT bridge$stringNbt(String s);
void bridge$dropItems(ServerPlayerEntity player, boolean all);
boolean bridge$processedDisconnect();
boolean bridge$isDisconnected();
}

View File

@ -0,0 +1,6 @@
package io.izzel.arclight.common.bridge.network.play;
public interface TimestampedPacket {
long bridge$timestamp();
}

View File

@ -18,4 +18,6 @@ public interface MinecraftServerBridge {
// todo
void bridge$queuedProcess(Runnable runnable);
boolean bridge$hasStopped();
}

View File

@ -1,5 +1,10 @@
package io.izzel.arclight.common.bridge.server.management;
import net.minecraft.block.BlockState;
import net.minecraft.network.play.client.CPlayerDiggingPacket;
import net.minecraft.network.play.server.SPlayerDiggingPacket;
import net.minecraft.util.math.BlockPos;
public interface PlayerInteractionManagerBridge {
boolean bridge$isFiredInteract();
@ -9,4 +14,8 @@ public interface PlayerInteractionManagerBridge {
boolean bridge$getInteractResult();
void bridge$setInteractResult(boolean b);
SPlayerDiggingPacket bridge$diggingPacket(BlockPos pos, BlockState state, CPlayerDiggingPacket.Action action, boolean successful, String context);
void bridge$creativeHarvestBlock(BlockPos pos, CPlayerDiggingPacket.Action action, String context);
}

View File

@ -1,6 +1,13 @@
package io.izzel.arclight.common.bridge.server.management;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.play.server.SRespawnPacket;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameType;
import net.minecraft.world.WorldType;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
import org.bukkit.craftbukkit.v.CraftServer;
import java.util.List;
@ -12,4 +19,10 @@ public interface PlayerListBridge {
List<ServerPlayerEntity> bridge$getPlayers();
CraftServer bridge$getCraftServer();
boolean bridge$worldNoCollision(ServerWorld world, Entity entity);
void bridge$setSpawnPoint(ServerPlayerEntity player, BlockPos pos, boolean flag, DimensionType type, boolean flag1);
SRespawnPacket bridge$respawnPacket(DimensionType type, long seed, WorldType worldType, GameType gameType);
}

View File

@ -5,4 +5,6 @@ import net.minecraft.world.dimension.DimensionType;
public interface DimensionTypeBridge {
DimensionType bridge$getType();
void bridge$setType(DimensionType type);
}

View File

@ -1,8 +1,15 @@
package io.izzel.arclight.common.bridge.world.storage;
import net.minecraft.world.World;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import org.bukkit.craftbukkit.v.map.CraftMapView;
import java.util.function.BiFunction;
public interface MapDataBridge {
CraftMapView bridge$getMapView();
DimensionType bridge$dimension(int id, String suffix, String dir, BiFunction<World, DimensionType, ? extends Dimension> provider, boolean skyLight);
}

View File

@ -39,7 +39,7 @@ public abstract class CraftServerMixin {
@Shadow(remap = false) protected abstract void loadCustomPermissions();
@Shadow(remap = false) @Final protected DedicatedServer console;
@Shadow(remap = false) @Final @Mutable private String serverName;
@Accessor(value = "logger", remap = false) public abstract void setLogger(Logger logger);
@Accessor(value = "logger", remap = false) @Mutable public abstract void setLogger(Logger logger);
// @formatter:on
@Inject(method = "<init>", at = @At("RETURN"))

View File

@ -4,11 +4,8 @@ import io.izzel.arclight.common.bridge.entity.EntityBridge;
import net.minecraft.block.AbstractButtonBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.BooleanProperty;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
@ -21,7 +18,6 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.List;
@ -33,23 +29,6 @@ public class AbstractButtonBlockMixin {
@Shadow @Final public static BooleanProperty POWERED;
// @formatter:on
@Inject(method = "onBlockActivated", cancellable = true, at = @At(value = "HEAD"))
public void arclight$blockRedstone1(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit, CallbackInfoReturnable<Boolean> cir) {
if (!state.get(POWERED)) {
boolean powered = state.get(POWERED);
Block block = CraftBlock.at(worldIn, pos);
int old = (powered) ? 15 : 0;
int current = (!powered) ? 15 : 0;
BlockRedstoneEvent event = new BlockRedstoneEvent(block, old, current);
Bukkit.getPluginManager().callEvent(event);
if ((event.getNewCurrent() > 0) == (powered)) {
cir.setReturnValue(true);
}
}
}
@Inject(method = "checkPressed", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;get(Lnet/minecraft/state/IProperty;)Ljava/lang/Comparable;"))
public void arclight$entityInteract(BlockState state, World worldIn, BlockPos pos, CallbackInfo ci,

View File

@ -3,8 +3,6 @@ package io.izzel.arclight.common.mixin.core.block;
import net.minecraft.block.BlockState;
import net.minecraft.block.CampfireBlock;
import net.minecraft.entity.Entity;
import net.minecraft.entity.projectile.AbstractArrowEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
@ -12,15 +10,13 @@ import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(CampfireBlock.class)
public class CampfireBlockMixin {
@Inject(method = "onProjectileCollision", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
public void arclight$onFire(World worldIn, BlockState state, BlockRayTraceResult hit, Entity projectile, CallbackInfo ci, AbstractArrowEntity arrowEntity, BlockPos blockPos) {
if (CraftEventFactory.callBlockIgniteEvent(worldIn, blockPos, arrowEntity).isCancelled()) {
@Inject(method = "onProjectileCollision", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
public void arclight$onFire(World worldIn, BlockState state, BlockRayTraceResult hit, Entity projectile, CallbackInfo ci) {
if (CraftEventFactory.callBlockIgniteEvent(worldIn, hit.getPos(), projectile).isCancelled()) {
ci.cancel();
}
}

View File

@ -1,22 +0,0 @@
package io.izzel.arclight.common.mixin.core.block;
import io.izzel.arclight.common.mod.util.ChestBlockDoubleInventoryHacks;
import net.minecraft.inventory.DoubleSidedInventory;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.tileentity.ChestTileEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(targets = "net/minecraft/block/ChestBlock$2")
public class ChestBlock2Mixin {
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public INamedContainerProvider forDouble(ChestTileEntity p_212855_1_, ChestTileEntity p_212855_2_) {
final DoubleSidedInventory iinventory = new DoubleSidedInventory(p_212855_1_, p_212855_2_);
return ChestBlockDoubleInventoryHacks.create(p_212855_1_, p_212855_2_, iinventory);
}
}

View File

@ -13,7 +13,8 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(ComposterBlock.class)
public class ComposterBlockMixin {
@Redirect(method = "createInventory", at = @At(value = "NEW", target = "net/minecraft/block/ComposterBlock.EmptyInventory"))
@SuppressWarnings("UnresolvedMixinReference")
@Redirect(method = "createInventory", at = @At(value = "NEW", target = "()Lnet/minecraft/block/ComposterBlock$EmptyInventory;"))
public ComposterBlock.EmptyInventory arclight$newEmpty(BlockState blockState, IWorld world, BlockPos blockPos) {
ComposterBlock.EmptyInventory inventory = new ComposterBlock.EmptyInventory();
((IInventoryBridge) inventory).setOwner(new CraftBlockInventoryHolder(world, blockPos, inventory));

View File

@ -9,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.ModifyArg;
@Mixin(JukeboxBlock.class)
public class JukeBoxBlockMixin {
@ModifyArg(method = "insertRecord", index = 1, at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/JukeboxTileEntity;setRecord(Lnet/minecraft/item/ItemStack;)V"))
@ModifyArg(method = "insertRecord", index = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/tileentity/JukeboxTileEntity;setRecord(Lnet/minecraft/item/ItemStack;)V"))
private ItemStack arclight$oneItem(ItemStack stack) {
if (!stack.isEmpty()) {
stack.setCount(1);

View File

@ -1,5 +1,6 @@
package io.izzel.arclight.common.mixin.core.block;
import io.izzel.arclight.common.bridge.block.NoteBlockBridge;
import net.minecraft.block.BlockState;
import net.minecraft.block.NoteBlock;
import net.minecraft.util.math.BlockPos;
@ -14,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(NoteBlock.class)
public abstract class NoteBlockMixin {
public abstract class NoteBlockMixin implements NoteBlockBridge {
// @formatter:off
@Shadow protected abstract void triggerNote(World worldIn, BlockPos pos);
@ -25,11 +26,6 @@ public abstract class NoteBlockMixin {
this.play(worldIn, pos, blockState);
}
@Redirect(method = "onBlockActivated", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/NoteBlock;triggerNote(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V"))
public void arclight$callNote2(NoteBlock noteBlock, World worldIn, BlockPos pos, BlockState blockState) {
this.play(worldIn, pos, blockState);
}
@Redirect(method = "onBlockClicked", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/NoteBlock;triggerNote(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V"))
public void arclight$callNote3(NoteBlock noteBlock, World worldIn, BlockPos pos, BlockState blockState) {
this.play(worldIn, pos, blockState);
@ -43,6 +39,11 @@ public abstract class NoteBlockMixin {
arclight$state = null;
}
@Override
public void bridge$play(World worldIn, BlockPos pos, BlockState state) {
this.play(worldIn, pos, state);
}
@Inject(method = "triggerNote", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addBlockEvent(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;II)V"))
private void arclight$notePlay(World worldIn, BlockPos pos, CallbackInfo ci) {
NotePlayEvent event = CraftEventFactory.callNotePlayEvent(worldIn, pos, arclight$state.get(NoteBlock.INSTRUMENT), arclight$state.get(NoteBlock.NOTE));

View File

@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(TNTBlock.class)
public class TNTBlockMixin {
@Inject(method = "onProjectileCollision", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/TNTBlock;catchFire(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/Direction;Lnet/minecraft/entity/LivingEntity;)V"))
@Inject(method = "onProjectileCollision", cancellable = true, at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/block/TNTBlock;catchFire(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/Direction;Lnet/minecraft/entity/LivingEntity;)V"))
public void arclight$entityChangeBlock(World worldIn, BlockState state, BlockRayTraceResult hit, Entity projectile, CallbackInfo ci) {
if (CraftEventFactory.callEntityChangeBlockEvent(projectile, hit.getPos(), Blocks.AIR.getDefaultState()).isCancelled()) {
ci.cancel();

View File

@ -30,7 +30,6 @@ import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
@ -38,7 +37,6 @@ import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
import org.bukkit.Bukkit;
import org.bukkit.Server;
import org.bukkit.block.BlockFace;
import org.bukkit.command.CommandSender;
import org.bukkit.craftbukkit.v.CraftServer;
import org.bukkit.craftbukkit.v.CraftWorld;
@ -55,7 +53,6 @@ import org.bukkit.event.entity.EntityDropItemEvent;
import org.bukkit.event.entity.EntityPoseChangeEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.bukkit.event.vehicle.VehicleEnterEvent;
import org.bukkit.event.vehicle.VehicleExitEvent;
import org.bukkit.plugin.PluginManager;
@ -114,7 +111,7 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
@Shadow @Nullable public abstract MinecraftServer getServer();
@Shadow public abstract Vec3d getMotion();
@Shadow public abstract EntityType<?> getType();
@Shadow public abstract void remove(boolean keepData);
@Shadow(remap = false) public abstract void remove(boolean keepData);
@Shadow @Final protected Random rand;
@Shadow public abstract float getWidth();
@Shadow public abstract float getHeight();
@ -128,7 +125,7 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
@Shadow public void tick() {}
@Shadow public abstract AxisAlignedBB getBoundingBox();
@Shadow(remap = false) public abstract Collection<ItemEntity> captureDrops();
@Shadow public abstract Collection<ItemEntity> captureDrops(Collection<ItemEntity> value);
@Shadow(remap = false) public abstract Collection<ItemEntity> captureDrops(Collection<ItemEntity> value);
@Shadow public abstract BlockPos getPosition();
@Shadow public boolean onGround;
@Shadow public abstract boolean isInWater();
@ -166,15 +163,8 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
@Shadow public abstract int getEntityId();
@Shadow @Nullable public abstract ITextComponent getCustomName();
@Shadow protected abstract void applyEnchantments(LivingEntity entityLivingBaseIn, Entity entityIn);
@Shadow public abstract float getEyeHeight();
@Shadow @Nullable public abstract Entity changeDimension(DimensionType destination);
@Shadow public abstract boolean isRidingSameEntity(Entity entityIn);
@Shadow public boolean noClip;
@Shadow public abstract double getPosX();
@Shadow public abstract double getPosY();
@Shadow public abstract double getPosZ();
@Shadow(remap = false) public abstract void revive();
@Shadow public abstract Vec3d getPositionVec();
@Shadow public abstract boolean isInvulnerable();
// @formatter:on
@ -391,29 +381,6 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
ArclightCaptures.captureDamageEventBlock(null);
}
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;canTriggerWalking()Z"))
public void arclight$move$VehicleBlockCollisionEvent(MoverType typeIn, Vec3d pos, CallbackInfo ci) {
if (collidedHorizontally && getBukkitEntity() instanceof Vehicle) {
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.block.Block block = ((WorldBridge) this.world).bridge$getWorld().getBlockAt(MathHelper.floor(this.posX), MathHelper.floor(this.posY), MathHelper.floor(this.posZ));
Vec3d vec3d = this.getAllowedMovement(pos);
if (pos.x > vec3d.x) {
block = block.getRelative(BlockFace.EAST);
} else if (vec3d.x < vec3d.x) {
block = block.getRelative(BlockFace.WEST);
} else if (pos.z > vec3d.z) {
block = block.getRelative(BlockFace.SOUTH);
} else if (pos.z < vec3d.z) {
block = block.getRelative(BlockFace.NORTH);
}
if (block.getType() != org.bukkit.Material.AIR) {
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
Bukkit.getPluginManager().callEvent(event);
}
}
}
@Redirect(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;setFire(I)V"))
public void arclight$move$EntityCombustEvent(Entity entity, int seconds) {
EntityCombustEvent event = new EntityCombustByBlockEvent(null, getBukkitEntity(), 8);
@ -543,7 +510,7 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge,
@Inject(method = "entityDropItem(Lnet/minecraft/item/ItemStack;F)Lnet/minecraft/entity/item/ItemEntity;",
cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addEntity(Lnet/minecraft/entity/Entity;)Z"))
public void arclight$entityDropItem$EntityDropItemEvent(ItemStack stack, float offsetY, CallbackInfoReturnable<ItemEntity> cir, ItemEntity itementity) {
public void arclight$entityDropItem(ItemStack stack, float offsetY, CallbackInfoReturnable<ItemEntity> cir, ItemEntity itementity) {
EntityDropItemEvent event = new EntityDropItemEvent(this.getBukkitEntity(), (org.bukkit.entity.Item) ((EntityBridge) itementity).bridge$getBukkitEntity());
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {

View File

@ -87,7 +87,7 @@ public abstract class LivingEntityMixin extends EntityMixin implements LivingEnt
@Shadow public PlayerEntity attackingPlayer;
@Shadow public int deathTime;
@Shadow protected boolean dead;
@Shadow public void remove(boolean keepData) { }
@Shadow(remap = false) public void remove(boolean keepData) { }
@Shadow public abstract IAttributeInstance getAttribute(IAttribute attribute);
@Shadow public boolean potionsNeedUpdate;
@Shadow public abstract boolean removePotionEffect(Effect effectIn);
@ -783,7 +783,7 @@ public abstract class LivingEntityMixin extends EntityMixin implements LivingEnt
}
}
@Redirect(method = "spawnDrops", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/entity/LivingEntity;captureDrops(Ljava/util/Collection;)Ljava/util/Collection;"))
@Redirect(method = "spawnDrops", at = @At(value = "INVOKE", ordinal = 0, remap = false, target = "Lnet/minecraft/entity/LivingEntity;captureDrops(Ljava/util/Collection;)Ljava/util/Collection;"))
private Collection<ItemEntity> arclight$captureIfNeed(LivingEntity livingEntity, Collection<ItemEntity> value) {
Collection<ItemEntity> drops = livingEntity.captureDrops();
// todo this instanceof ArmorStandEntity

View File

@ -20,17 +20,17 @@ public class EatGrassGoalMixin {
private transient BlockPos arclight$pos;
@Inject(method = "tick", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Z"))
@Inject(method = "tick", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", ordinal = 0, remap = false, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Z"))
public void arclight$capturePos1(CallbackInfo ci, BlockPos pos) {
arclight$pos = pos;
}
@Inject(method = "tick", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Z"))
@Inject(method = "tick", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", ordinal = 1, remap = false, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Z"))
public void arclight$capturePos2(CallbackInfo ci, BlockPos pos) {
arclight$pos = pos.down();
}
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Z"))
@Redirect(method = "tick", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraftforge/event/ForgeEventFactory;getMobGriefingEvent(Lnet/minecraft/world/World;Lnet/minecraft/entity/Entity;)Z"))
public boolean arclight$entityChangeBlock(World world, Entity entity) {
boolean b = ForgeEventFactory.getMobGriefingEvent(world, entity);
EntityChangeBlockEvent event = CraftEventFactory.callEntityChangeBlockEvent(entity, arclight$pos, Blocks.AIR.getDefaultState(), !b);

View File

@ -10,7 +10,7 @@ import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.DamageSource;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerPickupXpEvent;
import net.minecraftforge.event.entity.player.PlayerXpEvent;
import org.bukkit.craftbukkit.v.entity.CraftLivingEntity;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.event.entity.EntityTargetEvent;
@ -73,7 +73,7 @@ public abstract class ExperienceOrbEntityMixin extends EntityMixin {
public void onCollideWithPlayer(PlayerEntity entityIn) {
if (!this.world.isRemote) {
if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0) {
if (MinecraftForge.EVENT_BUS.post(new PlayerPickupXpEvent(entityIn, (ExperienceOrbEntity) (Object) this)))
if (MinecraftForge.EVENT_BUS.post(new PlayerXpEvent.PickupXp(entityIn, (ExperienceOrbEntity) (Object) this)))
return;
entityIn.xpCooldown = 2;
entityIn.onItemPickup((ExperienceOrbEntity) (Object) this, 1);

View File

@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.Shadow;
@Mixin(MinecartCommandBlockEntity.MinecartCommandLogic.class)
public abstract class MinecartCommandBlockEntity_MinecartCommandLogicMixin implements ICommandSourceBridge {
@Shadow(aliases = {"this$0", "field_210168_a"}) private MinecartCommandBlockEntity outerThis;
@Shadow(aliases = {"this$0", "field_210168_a"}, remap = false) private MinecartCommandBlockEntity outerThis;
public CommandSender getBukkitSender(CommandSource wrapper) {
return ((EntityBridge) outerThis).bridge$getBukkitEntity();

View File

@ -2,6 +2,7 @@ package io.izzel.arclight.common.mixin.core.entity.merchant.villager;
import io.izzel.arclight.common.bridge.entity.merchant.IMerchantBridge;
import io.izzel.arclight.common.bridge.inventory.IInventoryBridge;
import io.izzel.arclight.common.bridge.item.MerchantOfferBridge;
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.merchant.villager.AbstractVillagerEntity;
@ -22,7 +23,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import io.izzel.arclight.common.bridge.item.MerchantOfferBridge;
@Mixin(AbstractVillagerEntity.class)
public abstract class AbstractVillagerEntityMixin extends CreatureEntityMixin implements IMerchantBridge {
@ -41,7 +41,7 @@ public abstract class AbstractVillagerEntityMixin extends CreatureEntityMixin im
return (craftMerchant == null) ? craftMerchant = new CraftMerchant((AbstractVillagerEntity) (Object) this) : craftMerchant;
}
@Redirect(method = "addTrades", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/MerchantOffers;add(Ljava/lang/Object;)Z"))
@Redirect(method = "addTrades", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/item/MerchantOffers;add(Ljava/lang/Object;)Z"))
private boolean arclight$gainOffer(MerchantOffers merchantOffers, Object e) {
MerchantOffer offer = (MerchantOffer) e;
VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((AbstractVillager) getBukkitEntity(), ((MerchantOfferBridge) offer).bridge$asBukkit());

View File

@ -1,5 +1,6 @@
package io.izzel.arclight.common.mixin.core.entity.merchant.villager;
import io.izzel.arclight.common.bridge.item.MerchantOfferBridge;
import net.minecraft.entity.merchant.villager.WanderingTraderEntity;
import net.minecraft.item.MerchantOffer;
import net.minecraft.item.MerchantOffers;
@ -10,12 +11,11 @@ import org.bukkit.event.entity.VillagerAcquireTradeEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import io.izzel.arclight.common.bridge.item.MerchantOfferBridge;
@Mixin(WanderingTraderEntity.class)
public abstract class WanderingTraderEntityMixin extends AbstractVillagerEntityMixin {
@Redirect(method = "populateTradeData", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/MerchantOffers;add(Ljava/lang/Object;)Z"))
@Redirect(method = "populateTradeData", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/item/MerchantOffers;add(Ljava/lang/Object;)Z"))
private boolean arclight$gainOffer(MerchantOffers merchantOffers, Object e) {
MerchantOffer offer = (MerchantOffer) e;
VillagerAcquireTradeEvent event = new VillagerAcquireTradeEvent((AbstractVillager) getBukkitEntity(), ((MerchantOfferBridge) offer).bridge$asBukkit());

View File

@ -1,36 +1,36 @@
package io.izzel.arclight.common.mixin.core.entity.monster;
import io.izzel.arclight.common.bridge.entity.monster.EndermanEntityBridge;
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.monster.EndermanEntity;
import org.bukkit.event.entity.EntityTargetEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
import org.spongepowered.asm.mixin.Overwrite;
import javax.annotation.Nullable;
@Mixin(EndermanEntity.class)
public abstract class EndermanEntityMixin extends CreatureEntityMixin {
// @formatter:off
@Shadow public abstract void setAttackTarget(@Nullable LivingEntity entitylivingbaseIn);
// @formatter:on
public abstract class EndermanEntityMixin extends CreatureEntityMixin implements EndermanEntityBridge {
@Override
public boolean setGoalTarget(LivingEntity livingEntity, EntityTargetEvent.TargetReason reason, boolean fireEvent) {
if (!super.setGoalTarget(livingEntity, reason, fireEvent)) {
return false;
} else {
setAttackTarget(getAttackTarget());
}
bridge$updateTarget(getAttackTarget());
return true;
}
@Inject(method = "setAttackTarget", cancellable = true, at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/entity/monster/MonsterEntity;setAttackTarget(Lnet/minecraft/entity/LivingEntity;)V"))
private void arclight$muteSuper(LivingEntity entitylivingbaseIn, CallbackInfo ci) {
ci.cancel();
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void setAttackTarget(@Nullable LivingEntity entity) {
if (!super.setGoalTarget(entity, EntityTargetEvent.TargetReason.UNKNOWN, true)) {
return;
}
bridge$updateTarget(getAttackTarget());
}
}

View File

@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net.minecraft.entity.monster.IllusionerEntity.BlindnessSpellGoal")
public class IllusionerEntity_BlindnessSpellGoalMixin {
@Shadow(aliases = {"this$0", "field_210765_a"}) private IllusionerEntity outerThis;
@Shadow(aliases = {"this$0", "field_210765_a"}, remap = false) private IllusionerEntity outerThis;
@Inject(method = "castSpell", at = @At("HEAD"))
private void arclight$reason(CallbackInfo ci) {

View File

@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net.minecraft.entity.monster.IllusionerEntity.MirrorSpellGoal")
public class IllusionerEntity_MirrorSpellGoalMixin {
@Shadow(aliases = {"this$0", "field_210767_a"}) private IllusionerEntity outerThis;
@Shadow(aliases = {"this$0", "field_210767_a"}, remap = false) private IllusionerEntity outerThis;
@Inject(method = "castSpell", at = @At("HEAD"))
private void arclight$reason(CallbackInfo ci) {

View File

@ -12,9 +12,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(targets = "net.minecraft.entity.monster.PhantomEntity.AttackPlayerGoal")
public abstract class PhantomEntity_AttackPlayerGoalMixin {
@Shadow(aliases = {"this$0", "field_203141_a"}) private PhantomEntity outerThis;
@Shadow(aliases = {"this$0", "field_203141_a"}, remap = false) private PhantomEntity outerThis;
@Inject(method = "shouldExecute", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/monster/PhantomEntity$AttackPlayerGoal;setAttackTarget(Lnet/minecraft/entity/LivingEntity;)V"))
@SuppressWarnings("UnresolvedMixinReference")
@Inject(method = "shouldExecute", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/monster/PhantomEntity;func_70624_b(Lnet/minecraft/entity/LivingEntity;)V"))
private void arclight$reason(CallbackInfoReturnable<Boolean> cir) {
((MobEntityBridge) outerThis).bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true);
}

View File

@ -5,6 +5,7 @@ import net.minecraft.block.SilverfishBlock;
import net.minecraft.entity.CreatureEntity;
import net.minecraft.entity.ai.goal.RandomWalkingGoal;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@ -12,8 +13,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.Random;
@Mixin(targets = "net.minecraft.entity.monster.SilverfishEntity.HideInStoneGoal")
public abstract class SilverfishEntity_HideInStoneGoalMixin extends RandomWalkingGoal {
@ -22,7 +21,7 @@ public abstract class SilverfishEntity_HideInStoneGoalMixin extends RandomWalkin
}
@Inject(method = "startExecuting", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/IWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
private void arclight$entityChangeBlock(CallbackInfo ci, Random random, BlockPos blockPos, BlockState blockState) {
private void arclight$entityChangeBlock(CallbackInfo ci, IWorld world, BlockPos blockPos, BlockState blockState) {
if (CraftEventFactory.callEntityChangeBlockEvent(this.creature, blockPos, SilverfishBlock.infest(blockState.getBlock())).isCancelled()) {
ci.cancel();
}

View File

@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net.minecraft.entity.monster.VexEntity.CopyOwnerTargetGoal")
public abstract class VexEntity_CopyOwnerTargetGoalMixin {
@Shadow(aliases = {"this$0", "field_190883_a"}) private VexEntity outerThis;
@Shadow(aliases = {"this$0", "field_190883_a"}, remap = false) private VexEntity outerThis;
@Inject(method = "startExecuting", at = @At("HEAD"))
private void arclight$reason(CallbackInfo ci) {

View File

@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(FoxEntity.EatBerriesGoal.class)
public abstract class FoxEntity_EatBerriesGoalMixin extends MoveToBlockGoal {
@Shadow(aliases = {"this$0", "field_220732_h"}) private FoxEntity outerThis;
@Shadow(aliases = {"this$0", "field_220732_h"}, remap = false) private FoxEntity outerThis;
public FoxEntity_EatBerriesGoalMixin(CreatureEntity creature, double speedIn, int length) {
super(creature, speedIn, length);

View File

@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(targets = "net.minecraft.entity.passive.FoxEntity.RevengeGoal")
public class FoxEntity_RevengeGoalMixin {
@Shadow(aliases = {"this$0", "field_220785_i"}) private FoxEntity outerThis;
@Shadow(aliases = {"this$0", "field_220785_i"}, remap = false) private FoxEntity outerThis;
@Inject(method = "startExecuting", at = @At("HEAD"))
private void arclight$reason(CallbackInfo ci) {

View File

@ -25,7 +25,7 @@ public abstract class MooshroomEntityMixin extends AnimalEntityMixin {
private void arclight$animalTransformPre(MooshroomEntity mooshroomEntity) {
}
@Inject(method = "onSheared", remap = false, cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addEntity(Lnet/minecraft/entity/Entity;)Z"))
@Inject(method = "onSheared", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addEntity(Lnet/minecraft/entity/Entity;)Z"))
private void arclight$animalTransform(ItemStack item, IWorld world, BlockPos pos, int fortune, CallbackInfoReturnable<List<ItemStack>> cir, List<ItemStack> stackList, CowEntity cowEntity) {
if (CraftEventFactory.callEntityTransformEvent((MooshroomEntity) (Object) this, cowEntity, EntityTransformEvent.TransformReason.SHEARED).isCancelled()) {
cir.setReturnValue(stackList);

View File

@ -53,9 +53,11 @@ public abstract class WolfEntityMixin extends TameableEntityMixin {
private void arclight$handledBy(SitGoal sitGoal, boolean sitting) {
}
@Redirect(method = "setTamed", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;setHealth(F)V"))
private void arclight$healToMax(WolfEntity wolfEntity, float health) {
wolfEntity.setHealth(wolfEntity.getMaxHealth());
@Inject(method = "setTamed", at = @At("RETURN"))
private void arclight$healToMax(boolean tamed, CallbackInfo ci) {
if (tamed) {
this.setHealth(this.getMaxHealth());
}
}
@Inject(method = "processInteract", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/passive/WolfEntity;heal(F)V"))

View File

@ -1,6 +1,7 @@
package io.izzel.arclight.common.mixin.core.inventory;
import io.izzel.arclight.common.bridge.entity.player.PlayerEntityBridge;
import io.izzel.arclight.common.bridge.inventory.CraftingInventoryBridge;
import io.izzel.arclight.common.bridge.inventory.IInventoryBridge;
import io.izzel.arclight.common.bridge.inventory.container.WorkbenchContainerBridge;
import io.izzel.arclight.common.bridge.util.IWorldPosCallableBridge;
@ -20,7 +21,6 @@ import org.bukkit.inventory.InventoryHolder;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import io.izzel.arclight.common.bridge.inventory.CraftingInventoryBridge;
import java.util.ArrayList;
import java.util.List;
@ -30,7 +30,7 @@ public abstract class CraftingInventoryMixin implements CraftingInventoryBridge,
// @formatter:off
@Shadow @Final private NonNullList<ItemStack> stackList;
@Shadow @Final public Container field_70465_c;
@Shadow @Final public Container eventHandler;
// @formatter:on
public List<HumanEntity> transaction = new ArrayList<>();
@ -110,8 +110,8 @@ public abstract class CraftingInventoryMixin implements CraftingInventoryBridge,
@Override
public Location getLocation() {
return this.field_70465_c instanceof WorkbenchContainer
? ((IWorldPosCallableBridge) ((WorkbenchContainerBridge) field_70465_c).bridge$getContainerAccess()).bridge$getLocation()
return this.eventHandler instanceof WorkbenchContainer
? ((IWorldPosCallableBridge) ((WorkbenchContainerBridge) eventHandler).bridge$getContainerAccess()).bridge$getLocation()
: ((PlayerEntityBridge) owner).bridge$getBukkitEntity().getLocation();
}

View File

@ -19,8 +19,8 @@ import java.util.List;
@Mixin(DoubleSidedInventory.class)
public abstract class DoubleSidedInventoryMixin implements IInventoryBridge, IInventory {
@Shadow @Final public IInventory field_70477_b;
@Shadow @Final public IInventory field_70478_c;
@Shadow @Final public IInventory upperChest;
@Shadow @Final public IInventory lowerChest;
private List<HumanEntity> transactions = new ArrayList<>();
@Override
@ -35,15 +35,15 @@ public abstract class DoubleSidedInventoryMixin implements IInventoryBridge, IIn
@Override
public void onOpen(CraftHumanEntity who) {
((IInventoryBridge) this.field_70477_b).onOpen(who);
((IInventoryBridge) this.field_70478_c).onOpen(who);
((IInventoryBridge) this.upperChest).onOpen(who);
((IInventoryBridge) this.lowerChest).onOpen(who);
this.transactions.add(who);
}
@Override
public void onClose(CraftHumanEntity who) {
((IInventoryBridge) this.field_70477_b).onClose(who);
((IInventoryBridge) this.field_70478_c).onClose(who);
((IInventoryBridge) this.upperChest).onClose(who);
((IInventoryBridge) this.lowerChest).onClose(who);
this.transactions.remove(who);
}
@ -60,18 +60,18 @@ public abstract class DoubleSidedInventoryMixin implements IInventoryBridge, IIn
@Override
public int getInventoryStackLimit() {
return Math.min(this.field_70477_b.getInventoryStackLimit(), this.field_70478_c.getInventoryStackLimit());
return Math.min(this.upperChest.getInventoryStackLimit(), this.lowerChest.getInventoryStackLimit());
}
@Override
public void setMaxStackSize(int size) {
((IInventoryBridge) this.field_70477_b).setMaxStackSize(size);
((IInventoryBridge) this.field_70478_c).setMaxStackSize(size);
((IInventoryBridge) this.upperChest).setMaxStackSize(size);
((IInventoryBridge) this.lowerChest).setMaxStackSize(size);
}
@Override
public Location getLocation() {
return ((IInventoryBridge) this.field_70477_b).getLocation();
return ((IInventoryBridge) this.upperChest).getLocation();
}
@Override

View File

@ -55,7 +55,7 @@ public abstract class EnchantmentContainerMixin extends ContainerMixin implement
// @formatter:off
@Shadow @Final private IInventory tableInventory;
@Shadow @Final private IWorldPosCallable worldPosCallable;
@Shadow protected abstract float getPower(World world, BlockPos pos);
@Shadow(remap = false) protected abstract float getPower(World world, BlockPos pos);
@Shadow @Final private Random rand;
@Shadow @Final private IntReferenceHolder xpSeed;
@Shadow @Final public int[] enchantLevels;

View File

@ -1,6 +1,7 @@
package io.izzel.arclight.common.mixin.core.item;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.item.BlockItemBridge;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
@ -20,7 +21,7 @@ import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(BlockItem.class)
public abstract class BlockItemMixin {
public abstract class BlockItemMixin implements BlockItemBridge {
// @formatter:off
@Shadow protected abstract boolean checkPosition();
@ -47,7 +48,7 @@ public abstract class BlockItemMixin {
protected boolean canPlace(BlockItemUseContext context, BlockState state) {
PlayerEntity playerentity = context.getPlayer();
ISelectionContext iselectioncontext = playerentity == null ? ISelectionContext.dummy() : ISelectionContext.forEntity(playerentity);
boolean original = (!this.checkPosition() || state.isValidPosition(context.getWorld(), context.getPos())) && context.getWorld().func_217350_a(state, context.getPos(), iselectioncontext);
boolean original = (!this.checkPosition() || state.isValidPosition(context.getWorld(), context.getPos())) && this.bridge$noCollisionInSel(context.getWorld(), state, context.getPos(), iselectioncontext);
Player player = (context.getPlayer() instanceof ServerPlayerEntityBridge) ? ((ServerPlayerEntityBridge) context.getPlayer()).bridge$getBukkitEntity() : null;
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(context.getWorld(), context.getPos()), player, CraftBlockData.fromData(state), original);

View File

@ -33,7 +33,7 @@ public abstract class BowItemMixin extends ShootableItem {
// @formatter:off
@Shadow public abstract int getUseDuration(ItemStack stack);
@Shadow public static float getArrowVelocity(int charge) { return 0; }
@Shadow public abstract AbstractArrowEntity customeArrow(AbstractArrowEntity arrow);
@Shadow(remap = false) public abstract AbstractArrowEntity customeArrow(AbstractArrowEntity arrow);
// @formatter:on
/**

View File

@ -7,13 +7,13 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.server.SChangeBlockPacket;
import net.minecraft.util.ActionResult;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
@ -54,7 +54,7 @@ public abstract class BucketItemMixin {
}
}
@Inject(method = "onItemRightClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/BucketItem;tryPlaceContainedLiquid(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockRayTraceResult;)Z"))
@Inject(method = "onItemRightClick", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/item/BucketItem;tryPlaceContainedLiquid(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockRayTraceResult;)Z"))
private void arclight$capture(World worldIn, PlayerEntity playerIn, Hand handIn, CallbackInfoReturnable<ActionResult<ItemStack>> cir, ItemStack stack, RayTraceResult result) {
BlockRayTraceResult blockRayTraceResult = (BlockRayTraceResult) result;
arclight$direction = blockRayTraceResult.getFace();
@ -73,7 +73,7 @@ public abstract class BucketItemMixin {
private transient org.bukkit.inventory.@Nullable ItemStack arclight$captureItem;
@Redirect(method = "fillBucket", at = @At(value = "NEW", target = "net/minecraft/item/ItemStack"))
private ItemStack arclight$useCapture(Item fillBucket) {
private ItemStack arclight$useCapture(IItemProvider fillBucket) {
return arclight$captureItem == null ? new ItemStack(fillBucket) : CraftItemStack.asNMSCopy(arclight$captureItem);
}

View File

@ -45,7 +45,7 @@ public abstract class ItemStackMixin implements ItemStackBridge {
this.convertStack(version);
}
@ModifyVariable(method = "attemptDamageItem", index = 0, name = "amount", at = @At(value = "JUMP", opcode = Opcodes.IFGT, ordinal = 0))
@ModifyVariable(method = "attemptDamageItem", index = 1, name = "amount", at = @At(value = "JUMP", opcode = Opcodes.IFGT, ordinal = 0))
private int arclight$itemDamage(int i, int amount, Random rand, ServerPlayerEntity damager) {
if (damager != null) {
PlayerItemDamageEvent event = new PlayerItemDamageEvent(((ServerPlayerEntityBridge) damager).bridge$getBukkitEntity(), CraftItemStack.asCraftMirror((ItemStack) (Object) this), i);

View File

@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(MilkBucketItem.class)
public class MilkBucketItemMixin {
@Inject(method = "onItemUseFinish", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/LivingEntity;curePotionEffects(Lnet/minecraft/item/ItemStack;)Z"))
@Inject(method = "onItemUseFinish", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/entity/LivingEntity;curePotionEffects(Lnet/minecraft/item/ItemStack;)Z"))
public void arclight$cureReason(ItemStack stack, World worldIn, LivingEntity entityLiving, CallbackInfoReturnable<ItemStack> cir) {
((LivingEntityBridge) entityLiving).bridge$pushEffectCause(EntityPotionEffectEvent.Cause.MILK);
}

View File

@ -17,7 +17,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(ShearsItem.class)
public class ShearsItemMixin {
@Inject(method = "itemInteractionForEntity", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraftforge/common/IShearable;isShearable(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/IWorldReader;Lnet/minecraft/util/math/BlockPos;)Z"))
@Inject(method = "itemInteractionForEntity", cancellable = true, at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraftforge/common/IShearable;isShearable(Lnet/minecraft/item/ItemStack;Lnet/minecraft/world/IWorldReader;Lnet/minecraft/util/math/BlockPos;)Z"))
private void arclight$onShear(ItemStack stack, PlayerEntity playerIn, LivingEntity entity, Hand hand, CallbackInfoReturnable<Boolean> cir) {
if (playerIn instanceof ServerPlayerEntityBridge) {
PlayerShearEntityEvent event = new PlayerShearEntityEvent(((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity(), ((EntityBridge) entity).bridge$getBukkitEntity());

View File

@ -0,0 +1,47 @@
package io.izzel.arclight.common.mixin.core.network;
import io.izzel.arclight.common.bridge.network.play.ServerPlayNetHandlerBridge;
import io.izzel.arclight.common.bridge.server.MinecraftServerBridge;
import net.minecraft.network.INetHandler;
import net.minecraft.network.IPacket;
import net.minecraft.network.PacketThreadUtil;
import net.minecraft.network.ThreadQuickExitException;
import net.minecraft.network.play.ServerPlayNetHandler;
import net.minecraft.util.concurrent.ThreadTaskExecutor;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v.CraftServer;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(PacketThreadUtil.class)
public class PacketThreadUtilMixin {
@Shadow @Final private static Logger LOGGER;
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public static <T extends INetHandler> void checkThreadAndEnqueue(IPacket<T> packetIn, T processor, ThreadTaskExecutor<?> executor) throws ThreadQuickExitException {
if (!executor.isOnExecutionThread()) {
executor.execute(() -> {
if (((MinecraftServerBridge) ((CraftServer) Bukkit.getServer()).getServer()).bridge$hasStopped() || (processor instanceof ServerPlayNetHandler && ((ServerPlayNetHandlerBridge) processor).bridge$processedDisconnect())) {
return;
}
if (processor.getNetworkManager().isChannelOpen()) {
packetIn.processPacket(processor);
} else {
LOGGER.debug("Ignoring packet due to disconnection: " + packetIn);
}
});
throw ThreadQuickExitException.INSTANCE;
} else if (((MinecraftServerBridge) ((CraftServer) Bukkit.getServer()).getServer()).bridge$hasStopped() || (processor instanceof ServerPlayNetHandler && ((ServerPlayNetHandlerBridge) processor).bridge$processedDisconnect())) {
throw ThreadQuickExitException.INSTANCE;
}
}
}

View File

@ -1,12 +1,17 @@
package io.izzel.arclight.common.mixin.core.network.play;
import com.google.common.base.Charsets;
import com.google.common.collect.ImmutableSet;
import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.inventory.container.ContainerBridge;
import io.izzel.arclight.common.bridge.network.play.ServerPlayNetHandlerBridge;
import io.izzel.arclight.common.bridge.network.play.TimestampedPacket;
import io.izzel.arclight.common.bridge.server.MinecraftServerBridge;
import io.izzel.arclight.common.bridge.server.management.PlayerInteractionManagerBridge;
import io.izzel.arclight.common.bridge.tileentity.SignTileEntityBridge;
import io.izzel.arclight.common.mod.ArclightConstants;
import io.izzel.arclight.common.mod.util.ArclightCaptures;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import it.unimi.dsi.fastutil.ints.Int2ShortMap;
@ -33,7 +38,6 @@ import net.minecraft.item.Items;
import net.minecraft.item.WritableBookItem;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.nbt.StringNBT;
import net.minecraft.network.IPacket;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.PacketThreadUtil;
@ -55,6 +59,7 @@ import net.minecraft.server.MinecraftServer;
import net.minecraft.server.management.PlayerList;
import net.minecraft.tileentity.SignTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
@ -118,6 +123,7 @@ import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.Recipe;
import org.bukkit.util.Vector;
import org.spigotmc.SpigotConfig;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@ -127,9 +133,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import io.izzel.arclight.common.bridge.tileentity.SignTileEntityBridge;
import io.izzel.arclight.common.mod.ArclightConstants;
import io.izzel.arclight.common.mod.util.ArclightCaptures;
import java.util.Collections;
import java.util.Objects;
@ -141,7 +144,7 @@ import java.util.logging.Level;
public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerBridge {
// @formatter:off
@Shadow(aliases = {"server", "field_147367_d"}) @Final private MinecraftServer minecraftServer;
@Shadow(aliases = {"server", "field_147367_d"}, remap = false) @Final private MinecraftServer minecraftServer;
@Shadow public ServerPlayerEntity player;
@Shadow @Final public NetworkManager netManager;
@Shadow public abstract void onDisconnect(ITextComponent reason);
@ -167,7 +170,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
@Shadow private double firstGoodY;
@Shadow private double firstGoodZ;
@Shadow @Final private static Logger LOGGER;
@Shadow protected abstract boolean func_223133_a(IWorldReader p_223133_1_);
@Shadow protected abstract boolean isPlayerNotInBlock(IWorldReader p_223133_1_);
@Shadow private double lastGoodX;
@Shadow private double lastGoodY;
@Shadow private double lastGoodZ;
@ -175,10 +178,10 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
@Shadow private int teleportId;
@Shadow public abstract void sendPacket(IPacket<?> packetIn);
@Shadow private int chatSpamThresholdCount;
// @formatter:on
@Shadow @Final private Int2ShortMap pendingTransactions;
@Shadow private int itemDropThreshold;
// @formatter:on
private static final int SURVIVAL_PLACE_DISTANCE_SQUARED = 6 * 6;
private static final int CREATIVE_PLACE_DISTANCE_SQUARED = 7 * 7;
private CraftServer server;
@ -201,6 +204,11 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
return (this.player == null) ? null : ((ServerPlayerEntityBridge) this.player).bridge$getBukkitEntity();
}
@Override
public boolean bridge$processedDisconnect() {
return this.processedDisconnect;
}
@Inject(method = "<init>", at = @At("RETURN"))
private void arclight$init(MinecraftServer server, NetworkManager networkManagerIn, ServerPlayerEntity playerIn, CallbackInfo ci) {
this.server = ((CraftServer) Bukkit.getServer());
@ -220,7 +228,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void disconnect(ITextComponent textComponent) {
this.disconnect(CraftChatMessage.fromComponent(textComponent, TextFormatting.WHITE));
this.disconnect(CraftChatMessage.fromComponent(textComponent));
}
public void disconnect(String s) {
@ -254,13 +262,13 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processVehicleMove(final CMoveVehiclePacket packetplayinvehiclemove) {
PacketThreadUtil.func_218796_a(packetplayinvehiclemove, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packetplayinvehiclemove, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (isMoveVehiclePacketInvalid(packetplayinvehiclemove)) {
this.disconnect(new TranslationTextComponent("multiplayer.disconnect.invalid_vehicle_movement"));
} else {
Entity entity = this.player.getLowestRidingEntity();
if (entity != this.player && entity.getControllingPassenger() == this.player && entity == this.lowestRiddenEnt) {
ServerWorld worldserver = this.player.func_71121_q();
ServerWorld worldserver = this.player.getServerWorld();
double d0 = entity.posX;
double d2 = entity.posY;
double d3 = entity.posZ;
@ -300,7 +308,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
this.netManager.sendPacket(new SMoveVehiclePacket(entity));
return;
}
boolean flag = worldserver.isCollisionBoxesEmpty(entity, entity.getBoundingBox().shrink(0.0625));
boolean flag = this.bridge$worldNoCollision(worldserver, entity, entity.getBoundingBox().shrink(0.0625));
d7 = d4 - this.lowestRiddenX1;
d8 = d5 - this.lowestRiddenY1 - 1.0E-6;
d9 = d6 - this.lowestRiddenZ1;
@ -320,7 +328,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
entity.setPositionAndRotation(d4, d5, d6, f, f2);
this.player.setPositionAndRotation(d4, d5, d6, this.player.rotationYaw, this.player.rotationPitch);
boolean flag3 = worldserver.isCollisionBoxesEmpty(entity, entity.getBoundingBox().shrink(0.0625));
boolean flag3 = this.bridge$worldNoCollision(worldserver, entity, entity.getBoundingBox().shrink(0.0625));
if (flag && (flag2 || !flag3)) {
entity.setPositionAndRotation(d0, d2, d3, f, f2);
this.player.setPositionAndRotation(d0, d2, d3, this.player.rotationYaw, this.player.rotationPitch);
@ -361,7 +369,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
}
}
this.player.func_71121_q().getChunkProvider().updatePlayerPosition(this.player);
this.player.getServerWorld().getChunkProvider().updatePlayerPosition(this.player);
this.player.addMovementStat(this.player.posX - d0, this.player.posY - d2, this.player.posZ - d3);
this.vehicleFloating = (d12 >= -0.03125 && !this.minecraftServer.isFlightAllowed() && !worldserver.checkBlockCollision(entity.getBoundingBox().grow(0.0625).expand(0.0, -0.55, 0.0)));
this.lowestRiddenX1 = entity.posX;
@ -373,7 +381,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
@Inject(method = "processConfirmTeleport", at = @At(value = "FIELD", ordinal = 6, shift = At.Shift.AFTER, target = "Lnet/minecraft/network/play/ServerPlayNetHandler;targetPos:Lnet/minecraft/util/math/Vec3d;"))
private void arclight$updateLoc(CConfirmTeleportPacket packetIn, CallbackInfo ci) {
this.player.func_71121_q().getChunkProvider().updatePlayerPosition(this.player);
this.player.getServerWorld().getChunkProvider().updatePlayerPosition(this.player);
}
@Inject(method = "processConfirmTeleport", at = @At(value = "FIELD", target = "Lnet/minecraft/network/play/ServerPlayNetHandler;teleportId:I"))
@ -394,7 +402,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processEditBook(CEditBookPacket packetplayinbedit) {
PacketThreadUtil.func_218796_a(packetplayinbedit, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packetplayinbedit, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (lastBookTick == 0) lastBookTick = ArclightConstants.currentTick;
if (this.lastBookTick + 20 > ArclightConstants.currentTick) {
this.disconnect("Book edited too quickly!");
@ -412,14 +420,14 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
if (nbttagcompound != null) {
itemstack3.setTag(nbttagcompound.copy());
}
itemstack3.setTagInfo("author", new StringNBT(this.player.getName().getString()));
itemstack3.setTagInfo("title", new StringNBT(itemstack.getTag().getString("title")));
itemstack3.setTagInfo("author", this.bridge$stringNbt(this.player.getName().getString()));
itemstack3.setTagInfo("title", this.bridge$stringNbt(itemstack.getTag().getString("title")));
ListNBT nbttaglist = itemstack.getTag().getList("pages", 8);
for (int i = 0; i < nbttaglist.size(); ++i) {
String s = nbttaglist.getString(i);
StringTextComponent chatcomponenttext = new StringTextComponent(s);
s = ITextComponent.Serializer.toJson(chatcomponenttext);
nbttaglist.set(i, new StringNBT(s));
nbttaglist.set(i, this.bridge$stringNbt(s));
}
itemstack3.setTagInfo("pages", nbttaglist);
this.player.setHeldItem(packetplayinbedit.getHand(), CraftEventFactory.handleEditBookEvent(this.player, enumitemslot, itemstack2, itemstack3));
@ -438,11 +446,11 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processPlayer(final CPlayerPacket packetplayinflying) {
PacketThreadUtil.func_218796_a(packetplayinflying, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packetplayinflying, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (isMovePlayerPacketInvalid(packetplayinflying)) {
this.disconnect(new TranslationTextComponent("multiplayer.disconnect.invalid_player_movement", new Object[0]));
this.disconnect(new TranslationTextComponent("multiplayer.disconnect.invalid_player_movement"));
} else {
final ServerWorld worldserver = this.minecraftServer.func_71218_a(this.player.dimension);
final ServerWorld worldserver = this.minecraftServer.getWorld(this.player.dimension);
if (!this.player.queuedEndExit && !((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
if (this.networkTickCount == 0) {
this.captureCurrentPosition();
@ -457,7 +465,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
this.lastPositionUpdate = this.networkTickCount;
if (this.player.isPassenger()) {
this.player.setPositionAndRotation(this.player.posX, this.player.posY, this.player.posZ, packetplayinflying.getYaw(this.player.rotationYaw), packetplayinflying.getPitch(this.player.rotationPitch));
this.player.func_71121_q().getChunkProvider().updatePlayerPosition(this.player);
this.player.getServerWorld().getChunkProvider().updatePlayerPosition(this.player);
this.allowedPlayerTicks = 20;
} else {
final double prevX = this.player.posX;
@ -504,7 +512,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
} else {
speed = this.player.abilities.walkSpeed * 10.0f;
}
if (!this.player.isInvulnerableDimensionChange() && (!this.player.func_71121_q().getGameRules().getBoolean(GameRules.DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isElytraFlying())) {
if (!this.player.isInvulnerableDimensionChange() && (!this.player.getServerWorld().getGameRules().getBoolean(GameRules.DISABLE_ELYTRA_MOVEMENT_CHECK) || !this.player.isElytraFlying())) {
final float f3 = this.player.isElytraFlying() ? 300.0f : 100.0f;
if (d12 - d11 > Math.max(f3, Math.pow(10.0f * i * speed, 2.0)) && !this.func_217264_d()) {
LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d8, d9, d10);
@ -512,10 +520,15 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
return;
}
}
final boolean flag = this.func_223133_a(worldserver);
final boolean flag = this.isPlayerNotInBlock(worldserver);
d8 = d5 - this.lastGoodX;
d9 = d6 - this.lastGoodY;
d10 = d7 - this.lastGoodZ;
if (d9 > 0.0D) {
this.player.fallDistance = 0.0F;
}
if (this.player.onGround && !packetplayinflying.isOnGround() && d9 > 0.0) {
this.player.jump();
}
@ -537,7 +550,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
this.player.setPositionAndRotation(d5, d6, d7, f, f2);
this.player.addMovementStat(this.player.posX - d0, this.player.posY - d2, this.player.posZ - d3);
if (!this.player.noClip && !this.player.isSleeping()) {
final boolean flag3 = this.func_223133_a(worldserver);
final boolean flag3 = this.isPlayerNotInBlock(worldserver);
if (flag && (flag2 || !flag3)) {
this.setPlayerLocation(d0, d2, d3, f, f2);
return;
@ -583,9 +596,12 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
}
this.player.setPositionAndRotation(d5, d6, d7, f, f2);
this.floating = (d13 >= -0.03125 && this.player.interactionManager.getGameType() != GameType.SPECTATOR && !this.minecraftServer.isFlightAllowed() && !this.player.abilities.allowFlying && !this.player.isPotionActive(Effects.LEVITATION) && !this.player.isElytraFlying() && !worldserver.checkBlockCollision(this.player.getBoundingBox().grow(0.0625).expand(0.0, -0.55, 0.0)));
// this.floating = (d13 >= -0.03125 && this.player.interactionManager.getGameType() != GameType.SPECTATOR && !this.minecraftServer.isFlightAllowed() && !this.player.abilities.allowFlying && !this.player.isPotionActive(Effects.LEVITATION) && !this.player.isElytraFlying() && !worldserver.checkBlockCollision(this.player.getBoundingBox().grow(0.0625).expand(0.0, -0.55, 0.0)));
this.floating = (d13 >= -0.03125 && this.player.interactionManager.getGameType() != GameType.SPECTATOR && !this.minecraftServer.isFlightAllowed() && !this.player.abilities.allowFlying && !this.player.isPotionActive(Effects.LEVITATION) && !this.player.isElytraFlying() && !worldserver.checkBlockCollision(this.player.getBoundingBox().grow(0.0625).expand(0.0, -0.55, 0.0)) && !this.player.isSpinAttacking());
this.player.onGround = packetplayinflying.isOnGround();
this.player.func_71121_q().getChunkProvider().updatePlayerPosition(this.player);
this.player.getServerWorld().getChunkProvider().updatePlayerPosition(this.player);
this.player.handleFalling(this.player.posY - d4, packetplayinflying.isOnGround());
this.lastGoodX = this.player.posX;
this.lastGoodY = this.player.posY;
@ -627,7 +643,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processPlayerDigging(CPlayerDiggingPacket packetplayinblockdig) {
PacketThreadUtil.func_218796_a(packetplayinblockdig, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packetplayinblockdig, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
return;
}
@ -671,13 +687,13 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
return;
}
}
this.player.dropItem(false);
this.bridge$dropItems(this.player, false);
}
return;
}
case DROP_ALL_ITEMS: {
if (!this.player.isSpectator()) {
this.player.dropItem(true);
this.bridge$dropItems(this.player, true);
}
return;
}
@ -697,11 +713,14 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
}
@Inject(method = "processTryUseItemOnBlock", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;func_71218_a(Lnet/minecraft/world/dimension/DimensionType;)Lnet/minecraft/world/server/ServerWorld;"))
@Inject(method = "processTryUseItemOnBlock", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/MinecraftServer;getWorld(Lnet/minecraft/world/dimension/DimensionType;)Lnet/minecraft/world/server/ServerWorld;"))
private void arclight$frozenUseItem(CPlayerTryUseItemOnBlockPacket packetIn, CallbackInfo ci) {
if (((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
ci.cancel();
}
if (!this.checkLimit(((TimestampedPacket) packetIn).bridge$timestamp())) {
ci.cancel();
}
}
@Inject(method = "processTryUseItemOnBlock", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/server/management/PlayerInteractionManager;func_219441_a(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/world/World;Lnet/minecraft/item/ItemStack;Lnet/minecraft/util/Hand;Lnet/minecraft/util/math/BlockRayTraceResult;)Lnet/minecraft/util/ActionResultType;"))
@ -709,18 +728,38 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
this.player.stopActiveHand();
}
private int limitedPackets;
private long lastLimitedPacket = -1;
private boolean checkLimit(long timestamp) {
if (lastLimitedPacket != -1 && timestamp - lastLimitedPacket < 30 && limitedPackets++ >= 4) {
return false;
}
if (lastLimitedPacket == -1 || timestamp - lastLimitedPacket >= 30) {
lastLimitedPacket = timestamp;
limitedPackets = 0;
return true;
}
return true;
}
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void processTryUseItem(CPlayerTryUseItemPacket packetplayinblockplace) {
PacketThreadUtil.func_218796_a(packetplayinblockplace, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
public void processTryUseItem(CPlayerTryUseItemPacket packet) {
PacketThreadUtil.checkThreadAndEnqueue(packet, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
return;
}
ServerWorld worldserver = this.minecraftServer.func_71218_a(this.player.dimension);
Hand enumhand = packetplayinblockplace.getHand();
if (!this.checkLimit(((TimestampedPacket) packet).bridge$timestamp())) {
return;
}
ServerWorld worldserver = this.minecraftServer.getWorld(this.player.dimension);
Hand enumhand = packet.getHand();
ItemStack itemstack = this.player.getHeldItem(enumhand);
this.player.markPlayerActive();
if (!itemstack.isEmpty()) {
@ -759,18 +798,14 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
}
@Inject(method = "handleSpectate", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/ServerPlayerEntity;func_200619_a(Lnet/minecraft/world/server/ServerWorld;DDDFF)V"))
@Inject(method = "handleSpectate", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/ServerPlayerEntity;teleport(Lnet/minecraft/world/server/ServerWorld;DDDFF)V"))
private void arclight$spectateTeleport(CSpectatePacket packetIn, CallbackInfo ci) {
((ServerPlayerEntityBridge) this.player).bridge$pushChangeDimensionCause(PlayerTeleportEvent.TeleportCause.SPECTATE);
}
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public void handleResourcePackStatus(CResourcePackStatusPacket packetIn) {
PacketThreadUtil.func_218796_a(packetIn, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
@Inject(method = "handleResourcePackStatus", at = @At("HEAD"))
private void arclight$handleResourcePackStatus(CResourcePackStatusPacket packetIn, CallbackInfo ci) {
PacketThreadUtil.checkThreadAndEnqueue(packetIn, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
this.server.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getPlayer(), PlayerResourcePackStatusEvent.Status.values()[packetIn.action.ordinal()]));
}
@ -794,7 +829,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processHeldItemChange(CHeldItemChangePacket packet) {
PacketThreadUtil.func_218796_a(packet, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packet, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
return;
}
@ -825,10 +860,10 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
boolean isSync = packet.getMessage().startsWith("/");
if (packet.getMessage().startsWith("/")) {
PacketThreadUtil.func_218796_a(packet, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packet, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
}
if (this.player.removed || this.player.getChatVisibility() == ChatVisibility.HIDDEN) {
this.sendPacket(new SChatPacket(new TranslationTextComponent("chat.cannotSend", new Object[0]).applyTextStyle(TextFormatting.RED)));
this.sendPacket(new SChatPacket(new TranslationTextComponent("chat.cannotSend").applyTextStyle(TextFormatting.RED)));
} else {
this.player.markPlayerActive();
String s = packet.getMessage();
@ -840,7 +875,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
@Override
protected Object evaluate() {
disconnect(new TranslationTextComponent("multiplayer.disconnect.illegal_characters", new Object[0]));
disconnect(new TranslationTextComponent("multiplayer.disconnect.illegal_characters"));
return null;
}
}
@ -856,7 +891,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
throw new RuntimeException(e);
}
}
this.disconnect(new TranslationTextComponent("multiplayer.disconnect.illegal_characters", new Object[0]));
this.disconnect(new TranslationTextComponent("multiplayer.disconnect.illegal_characters"));
return;
}
}
@ -874,7 +909,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
String conversationInput = s;
((MinecraftServerBridge) this.minecraftServer).bridge$queuedProcess(() -> this.getPlayer().acceptConversationInput(conversationInput));
} else if (this.player.getChatVisibility() == ChatVisibility.SYSTEM) {
TranslationTextComponent chatmessage = new TranslationTextComponent("chat.cannotSend", new Object[0]);
TranslationTextComponent chatmessage = new TranslationTextComponent("chat.cannotSend");
chatmessage.getStyle().setColor(TextFormatting.RED);
this.sendPacket(new SChatPacket(chatmessage));
} else {
@ -887,7 +922,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
@Override
protected Object evaluate() {
disconnect(new TranslationTextComponent("disconnect.spam", new Object[0]));
disconnect(new TranslationTextComponent("disconnect.spam"));
return null;
}
}
@ -903,7 +938,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
throw new RuntimeException(e2);
}
}
this.disconnect(new TranslationTextComponent("disconnect.spam", new Object[0]));
this.disconnect(new TranslationTextComponent("disconnect.spam"));
}
}
}
@ -986,7 +1021,9 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
private void handleSlashCommand(String s) {
LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
if (SpigotConfig.logCommands) {
LOGGER.info(this.player.getScoreboardName() + " issued server command: " + s);
}
CraftPlayer player = this.getPlayer();
PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(player, s, new LazyPlayerSet(this.minecraftServer));
this.server.getPluginManager().callEvent(event);
@ -1007,7 +1044,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void handleAnimation(CAnimateHandPacket packet) {
PacketThreadUtil.func_218796_a(packet, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packet, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
return;
}
@ -1038,29 +1075,27 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
this.player.swingArm(packet.getHand());
}
private static final Set<String> sneakKeys = ImmutableSet.of("START_SNEAKING", "PRESS_SHIFT_KEY");
private static final Set<String> standKeys = ImmutableSet.of("STOP_SNEAKING", "RELEASE_SHIFT_KEY");
@Inject(method = "processEntityAction", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/ServerPlayerEntity;markPlayerActive()V"))
private void arclight$toggleAction(CEntityActionPacket packetIn, CallbackInfo ci) {
if (this.player.removed) {
ci.cancel();
return;
}
switch (packetIn.getAction()) {
case START_SNEAKING:
case STOP_SNEAKING: {
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packetIn.getAction() == CEntityActionPacket.Action.START_SNEAKING);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
return;
}
break;
String name = packetIn.getAction().name();
if (sneakKeys.contains(name) || standKeys.contains(name)) {
PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), sneakKeys.contains(name));
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
ci.cancel();
}
case START_SPRINTING:
case STOP_SPRINTING: {
PlayerToggleSprintEvent e2 = new PlayerToggleSprintEvent(this.getPlayer(), packetIn.getAction() == CEntityActionPacket.Action.START_SPRINTING);
this.server.getPluginManager().callEvent(e2);
if (e2.isCancelled()) {
return;
}
break;
} else if (packetIn.getAction() == CEntityActionPacket.Action.START_SPRINTING || packetIn.getAction() == CEntityActionPacket.Action.STOP_SPRINTING) {
PlayerToggleSprintEvent e2 = new PlayerToggleSprintEvent(this.getPlayer(), packetIn.getAction() == CEntityActionPacket.Action.START_SPRINTING);
this.server.getPluginManager().callEvent(e2);
if (e2.isCancelled()) {
ci.cancel();
}
}
}
@ -1071,12 +1106,12 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processUseEntity(final CUseEntityPacket packetIn) {
PacketThreadUtil.func_218796_a(packetIn, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packetIn, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
return;
}
final ServerWorld worldserver = this.minecraftServer.func_71218_a(this.player.dimension);
final Entity entity = packetIn.getEntityFromWorld(worldserver);
final ServerWorld world = this.minecraftServer.getWorld(this.player.dimension);
final Entity entity = packetIn.getEntityFromWorld(world);
this.player.markPlayerActive();
if (entity != null) {
final boolean flag = this.player.canEntityBeSeen(entity);
@ -1112,22 +1147,25 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
}
}
if (packetIn.getAction() == CUseEntityPacket.Action.INTERACT) {
final Hand enumhand = packetIn.getHand();
this.player.interactOn(entity, enumhand);
final Hand hand = packetIn.getHand();
this.player.interactOn(entity, hand);
if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
this.player.sendContainerToPlayer(this.player.openContainer);
}
} else if (packetIn.getAction() == CUseEntityPacket.Action.INTERACT_AT) {
final Hand enumhand = packetIn.getHand();
if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(player, entity, packetIn.getHitVec(), enumhand) != null)
final Hand hand = packetIn.getHand();
if (net.minecraftforge.common.ForgeHooks.onInteractEntityAt(player, entity, packetIn.getHitVec(), hand) != null)
return;
entity.applyPlayerInteraction(this.player, packetIn.getHitVec(), enumhand);
ActionResultType result = entity.applyPlayerInteraction(this.player, packetIn.getHitVec(), hand);
if (result.isSuccess()) {
this.player.swingArm(hand);
}
if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
this.player.sendContainerToPlayer(this.player.openContainer);
}
} else if (packetIn.getAction() == CUseEntityPacket.Action.ATTACK) {
if (entity instanceof ItemEntity || entity instanceof ExperienceOrbEntity || entity instanceof AbstractArrowEntity || (entity == this.player && !this.player.isSpectator())) {
this.disconnect(new TranslationTextComponent("multiplayer.disconnect.invalid_entity_attacked", new Object[0]));
this.disconnect(new TranslationTextComponent("multiplayer.disconnect.invalid_entity_attacked"));
this.minecraftServer.logWarning("Player " + this.player.getName().getString() + " tried to attack an invalid entity");
return;
}
@ -1155,7 +1193,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processClickWindow(CClickWindowPacket packet) {
PacketThreadUtil.func_218796_a(packet, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packet, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (((ServerPlayerEntityBridge) this.player).bridge$isMovementBlocked()) {
return;
}
@ -1474,7 +1512,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processCreativeInventoryAction(final CCreativeInventoryActionPacket packetplayinsetcreativeslot) {
PacketThreadUtil.func_218796_a(packetplayinsetcreativeslot, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packetplayinsetcreativeslot, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (this.player.interactionManager.isCreative()) {
final boolean flag = packetplayinsetcreativeslot.getSlotId() < 0;
ItemStack itemstack = packetplayinsetcreativeslot.getStack();
@ -1531,15 +1569,12 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
this.player.container.detectAndSendChanges();
} else if (flag && flag3 && this.itemDropThreshold < 200) {
this.itemDropThreshold += 20;
final ItemEntity entityitem = this.player.dropItem(itemstack, true);
if (entityitem != null) {
entityitem.setAgeToCreativeDespawnTime();
}
this.player.dropItem(itemstack, true);
}
}
}
@Inject(method = "processConfirmTransaction", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/network/PacketThreadUtil;func_218796_a(Lnet/minecraft/network/IPacket;Lnet/minecraft/network/INetHandler;Lnet/minecraft/world/server/ServerWorld;)V"))
@Inject(method = "processConfirmTransaction", at = @At(value = "INVOKE", shift = At.Shift.AFTER, target = "Lnet/minecraft/network/PacketThreadUtil;checkThreadAndEnqueue(Lnet/minecraft/network/IPacket;Lnet/minecraft/network/INetHandler;Lnet/minecraft/world/server/ServerWorld;)V"))
private void arclight$noTransaction(CConfirmTransactionPacket packetIn, CallbackInfo ci) {
if (((ServerPlayerEntityBridge) player).bridge$isMovementBlocked()) {
ci.cancel();
@ -1592,7 +1627,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
@Inject(method = "processKeepAlive", at = @At("HEAD"))
private void arclight$syncKeepAlive(CKeepAlivePacket packetIn, CallbackInfo ci) {
PacketThreadUtil.func_218796_a(packetIn, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packetIn, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
}
/**
@ -1601,7 +1636,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
*/
@Overwrite
public void processPlayerAbilities(CPlayerAbilitiesPacket packet) {
PacketThreadUtil.func_218796_a(packet, (ServerPlayNetHandler) (Object) this, this.player.func_71121_q());
PacketThreadUtil.checkThreadAndEnqueue(packet, (ServerPlayNetHandler) (Object) this, this.player.getServerWorld());
if (this.player.abilities.allowFlying && this.player.abilities.isFlying != packet.isFlying()) {
PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this.server.getPlayer(this.player), packet.isFlying());
this.server.getPluginManager().callEvent(event);
@ -1621,7 +1656,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
if (packet.channel.equals(CUSTOM_REGISTER)) {
try {
String channels = packet.data.toString(Charsets.UTF_8);
for (String channel :channels.split("\0")){
for (String channel : channels.split("\0")) {
if (!StringUtils.isNullOrEmpty(channel)) {
this.getPlayer().addChannel(channel);
}
@ -1633,7 +1668,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
} else if (packet.channel.equals(CUSTOM_UNREGISTER)) {
try {
final String channels = packet.data.toString(Charsets.UTF_8);
for (String channel :channels.split("\0")){
for (String channel : channels.split("\0")) {
if (!StringUtils.isNullOrEmpty(channel)) {
this.getPlayer().removeChannel(channel);
}
@ -1658,6 +1693,11 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
return !((ServerPlayerEntityBridge) this.player).bridge$isJoining() && !this.netManager.isChannelOpen();
}
@Override
public boolean bridge$isDisconnected() {
return this.isDisconnected();
}
/**
* @author IzzelAliz
* @reason

View File

@ -1,5 +1,6 @@
package io.izzel.arclight.common.mixin.core.network.play.client;
import io.izzel.arclight.common.bridge.network.play.TimestampedPacket;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.CPlayerTryUseItemOnBlockPacket;
import org.spongepowered.asm.mixin.Mixin;
@ -8,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(CPlayerTryUseItemOnBlockPacket.class)
public class CPlayerTryUseItemOnBlockPacketMixin {
public class CPlayerTryUseItemOnBlockPacketMixin implements TimestampedPacket {
public long timestamp;
@ -16,4 +17,9 @@ public class CPlayerTryUseItemOnBlockPacketMixin {
private void arclight$read(PacketBuffer buf, CallbackInfo ci) {
this.timestamp = System.currentTimeMillis();
}
@Override
public long bridge$timestamp() {
return timestamp;
}
}

View File

@ -1,5 +1,6 @@
package io.izzel.arclight.common.mixin.core.network.play.client;
import io.izzel.arclight.common.bridge.network.play.TimestampedPacket;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.client.CPlayerTryUseItemPacket;
import org.spongepowered.asm.mixin.Mixin;
@ -8,7 +9,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(CPlayerTryUseItemPacket.class)
public class CPlayerTryUseItemPacketMixin {
public class CPlayerTryUseItemPacketMixin implements TimestampedPacket {
public long timestamp;
@ -16,4 +17,9 @@ public class CPlayerTryUseItemPacketMixin {
private void arclight$read(PacketBuffer buf, CallbackInfo ci) {
this.timestamp = System.currentTimeMillis();
}
@Override
public long bridge$timestamp() {
return timestamp;
}
}

View File

@ -122,6 +122,11 @@ public abstract class MinecraftServerMixin extends RecursiveEventLoop<TickDelaye
}
}
@Override
public boolean bridge$hasStopped() {
return this.hasStopped();
}
@Inject(method = "<init>", at = @At("RETURN"))
public void arclight$loadOptions(File file, Proxy proxy, DataFixer dataFixerIn, Commands commands, YggdrasilAuthenticationService authenticationService, MinecraftSessionService sessionService, GameProfileRepository profileRepository, PlayerProfileCache playerProfileCache, IChunkStatusListenerFactory listenerFactory, String string, CallbackInfo ci) {
String[] arguments = ManagementFactory.getRuntimeMXBean().getInputArguments().toArray(new String[0]);

View File

@ -1,32 +1,23 @@
package io.izzel.arclight.common.mixin.core.server.management;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.server.management.PlayerInteractionManagerBridge;
import io.izzel.arclight.common.mod.ArclightMod;
import io.izzel.arclight.common.mod.util.ArclightCaptures;
import net.minecraft.block.BlockState;
import net.minecraft.block.CakeBlock;
import net.minecraft.block.DoorBlock;
import net.minecraft.block.TrapDoorBlock;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.network.play.client.CPlayerDiggingPacket;
import net.minecraft.network.play.server.SChangeBlockPacket;
import net.minecraft.network.play.server.SPlayerDiggingPacket;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.state.properties.DoubleBlockHalf;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks;
import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.event.Event;
@ -40,9 +31,9 @@ import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import io.izzel.arclight.common.mod.util.ArclightCaptures;
import java.util.List;
import java.util.Objects;
@Mixin(PlayerInteractionManager.class)
public abstract class PlayerInteractionManagerMixin implements PlayerInteractionManagerBridge {
@ -51,7 +42,6 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
@Shadow public ServerWorld world;
@Shadow public ServerPlayerEntity player;
@Shadow public abstract boolean isCreative();
@Shadow public abstract void func_225415_a(BlockPos p_225415_1_, CPlayerDiggingPacket.Action p_225415_2_);
@Shadow private GameType gameType;
@Shadow private int initialDamage;
@Shadow private int ticks;
@ -80,18 +70,18 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
dist *= dist;
net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock forgeEvent = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(player, blockPos, direction);
if (forgeEvent.isCanceled() || (!this.isCreative() && forgeEvent.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { // Restore block and te data
player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, world.getBlockState(blockPos), action, false));
player.connection.sendPacket(this.bridge$diggingPacket(blockPos, world.getBlockState(blockPos), action, false, "mod canceled"));
world.notifyBlockUpdate(blockPos, world.getBlockState(blockPos), world.getBlockState(blockPos), 3);
return;
}
if (d4 > dist) {
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, false));
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, false, "too far"));
} else if (blockPos.getY() >= i) {
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, false));
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, false, "too high"));
} else if (action == CPlayerDiggingPacket.Action.START_DESTROY_BLOCK) {
if (!this.world.isBlockModifiable(this.player, blockPos)) {
CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockPos, direction, this.player.inventory.getCurrentItem(), Hand.MAIN_HAND);
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, false));
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, false, "may not interact"));
TileEntity tileentity = this.world.getTileEntity(blockPos);
if (tileentity != null) {
this.player.connection.sendPacket(tileentity.getUpdatePacket());
@ -109,14 +99,14 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
}
if (this.isCreative()) {
if (!this.world.extinguishFire(null, blockPos, direction)) {
this.func_225415_a(blockPos, action);
this.bridge$creativeHarvestBlock(blockPos, action, "creative destroy");
} else {
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, true));
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, true, "fire put out"));
}
return;
}
if (this.player.func_223729_a(this.world, blockPos, this.gameType)) {
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, false));
if (this.player.blockActionRestricted(this.world, blockPos, this.gameType)) {
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, false, "block action restricted"));
return;
}
this.initialDamage = this.ticks;
@ -153,13 +143,16 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
f = 2.0f;
}
if (!iblockdata.isAir() && f >= 1.0f) {
this.func_225415_a(blockPos, action);
this.bridge$creativeHarvestBlock(blockPos, action, "insta mine");
} else {
if (this.isDestroyingBlock) {
this.player.connection.sendPacket(this.bridge$diggingPacket(this.destroyPos, this.world.getBlockState(this.destroyPos), CPlayerDiggingPacket.Action.START_DESTROY_BLOCK, false, "abort destroying since another started (client insta mine, server disagreed)"));
}
this.isDestroyingBlock = true;
this.destroyPos = blockPos;
int j = (int) (f * 10.0f);
this.world.sendBlockBreakProgress(this.player.getEntityId(), blockPos, j);
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, true));
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, true, "actual start of destroying"));
this.durabilityRemainingOnBlock = j;
}
} else if (action == CPlayerDiggingPacket.Action.STOP_DESTROY_BLOCK) {
@ -171,7 +164,7 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
if (f2 >= 0.7f) {
this.isDestroyingBlock = false;
this.world.sendBlockBreakProgress(this.player.getEntityId(), blockPos, -1);
this.func_225415_a(blockPos, action);
this.bridge$creativeHarvestBlock(blockPos, action, "destroyed");
return;
}
if (!this.receivedFinishDiggingPacket) {
@ -182,11 +175,16 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
}
}
}
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, true));
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, true, "stopped destroying"));
} else if (action == CPlayerDiggingPacket.Action.ABORT_DESTROY_BLOCK) {
this.isDestroyingBlock = false;
this.world.sendBlockBreakProgress(this.player.getEntityId(), this.destroyPos, -1);
this.player.connection.sendPacket(new SPlayerDiggingPacket(blockPos, this.world.getBlockState(blockPos), action, true));
if (!Objects.equals(this.destroyPos, blockPos)) {
ArclightMod.LOGGER.debug("Mismatch in destroy block pos: " + this.destroyPos + " " + blockPos);
this.world.sendBlockBreakProgress(this.player.getEntityId(), this.destroyPos, -1);
this.player.connection.sendPacket(this.bridge$diggingPacket(this.destroyPos, this.world.getBlockState(this.destroyPos), action, true, "aborted mismatched destroying"));
}
this.world.sendBlockBreakProgress(this.player.getEntityId(), blockPos, -1);
this.player.connection.sendPacket(this.bridge$diggingPacket(blockPos, this.world.getBlockState(blockPos), action, true, "aborted destroying"));
}
}
@ -201,81 +199,6 @@ public abstract class PlayerInteractionManagerMixin implements PlayerInteraction
}
}
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public ActionResultType func_219441_a(PlayerEntity playerIn, World worldIn, ItemStack stackIn, Hand handIn, BlockRayTraceResult blockRaytraceResultIn) {
BlockPos blockpos = blockRaytraceResultIn.getPos();
BlockState blockstate = worldIn.getBlockState(blockpos);
ActionResultType resultType = ActionResultType.PASS;
boolean cancelledBlock = false;
if (this.gameType == GameType.SPECTATOR) {
INamedContainerProvider provider = blockstate.getContainer(worldIn, blockpos);
cancelledBlock = !(provider instanceof INamedContainerProvider);
}
if (playerIn.getCooldownTracker().hasCooldown(stackIn.getItem())) {
cancelledBlock = true;
}
PlayerInteractEvent bukkitEvent = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, blockpos, blockRaytraceResultIn.getFace(), stackIn, cancelledBlock, handIn);
firedInteract = true;
interactResult = bukkitEvent.useItemInHand() == Event.Result.DENY;
if (bukkitEvent.useInteractedBlock() == Event.Result.DENY) {
if (blockstate.getBlock() instanceof DoorBlock) {
boolean bottom = blockstate.get(DoorBlock.HALF) == DoubleBlockHalf.LOWER;
((ServerPlayerEntity) playerIn).connection.sendPacket(new SChangeBlockPacket(world, bottom ? blockpos.up() : blockpos.down()));
} else if (blockstate.getBlock() instanceof CakeBlock) {
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().sendHealthUpdate();
}
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().updateInventory();
resultType = ((bukkitEvent.useItemInHand() != Event.Result.ALLOW) ? ActionResultType.SUCCESS : ActionResultType.PASS);
} else if (this.gameType == GameType.SPECTATOR) {
INamedContainerProvider inamedcontainerprovider = blockstate.getContainer(worldIn, blockpos);
if (inamedcontainerprovider != null) {
playerIn.openContainer(inamedcontainerprovider);
return ActionResultType.SUCCESS;
} else {
return ActionResultType.PASS;
}
} else {
net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = ForgeHooks.onRightClickBlock(playerIn, handIn, blockpos, blockRaytraceResultIn.getFace());
if (event.isCanceled()) return event.getCancellationResult();
ItemUseContext itemusecontext = new ItemUseContext(playerIn, handIn, blockRaytraceResultIn);
if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
ActionResultType result = stackIn.onItemUseFirst(itemusecontext);
if (result != ActionResultType.PASS) return result;
}
boolean flag = !playerIn.getHeldItemMainhand().isEmpty() || !playerIn.getHeldItemOffhand().isEmpty();
boolean flag1 = !(playerIn.isSneaking() && flag) || (playerIn.getHeldItemMainhand().doesSneakBypassUse(worldIn, blockpos, playerIn) && playerIn.getHeldItemOffhand().doesSneakBypassUse(worldIn, blockpos, playerIn));
boolean flag2 = blockstate.onBlockActivated(worldIn, playerIn, handIn, blockRaytraceResultIn);
if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && flag1 && flag2) {
return ActionResultType.SUCCESS;
} else {
if (flag1) {
resultType = flag2 ? ActionResultType.SUCCESS : ActionResultType.FAIL;
}
if (!stackIn.isEmpty() && resultType != ActionResultType.SUCCESS && !interactResult) {
if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
return ActionResultType.PASS;
}
if (this.isCreative()) {
int i = stackIn.getCount();
resultType = stackIn.onItemUse(itemusecontext);
stackIn.setCount(i);
return resultType;
} else {
return stackIn.onItemUse(itemusecontext);
}
} else {
return resultType;
}
}
}
return resultType;
}
@Override
public boolean bridge$isFiredInteract() {
return firedInteract;

View File

@ -2,12 +2,17 @@ package io.izzel.arclight.common.mixin.core.server.management;
import com.google.common.collect.Lists;
import com.mojang.authlib.GameProfile;
import io.izzel.arclight.api.ArclightVersion;
import io.izzel.arclight.common.bridge.entity.player.PlayerEntityBridge;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.network.play.ServerPlayNetHandlerBridge;
import io.izzel.arclight.common.bridge.server.MinecraftServerBridge;
import io.izzel.arclight.common.bridge.server.management.PlayerListBridge;
import io.izzel.arclight.common.bridge.world.WorldBridge;
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
import io.izzel.arclight.common.mod.ArclightMod;
import io.izzel.arclight.common.mod.server.BukkitRegistry;
import io.izzel.arclight.common.mod.util.ArclightCaptures;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.IPacket;
@ -15,10 +20,10 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SChangeGameStatePacket;
import net.minecraft.network.play.server.SChatPacket;
import net.minecraft.network.play.server.SEntityStatusPacket;
import net.minecraft.network.play.server.SRespawnPacket;
import net.minecraft.network.play.server.SServerDifficultyPacket;
import net.minecraft.network.play.server.SSetExperiencePacket;
import net.minecraft.network.play.server.SSpawnPositionPacket;
import net.minecraft.network.play.server.SUpdateViewDistancePacket;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.management.BanList;
@ -57,6 +62,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.gen.Accessor;
@ -64,8 +70,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import io.izzel.arclight.common.mod.ArclightMod;
import io.izzel.arclight.common.mod.util.ArclightCaptures;
import javax.annotation.Nullable;
import java.io.File;
@ -81,7 +85,7 @@ import java.util.UUID;
public abstract class PlayerListMixin implements PlayerListBridge {
// @formatter:off
@Override @Accessor("players") public abstract void bridge$setPlayers(List<ServerPlayerEntity> players);
@Override @Accessor("players") @Mutable public abstract void bridge$setPlayers(List<ServerPlayerEntity> players);
@Override @Accessor("players") public abstract List<ServerPlayerEntity> bridge$getPlayers();
@Shadow public abstract void sendMessage(ITextComponent component, boolean isSystem);
@Shadow public IPlayerFileData playerDataManager;
@ -96,11 +100,11 @@ public abstract class PlayerListMixin implements PlayerListBridge {
@Shadow @Final private MinecraftServer server;
@Shadow public abstract BanList getBannedPlayers();
@Shadow public abstract IPBanList getBannedIPs();
@Shadow public abstract boolean removePlayer(ServerPlayerEntity player);
@Shadow(remap = false) public abstract boolean removePlayer(ServerPlayerEntity player);
@Shadow protected abstract void setPlayerGameTypeBasedOnOther(ServerPlayerEntity target, ServerPlayerEntity source, IWorld worldIn);
@Shadow public abstract void func_72354_b(ServerPlayerEntity playerIn, ServerWorld worldIn);
@Shadow public abstract void sendWorldInfo(ServerPlayerEntity playerIn, ServerWorld worldIn);
@Shadow public abstract void updatePermissionLevel(ServerPlayerEntity player);
@Shadow public abstract boolean addPlayer(ServerPlayerEntity player);
@Shadow(remap = false) public abstract boolean addPlayer(ServerPlayerEntity player);
@Shadow @Final private Map<UUID, ServerPlayerEntity> uuidToPlayerMap;
// @formatter:on
@ -168,7 +172,7 @@ public abstract class PlayerListMixin implements PlayerListBridge {
this.writePlayerData(entityplayer);
entityplayer.connection.disconnect(new TranslationTextComponent("multiplayer.disconnect.duplicate_login"));
}
final ServerPlayerEntity entity = new ServerPlayerEntity(this.server, this.server.func_71218_a(DimensionType.OVERWORLD), gameProfile, new PlayerInteractionManager(this.server.func_71218_a(DimensionType.OVERWORLD)));
final ServerPlayerEntity entity = new ServerPlayerEntity(this.server, this.server.getWorld(DimensionType.OVERWORLD), gameProfile, new PlayerInteractionManager(this.server.getWorld(DimensionType.OVERWORLD)));
final Player player = ((ServerPlayerEntityBridge) entity).bridge$getBukkitEntity();
// todo hostname
final PlayerLoginEvent event = new PlayerLoginEvent(player, "", ((InetSocketAddress) socketAddress).getAddress());
@ -222,29 +226,29 @@ public abstract class PlayerListMixin implements PlayerListBridge {
playerIn.stopRiding();
org.bukkit.World fromWorld = ((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().getWorld();
ServerWorld world = server.func_71218_a(dimension);
ServerWorld world = server.getWorld(dimension);
if (world == null)
dimension = playerIn.getSpawnDimension();
else if (!world.getDimension().canRespawnHere())
dimension = world.getDimension().getRespawnDimension(playerIn);
if (server.func_71218_a(dimension) == null)
if (server.getWorld(dimension) == null)
dimension = DimensionType.OVERWORLD;
this.removePlayer(playerIn);
playerIn.func_71121_q().removePlayer(playerIn, true); // Forge: keep data until copyFrom called
playerIn.getServerWorld().removePlayer(playerIn, true); // Forge: keep data until copyFrom called
BlockPos blockpos = playerIn.getBedLocation(dimension);
boolean flag = playerIn.isSpawnForced(dimension);
playerIn.dimension = dimension;
PlayerInteractionManager playerinteractionmanager;
if (this.server.isDemo()) {
playerinteractionmanager = new DemoPlayerInteractionManager(this.server.func_71218_a(playerIn.dimension));
playerinteractionmanager = new DemoPlayerInteractionManager(this.server.getWorld(playerIn.dimension));
} else {
playerinteractionmanager = new PlayerInteractionManager(this.server.func_71218_a(playerIn.dimension));
playerinteractionmanager = new PlayerInteractionManager(this.server.getWorld(playerIn.dimension));
}
playerIn.queuedEndExit = false;
ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.server, this.server.func_71218_a(playerIn.dimension), playerIn.getGameProfile(), playerinteractionmanager);
ServerPlayerEntity serverplayerentity = new ServerPlayerEntity(this.server, this.server.getWorld(playerIn.dimension), playerIn.getGameProfile(), playerinteractionmanager);
serverplayerentity.connection = playerIn.connection;
serverplayerentity.copyFrom(playerIn, conqueredEnd);
playerIn.remove(false); // Forge: clone event had a chance to see old data, now discard it
@ -260,13 +264,13 @@ public abstract class PlayerListMixin implements PlayerListBridge {
boolean isBedSpawn = false;
CraftWorld cworld = (CraftWorld) Bukkit.getWorld(((PlayerEntityBridge) playerIn).bridge$getSpawnWorld());
if (cworld != null && blockpos != null) {
Optional<Vec3d> optional = PlayerEntity.func_213822_a(cworld.getHandle(), blockpos, flag);
Optional<Vec3d> optional = PlayerEntity.checkBedValidRespawnPosition(cworld.getHandle(), blockpos, flag);
if (optional.isPresent()) {
Vec3d vec3d = optional.get();
isBedSpawn = true;
location = new Location(cworld, vec3d.x, vec3d.y, vec3d.z);
} else {
serverplayerentity.setSpawnPoint(null, true);
this.bridge$setSpawnPoint(serverplayerentity, null, true, serverplayerentity.dimension, false);
serverplayerentity.connection.sendPacket(new SChangeGameStatePacket(0, 0.0f));
}
}
@ -278,12 +282,15 @@ public abstract class PlayerListMixin implements PlayerListBridge {
Player respawnPlayer = this.cserver.getPlayer(serverplayerentity);
PlayerRespawnEvent respawnEvent = new PlayerRespawnEvent(respawnPlayer, location, isBedSpawn);
this.cserver.getPluginManager().callEvent(respawnEvent);
if (((ServerPlayNetHandlerBridge) playerIn.connection).bridge$isDisconnected()) {
return playerIn;
}
location = respawnEvent.getRespawnLocation();
if (!flag) {
((ServerPlayerEntityBridge) playerIn).bridge$reset();
}
} else {
location.setWorld(((WorldBridge) this.server.func_71218_a(dimension)).bridge$getWorld());
location.setWorld(((WorldBridge) this.server.getWorld(dimension)).bridge$getWorld());
}
ServerWorld serverworld = ((CraftWorld) location.getWorld()).getHandle();
@ -292,29 +299,34 @@ public abstract class PlayerListMixin implements PlayerListBridge {
this.setPlayerGameTypeBasedOnOther(serverplayerentity, playerIn, serverworld);
if (blockpos != null) {
Optional<Vec3d> optional = PlayerEntity.func_213822_a(this.server.func_71218_a(playerIn.dimension), blockpos, flag);
Optional<Vec3d> optional = PlayerEntity.checkBedValidRespawnPosition(this.server.getWorld(playerIn.dimension), blockpos, flag);
if (optional.isPresent()) {
Vec3d vec3d = optional.get();
serverplayerentity.setLocationAndAngles(vec3d.x, vec3d.y, vec3d.z, 0.0F, 0.0F);
serverplayerentity.setSpawnPoint(blockpos, flag, dimension);
this.bridge$setSpawnPoint(serverplayerentity, blockpos, flag, dimension, false);
} else {
serverplayerentity.connection.sendPacket(new SChangeGameStatePacket(0, 0.0F));
}
}
while (avoidSuffocation && !serverworld.areCollisionShapesEmpty(serverplayerentity) && serverplayerentity.posY < 256.0D) {
while (avoidSuffocation && !this.bridge$worldNoCollision(serverworld, serverplayerentity) && serverplayerentity.posY < 256.0D) {
serverplayerentity.setPosition(serverplayerentity.posX, serverplayerentity.posY + 1.0D, serverplayerentity.posZ);
}
if (fromWorld.getEnvironment() == ((WorldBridge) serverworld).bridge$getWorld().getEnvironment()) {
serverplayerentity.connection.sendPacket(this.bridge$respawnPacket((((DimensionTypeBridge) serverplayerentity.dimension).bridge$getType().getId() >= 0) ? DimensionType.THE_NETHER : DimensionType.OVERWORLD, WorldInfo.byHashing(serverworld.getWorldInfo().getSeed()), serverworld.getWorldInfo().getGenerator(), playerIn.interactionManager.getGameType()));
}
WorldInfo worldinfo = serverplayerentity.world.getWorldInfo();
NetworkHooks.sendDimensionDataPacket(serverplayerentity.connection.netManager, serverplayerentity);
serverplayerentity.connection.sendPacket(new SRespawnPacket(serverplayerentity.dimension, worldinfo.getGenerator(), serverplayerentity.interactionManager.getGameType()));
serverplayerentity.connection.sendPacket(this.bridge$respawnPacket(((DimensionTypeBridge) serverplayerentity.dimension).bridge$getType(), WorldInfo.byHashing(worldinfo.getSeed()), worldinfo.getGenerator(), serverplayerentity.interactionManager.getGameType()));
serverplayerentity.connection.sendPacket(new SUpdateViewDistancePacket(((WorldBridge) serverworld).bridge$spigotConfig().viewDistance));
BlockPos blockpos1 = serverworld.getSpawnPoint();
serverplayerentity.connection.setPlayerLocation(serverplayerentity.posX, serverplayerentity.posY, serverplayerentity.posZ, serverplayerentity.rotationYaw, serverplayerentity.rotationPitch);
serverplayerentity.connection.sendPacket(new SSpawnPositionPacket(blockpos1));
serverplayerentity.connection.sendPacket(new SServerDifficultyPacket(worldinfo.getDifficulty(), worldinfo.isDifficultyLocked()));
serverplayerentity.connection.sendPacket(new SSetExperiencePacket(serverplayerentity.experience, serverplayerentity.experienceTotal, serverplayerentity.experienceLevel));
this.func_72354_b(serverplayerentity, serverworld);
this.sendWorldInfo(serverplayerentity, serverworld);
this.updatePermissionLevel(serverplayerentity);
serverworld.addRespawnedPlayer(serverplayerentity);
this.addPlayer(serverplayerentity);
@ -355,6 +367,10 @@ public abstract class PlayerListMixin implements PlayerListBridge {
((ServerPlayerEntityBridge) playerEntity).bridge$getBukkitEntity().updateScaledHealth();
int i = playerEntity.world.getGameRules().getBoolean(GameRules.REDUCED_DEBUG_INFO) ? 22 : 23;
playerEntity.connection.sendPacket(new SEntityStatusPacket(playerEntity, (byte) i));
if (ArclightVersion.atLeast(ArclightVersion.v1_15)) {
float immediateRespawn = playerEntity.world.getGameRules().getBoolean(GameRules.DO_IMMEDIATE_RESPAWN) ? 1.0f : 0.0f;
playerEntity.connection.sendPacket(new SChangeGameStatePacket(11, immediateRespawn));
}
}
@Redirect(method = "sendMessage(Lnet/minecraft/util/text/ITextComponent;Z)V", at = @At(value = "NEW", target = "net/minecraft/network/play/server/SChatPacket"))

View File

@ -1,6 +1,7 @@
package io.izzel.arclight.common.mixin.core.tileentity;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.tileentity.AbstractFurnaceTileEntityBridge;
import net.minecraft.block.Blocks;
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.player.PlayerEntity;
@ -27,7 +28,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import io.izzel.arclight.common.bridge.tileentity.AbstractFurnaceTileEntityBridge;
import javax.annotation.Nullable;
import java.util.ArrayList;
@ -80,7 +80,7 @@ public abstract class AbstractFurnaceTileEntityMixin extends LockableTileEntityM
* @reason
*/
@Overwrite
private void func_214007_c(@Nullable IRecipe<?> p_214007_1_) {
private void smelt(@Nullable IRecipe<?> p_214007_1_) {
if (p_214007_1_ != null && this.canSmelt(p_214007_1_)) {
ItemStack itemstack = this.items.get(0);
ItemStack itemstack1 = p_214007_1_.getRecipeOutput();
@ -145,7 +145,7 @@ public abstract class AbstractFurnaceTileEntityMixin extends LockableTileEntityM
* @reason
*/
@Overwrite
private static void func_214003_a(PlayerEntity entity, int ex, float f) {
private static void spawnExpOrbs(PlayerEntity entity, int ex, float f) {
if (f == 0.0F) {
ex = 0;
} else if (f < 1.0F) {

View File

@ -2,6 +2,7 @@ package io.izzel.arclight.common.mixin.core.tileentity;
import io.izzel.arclight.common.bridge.command.ICommandSourceBridge;
import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge;
import net.minecraft.command.CommandSource;
import net.minecraft.command.ICommandSource;
import net.minecraft.entity.Entity;
@ -26,7 +27,6 @@ import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import io.izzel.arclight.common.bridge.inventory.container.LecternContainerBridge;
import javax.annotation.Nullable;
@ -34,7 +34,7 @@ import javax.annotation.Nullable;
public abstract class LecternTileEntityMixin extends TileEntityMixin implements ICommandSource, ICommandSourceBridge {
// @formatter:off
@Shadow @Final public IInventory field_214048_a;
@Shadow @Final public IInventory inventory;
@Shadow @Final private IIntArray field_214049_b;
// @formatter:on
@ -49,7 +49,7 @@ public abstract class LecternTileEntityMixin extends TileEntityMixin implements
*/
@Overwrite
public Container createMenu(int i, PlayerInventory playerInventory, PlayerEntity entity) {
LecternContainer container = new LecternContainer(i, this.field_214048_a, this.field_214049_b);
LecternContainer container = new LecternContainer(i, this.inventory, this.field_214049_b);
((LecternContainerBridge) container).bridge$setPlayerInventory(playerInventory);
return container;
}

View File

@ -1,5 +1,6 @@
package io.izzel.arclight.common.mixin.core.tileentity;
import io.izzel.arclight.common.bridge.tileentity.TileEntityBridge;
import net.minecraft.block.BlockState;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
@ -15,7 +16,6 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import io.izzel.arclight.common.bridge.tileentity.TileEntityBridge;
import javax.annotation.Nullable;
@ -30,6 +30,7 @@ public abstract class TileEntityMixin implements TileEntityBridge {
@Shadow protected BlockPos pos;
@Shadow public abstract BlockState getBlockState();
@Shadow public abstract void markDirty();
@Shadow public abstract BlockPos getPos();
// @formatter:on
@Inject(method = "read", at = @At("RETURN"))

View File

@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(VillageSiege.class)
public class VillageSiegeMixin {
@Inject(method = "func_75530_c", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;addEntity(Lnet/minecraft/entity/Entity;)Z"))
@Inject(method = "spawnZombie", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;addEntity(Lnet/minecraft/entity/Entity;)Z"))
public void arclight$addEntityReason(ServerWorld world, CallbackInfo ci) {
((ServerWorldBridge) world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION);
}

View File

@ -54,6 +54,7 @@ public abstract class WorldMixin implements WorldBridge {
@Shadow @Final public WorldInfo worldInfo;
@Shadow public abstract WorldBorder getWorldBorder();
@Shadow@Final private WorldBorder worldBorder;
@Shadow public abstract long getDayTime();
@Accessor("mainThread") public abstract Thread arclight$getMainThread();
// @formatter:on

View File

@ -47,6 +47,11 @@ public abstract class ChunkMixin implements ChunkBridge {
return bukkitChunk;
}
@Override
public void bridge$setBukkitChunk(org.bukkit.Chunk chunk) {
this.bukkitChunk = chunk;
}
public BlockState setType(BlockPos pos, BlockState state, boolean isMoving, boolean doPlace) {
return this.bridge$setType(pos, state, isMoving, doPlace);
}

View File

@ -1,48 +1,58 @@
package io.izzel.arclight.common.mixin.core.world.chunk.storage;
import io.izzel.arclight.common.bridge.world.chunk.storage.RegionFileCacheBridge;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.chunk.storage.RegionFile;
import net.minecraft.world.chunk.storage.RegionFileCache;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.io.File;
import java.io.IOException;
@Mixin(RegionFileCache.class)
public class RegionFileCacheMixin implements RegionFileCacheBridge {
public abstract class RegionFileCacheMixin implements RegionFileCacheBridge {
// @formatter:off
@Shadow @Final public Long2ObjectLinkedOpenHashMap<RegionFile> cache;
@Shadow @Final private File folder;
@Shadow protected abstract RegionFile loadFile(ChunkPos pos) throws IOException;
// @formatter:on
private RegionFile loadFile(ChunkPos pos, boolean existsOnly) throws IOException {
long i = ChunkPos.asLong(pos.getRegionCoordX(), pos.getRegionCoordZ());
RegionFile regionfile = this.cache.getAndMoveToFirst(i);
if (regionfile != null) {
return regionfile;
} else {
if (this.cache.size() >= 256) {
this.cache.removeLast().close();
}
this.arclight$existOnly = existsOnly;
return loadFile(pos);
}
if (!this.folder.exists()) {
this.folder.mkdirs();
}
private transient boolean arclight$existOnly;
File file1 = new File(this.folder, "r." + pos.getRegionCoordX() + "." + pos.getRegionCoordZ() + ".mca");
if (existsOnly && !file1.exists()) return null;
@Inject(method = "loadFile", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD,
at = @At(value = "NEW", target = "net/minecraft/world/chunk/storage/RegionFile"))
private void arclight$retIfSearch(ChunkPos pos, CallbackInfoReturnable<RegionFile> cir, long l, RegionFile rf, File file) {
if (arclight$existOnly && !file.exists()) cir.setReturnValue(null);
}
RegionFile regionfile1 = new RegionFile(file1);
this.cache.putAndMoveToFirst(i, regionfile1);
return regionfile1;
@Inject(method = "readChunk", at = @At("HEAD"))
private void arclight$read(ChunkPos pos, CallbackInfoReturnable<CompoundNBT> cir) {
this.arclight$existOnly = true;
}
@Inject(method = "readChunk", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/chunk/storage/RegionFile;func_222666_a(Lnet/minecraft/util/math/ChunkPos;)Ljava/io/DataInputStream;"))
private void arclight$retIfNotFound(ChunkPos pos, CallbackInfoReturnable<CompoundNBT> cir, RegionFile rf) {
if (rf == null) {
cir.setReturnValue(null);
}
}
@Inject(method = "writeChunk", at = @At("HEAD"))
private void arclight$write(ChunkPos pos, CompoundNBT compound, CallbackInfo ci) {
this.arclight$existOnly = false;
}
public boolean chunkExists(ChunkPos pos) throws IOException {
RegionFile regionFile = loadFile(pos, true);
return regionFile != null && regionFile.contains(pos);

View File

@ -12,4 +12,8 @@ public abstract class DimensionMixin implements DimensionBridge {
// @formatter:off
@Accessor("type") public abstract DimensionType bridge$getDimensionManager();
// @formatter:on
public DimensionType getDimensionManager() {
return bridge$getDimensionManager();
}
}

View File

@ -0,0 +1,18 @@
package io.izzel.arclight.common.mixin.core.world.gen.feature.structure;
import net.minecraft.world.IWorld;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.gen.feature.structure.Structure;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(Structure.class)
public class StructureMixin {
@Redirect(method = "getStarts", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/world/IWorld;getChunk(IILnet/minecraft/world/chunk/ChunkStatus;)Lnet/minecraft/world/chunk/IChunk;"))
private IChunk arclight$notLoadChunk(IWorld iWorld, int chunkX, int chunkZ, ChunkStatus requiredStatus) {
return iWorld.getChunk(chunkX, chunkZ, requiredStatus, false);
}
}

View File

@ -3,6 +3,8 @@ package io.izzel.arclight.common.mixin.core.world.raid;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.potion.Effects;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.village.PointOfInterest;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.raid.Raid;
import net.minecraft.world.raid.RaidManager;
@ -15,6 +17,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import java.util.List;
import java.util.Map;
@Mixin(RaidManager.class)
@ -26,7 +29,8 @@ public class RaidManagerMixin {
@Inject(method = "badOmenTick", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/raid/Raid;increaseLevel(Lnet/minecraft/entity/player/PlayerEntity;)V"))
public void arclight$raidTrigger(ServerPlayerEntity playerEntity, CallbackInfoReturnable<Raid> cir,
DimensionType dimensionType, BlockPos pos, BlockPos pos1, Raid raid) {
DimensionType dimensionType, BlockPos pos, BlockPos pos1, List<PointOfInterest> list,
int i, Vec3d vec3d, Raid raid) {
if (!CraftEventFactory.callRaidTriggerEvent(raid, playerEntity)) {
playerEntity.removePotionEffect(Effects.BAD_OMEN);
this.byId.remove(raid.getId(), raid);

View File

@ -51,12 +51,12 @@ public class RaidMixin implements RaidBridge {
CraftEventFactory.callRaidStopEvent((Raid) (Object) this, RaidStopEvent.Reason.TIMEOUT);
}
@Inject(method = "tick", at = @At(value = "INVOKE", ordinal = 4, target = "Lnet/minecraft/world/raid/Raid;stop()V"))
@Inject(method = "tick", at = @At(value = "INVOKE", ordinal = 3, target = "Lnet/minecraft/world/raid/Raid;stop()V"))
public void arclight$stopUnspawnable(CallbackInfo ci) {
CraftEventFactory.callRaidStopEvent((Raid) (Object) this, RaidStopEvent.Reason.UNSPAWNABLE);
}
@Inject(method = "tick", at = @At(value = "INVOKE", ordinal = 5, target = "Lnet/minecraft/world/raid/Raid;stop()V"))
@Inject(method = "tick", at = @At(value = "INVOKE", ordinal = 4, target = "Lnet/minecraft/world/raid/Raid;stop()V"))
public void arclight$stopFinish(CallbackInfo ci) {
CraftEventFactory.callRaidStopEvent((Raid) (Object) this, RaidStopEvent.Reason.FINISHED);
}
@ -79,10 +79,9 @@ public class RaidMixin implements RaidBridge {
@Inject(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/raid/Raid;markDirty()V"))
public void arclight$finish(CallbackInfo ci) {
if (arclight$winners != null) {
CraftEventFactory.callRaidFinishEvent((Raid) (Object) this, arclight$winners);
arclight$winners = null;
}
List<Player> winners = this.arclight$winners == null ? new ArrayList<>() : this.arclight$winners;
this.arclight$winners = null;
CraftEventFactory.callRaidFinishEvent((Raid) (Object) this, winners);
}
private transient AbstractRaiderEntity arclight$leader;

View File

@ -5,7 +5,9 @@ import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.inventory.IInventoryBridge;
import io.izzel.arclight.common.bridge.world.ExplosionBridge;
import io.izzel.arclight.common.bridge.world.server.ServerWorldBridge;
import io.izzel.arclight.common.bridge.world.storage.MapDataBridge;
import io.izzel.arclight.common.bridge.world.storage.WorldInfoBridge;
import io.izzel.arclight.common.mixin.core.world.WorldMixin;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
@ -53,8 +55,6 @@ import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import io.izzel.arclight.common.bridge.world.storage.MapDataBridge;
import io.izzel.arclight.common.mixin.core.world.WorldMixin;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -213,7 +213,7 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
private transient CreatureSpawnEvent.SpawnReason arclight$reason;
@Inject(method = "addEntity0", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraftforge/eventbus/api/IEventBus;post(Lnet/minecraftforge/eventbus/api/Event;)Z"))
@Inject(method = "addEntity0", cancellable = true, at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraftforge/eventbus/api/IEventBus;post(Lnet/minecraftforge/eventbus/api/Event;)Z"))
public void arclight$addEntityEvent(Entity entityIn, CallbackInfoReturnable<Boolean> cir) {
if (arclight$reason == null) arclight$reason = CreatureSpawnEvent.SpawnReason.DEFAULT;
if (!CraftEventFactory.doEntityAddEventCalling((ServerWorld) (Object) this, entityIn, arclight$reason)) {

View File

@ -1,5 +1,8 @@
package io.izzel.arclight.common.mixin.core.world.storage;
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
import io.izzel.arclight.common.bridge.world.storage.MapDataBridge;
import io.izzel.arclight.common.mod.ArclightConstants;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.dimension.OverworldDimension;
@ -15,13 +18,11 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import io.izzel.arclight.common.bridge.world.storage.MapDataBridge;
import io.izzel.arclight.common.mod.ArclightConstants;
import java.util.UUID;
@Mixin(MapData.class)
public class MapDataMixin implements MapDataBridge {
public abstract class MapDataMixin implements MapDataBridge {
// @formatter:off
@Shadow public DimensionType dimension;
@ -53,7 +54,8 @@ public class MapDataMixin implements MapDataBridge {
if (type == null) {
/* All Maps which do not have their valid world loaded are set to a dimension which hopefully won't be reached.
This is to prevent them being corrupted with the wrong map data. */
type = new DimensionType(ArclightConstants.ARCLIGHT_DIMENSION, "", "", OverworldDimension::new, false, null, null);
type = this.bridge$dimension(ArclightConstants.ARCLIGHT_DIMENSION, "", "", OverworldDimension::new, false);
((DimensionTypeBridge) type).bridge$setType(DimensionType.OVERWORLD);
}
} else {

View File

@ -30,7 +30,7 @@ public class SaveHandlerMixin implements SaveHandlerBridge {
// @formatter:off
@Shadow(aliases = {"field_215773_b"}, remap = false) @Final private static Logger LOGGER;
@Shadow @Final private File playersDirectory;
@Shadow @Final private File field_215774_c;
@Shadow @Final private File worldDirectory;
// @formatter:on
private UUID uuid;
@ -65,7 +65,7 @@ public class SaveHandlerMixin implements SaveHandlerBridge {
public UUID getUUID() {
if (uuid != null) return uuid;
File file1 = new File(this.field_215774_c, "uid.dat");
File file1 = new File(this.worldDirectory, "uid.dat");
if (file1.exists()) {
try (DataInputStream dis = new DataInputStream(new FileInputStream(file1))) {
return uuid = new UUID(dis.readLong(), dis.readLong());

View File

@ -1,6 +1,11 @@
package io.izzel.arclight.common.mixin.core.world.storage;
import io.izzel.arclight.common.bridge.world.storage.WorldInfoBridge;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.play.server.SServerDifficultyPacket;
import net.minecraft.world.Difficulty;
import net.minecraft.world.World;
import net.minecraft.world.storage.WorldInfo;
import org.bukkit.Bukkit;
@ -19,10 +24,16 @@ public abstract class WorldInfoMixin implements WorldInfoBridge {
@Shadow private boolean raining;
@Shadow private boolean thundering;
@Shadow public abstract String getWorldName();
@Shadow public abstract boolean isDifficultyLocked();
// @formatter:on
public World world;
@Inject(method = "updateTagCompound", at = @At("RETURN"))
private void arclight$writeArclight(CompoundNBT nbt, CompoundNBT playerNbt, CallbackInfo ci) {
nbt.putString("Bukkit.Version", Bukkit.getName() + "/" + Bukkit.getVersion() + "/" + Bukkit.getBukkitVersion());
}
@Inject(method = "setThundering", cancellable = true, at = @At("HEAD"))
public void arclight$thunder(boolean thunderingIn, CallbackInfo ci) {
if (this.thundering == thunderingIn) {
@ -57,6 +68,14 @@ public abstract class WorldInfoMixin implements WorldInfoBridge {
}
}
@Inject(method = "setDifficulty", at = @At("RETURN"))
private void arclight$sendDiffChange(Difficulty newDifficulty, CallbackInfo ci) {
SServerDifficultyPacket packet = new SServerDifficultyPacket(newDifficulty, this.isDifficultyLocked());
for (PlayerEntity player : this.world.getPlayers()) {
((ServerPlayerEntity) player).connection.sendPacket(packet);
}
}
@Override
public void bridge$setWorld(World world) {
this.world = world;

View File

@ -2,22 +2,51 @@ package io.izzel.arclight.common.mixin.v1_15.block;
import net.minecraft.block.AbstractButtonBlock;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.BooleanProperty;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Random;
@Mixin(AbstractButtonBlock.class)
public class AbstractButtonBlockMixin_1_15 {
// @formatter:off
@Shadow @Final public static BooleanProperty POWERED;
// @formatter:on
@Inject(method = "onBlockActivated", cancellable = true, at = @At(value = "HEAD"))
public void arclight$blockRedstone1(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit, CallbackInfoReturnable<Boolean> cir) {
if (!state.get(POWERED)) {
boolean powered = state.get(POWERED);
Block block = CraftBlock.at(worldIn, pos);
int old = (powered) ? 15 : 0;
int current = (!powered) ? 15 : 0;
BlockRedstoneEvent event = new BlockRedstoneEvent(block, old, current);
Bukkit.getPluginManager().callEvent(event);
if ((event.getNewCurrent() > 0) == (powered)) {
cir.setReturnValue(true);
}
}
}
@Inject(method = "tick", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
private void arclight$blockRedstone2(BlockState state, ServerWorld worldIn, BlockPos pos, Random rand, CallbackInfo ci) {
Block block = CraftBlock.at(worldIn, pos);

View File

@ -3,6 +3,7 @@ package io.izzel.arclight.common.mixin.v1_15.block;
import net.minecraft.block.BlockState;
import net.minecraft.block.LeverBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.BooleanProperty;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
@ -11,19 +12,23 @@ import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(LeverBlock.class)
public class LeverBlockMixin_1_15 {
@Inject(method = "onBlockActivated", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD
, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/LeverBlock;setPowered(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;"))
public void arclight$blockRedstone(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit, CallbackInfoReturnable<Boolean> cir,
boolean flag) {
// @formatter:off
@Shadow @Final public static BooleanProperty POWERED;
// @formatter:on
@Inject(method = "onBlockActivated", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/LeverBlock;setPowered(Lnet/minecraft/block/BlockState;Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/block/BlockState;"))
public void arclight$blockRedstone(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit, CallbackInfoReturnable<Boolean> cir) {
boolean flag = state.get(POWERED);
Block block = CraftBlock.at(worldIn, pos);
int old = (flag) ? 15 : 0;
int current = (!flag) ? 15 : 0;

View File

@ -3,7 +3,6 @@ package io.izzel.arclight.common.mixin.v1_15.block;
import net.minecraft.block.BlockState;
import net.minecraft.block.MushroomBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.spongepowered.asm.mixin.Mixin;
@ -14,7 +13,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
public class MushroomBlockMixin_1_15 {
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
public boolean arclight$blockSpread(ServerWorld world, BlockPos toPos, BlockState newState, int flags, BlockState state, World worldIn, BlockPos fromPos) {
public boolean arclight$blockSpread(ServerWorld world, BlockPos toPos, BlockState newState, int flags, BlockState state, ServerWorld worldIn, BlockPos fromPos) {
return CraftEventFactory.handleBlockSpreadEvent(world, fromPos, toPos, newState, flags);
}
}

View File

@ -0,0 +1,19 @@
package io.izzel.arclight.common.mixin.v1_15.block;
import io.izzel.arclight.common.bridge.block.NoteBlockBridge;
import net.minecraft.block.BlockState;
import net.minecraft.block.NoteBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(NoteBlock.class)
public abstract class NoteBlockMixin_1_15 implements NoteBlockBridge {
@Redirect(method = "onBlockActivated", at = @At(value = "INVOKE", target = "Lnet/minecraft/block/NoteBlock;triggerNote(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;)V"))
public void arclight$callNote2(NoteBlock noteBlock, World worldIn, BlockPos pos, BlockState blockState) {
this.bridge$play(worldIn, pos, blockState);
}
}

View File

@ -4,7 +4,6 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.SpreadableSnowyDirtBlock;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.spongepowered.asm.mixin.Mixin;
@ -26,7 +25,7 @@ public class SpreadableSnowyDirtBlockMixin_1_15 {
}
@Redirect(method = "tick", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z"))
public boolean arclight$blockSpread(ServerWorld world, BlockPos to, BlockState state, BlockState state1, World worldIn, BlockPos from) {
public boolean arclight$blockSpread(ServerWorld world, BlockPos to, BlockState state, BlockState state1, ServerWorld worldIn, BlockPos from) {
return CraftEventFactory.handleBlockSpreadEvent(world, from, to, state);
}
}

View File

@ -2,10 +2,12 @@ package io.izzel.arclight.common.mixin.v1_15.entity;
import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.entity.InternalEntityBridge;
import io.izzel.arclight.common.bridge.world.WorldBridge;
import net.minecraft.block.pattern.BlockPattern;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.MoverType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.network.datasync.EntityDataManager;
import net.minecraft.server.MinecraftServer;
@ -19,13 +21,20 @@ import net.minecraft.world.gen.Heightmap;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.util.ITeleporter;
import org.bukkit.Bukkit;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v.CraftWorld;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.entity.EntityPortalEvent;
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import javax.annotation.Nullable;
import java.util.Random;
@ -42,7 +51,7 @@ public abstract class EntityMixin_1_15 implements EntityBridge {
@Shadow public float rotationYaw;
@Shadow public float rotationPitch;
@Shadow public abstract void setMotion(Vec3d motionIn);
@Shadow public abstract void remove(boolean keepData);
@Shadow(remap = false) public abstract void remove(boolean keepData);
@Shadow public abstract Vec3d getMotion();
@Shadow public abstract double getPosX();
@Shadow public abstract double getPosZ();
@ -56,13 +65,44 @@ public abstract class EntityMixin_1_15 implements EntityBridge {
@Shadow public abstract float getWidth();
@Shadow public abstract float getHeight();
@Shadow public abstract double getPosYEye();
@Shadow public abstract void setFlag(int flag, boolean set);
@Shadow public abstract Vec3d getPositionVec();
@Shadow(remap = false) public abstract void revive();
@Shadow public abstract void setWorld(World worldIn);
@Shadow public abstract int getEntityId();
@Shadow @Nullable public abstract Entity changeDimension(DimensionType destination);
@Shadow public boolean collidedHorizontally;
@Shadow protected abstract Vec3d getAllowedMovement(Vec3d vec);
// @formatter:on
@Inject(method = "move", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;canTriggerWalking()Z"))
private void arclight$move$blockCollide(MoverType typeIn, Vec3d pos, CallbackInfo ci) {
if (collidedHorizontally && this.bridge$getBukkitEntity() instanceof Vehicle) {
Vehicle vehicle = (Vehicle) this.bridge$getBukkitEntity();
org.bukkit.block.Block block = ((WorldBridge) this.world).bridge$getWorld().getBlockAt(MathHelper.floor(this.getPosX()), MathHelper.floor(this.getPosY()), MathHelper.floor(this.getPosZ()));
Vec3d vec3d = this.getAllowedMovement(pos);
if (pos.x > vec3d.x) {
block = block.getRelative(BlockFace.EAST);
} else if (vec3d.x < vec3d.x) {
block = block.getRelative(BlockFace.WEST);
} else if (pos.z > vec3d.z) {
block = block.getRelative(BlockFace.SOUTH);
} else if (pos.z < vec3d.z) {
block = block.getRelative(BlockFace.NORTH);
}
if (block.getType() != org.bukkit.Material.AIR) {
VehicleBlockCollisionEvent event = new VehicleBlockCollisionEvent(vehicle, block);
Bukkit.getPluginManager().callEvent(event);
}
}
}
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
@Overwrite(remap = false)
@Nullable
public Entity changeDimension(DimensionType destination, ITeleporter teleporter) {
BlockPos location = ((InternalEntityBridge) this).internal$capturedPos();

View File

@ -12,6 +12,7 @@ import net.minecraft.particles.ParticleTypes;
import net.minecraft.potion.Effect;
import net.minecraft.potion.EffectInstance;
import net.minecraft.util.DamageSource;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.PotionEvent;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
@ -27,10 +28,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.ConcurrentModificationException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@Mixin(LivingEntity.class)
public abstract class LivingEntityMixin_1_15 extends EntityMixin_1_15 implements LivingEntityBridge {
@ -49,6 +52,9 @@ public abstract class LivingEntityMixin_1_15 extends EntityMixin_1_15 implements
@Shadow @Nullable public abstract EffectInstance removeActivePotionEffect(@Nullable Effect potioneffectin);
@Shadow public int deathTime;
@Shadow protected abstract void createWitherRose(@Nullable LivingEntity p_226298_1_);
@Shadow public abstract Optional<BlockPos> getBedPosition();
@Shadow public abstract boolean isSleeping();
@Shadow public abstract Collection<EffectInstance> getActivePotionEffects();
// @formatter:on
/**

View File

@ -0,0 +1,41 @@
package io.izzel.arclight.common.mixin.v1_15.entity.monster;
import io.izzel.arclight.common.bridge.entity.monster.EndermanEntityBridge;
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.monster.EndermanEntity;
import net.minecraft.network.datasync.DataParameter;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(EndermanEntity.class)
public abstract class EndermanEntityMixin_1_15 extends CreatureEntityMixin implements EndermanEntityBridge {
// @formatter:off
@Shadow private int targetChangeTime;
@Shadow @Final private static DataParameter<Boolean> SCREAMING;
@Shadow @Final private static DataParameter<Boolean> field_226535_bx_;
@Shadow @Final private static AttributeModifier ATTACKING_SPEED_BOOST;
// @formatter:on
@Override
public void bridge$updateTarget(LivingEntity livingEntity) {
IAttributeInstance iattributeinstance = this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
if (livingEntity == null) {
this.targetChangeTime = 0;
this.dataManager.set(SCREAMING, false);
this.dataManager.set(field_226535_bx_, false);
iattributeinstance.removeModifier(ATTACKING_SPEED_BOOST);
} else {
this.targetChangeTime = this.ticksExisted;
this.dataManager.set(SCREAMING, true);
if (!iattributeinstance.hasModifier(ATTACKING_SPEED_BOOST)) {
iattributeinstance.applyModifier(ATTACKING_SPEED_BOOST);
}
}
}
}

View File

@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
@Mixin(targets = "net.minecraft.entity.passive.BeeEntity.FindPollinationTargetGoal")
public class BeeEntity_FindPollinationTargetGoalMixin {
@Shadow(aliases = {"this$0", "field_226483_b_"}) private BeeEntity outerThis;
@Shadow(aliases = {"this$0", "field_226483_b_"}, remap = false) private BeeEntity outerThis;
@Inject(method = "tick", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;playEvent(ILnet/minecraft/util/math/BlockPos;I)V"))
private void arclight$entityChangeBlock(CallbackInfo ci, int i, BlockPos blockPos, BlockState blockState, Block block, boolean flag, IntegerProperty property) {

View File

@ -4,7 +4,7 @@ import com.mojang.datafixers.util.Either;
import io.izzel.arclight.common.bridge.entity.InternalEntityBridge;
import io.izzel.arclight.common.bridge.entity.player.PlayerEntityBridge;
import io.izzel.arclight.common.bridge.world.WorldBridge;
import io.izzel.arclight.common.mixin.core.entity.LivingEntityMixin;
import io.izzel.arclight.common.mixin.v1_15.entity.LivingEntityMixin_1_15;
import net.minecraft.entity.player.PlayerAbilities;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Direction;
@ -29,7 +29,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(PlayerEntity.class)
public abstract class PlayerEntityMixin_1_15 extends LivingEntityMixin implements PlayerEntityBridge {
public abstract class PlayerEntityMixin_1_15 extends LivingEntityMixin_1_15 implements PlayerEntityBridge {
// @formatter:off
@Shadow public abstract Either<PlayerEntity.SleepResult, Unit> trySleep(BlockPos at);
@ -104,8 +104,8 @@ public abstract class PlayerEntityMixin_1_15 extends LivingEntityMixin implement
@Inject(method = "stopSleepInBed", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/PlayerEntity;sleepTimer:I"))
private void arclight$wakeup(boolean flag, boolean flag1, CallbackInfo ci) {
BlockPos blockPos = this.getBedPosition().orElse(null);
if (this.getBukkitEntity() instanceof Player) {
Player player = (Player) this.getBukkitEntity();
if (this.bridge$getBukkitEntity() instanceof Player) {
Player player = (Player) this.bridge$getBukkitEntity();
Block bed;
if (blockPos != null) {
bed = CraftBlock.at(this.world, blockPos);

View File

@ -87,7 +87,7 @@ public abstract class ServerPlayerEntityMixin_1_15 extends PlayerEntityMixin_1_1
* @author IzzelAliz
* @reason
*/
@Overwrite
@Overwrite(remap = false)
@Nullable
public Entity changeDimension(DimensionType dim, ITeleporter teleporter) {
final DimensionType[] destination = {dim};
@ -152,9 +152,9 @@ public abstract class ServerPlayerEntityMixin_1_15 extends PlayerEntityMixin_1_1
}
}
Location enter = this.getBukkitEntity().getLocation();
Location enter = this.bridge$getBukkitEntity().getLocation();
Location exit = (serverworld1[0] == null) ? null : new Location(((ServerWorldBridge) serverworld1[0]).bridge$getWorld(), d0, d1, d2, f1, f);
PlayerPortalEvent event = new PlayerPortalEvent((Player) this.getBukkitEntity(), enter, exit, cause, 128, true, ((DimensionTypeBridge) destination[0]).bridge$getType() == DimensionType.THE_END ? 0 : 16);
PlayerPortalEvent event = new PlayerPortalEvent((Player) this.bridge$getBukkitEntity(), enter, exit, cause, 128, true, ((DimensionTypeBridge) destination[0]).bridge$getType() == DimensionType.THE_END ? 0 : 16);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled() || event.getTo() == null) {
return null;
@ -205,7 +205,7 @@ public abstract class ServerPlayerEntityMixin_1_15 extends PlayerEntityMixin_1_1
}
org.bukkit.World bworld = ((ServerWorldBridge) serverworld1[0]).bridge$getWorld();
PortalCreateEvent portalEvent = new PortalCreateEvent((List<BlockState>) (List) blockList.getList(), bworld, this.getBukkitEntity(), PortalCreateEvent.CreateReason.END_PLATFORM);
PortalCreateEvent portalEvent = new PortalCreateEvent((List<BlockState>) (List) blockList.getList(), bworld, this.bridge$getBukkitEntity(), PortalCreateEvent.CreateReason.END_PLATFORM);
Bukkit.getPluginManager().callEvent(portalEvent);
if (!portalEvent.isCancelled()) {
@ -240,7 +240,7 @@ public abstract class ServerPlayerEntityMixin_1_15 extends PlayerEntityMixin_1_1
serverworld.getProfiler().endSection();
final PlayerTeleportEvent tpEvent = new PlayerTeleportEvent((Player) this.getBukkitEntity(), enter, exit, cause);
final PlayerTeleportEvent tpEvent = new PlayerTeleportEvent((Player) this.bridge$getBukkitEntity(), enter, exit, cause);
Bukkit.getServer().getPluginManager().callEvent(tpEvent);
if (tpEvent.isCancelled() || tpEvent.getTo() == null) {
return null;
@ -295,7 +295,7 @@ public abstract class ServerPlayerEntityMixin_1_15 extends PlayerEntityMixin_1_1
this.lastFoodLevel = -1;
BasicEventHooks.firePlayerChangedDimensionEvent((ServerPlayerEntity) (Object) this, dimensiontype, destination[0]);
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent((Player) this.getBukkitEntity(), ((WorldBridge) serverworld).bridge$getWorld());
PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent((Player) this.bridge$getBukkitEntity(), ((WorldBridge) serverworld).bridge$getWorld());
Bukkit.getPluginManager().callEvent(changeEvent);
return (ServerPlayerEntity) (Object) this;
}

View File

@ -0,0 +1,18 @@
package io.izzel.arclight.common.mixin.v1_15.item;
import io.izzel.arclight.common.bridge.item.BlockItemBridge;
import net.minecraft.block.BlockState;
import net.minecraft.item.BlockItem;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(BlockItem.class)
public class BlockItemMixin_1_15 implements BlockItemBridge {
@Override
public boolean bridge$noCollisionInSel(World world, BlockState state, BlockPos pos, ISelectionContext context) {
return world.func_226663_a_(state, pos, context);
}
}

View File

@ -0,0 +1,29 @@
package io.izzel.arclight.common.mixin.v1_15.network.play;
import io.izzel.arclight.common.bridge.network.play.ServerPlayNetHandlerBridge;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.nbt.StringNBT;
import net.minecraft.network.play.ServerPlayNetHandler;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.server.ServerWorld;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(ServerPlayNetHandler.class)
public abstract class ServerPlayNetHandlerMixin_1_15 implements ServerPlayNetHandlerBridge {
@Override
public boolean bridge$worldNoCollision(ServerWorld world, Entity entity, AxisAlignedBB aabb) {
return world.hasNoCollisions(entity, aabb);
}
@Override
public StringNBT bridge$stringNbt(String s) {
return StringNBT.valueOf(s);
}
@Override
public void bridge$dropItems(ServerPlayerEntity player, boolean all) {
player.drop(all);
}
}

View File

@ -0,0 +1,126 @@
package io.izzel.arclight.common.mixin.v1_15.server.management;
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
import io.izzel.arclight.common.bridge.server.management.PlayerInteractionManagerBridge;
import net.minecraft.block.BlockState;
import net.minecraft.block.CakeBlock;
import net.minecraft.block.DoorBlock;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemUseContext;
import net.minecraft.network.play.client.CPlayerDiggingPacket;
import net.minecraft.network.play.server.SChangeBlockPacket;
import net.minecraft.network.play.server.SPlayerDiggingPacket;
import net.minecraft.server.management.PlayerInteractionManager;
import net.minecraft.state.properties.DoubleBlockHalf;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.GameType;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.common.ForgeHooks;
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
import org.bukkit.event.Event;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(PlayerInteractionManager.class)
public abstract class PlayerInteractionManagerMixin_1_15 implements PlayerInteractionManagerBridge {
// @formatter:off
@Shadow public abstract void func_229860_a_(BlockPos p_229860_1_, CPlayerDiggingPacket.Action p_229860_2_, String p_229860_3_);
@Shadow private GameType gameType;
@Shadow public abstract boolean isCreative();
@Shadow public ServerWorld world;
// @formatter:on
@Override
public SPlayerDiggingPacket bridge$diggingPacket(BlockPos pos, BlockState state, CPlayerDiggingPacket.Action action, boolean successful, String context) {
return new SPlayerDiggingPacket(pos, state, action, successful, context);
}
@Override
public void bridge$creativeHarvestBlock(BlockPos pos, CPlayerDiggingPacket.Action action, String context) {
this.func_229860_a_(pos, action, context);
}
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public ActionResultType func_219441_a(PlayerEntity playerIn, World worldIn, ItemStack stackIn, Hand handIn, BlockRayTraceResult blockRaytraceResultIn) {
BlockPos blockpos = blockRaytraceResultIn.getPos();
BlockState blockstate = worldIn.getBlockState(blockpos);
ActionResultType resultType = ActionResultType.PASS;
boolean cancelledBlock = false;
if (this.gameType == GameType.SPECTATOR) {
INamedContainerProvider provider = blockstate.getContainer(worldIn, blockpos);
cancelledBlock = !(provider instanceof INamedContainerProvider);
}
if (playerIn.getCooldownTracker().hasCooldown(stackIn.getItem())) {
cancelledBlock = true;
}
PlayerInteractEvent bukkitEvent = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, blockpos, blockRaytraceResultIn.getFace(), stackIn, cancelledBlock, handIn);
bridge$setFiredInteract(true);
bridge$setInteractResult(bukkitEvent.useItemInHand() == Event.Result.DENY);
if (bukkitEvent.useInteractedBlock() == Event.Result.DENY) {
if (blockstate.getBlock() instanceof DoorBlock) {
boolean bottom = blockstate.get(DoorBlock.HALF) == DoubleBlockHalf.LOWER;
((ServerPlayerEntity) playerIn).connection.sendPacket(new SChangeBlockPacket(this.world, bottom ? blockpos.up() : blockpos.down()));
} else if (blockstate.getBlock() instanceof CakeBlock) {
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().sendHealthUpdate();
}
((ServerPlayerEntityBridge) playerIn).bridge$getBukkitEntity().updateInventory();
resultType = ((bukkitEvent.useItemInHand() != Event.Result.ALLOW) ? ActionResultType.SUCCESS : ActionResultType.PASS);
} else if (this.gameType == GameType.SPECTATOR) {
INamedContainerProvider inamedcontainerprovider = blockstate.getContainer(worldIn, blockpos);
if (inamedcontainerprovider != null) {
playerIn.openContainer(inamedcontainerprovider);
return ActionResultType.SUCCESS;
} else {
return ActionResultType.PASS;
}
} else {
net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock event = ForgeHooks.onRightClickBlock(playerIn, handIn, blockpos, blockRaytraceResultIn.getFace());
if (event.isCanceled()) return event.getCancellationResult();
ItemUseContext itemusecontext = new ItemUseContext(playerIn, handIn, blockRaytraceResultIn);
if (event.getUseItem() != net.minecraftforge.eventbus.api.Event.Result.DENY) {
ActionResultType result = stackIn.onItemUseFirst(itemusecontext);
if (result != ActionResultType.PASS) return result;
}
boolean flag = !playerIn.getHeldItemMainhand().isEmpty() || !playerIn.getHeldItemOffhand().isEmpty();
boolean flag1 = (playerIn.isSecondaryUseActive() && flag) && !(playerIn.getHeldItemMainhand().doesSneakBypassUse(worldIn, blockpos, playerIn) && playerIn.getHeldItemOffhand().doesSneakBypassUse(worldIn, blockpos, playerIn));
if (event.getUseBlock() != net.minecraftforge.eventbus.api.Event.Result.DENY && !flag1) {
resultType = blockstate.onBlockActivated(worldIn, playerIn, handIn, blockRaytraceResultIn);
if (resultType.isSuccessOrConsume()) {
return resultType;
}
}
if (!stackIn.isEmpty() && resultType != ActionResultType.SUCCESS && !bridge$getInteractResult()) {
if (event.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY) {
return ActionResultType.PASS;
}
if (this.isCreative()) {
int i = stackIn.getCount();
resultType = stackIn.onItemUse(itemusecontext);
stackIn.setCount(i);
return resultType;
} else {
return stackIn.onItemUse(itemusecontext);
}
} else {
return resultType;
}
}
return resultType;
}
}

View File

@ -0,0 +1,32 @@
package io.izzel.arclight.common.mixin.v1_15.server.management;
import io.izzel.arclight.common.bridge.server.management.PlayerListBridge;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.play.server.SRespawnPacket;
import net.minecraft.server.management.PlayerList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.GameType;
import net.minecraft.world.WorldType;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
import org.spongepowered.asm.mixin.Mixin;
@Mixin(PlayerList.class)
public abstract class PlayerListMixin_1_15 implements PlayerListBridge {
@Override
public boolean bridge$worldNoCollision(ServerWorld world, Entity entity) {
return world.hasNoCollisions(entity);
}
@Override
public void bridge$setSpawnPoint(ServerPlayerEntity player, BlockPos pos, boolean flag, DimensionType type, boolean flag1) {
player.setSpawnPoint(pos, flag, flag1, type);
}
@Override
public SRespawnPacket bridge$respawnPacket(DimensionType type, long seed, WorldType worldType, GameType gameType) {
return new SRespawnPacket(type, seed, worldType, gameType);
}
}

View File

@ -0,0 +1,117 @@
package io.izzel.arclight.common.mixin.v1_15.tileentity;
import com.google.common.collect.Lists;
import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.world.WorldBridge;
import io.izzel.arclight.common.mixin.core.tileentity.TileEntityMixin;
import net.minecraft.block.BlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.passive.BeeEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tags.EntityTypeTags;
import net.minecraft.tileentity.BeehiveTileEntity;
import net.minecraft.world.World;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntityEnterBlockEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import javax.annotation.Nullable;
import java.util.List;
@Mixin(BeehiveTileEntity.class)
public abstract class BeehiveTileEntityMixin extends TileEntityMixin {
// @formatter:off
@Shadow @Final private List<BeehiveTileEntity.Bee> bees;
@Shadow protected abstract boolean releaseBee(BlockState p_226967_1_, CompoundNBT p_226967_2_, @Nullable List<Entity> p_226967_3_, BeehiveTileEntity.State p_226967_4_);
// @formatter:on
public int maxBees = 3;
/**
* @author IzzelAliz
* @reason
*/
@Overwrite
public boolean isFullOfBees() {
return this.bees.size() >= maxBees;
}
public List<Entity> tryReleaseBee(BlockState blockState, BeehiveTileEntity.State state, boolean force) {
List<Entity> list = Lists.newArrayList();
this.bees.removeIf(bee -> this.releaseBee(blockState, bee.entityData, list, state, force));
return list;
}
@Inject(method = "tryEnterHive(Lnet/minecraft/entity/Entity;ZI)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;stopRiding()V"))
private void arclight$beeEnterBlock(Entity entity, boolean p_226962_2_, int p_226962_3_, CallbackInfo ci) {
if (this.world != null) {
EntityEnterBlockEvent event = new EntityEnterBlockEvent(((EntityBridge) entity).bridge$getBukkitEntity(), CraftBlock.at(this.world, this.getPos()));
Bukkit.getPluginManager().callEvent(event);
if (event.isCancelled()) {
if (entity instanceof BeeEntity) {
((BeeEntity) entity).setStayOutOfHiveCountdown(400);
}
ci.cancel();
}
}
}
private boolean releaseBee(BlockState blockState, CompoundNBT nbt, @Nullable List<Entity> list, BeehiveTileEntity.State state, boolean force) {
arclight$force = force;
try {
return this.releaseBee(blockState, nbt, list, state);
} finally {
arclight$force = false;
}
}
private transient boolean arclight$force;
@Redirect(method = "releaseBee", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isNightTime()Z"))
private boolean arclight$bypassNightCheck(World world) {
return !arclight$force && world.isNightTime();
}
@Redirect(method = "releaseBee", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getType()Lnet/minecraft/entity/EntityType;"))
private EntityType<?> arclight$spawnFirst(Entity entity) {
EntityType<?> type = entity.getType();
if (type.isContained(EntityTypeTags.BEEHIVE_INHABITORS)) {
((WorldBridge) this.world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.BEEHIVE);
if (!this.world.addEntity(entity)) {
return EntityType.ITEM_FRAME;
} else {
return type;
}
}
return type;
}
@Redirect(method = "releaseBee", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addEntity(Lnet/minecraft/entity/Entity;)Z"))
private boolean arclight$addedBefore(World world, Entity entityIn) {
return true;
}
@Inject(method = "read", at = @At("RETURN"))
private void arclight$readMax(CompoundNBT compound, CallbackInfo ci) {
if (compound.contains("Bukkit.MaxEntities")) {
this.maxBees = compound.getInt("Bukkit.MaxEntities");
}
}
@Inject(method = "write", at = @At("RETURN"))
private void arclight$writeMax(CompoundNBT compound, CallbackInfoReturnable<CompoundNBT> cir) {
compound.putInt("Bukkit.MaxEntities", this.maxBees);
}
}

View File

@ -0,0 +1,274 @@
package io.izzel.arclight.common.mixin.v1_15.world;
import io.izzel.arclight.common.bridge.entity.EntityBridge;
import io.izzel.arclight.common.bridge.world.TeleporterBridge;
import io.izzel.arclight.common.bridge.world.WorldBridge;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.NetherPortalBlock;
import net.minecraft.block.pattern.BlockPattern;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.village.PointOfInterest;
import net.minecraft.village.PointOfInterestManager;
import net.minecraft.village.PointOfInterestType;
import net.minecraft.world.Teleporter;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.server.TicketType;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v.util.BlockStateListPopulator;
import org.bukkit.event.world.PortalCreateEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.Random;
import java.util.stream.Collectors;
@Mixin(Teleporter.class)
public abstract class TeleporterMixin_1_15 implements TeleporterBridge {
// @formatter:off
@Shadow @Final protected ServerWorld world;
@Shadow @Final protected Random random;
// @formatter:on
private transient BlockStateListPopulator arclight$populator;
@Redirect(method = "makePortal", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
public boolean arclight$portalPlace1(ServerWorld serverWorld, BlockPos pos, BlockState newState, int flags) {
if (arclight$populator == null) {
arclight$populator = new BlockStateListPopulator(serverWorld);
}
return arclight$populator.setBlockState(pos, newState, flags);
}
@Redirect(method = "makePortal", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z"))
public boolean arclight$portalPlace2(ServerWorld serverWorld, BlockPos pos, BlockState state) {
if (arclight$populator == null) {
arclight$populator = new BlockStateListPopulator(serverWorld);
}
return arclight$populator.setBlockState(pos, state, 3);
}
@Inject(method = "makePortal", at = @At("RETURN"))
@SuppressWarnings({"unchecked", "rawtypes"})
public void arclight$portalCreate(Entity entityIn, CallbackInfoReturnable<Boolean> cir) {
PortalCreateEvent event = new PortalCreateEvent((List) arclight$populator.getList(), ((WorldBridge) this.world).bridge$getWorld(),
((EntityBridge) entityIn).bridge$getBukkitEntity(), PortalCreateEvent.CreateReason.NETHER_PAIR);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
arclight$populator.updateList();
}
arclight$populator = null;
}
@Override
public boolean bridge$makePortal(Entity entityIn, BlockPos pos, int createRadius) {
return this.createPortal(entityIn, pos, createRadius);
}
public boolean createPortal(Entity entity, BlockPos createPosition, int createRadius) {
boolean flag = true;
double d0 = -1.0;
int i = createPosition.getX();
int j = createPosition.getY();
int k = createPosition.getZ();
int l = i;
int i2 = j;
int j2 = k;
int k2 = 0;
int l2 = this.random.nextInt(4);
BlockPos.Mutable blockposition_mutableblockposition = new BlockPos.Mutable();
for (int i3 = i - createRadius; i3 <= i + createRadius; ++i3) {
double d2 = i3 + 0.5 - createPosition.getX();
for (int j3 = k - createRadius; j3 <= k + createRadius; ++j3) {
double d3 = j3 + 0.5 - createPosition.getZ();
Label_0439:
for (int k3 = this.world.getActualHeight() - 1; k3 >= 0; --k3) {
if (this.world.isAirBlock(blockposition_mutableblockposition.setPos(i3, k3, j3))) {
while (k3 > 0 && this.world.isAirBlock(blockposition_mutableblockposition.setPos(i3, k3 - 1, j3))) {
--k3;
}
for (int i4 = l2; i4 < l2 + 4; ++i4) {
int l3 = i4 % 2;
int j4 = 1 - l3;
if (i4 % 4 >= 2) {
l3 = -l3;
j4 = -j4;
}
for (int l4 = 0; l4 < 3; ++l4) {
for (int i5 = 0; i5 < 4; ++i5) {
for (int k4 = -1; k4 < 4; ++k4) {
int k5 = i3 + (i5 - 1) * l3 + l4 * j4;
int j5 = k3 + k4;
int l5 = j3 + (i5 - 1) * j4 - l4 * l3;
blockposition_mutableblockposition.setPos(k5, j5, l5);
if (k4 < 0 && !this.world.getBlockState(blockposition_mutableblockposition).getMaterial().isSolid()) {
continue Label_0439;
}
if (k4 >= 0 && !this.world.isAirBlock(blockposition_mutableblockposition)) {
continue Label_0439;
}
}
}
}
double d4 = k3 + 0.5 - entity.getPosY();
double d5 = d2 * d2 + d4 * d4 + d3 * d3;
if (d0 < 0.0 || d5 < d0) {
d0 = d5;
l = i3;
i2 = k3;
j2 = j3;
k2 = i4 % 4;
}
}
}
}
}
}
if (d0 < 0.0) {
for (int i3 = i - createRadius; i3 <= i + createRadius; ++i3) {
double d2 = i3 + 0.5 - createPosition.getX();
for (int j3 = k - createRadius; j3 <= k + createRadius; ++j3) {
double d3 = j3 + 0.5 - createPosition.getZ();
Label_0812:
for (int k3 = this.world.getActualHeight() - 1; k3 >= 0; --k3) {
if (this.world.isAirBlock(blockposition_mutableblockposition.setPos(i3, k3, j3))) {
while (k3 > 0 && this.world.isAirBlock(blockposition_mutableblockposition.setPos(i3, k3 - 1, j3))) {
--k3;
}
for (int i4 = l2; i4 < l2 + 2; ++i4) {
int l3 = i4 % 2;
int j4 = 1 - l3;
for (int l4 = 0; l4 < 4; ++l4) {
for (int i5 = -1; i5 < 4; ++i5) {
int k4 = i3 + (l4 - 1) * l3;
int k5 = k3 + i5;
int j5 = j3 + (l4 - 1) * j4;
blockposition_mutableblockposition.setPos(k4, k5, j5);
if (i5 < 0 && !this.world.getBlockState(blockposition_mutableblockposition).getMaterial().isSolid()) {
continue Label_0812;
}
if (i5 >= 0 && !this.world.isAirBlock(blockposition_mutableblockposition)) {
continue Label_0812;
}
}
}
double d4 = k3 + 0.5 - entity.getPosY();
double d5 = d2 * d2 + d4 * d4 + d3 * d3;
if (d0 < 0.0 || d5 < d0) {
d0 = d5;
l = i3;
i2 = k3;
j2 = j3;
k2 = i4 % 2;
}
}
}
}
}
}
}
int i6 = l;
int j6 = i2;
int j3 = j2;
int k6 = k2 % 2;
int l6 = 1 - k6;
if (k2 % 4 >= 2) {
k6 = -k6;
l6 = -l6;
}
BlockStateListPopulator blockList = new BlockStateListPopulator(this.world);
if (d0 < 0.0) {
i2 = (j6 = MathHelper.clamp(i2, 70, this.world.getActualHeight() - 10));
for (int k3 = -1; k3 <= 1; ++k3) {
for (int i4 = 1; i4 < 3; ++i4) {
for (int l3 = -1; l3 < 3; ++l3) {
int j4 = i6 + (i4 - 1) * k6 + k3 * l6;
int l4 = j6 + l3;
int i5 = j3 + (i4 - 1) * l6 - k3 * k6;
boolean flag2 = l3 < 0;
blockposition_mutableblockposition.setPos(j4, l4, i5);
blockList.setBlockState(blockposition_mutableblockposition, flag2 ? Blocks.OBSIDIAN.getDefaultState() : Blocks.AIR.getDefaultState(), 3);
}
}
}
}
for (int k3 = -1; k3 < 3; ++k3) {
for (int i4 = -1; i4 < 4; ++i4) {
if (k3 == -1 || k3 == 2 || i4 == -1 || i4 == 3) {
blockposition_mutableblockposition.setPos(i6 + k3 * k6, j6 + i4, j3 + k3 * l6);
blockList.setBlockState(blockposition_mutableblockposition, Blocks.OBSIDIAN.getDefaultState(), 3);
}
}
}
BlockState iblockdata = (Blocks.NETHER_PORTAL.getDefaultState()).with(NetherPortalBlock.AXIS, (k6 == 0) ? Direction.Axis.Z : Direction.Axis.X);
for (int i4 = 0; i4 < 2; ++i4) {
for (int l3 = 0; l3 < 3; ++l3) {
blockposition_mutableblockposition.setPos(i6 + i4 * k6, j6 + l3, j3 + i4 * l6);
blockList.setBlockState(blockposition_mutableblockposition, iblockdata, 18);
}
}
org.bukkit.World bworld = ((WorldBridge) this.world).bridge$getWorld();
PortalCreateEvent event = new PortalCreateEvent((List) blockList.getList(), bworld, ((EntityBridge) entity).bridge$getBukkitEntity(), PortalCreateEvent.CreateReason.NETHER_PAIR);
Bukkit.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
blockList.updateList();
}
return true;
}
public BlockPattern.PortalInfo findAndTeleport(Entity p_222268_1_, BlockPos pos, float p_222268_2_, int searchRadius, boolean searchOnly) {
Vec3d vec3d = p_222268_1_.getLastPortalVec();
Direction direction = p_222268_1_.getTeleportDirection();
BlockPattern.PortalInfo portalInfo = this.findPortal(new BlockPos(p_222268_1_), p_222268_1_.getMotion(), direction, vec3d.x, vec3d.y, p_222268_1_ instanceof PlayerEntity, searchRadius);
if (searchOnly) return portalInfo;
if (portalInfo == null) {
return null;
} else {
Vec3d vec3d1 = portalInfo.pos;
Vec3d vec3d2 = portalInfo.motion;
p_222268_1_.setMotion(vec3d2);
p_222268_1_.rotationYaw = p_222268_2_ + (float) portalInfo.rotation;
p_222268_1_.moveForced(vec3d1.x, vec3d1.y, vec3d1.z);
return portalInfo;
}
}
@Override
public BlockPattern.PortalInfo bridge$placeInPortal(Entity p_222268_1_, BlockPos pos, float p_222268_2_, int searchRadius, boolean searchOnly) {
return findAndTeleport(p_222268_1_, pos, p_222268_2_, searchRadius, searchOnly);
}
public BlockPattern.PortalInfo findPortal(BlockPos p_222272_1_, Vec3d p_222272_2_, Direction directionIn, double p_222272_4_, double p_222272_6_, boolean p_222272_8_, int searchRadius) {
PointOfInterestManager pointofinterestmanager = this.world.getPointOfInterestManager();
pointofinterestmanager.ensureLoadedAndValid(this.world, p_222272_1_, 128);
List<PointOfInterest> list = pointofinterestmanager.getInSquare((p_226705_0_) -> {
return p_226705_0_ == PointOfInterestType.NETHER_PORTAL;
}, p_222272_1_, searchRadius, PointOfInterestManager.Status.ANY).collect(Collectors.toList());
Optional<PointOfInterest> optional = list.stream().min(Comparator.<PointOfInterest>comparingDouble((p_226706_1_) -> {
return p_226706_1_.getPos().distanceSq(p_222272_1_);
}).thenComparingInt((p_226704_0_) -> {
return p_226704_0_.getPos().getY();
}));
return optional.map((p_226707_7_) -> {
BlockPos blockpos = p_226707_7_.getPos();
this.world.getChunkProvider().registerTicket(TicketType.PORTAL, new ChunkPos(blockpos), 3, blockpos);
BlockPattern.PatternHelper blockpattern$patternhelper = NetherPortalBlock.createPatternHelper(this.world, blockpos);
return blockpattern$patternhelper.getPortalInfo(directionIn, blockpos, p_222272_6_, p_222272_2_, p_222272_4_);
}).orElse(null);
}
}

View File

@ -0,0 +1,18 @@
package io.izzel.arclight.common.mixin.v1_15.world;
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
import net.minecraft.world.World;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(World.class)
public class WorldMixin_1_14 {
@Redirect(method = "isNightTime", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/dimension/Dimension;getType()Lnet/minecraft/world/dimension/DimensionType;"))
private DimensionType arclight$nightTimeType(Dimension dimension) {
return ((DimensionTypeBridge) dimension.getType()).bridge$getType();
}
}

View File

@ -27,6 +27,11 @@ public class DimensionTypeMixin_1_15 implements DimensionTypeBridge {
return (type == null) ? (DimensionType) (Object) this : type;
}
@Override
public void bridge$setType(DimensionType type) {
this.type = type;
}
@Override
public DimensionType bridge$getType() {
return getType();

View File

@ -0,0 +1,24 @@
package io.izzel.arclight.common.mixin.v1_15.world.gen.feature.structure;
import io.izzel.arclight.common.bridge.world.IWorldWriterBridge;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.MutableBoundingBox;
import net.minecraft.world.IWorld;
import net.minecraft.world.gen.ChunkGenerator;
import net.minecraft.world.gen.feature.structure.SwampHutPiece;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Random;
@Mixin(SwampHutPiece.class)
public class SwampHutPieceMixin_1_15 {
@Inject(method = "create", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/IWorld;addEntity(Lnet/minecraft/entity/Entity;)Z"))
public void arclight$spawnReason(IWorld worldIn, ChunkGenerator<?> chunkGeneratorIn, Random randomIn, MutableBoundingBox mutableBoundingBoxIn, ChunkPos chunkPosIn, CallbackInfoReturnable<Boolean> cir) {
((IWorldWriterBridge) worldIn).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
}
}

View File

@ -0,0 +1,38 @@
package io.izzel.arclight.common.mixin.v1_15.world.server;
import io.izzel.arclight.common.mixin.core.world.server.ServerWorldMixin;
import net.minecraft.profiler.IProfiler;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.border.IBorderListener;
import net.minecraft.world.chunk.listener.IChunkStatusListener;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerMultiWorld;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.SaveHandler;
import net.minecraft.world.storage.WorldInfo;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import java.util.concurrent.Executor;
@Mixin(ServerMultiWorld.class)
public abstract class ServerMultiWorldMixin_1_15 extends ServerWorldMixin {
// @formatter:off
@Shadow(remap = false) @Final @Mutable private ServerWorld delegate;
@Shadow(remap = false) @Final @Mutable private IBorderListener borderListener;
// @formatter:on
public void arclight$constructor$super(MinecraftServer serverIn, Executor executor, SaveHandler saveHandler, WorldInfo worldInfo, DimensionType dimType, IProfiler profiler, IChunkStatusListener listener, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
throw new RuntimeException();
}
public void arclight$constructor(ServerWorld world, MinecraftServer serverIn, Executor executor, SaveHandler saveHandler, DimensionType dimType, IProfiler profiler, IChunkStatusListener listener, WorldInfo worldInfo, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
arclight$constructor$super(serverIn, executor, saveHandler, worldInfo, dimType, profiler, listener, gen, env);
this.delegate = world;
this.borderListener = new IBorderListener.Impl(this.getWorldBorder());
world.getWorldBorder().addListener(this.borderListener);
}
}

View File

@ -0,0 +1,47 @@
package io.izzel.arclight.common.mixin.v1_15.world.server;
import io.izzel.arclight.common.bridge.world.server.ServerWorldBridge;
import io.izzel.arclight.common.mixin.core.world.WorldMixin;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.world.server.ServerWorld;
import org.bukkit.Bukkit;
import org.bukkit.event.world.TimeSkipEvent;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.List;
@Mixin(ServerWorld.class)
public abstract class ServerWorldMixin_1_15 extends WorldMixin implements ServerWorldBridge {
// @formatter:off
@Shadow private boolean allPlayersSleeping;
@Shadow @Final private List<ServerPlayerEntity> players;
@Shadow protected abstract void wakeUpAllPlayers();
// @formatter:on
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setDayTime(J)V"))
private void arclight$timeSkip(ServerWorld world, long time) {
TimeSkipEvent event = new TimeSkipEvent(this.bridge$getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (time - time % 24000L) - this.getDayTime());
Bukkit.getPluginManager().callEvent(event);
arclight$timeSkipCancelled = event.isCancelled();
if (!event.isCancelled()) {
world.setDayTime(this.getDayTime() + event.getSkipAmount());
this.allPlayersSleeping = this.players.stream().allMatch(LivingEntity::isSleeping);
}
}
private transient boolean arclight$timeSkipCancelled;
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;wakeUpAllPlayers()V"))
private void arclight$notWakeIfCancelled(ServerWorld world) {
if (!arclight$timeSkipCancelled) {
this.wakeUpAllPlayers();
}
arclight$timeSkipCancelled = false;
}
}

View File

@ -0,0 +1,19 @@
package io.izzel.arclight.common.mixin.v1_15.world.storage;
import io.izzel.arclight.common.bridge.world.storage.MapDataBridge;
import net.minecraft.world.World;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.storage.MapData;
import org.spongepowered.asm.mixin.Mixin;
import java.util.function.BiFunction;
@Mixin(MapData.class)
public abstract class MapDataMixin_1_15 implements MapDataBridge {
@Override
public DimensionType bridge$dimension(int id, String suffix, String dir, BiFunction<World, DimensionType, ? extends Dimension> provider, boolean skyLight) {
return new DimensionType(id, suffix, dir, provider, skyLight, null, null, null);
}
}

View File

@ -1,27 +1,33 @@
package io.izzel.arclight.common.mod;
import cpw.mods.modlauncher.api.ITransformingClassLoader;
import io.izzel.arclight.api.ArclightVersion;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.Mixins;
import org.spongepowered.asm.mixin.connect.IMixinConnector;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
public class ArclightConnector implements IMixinConnector {
public static final Logger LOGGER = LogManager.getLogger("Arclight");
private static final List<String> FILTER_PACKAGE = Arrays.asList("com.google.common", "com.google.gson", "ninja.leaping.configurate", "io.izzel.arclight.api");
@Override
public void connect() {
((ITransformingClassLoader) Thread.currentThread().getContextClassLoader()).addTargetPackageFilter(
s -> FILTER_PACKAGE.stream().noneMatch(s::startsWith)
);
Mixins.addConfiguration("mixins.arclight.core.json");
Mixins.addConfiguration("mixins.arclight.bukkit.json");
Mixins.addConfiguration("mixins.arclight.forge.json");
if (ArclightVersion.atLeast(ArclightVersion.v1_15)) {
Mixins.addConfiguration("mixins.arclight.core.1_15.json");
}
LOGGER.info("Arclight core mixin added.");
ArclightConfig.init(Paths.get("arclight.yml"));
Mixins.addConfiguration("mixins.arclight.optimization.json");
if (ArclightConfig.INSTANCE.optimizations.removeStreams) {
Mixins.addConfiguration("mixins.arclight.optimization.stream.json");
}
LOGGER.info("Arclight optimization mixin added.");
}
}

View File

@ -13,8 +13,8 @@ import java.util.Comparator;
public class ArclightConstants {
public static final TicketType<Unit> PLUGIN = TicketType.func_219484_a("plugin", (a, b) -> 0);
public static final TicketType<Plugin> PLUGIN_TICKET = TicketType.func_219484_a("plugin_ticket", Comparator.comparing(it -> it.getClass().getName()));
public static final TicketType<Unit> PLUGIN = TicketType.create("plugin", (a, b) -> 0);
public static final TicketType<Plugin> PLUGIN_TICKET = TicketType.create("plugin_ticket", Comparator.comparing(it -> it.getClass().getName()));
public static final TreeType MOD = EnumHelper.addEnum(TreeType.class, "MOD", ImmutableList.of(), ImmutableList.of());

View File

@ -1,568 +0,0 @@
package io.izzel.arclight.common.mod.util;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.crash.CrashReport;
import net.minecraft.crash.CrashReportCategory;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityPredicate;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.crafting.RecipeManager;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.IPacket;
import net.minecraft.particles.IParticleData;
import net.minecraft.profiler.IProfiler;
import net.minecraft.scoreboard.Scoreboard;
import net.minecraft.server.MinecraftServer;
import net.minecraft.tags.NetworkTagManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceContext;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.Difficulty;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.Explosion;
import net.minecraft.world.GameRules;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraft.world.WorldType;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.border.WorldBorder;
import net.minecraft.world.chunk.AbstractChunkProvider;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.ChunkStatus;
import net.minecraft.world.chunk.IChunk;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.gen.Heightmap;
import net.minecraft.world.storage.MapData;
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityDispatcher;
import net.minecraftforge.common.capabilities.CapabilityProvider;
import net.minecraftforge.common.util.LazyOptional;
import org.bukkit.craftbukkit.v.util.BlockStateListPopulator;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.UUID;
import java.util.function.BiFunction;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;
@SuppressWarnings("unused")
public class ArclightBlockPopulator extends BlockStateListPopulator {
public ArclightBlockPopulator(World world) {
super(world);
}
public Biome getBiome(BlockPos pos) {return getWorld().getBiome(pos);}
public Biome getBiomeBody(BlockPos pos) {return getWorld().getBiomeBody(pos);}
public boolean isRemote() {return getWorld().isRemote();}
@Nullable
public MinecraftServer getServer() {return getWorld().getServer();}
@OnlyIn(Dist.CLIENT)
public void setInitialSpawnLocation() {getWorld().setInitialSpawnLocation();}
public BlockState getGroundAboveSeaLevel(BlockPos pos) {return getWorld().getGroundAboveSeaLevel(pos);}
public static boolean isValid(BlockPos pos) {return World.isValid(pos);}
public static boolean isOutsideBuildHeight(BlockPos pos) {return World.isOutsideBuildHeight(pos);}
public static boolean isYOutOfBounds(int y) {return World.isYOutOfBounds(y);}
public Chunk getChunkAt(BlockPos pos) {return getWorld().getChunkAt(pos);}
@Override
public Chunk getChunk(int chunkX, int chunkZ) {return getWorld().getChunk(chunkX, chunkZ);}
public IChunk getChunk(int x, int z, ChunkStatus requiredStatus, boolean nonnull) {return getWorld().getChunk(x, z, requiredStatus, nonnull);}
public void markAndNotifyBlock(BlockPos pos, @Nullable Chunk chunk, BlockState blockstate, BlockState newState, int flags) {getWorld().markAndNotifyBlock(pos, chunk, blockstate, newState, flags);}
public void onBlockStateChange(BlockPos p_217393_1_, BlockState p_217393_2_, BlockState p_217393_3_) {getWorld().onBlockStateChange(p_217393_1_, p_217393_2_, p_217393_3_);}
public boolean removeBlock(BlockPos pos, boolean isMoving) {return getWorld().removeBlock(pos, isMoving);}
public boolean destroyBlock(BlockPos pos, boolean dropBlock) {return getWorld().destroyBlock(pos, dropBlock);}
public boolean setBlockState(BlockPos pos, BlockState state) {return getWorld().setBlockState(pos, state);}
public void notifyBlockUpdate(BlockPos pos, BlockState oldState, BlockState newState, int flags) {getWorld().notifyBlockUpdate(pos, oldState, newState, flags);}
public void notifyNeighbors(BlockPos pos, Block blockIn) {getWorld().notifyNeighbors(pos, blockIn);}
public void func_225319_b(BlockPos p_225319_1_, BlockState p_225319_2_, BlockState p_225319_3_) {getWorld().func_225319_b(p_225319_1_, p_225319_2_, p_225319_3_);}
public void notifyNeighborsOfStateChange(BlockPos pos, Block blockIn) {getWorld().notifyNeighborsOfStateChange(pos, blockIn);}
public void notifyNeighborsOfStateExcept(BlockPos pos, Block blockType, Direction skipSide) {getWorld().notifyNeighborsOfStateExcept(pos, blockType, skipSide);}
public void neighborChanged(BlockPos pos, Block blockIn, BlockPos fromPos) {getWorld().neighborChanged(pos, blockIn, fromPos);}
public int getLightSubtracted(BlockPos pos, int amount) {return getWorld().getLightSubtracted(pos, amount);}
public int getHeight(Heightmap.Type heightmapType, int x, int z) {return getWorld().getHeight(heightmapType, x, z);}
public int getLightFor(LightType type, BlockPos pos) {return getWorld().getLightFor(type, pos);}
public boolean isDaytime() {return getWorld().isDaytime();}
public void playSound(@Nullable PlayerEntity player, BlockPos pos, SoundEvent soundIn, SoundCategory category, float volume, float pitch) {getWorld().playSound(player, pos, soundIn, category, volume, pitch);}
public void playSound(@Nullable PlayerEntity player, double x, double y, double z, SoundEvent soundIn, SoundCategory category, float volume, float pitch) {getWorld().playSound(player, x, y, z, soundIn, category, volume, pitch);}
public void playMovingSound(@Nullable PlayerEntity p_217384_1_, Entity p_217384_2_, SoundEvent p_217384_3_, SoundCategory p_217384_4_, float p_217384_5_, float p_217384_6_) {getWorld().playMovingSound(p_217384_1_, p_217384_2_, p_217384_3_, p_217384_4_, p_217384_5_, p_217384_6_);}
public void playSound(double x, double y, double z, SoundEvent soundIn, SoundCategory category, float volume, float pitch, boolean distanceDelay) {getWorld().playSound(x, y, z, soundIn, category, volume, pitch, distanceDelay);}
public void addParticle(IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {getWorld().addParticle(particleData, x, y, z, xSpeed, ySpeed, zSpeed);}
@OnlyIn(Dist.CLIENT)
public void addParticle(IParticleData particleData, boolean forceAlwaysRender, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {getWorld().addParticle(particleData, forceAlwaysRender, x, y, z, xSpeed, ySpeed, zSpeed);}
public void addOptionalParticle(IParticleData particleData, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {getWorld().addOptionalParticle(particleData, x, y, z, xSpeed, ySpeed, zSpeed);}
public void addOptionalParticle(IParticleData particleData, boolean ignoreRange, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {getWorld().addOptionalParticle(particleData, ignoreRange, x, y, z, xSpeed, ySpeed, zSpeed);}
public float getSunBrightness(float partialTicks) {return getWorld().getSunBrightness(partialTicks);}
public float getSunBrightnessBody(float partialTicks) {return getWorld().getSunBrightnessBody(partialTicks);}
@OnlyIn(Dist.CLIENT)
public Vec3d getSkyColor(BlockPos p_217382_1_, float p_217382_2_) {return getWorld().getSkyColor(p_217382_1_, p_217382_2_);}
@OnlyIn(Dist.CLIENT)
public Vec3d getSkyColorBody(BlockPos p_217382_1_, float p_217382_2_) {return getWorld().getSkyColorBody(p_217382_1_, p_217382_2_);}
public float getCelestialAngleRadians(float partialTicks) {return getWorld().getCelestialAngleRadians(partialTicks);}
@OnlyIn(Dist.CLIENT)
public Vec3d getCloudColour(float partialTicks) {return getWorld().getCloudColour(partialTicks);}
@OnlyIn(Dist.CLIENT)
public Vec3d getCloudColorBody(float partialTicks) {return getWorld().getCloudColorBody(partialTicks);}
@OnlyIn(Dist.CLIENT)
public Vec3d getFogColor(float partialTicks) {return getWorld().getFogColor(partialTicks);}
@OnlyIn(Dist.CLIENT)
public float getStarBrightness(float partialTicks) {return getWorld().getStarBrightness(partialTicks);}
@OnlyIn(Dist.CLIENT)
public float getStarBrightnessBody(float partialTicks) {return getWorld().getStarBrightnessBody(partialTicks);}
public boolean addTileEntity(TileEntity tile) {return getWorld().addTileEntity(tile);}
public void addTileEntities(Collection<TileEntity> tileEntityCollection) {getWorld().addTileEntities(tileEntityCollection);}
public void tickBlockEntities() {getWorld().tickBlockEntities();}
public void guardEntityTick(Consumer<Entity> p_217390_1_, Entity p_217390_2_) {getWorld().guardEntityTick(p_217390_1_, p_217390_2_);}
public boolean checkBlockCollision(AxisAlignedBB bb) {return getWorld().checkBlockCollision(bb);}
public boolean isFlammableWithin(AxisAlignedBB bb) {return getWorld().isFlammableWithin(bb);}
@OnlyIn(Dist.CLIENT)
@Nullable
public BlockState findBlockstateInArea(AxisAlignedBB area, Block blockIn) {return getWorld().findBlockstateInArea(area, blockIn);}
public boolean isMaterialInBB(AxisAlignedBB bb, Material materialIn) {return getWorld().isMaterialInBB(bb, materialIn);}
public Explosion createExplosion(@Nullable Entity entityIn, double xIn, double yIn, double zIn, float explosionRadius, Explosion.Mode modeIn) {return getWorld().createExplosion(entityIn, xIn, yIn, zIn, explosionRadius, modeIn);}
public Explosion createExplosion(@Nullable Entity entityIn, double xIn, double yIn, double zIn, float explosionRadius, boolean causesFire, Explosion.Mode modeIn) {return getWorld().createExplosion(entityIn, xIn, yIn, zIn, explosionRadius, causesFire, modeIn);}
public Explosion createExplosion(@Nullable Entity entityIn, @Nullable DamageSource damageSourceIn, double xIn, double yIn, double zIn, float explosionRadius, boolean causesFire, Explosion.Mode modeIn) {return getWorld().createExplosion(entityIn, damageSourceIn, xIn, yIn, zIn, explosionRadius, causesFire, modeIn);}
public boolean extinguishFire(@Nullable PlayerEntity player, BlockPos pos, Direction side) {return getWorld().extinguishFire(player, pos, side);}
@OnlyIn(Dist.CLIENT)
public String getProviderName() {return getWorld().getProviderName();}
@Nullable
public TileEntity getTileEntity(BlockPos pos) {return getWorld().getTileEntity(pos);}
public void setTileEntity(BlockPos pos, @Nullable TileEntity tileEntityIn) {getWorld().setTileEntity(pos, tileEntityIn);}
public void removeTileEntity(BlockPos pos) {getWorld().removeTileEntity(pos);}
public boolean isBlockPresent(BlockPos pos) {return getWorld().isBlockPresent(pos);}
public boolean isTopSolid(BlockPos p_217400_1_, Entity p_217400_2_) {return getWorld().isTopSolid(p_217400_1_, p_217400_2_);}
public void calculateInitialSkylight() {getWorld().calculateInitialSkylight();}
public void setAllowedSpawnTypes(boolean hostile, boolean peaceful) {getWorld().setAllowedSpawnTypes(hostile, peaceful);}
public void calculateInitialWeatherBody() {getWorld().calculateInitialWeatherBody();}
public void close() throws IOException {getWorld().close();}
@Override
public ChunkStatus getChunkStatus() {return getWorld().getChunkStatus();}
public List<Entity> getEntitiesInAABBexcluding(@Nullable Entity entityIn, AxisAlignedBB boundingBox, @Nullable Predicate<? super Entity> predicate) {return getWorld().getEntitiesInAABBexcluding(entityIn, boundingBox, predicate);}
public List<Entity> getEntitiesWithinAABB(@Nullable EntityType<?> type, AxisAlignedBB boundingBox, Predicate<? super Entity> predicate) {return getWorld().getEntitiesWithinAABB(type, boundingBox, predicate);}
public <T extends Entity> List<T> getEntitiesWithinAABB(Class<? extends T> clazz, AxisAlignedBB aabb, @Nullable Predicate<? super T> filter) {return getWorld().getEntitiesWithinAABB(clazz, aabb, filter);}
@Override
public <T extends Entity> List<T> func_225316_b(Class<? extends T> p_225316_1_, AxisAlignedBB p_225316_2_, @Nullable Predicate<? super T> p_225316_3_) {return getWorld().func_225316_b(p_225316_1_, p_225316_2_, p_225316_3_);}
@Nullable
public Entity getEntityByID(int id) {return getWorld().getEntityByID(id);}
public void markChunkDirty(BlockPos pos, TileEntity unusedTileEntity) {getWorld().markChunkDirty(pos, unusedTileEntity);}
public int getSeaLevel() {return getWorld().getSeaLevel();}
public WorldType getWorldType() {return getWorld().getWorldType();}
public int getStrongPower(BlockPos pos) {return getWorld().getStrongPower(pos);}
public boolean isSidePowered(BlockPos pos, Direction side) {return getWorld().isSidePowered(pos, side);}
public int getRedstonePower(BlockPos pos, Direction facing) {return getWorld().getRedstonePower(pos, facing);}
public boolean isBlockPowered(BlockPos pos) {return getWorld().isBlockPowered(pos);}
public int getRedstonePowerFromNeighbors(BlockPos pos) {return getWorld().getRedstonePowerFromNeighbors(pos);}
@OnlyIn(Dist.CLIENT)
public void sendQuittingDisconnectingPacket() {getWorld().sendQuittingDisconnectingPacket();}
public void setGameTime(long worldTime) {getWorld().setGameTime(worldTime);}
public long getSeed() {return getWorld().getSeed();}
public long getGameTime() {return getWorld().getGameTime();}
public long getDayTime() {return getWorld().getDayTime();}
public void setDayTime(long time) {getWorld().setDayTime(time);}
@Override
public BlockPos getSpawnPoint() {return getWorld().getSpawnPoint();}
public void setSpawnPoint(BlockPos pos) {getWorld().setSpawnPoint(pos);}
public boolean isBlockModifiable(PlayerEntity player, BlockPos pos) {return getWorld().isBlockModifiable(player, pos);}
public boolean canMineBlockBody(PlayerEntity player, BlockPos pos) {return getWorld().canMineBlockBody(player, pos);}
public void setEntityState(Entity entityIn, byte state) {getWorld().setEntityState(entityIn, state);}
public AbstractChunkProvider getChunkProvider() {return getWorld().getChunkProvider();}
public void addBlockEvent(BlockPos pos, Block blockIn, int eventID, int eventParam) {getWorld().addBlockEvent(pos, blockIn, eventID, eventParam);}
public WorldInfo getWorldInfo() {return getWorld().getWorldInfo();}
public GameRules getGameRules() {return getWorld().getGameRules();}
public float getThunderStrength(float delta) {return getWorld().getThunderStrength(delta);}
@OnlyIn(Dist.CLIENT)
public void setThunderStrength(float strength) {getWorld().setThunderStrength(strength);}
public float getRainStrength(float delta) {return getWorld().getRainStrength(delta);}
@OnlyIn(Dist.CLIENT)
public void setRainStrength(float strength) {getWorld().setRainStrength(strength);}
public boolean isThundering() {return getWorld().isThundering();}
public boolean isRaining() {return getWorld().isRaining();}
public boolean isRainingAt(BlockPos position) {return getWorld().isRainingAt(position);}
public boolean isBlockinHighHumidity(BlockPos pos) {return getWorld().isBlockinHighHumidity(pos);}
@Nullable
public MapData getMapData(String mapName) {return getWorld().getMapData(mapName);}
public void registerMapData(MapData mapDataIn) {getWorld().registerMapData(mapDataIn);}
public int getNextMapId() {return getWorld().getNextMapId();}
public void playBroadcastSound(int id, BlockPos pos, int data) {getWorld().playBroadcastSound(id, pos, data);}
public int getActualHeight() {return getWorld().getActualHeight();}
public double getHorizon() {return getWorld().getHorizon();}
public CrashReportCategory fillCrashReport(CrashReport report) {return getWorld().fillCrashReport(report);}
public void sendBlockBreakProgress(int breakerId, BlockPos pos, int progress) {getWorld().sendBlockBreakProgress(breakerId, pos, progress);}
@OnlyIn(Dist.CLIENT)
public void makeFireworks(double x, double y, double z, double motionX, double motionY, double motionZ, @Nullable CompoundNBT compound) {getWorld().makeFireworks(x, y, z, motionX, motionY, motionZ, compound);}
public Scoreboard getScoreboard() {return getWorld().getScoreboard();}
public void updateComparatorOutputLevel(BlockPos pos, Block blockIn) {getWorld().updateComparatorOutputLevel(pos, blockIn);}
public DifficultyInstance getDifficultyForLocation(BlockPos pos) {return getWorld().getDifficultyForLocation(pos);}
public int getSkylightSubtracted() {return getWorld().getSkylightSubtracted();}
@OnlyIn(Dist.CLIENT)
public int getLastLightningBolt() {return getWorld().getLastLightningBolt();}
public void setLastLightningBolt(int lastLightningBoltIn) {getWorld().setLastLightningBolt(lastLightningBoltIn);}
public WorldBorder getWorldBorder() {return getWorld().getWorldBorder();}
public void sendPacketToServer(IPacket<?> packetIn) {getWorld().sendPacketToServer(packetIn);}
@Nullable
public BlockPos findNearestStructure(String name, BlockPos pos, int radius, boolean p_211157_4_) {return getWorld().findNearestStructure(name, pos, radius, p_211157_4_);}
public Dimension getDimension() {return getWorld().getDimension();}
public Random getRandom() {return getWorld().getRandom();}
public boolean hasBlockState(BlockPos p_217375_1_, Predicate<BlockState> p_217375_2_) {return getWorld().hasBlockState(p_217375_1_, p_217375_2_);}
public RecipeManager getRecipeManager() {return getWorld().getRecipeManager();}
public NetworkTagManager getTags() {return getWorld().getTags();}
public BlockPos getBlockRandomPos(int p_217383_1_, int p_217383_2_, int p_217383_3_, int p_217383_4_) {return getWorld().getBlockRandomPos(p_217383_1_, p_217383_2_, p_217383_3_, p_217383_4_);}
public boolean isSaveDisabled() {return getWorld().isSaveDisabled();}
public IProfiler getProfiler() {return getWorld().getProfiler();}
public BlockPos getHeight(Heightmap.Type heightmapType, BlockPos pos) {return getWorld().getHeight(heightmapType, pos);}
public double getMaxEntityRadius() {return getWorld().getMaxEntityRadius();}
public double increaseMaxEntityRadius(double value) {return getWorld().increaseMaxEntityRadius(value);}
public boolean areCapsCompatible(CapabilityProvider<World> other) {return getWorld().areCapsCompatible(other);}
public boolean areCapsCompatible(@Nullable CapabilityDispatcher other) {return getWorld().areCapsCompatible(other);}
@Nonnull
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap, @Nullable Direction side) {return getWorld().getCapability(cap, side);}
@Nonnull
public <T> LazyOptional<T> getCapability(@Nonnull Capability<T> cap) {return getWorld().getCapability(cap);}
@Override
public boolean isSkyLightMax(BlockPos pos) {return getWorld().isSkyLightMax(pos);}
@Override
@OnlyIn(Dist.CLIENT)
public int getCombinedLight(BlockPos pos, int minLight) {return getWorld().getCombinedLight(pos, minLight);}
@Override
public int getLightValue(BlockPos pos) {return getWorld().getLightValue(pos);}
@Override
public int getMaxLightLevel() {return getWorld().getMaxLightLevel();}
@Override
public int getHeight() {return getWorld().getHeight();}
@Override
public BlockRayTraceResult rayTraceBlocks(RayTraceContext context) {return getWorld().rayTraceBlocks(context);}
@Override
@Nullable
public BlockRayTraceResult rayTraceBlocks(Vec3d p_217296_1_, Vec3d p_217296_2_, BlockPos p_217296_3_, VoxelShape p_217296_4_, BlockState p_217296_5_) {return getWorld().rayTraceBlocks(p_217296_1_, p_217296_2_, p_217296_3_, p_217296_4_, p_217296_5_);}
public static <T> T func_217300_a(RayTraceContext p_217300_0_, BiFunction<RayTraceContext, BlockPos, T> p_217300_1_, Function<RayTraceContext, T> p_217300_2_) {return IBlockReader.func_217300_a(p_217300_0_, p_217300_1_, p_217300_2_);}
@Override
public float getCurrentMoonPhaseFactor() {return getWorld().getCurrentMoonPhaseFactor();}
@Override
public float getCelestialAngle(float partialTicks) {return getWorld().getCelestialAngle(partialTicks);}
@Override
@OnlyIn(Dist.CLIENT)
public int getMoonPhase() {return getWorld().getMoonPhase();}
@Override
public Difficulty getDifficulty() {return getWorld().getDifficulty();}
@Override
public boolean chunkExists(int chunkX, int chunkZ) {return getWorld().chunkExists(chunkX, chunkZ);}
@Override
public void playEvent(int type, BlockPos pos, int data) {getWorld().playEvent(type, pos, data);}
@Override
public Stream<VoxelShape> getEmptyCollisionShapes(@Nullable Entity entityIn, AxisAlignedBB aabb, Set<Entity> entitiesToIgnore) {return getWorld().getEmptyCollisionShapes(entityIn, aabb, entitiesToIgnore);}
@Override
public boolean checkNoEntityCollision(@Nullable Entity entityIn, VoxelShape shape) {return getWorld().checkNoEntityCollision(entityIn, shape);}
@Override
public List<Entity> getEntitiesWithinAABBExcludingEntity(@Nullable Entity entityIn, AxisAlignedBB bb) {return getWorld().getEntitiesWithinAABBExcludingEntity(entityIn, bb);}
@Override
public <T extends Entity> List<T> getEntitiesWithinAABB(Class<? extends T> p_217357_1_, AxisAlignedBB p_217357_2_) {return getWorld().getEntitiesWithinAABB(p_217357_1_, p_217357_2_);}
@Override
public <T extends Entity> List<T> func_225317_b(Class<? extends T> p_225317_1_, AxisAlignedBB p_225317_2_) {return getWorld().func_225317_b(p_225317_1_, p_225317_2_);}
@Override
@Nullable
public PlayerEntity getClosestPlayer(double x, double y, double z, double distance, @Nullable Predicate<Entity> predicate) {return getWorld().getClosestPlayer(x, y, z, distance, predicate);}
@Override
@Nullable
public PlayerEntity getClosestPlayer(Entity entityIn, double distance) {return getWorld().getClosestPlayer(entityIn, distance);}
@Override
@Nullable
public PlayerEntity getClosestPlayer(double x, double y, double z, double distance, boolean creativePlayers) {return getWorld().getClosestPlayer(x, y, z, distance, creativePlayers);}
@Override
@Nullable
public PlayerEntity getClosestPlayer(double x, double y, double z) {return getWorld().getClosestPlayer(x, y, z);}
@Override
public boolean isPlayerWithin(double x, double y, double z, double distance) {return getWorld().isPlayerWithin(x, y, z, distance);}
@Override
@Nullable
public PlayerEntity getClosestPlayer(EntityPredicate predicate, LivingEntity target) {return getWorld().getClosestPlayer(predicate, target);}
@Override
@Nullable
public PlayerEntity getClosestPlayer(EntityPredicate predicate, LivingEntity target, double p_217372_3_, double p_217372_5_, double p_217372_7_) {return getWorld().getClosestPlayer(predicate, target, p_217372_3_, p_217372_5_, p_217372_7_);}
@Override
@Nullable
public PlayerEntity getClosestPlayer(EntityPredicate predicate, double x, double y, double z) {return getWorld().getClosestPlayer(predicate, x, y, z);}
@Override
@Nullable
public <T extends LivingEntity> T getClosestEntityWithinAABB(Class<? extends T> entityClazz, EntityPredicate p_217360_2_, @Nullable LivingEntity target, double x, double y, double z, AxisAlignedBB boundingBox) {return getWorld().getClosestEntityWithinAABB(entityClazz, p_217360_2_, target, x, y, z, boundingBox);}
@Override
@Nullable
public <T extends LivingEntity> T func_225318_b(Class<? extends T> p_225318_1_, EntityPredicate p_225318_2_, @Nullable LivingEntity p_225318_3_, double p_225318_4_, double p_225318_6_, double p_225318_8_, AxisAlignedBB p_225318_10_) {return getWorld().func_225318_b(p_225318_1_, p_225318_2_, p_225318_3_, p_225318_4_, p_225318_6_, p_225318_8_, p_225318_10_);}
@Override
@Nullable
public <T extends LivingEntity> T getClosestEntity(List<? extends T> entities, EntityPredicate predicate, @Nullable LivingEntity target, double x, double y, double z) {return getWorld().getClosestEntity(entities, predicate, target, x, y, z);}
@Override
public List<PlayerEntity> getTargettablePlayersWithinAABB(EntityPredicate predicate, LivingEntity target, AxisAlignedBB box) {return getWorld().getTargettablePlayersWithinAABB(predicate, target, box);}
@Override
public <T extends LivingEntity> List<T> getTargettableEntitiesWithinAABB(Class<? extends T> p_217374_1_, EntityPredicate p_217374_2_, LivingEntity p_217374_3_, AxisAlignedBB p_217374_4_) {return getWorld().getTargettableEntitiesWithinAABB(p_217374_1_, p_217374_2_, p_217374_3_, p_217374_4_);}
@Override
@Nullable
public PlayerEntity getPlayerByUuid(UUID uniqueIdIn) {return getWorld().getPlayerByUuid(uniqueIdIn);}
@Override
public boolean isAirBlock(BlockPos pos) {return getWorld().isAirBlock(pos);}
@Override
public boolean canBlockSeeSky(BlockPos pos) {return getWorld().canBlockSeeSky(pos);}
@Override
public float getBrightness(BlockPos pos) {return getWorld().getBrightness(pos);}
@Override
public int getStrongPower(BlockPos pos, Direction direction) {return getWorld().getStrongPower(pos, direction);}
@Override
public IChunk getChunk(BlockPos pos) {return getWorld().getChunk(pos);}
@Override
public IChunk getChunk(int chunkX, int chunkZ, ChunkStatus requiredStatus) {return getWorld().getChunk(chunkX, chunkZ, requiredStatus);}
@Override
public boolean func_217350_a(BlockState blockStateIn, BlockPos pos, ISelectionContext selectionContext) {return getWorld().func_217350_a(blockStateIn, pos, selectionContext);}
@Override
public boolean checkNoEntityCollision(Entity entityIn) {return getWorld().checkNoEntityCollision(entityIn);}
@Override
public boolean areCollisionShapesEmpty(AxisAlignedBB aabb) {return getWorld().areCollisionShapesEmpty(aabb);}
@Override
public boolean areCollisionShapesEmpty(Entity entityIn) {return getWorld().areCollisionShapesEmpty(entityIn);}
@Override
public boolean isCollisionBoxesEmpty(Entity entityIn, AxisAlignedBB aabb) {return getWorld().isCollisionBoxesEmpty(entityIn, aabb);}
@Override
public boolean isCollisionBoxesEmpty(@Nullable Entity entityIn, AxisAlignedBB aabb, Set<Entity> entitiesToIgnore) {return getWorld().isCollisionBoxesEmpty(entityIn, aabb, entitiesToIgnore);}
@Override
public Stream<VoxelShape> getCollisionShapes(@Nullable Entity entityIn, AxisAlignedBB aabb, Set<Entity> entitiesToIgnore) {return getWorld().getCollisionShapes(entityIn, aabb, entitiesToIgnore);}
@Override
public Stream<VoxelShape> getCollisionShapes(@Nullable Entity entityIn, AxisAlignedBB aabb) {return getWorld().getCollisionShapes(entityIn, aabb);}
@Override
public boolean hasWater(BlockPos pos) {return getWorld().hasWater(pos);}
@Override
public boolean containsAnyLiquid(AxisAlignedBB bb) {return getWorld().containsAnyLiquid(bb);}
@Override
public int getLight(BlockPos pos) {return getWorld().getLight(pos);}
@Override
public int getNeighborAwareLightSubtracted(BlockPos pos, int amount) {return getWorld().getNeighborAwareLightSubtracted(pos, amount);}
@Override
@Deprecated
public boolean isBlockLoaded(BlockPos pos) {return getWorld().isBlockLoaded(pos);}
@Override
public boolean isAreaLoaded(BlockPos center, int range) {return getWorld().isAreaLoaded(center, range);}
@Override
@Deprecated
public boolean isAreaLoaded(BlockPos from, BlockPos to) {return getWorld().isAreaLoaded(from, to);}
@Override
@Deprecated
public boolean isAreaLoaded(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {return getWorld().isAreaLoaded(fromX, fromY, fromZ, toX, toY, toZ);}
@Override
public int getMaxHeight() {return getWorld().getMaxHeight();}
@Override
public boolean addEntity(Entity entityIn) {return getWorld().addEntity(entityIn);}
}

View File

@ -33,6 +33,9 @@ public net.minecraft.world.end.DragonFightManager field_186122_p #respawnState
public net.minecraft.entity.passive.BeeEntity field_226364_bD_ #stayOutOfHiveCountdown
public net.minecraft.entity.passive.BeeEntity$PollinateGoal
public net.minecraft.entity.passive.BeeEntity.PollinateGoal func_226504_l_()V #cancel
public net.minecraft.tileentity.BeehiveTileEntity$Bee
public net.minecraft.tileentity.BeehiveTileEntity$Bee field_226977_a_ #entityData
public net.minecraft.entity.passive.BeeEntity$PollinateGoal func_226504_l_()V #cancel
# Bukkit
public net.minecraft.entity.player.PlayerEntity func_190531_bD()I
public net.minecraft.entity.item.ItemFrameEntity func_174859_a(Lnet/minecraft/util/Direction;)V
@ -335,7 +338,7 @@ public net.minecraft.entity.passive.MooshroomEntity func_213446_a(Lnet/minecraft
public net.minecraft.entity.monster.PillagerEntity field_213677_bz
public net.minecraft.entity.player.ServerPlayerEntity func_213846_b(Lnet/minecraft/world/server/ServerWorld;)V
public net.minecraft.entity.monster.ZombieVillagerEntity func_191991_a(Ljava/util/UUID;I)V
public net.minecraft.item.BucketItem field_77876_a
# public net.minecraft.item.BucketItem field_77876_a
public net.minecraft.world.raid.RaidManager field_215175_a
public net.minecraft.world.raid.Raid field_221352_p
public net.minecraft.world.raid.Raid field_221345_i

View File

@ -7,7 +7,8 @@
"setSourceFile": true,
"plugin": "io.izzel.arclight.common.mod.ArclightMixinPlugin",
"injectors": {
"maxShiftBy": 2
"maxShiftBy": 2,
"defaultRequire": 1
},
"mixins": [
"block.AbstractButtonBlockMixin_1_15",
@ -32,6 +33,7 @@
"block.MushroomBlockMixin_1_15",
"block.NetherPortalBlockMixin_1_15",
"block.NetherWartBlockMixin_1_15",
"block.NoteBlockMixin_1_15",
"block.ObserverBlockMixin_1_15",
"block.PistonBlockMixin_1_15",
"block.RedstoneDiodeBlockMixin_1_15",
@ -57,21 +59,34 @@
"entity.item.FallingBlockEntityMixin_1_15",
"entity.item.ItemEntityMixin_1_15",
"entity.monster.AbstractRaiderEntityMixin",
"entity.monster.EndermanEntityMixin_1_15",
"entity.monster.RavagerEntityMixin_1_15",
"entity.monster.ShulkerEntityMixin_1_15",
"entity.monster.ZombiePigmanEntityMixin_1_15",
"entity.passive.BeeEntity_AngerGoalMixin",
"entity.passive.BeeEntity_FindPollinationTargetGoalMixin",
"entity.passive.BeeEntityMixin",
"entity.player.PlayerEntityMixin_1_15",
"entity.player.ServerPlayerEntityMixin_1_15",
"item.BlockItemMixin_1_15",
"item.LeadItemMixin_1_15",
"item.crafting.SpecialRecipeMixin",
"network.play.ServerPlayNetHandlerMixin_1_15",
"server.management.PlayerInteractionManagerMixin_1_15",
"server.management.PlayerListMixin_1_15",
"tileentity.BeehiveTileEntityMixin",
"world.ExplosionMixin_1_15",
"world.TeleporterMixin_1_15",
"world.WorldMixin_1_14",
"world.biome.BiomeContainerMixin",
"world.chunk.ChunkMixin_1_15",
"world.dimension.DimensionTypeMixin_1_15",
"world.gen.feature.structure.SwampHutPieceMixin_1_15",
"world.server.ServerMultiWorldMixin_1_15",
"world.server.ServerWorldMixin_1_15",
"world.server.TicketManagerMixin_1_15",
"world.spawner.WorldEntitySpawnerMixin_1_15",
"world.storage.MapDataMixin_1_15",
"world.storage.loot.LootTableManagerMixin",
"world.storage.loot.LootTableMixin"
]

View File

@ -23,7 +23,6 @@
"block.CactusBlockMixin",
"block.CampfireBlockMixin",
"block.CarvedPumpkinBlockMixin",
"block.ChestBlock2Mixin",
"block.CommandBlockBlockMixin",
"block.ComparatorBlockMixin",
"block.ComposterBlock_EmptyInventoryMixin",
@ -285,6 +284,7 @@
"item.crafting.StonecuttingRecipeMixin",
"item.crafting.SuspiciousStewRecipeMixin",
"item.crafting.TippedArrowRecipeMixin",
"network.PacketThreadUtilMixin",
"network.datasync.EntityDataManagerMixin",
"network.login.ServerLoginNetHandler1Mixin",
"network.play.ServerPlayNetHandlerMixin",
@ -334,8 +334,6 @@
"world.ExplosionMixin",
"world.IBlockReaderMixin",
"world.IWorldWriterMixin",
"world.ServerMultiWorldMixin",
"world.TeleporterMixin",
"world.TrackedEntityMixin",
"world.WorldMixin",
"world.border.WorldBorderMixin",
@ -344,7 +342,7 @@
"world.chunk.storage.RegionFileCacheMixin",
"world.dimension.DimensionMixin",
"world.gen.WorldGenRegionMixin",
"world.gen.feature.structure.SwampHutPieceMixin",
"world.gen.feature.structure.StructureMixin",
"world.raid.RaidManagerMixin",
"world.raid.RaidMixin",
"world.server.ChunkHolderMixin",

View File

@ -95,7 +95,7 @@ processResources {
}
jar {
manifest.attributes 'MixinConnector': 'io.izzel.arclight.common.mod.ArclightConnector'
manifest.attributes 'MixinConnector': 'io.izzel.arclight.impl.ArclightConnector_1_14'
manifest.attributes 'Main-Class': 'io.izzel.arclight.server.Main'
manifest.attributes 'Implementation-Title': 'Arclight'
manifest.attributes 'Implementation-Version': "arclight-${project.version}-${getGitHash()}"
@ -115,10 +115,13 @@ remapSpigotJar {
}
mixin {
add sourceSets.main, 'mixins.arclight.impl.refmap.json'
add sourceSets.main, 'mixins.arclight.impl.refmap.1_14.json'
}
compileJava {
options.compilerArgs << '-XDignore.symbol.file' << '-XDenableSunApiLintControl'
options.encoding = 'UTF-8'
}
options.compilerArgs += [
"-AreobfTsrgFiles=${project(':arclight-common').file('extra_mapping.tsrg').canonicalPath}"
]
}

View File

@ -0,0 +1,19 @@
package io.izzel.arclight.impl;
import io.izzel.arclight.common.mod.ArclightConfig;
import io.izzel.arclight.common.mod.ArclightConnector;
import org.spongepowered.asm.mixin.Mixins;
public class ArclightConnector_1_14 extends ArclightConnector {
@Override
public void connect() {
super.connect();
Mixins.addConfiguration("mixins.arclight.impl.core.1_14.json");
Mixins.addConfiguration("mixins.arclight.optimization.1_14.json");
if (ArclightConfig.INSTANCE.optimizations.removeStreams) {
Mixins.addConfiguration("mixins.arclight.optimization.stream.1_14.json");
}
LOGGER.info("Arclight optimization mixin added.");
}
}

View File

@ -1,32 +0,0 @@
package io.izzel.arclight.impl.mixin.v1_14.block;
import net.minecraft.block.AbstractButtonBlock;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.bukkit.Bukkit;
import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v.block.CraftBlock;
import org.bukkit.event.block.BlockRedstoneEvent;
import org.spongepowered.asm.mixin.Mixin;
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.Random;
@Mixin(AbstractButtonBlock.class)
public class AbstractButtonBlockMixin_1_14 {
@Inject(method = "tick", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z"))
private void arclight$blockRedstone2(BlockState state, World worldIn, BlockPos pos, Random random, CallbackInfo ci) {
Block block = CraftBlock.at(worldIn, pos);
BlockRedstoneEvent event = new BlockRedstoneEvent(block, 15, 0);
Bukkit.getPluginManager().callEvent(event);
if (event.getNewCurrent() > 0) {
ci.cancel();
}
}
}

Some files were not shown because too many files have changed in this diff Show More