Skip to content
This repository has been archived by the owner on Apr 28, 2020. It is now read-only.

Patch entity networking #37

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

UpcraftLP
Copy link
Contributor

@UpcraftLP UpcraftLP commented Aug 31, 2018

  • 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 {
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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)) {
Copy link
Contributor

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) {
Copy link
Contributor

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)) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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) {
Copy link
Contributor

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",
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants