This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also: - Improved networking stack a little by making client not send Flying (10) and removing 11 spam by limiting percision of delta between cordinates. - Limited Rosepad-exclusive fixes&features to Rosepad servers only - Added coordinates display - Added Entity Damage (35) packet for future damage&death implementation - Made debug menu a little bit more colorful
- Loading branch information
Buj Itself
committed
Jul 12, 2022
1 parent
6497cf1
commit f160a8c
Showing
51 changed files
with
1,726 additions
and
155 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 58 additions & 8 deletions
66
client/inject/java/net/minecraft/src/Packet130RosepadMeta.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,83 @@ | ||
package net.minecraft.src; | ||
|
||
import net.minecraft.client.Minecraft; | ||
|
||
import java.io.DataInputStream; | ||
import java.io.DataOutputStream; | ||
import java.io.IOException; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
// Reserved for future modifications | ||
public class Packet130RosepadMeta extends Packet { | ||
public List<ULPPExtension> extensions = new ArrayList<>(); | ||
public String clientName = "Rosepad"; | ||
public int[] version = Minecraft.getVersion(); | ||
public String tag = Minecraft.getVersionTag(); | ||
public long flags = 0; | ||
|
||
@Override | ||
public void readPacketData(DataInputStream dataInputStream) throws IOException { | ||
// TODO Auto-generated method stub | ||
|
||
clientName = dataInputStream.readUTF(); | ||
short verLen = dataInputStream.readShort(); | ||
version = new int[verLen]; | ||
for (short i = 0; i < verLen; i++) | ||
version[i] = dataInputStream.readShort(); | ||
int count = dataInputStream.readInt(); | ||
extensions.clear(); | ||
for (int i = 0; i < count; i++) { | ||
ULPPExtension ext = new ULPPExtension( | ||
dataInputStream.readUTF(), | ||
dataInputStream.readInt() | ||
); | ||
extensions.add(ext); | ||
} | ||
flags = dataInputStream.readLong(); | ||
} | ||
|
||
@Override | ||
public void writePacket(DataOutputStream dataOutputStream) throws IOException { | ||
// TODO Auto-generated method stub | ||
dataOutputStream.writeUTF(clientName); | ||
dataOutputStream.writeShort(version.length); | ||
for (int i : version) { | ||
dataOutputStream.writeShort(i); | ||
} | ||
dataOutputStream.writeInt(extensions.size()); | ||
for (ULPPExtension ext : extensions) { | ||
dataOutputStream.writeUTF(ext.getName()); | ||
dataOutputStream.writeInt(ext.getVersion()); | ||
} | ||
dataOutputStream.writeLong(flags); | ||
} | ||
|
||
public Packet130RosepadMeta Default() { | ||
this.extensions.clear(); | ||
this.extensions.add(new ULPPExtension("ULPP", 1)); | ||
this.extensions.add(new ULPPExtension("ROSE", 1)); | ||
|
||
this.version = Minecraft.getVersion(); | ||
this.tag = Minecraft.getVersionString(); | ||
|
||
this.clientName = "Rosepad"; | ||
this.flags = 0; | ||
|
||
return this; | ||
} | ||
|
||
@Override | ||
public void processPacket(NetHandler netHandler) { | ||
// TODO Auto-generated method stub | ||
|
||
netHandler.handleRosepadMeta(this); | ||
} | ||
|
||
@Override | ||
public int getPacketSize() { | ||
// TODO Auto-generated method stub | ||
return 0; | ||
int len = 18 + clientName.length() + tag.length() + version.length * 2; | ||
for (ULPPExtension ext : extensions) { | ||
len += 6 + ext.getName().length(); | ||
} | ||
return len; | ||
} | ||
|
||
public RosepadMeta getMeta() { | ||
return new RosepadMeta(clientName, version, tag, flags); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
client/inject/java/net/minecraft/src/Packet35EntityDamage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package net.minecraft.src; | ||
|
||
import java.io.DataInputStream; | ||
import java.io.DataOutputStream; | ||
import java.io.IOException; | ||
|
||
public class Packet35EntityDamage extends Packet { | ||
public int entityId; | ||
public int damage; | ||
public boolean dead; | ||
|
||
public Packet35EntityDamage() { | ||
this.entityId = 0; | ||
this.damage = 0; | ||
this.dead = false; | ||
} | ||
|
||
@Override | ||
public void readPacketData(DataInputStream dataInputStream) throws IOException { | ||
this.entityId = dataInputStream.readInt(); | ||
this.damage = dataInputStream.readInt(); | ||
this.dead = dataInputStream.readBoolean(); | ||
} | ||
|
||
@Override | ||
public void writePacket(DataOutputStream dataOutputStream) throws IOException { | ||
dataOutputStream.writeInt(entityId); | ||
dataOutputStream.writeInt(damage); | ||
dataOutputStream.writeBoolean(dead); | ||
} | ||
|
||
@Override | ||
public void processPacket(NetHandler netHandler) { | ||
|
||
} | ||
|
||
@Override | ||
public int getPacketSize() { | ||
return 9; | ||
} | ||
|
||
public Packet35EntityDamage hit(Entity entity, int damage) { | ||
this.entityId = entity.entityID; | ||
this.damage = damage; | ||
this.dead = entity.isDead; | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package net.minecraft.src; | ||
|
||
public class RosepadMeta { | ||
public static final long USES_USER_SCRIPTS = 1; | ||
|
||
public RosepadMeta(String brandName, int[] version, String versionTag, long flags) { | ||
this.brandName = brandName; | ||
this.version = version; | ||
this.versionTag = versionTag; | ||
this.flags = flags; | ||
} | ||
|
||
private final String brandName; | ||
private final int[] version; | ||
private final String versionTag; | ||
private final long flags; | ||
|
||
public String getBrandName() { | ||
return brandName; | ||
} | ||
|
||
public int[] getVersion() { | ||
return version.clone(); | ||
} | ||
|
||
public String getVersionTag() { | ||
return versionTag; | ||
} | ||
|
||
public long getFlags() { | ||
return flags; | ||
} | ||
|
||
public String getVersionString() { | ||
StringBuilder str = new StringBuilder(); | ||
for (int v : getVersion()) { | ||
if (str.length() > 0) str.append("."); | ||
str.append(v); | ||
} | ||
String tag; | ||
if ((tag = getVersionTag()).length() > 0) { | ||
str.append("-").append(tag); | ||
} | ||
return str.toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- BlockHidable.java | ||
+++ BlockHidable.java | ||
@@ -22,4 +22,5 @@ | ||
if (entityPlayer.inventory.getCurrentItem() == null) { | ||
this.render = !this.render; | ||
+ world.setBlockWithNotify(x, y, z, 0); | ||
world.setBlockWithNotify(x, y, z, this.id); | ||
return true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- BlockJukebox.java | ||
+++ BlockJukebox.java | ||
@@ -28,5 +28,5 @@ | ||
final EntityItem entity = new EntityItem(world, x + (world.rand.nextFloat() * 0.7f + 0.15000000596046448), y + (world.rand.nextFloat() * 0.7f + 0.06000000238418579 + 0.6), z + (world.rand.nextFloat() * 0.7f + 0.15000000596046448), new ItemStack(itemID)); | ||
entity.delayBeforeCanPickup = 10; | ||
- world.spawnEntityInWorld(entity); | ||
+ if (!world.multiplayerWorld) world.spawnEntityInWorld(entity); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,6 @@ | |
+ return true; | ||
} | ||
- return true; | ||
+ return false; | ||
+ return !world.rosepadContentEnabled(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
--- BlockSponge.java | ||
+++ BlockSponge.java | ||
@@ -12,6 +12,8 @@ | ||
@@ -9,9 +9,12 @@ | ||
@Override | ||
public void onBlockAdded(final World world, final int x, final int y, final int z) { | ||
+ if (!world.rosepadContentEnabled()) return; | ||
for (int n = 2, i = x - n; i <= x + n; ++i) { | ||
for (int j = y - n; j <= y + n; ++j) { | ||
for (int k = z - n; k <= z + n; ++k) { | ||
- world.getBlockMaterial(i, j, k); | ||
- final Material water = Material.WATER; | ||
+if (world.getBlockMaterial(i, j, k) == Material.WATER) { | ||
+world.setBlock(i, j, k, 0); | ||
+world.notifyBlocksOfNeighborChange(i, j, k, 0); | ||
+} | ||
+ if (world.getBlockMaterial(i, j, k) == Material.WATER) { | ||
+ world.setBlock(i, j, k, 0); | ||
+ world.notifyBlocksOfNeighborChange(i, j, k, 0); | ||
+ } | ||
} | ||
} |
Oops, something went wrong.