Restore files omitted by sparse release checkout
This commit is contained in:
parent
0eb68e39ff
commit
35b68e0e73
1 changed files with 182963 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
|||
package com.dunerealms.gui;
|
||||
import java.lang.reflect.Field;
|
||||
/** Detach only the lobby's vanilla End fight, without killing entities or editing NBT. */
|
||||
final class DragonController {
|
||||
record Detached(Object handle,Field field,Object previous){
|
||||
void restore() throws IllegalAccessException {if(field.get(handle)==null)field.set(handle,previous);}
|
||||
}
|
||||
static Detached detach(Object handle)throws ReflectiveOperationException {
|
||||
for(Class<?> type=handle.getClass();type!=null;type=type.getSuperclass())for(Field field:type.getDeclaredFields())if(field.getType().getSimpleName().equals("EndDragonFight")){
|
||||
field.setAccessible(true);Object previous=field.get(handle);field.set(handle,null);return new Detached(handle,field,previous);
|
||||
}
|
||||
throw new NoSuchFieldException("Lobby EndDragonFight controller");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue

Staff