1.17: cleanup
This commit is contained in:
parent
bc714cafb3
commit
e36e6d2910
@ -7,9 +7,8 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forge_gradle_version}"
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forge_gradle_version}"
|
||||||
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
|
classpath 'org.spongepowered:mixingradle:0.7.1-SNAPSHOT'
|
||||||
// classpath "io.izzel.arclight:arclight-gradle-plugin:$agpVersion"
|
classpath "io.izzel.arclight:arclight-gradle-plugin:$agpVersion"
|
||||||
classpath files("G:\\workspace\\arclight-gradle-plugin\\build\\libs\\arclight-gradle-plugin-1.18.jar")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ dependencies {
|
|||||||
implementation 'org.jetbrains:annotations:19.0.0'
|
implementation 'org.jetbrains:annotations:19.0.0'
|
||||||
|
|
||||||
implementation 'org.spongepowered:mixin:0.8.3'
|
implementation 'org.spongepowered:mixin:0.8.3'
|
||||||
annotationProcessor 'org.spongepowered:mixin:0.8.2:processor'
|
annotationProcessor 'org.spongepowered:mixin:0.8.3:processor'
|
||||||
|
|
||||||
implementation 'com.github.ArclightTeam:mixin-tools:1.0.0'
|
implementation 'com.github.ArclightTeam:mixin-tools:1.0.0'
|
||||||
annotationProcessor 'com.github.ArclightTeam:mixin-tools:1.0.0'
|
annotationProcessor 'com.github.ArclightTeam:mixin-tools:1.0.0'
|
||||||
@ -68,7 +67,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
remapSpigotJar {
|
remapSpigotJar {
|
||||||
includes.add('net/minecraft/block/ChestBlock$DoubleInventory')
|
includes.add('net/minecraft/world/level/block/ChestBlock$DoubleInventory')
|
||||||
includes.add('net/minecraft/tileentity/LecternTileEntity$LecternInventory')
|
includes.add('net/minecraft/tileentity/LecternTileEntity$LecternInventory')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package io.izzel.arclight.common.asm;
|
package io.izzel.arclight.common.asm;
|
||||||
|
|
||||||
|
import cpw.mods.modlauncher.api.NamedPath;
|
||||||
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
import cpw.mods.modlauncher.serviceapi.ILaunchPluginService;
|
||||||
import io.izzel.arclight.common.mod.util.log.ArclightI18nLogger;
|
import io.izzel.arclight.common.mod.util.log.ArclightI18nLogger;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -12,7 +13,6 @@ import org.objectweb.asm.tree.VarInsnNode;
|
|||||||
import org.spongepowered.asm.launch.MixinLaunchPlugin;
|
import org.spongepowered.asm.launch.MixinLaunchPlugin;
|
||||||
|
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@ -37,7 +37,7 @@ public class ArclightImplementer implements ILaunchPluginService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeLaunch(ITransformerLoader transformerLoader, Path[] specialPaths) {
|
public void initializeLaunch(ITransformerLoader transformerLoader, NamedPath[] specialPaths) {
|
||||||
this.transformerLoader = transformerLoader;
|
this.transformerLoader = transformerLoader;
|
||||||
this.implementers.put("inventory", new InventoryImplementer());
|
this.implementers.put("inventory", new InventoryImplementer());
|
||||||
this.implementers.put("switch", SwitchTableFixer.INSTANCE);
|
this.implementers.put("switch", SwitchTableFixer.INSTANCE);
|
||||||
|
|||||||
@ -1,51 +0,0 @@
|
|||||||
package io.izzel.arclight.common.mixin.bukkit;
|
|
||||||
|
|
||||||
import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
|
||||||
import net.minecraft.world.level.chunk.LevelChunk;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.craftbukkit.v.CraftChunk;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
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(value = CraftChunk.class, remap = false)
|
|
||||||
public abstract class CraftChunkMixin {
|
|
||||||
|
|
||||||
// @formatter:off
|
|
||||||
@Shadow public abstract boolean isLoaded();
|
|
||||||
@Shadow public abstract World getWorld();
|
|
||||||
@Shadow @Final private int x;
|
|
||||||
@Shadow @Final private int z;
|
|
||||||
@Shadow public abstract LevelChunk getHandle();
|
|
||||||
// @formatter:on
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author IzzelAliz
|
|
||||||
* @reason
|
|
||||||
*/
|
|
||||||
@Overwrite
|
|
||||||
public Entity[] getEntities() {
|
|
||||||
if (!this.isLoaded()) {
|
|
||||||
this.getWorld().getChunkAt(this.x, this.z);
|
|
||||||
}
|
|
||||||
int count = 0;
|
|
||||||
int index = 0;
|
|
||||||
net.minecraft.world.level.chunk.LevelChunk chunk = this.getHandle();
|
|
||||||
for (int i = 0; i < 16; ++i) {
|
|
||||||
count += chunk.entitySections[i].size();
|
|
||||||
}
|
|
||||||
Entity[] entities = new Entity[count];
|
|
||||||
for (int j = 0; j < 16; ++j) {
|
|
||||||
Object[] array;
|
|
||||||
for (int length = (array = chunk.entitySections[j].toArray()).length, k = 0; k < length; ++k) {
|
|
||||||
Object obj = array[k];
|
|
||||||
if (obj instanceof net.minecraft.world.entity.Entity) {
|
|
||||||
entities[index++] = ((EntityBridge) obj).bridge$getBukkitEntity();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return entities;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -12,7 +12,7 @@ import io.izzel.arclight.common.mod.server.entity.ArclightModProjectile;
|
|||||||
import io.izzel.arclight.common.mod.server.entity.ArclightModRaider;
|
import io.izzel.arclight.common.mod.server.entity.ArclightModRaider;
|
||||||
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
import io.izzel.arclight.common.mod.util.ResourceLocationUtil;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
import net.minecraft.resources.ResourceLocation;
|
||||||
import net.minecraft.world.entity.AgableMob;
|
import net.minecraft.world.entity.AgeableMob;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.FlyingMob;
|
import net.minecraft.world.entity.FlyingMob;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
@ -78,7 +78,7 @@ public abstract class CraftEntityMixin implements org.bukkit.entity.Entity {
|
|||||||
private static void arclight$modEntity(CraftServer server, Entity entity, CallbackInfoReturnable<CraftEntity> cir) {
|
private static void arclight$modEntity(CraftServer server, Entity entity, CallbackInfoReturnable<CraftEntity> cir) {
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
if (entity instanceof Mob) {
|
if (entity instanceof Mob) {
|
||||||
if (entity instanceof AgableMob) {
|
if (entity instanceof AgeableMob) {
|
||||||
if (entity instanceof AbstractHorse) {
|
if (entity instanceof AbstractHorse) {
|
||||||
if (entity instanceof AbstractChestedHorse) {
|
if (entity instanceof AbstractChestedHorse) {
|
||||||
cir.setReturnValue(new ArclightModChestedHorse(server, (AbstractChestedHorse) entity));
|
cir.setReturnValue(new ArclightModChestedHorse(server, (AbstractChestedHorse) entity));
|
||||||
@ -91,7 +91,7 @@ public abstract class CraftEntityMixin implements org.bukkit.entity.Entity {
|
|||||||
cir.setReturnValue(new CraftTameableAnimal(server, (TamableAnimal) entity));
|
cir.setReturnValue(new CraftTameableAnimal(server, (TamableAnimal) entity));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
cir.setReturnValue(new CraftAgeable(server, (AgableMob) entity));
|
cir.setReturnValue(new CraftAgeable(server, (AgeableMob) entity));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (entity instanceof FlyingMob) {
|
if (entity instanceof FlyingMob) {
|
||||||
|
|||||||
@ -27,7 +27,7 @@ public abstract class CraftHumanEntityMixin extends CraftEntity {
|
|||||||
@Override
|
@Override
|
||||||
public void setHandle(Entity entity) {
|
public void setHandle(Entity entity) {
|
||||||
super.setHandle(entity);
|
super.setHandle(entity);
|
||||||
this.inventory = new CraftInventoryPlayer(((Player) entity).inventory);
|
this.inventory = new CraftInventoryPlayer(((Player) entity).getInventory());
|
||||||
this.enderChest = new CraftInventory(((Player) entity).getEnderChestInventory());
|
this.enderChest = new CraftInventory(((Player) entity).getEnderChestInventory());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,14 @@ import io.izzel.arclight.common.mod.ArclightMod;
|
|||||||
import io.izzel.arclight.common.mod.server.block.ArclightTileInventory;
|
import io.izzel.arclight.common.mod.server.block.ArclightTileInventory;
|
||||||
import io.izzel.arclight.i18n.LocalizedException;
|
import io.izzel.arclight.i18n.LocalizedException;
|
||||||
import io.izzel.arclight.i18n.conf.MaterialPropertySpec;
|
import io.izzel.arclight.i18n.conf.MaterialPropertySpec;
|
||||||
|
import net.minecraft.resources.ResourceLocation;
|
||||||
|
import net.minecraft.world.Container;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.FallingBlock;
|
||||||
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
@ -46,14 +54,6 @@ import java.lang.reflect.Constructor;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.world.Container;
|
|
||||||
import net.minecraft.world.item.Item;
|
|
||||||
import net.minecraft.world.item.ItemStack;
|
|
||||||
import net.minecraft.world.level.block.Block;
|
|
||||||
import net.minecraft.world.level.block.Blocks;
|
|
||||||
import net.minecraft.world.level.block.FallingBlock;
|
|
||||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
||||||
|
|
||||||
@Mixin(value = Material.class, remap = false)
|
@Mixin(value = Material.class, remap = false)
|
||||||
public abstract class MaterialMixin implements MaterialBridge {
|
public abstract class MaterialMixin implements MaterialBridge {
|
||||||
@ -328,7 +328,7 @@ public abstract class MaterialMixin implements MaterialBridge {
|
|||||||
arclight$spec.burnable = block != null && ((FireBlockBridge) Blocks.FIRE).bridge$canBurn(block);
|
arclight$spec.burnable = block != null && ((FireBlockBridge) Blocks.FIRE).bridge$canBurn(block);
|
||||||
}
|
}
|
||||||
if (arclight$spec.fuel == null) {
|
if (arclight$spec.fuel == null) {
|
||||||
arclight$spec.fuel = item != null && new ItemStack(item).getBurnTime() > 0;
|
arclight$spec.fuel = item != null && new ItemStack(item).getBurnTime(null) > 0;
|
||||||
}
|
}
|
||||||
if (arclight$spec.occluding == null) {
|
if (arclight$spec.occluding == null) {
|
||||||
arclight$spec.occluding = arclight$spec.solid;
|
arclight$spec.occluding = arclight$spec.solid;
|
||||||
|
|||||||
@ -20,6 +20,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Mixin(PiglinAi.class)
|
@Mixin(PiglinAi.class)
|
||||||
public abstract class PiglinAiMixin {
|
public abstract class PiglinAiMixin {
|
||||||
@ -92,7 +93,7 @@ public abstract class PiglinAiMixin {
|
|||||||
ItemStack stack = piglin.getItemInHand(InteractionHand.OFF_HAND);
|
ItemStack stack = piglin.getItemInHand(InteractionHand.OFF_HAND);
|
||||||
PiglinBarterEvent event = CraftEventFactory.callPiglinBarterEvent(piglin, getBarterResponseItems(piglin), stack);
|
PiglinBarterEvent event = CraftEventFactory.callPiglinBarterEvent(piglin, getBarterResponseItems(piglin), stack);
|
||||||
if (!event.isCancelled()) {
|
if (!event.isCancelled()) {
|
||||||
throwItems(piglin, event.getOutcome().stream().map(CraftItemStack::asNMSCopy).toList());
|
throwItems(piglin, event.getOutcome().stream().map(CraftItemStack::asNMSCopy).collect(Collectors.toList()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,17 @@
|
|||||||
package io.izzel.arclight.common.mixin.forge;
|
package io.izzel.arclight.common.mixin.forge;
|
||||||
|
|
||||||
|
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.world.InteractionHand;
|
import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
import net.minecraft.world.entity.LivingEntity;
|
||||||
import net.minecraft.world.item.context.UseOnContext;
|
import net.minecraft.world.item.context.UseOnContext;
|
||||||
import net.minecraft.world.level.ChunkPos;
|
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraftforge.common.ForgeHooks;
|
import net.minecraftforge.common.ForgeHooks;
|
||||||
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.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
|
||||||
|
|
||||||
@Mixin(ForgeHooks.class)
|
@Mixin(ForgeHooks.class)
|
||||||
public class ForgeHooksMixin {
|
public class ForgeHooksMixin {
|
||||||
@ -29,7 +28,7 @@ public class ForgeHooksMixin {
|
|||||||
|
|
||||||
@Inject(method = "canEntityDestroy", cancellable = true, remap = false, at = @At("HEAD"))
|
@Inject(method = "canEntityDestroy", cancellable = true, remap = false, at = @At("HEAD"))
|
||||||
private static void arclight$returnIfNotLoaded(Level world, BlockPos pos, LivingEntity entity, CallbackInfoReturnable<Boolean> cir) {
|
private static void arclight$returnIfNotLoaded(Level world, BlockPos pos, LivingEntity entity, CallbackInfoReturnable<Boolean> cir) {
|
||||||
if (!world.getChunkSource().isEntityTickingChunk(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4))) {
|
if (!world.isLoaded(pos)) {
|
||||||
cir.setReturnValue(false);
|
cir.setReturnValue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package io.izzel.arclight.common.mod;
|
package io.izzel.arclight.common.mod;
|
||||||
|
|
||||||
import cpw.mods.modlauncher.api.ITransformingClassLoader;
|
|
||||||
import io.izzel.arclight.common.mod.util.log.ArclightI18nLogger;
|
import io.izzel.arclight.common.mod.util.log.ArclightI18nLogger;
|
||||||
import io.izzel.arclight.mixin.injector.EjectorInfo;
|
import io.izzel.arclight.mixin.injector.EjectorInfo;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
@ -8,20 +7,12 @@ import org.spongepowered.asm.mixin.Mixins;
|
|||||||
import org.spongepowered.asm.mixin.connect.IMixinConnector;
|
import org.spongepowered.asm.mixin.connect.IMixinConnector;
|
||||||
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo;
|
import org.spongepowered.asm.mixin.injection.struct.InjectionInfo;
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ArclightConnector implements IMixinConnector {
|
public class ArclightConnector implements IMixinConnector {
|
||||||
|
|
||||||
public static final Logger LOGGER = ArclightI18nLogger.getLogger("Arclight");
|
public static final Logger LOGGER = ArclightI18nLogger.getLogger("Arclight");
|
||||||
private static final List<String> FILTER_PACKAGE = Arrays.asList("com.google.common", "com.google.gson", "ninja.leaping.configurate",
|
|
||||||
"io.izzel.arclight.i18n");
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void connect() {
|
public void connect() {
|
||||||
((ITransformingClassLoader) Thread.currentThread().getContextClassLoader()).addTargetPackageFilter(
|
|
||||||
s -> FILTER_PACKAGE.stream().noneMatch(s::startsWith)
|
|
||||||
);
|
|
||||||
InjectionInfo.register(EjectorInfo.class);
|
InjectionInfo.register(EjectorInfo.class);
|
||||||
Mixins.addConfiguration("mixins.arclight.core.json");
|
Mixins.addConfiguration("mixins.arclight.core.json");
|
||||||
Mixins.addConfiguration("mixins.arclight.bukkit.json");
|
Mixins.addConfiguration("mixins.arclight.bukkit.json");
|
||||||
|
|||||||
@ -4,8 +4,10 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import net.minecraftforge.fml.loading.moddiscovery.AbstractJarFileLocator;
|
import net.minecraftforge.fml.loading.moddiscovery.AbstractJarFileLocator;
|
||||||
import net.minecraftforge.forgespi.locating.IModFile;
|
import net.minecraftforge.forgespi.locating.IModFile;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public abstract class ArclightLocator extends AbstractJarFileLocator {
|
public abstract class ArclightLocator extends AbstractJarFileLocator {
|
||||||
|
|
||||||
@ -13,7 +15,6 @@ public abstract class ArclightLocator extends AbstractJarFileLocator {
|
|||||||
|
|
||||||
public ArclightLocator() {
|
public ArclightLocator() {
|
||||||
this.arclight = loadJars();
|
this.arclight = loadJars();
|
||||||
this.modJars.put(arclight, createFileSystem(arclight));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IModFile loadJars();
|
protected abstract IModFile loadJars();
|
||||||
@ -31,4 +32,9 @@ public abstract class ArclightLocator extends AbstractJarFileLocator {
|
|||||||
@Override
|
@Override
|
||||||
public void initArguments(Map<String, ?> arguments) {
|
public void initArguments(Map<String, ?> arguments) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Stream<Path> scanCandidates() {
|
||||||
|
return Stream.empty();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,12 +4,11 @@ import io.izzel.arclight.api.ArclightVersion;
|
|||||||
import io.izzel.arclight.common.mod.server.ArclightPermissionHandler;
|
import io.izzel.arclight.common.mod.server.ArclightPermissionHandler;
|
||||||
import io.izzel.arclight.common.mod.server.event.ArclightEventDispatcherRegistry;
|
import io.izzel.arclight.common.mod.server.event.ArclightEventDispatcherRegistry;
|
||||||
import io.izzel.arclight.common.mod.util.log.ArclightI18nLogger;
|
import io.izzel.arclight.common.mod.util.log.ArclightI18nLogger;
|
||||||
import net.minecraftforge.fml.ExtensionPoint;
|
import net.minecraftforge.fml.IExtensionPoint;
|
||||||
import net.minecraftforge.fml.ModLoadingContext;
|
import net.minecraftforge.fml.ModLoadingContext;
|
||||||
import net.minecraftforge.fml.common.Mod;
|
import net.minecraftforge.fml.common.Mod;
|
||||||
import net.minecraftforge.fml.network.FMLNetworkConstants;
|
import net.minecraftforge.fmllegacy.network.FMLNetworkConstants;
|
||||||
import net.minecraftforge.server.permission.PermissionAPI;
|
import net.minecraftforge.server.permission.PermissionAPI;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@Mod("arclight")
|
@Mod("arclight")
|
||||||
@ -21,7 +20,8 @@ public class ArclightMod {
|
|||||||
LOGGER.info("mod-load");
|
LOGGER.info("mod-load");
|
||||||
ArclightVersion.setVersion(ArclightVersion.v1_16_4);
|
ArclightVersion.setVersion(ArclightVersion.v1_16_4);
|
||||||
ArclightEventDispatcherRegistry.registerAllEventDispatchers();
|
ArclightEventDispatcherRegistry.registerAllEventDispatchers();
|
||||||
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
|
||||||
|
() -> new IExtensionPoint.DisplayTest(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
||||||
PermissionAPI.setPermissionHandler(ArclightPermissionHandler.INSTANCE);
|
PermissionAPI.setPermissionHandler(ArclightPermissionHandler.INSTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -182,7 +182,7 @@ public class ArclightContainer {
|
|||||||
@Override
|
@Override
|
||||||
public void setItem(int index, @NotNull ItemStack stack) {
|
public void setItem(int index, @NotNull ItemStack stack) {
|
||||||
if (index >= size) return;
|
if (index >= size) return;
|
||||||
container.setItem(index, stack);
|
container.getSlot(index).set(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
import net.minecraft.server.dedicated.DedicatedServer;
|
import net.minecraft.server.dedicated.DedicatedServer;
|
||||||
import net.minecraft.server.players.PlayerList;
|
import net.minecraft.server.players.PlayerList;
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
import net.minecraft.world.level.dimension.DimensionType;
|
||||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.v.CraftServer;
|
import org.bukkit.craftbukkit.v.CraftServer;
|
||||||
import org.bukkit.craftbukkit.v.command.ColouredConsoleSender;
|
import org.bukkit.craftbukkit.v.command.ColouredConsoleSender;
|
||||||
|
|||||||
@ -29,7 +29,7 @@ import net.minecraft.world.item.Items;
|
|||||||
import net.minecraft.world.level.block.Block;
|
import net.minecraft.world.level.block.Block;
|
||||||
import net.minecraft.world.level.block.Blocks;
|
import net.minecraft.world.level.block.Blocks;
|
||||||
import net.minecraft.world.level.dimension.DimensionType;
|
import net.minecraft.world.level.dimension.DimensionType;
|
||||||
import net.minecraftforge.fml.CrashReportExtender;
|
import net.minecraftforge.fml.CrashReportCallables;
|
||||||
import net.minecraftforge.registries.ForgeRegistries;
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
import net.minecraftforge.registries.ForgeRegistry;
|
import net.minecraftforge.registries.ForgeRegistry;
|
||||||
import net.minecraftforge.registries.IForgeRegistry;
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
@ -81,7 +81,7 @@ public class BukkitRegistry {
|
|||||||
private static final BiMap<ResourceLocation, Statistic> STATS = HashBiMap.create(Unsafe.getStatic(CraftStatistic.class, "statistics"));
|
private static final BiMap<ResourceLocation, Statistic> STATS = HashBiMap.create(Unsafe.getStatic(CraftStatistic.class, "statistics"));
|
||||||
|
|
||||||
public static void registerAll() {
|
public static void registerAll() {
|
||||||
CrashReportExtender.registerCrashCallable("Arclight", () -> new CraftCrashReport().call().toString());
|
CrashReportCallables.registerCrashCallable("Arclight", new CraftCrashReport());
|
||||||
loadMaterials();
|
loadMaterials();
|
||||||
loadPotions();
|
loadPotions();
|
||||||
loadEnchantments();
|
loadEnchantments();
|
||||||
@ -382,7 +382,7 @@ public class BukkitRegistry {
|
|||||||
private static Set<IForgeRegistry<?>> registries() {
|
private static Set<IForgeRegistry<?>> registries() {
|
||||||
return ImmutableSet.of(ForgeRegistries.BLOCKS, ForgeRegistries.ITEMS,
|
return ImmutableSet.of(ForgeRegistries.BLOCKS, ForgeRegistries.ITEMS,
|
||||||
ForgeRegistries.POTION_TYPES, ForgeRegistries.POTIONS,
|
ForgeRegistries.POTION_TYPES, ForgeRegistries.POTIONS,
|
||||||
ForgeRegistries.ENTITIES, ForgeRegistries.TILE_ENTITIES,
|
ForgeRegistries.ENTITIES, ForgeRegistries.BLOCK_ENTITIES,
|
||||||
ForgeRegistries.BIOMES);
|
ForgeRegistries.BIOMES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,6 @@ package io.izzel.arclight.common.mod.server.event;
|
|||||||
import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
import io.izzel.arclight.common.bridge.entity.EntityBridge;
|
||||||
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
|
import io.izzel.arclight.common.bridge.entity.player.ServerPlayerEntityBridge;
|
||||||
import net.minecraft.server.level.ServerPlayer;
|
import net.minecraft.server.level.ServerPlayer;
|
||||||
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
|
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -15,7 +14,7 @@ import org.bukkit.event.player.PlayerTeleportEvent;
|
|||||||
public class EntityTeleportEventDispatcher {
|
public class EntityTeleportEventDispatcher {
|
||||||
|
|
||||||
@SubscribeEvent(receiveCanceled = true)
|
@SubscribeEvent(receiveCanceled = true)
|
||||||
public void onTeleport(EnderTeleportEvent event) {
|
public void onTeleport(net.minecraftforge.event.entity.EntityTeleportEvent.EnderEntity event) {
|
||||||
if (event.getEntity() instanceof ServerPlayer) {
|
if (event.getEntity() instanceof ServerPlayer) {
|
||||||
CraftPlayer player = ((ServerPlayerEntityBridge) event.getEntity()).bridge$getBukkitEntity();
|
CraftPlayer player = ((ServerPlayerEntityBridge) event.getEntity()).bridge$getBukkitEntity();
|
||||||
PlayerTeleportEvent bukkitEvent = new PlayerTeleportEvent(player, player.getLocation(), new Location(player.getWorld(), event.getTargetX(), event.getTargetY(), event.getTargetZ()), PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
PlayerTeleportEvent bukkitEvent = new PlayerTeleportEvent(player, player.getLocation(), new Location(player.getWorld(), event.getTargetX(), event.getTargetY(), event.getTargetZ()), PlayerTeleportEvent.TeleportCause.ENDER_PEARL);
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package io.izzel.arclight.common.mod.util;
|
|||||||
|
|
||||||
import io.izzel.arclight.common.bridge.item.crafting.RecipeManagerBridge;
|
import io.izzel.arclight.common.bridge.item.crafting.RecipeManagerBridge;
|
||||||
import net.minecraft.world.item.crafting.Recipe;
|
import net.minecraft.world.item.crafting.Recipe;
|
||||||
import net.minecraftforge.fml.server.ServerLifecycleHooks;
|
import net.minecraftforge.fmllegacy.server.ServerLifecycleHooks;
|
||||||
import org.bukkit.NamespacedKey;
|
import org.bukkit.NamespacedKey;
|
||||||
import org.bukkit.craftbukkit.v.inventory.CraftComplexRecipe;
|
import org.bukkit.craftbukkit.v.inventory.CraftComplexRecipe;
|
||||||
import org.bukkit.craftbukkit.v.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v.inventory.CraftItemStack;
|
||||||
|
|||||||
@ -1,9 +1,8 @@
|
|||||||
package io.izzel.arclight.common.mod.util;
|
package io.izzel.arclight.common.mod.util;
|
||||||
|
|
||||||
import com.mojang.serialization.Lifecycle;
|
import com.mojang.serialization.Lifecycle;
|
||||||
import io.izzel.arclight.common.bridge.world.storage.WorldInfoBridge;
|
|
||||||
import io.izzel.arclight.common.bridge.world.storage.DerivedWorldInfoBridge;
|
import io.izzel.arclight.common.bridge.world.storage.DerivedWorldInfoBridge;
|
||||||
import net.minecraft.CrashReportCategory;
|
import io.izzel.arclight.common.bridge.world.storage.WorldInfoBridge;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
import net.minecraft.world.Difficulty;
|
import net.minecraft.world.Difficulty;
|
||||||
@ -16,6 +15,7 @@ import net.minecraft.world.level.storage.DerivedLevelData;
|
|||||||
import net.minecraft.world.level.storage.PrimaryLevelData;
|
import net.minecraft.world.level.storage.PrimaryLevelData;
|
||||||
import net.minecraft.world.level.storage.ServerLevelData;
|
import net.minecraft.world.level.storage.ServerLevelData;
|
||||||
import net.minecraft.world.level.timers.TimerQueue;
|
import net.minecraft.world.level.timers.TimerQueue;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@SuppressWarnings("all")
|
@SuppressWarnings("all")
|
||||||
@ -233,11 +233,6 @@ public class DelegateWorldInfo extends PrimaryLevelData {
|
|||||||
derivedWorldInfo.setWanderingTraderId(id);
|
derivedWorldInfo.setWanderingTraderId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void fillCrashReportCategory(CrashReportCategory category) {
|
|
||||||
derivedWorldInfo.fillCrashReportCategory(category);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DelegateWorldInfo wrap(DerivedLevelData worldInfo) {
|
public static DelegateWorldInfo wrap(DerivedLevelData worldInfo) {
|
||||||
return new DelegateWorldInfo(worldSettings(worldInfo), generatorSettings(worldInfo), lifecycle(worldInfo), worldInfo);
|
return new DelegateWorldInfo(worldSettings(worldInfo), generatorSettings(worldInfo), lifecycle(worldInfo), worldInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
package io.izzel.arclight.common.mod.util;
|
package io.izzel.arclight.common.mod.util;
|
||||||
|
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
|
||||||
import net.minecraft.core.NonNullList;
|
import net.minecraft.core.NonNullList;
|
||||||
import net.minecraft.world.Container;
|
import net.minecraft.world.Container;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
@ -8,13 +7,13 @@ import org.jetbrains.annotations.NotNull;
|
|||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class WrappedContents extends NonNullList<ItemStack> {
|
public class WrappedContents extends NonNullList<ItemStack> {
|
||||||
|
|
||||||
private final Container inventory;
|
private final Container inventory;
|
||||||
|
|
||||||
public WrappedContents(Container inventory) {
|
public WrappedContents(Container inventory) {
|
||||||
|
super(null, null);
|
||||||
this.inventory = inventory;
|
this.inventory = inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
package io.izzel.arclight.common.mod.util.remapper;
|
package io.izzel.arclight.common.mod.util.remapper;
|
||||||
|
|
||||||
import cpw.mods.modlauncher.api.ITransformingClassLoader;
|
import cpw.mods.modlauncher.TransformingClassLoader;
|
||||||
|
|
||||||
public interface RemappingClassLoader {
|
public interface RemappingClassLoader {
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ public interface RemappingClassLoader {
|
|||||||
static ClassLoader asTransforming(ClassLoader classLoader) {
|
static ClassLoader asTransforming(ClassLoader classLoader) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
while (classLoader != null) {
|
while (classLoader != null) {
|
||||||
if (classLoader instanceof ITransformingClassLoader || classLoader instanceof RemappingClassLoader) {
|
if (classLoader instanceof TransformingClassLoader || classLoader instanceof RemappingClassLoader) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -7,9 +7,8 @@ buildscript {
|
|||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forge_gradle_version}"
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: "${forge_gradle_version}"
|
||||||
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
|
classpath 'org.spongepowered:mixingradle:0.7.1-SNAPSHOT'
|
||||||
// classpath "io.izzel.arclight:arclight-gradle-plugin:$agpVersion"
|
classpath "io.izzel.arclight:arclight-gradle-plugin:$agpVersion"
|
||||||
classpath files("G:\\workspace\\arclight-gradle-plugin\\build\\libs\\arclight-gradle-plugin-1.18.jar")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,6 +139,7 @@ jar {
|
|||||||
}
|
}
|
||||||
from(project(':arclight-common').tasks.jar.outputs.files.collect { it.isDirectory() ? it : zipTree(it) })
|
from(project(':arclight-common').tasks.jar.outputs.files.collect { it.isDirectory() ? it : zipTree(it) })
|
||||||
from sourceSets.applaunch.output.classesDirs
|
from sourceSets.applaunch.output.classesDirs
|
||||||
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||||
}
|
}
|
||||||
|
|
||||||
remapSpigotJar {
|
remapSpigotJar {
|
||||||
@ -157,7 +157,7 @@ compileJava {
|
|||||||
}
|
}
|
||||||
|
|
||||||
compileApplaunchJava {
|
compileApplaunchJava {
|
||||||
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_6
|
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_7
|
||||||
}
|
}
|
||||||
|
|
||||||
task srgJar(type: Jar) {
|
task srgJar(type: Jar) {
|
||||||
|
|||||||
@ -6,13 +6,15 @@ import net.minecraftforge.forgespi.locating.IModFile;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
public class ArclightLocator_Forge extends ArclightLocator {
|
public class ArclightLocator_Forge extends ArclightLocator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected IModFile loadJars() {
|
protected IModFile loadJars() {
|
||||||
try {
|
try {
|
||||||
return ModFile.newFMLInstance(new File(ArclightLocator.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toPath(), this);
|
return ModFile.newFMLInstance(this, new File(ArclightLocator.class.getProtectionDomain().getCodeSource().getLocation().toURI()).toPath());
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@ allprojects {
|
|||||||
version '1.0.20'
|
version '1.0.20'
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
agpVersion = '1.17'
|
agpVersion = '1.18'
|
||||||
minecraftVersion = '1.17.1'
|
minecraftVersion = '1.17.1'
|
||||||
forgeVersion = '37.0.1'
|
forgeVersion = '37.0.1'
|
||||||
apiVersion = '1.0.+'
|
apiVersion = '1.0.+'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user