Revert "Fixed crash on dedicated servers (PacketSpellProperties), Fixes #780, #779, #773, #774, #771, #768"

This reverts commit 6690564017.
This commit is contained in:
WinDanesz
2022-04-17 15:46:11 +02:00
parent 67459cbbbd
commit 4d078f9597
@@ -21,13 +21,9 @@ public class PacketSpellProperties implements IMessageHandler<PacketSpellPropert
net.minecraft.client.Minecraft.getMinecraft().addScheduledTask(() -> {
int spellId = message.firstId;
for(int i = 0; i <message.propertiesArray.length; i++){
Spell spell = Spell.byNetworkID(spellId);
SpellProperties props = message.propertiesArray[i];
spell.setPropertiesClient(props);
spellId++;
int first = message.firstId;
for(int i = first; i <message.propertiesArray.length; i++){
Spell.byNetworkID(i).setPropertiesClient(message.propertiesArray[i]);
}
});
}
@@ -47,22 +43,16 @@ public class PacketSpellProperties implements IMessageHandler<PacketSpellPropert
this.firstId = firstId;
this.count = count;
this.propertiesArray = properties;
}
@Override
public void fromBytes(ByteBuf buf){
List<SpellProperties> propertiesList = new ArrayList<>();
firstId = buf.readInt();
int i = buf.readInt();
count = buf.readInt();
int k = 0;
int j = firstId;
while(k < count){
SpellProperties props = new SpellProperties(Spell.byNetworkID(j), buf);
propertiesList.add(props);
k++;
j++;
firstId = i;
while(buf.isReadable() && i < count){
propertiesList.add(new SpellProperties(Spell.byNetworkID(i++), buf));
}
propertiesArray = propertiesList.toArray(new SpellProperties[0]);