improve cheat gui, fix particle bug
This commit is contained in:
parent
8a9e9451b7
commit
30e6b4eb74
7 changed files with 147 additions and 134 deletions
|
@ -101,7 +101,7 @@ public abstract class ItemRegistry {
|
|||
private static void register(String name, Item item) {
|
||||
if(item.getBlock() != null)
|
||||
throw new IllegalArgumentException("Gegenstand " + name + " darf keinen Block besitzen");
|
||||
if(item.getTab() == null || item.getTab().isBlockTab())
|
||||
if(item.getTab() == null || !item.getTab().isItemTab())
|
||||
throw new IllegalArgumentException("Gegenstand " + name + " muss einen Gegenstand-Tab besitzen");
|
||||
if(ITEM_MAP.containsKey(name))
|
||||
throw new IllegalArgumentException("Gegenstand " + name + " ist bereits mit ID " + ITEM_IDS.get(ITEM_MAP.get(name)) + " registriert");
|
||||
|
|
|
@ -6,6 +6,17 @@ import common.init.ItemRegistry;
|
|||
import common.init.Items;
|
||||
|
||||
public enum CheatTab {
|
||||
ALL("Alles") {
|
||||
protected Item getIconItem() {
|
||||
return Items.navigator;
|
||||
}
|
||||
|
||||
public void filter(List<ItemStack> list) {
|
||||
for(Item item : ItemRegistry.items()) {
|
||||
item.getSubItems(list);
|
||||
}
|
||||
}
|
||||
},
|
||||
BLOCKS("Baumaterial", true) {
|
||||
protected Item getIconItem() {
|
||||
return Items.glass;
|
||||
|
@ -90,16 +101,48 @@ public enum CheatTab {
|
|||
protected Item getIconItem() {
|
||||
return Items.charge_crystal;
|
||||
}
|
||||
},
|
||||
ALL_BLOCKS("Alle Blöcke") {
|
||||
protected Item getIconItem() {
|
||||
return Items.stone;
|
||||
}
|
||||
|
||||
public void filter(List<ItemStack> list) {
|
||||
for(Item item : ItemRegistry.items()) {
|
||||
if(item.getBlock() != null)
|
||||
item.getSubItems(list);
|
||||
}
|
||||
}
|
||||
},
|
||||
ALL_ITEMS("Alle Gegenstände") {
|
||||
protected Item getIconItem() {
|
||||
return Items.flint;
|
||||
}
|
||||
|
||||
public void filter(List<ItemStack> list) {
|
||||
for(Item item : ItemRegistry.items()) {
|
||||
if(item.getBlock() == null)
|
||||
item.getSubItems(list);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private final String name;
|
||||
private final boolean blocks;
|
||||
private final boolean items;
|
||||
|
||||
private ItemStack icon;
|
||||
|
||||
private CheatTab(String name, boolean blocks) {
|
||||
this.name = name;
|
||||
this.blocks = blocks;
|
||||
this.items = !blocks;
|
||||
}
|
||||
|
||||
private CheatTab(String name) {
|
||||
this.name = name;
|
||||
this.blocks = false;
|
||||
this.items = false;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
|
@ -114,6 +157,10 @@ public enum CheatTab {
|
|||
return this.blocks;
|
||||
}
|
||||
|
||||
public boolean isItemTab() {
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public ItemStack getIcon() {
|
||||
if(this.icon == null)
|
||||
this.icon = new ItemStack(this.getIconItem());
|
||||
|
@ -124,9 +171,8 @@ public enum CheatTab {
|
|||
|
||||
public void filter(List<ItemStack> list) {
|
||||
for(Item item : ItemRegistry.items()) {
|
||||
if(item != null && item.getTab() == this) {
|
||||
if(item.getTab() == this)
|
||||
item.getSubItems(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,9 +44,9 @@ public enum ParticleType
|
|||
SLIME("slime", 33, false),
|
||||
HEART("heart", 34, false),
|
||||
// BARRIER("barrier", 35, false),
|
||||
ITEM_CRACK("iconcrack_", 36, false, 2),
|
||||
BLOCK_CRACK("blockcrack_", 37, false, 1),
|
||||
BLOCK_DUST("blockdust_", 38, false, 1),
|
||||
ITEM_CRACK("iconcrack_", 36, false, true),
|
||||
BLOCK_CRACK("blockcrack_", 37, false, true),
|
||||
BLOCK_DUST("blockdust_", 38, false, true),
|
||||
WATER_DROP("droplet", 39, false),
|
||||
ITEM_TAKE("take", 40, false),
|
||||
HAIL_CORN("hail", 41, false);
|
||||
|
@ -54,21 +54,21 @@ public enum ParticleType
|
|||
private final String particleName;
|
||||
private final int particleID;
|
||||
private final boolean shouldIgnoreRange;
|
||||
private final int argumentCount;
|
||||
private final boolean argument;
|
||||
private static final Map<Integer, ParticleType> PARTICLES = Maps.<Integer, ParticleType>newHashMap();
|
||||
private static final String[] PARTICLE_NAMES;
|
||||
|
||||
private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited, int argumentCountIn)
|
||||
private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited, boolean argumentCountIn)
|
||||
{
|
||||
this.particleName = particleNameIn;
|
||||
this.particleID = particleIDIn;
|
||||
this.shouldIgnoreRange = unlimited;
|
||||
this.argumentCount = argumentCountIn;
|
||||
this.argument = argumentCountIn;
|
||||
}
|
||||
|
||||
private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited)
|
||||
{
|
||||
this(particleNameIn, particleIDIn, unlimited, 0);
|
||||
this(particleNameIn, particleIDIn, unlimited, false);
|
||||
}
|
||||
|
||||
public static String[] getParticleNames()
|
||||
|
@ -86,9 +86,9 @@ public enum ParticleType
|
|||
return this.particleID;
|
||||
}
|
||||
|
||||
public int getArgumentCount()
|
||||
public boolean hasArgument()
|
||||
{
|
||||
return this.argumentCount;
|
||||
return this.argument;
|
||||
}
|
||||
|
||||
public boolean getShouldIgnoreRange()
|
||||
|
@ -96,11 +96,6 @@ public enum ParticleType
|
|||
return this.shouldIgnoreRange;
|
||||
}
|
||||
|
||||
public boolean hasArguments()
|
||||
{
|
||||
return this.argumentCount > 0;
|
||||
}
|
||||
|
||||
public static ParticleType getParticleFromId(int particleId)
|
||||
{
|
||||
return PARTICLES.get(particleId);
|
||||
|
|
|
@ -19,17 +19,13 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
private float particleSpeed;
|
||||
private int particleCount;
|
||||
private boolean longDistance;
|
||||
|
||||
/**
|
||||
* These are the block/item ids and possibly metaData ids that are used to color or texture the particle.
|
||||
*/
|
||||
private int[] particleArguments;
|
||||
private int particleArgument;
|
||||
|
||||
public SPacketParticles()
|
||||
{
|
||||
}
|
||||
|
||||
public SPacketParticles(ParticleType particleTypeIn, boolean longDistanceIn, float x, float y, float z, float xOffsetIn, float yOffset, float zOffset, float particleSpeedIn, int particleCountIn, int[] particleArgumentsIn)
|
||||
public SPacketParticles(ParticleType particleTypeIn, boolean longDistanceIn, float x, float y, float z, float xOffsetIn, float yOffset, float zOffset, float particleSpeedIn, int particleCountIn, int particleArgumentIn)
|
||||
{
|
||||
this.particleType = particleTypeIn;
|
||||
this.longDistance = longDistanceIn;
|
||||
|
@ -41,7 +37,7 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
this.zOffset = zOffset;
|
||||
this.particleSpeed = particleSpeedIn;
|
||||
this.particleCount = particleCountIn;
|
||||
this.particleArguments = particleArgumentsIn;
|
||||
this.particleArgument = particleArgumentIn;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,13 +61,8 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
this.zOffset = buf.readFloat();
|
||||
this.particleSpeed = buf.readFloat();
|
||||
this.particleCount = buf.readInt();
|
||||
int i = this.particleType.getArgumentCount();
|
||||
this.particleArguments = new int[i];
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
this.particleArguments[j] = buf.readVarInt();
|
||||
}
|
||||
if(this.particleType.hasArgument())
|
||||
this.particleArgument = buf.readVarInt();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,12 +80,8 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
buf.writeFloat(this.zOffset);
|
||||
buf.writeFloat(this.particleSpeed);
|
||||
buf.writeInt(this.particleCount);
|
||||
int i = this.particleType.getArgumentCount();
|
||||
|
||||
for (int j = 0; j < i; ++j)
|
||||
{
|
||||
buf.writeVarInt(this.particleArguments[j]);
|
||||
}
|
||||
if(this.particleType.hasArgument())
|
||||
buf.writeVarInt(this.particleArgument);
|
||||
}
|
||||
|
||||
public ParticleType getParticleType()
|
||||
|
@ -175,9 +162,9 @@ public class SPacketParticles implements Packet<IClientPlayer>
|
|||
* Gets the particle arguments. Some particles rely on block and/or item ids and sometimes metadata ids to color or
|
||||
* texture the particle.
|
||||
*/
|
||||
public int[] getParticleArgs()
|
||||
public int getParticleArg()
|
||||
{
|
||||
return this.particleArguments;
|
||||
return this.particleArgument;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue