Fix End Portal and End Cities not spawning
This commit is contained in:
parent
e75ae5ad01
commit
918ed363bb
|
|
@ -18,7 +18,7 @@ function initializeCoreMod() {
|
||||||
'target': {
|
'target': {
|
||||||
'type': 'METHOD',
|
'type': 'METHOD',
|
||||||
'class': 'net.minecraft.world.level.levelgen.structure.structures.EndCityStructure',
|
'class': 'net.minecraft.world.level.levelgen.structure.structures.EndCityStructure',
|
||||||
'methodName': 'm_214086_',
|
'methodName': 'findGenerationPoint',
|
||||||
'methodDesc': '(Lnet/minecraft/world/level/levelgen/structure/Structure$GenerationContext;)Ljava/util/Optional;'
|
'methodDesc': '(Lnet/minecraft/world/level/levelgen/structure/Structure$GenerationContext;)Ljava/util/Optional;'
|
||||||
},
|
},
|
||||||
'transformer': function (method) {
|
'transformer': function (method) {
|
||||||
|
|
@ -75,7 +75,7 @@ function initializeCoreMod() {
|
||||||
'target': {
|
'target': {
|
||||||
'type': 'METHOD',
|
'type': 'METHOD',
|
||||||
'class': 'net.minecraft.world.level.dimension.end.EndDragonFight',
|
'class': 'net.minecraft.world.level.dimension.end.EndDragonFight',
|
||||||
'methodName': 'm_64093_', // spawnExitPortal
|
'methodName': 'spawnExitPortal', // spawnExitPortal
|
||||||
'methodDesc': '(Z)V'
|
'methodDesc': '(Z)V'
|
||||||
},
|
},
|
||||||
'transformer': function(method) {
|
'transformer': function(method) {
|
||||||
|
|
@ -87,29 +87,19 @@ function initializeCoreMod() {
|
||||||
for (var i = 2; i < insnList.size(); ++i) {
|
for (var i = 2; i < insnList.size(); ++i) {
|
||||||
var insn = insnList.get(i);
|
var insn = insnList.get(i);
|
||||||
|
|
||||||
// we want insn to be the GETFIELD portalLocation instruction after RandomSource.create
|
if (insn.getOpcode() == Opcodes.ALOAD && insn.var == 2) {
|
||||||
var previous = insnList.get(i - 2);
|
// this.portalLocation = ASMHooks.prePlaceEndPodium(this.portalLocation)
|
||||||
if (previous.getOpcode() === Opcodes.INVOKESTATIC && previous.name.equals(randomSourceCreate)) {
|
// f_64072_ maps to portalLocation
|
||||||
// labels and frame nodes use -1 as their opcode
|
insnList.insertBefore(insn, ASMAPI.listOf(
|
||||||
if (insn.getNext().getOpcode() === -1) {
|
new VarInsnNode(Opcodes.ALOAD, 0),
|
||||||
insn = insn.getNext();
|
new VarInsnNode(Opcodes.ALOAD, 0),
|
||||||
}
|
new FieldInsnNode(Opcodes.GETFIELD, 'net/minecraft/world/level/dimension/end/EndDragonFight', 'portalLocation', 'Lnet/minecraft/core/BlockPos;'),
|
||||||
|
new MethodInsnNode(Opcodes.INVOKESTATIC, 'thedarkcolour/exdeorum/asm/ASMHooks', 'prePlaceEndPodium', '(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/core/BlockPos;', false),
|
||||||
// ALOAD 0 (there are two in a row)
|
new FieldInsnNode(Opcodes.PUTFIELD, 'net/minecraft/world/level/dimension/end/EndDragonFight', 'portalLocation', 'Lnet/minecraft/core/BlockPos;')
|
||||||
insnList.insertBefore(insn, new VarInsnNode(Opcodes.ALOAD, 0));
|
));
|
||||||
|
|
||||||
// INVOKESTATIC to my hook
|
|
||||||
// DUP_X1
|
|
||||||
// PUTFIELD
|
|
||||||
insnList.insert(insn, ASMAPI.listOf(
|
|
||||||
new MethodInsnNode(Opcodes.INVOKESTATIC, 'thedarkcolour/exdeorum/asm/ASMHooks', 'prePlaceEndPodium', '(Lnet/minecraft/core/BlockPos;)Lnet/minecraft/core/BlockPos;', false),
|
|
||||||
new InsnNode(Opcodes.DUP_X1),
|
|
||||||
new FieldInsnNode(Opcodes.PUTFIELD, insn.owner, insn.name, insn.desc)
|
|
||||||
));
|
|
||||||
|
|
||||||
ASMAPI.log('INFO', 'Successfully patched end portal.');
|
ASMAPI.log('INFO', 'Successfully patched end portal.');
|
||||||
return method;
|
return method;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ASMAPI.log('ERROR', 'Unable to patch End Portal, it will not spawn properly and you will be unable to return to the overworld without cheats.');
|
ASMAPI.log('ERROR', 'Unable to patch End Portal, it will not spawn properly and you will be unable to return to the overworld without cheats.');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user