Fix chest/lectern crashing (#385)
This commit is contained in:
parent
b979227322
commit
9c46952a18
|
@ -93,6 +93,12 @@ jar {
|
|||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
tasks.reobfJar.configure {
|
||||
it.extraMappings.from(project.files('extra_mapping.tsrg'))
|
||||
}
|
||||
}
|
||||
|
||||
processResources {
|
||||
filesMatching("**/mods.toml") {
|
||||
expand 'version': "$minecraftVersion-${project.version}-$gitHash"
|
||||
|
@ -101,7 +107,6 @@ processResources {
|
|||
|
||||
remapSpigotJar {
|
||||
includes.add('net/minecraft/world/level/block/ChestBlock$DoubleInventory')
|
||||
includes.add('net/minecraft/tileentity/LecternTileEntity$LecternInventory')
|
||||
}
|
||||
|
||||
mixin {
|
||||
|
@ -111,7 +116,4 @@ mixin {
|
|||
compileJava {
|
||||
options.compilerArgs << '-XDignore.symbol.file' << '-XDenableSunApiLintControl'
|
||||
options.encoding = 'UTF-8'
|
||||
options.compilerArgs += [
|
||||
"-AreobfTsrgFiles=${project.file('extra_mapping.tsrg').canonicalPath}"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,64 +1,4 @@
|
|||
net/minecraft/world/IWorld net/minecraft/world/IWorld
|
||||
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
|
||||
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
|
||||
destroyBlock (Lnet/minecraft/util/math/BlockPos;ZLnet/minecraft/entity/Entity;)Z func_225521_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
|
||||
setAttackTarget (Lnet/minecraft/entity/LivingEntity;)V func_70624_b
|
||||
net/minecraft/entity/passive/WolfEntity net/minecraft/entity/passive/WolfEntity
|
||||
setHealth (F)V func_70606_j
|
||||
heal (F)V func_70691_i
|
||||
net/minecraft/block/BlockState net/minecraft/block/BlockState
|
||||
get (Lnet/minecraft/state/Property;)Ljava/lang/Comparable; func_177229_b
|
||||
net/minecraft/entity/item/ArmorStandEntity net/minecraft/entity/item/ArmorStandEntity
|
||||
remove ()V func_70106_y
|
||||
setLocationAndAngles (DDDFF)V func_70012_b
|
||||
net/minecraft/entity/merchant/villager/VillagerEntity net/minecraft/entity/merchant/villager/VillagerEntity
|
||||
addPotionEffect (Lnet/minecraft/potion/EffectInstance;)Z func_195064_c
|
||||
net/minecraft/entity/monster/SpiderEntity net/minecraft/entity/monster/SpiderEntity
|
||||
addPotionEffect (Lnet/minecraft/potion/EffectInstance;)Z func_195064_c
|
||||
net/minecraft/entity/monster/WitchEntity net/minecraft/entity/monster/WitchEntity
|
||||
addPotionEffect (Lnet/minecraft/potion/EffectInstance;)Z func_195064_c
|
||||
net/minecraft/entity/passive/ParrotEntity net/minecraft/entity/passive/ParrotEntity
|
||||
addPotionEffect (Lnet/minecraft/potion/EffectInstance;)Z func_195064_c
|
||||
net/minecraft/entity/monster/ZombieVillagerEntity net/minecraft/entity/monster/ZombieVillagerEntity
|
||||
addPotionEffect (Lnet/minecraft/potion/EffectInstance;)Z func_195064_c
|
||||
removePotionEffect (Lnet/minecraft/potion/Effect;)Z func_195063_d
|
||||
net/minecraft/entity/MobEntity net/minecraft/entity/MobEntity
|
||||
entityDropItem (Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/entity/item/ItemEntity; func_199703_a
|
||||
net/minecraft/entity/passive/ChickenEntity net/minecraft/entity/passive/ChickenEntity
|
||||
entityDropItem (Lnet/minecraft/util/IItemProvider;)Lnet/minecraft/entity/item/ItemEntity; func_199703_a
|
||||
net/minecraft/entity/passive/SheepEntity net/minecraft/entity/passive/SheepEntity
|
||||
entityDropItem (Lnet/minecraft/util/IItemProvider;I)Lnet/minecraft/entity/item/ItemEntity; func_199702_a
|
||||
net/minecraft/entity/passive/TurtleEntity net/minecraft/entity/passive/TurtleEntity
|
||||
entityDropItem (Lnet/minecraft/util/IItemProvider;I)Lnet/minecraft/entity/item/ItemEntity; func_199702_a
|
||||
net/minecraft/entity/monster/AbstractSkeletonEntity net/minecraft/entity/monster/AbstractSkeletonEntity
|
||||
playSound (Lnet/minecraft/util/SoundEvent;FF)V func_184185_a
|
||||
net/minecraft/entity/projectile/FishingBobberEntity net/minecraft/entity/projectile/FishingBobberEntity
|
||||
playSound (Lnet/minecraft/util/SoundEvent;FF)V func_184185_a
|
||||
net/minecraft/entity/monster/CreeperEntity net/minecraft/entity/monster/CreeperEntity
|
||||
dataManager field_70180_af
|
||||
net/minecraft/entity/passive/DolphinEntity net/minecraft/entity/passive/DolphinEntity
|
||||
setItemStackToSlot (Lnet/minecraft/inventory/EquipmentSlotType;Lnet/minecraft/item/ItemStack;)V func_184201_a
|
||||
net/minecraft/entity/monster/ShulkerEntity net/minecraft/entity/monster/ShulkerEntity
|
||||
forceSetPosition (DDD)V func_226286_f_
|
||||
net/minecraft/entity/passive/horse/AbstractHorseEntity net/minecraft/entity/passive/horse/AbstractHorseEntity
|
||||
heal (F)V func_70691_i
|
||||
net/minecraft/entity/player/ServerPlayerEntity net/minecraft/entity/player/ServerPlayerEntity
|
||||
ticksExisted field_70173_aa
|
||||
addPotionEffect (Lnet/minecraft/potion/EffectInstance;)Z func_195064_c
|
||||
net/minecraft/entity/player/PlayerEntity net/minecraft/entity/player/PlayerEntity
|
||||
rotationYaw field_70177_z
|
||||
setFlag (IZ)V func_70052_a
|
||||
net/minecraft/block/SweetBerryBushBlock net/minecraft/block/SweetBerryBushBlock
|
||||
spawnAsEntity (Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/item/ItemStack;)V func_180635_a
|
||||
net/minecraft/entity/passive/TameableEntity net/minecraft/entity/passive/TameableEntity
|
||||
setLocationAndAngles (DDDFF)V func_70012_b
|
||||
net/minecraft/entity/boss/dragon/EnderDragonEntity net/minecraft/entity/boss/dragon/EnderDragonEntity
|
||||
setHealth (F)V func_70606_j
|
||||
net/minecraft/entity/monster/AbstractRaiderEntity net/minecraft/entity/monster/AbstractRaiderEntity
|
||||
setAttackTarget (Lnet/minecraft/entity/LivingEntity;)V func_70624_b
|
||||
net/minecraft/world/level/block/ChestBlock$DoubleInventory net/minecraft/world/level/block/ChestBlock$2$1
|
||||
tileentitychest f_51612_
|
||||
tileentitychest1 f_51613_
|
||||
net/minecraft/world/level/block/entity/LecternBlockEntity$LecternInventory net/minecraft/world/level/block/entity/LecternBlockEntity$1
|
|
@ -1,24 +0,0 @@
|
|||
package io.izzel.arclight.common.mixin.core.world.level.block;
|
||||
|
||||
import io.izzel.arclight.common.mod.server.block.ChestBlockDoubleInventoryHacks;
|
||||
import net.minecraft.world.CompoundContainer;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Overwrite;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@Mixin(targets = "net/minecraft/world/level/block/ChestBlock$2")
|
||||
public class ChestBlock2Mixin {
|
||||
|
||||
/**
|
||||
* @author IzzelAliz
|
||||
* @reason
|
||||
*/
|
||||
@Overwrite(remap = false)
|
||||
public Optional<MenuProvider> m_6959_(final ChestBlockEntity p_225539_1_, final ChestBlockEntity p_225539_2_) {
|
||||
final CompoundContainer iinventory = new CompoundContainer(p_225539_1_, p_225539_2_);
|
||||
return Optional.ofNullable(ChestBlockDoubleInventoryHacks.create(p_225539_1_, p_225539_2_, iinventory));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package io.izzel.arclight.common.mixin.core.world.level.block;
|
||||
|
||||
import net.minecraft.world.CompoundContainer;
|
||||
import net.minecraft.world.Container;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
@Mixin(targets = "net/minecraft/world/level/block/ChestBlock$2$1")
|
||||
public class ChestBlock2_1Mixin {
|
||||
|
||||
@Shadow(aliases = {"f_51614_", "val$container"}) private Container container;
|
||||
|
||||
public CompoundContainer inventorylargechest = (CompoundContainer) container;
|
||||
}
|
|
@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
|||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(targets = "net.minecraft.world.level.block.ComposterBlock$OutputContainer")
|
||||
@Mixin(ComposterBlock.OutputContainer.class)
|
||||
public abstract class ComposterBlock_OutputContainerMixin extends SimpleContainerMixin {
|
||||
|
||||
// @formatter:off
|
||||
|
|
|
@ -90,4 +90,8 @@ public abstract class LecternTileEntity1Mixin implements IInventoryBridge, Conta
|
|||
@Override
|
||||
public void setCurrentRecipe(Recipe<?> recipe) {
|
||||
}
|
||||
|
||||
public LecternBlockEntity getLectern() {
|
||||
return outerThis;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,27 +2,21 @@ package io.izzel.arclight.common.mod.server.block;
|
|||
|
||||
import io.izzel.arclight.api.Unsafe;
|
||||
import net.minecraft.world.CompoundContainer;
|
||||
import net.minecraft.world.MenuProvider;
|
||||
import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
|
||||
import java.lang.invoke.MethodHandle;
|
||||
import java.lang.invoke.MethodType;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class ChestBlockDoubleInventoryHacks {
|
||||
|
||||
private static MethodHandle ctor;
|
||||
private static Class<?> cl;
|
||||
private static long offset;
|
||||
private static final Class<?> cl;
|
||||
private static final long offset;
|
||||
|
||||
static {
|
||||
try {
|
||||
cl = Class.forName("net.minecraft.block.ChestBlock$DoubleInventory");
|
||||
cl = Class.forName("net/minecraft/world/level/block/ChestBlock$2$1");
|
||||
Field field = cl.getDeclaredField("inventorylargechest");
|
||||
offset = Unsafe.objectFieldOffset(field);
|
||||
ctor = Unsafe.lookup().findConstructor(cl, MethodType.methodType(void.class, ChestBlockEntity.class, ChestBlockEntity.class, CompoundContainer.class));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,12 +27,4 @@ public class ChestBlockDoubleInventoryHacks {
|
|||
public static boolean isInstance(Object obj) {
|
||||
return cl.isInstance(obj);
|
||||
}
|
||||
|
||||
public static MenuProvider create(ChestBlockEntity entity, ChestBlockEntity entity1, CompoundContainer inventory) {
|
||||
try {
|
||||
return (MenuProvider) ctor.invoke(entity, entity1, inventory);
|
||||
} catch (Throwable throwable) {
|
||||
throw new RuntimeException(throwable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ public net.minecraft.world.level.chunk.storage.EntityStorage f_156538_ # level
|
|||
public net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate f_74482_ # palettes
|
||||
public net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate f_74483_ # entityInfoList
|
||||
public net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager f_74326_ # structureRepository
|
||||
public net.minecraft.world.level.block.entity.LecternBlockEntity$1
|
||||
# Misc
|
||||
public net.minecraft.server.PlayerAdvancements f_135964_
|
||||
public net.minecraft.server.level.PlayerRespawnLogic m_8264_(Lnet/minecraft/server/level/ServerLevel;IIZ)Lnet/minecraft/core/BlockPos;
|
||||
|
|
|
@ -325,7 +325,7 @@
|
|||
"world.level.block.CarvedPumpkinBlockMixin",
|
||||
"world.level.block.CauldronBlockMixin",
|
||||
"world.level.block.CaveVinesMixin",
|
||||
"world.level.block.ChestBlock2Mixin",
|
||||
"world.level.block.ChestBlock2_1Mixin",
|
||||
"world.level.block.ChestBlockMixin",
|
||||
"world.level.block.ChorusFlowerBlockMixin",
|
||||
"world.level.block.CocoaBlockMixin",
|
||||
|
|
Loading…
Reference in New Issue
Block a user