Merge pull request #64 from HugoDaBosss/master

Fixed double placing sound and small packet finding optimization. (I suck at github)
This commit is contained in:
Myles 2016-03-03 10:04:33 +00:00
commit 8f132fed14
3 changed files with 13 additions and 2 deletions

View File

@ -170,7 +170,7 @@ public enum PacketType {
if(id == -1)
return null;
for (PacketType pt : values()) {
if (pt.getNewPacketID() == id && id != -1
if (pt.getNewPacketID() == id
&& pt.getState() == state
&& pt.getDirection() == direction)
return pt;
@ -182,7 +182,7 @@ public enum PacketType {
if(id == -1)
return null;
for (PacketType pt : values()) {
if (pt.getPacketID() == id && id != -1
if (pt.getPacketID() == id
&& pt.getState() == state
&& pt.getDirection() == direction)
return pt;

View File

@ -252,11 +252,13 @@ public enum SoundEffect {
private String name;
private String newname;
private SoundCategory cat;
private boolean breaksound;
SoundEffect(String name, String newname, SoundCategory cat) {
this.cat = cat;
this.newname = newname;
this.name = name;
this.breaksound = name.startsWith("dig.");
}
public static SoundEffect getByName(String name) {
@ -279,5 +281,9 @@ public enum SoundEffect {
public SoundCategory getCategory() {
return cat;
}
public boolean isBreakPlaceSound() {
return breaksound;
}
}

View File

@ -59,6 +59,11 @@ public class OutgoingTransformer {
int catid = 0;
String newname = name;
if (effect != null) {
if(effect.isBreakPlaceSound()) {
input.readBytes(input.readableBytes());
output.clear();
return;
}
catid = effect.getCategory().getId();
newname = effect.getNewName();
}