1.16: worlds
This commit is contained in:
parent
aa40bd2520
commit
d234310d96
@ -6,7 +6,7 @@ A Bukkit server implementation utilizing Mixin.
|
|||||||
|
|
||||||
| Minecraft | Forge | Status | Build |
|
| Minecraft | Forge | Status | Build |
|
||||||
| :----: | :----: | :---: | :---: |
|
| :----: | :----: | :---: | :---: |
|
||||||
| 1.16.x | 33.0.5 | - | [](https://ci.appveyor.com/project/IzzelAliz/arclight-16) |
|
| 1.16.x | 33.0.22 | - | [](https://ci.appveyor.com/project/IzzelAliz/arclight-16) |
|
||||||
| 1.15.x | 31.2.30 | ACTIVE | [](https://ci.appveyor.com/project/IzzelAliz/arclight-15) |
|
| 1.15.x | 31.2.30 | ACTIVE | [](https://ci.appveyor.com/project/IzzelAliz/arclight-15) |
|
||||||
| 1.14.x | 28.2.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.0.6) | [](https://ci.appveyor.com/project/IzzelAliz/arclight) |
|
| 1.14.x | 28.2.0 | [LEGACY](https://github.com/IzzelAliz/Arclight/releases/tag/1.0.6) | [](https://ci.appveyor.com/project/IzzelAliz/arclight) |
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ apply plugin: 'io.izzel.arclight'
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
minecraftVersion = '1.16.2'
|
minecraftVersion = '1.16.2'
|
||||||
forgeVersion = '33.0.5'
|
forgeVersion = '33.0.22'
|
||||||
}
|
}
|
||||||
|
|
||||||
arclight {
|
arclight {
|
||||||
|
|||||||
@ -1,11 +1,15 @@
|
|||||||
net/minecraft/world/IWorld net/minecraft/world/IWorld
|
net/minecraft/world/IWorld net/minecraft/world/IWorld
|
||||||
addEntity (Lnet/minecraft/entity/Entity;)Z func_217376_c
|
addEntity (Lnet/minecraft/entity/Entity;)Z func_217376_c
|
||||||
|
setBlockState (Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z func_180501_a
|
||||||
net/minecraft/world/World net/minecraft/world/World
|
net/minecraft/world/World net/minecraft/world/World
|
||||||
addEntity (Lnet/minecraft/entity/Entity;)Z func_217376_c
|
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
|
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
|
destroyBlock (Lnet/minecraft/util/math/BlockPos;ZLnet/minecraft/entity/Entity;)Z func_225521_a_
|
||||||
setBlockState (Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)Z func_180501_a
|
net/minecraft/world/server/ServerWorld net/minecraft/world/server/ServerWorld
|
||||||
|
func_242417_l (Lnet/minecraft/entity/Entity;)V func_242417_l
|
||||||
net/minecraft/entity/monster/MonsterEntity net/minecraft/entity/monster/MonsterEntity
|
net/minecraft/entity/monster/MonsterEntity net/minecraft/entity/monster/MonsterEntity
|
||||||
setAttackTarget (Lnet/minecraft/entity/LivingEntity;)V func_70624_b
|
setAttackTarget (Lnet/minecraft/entity/LivingEntity;)V func_70624_b
|
||||||
net/minecraft/entity/passive/WolfEntity net/minecraft/entity/passive/WolfEntity
|
net/minecraft/entity/passive/WolfEntity net/minecraft/entity/passive/WolfEntity
|
||||||
setHealth (F)V func_70606_j
|
setHealth (F)V func_70606_j
|
||||||
|
net/minecraft/block/BlockState net/minecraft/block/BlockState
|
||||||
|
get (Lnet/minecraft/state/Property;)Ljava/lang/Comparable; func_177229_b
|
||||||
@ -1,8 +0,0 @@
|
|||||||
package io.izzel.arclight.common.bridge.world.dimension;
|
|
||||||
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
|
|
||||||
public interface DimensionBridge {
|
|
||||||
|
|
||||||
DimensionType bridge$getDimensionManager();
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
package io.izzel.arclight.common.bridge.world.dimension;
|
|
||||||
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
|
|
||||||
public interface DimensionTypeBridge {
|
|
||||||
|
|
||||||
DimensionType bridge$getType();
|
|
||||||
|
|
||||||
void bridge$setType(DimensionType type);
|
|
||||||
}
|
|
||||||
@ -19,4 +19,6 @@ public interface ChunkManagerBridge {
|
|||||||
ArclightCallbackExecutor bridge$getCallbackExecutor();
|
ArclightCallbackExecutor bridge$getCallbackExecutor();
|
||||||
|
|
||||||
ChunkHolder bridge$chunkHolderAt(long chunkPos);
|
ChunkHolder bridge$chunkHolderAt(long chunkPos);
|
||||||
|
|
||||||
|
void bridge$setViewDistance(int i);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package io.izzel.arclight.common.bridge.world.server;
|
package io.izzel.arclight.common.bridge.world.server;
|
||||||
|
|
||||||
|
import net.minecraft.world.gen.ChunkGenerator;
|
||||||
import net.minecraft.world.server.ServerWorldLightManager;
|
import net.minecraft.world.server.ServerWorldLightManager;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -15,4 +16,8 @@ public interface ServerChunkProviderBridge {
|
|||||||
boolean bridge$isChunkLoaded(int x, int z);
|
boolean bridge$isChunkLoaded(int x, int z);
|
||||||
|
|
||||||
ServerWorldLightManager bridge$getLightManager();
|
ServerWorldLightManager bridge$getLightManager();
|
||||||
|
|
||||||
|
void bridge$setChunkGenerator(ChunkGenerator chunkGenerator);
|
||||||
|
|
||||||
|
void bridge$setViewDistance(int viewDistance);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.minecraft.entity.effect.LightningBoltEntity;
|
|||||||
import net.minecraft.particles.IParticleData;
|
import net.minecraft.particles.IParticleData;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.storage.SaveFormat;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.weather.LightningStrikeEvent;
|
import org.bukkit.event.weather.LightningStrikeEvent;
|
||||||
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
||||||
@ -21,9 +22,12 @@ public interface ServerWorldBridge extends WorldBridge {
|
|||||||
|
|
||||||
boolean bridge$addEntitySerialized(Entity entity, CreatureSpawnEvent.SpawnReason reason);
|
boolean bridge$addEntitySerialized(Entity entity, CreatureSpawnEvent.SpawnReason reason);
|
||||||
|
|
||||||
// todo
|
boolean bridge$addAllEntities(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason);
|
||||||
|
|
||||||
boolean bridge$addAllEntitiesSafely(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason);
|
boolean bridge$addAllEntitiesSafely(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason reason);
|
||||||
|
|
||||||
|
SaveFormat.LevelSave bridge$getConvertable();
|
||||||
|
|
||||||
interface Hack {
|
interface Hack {
|
||||||
|
|
||||||
TileEntity getTileEntity(BlockPos blockPos);
|
TileEntity getTileEntity(BlockPos blockPos);
|
||||||
|
|||||||
@ -1,8 +0,0 @@
|
|||||||
package io.izzel.arclight.common.bridge.world.storage;
|
|
||||||
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
|
|
||||||
public interface DerivedWorldInfoBridge {
|
|
||||||
|
|
||||||
void bridge$setDimension(DimensionType dimensionType);
|
|
||||||
}
|
|
||||||
@ -1,16 +1,10 @@
|
|||||||
package io.izzel.arclight.common.bridge.world.storage;
|
package io.izzel.arclight.common.bridge.world.storage;
|
||||||
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public interface SaveHandlerBridge {
|
public interface PlayerDataBridge {
|
||||||
|
|
||||||
String[] bridge$getSeenPlayers();
|
|
||||||
|
|
||||||
UUID bridge$getUUID(ServerWorld world);
|
|
||||||
|
|
||||||
File bridge$getPlayerDir();
|
File bridge$getPlayerDir();
|
||||||
|
|
||||||
@ -1,10 +1,10 @@
|
|||||||
package io.izzel.arclight.common.bridge.world.storage;
|
package io.izzel.arclight.common.bridge.world.storage;
|
||||||
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
|
||||||
public interface WorldInfoBridge {
|
public interface WorldInfoBridge {
|
||||||
|
|
||||||
void bridge$setWorld(World world);
|
void bridge$setWorld(ServerWorld world);
|
||||||
|
|
||||||
World bridge$getWorld();
|
ServerWorld bridge$getWorld();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package io.izzel.arclight.common.mixin.bukkit;
|
|||||||
import io.izzel.arclight.common.bridge.bukkit.MaterialBridge;
|
import io.izzel.arclight.common.bridge.bukkit.MaterialBridge;
|
||||||
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
||||||
import io.izzel.arclight.i18n.conf.MaterialPropertySpec;
|
import io.izzel.arclight.i18n.conf.MaterialPropertySpec;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.block.Biome;
|
import org.bukkit.block.Biome;
|
||||||
@ -36,7 +37,7 @@ public abstract class CraftBlockMixin {
|
|||||||
* @reason
|
* @reason
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static Biome biomeBaseToBiome(net.minecraft.world.biome.Biome base) {
|
public static Biome biomeBaseToBiome(Registry<net.minecraft.world.biome.Biome> registry, net.minecraft.world.biome.Biome base) {
|
||||||
return Biome.valueOf(ResourceLocationUtil.standardize(base.getRegistryName()));
|
return Biome.valueOf(ResourceLocationUtil.standardize(base.getRegistryName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ public abstract class CraftBlockMixin {
|
|||||||
* @reason
|
* @reason
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static net.minecraft.world.biome.Biome biomeToBiomeBase(Biome bio) {
|
public static net.minecraft.world.biome.Biome biomeToBiomeBase(Registry<net.minecraft.world.biome.Biome> registry, Biome bio) {
|
||||||
return ForgeRegistries.BIOMES.getValue(CraftNamespacedKey.toMinecraft(bio.getKey()));
|
return ForgeRegistries.BIOMES.getValue(CraftNamespacedKey.toMinecraft(bio.getKey()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import io.izzel.arclight.common.mod.server.entity.ArclightModVillager;
|
|||||||
import net.minecraft.entity.AgeableEntity;
|
import net.minecraft.entity.AgeableEntity;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.FlyingEntity;
|
import net.minecraft.entity.FlyingEntity;
|
||||||
import net.minecraft.entity.IProjectile;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.MobEntity;
|
import net.minecraft.entity.MobEntity;
|
||||||
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
|
||||||
@ -24,6 +23,7 @@ import net.minecraft.entity.passive.GolemEntity;
|
|||||||
import net.minecraft.entity.passive.TameableEntity;
|
import net.minecraft.entity.passive.TameableEntity;
|
||||||
import net.minecraft.entity.passive.horse.AbstractChestedHorseEntity;
|
import net.minecraft.entity.passive.horse.AbstractChestedHorseEntity;
|
||||||
import net.minecraft.entity.passive.horse.AbstractHorseEntity;
|
import net.minecraft.entity.passive.horse.AbstractHorseEntity;
|
||||||
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftAgeable;
|
import org.bukkit.craftbukkit.v.entity.CraftAgeable;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftEntity;
|
import org.bukkit.craftbukkit.v.entity.CraftEntity;
|
||||||
@ -88,7 +88,7 @@ public class CraftEntityMixin {
|
|||||||
cir.setReturnValue(new ArclightModMinecart(server, (AbstractMinecartEntity) entity));
|
cir.setReturnValue(new ArclightModMinecart(server, (AbstractMinecartEntity) entity));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity instanceof IProjectile) {
|
if (entity instanceof ProjectileEntity) {
|
||||||
cir.setReturnValue(new ArclightModProjectile(server, entity));
|
cir.setReturnValue(new ArclightModProjectile(server, entity));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import org.bukkit.entity.Villager;
|
|||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
@Mixin(CraftVillager.class)
|
@Mixin(value = CraftVillager.class, remap = false)
|
||||||
public class CraftVillagerMixin {
|
public class CraftVillagerMixin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package io.izzel.arclight.common.mixin.bukkit;
|
|||||||
|
|
||||||
import io.izzel.arclight.common.bridge.bukkit.EntityTypeBridge;
|
import io.izzel.arclight.common.bridge.bukkit.EntityTypeBridge;
|
||||||
import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.storage.SaveHandlerBridge;
|
import io.izzel.arclight.common.bridge.world.server.ServerWorldBridge;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.craftbukkit.v.CraftWorld;
|
import org.bukkit.craftbukkit.v.CraftWorld;
|
||||||
@ -17,7 +17,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@Mixin(value = CraftWorld.class, remap = false)
|
@Mixin(value = CraftWorld.class, remap = false)
|
||||||
@ -35,21 +34,12 @@ public class CraftWorldMixin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @author IzzelAliz
|
|
||||||
* @reason
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
public UUID getUID() {
|
|
||||||
return ((SaveHandlerBridge) this.world.getSaveHandler()).bridge$getUUID(this.world);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author IzzelAliz
|
* @author IzzelAliz
|
||||||
* @reason
|
* @reason
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public File getWorldFolder() {
|
public File getWorldFolder() {
|
||||||
return this.world.dimension.getType().getDirectory(this.world.getSaveHandler().getWorldDirectory());
|
return ((ServerWorldBridge) this.world).bridge$getConvertable().getDimensionFolder(this.world.getDimensionKey());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -317,7 +317,7 @@ public abstract class MaterialMixin implements MaterialBridge {
|
|||||||
arclight$spec.interactable = true;
|
arclight$spec.interactable = true;
|
||||||
}
|
}
|
||||||
if (arclight$spec.hardness == null) {
|
if (arclight$spec.hardness == null) {
|
||||||
arclight$spec.hardness = block != null ? block.blockHardness : 0;
|
arclight$spec.hardness = block != null ? block.getDefaultState().hardness : 0;
|
||||||
}
|
}
|
||||||
if (arclight$spec.blastResistance == null) {
|
if (arclight$spec.blastResistance == null) {
|
||||||
arclight$spec.blastResistance = block != null ? block.getExplosionResistance() : 0;
|
arclight$spec.blastResistance = block != null ? block.getExplosionResistance() : 0;
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
package io.izzel.arclight.common.mixin.core.block;
|
||||||
|
|
||||||
|
import net.minecraft.block.AbstractBlock;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IWorld;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
@Mixin(AbstractBlock.class)
|
||||||
|
public abstract class AbstractBlockMixin {
|
||||||
|
|
||||||
|
// @formatter:off
|
||||||
|
@Shadow public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { return null; }
|
||||||
|
// @formatter:on
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.block;
|
package io.izzel.arclight.common.mixin.core.block;
|
||||||
|
|
||||||
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.AbstractBlock;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -10,8 +10,8 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(BlockState.class)
|
@Mixin(AbstractBlock.AbstractBlockState.class)
|
||||||
public class BlockStateMixin {
|
public class AbstractBlock_AbstractBlockStateMixin {
|
||||||
|
|
||||||
@Inject(method = "onEntityCollision", at = @At("HEAD"))
|
@Inject(method = "onEntityCollision", at = @At("HEAD"))
|
||||||
private void arclight$captureBlockCollide(World worldIn, BlockPos pos, Entity entityIn, CallbackInfo ci) {
|
private void arclight$captureBlockCollide(World worldIn, BlockPos pos, Entity entityIn, CallbackInfo ci) {
|
||||||
@ -12,10 +12,8 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
|||||||
import net.minecraft.item.BlockItemUseContext;
|
import net.minecraft.item.BlockItemUseContext;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.GameRules;
|
import net.minecraft.world.GameRules;
|
||||||
import net.minecraft.world.IWorld;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraftforge.common.extensions.IForgeBlock;
|
import net.minecraftforge.common.extensions.IForgeBlock;
|
||||||
@ -34,12 +32,11 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mixin(Block.class)
|
@Mixin(Block.class)
|
||||||
public abstract class BlockMixin implements BlockBridge {
|
public abstract class BlockMixin extends AbstractBlockMixin implements BlockBridge {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow public abstract BlockState getDefaultState();
|
@Shadow public abstract BlockState getDefaultState();
|
||||||
@Shadow @Nullable public BlockState getStateForPlacement(BlockItemUseContext context) { return null; }
|
@Shadow @Nullable public BlockState getStateForPlacement(BlockItemUseContext context) { return null; }
|
||||||
@Shadow public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) { return null; }
|
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||||||
@Mixin(CakeBlock.class)
|
@Mixin(CakeBlock.class)
|
||||||
public class CakeBlockMixin {
|
public class CakeBlockMixin {
|
||||||
|
|
||||||
@Redirect(method = "func_226911_a_", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/FoodStats;addStats(IF)V"))
|
@Redirect(method = "eatSlice", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/FoodStats;addStats(IF)V"))
|
||||||
private void arclight$eatCake(FoodStats foodStats, int foodLevelIn, float foodSaturationModifier, IWorld worldIn, BlockPos pos, BlockState state, PlayerEntity player) {
|
private void arclight$eatCake(FoodStats foodStats, int foodLevelIn, float foodSaturationModifier, IWorld worldIn, BlockPos pos, BlockState state, PlayerEntity player) {
|
||||||
int old = foodStats.getFoodLevel();
|
int old = foodStats.getFoodLevel();
|
||||||
FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(player, old + foodLevelIn);
|
FoodLevelChangeEvent event = CraftEventFactory.callFoodLevelChangeEvent(player, old + foodLevelIn);
|
||||||
|
|||||||
@ -31,7 +31,7 @@ public abstract class ComposterBlockMixin {
|
|||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow @Final public static IntegerProperty LEVEL;
|
@Shadow @Final public static IntegerProperty LEVEL;
|
||||||
@Shadow @Final public static Object2FloatMap<IItemProvider> CHANCES;
|
@Shadow @Final public static Object2FloatMap<IItemProvider> CHANCES;
|
||||||
@Shadow private static BlockState resetFillState(BlockState state, IWorld world, BlockPos pos) { return null; }
|
@Shadow public static BlockState resetFillState(BlockState state, IWorld world, BlockPos pos) { return null; }
|
||||||
@Shadow public static BlockState empty(BlockState state, World world, BlockPos pos) { return null; }
|
@Shadow public static BlockState empty(BlockState state, World world, BlockPos pos) { return null; }
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,10 @@ import net.minecraft.block.FlowingFluidBlock;
|
|||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.enchantment.FrostWalkerEnchantment;
|
import net.minecraft.enchantment.FrostWalkerEnchantment;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.util.Direction;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
import net.minecraft.util.math.shapes.ISelectionContext;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.BlockSnapshot;
|
|
||||||
import net.minecraftforge.event.ForgeEventFactory;
|
|
||||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
@ -26,20 +23,19 @@ public class FrostWalkerEnchantmentMixin {
|
|||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite
|
||||||
public static void freezeNearby(LivingEntity living, World worldIn, BlockPos pos, int level) {
|
public static void freezeNearby(LivingEntity living, World worldIn, BlockPos pos, int level) {
|
||||||
if (living.onGround) {
|
if (living.isOnGround()) {
|
||||||
BlockState blockstate = Blocks.FROSTED_ICE.getDefaultState();
|
BlockState blockstate = Blocks.FROSTED_ICE.getDefaultState();
|
||||||
float f = (float) Math.min(16, 2 + level);
|
float f = (float) Math.min(16, 2 + level);
|
||||||
BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable();
|
BlockPos.Mutable blockpos$mutable = new BlockPos.Mutable();
|
||||||
|
|
||||||
for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add(-f, -1.0D, -f), pos.add(f, -1.0D, f))) {
|
for (BlockPos blockpos : BlockPos.getAllInBoxMutable(pos.add((double) (-f), -1.0D, (double) (-f)), pos.add((double) f, -1.0D, (double) f))) {
|
||||||
if (blockpos.withinDistance(living.getPositionVec(), f)) {
|
if (blockpos.withinDistance(living.getPositionVec(), (double) f)) {
|
||||||
blockpos$mutable.setPos(blockpos.getX(), blockpos.getY() + 1, blockpos.getZ());
|
blockpos$mutable.setPos(blockpos.getX(), blockpos.getY() + 1, blockpos.getZ());
|
||||||
BlockState blockstate1 = worldIn.getBlockState(blockpos$mutable);
|
BlockState blockstate1 = worldIn.getBlockState(blockpos$mutable);
|
||||||
if (blockstate1.isAir(worldIn, blockpos$mutable)) {
|
if (blockstate1.isAir(worldIn, blockpos$mutable)) {
|
||||||
BlockState blockstate2 = worldIn.getBlockState(blockpos);
|
BlockState blockstate2 = worldIn.getBlockState(blockpos);
|
||||||
boolean isFull = blockstate2.getBlock() == Blocks.WATER && blockstate2.get(FlowingFluidBlock.LEVEL) == 0; //TODO: Forge, modded waters?
|
boolean isFull = blockstate2.getBlock() == Blocks.WATER && blockstate2.get(FlowingFluidBlock.LEVEL) == 0; //TODO: Forge, modded waters?
|
||||||
if (blockstate2.getMaterial() == Material.WATER && isFull && blockstate.isValidPosition(worldIn, blockpos) && worldIn.func_226663_a_(blockstate, blockpos, ISelectionContext.dummy()) && !ForgeEventFactory.onBlockPlace(living, new BlockSnapshot(worldIn, blockpos, blockstate2), Direction.UP)) {
|
if (blockstate2.getMaterial() == Material.WATER && isFull && blockstate.isValidPosition(worldIn, blockpos) && worldIn.func_226663_a_(blockstate, blockpos, ISelectionContext.dummy()) && !net.minecraftforge.event.ForgeEventFactory.onBlockPlace(living, net.minecraftforge.common.util.BlockSnapshot.create(worldIn.getDimensionKey(), worldIn, blockpos), net.minecraft.util.Direction.UP)) {
|
||||||
worldIn.setBlockState(blockpos, blockstate);
|
|
||||||
if (CraftEventFactory.handleBlockFormEvent(worldIn, blockpos, blockstate, living)) {
|
if (CraftEventFactory.handleBlockFormEvent(worldIn, blockpos, blockstate, living)) {
|
||||||
worldIn.getPendingBlockTicks().scheduleTick(blockpos, Blocks.FROSTED_ICE, MathHelper.nextInt(living.getRNG(), 60, 120));
|
worldIn.getPendingBlockTicks().scheduleTick(blockpos, Blocks.FROSTED_ICE, MathHelper.nextInt(living.getRNG(), 60, 120));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,6 @@ package io.izzel.arclight.common.mixin.core.entity.ai.attributes;
|
|||||||
|
|
||||||
import io.izzel.arclight.common.bridge.entity.ai.attributes.RangedAttributeBridge;
|
import io.izzel.arclight.common.bridge.entity.ai.attributes.RangedAttributeBridge;
|
||||||
import net.minecraft.entity.ai.attributes.Attribute;
|
import net.minecraft.entity.ai.attributes.Attribute;
|
||||||
import net.minecraft.entity.ai.attributes.IAttribute;
|
|
||||||
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
import net.minecraft.entity.ai.attributes.RangedAttribute;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
@ -10,19 +9,17 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
|
|
||||||
@Mixin(RangedAttribute.class)
|
@Mixin(RangedAttribute.class)
|
||||||
public abstract class RangedAttributeMixin extends Attribute implements RangedAttributeBridge {
|
public abstract class RangedAttributeMixin extends Attribute implements RangedAttributeBridge {
|
||||||
|
|
||||||
protected RangedAttributeMixin(@Nullable IAttribute parentIn, String unlocalizedNameIn, double defaultValueIn) {
|
|
||||||
super(parentIn, unlocalizedNameIn, defaultValueIn);
|
|
||||||
}
|
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Override @Accessor("maximumValue") public abstract void bridge$setMaximumValue(double maximumValue);
|
@Override @Accessor("maximumValue") public abstract void bridge$setMaximumValue(double maximumValue);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
|
protected RangedAttributeMixin(String p_i231500_1_, double p_i231500_2_) {
|
||||||
|
super(p_i231500_1_, p_i231500_2_);
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "clampValue", cancellable = true, at = @At("HEAD"))
|
@Inject(method = "clampValue", cancellable = true, at = @At("HEAD"))
|
||||||
private void arclight$notNan(double value, CallbackInfoReturnable<Double> cir) {
|
private void arclight$notNan(double value, CallbackInfoReturnable<Double> cir) {
|
||||||
if (Double.isNaN(value)) {
|
if (Double.isNaN(value)) {
|
||||||
|
|||||||
@ -59,7 +59,7 @@ public abstract class AbstractMinecartEntityMixin extends EntityMixin {
|
|||||||
@Shadow public abstract void onActivatorRailPass(int x, int y, int z, boolean receivingPower);
|
@Shadow public abstract void onActivatorRailPass(int x, int y, int z, boolean receivingPower);
|
||||||
@Shadow private boolean isInReverse;
|
@Shadow private boolean isInReverse;
|
||||||
@Shadow public abstract AbstractMinecartEntity.Type getMinecartType();
|
@Shadow public abstract AbstractMinecartEntity.Type getMinecartType();
|
||||||
@Shadow public abstract boolean canUseRail();
|
@Shadow(remap = false) public abstract boolean canUseRail();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
public boolean slowWhenEmpty = true;
|
public boolean slowWhenEmpty = true;
|
||||||
|
|||||||
@ -11,7 +11,8 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||||||
@Mixin(CommandBlockMinecartEntity.MinecartCommandLogic.class)
|
@Mixin(CommandBlockMinecartEntity.MinecartCommandLogic.class)
|
||||||
public abstract class CommandBlockMinecartEntity_MinecartCommandLogicMixin implements ICommandSourceBridge {
|
public abstract class CommandBlockMinecartEntity_MinecartCommandLogicMixin implements ICommandSourceBridge {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_210168_a"}, remap = false) private CommandBlockMinecartEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_210168_a"}, remap = false)
|
||||||
|
private CommandBlockMinecartEntity outerThis;
|
||||||
|
|
||||||
public CommandSender getBukkitSender(CommandSource wrapper) {
|
public CommandSender getBukkitSender(CommandSource wrapper) {
|
||||||
return ((EntityBridge) outerThis).bridge$getBukkitEntity();
|
return ((EntityBridge) outerThis).bridge$getBukkitEntity();
|
||||||
|
|||||||
@ -3,9 +3,9 @@ package io.izzel.arclight.common.mixin.core.entity.monster;
|
|||||||
import io.izzel.arclight.common.bridge.entity.monster.EndermanEntityBridge;
|
import io.izzel.arclight.common.bridge.entity.monster.EndermanEntityBridge;
|
||||||
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
|
import io.izzel.arclight.common.mixin.core.entity.CreatureEntityMixin;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.SharedMonsterAttributes;
|
|
||||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
import net.minecraft.entity.ai.attributes.Attributes;
|
||||||
|
import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance;
|
||||||
import net.minecraft.entity.monster.EndermanEntity;
|
import net.minecraft.entity.monster.EndermanEntity;
|
||||||
import net.minecraft.network.datasync.DataParameter;
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
@ -15,7 +15,6 @@ import org.spongepowered.asm.mixin.Overwrite;
|
|||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
@Mixin(EndermanEntity.class)
|
@Mixin(EndermanEntity.class)
|
||||||
public abstract class EndermanEntityMixin extends CreatureEntityMixin implements EndermanEntityBridge {
|
public abstract class EndermanEntityMixin extends CreatureEntityMixin implements EndermanEntityBridge {
|
||||||
@ -29,17 +28,17 @@ public abstract class EndermanEntityMixin extends CreatureEntityMixin implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bridge$updateTarget(LivingEntity livingEntity) {
|
public void bridge$updateTarget(LivingEntity livingEntity) {
|
||||||
IAttributeInstance iattributeinstance = this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
|
ModifiableAttributeInstance modifiableattributeinstance = this.getAttribute(Attributes.MOVEMENT_SPEED);
|
||||||
if (livingEntity == null) {
|
if (livingEntity == null) {
|
||||||
this.targetChangeTime = 0;
|
this.targetChangeTime = 0;
|
||||||
this.dataManager.set(SCREAMING, false);
|
this.dataManager.set(SCREAMING, false);
|
||||||
this.dataManager.set(field_226535_bx_, false);
|
this.dataManager.set(field_226535_bx_, false);
|
||||||
iattributeinstance.removeModifier(ATTACKING_SPEED_BOOST);
|
modifiableattributeinstance.removeModifier(ATTACKING_SPEED_BOOST);
|
||||||
} else {
|
} else {
|
||||||
this.targetChangeTime = this.ticksExisted;
|
this.targetChangeTime = this.ticksExisted;
|
||||||
this.dataManager.set(SCREAMING, true);
|
this.dataManager.set(SCREAMING, true);
|
||||||
if (!iattributeinstance.hasModifier(ATTACKING_SPEED_BOOST)) {
|
if (!modifiableattributeinstance.hasModifier(ATTACKING_SPEED_BOOST)) {
|
||||||
iattributeinstance.applyModifier(ATTACKING_SPEED_BOOST);
|
modifiableattributeinstance.applyNonPersistentModifier(ATTACKING_SPEED_BOOST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -63,11 +62,8 @@ public abstract class EndermanEntityMixin extends CreatureEntityMixin implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.UNKNOWN, true);
|
this.bridge$pushGoalTargetReason(EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||||
arclight$targetSuccess = new AtomicBoolean();
|
|
||||||
super.setAttackTarget(entity);
|
super.setAttackTarget(entity);
|
||||||
boolean ret = arclight$targetSuccess.get();
|
if (arclight$targetSuccess) {
|
||||||
arclight$targetSuccess = null;
|
|
||||||
if (ret) {
|
|
||||||
bridge$updateTarget(getAttackTarget());
|
bridge$updateTarget(getAttackTarget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(targets = "net.minecraft.entity.monster.IllusionerEntity.BlindnessSpellGoal")
|
@Mixin(targets = "net.minecraft.entity.monster.IllusionerEntity.BlindnessSpellGoal")
|
||||||
public class IllusionerEntity_BlindnessSpellGoalMixin {
|
public class IllusionerEntity_BlindnessSpellGoalMixin {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_210765_a"}, remap = false) private IllusionerEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_210765_a"}, remap = false)
|
||||||
|
private IllusionerEntity outerThis;
|
||||||
|
|
||||||
@Inject(method = "castSpell", at = @At("HEAD"))
|
@Inject(method = "castSpell", at = @At("HEAD"))
|
||||||
private void arclight$reason(CallbackInfo ci) {
|
private void arclight$reason(CallbackInfo ci) {
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(targets = "net.minecraft.entity.monster.IllusionerEntity.MirrorSpellGoal")
|
@Mixin(targets = "net.minecraft.entity.monster.IllusionerEntity.MirrorSpellGoal")
|
||||||
public class IllusionerEntity_MirrorSpellGoalMixin {
|
public class IllusionerEntity_MirrorSpellGoalMixin {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_210767_a"}, remap = false) private IllusionerEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_210767_a"}, remap = false)
|
||||||
|
private IllusionerEntity outerThis;
|
||||||
|
|
||||||
@Inject(method = "castSpell", at = @At("HEAD"))
|
@Inject(method = "castSpell", at = @At("HEAD"))
|
||||||
private void arclight$reason(CallbackInfo ci) {
|
private void arclight$reason(CallbackInfo ci) {
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|||||||
@Mixin(targets = "net.minecraft.entity.monster.PhantomEntity.AttackPlayerGoal")
|
@Mixin(targets = "net.minecraft.entity.monster.PhantomEntity.AttackPlayerGoal")
|
||||||
public abstract class PhantomEntity_AttackPlayerGoalMixin {
|
public abstract class PhantomEntity_AttackPlayerGoalMixin {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_203141_a"}, remap = false) private PhantomEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_203141_a"}, remap = false)
|
||||||
|
private PhantomEntity outerThis;
|
||||||
|
|
||||||
@SuppressWarnings("UnresolvedMixinReference")
|
@SuppressWarnings("UnresolvedMixinReference")
|
||||||
@Inject(method = "shouldExecute", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/entity/monster/PhantomEntity;func_70624_b(Lnet/minecraft/entity/LivingEntity;)V"))
|
@Inject(method = "shouldExecute", at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/entity/monster/PhantomEntity;func_70624_b(Lnet/minecraft/entity/LivingEntity;)V"))
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
public abstract class SpellcastingIllagerEntity_UseSpellGoalMixin {
|
public abstract class SpellcastingIllagerEntity_UseSpellGoalMixin {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow(aliases = {"this$0", "field_193323_e"}, remap = false) private SpellcastingIllagerEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_193323_e"}, remap = false) private SpellcastingIllagerEntity outerThis;
|
||||||
@Shadow protected abstract SpellcastingIllagerEntity.SpellType getSpellType();
|
@Shadow protected abstract SpellcastingIllagerEntity.SpellType getSpellType();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(targets = "net.minecraft.entity.monster.VexEntity.CopyOwnerTargetGoal")
|
@Mixin(targets = "net.minecraft.entity.monster.VexEntity.CopyOwnerTargetGoal")
|
||||||
public abstract class VexEntity_CopyOwnerTargetGoalMixin {
|
public abstract class VexEntity_CopyOwnerTargetGoalMixin {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_190883_a"}, remap = false) private VexEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_190883_a"}, remap = false)
|
||||||
|
private VexEntity outerThis;
|
||||||
|
|
||||||
@Inject(method = "startExecuting", at = @At("HEAD"))
|
@Inject(method = "startExecuting", at = @At("HEAD"))
|
||||||
private void arclight$reason(CallbackInfo ci) {
|
private void arclight$reason(CallbackInfo ci) {
|
||||||
|
|||||||
@ -16,7 +16,8 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|||||||
@Mixin(targets = "net.minecraft.entity.passive.BeeEntity.FindPollinationTargetGoal")
|
@Mixin(targets = "net.minecraft.entity.passive.BeeEntity.FindPollinationTargetGoal")
|
||||||
public class BeeEntity_FindPollinationTargetGoalMixin {
|
public class BeeEntity_FindPollinationTargetGoalMixin {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_226483_b_"}, remap = false) private BeeEntity outerThis;
|
@SuppressWarnings("target") @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"))
|
@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) {
|
private void arclight$entityChangeBlock(CallbackInfo ci, int i, BlockPos blockPos, BlockState blockState, Block block, boolean flag, IntegerProperty property) {
|
||||||
|
|||||||
@ -16,7 +16,8 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|||||||
@Mixin(FoxEntity.EatBerriesGoal.class)
|
@Mixin(FoxEntity.EatBerriesGoal.class)
|
||||||
public abstract class FoxEntity_EatBerriesGoalMixin extends MoveToBlockGoal {
|
public abstract class FoxEntity_EatBerriesGoalMixin extends MoveToBlockGoal {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_220732_h"}, remap = false) private FoxEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_220732_h"}, remap = false)
|
||||||
|
private FoxEntity outerThis;
|
||||||
|
|
||||||
public FoxEntity_EatBerriesGoalMixin(CreatureEntity creature, double speedIn, int length) {
|
public FoxEntity_EatBerriesGoalMixin(CreatureEntity creature, double speedIn, int length) {
|
||||||
super(creature, speedIn, length);
|
super(creature, speedIn, length);
|
||||||
|
|||||||
@ -2,9 +2,10 @@ package io.izzel.arclight.common.mixin.core.entity.passive;
|
|||||||
|
|
||||||
import io.izzel.arclight.common.bridge.entity.passive.AnimalEntityBridge;
|
import io.izzel.arclight.common.bridge.entity.passive.AnimalEntityBridge;
|
||||||
import io.izzel.arclight.common.bridge.entity.passive.FoxEntityBridge;
|
import io.izzel.arclight.common.bridge.entity.passive.FoxEntityBridge;
|
||||||
import io.izzel.arclight.common.mixin.core.entity.ai.goal.BreedGoalMixin;
|
|
||||||
import net.minecraft.advancements.CriteriaTriggers;
|
import net.minecraft.advancements.CriteriaTriggers;
|
||||||
|
import net.minecraft.entity.ai.goal.BreedGoal;
|
||||||
import net.minecraft.entity.item.ExperienceOrbEntity;
|
import net.minecraft.entity.item.ExperienceOrbEntity;
|
||||||
|
import net.minecraft.entity.passive.AnimalEntity;
|
||||||
import net.minecraft.entity.passive.FoxEntity;
|
import net.minecraft.entity.passive.FoxEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.stats.Stats;
|
import net.minecraft.stats.Stats;
|
||||||
@ -18,7 +19,11 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
|
|
||||||
@Mixin(targets = "net.minecraft.entity.passive.FoxEntity.MateGoal")
|
@Mixin(targets = "net.minecraft.entity.passive.FoxEntity.MateGoal")
|
||||||
public class FoxEntity_MateGoalMixin extends BreedGoalMixin {
|
public abstract class FoxEntity_MateGoalMixin extends BreedGoal {
|
||||||
|
|
||||||
|
public FoxEntity_MateGoalMixin(AnimalEntity animal, double speedIn) {
|
||||||
|
super(animal, speedIn);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author IzzekAkuz
|
* @author IzzekAkuz
|
||||||
|
|||||||
@ -12,7 +12,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(targets = "net.minecraft.entity.passive.FoxEntity.RevengeGoal")
|
@Mixin(targets = "net.minecraft.entity.passive.FoxEntity.RevengeGoal")
|
||||||
public class FoxEntity_RevengeGoalMixin {
|
public class FoxEntity_RevengeGoalMixin {
|
||||||
|
|
||||||
@Shadow(aliases = {"this$0", "field_220785_i"}, remap = false) private FoxEntity outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_220785_i"}, remap = false)
|
||||||
|
private FoxEntity outerThis;
|
||||||
|
|
||||||
@Inject(method = "startExecuting", at = @At("HEAD"))
|
@Inject(method = "startExecuting", at = @At("HEAD"))
|
||||||
private void arclight$reason(CallbackInfo ci) {
|
private void arclight$reason(CallbackInfo ci) {
|
||||||
|
|||||||
@ -150,7 +150,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen
|
|||||||
@Shadow private int lastFoodLevel;
|
@Shadow private int lastFoodLevel;
|
||||||
@Shadow public int currentWindowId;
|
@Shadow public int currentWindowId;
|
||||||
@Shadow public abstract void getNextWindowId();
|
@Shadow public abstract void getNextWindowId();
|
||||||
@Shadow private String language;
|
@Shadow(remap = false) private String language;
|
||||||
@Shadow public abstract void teleport(ServerWorld p_200619_1_, double x, double y, double z, float yaw, float pitch);
|
@Shadow public abstract void teleport(ServerWorld p_200619_1_, double x, double y, double z, float yaw, float pitch);
|
||||||
@Shadow public abstract void giveExperiencePoints(int p_195068_1_);
|
@Shadow public abstract void giveExperiencePoints(int p_195068_1_);
|
||||||
@Shadow private RegistryKey<World> field_241137_cq_;
|
@Shadow private RegistryKey<World> field_241137_cq_;
|
||||||
@ -432,7 +432,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen
|
|||||||
* @author IzzelAliz
|
* @author IzzelAliz
|
||||||
* @reason
|
* @reason
|
||||||
*/
|
*/
|
||||||
@Overwrite
|
@Overwrite(remap = false)
|
||||||
@Nullable
|
@Nullable
|
||||||
public Entity changeDimension(ServerWorld server, ITeleporter teleporter) {
|
public Entity changeDimension(ServerWorld server, ITeleporter teleporter) {
|
||||||
if (this.isSleeping()) {
|
if (this.isSleeping()) {
|
||||||
@ -598,13 +598,13 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen
|
|||||||
return Either.left(PlayerEntity.SleepResult.OTHER_PROBLEM);
|
return Either.left(PlayerEntity.SleepResult.OTHER_PROBLEM);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "trySleep", at = @At(value = "INVOKE", target = "Lcom/mojang/datafixers/util/Either;left(Ljava/lang/Object;)Lcom/mojang/datafixers/util/Either;"))
|
@Redirect(method = "trySleep", at = @At(value = "INVOKE", remap = false, target = "Lcom/mojang/datafixers/util/Either;left(Ljava/lang/Object;)Lcom/mojang/datafixers/util/Either;"))
|
||||||
private <L, R> Either<L, R> arclight$failSleep(L value, BlockPos pos) {
|
private <L, R> Either<L, R> arclight$failSleep(L value, BlockPos pos) {
|
||||||
Either<L, R> either = Either.left(value);
|
Either<L, R> either = Either.left(value);
|
||||||
return arclight$fireBedEvent(either, pos);
|
return arclight$fireBedEvent(either, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "trySleep", at = @At(value = "INVOKE", target = "Lcom/mojang/datafixers/util/Either;ifRight(Ljava/util/function/Consumer;)Lcom/mojang/datafixers/util/Either;"))
|
@Redirect(method = "trySleep", at = @At(value = "INVOKE", remap = false, target = "Lcom/mojang/datafixers/util/Either;ifRight(Ljava/util/function/Consumer;)Lcom/mojang/datafixers/util/Either;"))
|
||||||
private <L, R> Either<L, R> arclight$successSleep(Either<L, R> either, Consumer<? super R> consumer, BlockPos pos) {
|
private <L, R> Either<L, R> arclight$successSleep(Either<L, R> either, Consumer<? super R> consumer, BlockPos pos) {
|
||||||
return arclight$fireBedEvent(either, pos).ifRight(consumer);
|
return arclight$fireBedEvent(either, pos).ifRight(consumer);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.tileentity;
|
package io.izzel.arclight.common.mixin.core.tileentity;
|
||||||
|
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.potion.Effect;
|
import net.minecraft.potion.Effect;
|
||||||
import net.minecraft.potion.EffectInstance;
|
import net.minecraft.potion.EffectInstance;
|
||||||
@ -25,7 +26,7 @@ public abstract class BeaconTileEntityMixin implements BeaconTileEntityBridge {
|
|||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
@Inject(method = "read", at = @At("RETURN"))
|
@Inject(method = "read", at = @At("RETURN"))
|
||||||
public void arclight$level(CompoundNBT compound, CallbackInfo ci) {
|
public void arclight$level(BlockState state, CompoundNBT compound, CallbackInfo ci) {
|
||||||
this.levels = compound.getInt("Levels");
|
this.levels = compound.getInt("Levels");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
|||||||
@Mixin(VillageSiege.class)
|
@Mixin(VillageSiege.class)
|
||||||
public class VillageSiegeMixin {
|
public class VillageSiegeMixin {
|
||||||
|
|
||||||
@Inject(method = "spawnZombie", 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;func_242417_l(Lnet/minecraft/entity/Entity;)V"))
|
||||||
public void arclight$addEntityReason(ServerWorld world, CallbackInfo ci) {
|
public void arclight$addEntityReason(ServerWorld world, CallbackInfo ci) {
|
||||||
((ServerWorldBridge) world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION);
|
((ServerWorldBridge) world).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world;
|
package io.izzel.arclight.common.mixin.core.world;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.world.IWorldBridge;
|
import io.izzel.arclight.common.bridge.world.server.ServerWorldBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.world.IServerWorld;
|
import net.minecraft.world.IServerWorld;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
@ -14,7 +13,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
@Mixin(IServerWorld.class)
|
@Mixin(IServerWorld.class)
|
||||||
public interface IServerWorldMixin extends IWorld, IWorldBridge, WorldBridge {
|
public interface IServerWorldMixin extends IWorld, ServerWorldBridge {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow ServerWorld getWorld();
|
@Shadow ServerWorld getWorld();
|
||||||
@ -49,4 +48,9 @@ public interface IServerWorldMixin extends IWorld, IWorldBridge, WorldBridge {
|
|||||||
}
|
}
|
||||||
return !entity.removed;
|
return !entity.removed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
default boolean bridge$addAllEntities(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||||
|
return this.addAllEntities(entity, reason);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,14 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world;
|
package io.izzel.arclight.common.mixin.core.world;
|
||||||
|
|
||||||
import io.izzel.arclight.api.ArclightVersion;
|
|
||||||
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.border.WorldBorderBridge;
|
import io.izzel.arclight.common.bridge.world.border.WorldBorderBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
|
|
||||||
import io.izzel.arclight.common.bridge.world.storage.DerivedWorldInfoBridge;
|
|
||||||
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
||||||
|
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.profiler.IProfiler;
|
import net.minecraft.profiler.IProfiler;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.RegistryKey;
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
@ -17,12 +16,11 @@ import net.minecraft.world.DimensionType;
|
|||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.IWorld;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.border.WorldBorder;
|
import net.minecraft.world.border.WorldBorder;
|
||||||
import net.minecraft.world.chunk.AbstractChunkProvider;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.dimension.Dimension;
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraft.world.storage.WorldInfo;
|
import net.minecraft.world.storage.ISpawnWorldInfo;
|
||||||
|
import net.minecraft.world.storage.IWorldInfo;
|
||||||
|
import net.minecraft.world.storage.ServerWorldInfo;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.CraftWorld;
|
import org.bukkit.craftbukkit.v.CraftWorld;
|
||||||
@ -38,13 +36,12 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
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.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@Mixin(World.class)
|
@Mixin(World.class)
|
||||||
public abstract class WorldMixin implements WorldBridge {
|
public abstract class WorldMixin implements WorldBridge {
|
||||||
@ -53,15 +50,14 @@ public abstract class WorldMixin implements WorldBridge {
|
|||||||
@Shadow @Nullable public TileEntity getTileEntity(BlockPos pos) { return null; }
|
@Shadow @Nullable public TileEntity getTileEntity(BlockPos pos) { return null; }
|
||||||
@Shadow public abstract BlockState getBlockState(BlockPos pos);
|
@Shadow public abstract BlockState getBlockState(BlockPos pos);
|
||||||
@Shadow public abstract void setTileEntity(BlockPos pos, @Nullable TileEntity tileEntityIn);
|
@Shadow public abstract void setTileEntity(BlockPos pos, @Nullable TileEntity tileEntityIn);
|
||||||
@Shadow public Dimension dimension;
|
|
||||||
@Shadow public abstract WorldInfo getWorldInfo();
|
|
||||||
@Shadow public abstract Dimension getDimension();
|
|
||||||
@Shadow public abstract long getSeed();
|
|
||||||
@Shadow @Final public WorldInfo worldInfo;
|
|
||||||
@Shadow public abstract WorldBorder getWorldBorder();
|
@Shadow public abstract WorldBorder getWorldBorder();
|
||||||
@Shadow@Final private WorldBorder worldBorder;
|
@Shadow @Final private WorldBorder worldBorder;
|
||||||
@Shadow public abstract long getDayTime();
|
@Shadow public abstract long getDayTime();
|
||||||
@Shadow@Final private DimensionType dimensionType;@Accessor("mainThread") public abstract Thread arclight$getMainThread();
|
@Shadow public abstract MinecraftServer shadow$getServer();
|
||||||
|
@Shadow @Final private DimensionType dimensionType;
|
||||||
|
@Shadow public abstract IWorldInfo getWorldInfo();
|
||||||
|
@Shadow public abstract RegistryKey<World> getDimensionKey();
|
||||||
|
@Accessor("mainThread") public abstract Thread arclight$getMainThread();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
private RegistryKey<DimensionType> typeKey;
|
private RegistryKey<DimensionType> typeKey;
|
||||||
@ -71,28 +67,33 @@ public abstract class WorldMixin implements WorldBridge {
|
|||||||
public long ticksPerAnimalSpawns;
|
public long ticksPerAnimalSpawns;
|
||||||
public long ticksPerMonsterSpawns;
|
public long ticksPerMonsterSpawns;
|
||||||
public long ticksPerWaterSpawns;
|
public long ticksPerWaterSpawns;
|
||||||
|
public long ticksPerWaterAmbientSpawns;
|
||||||
public long ticksPerAmbientSpawns;
|
public long ticksPerAmbientSpawns;
|
||||||
public boolean populating;
|
public boolean populating;
|
||||||
public org.bukkit.generator.ChunkGenerator generator;
|
public org.bukkit.generator.ChunkGenerator generator;
|
||||||
protected org.bukkit.World.Environment environment;
|
protected org.bukkit.World.Environment environment;
|
||||||
public org.spigotmc.SpigotWorldConfig spigotConfig;
|
public org.spigotmc.SpigotWorldConfig spigotConfig;
|
||||||
|
|
||||||
@Inject(method = "<init>(Lnet/minecraft/world/storage/WorldInfo;Lnet/minecraft/world/dimension/DimensionType;Ljava/util/function/BiFunction;Lnet/minecraft/profiler/IProfiler;Z)V", at = @At("RETURN"))
|
public void arclight$constructor(ISpawnWorldInfo p_i241925_1_, RegistryKey<World> p_i241925_2_, final DimensionType p_i241925_3_, Supplier<IProfiler> p_i241925_4_, boolean p_i241925_5_, boolean p_i241925_6_, long p_i241925_7_) {
|
||||||
private void arclight$init(WorldInfo info, DimensionType dimType, BiFunction<World, Dimension, AbstractChunkProvider> provider, IProfiler profilerIn, boolean remote, CallbackInfo ci) {
|
throw new RuntimeException();
|
||||||
if (info instanceof DerivedWorldInfoBridge) {
|
}
|
||||||
((DerivedWorldInfoBridge) info).bridge$setDimension(dimType);
|
|
||||||
}
|
public void arclight$constructor(ISpawnWorldInfo p_i241925_1_, RegistryKey<World> p_i241925_2_, final DimensionType p_i241925_3_, Supplier<IProfiler> p_i241925_4_, boolean p_i241925_5_, boolean p_i241925_6_, long p_i241925_7_, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
|
||||||
spigotConfig = new SpigotWorldConfig(info.getWorldName());
|
arclight$constructor(p_i241925_1_, p_i241925_2_, p_i241925_3_, p_i241925_4_, p_i241925_5_, p_i241925_6_, p_i241925_7_);
|
||||||
|
this.generator = gen;
|
||||||
|
this.environment = env;
|
||||||
|
bridge$getWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "<init>(Lnet/minecraft/world/storage/ISpawnWorldInfo;Lnet/minecraft/util/RegistryKey;Lnet/minecraft/world/DimensionType;Ljava/util/function/Supplier;ZZJ)V", at = @At("RETURN"))
|
||||||
|
private void arclight$init(ISpawnWorldInfo info, RegistryKey<World> p_i241925_2_, DimensionType dimType, Supplier<IProfiler> p_i241925_4_, boolean p_i241925_5_, boolean p_i241925_6_, long p_i241925_7_, CallbackInfo ci) {
|
||||||
|
this.spigotConfig = new SpigotWorldConfig(((ServerWorldInfo) info).getWorldName());
|
||||||
((WorldBorderBridge) this.worldBorder).bridge$setWorld((ServerWorld) (Object) this);
|
((WorldBorderBridge) this.worldBorder).bridge$setWorld((ServerWorld) (Object) this);
|
||||||
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns();
|
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns();
|
||||||
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns();
|
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns();
|
||||||
if (ArclightVersion.atLeast(ArclightVersion.v1_15)) {
|
this.ticksPerWaterSpawns = this.getServer().getTicksPerWaterSpawns();
|
||||||
this.ticksPerWaterSpawns = this.getServer().getTicksPerWaterSpawns();
|
this.ticksPerWaterAmbientSpawns = this.getServer().getTicksPerWaterAmbientSpawns();
|
||||||
this.ticksPerAmbientSpawns = this.getServer().getTicksPerAmbientSpawns();
|
this.ticksPerAmbientSpawns = this.getServer().getTicksPerAmbientSpawns();
|
||||||
} else {
|
|
||||||
this.ticksPerWaterSpawns = 1;
|
|
||||||
this.ticksPerAmbientSpawns = 1;
|
|
||||||
}
|
|
||||||
this.typeKey = this.getServer().getHandle().getServer().func_244267_aX().func_230520_a_().func_230519_c_(dimensionType)
|
this.typeKey = this.getServer().getHandle().getServer().func_244267_aX().func_230520_a_().func_230519_c_(dimensionType)
|
||||||
.orElseThrow(() -> new IllegalStateException("Unregistered dimension type: " + dimType));
|
.orElseThrow(() -> new IllegalStateException("Unregistered dimension type: " + dimType));
|
||||||
}
|
}
|
||||||
@ -119,17 +120,7 @@ public abstract class WorldMixin implements WorldBridge {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long bridge$ticksPerWaterAmbientSpawns() {
|
public long bridge$ticksPerWaterAmbientSpawns() {
|
||||||
}
|
return ticksPerWaterAmbientSpawns;
|
||||||
|
|
||||||
public void arclight$constructor(WorldInfo info, DimensionType dimType, BiFunction<World, Dimension, AbstractChunkProvider> provider, IProfiler profilerIn, boolean remote) {
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void arclight$constructor(WorldInfo info, DimensionType dimType, BiFunction<World, Dimension, AbstractChunkProvider> provider, IProfiler profilerIn, boolean remote, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
|
|
||||||
arclight$constructor(info, dimType, provider, profilerIn, remote);
|
|
||||||
this.generator = gen;
|
|
||||||
this.environment = env;
|
|
||||||
bridge$getWorld();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegistryKey<DimensionType> getTypeKey() {
|
public RegistryKey<DimensionType> getTypeKey() {
|
||||||
@ -164,10 +155,10 @@ public abstract class WorldMixin implements WorldBridge {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "markAndNotifyBlock", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;updateNeighbors(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;I)V"))
|
@Inject(method = "markAndNotifyBlock", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;updateNeighbours(Lnet/minecraft/world/IWorld;Lnet/minecraft/util/math/BlockPos;II)V"))
|
||||||
private void arclight$callBlockPhysics(BlockPos pos, Chunk chunk, BlockState blockstate, BlockState newState, int flags, CallbackInfo ci) {
|
private void arclight$callBlockPhysics(BlockPos pos, Chunk chunk, BlockState blockstate, BlockState state, int flags, int recursionLeft, CallbackInfo ci) {
|
||||||
if (this.world != null) {
|
if (this.world != null) {
|
||||||
BlockPhysicsEvent event = new BlockPhysicsEvent(CraftBlock.at((IWorld) this, pos), CraftBlockData.fromData(newState));
|
BlockPhysicsEvent event = new BlockPhysicsEvent(CraftBlock.at((IWorld) this, pos), CraftBlockData.fromData(state));
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
ci.cancel();
|
ci.cancel();
|
||||||
@ -175,13 +166,6 @@ public abstract class WorldMixin implements WorldBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "notifyNeighbors", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;notifyNeighborsOfStateChange(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"))
|
|
||||||
private void arclight$noPhysicsPopulating(BlockPos pos, Block blockIn, CallbackInfo ci) {
|
|
||||||
if (populating) {
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "neighborChanged", cancellable = true,
|
@Inject(method = "neighborChanged", cancellable = true,
|
||||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;neighborChanged(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;Lnet/minecraft/util/math/BlockPos;Z)V"),
|
at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;neighborChanged(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;Lnet/minecraft/util/math/BlockPos;Z)V"),
|
||||||
locals = LocalCapture.CAPTURE_FAILHARD)
|
locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
@ -196,11 +180,6 @@ public abstract class WorldMixin implements WorldBridge {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CraftServer getServer() {
|
public CraftServer getServer() {
|
||||||
return (CraftServer) Bukkit.getServer();
|
return (CraftServer) Bukkit.getServer();
|
||||||
}
|
}
|
||||||
@ -208,10 +187,10 @@ public abstract class WorldMixin implements WorldBridge {
|
|||||||
public CraftWorld getWorld() {
|
public CraftWorld getWorld() {
|
||||||
if (this.world == null) {
|
if (this.world == null) {
|
||||||
if (generator == null) {
|
if (generator == null) {
|
||||||
generator = getServer().getGenerator(getWorldInfo().getWorldName());
|
generator = getServer().getGenerator(((ServerWorldInfo) this.getWorldInfo()).getWorldName());
|
||||||
}
|
}
|
||||||
if (environment == null) {
|
if (environment == null) {
|
||||||
environment = org.bukkit.World.Environment.getEnvironment(getDimension().getType().getId());
|
environment = org.bukkit.World.Environment.valueOf(ResourceLocationUtil.standardize(this.typeKey.getRegistryName()));
|
||||||
}
|
}
|
||||||
this.world = new CraftWorld((ServerWorld) (Object) this, generator, environment);
|
this.world = new CraftWorld((ServerWorld) (Object) this, generator, environment);
|
||||||
getServer().addWorld(this.world);
|
getServer().addWorld(this.world);
|
||||||
|
|||||||
@ -1,19 +0,0 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world.dimension;
|
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.world.dimension.DimensionBridge;
|
|
||||||
import net.minecraft.world.dimension.Dimension;
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
|
||||||
|
|
||||||
@Mixin(Dimension.class)
|
|
||||||
public abstract class DimensionMixin implements DimensionBridge {
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
@Accessor("type") public abstract DimensionType bridge$getDimensionManager();
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
public DimensionType getDimensionManager() {
|
|
||||||
return bridge$getDimensionManager();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,49 +0,0 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world.dimension;
|
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
|
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraft.world.biome.IBiomeMagnifier;
|
|
||||||
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.Inject;
|
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
|
||||||
|
|
||||||
import java.util.function.BiFunction;
|
|
||||||
|
|
||||||
@Mixin(DimensionType.class)
|
|
||||||
public class DimensionTypeMixin implements DimensionTypeBridge {
|
|
||||||
|
|
||||||
protected void arclight$constructor(int idIn, String suffixIn, String directoryIn, BiFunction<World, DimensionType, ? extends Dimension> p_i49935_4_, boolean p_i49935_5_, IBiomeMagnifier p_i225789_6_) {
|
|
||||||
throw new RuntimeException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void arclight$constructor(int idIn, String suffixIn, String directoryIn, BiFunction<World, DimensionType, ? extends Dimension> p_i49935_4_, boolean p_i49935_5_, IBiomeMagnifier p_i225789_6_, DimensionType type) {
|
|
||||||
arclight$constructor(idIn, suffixIn, directoryIn, p_i49935_4_, p_i49935_5_, p_i225789_6_);
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DimensionType type;
|
|
||||||
|
|
||||||
public DimensionType getType() {
|
|
||||||
return (type == null) ? (DimensionType) (Object) this : type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bridge$setType(DimensionType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public DimensionType bridge$getType() {
|
|
||||||
return getType();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "isVanilla", remap = false, cancellable = true, at = @At("HEAD"))
|
|
||||||
private void arclight$vanillaCheck(CallbackInfoReturnable<Boolean> cir) {
|
|
||||||
if (this.type != null) {
|
|
||||||
cir.setReturnValue(this.type.isVanilla());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,15 +1,19 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world.gen.feature.structure;
|
package io.izzel.arclight.common.mixin.core.world.gen.feature.structure;
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.world.IWorldWriterBridge;
|
import io.izzel.arclight.common.bridge.world.IWorldWriterBridge;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.ChunkPos;
|
import net.minecraft.util.math.ChunkPos;
|
||||||
import net.minecraft.util.math.MutableBoundingBox;
|
import net.minecraft.util.math.MutableBoundingBox;
|
||||||
import net.minecraft.world.IWorld;
|
import net.minecraft.world.ISeedReader;
|
||||||
|
import net.minecraft.world.IServerWorld;
|
||||||
import net.minecraft.world.gen.ChunkGenerator;
|
import net.minecraft.world.gen.ChunkGenerator;
|
||||||
|
import net.minecraft.world.gen.feature.structure.StructureManager;
|
||||||
import net.minecraft.world.gen.feature.structure.SwampHutPiece;
|
import net.minecraft.world.gen.feature.structure.SwampHutPiece;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
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.CallbackInfoReturnable;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -17,8 +21,13 @@ import java.util.Random;
|
|||||||
@Mixin(SwampHutPiece.class)
|
@Mixin(SwampHutPiece.class)
|
||||||
public class SwampHutPieceMixin {
|
public class SwampHutPieceMixin {
|
||||||
|
|
||||||
@Inject(method = "create", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/IWorld;addEntity(Lnet/minecraft/entity/Entity;)Z"))
|
@Inject(method = "func_230383_a_", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/ISeedReader;func_242417_l(Lnet/minecraft/entity/Entity;)V"))
|
||||||
public void arclight$spawnReason(IWorld worldIn, ChunkGenerator<?> chunkGeneratorIn, Random randomIn, MutableBoundingBox mutableBoundingBoxIn, ChunkPos chunkPosIn, CallbackInfoReturnable<Boolean> cir) {
|
private void arclight$spawnReason1(ISeedReader worldIn, StructureManager p_230383_2_, ChunkGenerator p_230383_3_, Random p_230383_4_, MutableBoundingBox p_230383_5_, ChunkPos p_230383_6_, BlockPos p_230383_7_, CallbackInfoReturnable<Boolean> cir) {
|
||||||
|
((IWorldWriterBridge) worldIn).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "func_214821_a", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/IServerWorld;func_242417_l(Lnet/minecraft/entity/Entity;)V"))
|
||||||
|
private void arclight$spawnReason2(IServerWorld worldIn, MutableBoundingBox p_214821_2_, CallbackInfo ci) {
|
||||||
((IWorldWriterBridge) worldIn).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
|
((IWorldWriterBridge) worldIn).bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.CHUNK_GEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ public abstract class ChunkManagerMixin implements ChunkManagerBridge {
|
|||||||
@Shadow abstract boolean isOutsideSpawningRadius(ChunkPos chunkPosIn);
|
@Shadow abstract boolean isOutsideSpawningRadius(ChunkPos chunkPosIn);
|
||||||
@Shadow protected abstract void tickEntityTracker();
|
@Shadow protected abstract void tickEntityTracker();
|
||||||
@Invoker("tick") public abstract void bridge$tick(BooleanSupplier hasMoreTime);
|
@Invoker("tick") public abstract void bridge$tick(BooleanSupplier hasMoreTime);
|
||||||
|
@Invoker("setViewDistance") public abstract void bridge$setViewDistance(int i);
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
public final ArclightCallbackExecutor callbackExecutor = new ArclightCallbackExecutor();
|
public final ArclightCallbackExecutor callbackExecutor = new ArclightCallbackExecutor();
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import net.minecraft.world.GameRules;
|
|||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.ChunkStatus;
|
import net.minecraft.world.chunk.ChunkStatus;
|
||||||
import net.minecraft.world.chunk.IChunk;
|
import net.minecraft.world.chunk.IChunk;
|
||||||
|
import net.minecraft.world.gen.ChunkGenerator;
|
||||||
import net.minecraft.world.server.ChunkHolder;
|
import net.minecraft.world.server.ChunkHolder;
|
||||||
import net.minecraft.world.server.ChunkManager;
|
import net.minecraft.world.server.ChunkManager;
|
||||||
import net.minecraft.world.server.ServerChunkProvider;
|
import net.minecraft.world.server.ServerChunkProvider;
|
||||||
@ -22,6 +23,7 @@ import net.minecraft.world.server.TicketType;
|
|||||||
import net.minecraft.world.storage.IWorldInfo;
|
import net.minecraft.world.storage.IWorldInfo;
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Mutable;
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
@ -50,6 +52,7 @@ public abstract class ServerChunkProviderMixin implements ServerChunkProviderBri
|
|||||||
@Shadow public boolean spawnHostiles;
|
@Shadow public boolean spawnHostiles;
|
||||||
@Shadow public boolean spawnPassives;
|
@Shadow public boolean spawnPassives;
|
||||||
@Shadow protected abstract void func_241098_a_(long p_241098_1_, Consumer<Chunk> p_241098_3_);
|
@Shadow protected abstract void func_241098_a_(long p_241098_1_, Consumer<Chunk> p_241098_3_);
|
||||||
|
@Shadow @Final @Mutable public ChunkGenerator generator;
|
||||||
@Invoker("func_217235_l") public abstract boolean bridge$tickDistanceManager();
|
@Invoker("func_217235_l") public abstract boolean bridge$tickDistanceManager();
|
||||||
@Accessor("lightManager") public abstract ServerWorldLightManager bridge$getLightManager();
|
@Accessor("lightManager") public abstract ServerWorldLightManager bridge$getLightManager();
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
@ -64,6 +67,16 @@ public abstract class ServerChunkProviderMixin implements ServerChunkProviderBri
|
|||||||
return isChunkLoaded(x, z);
|
return isChunkLoaded(x, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bridge$setChunkGenerator(ChunkGenerator chunkGenerator) {
|
||||||
|
this.generator = chunkGenerator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void bridge$setViewDistance(int viewDistance) {
|
||||||
|
((ChunkManagerBridge) this.chunkManager).bridge$setViewDistance(viewDistance);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author IzzelAliz
|
* @author IzzelAliz
|
||||||
* @reason
|
* @reason
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world.server;
|
|
||||||
|
|
||||||
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 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -2,57 +2,63 @@ package io.izzel.arclight.common.mixin.core.world.server;
|
|||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
||||||
|
import io.izzel.arclight.common.bridge.entity.LivingEntityBridge;
|
||||||
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
|
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
|
||||||
import io.izzel.arclight.common.bridge.inventory.IInventoryBridge;
|
import io.izzel.arclight.common.bridge.inventory.IInventoryBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.ExplosionBridge;
|
import io.izzel.arclight.common.bridge.world.ExplosionBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
|
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
||||||
|
import io.izzel.arclight.common.bridge.world.server.ServerChunkProviderBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.server.ServerWorldBridge;
|
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.MapDataBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.storage.WorldInfoBridge;
|
import io.izzel.arclight.common.bridge.world.storage.WorldInfoBridge;
|
||||||
import io.izzel.arclight.common.mixin.core.world.WorldMixin;
|
import io.izzel.arclight.common.mixin.core.world.WorldMixin;
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntMap;
|
|
||||||
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
import net.minecraft.block.Blocks;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.EntityClassification;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.MobEntity;
|
|
||||||
import net.minecraft.entity.effect.LightningBoltEntity;
|
import net.minecraft.entity.effect.LightningBoltEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.network.IPacket;
|
import net.minecraft.network.IPacket;
|
||||||
import net.minecraft.network.play.server.SSpawnParticlePacket;
|
import net.minecraft.network.play.server.SSpawnParticlePacket;
|
||||||
import net.minecraft.particles.IParticleData;
|
import net.minecraft.particles.IParticleData;
|
||||||
import net.minecraft.profiler.IProfiler;
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.DamageSource;
|
import net.minecraft.util.DamageSource;
|
||||||
import net.minecraft.util.IProgressUpdate;
|
import net.minecraft.util.IProgressUpdate;
|
||||||
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.ExplosionContext;
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldSettings;
|
|
||||||
import net.minecraft.world.chunk.Chunk;
|
import net.minecraft.world.chunk.Chunk;
|
||||||
import net.minecraft.world.chunk.listener.IChunkStatusListener;
|
import net.minecraft.world.chunk.listener.IChunkStatusListener;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.world.gen.ChunkGenerator;
|
||||||
import net.minecraft.world.server.ServerChunkProvider;
|
import net.minecraft.world.server.ServerChunkProvider;
|
||||||
import net.minecraft.world.server.ServerWorld;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
import net.minecraft.world.spawner.WanderingTraderSpawner;
|
import net.minecraft.world.spawner.ISpecialSpawner;
|
||||||
|
import net.minecraft.world.storage.IServerWorldInfo;
|
||||||
import net.minecraft.world.storage.MapData;
|
import net.minecraft.world.storage.MapData;
|
||||||
import net.minecraft.world.storage.SaveHandler;
|
import net.minecraft.world.storage.SaveFormat;
|
||||||
import net.minecraft.world.storage.WorldInfo;
|
import net.minecraft.world.storage.ServerWorldInfo;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.craftbukkit.v.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftHumanEntity;
|
import org.bukkit.craftbukkit.v.entity.CraftHumanEntity;
|
||||||
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
import org.bukkit.craftbukkit.v.event.CraftEventFactory;
|
||||||
|
import org.bukkit.craftbukkit.v.generator.CustomChunkGenerator;
|
||||||
|
import org.bukkit.craftbukkit.v.util.BlockStateListPopulator;
|
||||||
|
import org.bukkit.craftbukkit.v.util.WorldUUID;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.LightningStrike;
|
import org.bukkit.entity.LightningStrike;
|
||||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||||
import org.bukkit.event.server.MapInitializeEvent;
|
import org.bukkit.event.server.MapInitializeEvent;
|
||||||
import org.bukkit.event.weather.LightningStrikeEvent;
|
import org.bukkit.event.weather.LightningStrikeEvent;
|
||||||
|
import org.bukkit.event.world.PortalCreateEvent;
|
||||||
import org.bukkit.event.world.TimeSkipEvent;
|
import org.bukkit.event.world.TimeSkipEvent;
|
||||||
import org.bukkit.event.world.WorldSaveEvent;
|
import org.bukkit.event.world.WorldSaveEvent;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
@ -60,7 +66,6 @@ import org.spongepowered.asm.mixin.Final;
|
|||||||
import org.spongepowered.asm.mixin.Implements;
|
import org.spongepowered.asm.mixin.Implements;
|
||||||
import org.spongepowered.asm.mixin.Interface;
|
import org.spongepowered.asm.mixin.Interface;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Mutable;
|
|
||||||
import org.spongepowered.asm.mixin.Overwrite;
|
import org.spongepowered.asm.mixin.Overwrite;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
@ -73,7 +78,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
|||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -84,29 +89,53 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow public abstract boolean addEntity(Entity entityIn);
|
@Shadow public abstract boolean addEntity(Entity entityIn);
|
||||||
@Shadow public abstract boolean summonEntity(Entity entityIn);
|
@Shadow public abstract boolean summonEntity(Entity entityIn);
|
||||||
@Shadow public abstract void addLightningBolt(LightningBoltEntity entityIn);
|
|
||||||
@Shadow public abstract <T extends IParticleData> int spawnParticle(T type, double posX, double posY, double posZ, int particleCount, double xOffset, double yOffset, double zOffset, double speed);
|
@Shadow public abstract <T extends IParticleData> int spawnParticle(T type, double posX, double posY, double posZ, int particleCount, double xOffset, double yOffset, double zOffset, double speed);
|
||||||
@Shadow protected abstract boolean sendPacketWithinDistance(ServerPlayerEntity player, boolean longDistance, double posX, double posY, double posZ, IPacket<?> packet);
|
@Shadow protected abstract boolean sendPacketWithinDistance(ServerPlayerEntity player, boolean longDistance, double posX, double posY, double posZ, IPacket<?> packet);
|
||||||
@Shadow @Nonnull public abstract MinecraftServer shadow$getServer();
|
@Shadow @Nonnull public abstract MinecraftServer shadow$getServer();
|
||||||
@Shadow @Final private List<ServerPlayerEntity> players;
|
@Shadow @Final private List<ServerPlayerEntity> players;
|
||||||
@Shadow @Final public Int2ObjectMap<Entity> entitiesById;
|
@Shadow @Final public Int2ObjectMap<Entity> entitiesById;
|
||||||
@Shadow public abstract ServerChunkProvider getChunkProvider();
|
@Shadow public abstract ServerChunkProvider getChunkProvider();
|
||||||
@Shadow @Final @Mutable @Nullable private WanderingTraderSpawner wanderingTraderSpawner;
|
|
||||||
@Shadow private boolean allPlayersSleeping;
|
@Shadow private boolean allPlayersSleeping;
|
||||||
@Shadow protected abstract void wakeUpAllPlayers();
|
@Shadow protected abstract void wakeUpAllPlayers();
|
||||||
|
@Shadow @Final private ServerChunkProvider field_241102_C_;
|
||||||
|
@Shadow protected abstract boolean hasDuplicateEntity(Entity entityIn);
|
||||||
|
@Shadow @Final public static BlockPos field_241108_a_;
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
public void arclight$constructor(MinecraftServer serverIn, Executor executor, SaveHandler saveHandler, WorldInfo worldInfo, DimensionType dimType, IProfiler profiler, IChunkStatusListener listener) {
|
@SuppressWarnings({"FieldCanBeLocal", "unused"})
|
||||||
|
private ServerWorldInfo $$worldDataServer;
|
||||||
|
public SaveFormat.LevelSave convertable;
|
||||||
|
public UUID uuid;
|
||||||
|
|
||||||
|
public void arclight$constructor(MinecraftServer p_i241885_1_, Executor p_i241885_2_, SaveFormat.LevelSave p_i241885_3_, IServerWorldInfo p_i241885_4_, RegistryKey<World> p_i241885_5_, DimensionType p_i241885_6_, IChunkStatusListener p_i241885_7_, ChunkGenerator p_i241885_8_, boolean p_i241885_9_, long p_i241885_10_, List<ISpecialSpawner> p_i241885_12_, boolean p_i241885_13_) {
|
||||||
throw new RuntimeException();
|
throw new RuntimeException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void arclight$constructor(MinecraftServer serverIn, Executor executor, SaveHandler saveHandler, WorldInfo worldInfo, DimensionType dimType, IProfiler profiler, IChunkStatusListener listener, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
|
public void arclight$constructor(MinecraftServer p_i241885_1_, Executor p_i241885_2_, SaveFormat.LevelSave p_i241885_3_, ServerWorldInfo p_i241885_4_, RegistryKey<World> p_i241885_5_, DimensionType p_i241885_6_, IChunkStatusListener p_i241885_7_, ChunkGenerator p_i241885_8_, boolean p_i241885_9_, long p_i241885_10_, List<ISpecialSpawner> p_i241885_12_, boolean p_i241885_13_, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
|
||||||
arclight$constructor(serverIn, executor, saveHandler, worldInfo, dimType, profiler, listener);
|
arclight$constructor(p_i241885_1_, p_i241885_2_, p_i241885_3_, p_i241885_4_, p_i241885_5_, p_i241885_6_, p_i241885_7_, p_i241885_8_, p_i241885_9_, p_i241885_10_, p_i241885_12_, p_i241885_13_);
|
||||||
this.generator = gen;
|
this.generator = gen;
|
||||||
this.environment = env;
|
this.environment = env;
|
||||||
|
if (gen != null) {
|
||||||
|
CustomChunkGenerator generator = new CustomChunkGenerator((ServerWorld) (Object) this, this.field_241102_C_.getChunkGenerator(), gen);
|
||||||
|
((ServerChunkProviderBridge) this.field_241102_C_).bridge$setChunkGenerator(generator);
|
||||||
|
}
|
||||||
bridge$getWorld();
|
bridge$getWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject(method = "<init>(Lnet/minecraft/server/MinecraftServer;Ljava/util/concurrent/Executor;Lnet/minecraft/world/storage/SaveFormat$LevelSave;Lnet/minecraft/world/storage/IServerWorldInfo;Lnet/minecraft/util/RegistryKey;Lnet/minecraft/world/DimensionType;Lnet/minecraft/world/chunk/listener/IChunkStatusListener;Lnet/minecraft/world/gen/ChunkGenerator;ZJLjava/util/List;Z)V", at = @At("RETURN"))
|
||||||
|
private void arclight$init(MinecraftServer minecraftServer, Executor p_i241885_2_, SaveFormat.LevelSave p_i241885_3_, IServerWorldInfo worldInfo, RegistryKey<World> p_i241885_5_, DimensionType p_i241885_6_, IChunkStatusListener p_i241885_7_, ChunkGenerator p_i241885_8_, boolean p_i241885_9_, long p_i241885_10_, List<ISpecialSpawner> p_i241885_12_, boolean p_i241885_13_, CallbackInfo ci) {
|
||||||
|
this.pvpMode = minecraftServer.isPVPEnabled();
|
||||||
|
this.convertable = p_i241885_3_;
|
||||||
|
this.uuid = WorldUUID.getUUID(p_i241885_3_.getDimensionFolder(this.getDimensionKey()));
|
||||||
|
this.$$worldDataServer = (ServerWorldInfo) worldInfo;
|
||||||
|
((ServerChunkProviderBridge) this.field_241102_C_).bridge$setViewDistance(spigotConfig.viewDistance);
|
||||||
|
((WorldInfoBridge) worldInfo).bridge$setWorld((ServerWorld) (Object) this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Chunk getChunkIfLoaded(int x, int z) {
|
||||||
|
return this.field_241102_C_.getChunk(x, z, false);
|
||||||
|
}
|
||||||
|
|
||||||
public <T extends IParticleData> int sendParticles(final ServerPlayerEntity sender, final T t0, final double d0, final double d1, final double d2, final int i, final double d3, final double d4, final double d5, final double d6, final boolean force) {
|
public <T extends IParticleData> int sendParticles(final ServerPlayerEntity sender, final T t0, final double d0, final double d1, final double d2, final int i, final double d3, final double d4, final double d5, final double d6, final boolean force) {
|
||||||
SSpawnParticlePacket packet = new SSpawnParticlePacket(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
|
SSpawnParticlePacket packet = new SSpawnParticlePacket(t0, force, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
|
||||||
int j = 0;
|
int j = 0;
|
||||||
@ -120,6 +149,11 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
return j;
|
return j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SaveFormat.LevelSave bridge$getConvertable() {
|
||||||
|
return this.convertable;
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "onEntityAdded", at = @At("RETURN"))
|
@Inject(method = "onEntityAdded", at = @At("RETURN"))
|
||||||
private void arclight$validEntity(Entity entityIn, CallbackInfo ci) {
|
private void arclight$validEntity(Entity entityIn, CallbackInfo ci) {
|
||||||
((EntityBridge) entityIn).bridge$setValid(true);
|
((EntityBridge) entityIn).bridge$setValid(true);
|
||||||
@ -130,33 +164,38 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
((EntityBridge) entityIn).bridge$setValid(false);
|
((EntityBridge) entityIn).bridge$setValid(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "tickEnvironment", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;addEntity(Lnet/minecraft/entity/Entity;)Z"))
|
@Inject(method = "tickEnvironment", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/server/ServerWorld;addEntity(Lnet/minecraft/entity/Entity;)Z"))
|
||||||
public void arclight$thunder(Chunk chunkIn, int randomTickSpeed, CallbackInfo ci) {
|
public void arclight$thunder(Chunk chunkIn, int randomTickSpeed, CallbackInfo ci) {
|
||||||
bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
bridge$pushAddEntityReason(CreatureSpawnEvent.SpawnReason.LIGHTNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Redirect(method = "tickEnvironment", at = @At(value = "INVOKE", ordinal = 1, target = "Lnet/minecraft/world/server/ServerWorld;addEntity(Lnet/minecraft/entity/Entity;)Z"))
|
||||||
|
private boolean arclight$thunder(ServerWorld serverWorld, Entity entityIn) {
|
||||||
|
return strikeLightning(entityIn, LightningStrikeEvent.Cause.WEATHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean strikeLightning(Entity entity) {
|
||||||
|
return this.strikeLightning(entity, LightningStrikeEvent.Cause.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean strikeLightning(Entity entity, LightningStrikeEvent.Cause cause) {
|
||||||
|
if (arclight$cause != null) {
|
||||||
|
cause = arclight$cause;
|
||||||
|
arclight$cause = null;
|
||||||
|
}
|
||||||
|
LightningStrikeEvent lightning = new LightningStrikeEvent(this.bridge$getWorld(), (LightningStrike) ((LivingEntityBridge) entity).bridge$getBukkitEntity(), cause);
|
||||||
|
Bukkit.getPluginManager().callEvent(lightning);
|
||||||
|
if (lightning.isCancelled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.addEntity(entity);
|
||||||
|
}
|
||||||
|
|
||||||
@Redirect(method = "tickEnvironment", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z"))
|
@Redirect(method = "tickEnvironment", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setBlockState(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;)Z"))
|
||||||
public boolean arclight$snowForm(ServerWorld serverWorld, BlockPos pos, BlockState state) {
|
public boolean arclight$snowForm(ServerWorld serverWorld, BlockPos pos, BlockState state) {
|
||||||
return CraftEventFactory.handleBlockFormEvent(serverWorld, pos, state, null);
|
return CraftEventFactory.handleBlockFormEvent(serverWorld, pos, state, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "createSpawnPosition", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/biome/provider/BiomeProvider;getBiomesToSpawnIn()Ljava/util/List;"))
|
|
||||||
public void arclight$spawnPoint(WorldSettings settings, CallbackInfo ci) {
|
|
||||||
if (this.generator != null) {
|
|
||||||
Random rand = new Random(this.getSeed());
|
|
||||||
org.bukkit.Location spawn = this.generator.getFixedSpawnLocation(bridge$getWorld(), rand);
|
|
||||||
|
|
||||||
if (spawn != null) {
|
|
||||||
if (spawn.getWorld() != (bridge$getWorld())) {
|
|
||||||
throw new IllegalStateException("Cannot set spawn point for " + this.worldInfo.getWorldName() + " to be in another world (" + spawn.getWorld().getName() + ")");
|
|
||||||
} else {
|
|
||||||
this.worldInfo.setSpawn(new BlockPos(spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ()));
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "save", at = @At(value = "JUMP", ordinal = 0, opcode = Opcodes.IFNULL))
|
@Inject(method = "save", at = @At(value = "JUMP", ordinal = 0, opcode = Opcodes.IFNULL))
|
||||||
public void arclight$worldSave(IProgressUpdate progress, boolean flush, boolean skipSave, CallbackInfo ci) {
|
public void arclight$worldSave(IProgressUpdate progress, boolean flush, boolean skipSave, CallbackInfo ci) {
|
||||||
Bukkit.getPluginManager().callEvent(new WorldSaveEvent(bridge$getWorld()));
|
Bukkit.getPluginManager().callEvent(new WorldSaveEvent(bridge$getWorld()));
|
||||||
@ -180,29 +219,6 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
((EntityBridge) entityIn).bridge$setValid(false);
|
((EntityBridge) entityIn).bridge$setValid(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @author IzzelAliz
|
|
||||||
* @reason
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
@Nullable
|
|
||||||
public MapData getMapData(String mapName) {
|
|
||||||
return this.shadow$getServer().getWorld(DimensionType.OVERWORLD).getSavedData().get(() -> {
|
|
||||||
MapData newMap = new MapData(mapName);
|
|
||||||
MapInitializeEvent event = new MapInitializeEvent(((MapDataBridge) newMap).bridge$getMapView());
|
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
|
||||||
return newMap;
|
|
||||||
}, mapName);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "<init>", at = @At("RETURN"))
|
|
||||||
public void arclight$init(MinecraftServer serverIn, Executor executor, SaveHandler saveHandler, WorldInfo worldInfo, DimensionType dimType, IProfiler profiler, IChunkStatusListener listener, CallbackInfo ci) {
|
|
||||||
((WorldInfoBridge) worldInfo).bridge$setWorld((ServerWorld) (Object) this);
|
|
||||||
if (this.wanderingTraderSpawner == null && ((DimensionTypeBridge) this.dimension.getType()).bridge$getType() == DimensionType.OVERWORLD) {
|
|
||||||
this.wanderingTraderSpawner = new WanderingTraderSpawner((ServerWorld) (Object) this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private transient boolean arclight$force;
|
private transient boolean arclight$force;
|
||||||
|
|
||||||
@Redirect(method = "spawnParticle(Lnet/minecraft/particles/IParticleData;DDDIDDDD)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;sendPacketWithinDistance(Lnet/minecraft/entity/player/ServerPlayerEntity;ZDDDLnet/minecraft/network/IPacket;)Z"))
|
@Redirect(method = "spawnParticle(Lnet/minecraft/particles/IParticleData;DDDIDDDD)I", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;sendPacketWithinDistance(Lnet/minecraft/entity/player/ServerPlayerEntity;ZDDDLnet/minecraft/network/IPacket;)Z"))
|
||||||
@ -222,27 +238,11 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
|
|
||||||
private transient LightningStrikeEvent.Cause arclight$cause;
|
private transient LightningStrikeEvent.Cause arclight$cause;
|
||||||
|
|
||||||
@Inject(method = "addLightningBolt", cancellable = true, at = @At("HEAD"))
|
|
||||||
public void arclight$lightningEvent(LightningBoltEntity entityIn, CallbackInfo ci) {
|
|
||||||
LightningStrikeEvent event = new LightningStrikeEvent(this.getWorld(), (LightningStrike) ((EntityBridge) entityIn).bridge$getBukkitEntity(), arclight$cause);
|
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
|
||||||
ci.cancel();
|
|
||||||
}
|
|
||||||
arclight$cause = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bridge$pushStrikeLightningCause(LightningStrikeEvent.Cause cause) {
|
public void bridge$pushStrikeLightningCause(LightningStrikeEvent.Cause cause) {
|
||||||
this.arclight$cause = cause;
|
this.arclight$cause = cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void strikeLightning(LightningBoltEntity entity, LightningStrikeEvent.Cause cause) {
|
|
||||||
bridge$pushStrikeLightningCause(cause);
|
|
||||||
this.addLightningBolt(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bridge$strikeLightning(LightningBoltEntity entity, LightningStrikeEvent.Cause cause) {
|
public void bridge$strikeLightning(LightningBoltEntity entity, LightningStrikeEvent.Cause cause) {
|
||||||
strikeLightning(entity, cause);
|
strikeLightning(entity, cause);
|
||||||
@ -251,12 +251,12 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
private transient CreatureSpawnEvent.SpawnReason arclight$reason;
|
private transient CreatureSpawnEvent.SpawnReason arclight$reason;
|
||||||
|
|
||||||
@Inject(method = "addEntity0", cancellable = true, at = @At(value = "INVOKE", remap = false, 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) {
|
private void arclight$addEntityEvent(Entity entityIn, CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (arclight$reason == null) arclight$reason = CreatureSpawnEvent.SpawnReason.DEFAULT;
|
CreatureSpawnEvent.SpawnReason reason = arclight$reason == null ? CreatureSpawnEvent.SpawnReason.DEFAULT : arclight$reason;
|
||||||
if (!CraftEventFactory.doEntityAddEventCalling((ServerWorld) (Object) this, entityIn, arclight$reason)) {
|
arclight$reason = null;
|
||||||
|
if (!CraftEventFactory.doEntityAddEventCalling((ServerWorld) (Object) this, entityIn, reason)) {
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
}
|
}
|
||||||
arclight$reason = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "addEntity0", at = @At("RETURN"))
|
@Inject(method = "addEntity0", at = @At("RETURN"))
|
||||||
@ -294,9 +294,21 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
return addEntitySerialized(entity, reason);
|
return addEntitySerialized(entity, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean addAllEntitiesSafely(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||||
|
if (entity.getSelfAndPassengers().anyMatch(this::hasDuplicateEntity)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return this.bridge$addAllEntities(entity, reason);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean bridge$addAllEntitiesSafely(Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||||
|
return addAllEntitiesSafely(entity, reason);
|
||||||
|
}
|
||||||
|
|
||||||
@Inject(method = "createExplosion", cancellable = true, at = @At(value = "INVOKE", shift = At.Shift.AFTER,
|
@Inject(method = "createExplosion", cancellable = true, at = @At(value = "INVOKE", shift = At.Shift.AFTER,
|
||||||
target = "Lnet/minecraft/world/Explosion;doExplosionB(Z)V"), locals = LocalCapture.CAPTURE_FAILHARD)
|
target = "Lnet/minecraft/world/Explosion;doExplosionB(Z)V"), locals = LocalCapture.CAPTURE_FAILHARD)
|
||||||
public void arclight$doExplosion(Entity entityIn, DamageSource damageSourceIn, double xIn, double yIn, double zIn,
|
public void arclight$doExplosion(Entity entityIn, DamageSource damageSourceIn, @Nullable ExplosionContext context, double xIn, double yIn, double zIn,
|
||||||
float explosionRadius, boolean causesFire, Explosion.Mode modeIn, CallbackInfoReturnable<Explosion> cir,
|
float explosionRadius, boolean causesFire, Explosion.Mode modeIn, CallbackInfoReturnable<Explosion> cir,
|
||||||
Explosion explosion) {
|
Explosion explosion) {
|
||||||
if (((ExplosionBridge) explosion).bridge$wasCancelled()) {
|
if (((ExplosionBridge) explosion).bridge$wasCancelled()) {
|
||||||
@ -304,6 +316,28 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author IzzelAliz
|
||||||
|
* @reason
|
||||||
|
*/
|
||||||
|
@Overwrite
|
||||||
|
@Nullable
|
||||||
|
public MapData getMapData(String mapName) {
|
||||||
|
return this.shadow$getServer().func_241755_D_().getSavedData().get(() -> {
|
||||||
|
MapData newMap = new MapData(mapName);
|
||||||
|
MapInitializeEvent event = new MapInitializeEvent(((MapDataBridge) newMap).bridge$getMapView());
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
return newMap;
|
||||||
|
}, mapName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Inject(method = "func_230547_a_", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;notifyNeighborsOfStateChange(Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/Block;)V"))
|
||||||
|
private void arclight$returnIfPopulate(BlockPos p_230547_1_, Block p_230547_2_, CallbackInfo ci) {
|
||||||
|
if (populating) {
|
||||||
|
ci.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity bridge$getTileEntity(BlockPos blockPos) {
|
public TileEntity bridge$getTileEntity(BlockPos blockPos) {
|
||||||
return this.getTileEntity(blockPos);
|
return this.getTileEntity(blockPos);
|
||||||
@ -356,35 +390,13 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;func_241114_a_(J)V"))
|
||||||
* @author IzzelAliz
|
|
||||||
* @reason
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
public Object2IntMap<EntityClassification> countEntities() {
|
|
||||||
Object2IntMap<EntityClassification> map = new Object2IntOpenHashMap<>();
|
|
||||||
for (Entity entity : this.entitiesById.values()) {
|
|
||||||
if (entity instanceof MobEntity) {
|
|
||||||
MobEntity mobEntity = (MobEntity) entity;
|
|
||||||
if (mobEntity.canDespawn(0.0) && mobEntity.isNoDespawnRequired()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EntityClassification classification = entity.getType().getClassification();
|
|
||||||
if (classification != EntityClassification.MISC && this.getChunkProvider().func_223435_b(entity)) {
|
|
||||||
map.mergeInt(classification, 1, Integer::sum);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/server/ServerWorld;setDayTime(J)V"))
|
|
||||||
private void arclight$timeSkip(ServerWorld world, long time) {
|
private void arclight$timeSkip(ServerWorld world, long time) {
|
||||||
TimeSkipEvent event = new TimeSkipEvent(this.bridge$getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (time - time % 24000L) - this.getDayTime());
|
TimeSkipEvent event = new TimeSkipEvent(this.bridge$getWorld(), TimeSkipEvent.SkipReason.NIGHT_SKIP, (time - time % 24000L) - this.getDayTime());
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
arclight$timeSkipCancelled = event.isCancelled();
|
arclight$timeSkipCancelled = event.isCancelled();
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
world.setDayTime(this.getDayTime() + event.getSkipAmount());
|
world.func_241114_a_(this.getDayTime() + event.getSkipAmount());
|
||||||
this.allPlayersSleeping = this.players.stream().allMatch(LivingEntity::isSleeping);
|
this.allPlayersSleeping = this.players.stream().allMatch(LivingEntity::isSleeping);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,4 +415,33 @@ public abstract class ServerWorldMixin extends WorldMixin implements ServerWorld
|
|||||||
public ServerWorld bridge$getMinecraftWorld() {
|
public ServerWorld bridge$getMinecraftWorld() {
|
||||||
return (ServerWorld) (Object) this;
|
return (ServerWorld) (Object) this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author IzzelAliz
|
||||||
|
* @reason
|
||||||
|
*/
|
||||||
|
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||||
|
@Overwrite
|
||||||
|
public static void func_241121_a_(ServerWorld world) {
|
||||||
|
BlockPos blockpos = field_241108_a_;
|
||||||
|
int i = blockpos.getX();
|
||||||
|
int j = blockpos.getY() - 2;
|
||||||
|
int k = blockpos.getZ();
|
||||||
|
BlockStateListPopulator blockList = new BlockStateListPopulator(world);
|
||||||
|
BlockPos.getAllInBoxMutable(i - 2, j + 1, k - 2, i + 2, j + 3, k + 2).forEach((p_241122_1_) -> {
|
||||||
|
blockList.setBlockState(p_241122_1_, Blocks.OBSIDIAN.getDefaultState(), 3);
|
||||||
|
});
|
||||||
|
BlockPos.getAllInBoxMutable(i - 2, j, k - 2, i + 2, j, k + 2).forEach((p_241122_1_) -> {
|
||||||
|
blockList.setBlockState(p_241122_1_, Blocks.OBSIDIAN.getDefaultState(), 3);
|
||||||
|
});
|
||||||
|
CraftWorld bworld = ((WorldBridge) world).bridge$getWorld();
|
||||||
|
boolean spawnPortal = ArclightCaptures.getEndPortalSpawn();
|
||||||
|
Entity entity = ArclightCaptures.getEndPortalEntity();
|
||||||
|
PortalCreateEvent portalEvent = new PortalCreateEvent((List) blockList.getList(), bworld, entity == null ? null : ((EntityBridge) entity).bridge$getBukkitEntity(), PortalCreateEvent.CreateReason.END_PLATFORM);
|
||||||
|
portalEvent.setCancelled(!spawnPortal);
|
||||||
|
Bukkit.getPluginManager().callEvent(portalEvent);
|
||||||
|
if (!portalEvent.isCancelled()) {
|
||||||
|
blockList.updateList();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world.storage;
|
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.world.storage.DerivedWorldInfoBridge;
|
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
|
||||||
import net.minecraft.world.storage.DerivedWorldInfo;
|
|
||||||
import net.minecraft.world.storage.WorldInfo;
|
|
||||||
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(DerivedWorldInfo.class)
|
|
||||||
public class DerivedWorldInfoMixin implements DerivedWorldInfoBridge {
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
@Shadow @Final private WorldInfo delegate;
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
private DimensionType type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author IzzelAliz
|
|
||||||
* @reason
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
public String getWorldName() {
|
|
||||||
if (type == null || type.getId() == 0 || type.directory.isEmpty()) {
|
|
||||||
return this.delegate.getWorldName();
|
|
||||||
} else {
|
|
||||||
return this.delegate.getWorldName() + "/" + type.directory;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void bridge$setDimension(DimensionType dimensionType) {
|
|
||||||
this.type = dimensionType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +1,9 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world.storage;
|
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.bridge.world.storage.MapDataBridge;
|
||||||
import io.izzel.arclight.common.mod.ArclightConstants;
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.world.dimension.OverworldDimension;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.storage.MapData;
|
import net.minecraft.world.storage.MapData;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
@ -19,13 +17,15 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
@Mixin(MapData.class)
|
@Mixin(MapData.class)
|
||||||
public abstract class MapDataMixin implements MapDataBridge {
|
public abstract class MapDataMixin implements MapDataBridge {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow public DimensionType dimension;
|
@Shadow public RegistryKey<World> dimension;
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
public CraftMapView mapView;
|
public CraftMapView mapView;
|
||||||
@ -38,54 +38,37 @@ public abstract class MapDataMixin implements MapDataBridge {
|
|||||||
this.server = (CraftServer) Bukkit.getServer();
|
this.server = (CraftServer) Bukkit.getServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Redirect(method = "read", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/dimension/DimensionType;getById(I)Lnet/minecraft/world/dimension/DimensionType;"))
|
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||||
public DimensionType arclight$customDimension(int id, CompoundNBT nbt) {
|
@Redirect(method = "read", at = @At(value = "INVOKE", target = "Ljava/util/Optional;orElseThrow(Ljava/util/function/Supplier;)Ljava/lang/Object;"))
|
||||||
DimensionType type;
|
public Object arclight$customDimension(Optional<RegistryKey<World>> optional, Supplier<?> exceptionSupplier, CompoundNBT nbt) {
|
||||||
long least = nbt.getLong("UUIDLeast");
|
return optional.orElseGet(() -> {
|
||||||
long most = nbt.getLong("UUIDMost");
|
long least = nbt.getLong("UUIDLeast");
|
||||||
|
long most = nbt.getLong("UUIDMost");
|
||||||
if (least != 0L && most != 0L) {
|
if (least != 0L && most != 0L) {
|
||||||
this.uniqueId = new UUID(most, least);
|
this.uniqueId = new UUID(most, least);
|
||||||
|
CraftWorld world = (CraftWorld) this.server.getWorld(this.uniqueId);
|
||||||
CraftWorld world = (CraftWorld) server.getWorld(this.uniqueId);
|
if (world != null) {
|
||||||
// Check if the stored world details are correct.
|
return world.getHandle().getDimensionKey();
|
||||||
if (world == null) {
|
|
||||||
type = DimensionType.getById(id);
|
|
||||||
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, null);
|
|
||||||
((DimensionTypeBridge) type).bridge$setType(DimensionType.OVERWORLD);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
type = world.getHandle().dimension.getType();
|
|
||||||
}
|
}
|
||||||
} else {
|
throw new IllegalArgumentException("Invalid map dimension: " + nbt.get("dimension"));
|
||||||
type = DimensionType.getById(id);
|
});
|
||||||
}
|
|
||||||
return type;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "write", at = @At("HEAD"))
|
@Inject(method = "write", at = @At("HEAD"))
|
||||||
public void arclight$storeDimension(CompoundNBT compound, CallbackInfoReturnable<CompoundNBT> cir) {
|
public void arclight$storeDimension(CompoundNBT compound, CallbackInfoReturnable<CompoundNBT> cir) {
|
||||||
if (this.dimension.getId() >= CraftWorld.CUSTOM_DIMENSION_OFFSET) {
|
if (this.uniqueId == null) {
|
||||||
if (this.uniqueId == null) {
|
for (org.bukkit.World world : this.server.getWorlds()) {
|
||||||
for (org.bukkit.World world : server.getWorlds()) {
|
CraftWorld cWorld = (CraftWorld) world;
|
||||||
CraftWorld cWorld = (CraftWorld) world;
|
if (cWorld.getHandle().getDimensionKey() != this.dimension) continue;
|
||||||
if (cWorld.getHandle().dimension.getType() == this.dimension) {
|
this.uniqueId = cWorld.getUID();
|
||||||
this.uniqueId = cWorld.getUID();
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Perform a second check to see if a matching world was found, this is a necessary
|
|
||||||
change incase Maps are forcefully unlinked from a World and lack a UID.*/
|
|
||||||
if (this.uniqueId != null) {
|
|
||||||
compound.putLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
|
||||||
compound.putLong("UUIDMost", this.uniqueId.getMostSignificantBits());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (this.uniqueId != null) {
|
||||||
|
compound.putLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
|
||||||
|
compound.putLong("UUIDMost", this.uniqueId.getMostSignificantBits());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import java.util.Collection;
|
|||||||
public class MapData_MapInfoMixin {
|
public class MapData_MapInfoMixin {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow(aliases = {"this$0", "field_176107_c"}, remap = false) private MapData outerThis;
|
@SuppressWarnings("target") @Shadow(aliases = {"this$0", "field_176107_c"}, remap = false) private MapData outerThis;
|
||||||
@Shadow private boolean isDirty;
|
@Shadow private boolean isDirty;
|
||||||
@Shadow private int minX;
|
@Shadow private int minX;
|
||||||
@Shadow private int minY;
|
@Shadow private int minY;
|
||||||
|
|||||||
@ -0,0 +1,67 @@
|
|||||||
|
package io.izzel.arclight.common.mixin.core.world.storage;
|
||||||
|
|
||||||
|
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
|
||||||
|
import io.izzel.arclight.common.bridge.world.storage.PlayerDataBridge;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraft.nbt.CompressedStreamTools;
|
||||||
|
import net.minecraft.world.storage.PlayerData;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.bukkit.craftbukkit.v.entity.CraftPlayer;
|
||||||
|
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 java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
|
@Mixin(PlayerData.class)
|
||||||
|
public class PlayerDataMixin implements PlayerDataBridge {
|
||||||
|
|
||||||
|
// @formatter:off
|
||||||
|
@Shadow @Final private File playerDataFolder;
|
||||||
|
@Shadow @Final private static Logger LOGGER;
|
||||||
|
// @formatter:on
|
||||||
|
|
||||||
|
@Inject(method = "loadPlayerData", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundNBT;contains(Ljava/lang/String;I)Z"))
|
||||||
|
private void arclight$lastSeenTime(PlayerEntity player, CallbackInfoReturnable<CompoundNBT> cir) {
|
||||||
|
if (player instanceof ServerPlayerEntity) {
|
||||||
|
CraftPlayer craftPlayer = ((ServerPlayerEntityBridge) player).bridge$getBukkitEntity();
|
||||||
|
// Only update first played if it is older than the one we have
|
||||||
|
long modified = new File(this.playerDataFolder, player.getUniqueID().toString() + ".dat").lastModified();
|
||||||
|
if (modified < craftPlayer.getFirstPlayed()) {
|
||||||
|
craftPlayer.setFirstPlayed(modified);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getPlayerDir() {
|
||||||
|
return this.playerDataFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CompoundNBT getPlayerData(String uuid) {
|
||||||
|
try {
|
||||||
|
final File file1 = new File(this.playerDataFolder, uuid + ".dat");
|
||||||
|
if (file1.exists()) {
|
||||||
|
return CompressedStreamTools.readCompressed(new FileInputStream(file1));
|
||||||
|
}
|
||||||
|
} catch (Exception exception) {
|
||||||
|
LOGGER.warn("Failed to load player data for " + uuid);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File bridge$getPlayerDir() {
|
||||||
|
return getPlayerDir();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CompoundNBT bridge$getPlayerData(String uuid) {
|
||||||
|
return getPlayerData(uuid);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,134 +0,0 @@
|
|||||||
package io.izzel.arclight.common.mixin.core.world.storage;
|
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
|
|
||||||
import io.izzel.arclight.common.bridge.world.storage.SaveHandlerBridge;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
|
||||||
import net.minecraft.nbt.CompressedStreamTools;
|
|
||||||
import net.minecraft.world.server.ServerWorld;
|
|
||||||
import net.minecraft.world.storage.SaveHandler;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftPlayer;
|
|
||||||
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 java.io.DataInputStream;
|
|
||||||
import java.io.DataOutputStream;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Mixin(SaveHandler.class)
|
|
||||||
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 worldDirectory;
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
private final Int2ObjectMap<UUID> uuidMap = new Int2ObjectOpenHashMap<>();
|
|
||||||
|
|
||||||
@Inject(method = "readPlayerData", at = @At(value = "INVOKE", target = "Lnet/minecraft/nbt/CompoundNBT;contains(Ljava/lang/String;I)Z"))
|
|
||||||
public void arclight$lastSeenTime(PlayerEntity player, CallbackInfoReturnable<CompoundNBT> cir) {
|
|
||||||
if (player instanceof ServerPlayerEntity) {
|
|
||||||
CraftPlayer craftPlayer = ((ServerPlayerEntityBridge) player).bridge$getBukkitEntity();
|
|
||||||
// Only update first played if it is older than the one we have
|
|
||||||
long modified = new File(this.playersDirectory, player.getUniqueID().toString() + ".dat").lastModified();
|
|
||||||
if (modified < craftPlayer.getFirstPlayed()) {
|
|
||||||
craftPlayer.setFirstPlayed(modified);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getSeenPlayers() {
|
|
||||||
String[] arr = this.playersDirectory.list();
|
|
||||||
|
|
||||||
if (arr == null) {
|
|
||||||
arr = new String[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < arr.length; ++i) {
|
|
||||||
if (arr[i].endsWith(".dat")) {
|
|
||||||
arr[i] = arr[i].substring(0, arr[i].length() - 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUUID() {
|
|
||||||
return getUUID(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUUID(ServerWorld world) {
|
|
||||||
int dimId = world == null ? 0 : world.dimension.getType().getId();
|
|
||||||
UUID uuid = uuidMap.get(dimId);
|
|
||||||
if (uuid != null) return uuid;
|
|
||||||
File folder = world == null ? this.worldDirectory : world.dimension.getType().getDirectory(this.worldDirectory);
|
|
||||||
File file1 = new File(folder, "uid.dat");
|
|
||||||
if (file1.exists()) {
|
|
||||||
try (DataInputStream dis = new DataInputStream(new FileInputStream(file1))) {
|
|
||||||
uuid = new UUID(dis.readLong(), dis.readLong());
|
|
||||||
uuidMap.put(dimId, uuid);
|
|
||||||
return uuid;
|
|
||||||
} catch (IOException ex) {
|
|
||||||
LOGGER.warn("Failed to read " + file1 + ", generating new random UUID", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
uuid = UUID.randomUUID();
|
|
||||||
try (DataOutputStream dos = new DataOutputStream(new FileOutputStream(file1))) {
|
|
||||||
dos.writeLong(uuid.getMostSignificantBits());
|
|
||||||
dos.writeLong(uuid.getLeastSignificantBits());
|
|
||||||
} catch (IOException ex) {
|
|
||||||
LOGGER.warn("Failed to write " + file1, ex);
|
|
||||||
}
|
|
||||||
uuidMap.put(dimId, uuid);
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public File getPlayerDir() {
|
|
||||||
return this.playersDirectory;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CompoundNBT getPlayerData(String uuid) {
|
|
||||||
try {
|
|
||||||
final File file1 = new File(this.playersDirectory, uuid + ".dat");
|
|
||||||
if (file1.exists()) {
|
|
||||||
return CompressedStreamTools.readCompressed(new FileInputStream(file1));
|
|
||||||
}
|
|
||||||
} catch (Exception exception) {
|
|
||||||
LOGGER.warn("Failed to load player data for " + uuid);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] bridge$getSeenPlayers() {
|
|
||||||
return getSeenPlayers();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UUID bridge$getUUID(ServerWorld world) {
|
|
||||||
return getUUID(world);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public File bridge$getPlayerDir() {
|
|
||||||
return getPlayerDir();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CompoundNBT bridge$getPlayerData(String uuid) {
|
|
||||||
return getPlayerData(uuid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -5,10 +5,13 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.network.play.server.SServerDifficultyPacket;
|
import net.minecraft.network.play.server.SServerDifficultyPacket;
|
||||||
|
import net.minecraft.util.registry.DynamicRegistries;
|
||||||
import net.minecraft.world.Difficulty;
|
import net.minecraft.world.Difficulty;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.WorldSettings;
|
||||||
import net.minecraft.world.storage.WorldInfo;
|
import net.minecraft.world.server.ServerWorld;
|
||||||
|
import net.minecraft.world.storage.ServerWorldInfo;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.event.weather.ThunderChangeEvent;
|
import org.bukkit.event.weather.ThunderChangeEvent;
|
||||||
import org.bukkit.event.weather.WeatherChangeEvent;
|
import org.bukkit.event.weather.WeatherChangeEvent;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
@ -17,31 +20,32 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(WorldInfo.class)
|
@Mixin(ServerWorldInfo.class)
|
||||||
public abstract class WorldInfoMixin implements WorldInfoBridge {
|
public abstract class ServerWorldInfoMixin implements WorldInfoBridge {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
@Shadow private boolean raining;
|
|
||||||
@Shadow private boolean thundering;
|
|
||||||
@Shadow public abstract String getWorldName();
|
@Shadow public abstract String getWorldName();
|
||||||
|
@Shadow private boolean thundering;
|
||||||
|
@Shadow private boolean raining;
|
||||||
@Shadow public abstract boolean isDifficultyLocked();
|
@Shadow public abstract boolean isDifficultyLocked();
|
||||||
|
@Shadow private WorldSettings worldSettings;
|
||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
public World world;
|
public ServerWorld world;
|
||||||
|
|
||||||
@Inject(method = "updateTagCompound", at = @At("RETURN"))
|
@Inject(method = "serialize(Lnet/minecraft/util/registry/DynamicRegistries;Lnet/minecraft/nbt/CompoundNBT;Lnet/minecraft/nbt/CompoundNBT;)V",
|
||||||
private void arclight$writeArclight(CompoundNBT nbt, CompoundNBT playerNbt, CallbackInfo ci) {
|
at = @At("RETURN"))
|
||||||
|
private void arclight$bukkitVer(DynamicRegistries registry, CompoundNBT nbt, CompoundNBT playerNBT, CallbackInfo ci) {
|
||||||
nbt.putString("Bukkit.Version", Bukkit.getName() + "/" + Bukkit.getVersion() + "/" + Bukkit.getBukkitVersion());
|
nbt.putString("Bukkit.Version", Bukkit.getName() + "/" + Bukkit.getVersion() + "/" + Bukkit.getBukkitVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "setThundering", cancellable = true, at = @At("HEAD"))
|
@Inject(method = "setThundering", cancellable = true, at = @At("HEAD"))
|
||||||
public void arclight$thunder(boolean thunderingIn, CallbackInfo ci) {
|
private void arclight$thunder(boolean thunderingIn, CallbackInfo ci) {
|
||||||
if (this.thundering == thunderingIn) {
|
if (this.thundering == thunderingIn) {
|
||||||
ci.cancel();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
org.bukkit.World world = Bukkit.getWorld(this.getWorldName());
|
World world = Bukkit.getWorld(this.getWorldName());
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
ThunderChangeEvent event = new ThunderChangeEvent(world, thunderingIn);
|
ThunderChangeEvent event = new ThunderChangeEvent(world, thunderingIn);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
@ -52,13 +56,12 @@ public abstract class WorldInfoMixin implements WorldInfoBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Inject(method = "setRaining", cancellable = true, at = @At("HEAD"))
|
@Inject(method = "setRaining", cancellable = true, at = @At("HEAD"))
|
||||||
public void arclight$raining(boolean isRaining, CallbackInfo ci) {
|
private void arclight$storm(boolean isRaining, CallbackInfo ci) {
|
||||||
if (this.raining == isRaining) {
|
if (this.raining == isRaining) {
|
||||||
ci.cancel();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
org.bukkit.World world = Bukkit.getWorld(this.getWorldName());
|
World world = Bukkit.getWorld(this.getWorldName());
|
||||||
if (world != null) {
|
if (world != null) {
|
||||||
WeatherChangeEvent event = new WeatherChangeEvent(world, isRaining);
|
WeatherChangeEvent event = new WeatherChangeEvent(world, isRaining);
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
@ -77,12 +80,18 @@ public abstract class WorldInfoMixin implements WorldInfoBridge {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void bridge$setWorld(World world) {
|
public void bridge$setWorld(ServerWorld world) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public World bridge$getWorld() {
|
public ServerWorld bridge$getWorld() {
|
||||||
return world;
|
return world;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void checkName(String name) {
|
||||||
|
if (!this.worldSettings.worldName.equals(name)) {
|
||||||
|
this.worldSettings.worldName = name;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,14 +0,0 @@
|
|||||||
package io.izzel.arclight.common.mixin.forge;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.DimensionManager;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
|
||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
|
||||||
|
|
||||||
@Mixin(value = DimensionManager.class, remap = false)
|
|
||||||
public class DimensionManagerMixin {
|
|
||||||
|
|
||||||
@Redirect(method = "initWorld", at = @At(value = "INVOKE", target = "Lorg/apache/commons/lang3/Validate;isTrue(ZLjava/lang/String;[Ljava/lang/Object;)V"))
|
|
||||||
private static void arclight$allowHotloadOverworld(boolean expression, String message, Object... values) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -101,6 +101,12 @@ public class ArclightMixinPlugin implements IMixinConfigPlugin {
|
|||||||
))
|
))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
// damn spigot
|
||||||
|
private final Map<String, Map<String, String>> fieldRenames = ImmutableMap.<String, Map<String, String>>builder()
|
||||||
|
.put("net.minecraft.world.chunk.Chunk", ImmutableMap.of("$$world", "field_76637_e"))
|
||||||
|
.put("net.minecraft.world.server.ServerWorld", ImmutableMap.of("$$worldDataServer", "field_241103_E_"))
|
||||||
|
.build();
|
||||||
|
|
||||||
private final Set<String> modifyConstructor = ImmutableSet.<String>builder()
|
private final Set<String> modifyConstructor = ImmutableSet.<String>builder()
|
||||||
.add("net.minecraft.world.World")
|
.add("net.minecraft.world.World")
|
||||||
.add("net.minecraft.world.server.ServerWorld")
|
.add("net.minecraft.world.server.ServerWorld")
|
||||||
@ -165,20 +171,21 @@ public class ArclightMixinPlugin implements IMixinConfigPlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
modifyConstructor(targetClassName, targetClass);
|
modifyConstructor(targetClassName, targetClass);
|
||||||
if (targetClassName.equals("net.minecraft.world.chunk.Chunk")) {
|
renameFields(targetClassName, targetClass);
|
||||||
for (FieldNode field : targetClass.fields) {
|
}
|
||||||
if (field.name.equals("$$world")) {
|
|
||||||
field.name = "world";
|
private void renameFields(String targetClassName, ClassNode classNode) {
|
||||||
}
|
Map<String, String> map = this.fieldRenames.get(targetClassName);
|
||||||
|
if (map != null) {
|
||||||
|
for (FieldNode field : classNode.fields) {
|
||||||
|
field.name = map.getOrDefault(field.name, field.name);
|
||||||
}
|
}
|
||||||
for (MethodNode method : targetClass.methods) {
|
for (MethodNode method : classNode.methods) {
|
||||||
if (method.name.equals("<init>")) {
|
if (method.name.equals("<init>")) {
|
||||||
for (AbstractInsnNode instruction : method.instructions) {
|
for (AbstractInsnNode instruction : method.instructions) {
|
||||||
if (instruction instanceof FieldInsnNode) {
|
if (instruction instanceof FieldInsnNode) {
|
||||||
FieldInsnNode fieldInsnNode = (FieldInsnNode) instruction;
|
FieldInsnNode node = (FieldInsnNode) instruction;
|
||||||
if (fieldInsnNode.name.equals("$$world")) {
|
node.name = map.getOrDefault(node.name, node.name);
|
||||||
fieldInsnNode.name = "world";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,7 +6,6 @@ import io.izzel.arclight.api.EnumHelper;
|
|||||||
import io.izzel.arclight.api.Unsafe;
|
import io.izzel.arclight.api.Unsafe;
|
||||||
import io.izzel.arclight.common.bridge.bukkit.EntityTypeBridge;
|
import io.izzel.arclight.common.bridge.bukkit.EntityTypeBridge;
|
||||||
import io.izzel.arclight.common.bridge.bukkit.MaterialBridge;
|
import io.izzel.arclight.common.bridge.bukkit.MaterialBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.dimension.DimensionTypeBridge;
|
|
||||||
import io.izzel.arclight.common.mod.ArclightMod;
|
import io.izzel.arclight.common.mod.ArclightMod;
|
||||||
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
||||||
import io.izzel.arclight.common.mod.util.types.ArclightEnchantment;
|
import io.izzel.arclight.common.mod.util.types.ArclightEnchantment;
|
||||||
@ -18,9 +17,10 @@ import net.minecraft.block.Block;
|
|||||||
import net.minecraft.entity.merchant.villager.VillagerProfession;
|
import net.minecraft.entity.merchant.villager.VillagerProfession;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.potion.Effect;
|
import net.minecraft.potion.Effect;
|
||||||
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraftforge.common.DimensionManager;
|
import net.minecraft.world.DimensionType;
|
||||||
import net.minecraftforge.fml.CrashReportExtender;
|
import net.minecraftforge.fml.CrashReportExtender;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.ForgeRegistry;
|
import net.minecraftforge.registries.ForgeRegistry;
|
||||||
@ -117,31 +117,41 @@ public class BukkitRegistry {
|
|||||||
ArclightMod.LOGGER.info("registry.villager-profession", newTypes.size());
|
ArclightMod.LOGGER.info("registry.villager-profession", newTypes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public static void registerEnvironments() {
|
public static void registerEnvironments() {
|
||||||
int i = World.Environment.values().length;
|
int i = World.Environment.values().length;
|
||||||
List<World.Environment> newTypes = new ArrayList<>();
|
List<World.Environment> newTypes = new ArrayList<>();
|
||||||
for (DimensionType dimensionType : DimensionManager.getRegistry()) {
|
Registry<DimensionType> registry = Registry.REGISTRY.getValueForKey((RegistryKey) Registry.DIMENSION_TYPE_KEY);
|
||||||
DimensionType actual = ((DimensionTypeBridge) dimensionType).bridge$getType();
|
for (Map.Entry<RegistryKey<DimensionType>, DimensionType> entry : registry.getEntries()) {
|
||||||
World.Environment environment = World.Environment.getEnvironment(actual.getId());
|
RegistryKey<DimensionType> key = entry.getKey();
|
||||||
|
World.Environment environment = findEnvironment(key);
|
||||||
if (environment == null) {
|
if (environment == null) {
|
||||||
String name = ResourceLocationUtil.standardize(actual.getRegistryName());
|
String name = ResourceLocationUtil.standardize(key.getRegistryName());
|
||||||
environment = EnumHelper.makeEnum(World.Environment.class, name, i++, ENV_CTOR, ImmutableList.of(actual.getId()));
|
environment = EnumHelper.makeEnum(World.Environment.class, name, i, ENV_CTOR, ImmutableList.of(i - 1));
|
||||||
newTypes.add(environment);
|
newTypes.add(environment);
|
||||||
ENVIRONMENT_MAP.put(actual.getId(), environment);
|
ENVIRONMENT_MAP.put(i - 1, environment);
|
||||||
ArclightMod.LOGGER.debug("Registered {} as environment {}", actual.getRegistryName(), environment);
|
ArclightMod.LOGGER.debug("Registered {} as environment {}", key.getRegistryName(), environment);
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EnumHelper.addEnums(World.Environment.class, newTypes);
|
EnumHelper.addEnums(World.Environment.class, newTypes);
|
||||||
ArclightMod.LOGGER.info("registry.environment", newTypes.size());
|
ArclightMod.LOGGER.info("registry.environment", newTypes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static World.Environment findEnvironment(RegistryKey<DimensionType> key) {
|
||||||
|
try {
|
||||||
|
return World.Environment.valueOf(ResourceLocationUtil.standardize(key.func_240901_a_()));
|
||||||
|
} catch (Throwable t) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void loadEntities() {
|
private static void loadEntities() {
|
||||||
int origin = EntityType.values().length;
|
int origin = EntityType.values().length;
|
||||||
int i = origin;
|
int i = origin;
|
||||||
List<EntityType> newTypes = new ArrayList<>(ForgeRegistries.ENTITIES.getEntries().size() - origin + 1); // UNKNOWN
|
List<EntityType> newTypes = new ArrayList<>(ForgeRegistries.ENTITIES.getEntries().size() - origin + 1); // UNKNOWN
|
||||||
for (Map.Entry<ResourceLocation, net.minecraft.entity.EntityType<?>> entry : ForgeRegistries.ENTITIES.getEntries()) {
|
for (net.minecraft.entity.EntityType<?> type : ForgeRegistries.ENTITIES) {
|
||||||
ResourceLocation location = entry.getKey();
|
ResourceLocation location = type.getRegistryName();
|
||||||
net.minecraft.entity.EntityType<?> type = entry.getValue();
|
|
||||||
EntityType entityType = null;
|
EntityType entityType = null;
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
if (location.getNamespace().equals(NamespacedKey.MINECRAFT)) {
|
if (location.getNamespace().equals(NamespacedKey.MINECRAFT)) {
|
||||||
@ -166,11 +176,11 @@ public class BukkitRegistry {
|
|||||||
int origin = Enchantment.values().length;
|
int origin = Enchantment.values().length;
|
||||||
int size = ForgeRegistries.ENCHANTMENTS.getEntries().size();
|
int size = ForgeRegistries.ENCHANTMENTS.getEntries().size();
|
||||||
putBool(Enchantment.class, "acceptingNew", true);
|
putBool(Enchantment.class, "acceptingNew", true);
|
||||||
for (Map.Entry<ResourceLocation, net.minecraft.enchantment.Enchantment> entry : ForgeRegistries.ENCHANTMENTS.getEntries()) {
|
for (net.minecraft.enchantment.Enchantment enc : ForgeRegistries.ENCHANTMENTS) {
|
||||||
String name = ResourceLocationUtil.standardize(entry.getKey());
|
String name = ResourceLocationUtil.standardize(enc.getRegistryName());
|
||||||
ArclightEnchantment enchantment = new ArclightEnchantment(entry.getValue(), name);
|
ArclightEnchantment enchantment = new ArclightEnchantment(enc, name);
|
||||||
Enchantment.registerEnchantment(enchantment);
|
Enchantment.registerEnchantment(enchantment);
|
||||||
ArclightMod.LOGGER.debug("Registered {} as enchantment {}", entry.getKey(), enchantment);
|
ArclightMod.LOGGER.debug("Registered {} as enchantment {}", enc.getRegistryName(), enchantment);
|
||||||
}
|
}
|
||||||
Enchantment.stopAcceptingRegistrations();
|
Enchantment.stopAcceptingRegistrations();
|
||||||
ArclightMod.LOGGER.info("registry.enchantment", size - origin);
|
ArclightMod.LOGGER.info("registry.enchantment", size - origin);
|
||||||
@ -182,11 +192,11 @@ public class BukkitRegistry {
|
|||||||
PotionEffectType[] types = new PotionEffectType[size + 1];
|
PotionEffectType[] types = new PotionEffectType[size + 1];
|
||||||
putStatic(PotionEffectType.class, "byId", types);
|
putStatic(PotionEffectType.class, "byId", types);
|
||||||
putBool(PotionEffectType.class, "acceptingNew", true);
|
putBool(PotionEffectType.class, "acceptingNew", true);
|
||||||
for (Map.Entry<ResourceLocation, Effect> entry : ForgeRegistries.POTIONS.getEntries()) {
|
for (Effect eff : ForgeRegistries.POTIONS) {
|
||||||
String name = ResourceLocationUtil.standardize(entry.getKey());
|
String name = ResourceLocationUtil.standardize(eff.getRegistryName());
|
||||||
ArclightPotionEffect effect = new ArclightPotionEffect(entry.getValue(), name);
|
ArclightPotionEffect effect = new ArclightPotionEffect(eff, name);
|
||||||
PotionEffectType.registerPotionEffectType(effect);
|
PotionEffectType.registerPotionEffectType(effect);
|
||||||
ArclightMod.LOGGER.debug("Registered {} as potion {}", entry.getKey(), effect);
|
ArclightMod.LOGGER.debug("Registered {} as potion {}", eff.getRegistryName(), effect);
|
||||||
}
|
}
|
||||||
PotionEffectType.stopAcceptingRegistrations();
|
PotionEffectType.stopAcceptingRegistrations();
|
||||||
ArclightMod.LOGGER.info("registry.potion", size - origin);
|
ArclightMod.LOGGER.info("registry.potion", size - origin);
|
||||||
@ -197,9 +207,8 @@ public class BukkitRegistry {
|
|||||||
int i = Material.values().length;
|
int i = Material.values().length;
|
||||||
int origin = i;
|
int origin = i;
|
||||||
List<Material> list = new ArrayList<>();
|
List<Material> list = new ArrayList<>();
|
||||||
for (Map.Entry<ResourceLocation, Block> entry : ForgeRegistries.BLOCKS.getEntries()) {
|
for (Block block : ForgeRegistries.BLOCKS) {
|
||||||
ResourceLocation location = entry.getKey();
|
ResourceLocation location = block.getRegistryName();
|
||||||
Block block = entry.getValue();
|
|
||||||
String name = ResourceLocationUtil.standardize(location);
|
String name = ResourceLocationUtil.standardize(location);
|
||||||
Material material = BY_NAME.get(name);
|
Material material = BY_NAME.get(name);
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
@ -220,9 +229,8 @@ public class BukkitRegistry {
|
|||||||
MATERIAL_ITEM.put(material, value);
|
MATERIAL_ITEM.put(material, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Map.Entry<ResourceLocation, Item> entry : ForgeRegistries.ITEMS.getEntries()) {
|
for (Item item : ForgeRegistries.ITEMS) {
|
||||||
ResourceLocation location = entry.getKey();
|
ResourceLocation location = item.getRegistryName();
|
||||||
Item item = entry.getValue();
|
|
||||||
String name = ResourceLocationUtil.standardize(location);
|
String name = ResourceLocationUtil.standardize(location);
|
||||||
Material material = BY_NAME.get(name);
|
Material material = BY_NAME.get(name);
|
||||||
if (material == null) {
|
if (material == null) {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.minecraft.entity.passive.horse.AbstractChestedHorseEntity;
|
|||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftChestedHorse;
|
import org.bukkit.craftbukkit.v.entity.CraftChestedHorse;
|
||||||
|
import org.bukkit.entity.EntityCategory;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -32,4 +33,9 @@ public class ArclightModChestedHorse extends CraftChestedHorse {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "ArclightModChestedHorse{" + entityType + '}';
|
return "ArclightModChestedHorse{" + entityType + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull EntityCategory getCategory() {
|
||||||
|
return EntityCategory.NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.minecraft.entity.passive.horse.AbstractHorseEntity;
|
|||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftAbstractHorse;
|
import org.bukkit.craftbukkit.v.entity.CraftAbstractHorse;
|
||||||
|
import org.bukkit.entity.EntityCategory;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Horse;
|
import org.bukkit.entity.Horse;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@ -33,4 +34,9 @@ public class ArclightModHorse extends CraftAbstractHorse {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "ArclightModHorse{" + entityType + '}';
|
return "ArclightModHorse{" + entityType + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull EntityCategory getCategory() {
|
||||||
|
return EntityCategory.NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.minecraft.entity.MobEntity;
|
|||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftMob;
|
import org.bukkit.craftbukkit.v.entity.CraftMob;
|
||||||
|
import org.bukkit.entity.EntityCategory;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -26,4 +27,9 @@ public class ArclightModMob extends CraftMob {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "ArclightModMob{" + entityType + '}';
|
return "ArclightModMob{" + entityType + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull EntityCategory getCategory() {
|
||||||
|
return EntityCategory.NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package io.izzel.arclight.common.mod.server.entity;
|
|||||||
|
|
||||||
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftProjectile;
|
import org.bukkit.craftbukkit.v.entity.CraftProjectile;
|
||||||
@ -13,7 +14,7 @@ public class ArclightModProjectile extends CraftProjectile {
|
|||||||
private final EntityType entityType;
|
private final EntityType entityType;
|
||||||
|
|
||||||
public ArclightModProjectile(CraftServer server, Entity entity) {
|
public ArclightModProjectile(CraftServer server, Entity entity) {
|
||||||
super(server, entity);
|
super(server, (ProjectileEntity) entity);
|
||||||
this.entityType = EntityType.valueOf(ResourceLocationUtil.standardize(ForgeRegistries.ENTITIES.getKey(entity.getType())));
|
this.entityType = EntityType.valueOf(ResourceLocationUtil.standardize(ForgeRegistries.ENTITIES.getKey(entity.getType())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import net.minecraft.entity.monster.AbstractRaiderEntity;
|
|||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.entity.CraftRaider;
|
import org.bukkit.craftbukkit.v.entity.CraftRaider;
|
||||||
|
import org.bukkit.entity.EntityCategory;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
@ -26,4 +27,9 @@ public class ArclightModRaider extends CraftRaider {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "ArclightModRaider{" + entityType + '}';
|
return "ArclightModRaider{" + entityType + '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull EntityCategory getCategory() {
|
||||||
|
return EntityCategory.ILLAGER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,6 +13,8 @@
|
|||||||
"mixins": [
|
"mixins": [
|
||||||
"advancements.AdvancementMixin",
|
"advancements.AdvancementMixin",
|
||||||
"advancements.PlayerAdvancementsMixin",
|
"advancements.PlayerAdvancementsMixin",
|
||||||
|
"block.AbstractBlock_AbstractBlockStateMixin",
|
||||||
|
"block.AbstractBlockMixin",
|
||||||
"block.AbstractButtonBlockMixin",
|
"block.AbstractButtonBlockMixin",
|
||||||
"block.AbstractFireBlockMixin",
|
"block.AbstractFireBlockMixin",
|
||||||
"block.AbstractPressurePlateBlockMixin",
|
"block.AbstractPressurePlateBlockMixin",
|
||||||
@ -21,7 +23,6 @@
|
|||||||
"block.BambooSaplingBlockMixin",
|
"block.BambooSaplingBlockMixin",
|
||||||
"block.BeehiveBlockMixin",
|
"block.BeehiveBlockMixin",
|
||||||
"block.BlockMixin",
|
"block.BlockMixin",
|
||||||
"block.BlockStateMixin",
|
|
||||||
"block.BushBlockMixin",
|
"block.BushBlockMixin",
|
||||||
"block.CactusBlockMixin",
|
"block.CactusBlockMixin",
|
||||||
"block.CakeBlockMixin",
|
"block.CakeBlockMixin",
|
||||||
@ -400,10 +401,7 @@
|
|||||||
"world.border.WorldBorderMixin",
|
"world.border.WorldBorderMixin",
|
||||||
"world.chunk.ChunkMixin",
|
"world.chunk.ChunkMixin",
|
||||||
"world.chunk.storage.RegionFileCacheMixin",
|
"world.chunk.storage.RegionFileCacheMixin",
|
||||||
"world.dimension.DimensionMixin",
|
|
||||||
"world.dimension.DimensionTypeMixin",
|
|
||||||
"world.gen.WorldGenRegionMixin",
|
"world.gen.WorldGenRegionMixin",
|
||||||
"world.gen.feature.structure.StructureMixin",
|
|
||||||
"world.gen.feature.structure.SwampHutPieceMixin",
|
"world.gen.feature.structure.SwampHutPieceMixin",
|
||||||
"world.raid.RaidManagerMixin",
|
"world.raid.RaidManagerMixin",
|
||||||
"world.raid.RaidMixin",
|
"world.raid.RaidMixin",
|
||||||
@ -412,7 +410,6 @@
|
|||||||
"world.server.ChunkManagerMixin",
|
"world.server.ChunkManagerMixin",
|
||||||
"world.server.ServerChunkProvider_ChunkExecutorMixin",
|
"world.server.ServerChunkProvider_ChunkExecutorMixin",
|
||||||
"world.server.ServerChunkProviderMixin",
|
"world.server.ServerChunkProviderMixin",
|
||||||
"world.server.ServerMultiWorldMixin",
|
|
||||||
"world.server.ServerWorldMixin",
|
"world.server.ServerWorldMixin",
|
||||||
"world.server.TicketManagerMixin",
|
"world.server.TicketManagerMixin",
|
||||||
"world.server.TicketTypeMixin",
|
"world.server.TicketTypeMixin",
|
||||||
@ -422,11 +419,10 @@
|
|||||||
"world.spawner.WanderingTraderSpawnerMixin",
|
"world.spawner.WanderingTraderSpawnerMixin",
|
||||||
"world.spawner.WorldEntitySpawner_EntityDensityManagerMixin",
|
"world.spawner.WorldEntitySpawner_EntityDensityManagerMixin",
|
||||||
"world.spawner.WorldEntitySpawnerMixin",
|
"world.spawner.WorldEntitySpawnerMixin",
|
||||||
"world.storage.DerivedWorldInfoMixin",
|
|
||||||
"world.storage.MapData_MapInfoMixin",
|
"world.storage.MapData_MapInfoMixin",
|
||||||
"world.storage.MapDataMixin",
|
"world.storage.MapDataMixin",
|
||||||
|
"world.storage.PlayerDataMixin",
|
||||||
"world.storage.SaveFormatMixin",
|
"world.storage.SaveFormatMixin",
|
||||||
"world.storage.SaveHandlerMixin",
|
"world.storage.ServerWorldInfoMixin"
|
||||||
"world.storage.WorldInfoMixin"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -6,7 +6,6 @@
|
|||||||
"refmap": "mixins.arclight.refmap.json",
|
"refmap": "mixins.arclight.refmap.json",
|
||||||
"setSourceFile": true,
|
"setSourceFile": true,
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"DimensionManagerMixin",
|
|
||||||
"ForgeEventFactoryMixin",
|
"ForgeEventFactoryMixin",
|
||||||
"ForgeHooksMixin"
|
"ForgeHooksMixin"
|
||||||
]
|
]
|
||||||
|
|||||||
@ -21,7 +21,7 @@ apply plugin: 'io.izzel.arclight'
|
|||||||
|
|
||||||
ext {
|
ext {
|
||||||
minecraftVersion = '1.16.2'
|
minecraftVersion = '1.16.2'
|
||||||
forgeVersion = '33.0.5'
|
forgeVersion = '33.0.22'
|
||||||
}
|
}
|
||||||
|
|
||||||
arclight {
|
arclight {
|
||||||
@ -81,7 +81,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
embed 'net.md-5:bungeecord-chat:1.16-R0.3@jar'
|
embed 'net.md-5:bungeecord-chat:1.16-R0.3@jar'
|
||||||
embed "org.spigotmc:spigot-api:$minecraftVersion-R0.1-SNAPSHOT@jar"
|
embed "org.spigotmc:spigot-api:$minecraftVersion-R0.1-SNAPSHOT@jar"
|
||||||
embed 'com.github.ArclightTeam:mixin-tools:1.0.0'
|
embed 'com.github.ArclightTeam:mixin-tools:1.0.0@jar'
|
||||||
}
|
}
|
||||||
|
|
||||||
def getGitHash = { ->
|
def getGitHash = { ->
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user