3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-26 02:50:06 +01:00

Look up BlockBase.Info field in actual class instead of subclass

Dieser Commit ist enthalten in:
SirYwell 2021-06-05 20:32:09 +02:00
Ursprung 2bdf6ae18a
Commit 798e18ecc2
3 geänderte Dateien mit 6 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -31,7 +31,7 @@ public class BlockMaterial_1_16_1 implements BlockMaterial {
this.material = defaultState.getMaterial(); this.material = defaultState.getMaterial();
this.craftBlockData = CraftBlockData.fromData(defaultState); this.craftBlockData = CraftBlockData.fromData(defaultState);
this.craftMaterial = craftBlockData.getMaterial(); this.craftMaterial = craftBlockData.getMaterial();
BlockBase.Info blockInfo = ReflectionUtil.getField(Block.class, block, "aB"); BlockBase.Info blockInfo = ReflectionUtil.getField(BlockBase.class, block, "aB");
this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n"); this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n");
opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO); opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO);
} }

Datei anzeigen

@ -31,7 +31,7 @@ public class BlockMaterial_1_16_2 implements BlockMaterial {
this.material = defaultState.getMaterial(); this.material = defaultState.getMaterial();
this.craftBlockData = CraftBlockData.fromData(defaultState); this.craftBlockData = CraftBlockData.fromData(defaultState);
this.craftMaterial = craftBlockData.getMaterial(); this.craftMaterial = craftBlockData.getMaterial();
BlockBase.Info blockInfo = ReflectionUtil.getField(Block.class, block, "aB"); BlockBase.Info blockInfo = ReflectionUtil.getField(BlockBase.class, block, "aB");
this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n"); this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n");
opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO); opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO);
} }

Datei anzeigen

@ -12,6 +12,9 @@ import net.minecraft.server.v1_16_R3.ITileEntity;
import net.minecraft.server.v1_16_R3.Material; import net.minecraft.server.v1_16_R3.Material;
import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData; import org.bukkit.craftbukkit.v1_16_R3.block.data.CraftBlockData;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
public class BlockMaterial_1_16_5 implements BlockMaterial { public class BlockMaterial_1_16_5 implements BlockMaterial {
private final Block block; private final Block block;
private final IBlockData defaultState; private final IBlockData defaultState;
@ -31,7 +34,7 @@ public class BlockMaterial_1_16_5 implements BlockMaterial {
this.material = defaultState.getMaterial(); this.material = defaultState.getMaterial();
this.craftBlockData = CraftBlockData.fromData(defaultState); this.craftBlockData = CraftBlockData.fromData(defaultState);
this.craftMaterial = craftBlockData.getMaterial(); this.craftMaterial = craftBlockData.getMaterial();
BlockBase.Info blockInfo = ReflectionUtil.getField(Block.class, block, "aB"); BlockBase.Info blockInfo = ReflectionUtil.getField(BlockBase.class, block, "aB");
this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n"); this.isTranslucent = !(boolean)ReflectionUtil.getField(BlockBase.Info.class, blockInfo, "n");
opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO); opacity = defaultState.b(BlockAccessAir.INSTANCE, BlockPosition.ZERO);
} }