mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 11:03:43 +01:00 
			
		
		
		
	Flesh out NBT types
This commit is contained in:
		@@ -25,4 +25,5 @@ public class NBTByte implements NBTBase {
 | 
				
			|||||||
    public void setValue(Byte value) {
 | 
					    public void setValue(Byte value) {
 | 
				
			||||||
        this.value = value;
 | 
					        this.value = value;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,6 @@ import java.util.List;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class NBTList implements NBTBase {
 | 
					public class NBTList implements NBTBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private int length;
 | 
					 | 
				
			||||||
    private String key;
 | 
					    private String key;
 | 
				
			||||||
    private List<? extends NBTBase> values;
 | 
					    private List<? extends NBTBase> values;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -14,7 +13,7 @@ public class NBTList implements NBTBase {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public int getLength() {
 | 
					    public int getLength() {
 | 
				
			||||||
        return length;
 | 
					        return values.size();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String getKey() {
 | 
					    public String getKey() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,19 @@
 | 
				
			|||||||
package com.gmail.nossr50.core.nbt;
 | 
					package com.gmail.nossr50.core.nbt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Collection;
 | 
				
			||||||
 | 
					import java.util.LinkedHashMap;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					import java.util.Set;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class NBTTagCompound implements NBTBase {
 | 
					public class NBTTagCompound implements NBTBase {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    private String key;
 | 
				
			||||||
    private Map<String, NBTBase> tagMap;
 | 
					    private Map<String, NBTBase> tagMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public NBTTagCompound(String key) {
 | 
				
			||||||
 | 
					        tagMap = new LinkedHashMap<>();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public NBTType getNBTType() {
 | 
					    public NBTType getNBTType() {
 | 
				
			||||||
        return NBTType.COMPOUND;
 | 
					        return NBTType.COMPOUND;
 | 
				
			||||||
@@ -15,4 +23,32 @@ public class NBTTagCompound implements NBTBase {
 | 
				
			|||||||
        return tagMap.get(key);
 | 
					        return tagMap.get(key);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getKey() {
 | 
				
			||||||
 | 
					        return key;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setKey(String key) {
 | 
				
			||||||
 | 
					        this.key = key;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void addNBT(String tagKey, NBTBase nbt) {
 | 
				
			||||||
 | 
					        tagMap.put(tagKey, nbt);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Collection<NBTBase> getMapValues() {
 | 
				
			||||||
 | 
					        return tagMap.values();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Set<String> getMapKeys() {
 | 
				
			||||||
 | 
					        return tagMap.keySet();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public int getMapSize() {
 | 
				
			||||||
 | 
					        return tagMap.size();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void removeEntry(String tagKey) {
 | 
				
			||||||
 | 
					        tagMap.remove(tagKey);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user