-
Notifications
You must be signed in to change notification settings - Fork 52
Patch entity networking #37
base: master
Are you sure you want to change the base?
Patch entity networking #37
Conversation
UpcraftLP
commented
Aug 31, 2018
•
edited
Loading
edited
- adds custom spawn packets for entities and allows modders to alter those
- adds a grenade to the test mod for testing said packets
- adds utility methods for reflection
- allow for overriding vanilla behaviour and fix incorrect tracking behaviour for entities that inherit from registered vanilla entities (as @InsomniaKitten suggested)
maven { url 'https://libraries.minecraft.net/' } | ||
maven { url 'https://www.dimdev.org/maven/' } | ||
maven { url = 'https://repo.spongepowered.org/maven/' } | ||
maven { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
debug { | ||
compileClasspath += main.compileClasspath | ||
compileClasspath += main.compileClasspath + main.output |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
@Shadow @Final private ClientSuggestionProvider clientSuggestionProvider; | ||
@Shadow private NetworkTagManager networkTagManager; | ||
@Shadow private NBTQueryManager nbtQueryManager; | ||
@Shadow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
for (CustomPayloadHandler customPayloadHandler : RiftLoader.instance.getListeners(CustomPayloadHandler.class)) { | ||
if (customPayloadHandler.clientHandlesChannel(channelName)) { | ||
for(CustomPayloadHandler customPayloadHandler : RiftLoader.instance.getListeners(CustomPayloadHandler.class)) { | ||
if(customPayloadHandler.clientHandlesChannel(channelName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
customPayloadHandler.clientHandleCustomPayload(channelName, data); | ||
} | ||
} | ||
|
||
Class<? extends Message> messageClass = Message.REGISTRY.get(channelName); | ||
if (messageClass != null) { | ||
if(messageClass != null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
@@ -81,13 +96,13 @@ private void handleModCustomPayload(SPacketCustomPayload packet, CallbackInfo ci | |||
@Inject(method = "handleUpdateTileEntity", at = @At("RETURN")) | |||
private void handleUpdateModTileEntity(SPacketUpdateTileEntity packet, CallbackInfo ci) { | |||
TileEntity tileEntity = world.getTileEntity(packet.getPos()); | |||
if (tileEntity == null || packet.getNbtCompound() == null || !packet.getNbtCompound().hasKey("id", 8)) { | |||
if(tileEntity == null || packet.getNbtCompound() == null || !packet.getNbtCompound().hasKey("id", 8)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
@@ -15,7 +18,7 @@ | |||
Method method = URLClassLoader.class.getDeclaredMethod("addURL", URL.class); | |||
method.setAccessible(true); | |||
addURLHandle = MethodHandles.lookup().unreflect(method); | |||
} catch (ReflectiveOperationException e) { | |||
} catch(ReflectiveOperationException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
@@ -27,16 +30,47 @@ | |||
|
|||
//noinspection unchecked | |||
return (T) MethodHandles.lookup().unreflectConstructor(constructor).invokeWithArguments(constructorArgs); | |||
} catch (Throwable t) { | |||
} catch(Throwable t) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
throw t instanceof RuntimeException ? (RuntimeException) t : new RuntimeException(t); | ||
} | ||
} | ||
|
||
public static void addURLToClasspath(URL url) { | ||
try { | ||
addURLHandle.invoke(ClassLoader.getSystemClassLoader(), url); | ||
} catch (Throwable t) { | ||
} catch(Throwable t) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant formatting change
@@ -6,39 +6,41 @@ | |||
"package": "org.dimdev.rift.mixin.hook", | |||
"refmap": "mixins.rift.refmap.json", | |||
"mixins": [ | |||
"MixinAnvilSaveHandler", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These do not need resorting entirely, new mixins can just be appended