From 30e6b4eb740c67b088c2ac4d0693feb5265a578c Mon Sep 17 00:00:00 2001 From: Sen Date: Tue, 1 Jul 2025 00:20:02 +0200 Subject: [PATCH 1/2] improve cheat gui, fix particle bug --- .../client/gui/container/GuiContainer.java | 165 ++++++++---------- .../java/client/network/ClientPlayer.java | 4 +- .../main/java/common/init/ItemRegistry.java | 2 +- .../src/main/java/common/item/CheatTab.java | 50 +++++- .../main/java/common/model/ParticleType.java | 23 +-- .../java/common/packet/SPacketParticles.java | 31 +--- .../main/java/server/world/WorldServer.java | 6 +- 7 files changed, 147 insertions(+), 134 deletions(-) diff --git a/client/src/main/java/client/gui/container/GuiContainer.java b/client/src/main/java/client/gui/container/GuiContainer.java index 69e0dde3..ab37269c 100755 --- a/client/src/main/java/client/gui/container/GuiContainer.java +++ b/client/src/main/java/client/gui/container/GuiContainer.java @@ -1,5 +1,6 @@ package client.gui.container; +import java.util.Iterator; import java.util.List; import java.util.Set; @@ -8,7 +9,11 @@ import org.lwjgl.opengl.GL13; import client.gui.Font; import client.gui.Gui; +import client.gui.element.Element; +import client.gui.element.Field; import client.gui.element.InventoryButton; +import client.gui.element.Label; +import client.gui.element.MultiLabel; import client.renderer.Drawing; import client.renderer.GlState; import client.renderer.ItemRenderer; @@ -43,7 +48,7 @@ public abstract class GuiContainer extends Gui private static final List ITEM_LIST = Lists.newArrayList(); - private static CheatTab selectedTab = CheatTab.BLOCKS; + private static CheatTab selectedTab = CheatTab.ALL; protected RenderItem itemRender; protected int xSize = 176; @@ -76,8 +81,14 @@ public abstract class GuiContainer extends Gui private boolean isScrolling; private boolean wasClicking; private ItemStack cheatStack; + private int cheatX; + private int cheatY; private int cheatWidth; private int cheatHeight; + private Label cheatLabel; + private MultiLabel cheatDesc; + private Field cheatSearch; + private String cheatLast; public void drawString(String text, int x, int y) { x = x * 2 + this.container_x; @@ -100,37 +111,21 @@ public abstract class GuiContainer extends Gui public InventoryButton button(int x, int y, int w, int h) { return this.add(new InventoryButton(this.container_x + x * 2, this.container_y + y * 2, w * 2, h * 2)); } - -// public void uidims(int w, int h) { -// } public void mouse(Button btn, int x, int y, boolean ctrl, boolean shift) { super.mouse(btn, x, y, ctrl, shift); -// public void click(Button btn, int x, int y) { -// if(this.openGui != null) { -// int x = SKC.getMouseX() * this.openGui.width / this.gm.fb_x; -// int y = this.openGui.height - SKC.getMouseY() * this.openGui.height / this.gm.fb_y - 1; this.mouseClicked((x - this.container_x) / 2, (y - this.container_y) / 2, btn.ordinal()); //TODO: enum -// } } public void mouserel(Button btn, int x, int y) { super.mouserel(btn, x, y); -// if(this.openGui != null) { -// int x = SKC.getMouseX() * this.openGui.width / this.gm.fb_x; -// int y = this.openGui.height - SKC.getMouseY() * this.openGui.height / this.gm.fb_y - 1; this.mouseReleased((x - this.container_x) / 2, (y - this.container_y) / 2, btn.ordinal()); //TODO: enum -// } } public void drag(int x, int y) { super.drag(x, y); -// if(this.openGui != null) { -// int x = SKC.getMouseX() * this.openGui.width / this.gm.fb_x; -// int y = this.openGui.height - SKC.getMouseY() * this.openGui.height / this.gm.fb_y - 1; if(Button.MOUSE_LEFT.isDown() || Button.MOUSE_RIGHT.isDown() || Button.MOUSE_MIDDLE.isDown()) this.mouseDragged((x - this.container_x) / 2, (y - this.container_y) / 2); -// } } public GuiContainer(Container inventorySlotsIn) @@ -143,10 +138,6 @@ public abstract class GuiContainer extends Gui this.itemRender = this.gm.getRenderItem(); this.tooltip = null; this.cheatStack = null; -// this.width = width; -// this.height = height; -// this.initialize(this.gm.getGame()); -// this.container_x = this.container_y = this.container_w = this.container_h = 0; this.container_x = (width - (this.container_w = (this.xSize * 2))) / 2; this.container_y = (height - (this.container_h = (this.ySize * 2))) / 2; this.initGui(); @@ -163,38 +154,18 @@ public abstract class GuiContainer extends Gui return "Inventar"; } -// public int getXSize() { -// return this.xSize; -// } -// -// public int getYSize() { -// return this.ySize; -// } - -// public final void initialize(Game gm) { -// } - - /** - * Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the - * window resizes, the buttonList is cleared beforehand. - */ public void initGui() { this.gm.player.openContainer = this.inventorySlots; -// this.guiLeft = (this.width - this.xSize) / 2; -// this.guiTop = (this.height - this.ySize) / 2; -// this.addButtons(); if(this.gm.itemCheat) { - this.cheatWidth = Math.max((this.gm.fb_x - this.container_x - this.container_w - 32) / 2 / 18, 1); - this.cheatHeight = Math.max((this.gm.fb_y - this.container_y - 20 * 2 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 64) / 2 / 18, 1); -// CheatTab i = selectedTab; -// selectedTab = null; - this.setCurrentTab(selectedTab); + this.cheatX = this.container_x + this.container_w + 4; + this.cheatY = 20; + this.cheatWidth = Math.max((this.gm.fb_x - this.container_x - this.container_w - 32) / 18, 1); + this.cheatHeight = Math.max((this.gm.fb_y - 20 * 2 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) - 64) / 18, 1); } } public void addButtons() { -// this.uidims(this.xSize, this.ySize); if(this.inventorySlots != null) { for (int i1 = 0; i1 < this.inventorySlots.inventorySlots.size(); ++i1) { Slot slot = (Slot)this.inventorySlots.inventorySlots.get(i1); @@ -202,15 +173,14 @@ public abstract class GuiContainer extends Gui } } if(this.gm.itemCheat) { - for (int k = 0; k < this.cheatHeight; ++k) - { - for (int l = 0; l < this.cheatWidth; ++l) { - this.button(this.xSize + 2 + 18 * l, k * 18, 18, 18); - } - } + this.cheatLabel = this.add(new Label(this.cheatX, this.cheatY, this.cheatWidth * 18, "", true)); + this.cheatDesc = this.add(new MultiLabel(this.cheatX, this.cheatY + this.cheatHeight * 18, this.cheatWidth * 18, 60, "Vorsicht: Schummeln wird mit Keule bestraft\n(Halte Strg beim Klick für vollen Stapel)")); + this.cheatSearch = this.add(new Field(this.cheatX, this.gm.fb_y - Element.BASE_HEIGHT - 32, this.cheatWidth * 18, 0, 128, null, "")); + this.cheatLast = ""; for(CheatTab tab : CheatTab.values()) { - this.button(this.xSize + 2 + 18 * (tab.getIndex() % this.cheatWidth), this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18); + this.add(new InventoryButton(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18)); } + this.setCurrentTab(selectedTab); } } @@ -227,6 +197,9 @@ public abstract class GuiContainer extends Gui } if(this.gm.itemCheat) { + GL11.glPushMatrix(); + GL11.glTranslatef(-(float)((this.gm.fb_x - this.xSize * 2) / 2) * 0.5f, -(float)((this.gm.fb_y - this.ySize * 2) / 2) * 0.5f, 0.0f); + GL11.glScalef(0.5f, 0.5f, 0.5f); int i = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; int j = (int)((double)(this.currentScroll * (float)i) + 0.5D); @@ -245,9 +218,9 @@ public abstract class GuiContainer extends Gui this.itemRender.zLevel = 100.0F; GlState.enableDepth(); - this.itemRender.renderItemAndEffectIntoGUI(ITEM_LIST.get(i1), this.xSize + 2 + 18 * l + 1, k * 18 + 1); + this.itemRender.renderItemAndEffectIntoGUI(ITEM_LIST.get(i1), this.cheatX + 18 * l + 1, this.cheatY + k * 18 + 1); this.itemRender.zLevel = 0.0F; - if(this.isPointInRegion(this.xSize + 2 + 18 * l + 1, k * 18 + 1, 16, 16, mouseX, mouseY)) + if(this.isPointInRegion(this.cheatX + 18 * l + 1, this.cheatY + k * 18 + 1, 16, 16, this.gm.mouse_x, this.gm.mouse_y)) this.renderToolTip(ITEM_LIST.get(i1), mouseX, mouseY); } } @@ -257,6 +230,7 @@ public abstract class GuiContainer extends Gui { this.drawTab(tabs); } + GL11.glPopMatrix(); } } @@ -281,12 +255,12 @@ public abstract class GuiContainer extends Gui return; if(this.gm.itemCheat) { boolean flag = Button.MOUSE_LEFT.isDown(); //TODO: remove? - int x1 = this.xSize + 2 + this.cheatWidth * 18 + 1; - int y1 = 1; + int x1 = this.cheatX + this.cheatWidth * 18 + 1; + int y1 = this.cheatY + 1; int x2 = x1 + 10; int y2 = y1 + 112 + 18 * 4; - if (!this.wasClicking && flag && mouseX >= x1 && mouseY >= y1 && mouseX < x2 && mouseY < y2) + if (!this.wasClicking && flag && this.gm.mouse_x >= x1 && this.gm.mouse_y >= y1 && this.gm.mouse_x < x2 && this.gm.mouse_y < y2) { this.isScrolling = this.needsScrollBars(); } @@ -300,7 +274,7 @@ public abstract class GuiContainer extends Gui if (this.isScrolling) { - this.currentScroll = ((float)(mouseY - y1) - 7.5F) / ((float)(y2 - y1) - 15.0F); + this.currentScroll = ((float)(this.gm.mouse_y - y1) - 7.5F) / ((float)(y2 - y1) - 15.0F); this.currentScroll = ExtMath.clampf(this.currentScroll, 0.0F, 1.0F); } } @@ -423,21 +397,15 @@ public abstract class GuiContainer extends Gui super.draw(); if(this.gm.itemCheat) { if(this.needsScrollBars()) { - int i = this.xSize + 2 + this.cheatWidth * 18 + 1; - int j = 1; - int k = j + 184; - this.rect(i, j, 8, 182, 0x000000); - this.grad(i, j + (int)((float)(k - j - 17) * this.currentScroll), 8, 15, this.gm.style.fill_top, this.gm.style.fill_btm, this.gm.style.brdr_top, this.gm.style.brdr_btm); + int x1 = this.cheatX + this.cheatWidth * 18 + 1; + int y1 = this.cheatY + 1; + int y2 = y1 + 184; + Drawing.drawRect(x1, y1, 8, 182, 0xff000000); + Drawing.drawGradient(x1, y1 + (int)((float)(y2 - y1 - 17) * this.currentScroll), 8, 15, this.gm.style.fill_top, this.gm.style.fill_btm, this.gm.style.brdr_top, this.gm.style.brdr_btm); } - this.rect(this.xSize + 2 + 18 * (selectedTab.getIndex() % this.cheatWidth), this.cheatHeight * 18 + 4 + 20 * (selectedTab.getIndex() / this.cheatWidth) - 2, 18, 2, 0xffffff); + Drawing.drawRect(this.cheatX + 18 * (selectedTab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (selectedTab.getIndex() / this.cheatWidth) - 2, 18, 2, 0xffffffff); } this.drawGuiContainerBackgroundLayer(); - if(this.gm.itemCheat) { -// CheatTab tab = CheatTab.TABS[selectedTab]; - this.drawString(selectedTab.getName(), this.xSize + 2 + 4, -10); - this.drawString("Vorsicht: Schummeln wird mit Keule bestraft", this.xSize + 2 + 4, 18 * this.cheatHeight + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 10); - this.drawString("(Halte Strg beim Klick für vollen Stapel)", this.xSize + 2 + 4, 18 * this.cheatHeight + 20 * ((CheatTab.values().length + (this.cheatWidth - 1)) / this.cheatWidth) + 20); - } this.drawGuiContainerForegroundLayer(); } @@ -588,13 +556,13 @@ public abstract class GuiContainer extends Gui this.cheatStack = null; return; } - if((mouseButton == 0 || mouseButton == 1 || mouseButton == 2) && this.clickSide(mouseX, mouseY, -1, this.gm.shift() || mouseButton == 1, this.gm.ctrl() || mouseButton == 2)) + if((mouseButton == 0 || mouseButton == 1 || mouseButton == 2) && this.clickSide(this.gm.mouse_x, this.gm.mouse_y, -1, this.gm.shift() || mouseButton == 1, this.gm.ctrl() || mouseButton == 2)) return; if(mouseButton == 0) { if(this.gm.itemCheat && this.gm.player != null && this.gm.player.inventory.getItemStack() == null) { for (CheatTab tab : CheatTab.values()) { - if (this.isInsideTab(tab, mouseX, mouseY)) + if (this.isInsideTab(tab, this.gm.mouse_x, this.gm.mouse_y)) { this.setCurrentTab(tab); return; @@ -973,7 +941,7 @@ public abstract class GuiContainer extends Gui */ public void useHotbar(int slot) { - if (!this.clickSide((this.gm.mouse_x - this.container_x) / 2, (this.gm.mouse_y - this.container_y) / 2, slot, this.gm.shift(), this.gm.ctrl()) && this.gm != null && this.gm.player != null && this.gm.player.inventory.getItemStack() == null && this.cheatStack == null && this.theSlot != null) + if (!this.clickSide(this.gm.mouse_x, this.gm.mouse_y, slot, this.gm.shift(), this.gm.ctrl()) && this.gm != null && this.gm.player != null && this.gm.player.inventory.getItemStack() == null && this.cheatStack == null && this.theSlot != null) { // for (int i = 0; i < 9; ++i) // { @@ -1018,6 +986,10 @@ public abstract class GuiContainer extends Gui { this.gm.displayGuiScreen(null); } + else if(this.gm.itemCheat && !this.cheatSearch.getText().equals(this.cheatLast)) { + this.cheatLast = this.cheatSearch.getText(); + this.setCurrentTab(selectedTab); + } } public void renderItemOverlayIntoGUI(ItemStack stack, int xPosition, int yPosition, String text) @@ -1070,13 +1042,13 @@ public abstract class GuiContainer extends Gui protected boolean isInsideTab(CheatTab tab, int x, int y) { - return x >= this.xSize + 2 + 18 * (tab.getIndex() % this.cheatWidth) && x < this.xSize + 2 + 18 * (tab.getIndex() % this.cheatWidth) + 18 && - y >= this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) && y < this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) + 18; + return x >= this.cheatX + 18 * (tab.getIndex() % this.cheatWidth) && x < this.cheatX + 18 * (tab.getIndex() % this.cheatWidth) + 18 && + y >= this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) && y < this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) + 18; } - protected boolean renderInventoryHoveringText(CheatTab tab, int x, int z) + private boolean renderInventoryHoveringText(CheatTab tab, int x, int z) { - if (this.isPointInRegion(this.xSize + 2 + 18 * (tab.getIndex() % this.cheatWidth), this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, x, z)) + if (this.isPointInRegion(this.cheatX + 18 * (tab.getIndex() % this.cheatWidth), this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth), 18, 18, this.gm.mouse_x, this.gm.mouse_y)) { this.hover(tab.getName(), x, z); return true; @@ -1092,7 +1064,7 @@ public abstract class GuiContainer extends Gui this.itemRender.zLevel = 100.0F; ItemStack itemstack = tab.getIcon(); GlState.enableDepth(); - this.itemRender.renderItemAndEffectIntoGUI(itemstack, this.xSize + 2 + 18 * (tab.getIndex() % this.cheatWidth) + 1, this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) + 1); + this.itemRender.renderItemAndEffectIntoGUI(itemstack, this.cheatX + 18 * (tab.getIndex() % this.cheatWidth) + 1, this.cheatY + this.cheatHeight * 18 + 4 + 20 * (tab.getIndex() / this.cheatWidth) + 1); this.itemRender.zLevel = 0.0F; } @@ -1116,30 +1088,43 @@ public abstract class GuiContainer extends Gui this.dragSplittingSlots.clear(); ITEM_LIST.clear(); tab.filter(ITEM_LIST); - + if(!this.cheatLast.isBlank() && this.gm.player != null) { + for(Iterator iter = ITEM_LIST.iterator(); iter.hasNext();) { + ItemStack stack = iter.next(); + for(String line : stack.getTooltip(this.gm.player)) { + if(line.toLowerCase().contains(this.cheatLast.toLowerCase())) { + stack = null; + break; + } + } + if(stack != null) + iter.remove(); + } + } this.currentScroll = 0.0F; + this.cheatLabel.setText(tab.getName()); } private boolean clickSide(int mouseX, int mouseY, int slot, boolean instant, boolean full) { - if(this.gm.itemCheat && this.isPointInRegion(this.xSize + 2, 0, 18 * this.cheatWidth, 18 * this.cheatHeight, mouseX, mouseY) && this.gm.player != null && this.gm.player.inventory.getItemStack() == null && this.cheatStack == null) { - int i = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; - int j = (int)((double)(this.currentScroll * (float)i) + 0.5D); + if(this.gm.itemCheat && this.isPointInRegion(this.cheatX, this.cheatY, 18 * this.cheatWidth, 18 * this.cheatHeight, mouseX, mouseY) && this.gm.player != null && this.gm.player.inventory.getItemStack() == null && this.cheatStack == null) { + int size = (ITEM_LIST.size() + this.cheatWidth - 1) / this.cheatWidth - this.cheatHeight; + int off = (int)((double)(this.currentScroll * (float)size) + 0.5D); - if (j < 0) + if (off < 0) { - j = 0; + off = 0; } - int sx = (mouseX - (this.xSize + 2)) / 18; - int sy = mouseY / 18; - int i1 = sx + (sy + j) * this.cheatWidth; + int sx = (mouseX - this.cheatX) / 18; + int sy = (mouseY - this.cheatY) / 18; + int idx = sx + (sy + off) * this.cheatWidth; - if(i1 >= 0 && i1 < ITEM_LIST.size()) { + if(idx >= 0 && idx < ITEM_LIST.size()) { if(slot >= 0 || instant) { - this.gm.player.client.addToSendQueue(new CPacketCheat(ITEM_LIST.get(i1), slot, full)); + this.gm.player.client.addToSendQueue(new CPacketCheat(ITEM_LIST.get(idx), slot, full)); } else { - this.cheatStack = ITEM_LIST.get(i1).copy(); + this.cheatStack = ITEM_LIST.get(idx).copy(); this.cheatStack.size = full ? this.cheatStack.getMaxStackSize() : 1; } return true; diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index 78162908..d2462176 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -1838,7 +1838,7 @@ public class ClientPlayer implements IClientPlayer try { ParticleType particle = packetIn.getParticleType(); - this.world.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, packetIn.getParticleArgs()); + this.world.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, new int[] {packetIn.getParticleArg()}); } catch (Throwable var17) { @@ -1859,7 +1859,7 @@ public class ClientPlayer implements IClientPlayer try { ParticleType particle = packetIn.getParticleType(); - this.world.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, packetIn.getParticleArgs()); + this.world.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, new int[] {packetIn.getParticleArg()}); } catch (Throwable var16) { diff --git a/common/src/main/java/common/init/ItemRegistry.java b/common/src/main/java/common/init/ItemRegistry.java index 4165b5a0..93b06813 100755 --- a/common/src/main/java/common/init/ItemRegistry.java +++ b/common/src/main/java/common/init/ItemRegistry.java @@ -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"); diff --git a/common/src/main/java/common/item/CheatTab.java b/common/src/main/java/common/item/CheatTab.java index 200bff39..bb7a5638 100755 --- a/common/src/main/java/common/item/CheatTab.java +++ b/common/src/main/java/common/item/CheatTab.java @@ -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 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 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 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 list) { for(Item item : ItemRegistry.items()) { - if(item != null && item.getTab() == this) { + if(item.getTab() == this) item.getSubItems(list); - } } } } diff --git a/common/src/main/java/common/model/ParticleType.java b/common/src/main/java/common/model/ParticleType.java index cace4918..64b28fb3 100755 --- a/common/src/main/java/common/model/ParticleType.java +++ b/common/src/main/java/common/model/ParticleType.java @@ -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 PARTICLES = Maps.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); diff --git a/common/src/main/java/common/packet/SPacketParticles.java b/common/src/main/java/common/packet/SPacketParticles.java index f2fd4bac..6d44d612 100755 --- a/common/src/main/java/common/packet/SPacketParticles.java +++ b/common/src/main/java/common/packet/SPacketParticles.java @@ -19,17 +19,13 @@ public class SPacketParticles implements Packet 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 this.zOffset = zOffset; this.particleSpeed = particleSpeedIn; this.particleCount = particleCountIn; - this.particleArguments = particleArgumentsIn; + this.particleArgument = particleArgumentIn; } /** @@ -65,13 +61,8 @@ public class SPacketParticles implements Packet 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 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 * 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; } /** diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index 3686a00b..6578c2d1 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -1296,7 +1296,7 @@ public final class WorldServer extends AWorldServer { public void spawnParticle(ParticleType particleType, boolean longDistance, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int[] particleArguments) { Packet packet = new SPacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset, - (float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, particleArguments); + (float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, particleArguments.length == 0 ? 0 : particleArguments[0]); for(int i = 0; i < this.players.size(); ++i) { EntityNPC entityplayermp = this.players.get(i); @@ -1697,11 +1697,11 @@ public final class WorldServer extends AWorldServer { player.attackEntityFrom(DamageSource.causeExterminatusDamage(null), 5000); Packet packet = new SPacketParticles(ParticleType.EXPLOSION_HUGE, true, (float)player.posX, (float)this.getSeaLevel() + 4.0f, (float)player.posZ, (float)128.0, - (float)2.0, (float)128.0, (float)0.15, 1000, new int[0]); + (float)2.0, (float)128.0, (float)0.15, 1000, 0); player.connection.sendPacket(packet); packet = new SPacketParticles(ParticleType.CLOUD, true, (float)player.posX, (float)this.getSeaLevel() + 4.0f, (float)player.posZ, (float)128.0, - (float)2.0, (float)128.0, (float)0.15, 1000, new int[0]); + (float)2.0, (float)128.0, (float)0.15, 1000, 0); player.connection.sendPacket(packet); packet = new SPacketEffect(1025, new BlockPos(player.posX, (double)this.getSeaLevel() + 4.0, player.posZ), 0); player.connection.sendPacket(packet); From 0171d8172407a1dde3830c1231ec1c1a16648b66 Mon Sep 17 00:00:00 2001 From: Sen Date: Tue, 1 Jul 2025 00:58:54 +0200 Subject: [PATCH 2/2] fix particles --- .../java/client/network/ClientPlayer.java | 4 +- .../renderer/particle/EffectRenderer.java | 92 +++++----- .../renderer/particle/EntityAuraFX.java | 6 +- .../renderer/particle/EntityBlockDustFX.java | 4 +- .../renderer/particle/EntityBreakingFX.java | 9 +- .../renderer/particle/EntityBubbleFX.java | 2 +- .../renderer/particle/EntityCloudFX.java | 2 +- .../renderer/particle/EntityCrit2FX.java | 4 +- .../renderer/particle/EntityCritFX.java | 2 +- .../renderer/particle/EntityDiggingFX.java | 4 +- .../renderer/particle/EntityDownfallFX.java | 4 +- .../particle/EntityDropParticleFX.java | 4 +- .../EntityEnchantmentTableParticleFX.java | 2 +- .../renderer/particle/EntityExplodeFX.java | 2 +- .../renderer/particle/EntityFirework.java | 2 +- .../renderer/particle/EntityFishWakeFX.java | 2 +- .../renderer/particle/EntityFlameFX.java | 2 +- .../renderer/particle/EntityFootStepFX.java | 2 +- .../renderer/particle/EntityHeartFX.java | 2 +- .../particle/EntityHugeExplodeFX.java | 2 +- .../particle/EntityLargeExplodeFX.java | 2 +- .../renderer/particle/EntityLavaFX.java | 2 +- .../renderer/particle/EntityNoteFX.java | 2 +- .../particle/EntityParticleEmitter.java | 2 +- .../renderer/particle/EntityPortalFX.java | 2 +- .../renderer/particle/EntityReddustFX.java | 2 +- .../renderer/particle/EntitySmokeFX.java | 2 +- .../renderer/particle/EntitySnowShovelFX.java | 2 +- .../particle/EntitySpellParticleFX.java | 10 +- .../renderer/particle/EntitySplashFX.java | 2 +- .../renderer/particle/EntitySuspendFX.java | 2 +- .../renderer/particle/IParticleFactory.java | 2 +- .../main/java/client/world/WorldClient.java | 17 +- .../java/common/entity/npc/EntityNPC.java | 4 +- .../common/entity/projectile/EntityHook.java | 12 +- .../main/java/common/model/ParticleType.java | 167 ++++++------------ .../java/common/packet/SPacketParticles.java | 16 +- .../main/java/common/world/AWorldServer.java | 2 +- .../src/main/java/common/world/Explosion.java | 2 +- common/src/main/java/common/world/World.java | 7 +- .../main/java/server/world/WorldServer.java | 8 +- 41 files changed, 181 insertions(+), 239 deletions(-) diff --git a/client/src/main/java/client/network/ClientPlayer.java b/client/src/main/java/client/network/ClientPlayer.java index d2462176..863396d4 100755 --- a/client/src/main/java/client/network/ClientPlayer.java +++ b/client/src/main/java/client/network/ClientPlayer.java @@ -1838,7 +1838,7 @@ public class ClientPlayer implements IClientPlayer try { ParticleType particle = packetIn.getParticleType(); - this.world.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, new int[] {packetIn.getParticleArg()}); + this.world.spawnEntityFX(particle, particle.isUnlimited() | packetIn.isLongDistance(), packetIn.getXCoordinate(), packetIn.getYCoordinate(), packetIn.getZCoordinate(), d0, d2, d4, packetIn.getParticleArg()); } catch (Throwable var17) { @@ -1859,7 +1859,7 @@ public class ClientPlayer implements IClientPlayer try { ParticleType particle = packetIn.getParticleType(); - this.world.spawnEntityFX(particle, particle.getShouldIgnoreRange() | packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, new int[] {packetIn.getParticleArg()}); + this.world.spawnEntityFX(particle, particle.isUnlimited() | packetIn.isLongDistance(), packetIn.getXCoordinate() + d1, packetIn.getYCoordinate() + d3, packetIn.getZCoordinate() + d5, d6, d7, d8, packetIn.getParticleArg()); } catch (Throwable var16) { diff --git a/client/src/main/java/client/renderer/particle/EffectRenderer.java b/client/src/main/java/client/renderer/particle/EffectRenderer.java index 1ab1691e..e7c5a9da 100755 --- a/client/src/main/java/client/renderer/particle/EffectRenderer.java +++ b/client/src/main/java/client/renderer/particle/EffectRenderer.java @@ -37,7 +37,7 @@ public class EffectRenderer /** RNG. */ private Random rand = new Random(); - private Map particleTypes = Maps.newHashMap(); + private Map particleTypes = Maps.newEnumMap(ParticleType.class); public EffectRenderer(World worldIn, TextureManager rendererIn) { @@ -59,52 +59,50 @@ public class EffectRenderer private void registerVanillaParticles() { - this.registerParticle(ParticleType.EXPLOSION_NORMAL.getParticleID(), new EntityExplodeFX.Factory()); - this.registerParticle(ParticleType.WATER_BUBBLE.getParticleID(), new EntityBubbleFX.Factory()); - this.registerParticle(ParticleType.WATER_SPLASH.getParticleID(), new EntitySplashFX.Factory()); - this.registerParticle(ParticleType.WATER_WAKE.getParticleID(), new EntityFishWakeFX.Factory()); - this.registerParticle(ParticleType.WATER_DROP.getParticleID(), new EntityDownfallFX.RainFactory()); - this.registerParticle(ParticleType.SUSPENDED.getParticleID(), new EntitySuspendFX.Factory()); - this.registerParticle(ParticleType.SUSPENDED_DEPTH.getParticleID(), new EntityAuraFX.SuspendFactory()); - this.registerParticle(ParticleType.CRIT.getParticleID(), new EntityCrit2FX.Factory()); - this.registerParticle(ParticleType.CRIT_MAGIC.getParticleID(), new EntityCrit2FX.MagicFactory()); - this.registerParticle(ParticleType.SMOKE_NORMAL.getParticleID(), new EntitySmokeFX.Factory()); - this.registerParticle(ParticleType.SMOKE_LARGE.getParticleID(), new EntityCritFX.Factory()); - this.registerParticle(ParticleType.SPELL.getParticleID(), new EntitySpellParticleFX.Factory()); - this.registerParticle(ParticleType.SPELL_INSTANT.getParticleID(), new EntitySpellParticleFX.InstantFactory()); - this.registerParticle(ParticleType.SPELL_MOB.getParticleID(), new EntitySpellParticleFX.MobFactory()); - this.registerParticle(ParticleType.SPELL_MOB_AMBIENT.getParticleID(), new EntitySpellParticleFX.AmbientMobFactory()); - this.registerParticle(ParticleType.SPELL_WITCH.getParticleID(), new EntitySpellParticleFX.WitchFactory()); - this.registerParticle(ParticleType.DRIP_WATER.getParticleID(), new EntityDropParticleFX.WaterFactory()); - this.registerParticle(ParticleType.DRIP_LAVA.getParticleID(), new EntityDropParticleFX.LavaFactory()); -// this.registerParticle(EnumParticleTypes.VILLAGER_ANGRY.getParticleID(), new EntityHeartFX.AngryVillagerFactory()); - this.registerParticle(ParticleType.GROW.getParticleID(), new EntityAuraFX.GrowFactory()); - this.registerParticle(ParticleType.TOWN_AURA.getParticleID(), new EntityAuraFX.Factory()); - this.registerParticle(ParticleType.NOTE.getParticleID(), new EntityNoteFX.Factory()); - this.registerParticle(ParticleType.PORTAL.getParticleID(), new EntityPortalFX.Factory()); - this.registerParticle(ParticleType.ENCHANTMENT_TABLE.getParticleID(), new EntityEnchantmentTableParticleFX.EnchantmentTable()); - this.registerParticle(ParticleType.FLAME.getParticleID(), new EntityFlameFX.Factory()); - this.registerParticle(ParticleType.LAVA.getParticleID(), new EntityLavaFX.Factory()); - this.registerParticle(ParticleType.FOOTSTEP.getParticleID(), new EntityFootStepFX.Factory()); - this.registerParticle(ParticleType.CLOUD.getParticleID(), new EntityCloudFX.Factory()); - this.registerParticle(ParticleType.REDSTONE.getParticleID(), new EntityReddustFX.Factory()); - this.registerParticle(ParticleType.SNOWBALL.getParticleID(), new EntityBreakingFX.SnowballFactory()); - this.registerParticle(ParticleType.SNOW_SHOVEL.getParticleID(), new EntitySnowShovelFX.Factory()); - this.registerParticle(ParticleType.SLIME.getParticleID(), new EntityBreakingFX.SlimeFactory()); - this.registerParticle(ParticleType.HEART.getParticleID(), new EntityHeartFX.Factory()); -// this.registerParticle(EnumParticleTypes.BARRIER.getParticleID(), new Barrier.Factory()); - this.registerParticle(ParticleType.ITEM_CRACK.getParticleID(), new EntityBreakingFX.Factory()); - this.registerParticle(ParticleType.BLOCK_CRACK.getParticleID(), new EntityDiggingFX.Factory()); - this.registerParticle(ParticleType.BLOCK_DUST.getParticleID(), new EntityBlockDustFX.Factory()); - this.registerParticle(ParticleType.EXPLOSION_HUGE.getParticleID(), new EntityHugeExplodeFX.Factory()); - this.registerParticle(ParticleType.EXPLOSION_LARGE.getParticleID(), new EntityLargeExplodeFX.Factory()); - this.registerParticle(ParticleType.FIREWORKS_SPARK.getParticleID(), new EntityFirework.Factory()); - this.registerParticle(ParticleType.HAIL_CORN.getParticleID(), new EntityDownfallFX.HailFactory()); + this.register(ParticleType.EXPLOSION_NORMAL, new EntityExplodeFX.Factory()); + this.register(ParticleType.WATER_BUBBLE, new EntityBubbleFX.Factory()); + this.register(ParticleType.WATER_SPLASH, new EntitySplashFX.Factory()); + this.register(ParticleType.WATER_WAKE, new EntityFishWakeFX.Factory()); + this.register(ParticleType.WATER_DROP, new EntityDownfallFX.RainFactory()); + this.register(ParticleType.SUSPENDED, new EntitySuspendFX.Factory()); + this.register(ParticleType.SUSPENDED_DEPTH, new EntityAuraFX.SuspendFactory()); + this.register(ParticleType.CRIT, new EntityCrit2FX.Factory()); + this.register(ParticleType.CRIT_MAGIC, new EntityCrit2FX.MagicFactory()); + this.register(ParticleType.SMOKE_NORMAL, new EntitySmokeFX.Factory()); + this.register(ParticleType.SMOKE_LARGE, new EntityCritFX.Factory()); + this.register(ParticleType.SPELL, new EntitySpellParticleFX.Factory()); + this.register(ParticleType.SPELL_INSTANT, new EntitySpellParticleFX.InstantFactory()); + this.register(ParticleType.SPELL_MOB, new EntitySpellParticleFX.MobFactory()); + this.register(ParticleType.SPELL_MOB_AMBIENT, new EntitySpellParticleFX.AmbientMobFactory()); + this.register(ParticleType.SPELL_WITCH, new EntitySpellParticleFX.WitchFactory()); + this.register(ParticleType.DRIP_WATER, new EntityDropParticleFX.WaterFactory()); + this.register(ParticleType.DRIP_LAVA, new EntityDropParticleFX.LavaFactory()); + this.register(ParticleType.GROW, new EntityAuraFX.GrowFactory()); + this.register(ParticleType.TOWN_AURA, new EntityAuraFX.Factory()); + this.register(ParticleType.NOTE, new EntityNoteFX.Factory()); + this.register(ParticleType.PORTAL, new EntityPortalFX.Factory()); + this.register(ParticleType.ENCHANTMENT_TABLE, new EntityEnchantmentTableParticleFX.EnchantmentTable()); + this.register(ParticleType.FLAME, new EntityFlameFX.Factory()); + this.register(ParticleType.LAVA, new EntityLavaFX.Factory()); + this.register(ParticleType.FOOTSTEP, new EntityFootStepFX.Factory()); + this.register(ParticleType.CLOUD, new EntityCloudFX.Factory()); + this.register(ParticleType.REDSTONE, new EntityReddustFX.Factory()); + this.register(ParticleType.SNOWBALL, new EntityBreakingFX.SnowballFactory()); + this.register(ParticleType.SNOW_SHOVEL, new EntitySnowShovelFX.Factory()); + this.register(ParticleType.SLIME, new EntityBreakingFX.SlimeFactory()); + this.register(ParticleType.HEART, new EntityHeartFX.Factory()); + this.register(ParticleType.ITEM_CRACK, new EntityBreakingFX.Factory()); + this.register(ParticleType.BLOCK_CRACK, new EntityDiggingFX.Factory()); + this.register(ParticleType.BLOCK_DUST, new EntityBlockDustFX.Factory()); + this.register(ParticleType.EXPLOSION_HUGE, new EntityHugeExplodeFX.Factory()); + this.register(ParticleType.EXPLOSION_LARGE, new EntityLargeExplodeFX.Factory()); + this.register(ParticleType.FIREWORKS_SPARK, new EntityFirework.Factory()); + this.register(ParticleType.HAIL_CORN, new EntityDownfallFX.HailFactory()); } - public void registerParticle(int id, IParticleFactory particleFactory) + public void register(ParticleType id, IParticleFactory factory) { - this.particleTypes.put(Integer.valueOf(id), particleFactory); + this.particleTypes.put(id, factory); } public void emitParticleAtEntity(Entity entityIn, ParticleType particleTypes) @@ -123,13 +121,13 @@ public class EffectRenderer * @param zSpeed Z speed of the particle * @param parameters Parameters for the particle (color for redstone, ...) */ - public EntityFX spawnEffectParticle(int particleId, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int[] parameters) + public EntityFX spawnEffectParticle(ParticleType particleId, double xCoord, double yCoord, double zCoord, double xSpeed, double ySpeed, double zSpeed, int data) { - IParticleFactory iparticlefactory = (IParticleFactory)this.particleTypes.get(Integer.valueOf(particleId)); + IParticleFactory iparticlefactory = this.particleTypes.get(particleId); if (iparticlefactory != null) { - EntityFX entityfx = iparticlefactory.getEntityFX(particleId, this.worldObj, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, parameters); + EntityFX entityfx = iparticlefactory.getEntityFX(this.worldObj, xCoord, yCoord, zCoord, xSpeed, ySpeed, zSpeed, data); if (entityfx != null) { diff --git a/client/src/main/java/client/renderer/particle/EntityAuraFX.java b/client/src/main/java/client/renderer/particle/EntityAuraFX.java index 1240fb84..1ec581ed 100755 --- a/client/src/main/java/client/renderer/particle/EntityAuraFX.java +++ b/client/src/main/java/client/renderer/particle/EntityAuraFX.java @@ -55,7 +55,7 @@ public class EntityAuraFX extends EntityFX public static class SuspendFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, true); } @@ -63,7 +63,7 @@ public class EntityAuraFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false); } @@ -71,7 +71,7 @@ public class EntityAuraFX extends EntityFX public static class GrowFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { EntityFX entityfx = new EntityAuraFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, false); entityfx.setParticleTextureIndex(82); diff --git a/client/src/main/java/client/renderer/particle/EntityBlockDustFX.java b/client/src/main/java/client/renderer/particle/EntityBlockDustFX.java index 27f871d0..9aeaa4b7 100755 --- a/client/src/main/java/client/renderer/particle/EntityBlockDustFX.java +++ b/client/src/main/java/client/renderer/particle/EntityBlockDustFX.java @@ -16,9 +16,9 @@ public class EntityBlockDustFX extends EntityDiggingFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { - State iblockstate = BlockRegistry.byId(p_178902_15_[0]); + State iblockstate = BlockRegistry.byId(data); return iblockstate == null || iblockstate.getBlock().getRenderType() == -1 ? null : (new EntityBlockDustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, iblockstate)).calculateColor(); } } diff --git a/client/src/main/java/client/renderer/particle/EntityBreakingFX.java b/client/src/main/java/client/renderer/particle/EntityBreakingFX.java index 6692c560..b32c21db 100755 --- a/client/src/main/java/client/renderer/particle/EntityBreakingFX.java +++ b/client/src/main/java/client/renderer/particle/EntityBreakingFX.java @@ -68,15 +68,16 @@ public class EntityBreakingFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { - return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, ItemRegistry.byId(p_178902_15_[0])); + Item item = ItemRegistry.byId(data); + return item == null ? null : new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, item); } } public static class SlimeFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.slime_ball); } @@ -84,7 +85,7 @@ public class EntityBreakingFX extends EntityFX public static class SnowballFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityBreakingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Items.snowball); } diff --git a/client/src/main/java/client/renderer/particle/EntityBubbleFX.java b/client/src/main/java/client/renderer/particle/EntityBubbleFX.java index 909b2b5d..8441a640 100755 --- a/client/src/main/java/client/renderer/particle/EntityBubbleFX.java +++ b/client/src/main/java/client/renderer/particle/EntityBubbleFX.java @@ -48,7 +48,7 @@ public class EntityBubbleFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityBubbleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityCloudFX.java b/client/src/main/java/client/renderer/particle/EntityCloudFX.java index 4b46bf94..9539a44f 100755 --- a/client/src/main/java/client/renderer/particle/EntityCloudFX.java +++ b/client/src/main/java/client/renderer/particle/EntityCloudFX.java @@ -77,7 +77,7 @@ public class EntityCloudFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityCloudFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityCrit2FX.java b/client/src/main/java/client/renderer/particle/EntityCrit2FX.java index e021842a..b97da177 100755 --- a/client/src/main/java/client/renderer/particle/EntityCrit2FX.java +++ b/client/src/main/java/client/renderer/particle/EntityCrit2FX.java @@ -76,7 +76,7 @@ public class EntityCrit2FX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } @@ -84,7 +84,7 @@ public class EntityCrit2FX extends EntityFX public static class MagicFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { EntityFX entityfx = new EntityCrit2FX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); entityfx.setRBGColorF(entityfx.getRedColorF() * 0.3F, entityfx.getGreenColorF() * 0.8F, entityfx.getBlueColorF()); diff --git a/client/src/main/java/client/renderer/particle/EntityCritFX.java b/client/src/main/java/client/renderer/particle/EntityCritFX.java index 2e224ccf..ce019e3a 100755 --- a/client/src/main/java/client/renderer/particle/EntityCritFX.java +++ b/client/src/main/java/client/renderer/particle/EntityCritFX.java @@ -11,7 +11,7 @@ public class EntityCritFX extends EntitySmokeFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityCritFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityDiggingFX.java b/client/src/main/java/client/renderer/particle/EntityDiggingFX.java index 2279c382..065a78c9 100755 --- a/client/src/main/java/client/renderer/particle/EntityDiggingFX.java +++ b/client/src/main/java/client/renderer/particle/EntityDiggingFX.java @@ -116,9 +116,9 @@ public class EntityDiggingFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { - State state = BlockRegistry.byId(p_178902_15_[0]); + State state = BlockRegistry.byId(data); return state == null ? null : (new EntityDiggingFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, state)).calculateColor(); } } diff --git a/client/src/main/java/client/renderer/particle/EntityDownfallFX.java b/client/src/main/java/client/renderer/particle/EntityDownfallFX.java index d8d69ebf..86b3bb37 100755 --- a/client/src/main/java/client/renderer/particle/EntityDownfallFX.java +++ b/client/src/main/java/client/renderer/particle/EntityDownfallFX.java @@ -85,7 +85,7 @@ public class EntityDownfallFX extends EntityFX public static class RainFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 0, 4); } @@ -93,7 +93,7 @@ public class EntityDownfallFX extends EntityFX public static class HailFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityDownfallFX(worldIn, xCoordIn, yCoordIn, zCoordIn, 1, 4); } diff --git a/client/src/main/java/client/renderer/particle/EntityDropParticleFX.java b/client/src/main/java/client/renderer/particle/EntityDropParticleFX.java index bce28748..f2d72910 100755 --- a/client/src/main/java/client/renderer/particle/EntityDropParticleFX.java +++ b/client/src/main/java/client/renderer/particle/EntityDropParticleFX.java @@ -142,7 +142,7 @@ public class EntityDropParticleFX extends EntityFX public static class LavaFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityDropParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.LAVA); } @@ -150,7 +150,7 @@ public class EntityDropParticleFX extends EntityFX public static class WaterFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityDropParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, Material.WATER); } diff --git a/client/src/main/java/client/renderer/particle/EntityEnchantmentTableParticleFX.java b/client/src/main/java/client/renderer/particle/EntityEnchantmentTableParticleFX.java index b337bc0d..15dfeedc 100755 --- a/client/src/main/java/client/renderer/particle/EntityEnchantmentTableParticleFX.java +++ b/client/src/main/java/client/renderer/particle/EntityEnchantmentTableParticleFX.java @@ -86,7 +86,7 @@ public class EntityEnchantmentTableParticleFX extends EntityFX public static class EnchantmentTable implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityEnchantmentTableParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityExplodeFX.java b/client/src/main/java/client/renderer/particle/EntityExplodeFX.java index fcf1d11c..acc35047 100755 --- a/client/src/main/java/client/renderer/particle/EntityExplodeFX.java +++ b/client/src/main/java/client/renderer/particle/EntityExplodeFX.java @@ -45,7 +45,7 @@ public class EntityExplodeFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityFirework.java b/client/src/main/java/client/renderer/particle/EntityFirework.java index 6062e773..f8fa2a4d 100755 --- a/client/src/main/java/client/renderer/particle/EntityFirework.java +++ b/client/src/main/java/client/renderer/particle/EntityFirework.java @@ -16,7 +16,7 @@ public class EntityFirework { public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { EntityFirework.SparkFX entityfirework$sparkfx = new EntityFirework.SparkFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, Client.CLIENT.effectRenderer); entityfirework$sparkfx.setAlphaF(0.99F); diff --git a/client/src/main/java/client/renderer/particle/EntityFishWakeFX.java b/client/src/main/java/client/renderer/particle/EntityFishWakeFX.java index c120d5e7..5c94b7fd 100755 --- a/client/src/main/java/client/renderer/particle/EntityFishWakeFX.java +++ b/client/src/main/java/client/renderer/particle/EntityFishWakeFX.java @@ -48,7 +48,7 @@ public class EntityFishWakeFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityFishWakeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityFlameFX.java b/client/src/main/java/client/renderer/particle/EntityFlameFX.java index 462370d2..63ce7dd4 100755 --- a/client/src/main/java/client/renderer/particle/EntityFlameFX.java +++ b/client/src/main/java/client/renderer/particle/EntityFlameFX.java @@ -92,7 +92,7 @@ public class EntityFlameFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityFlameFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityFootStepFX.java b/client/src/main/java/client/renderer/particle/EntityFootStepFX.java index 2bad9a19..260115d2 100755 --- a/client/src/main/java/client/renderer/particle/EntityFootStepFX.java +++ b/client/src/main/java/client/renderer/particle/EntityFootStepFX.java @@ -86,7 +86,7 @@ public class EntityFootStepFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityFootStepFX(Client.CLIENT.getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityHeartFX.java b/client/src/main/java/client/renderer/particle/EntityHeartFX.java index f048950f..e7d77761 100755 --- a/client/src/main/java/client/renderer/particle/EntityHeartFX.java +++ b/client/src/main/java/client/renderer/particle/EntityHeartFX.java @@ -86,7 +86,7 @@ public class EntityHeartFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityHeartFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityHugeExplodeFX.java b/client/src/main/java/client/renderer/particle/EntityHugeExplodeFX.java index 7f287b9a..33cb3883 100755 --- a/client/src/main/java/client/renderer/particle/EntityHugeExplodeFX.java +++ b/client/src/main/java/client/renderer/particle/EntityHugeExplodeFX.java @@ -52,7 +52,7 @@ public class EntityHugeExplodeFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityHugeExplodeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityLargeExplodeFX.java b/client/src/main/java/client/renderer/particle/EntityLargeExplodeFX.java index 9dfe3875..8bfbebd2 100755 --- a/client/src/main/java/client/renderer/particle/EntityLargeExplodeFX.java +++ b/client/src/main/java/client/renderer/particle/EntityLargeExplodeFX.java @@ -93,7 +93,7 @@ public class EntityLargeExplodeFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityLargeExplodeFX(Client.CLIENT.getTextureManager(), worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityLavaFX.java b/client/src/main/java/client/renderer/particle/EntityLavaFX.java index bd823f03..c8d1d15c 100755 --- a/client/src/main/java/client/renderer/particle/EntityLavaFX.java +++ b/client/src/main/java/client/renderer/particle/EntityLavaFX.java @@ -89,7 +89,7 @@ public class EntityLavaFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityLavaFX(worldIn, xCoordIn, yCoordIn, zCoordIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityNoteFX.java b/client/src/main/java/client/renderer/particle/EntityNoteFX.java index 2bfa8501..91f8c7e3 100755 --- a/client/src/main/java/client/renderer/particle/EntityNoteFX.java +++ b/client/src/main/java/client/renderer/particle/EntityNoteFX.java @@ -78,7 +78,7 @@ public class EntityNoteFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityNoteFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityParticleEmitter.java b/client/src/main/java/client/renderer/particle/EntityParticleEmitter.java index 42f18a8f..4ae16e7b 100755 --- a/client/src/main/java/client/renderer/particle/EntityParticleEmitter.java +++ b/client/src/main/java/client/renderer/particle/EntityParticleEmitter.java @@ -48,7 +48,7 @@ public class EntityParticleEmitter extends EntityFX final double xCoord = d3; final double yCoord = d4; final double zCoord = d5; - ((WorldClient)this.worldObj).spawnEntityFX(this.particleTypes, this.particleTypes.getShouldIgnoreRange(), xCoord, yCoord, zCoord, d0, d1 + 0.2D, d2, new int[0]); + ((WorldClient)this.worldObj).spawnEntityFX(this.particleTypes, this.particleTypes.isUnlimited(), xCoord, yCoord, zCoord, d0, d1 + 0.2D, d2, 0); } } diff --git a/client/src/main/java/client/renderer/particle/EntityPortalFX.java b/client/src/main/java/client/renderer/particle/EntityPortalFX.java index 3c5dd594..e86db881 100755 --- a/client/src/main/java/client/renderer/particle/EntityPortalFX.java +++ b/client/src/main/java/client/renderer/particle/EntityPortalFX.java @@ -96,7 +96,7 @@ public class EntityPortalFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityPortalFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntityReddustFX.java b/client/src/main/java/client/renderer/particle/EntityReddustFX.java index f89e164b..306233d4 100755 --- a/client/src/main/java/client/renderer/particle/EntityReddustFX.java +++ b/client/src/main/java/client/renderer/particle/EntityReddustFX.java @@ -85,7 +85,7 @@ public class EntityReddustFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntityReddustFX(worldIn, xCoordIn, yCoordIn, zCoordIn, (float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntitySmokeFX.java b/client/src/main/java/client/renderer/particle/EntitySmokeFX.java index 5566bf2a..a7986d49 100755 --- a/client/src/main/java/client/renderer/particle/EntitySmokeFX.java +++ b/client/src/main/java/client/renderer/particle/EntitySmokeFX.java @@ -80,7 +80,7 @@ public class EntitySmokeFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntitySmokeFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntitySnowShovelFX.java b/client/src/main/java/client/renderer/particle/EntitySnowShovelFX.java index ff9e9faf..f093775a 100755 --- a/client/src/main/java/client/renderer/particle/EntitySnowShovelFX.java +++ b/client/src/main/java/client/renderer/particle/EntitySnowShovelFX.java @@ -73,7 +73,7 @@ public class EntitySnowShovelFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntitySnowShovelFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntitySpellParticleFX.java b/client/src/main/java/client/renderer/particle/EntitySpellParticleFX.java index 4aaa0472..467e2a59 100755 --- a/client/src/main/java/client/renderer/particle/EntitySpellParticleFX.java +++ b/client/src/main/java/client/renderer/particle/EntitySpellParticleFX.java @@ -84,7 +84,7 @@ public class EntitySpellParticleFX extends EntityFX public static class AmbientMobFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); entityfx.setAlphaF(0.15F); @@ -95,7 +95,7 @@ public class EntitySpellParticleFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } @@ -103,7 +103,7 @@ public class EntitySpellParticleFX extends EntityFX public static class InstantFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); ((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144); @@ -113,7 +113,7 @@ public class EntitySpellParticleFX extends EntityFX public static class MobFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); entityfx.setRBGColorF((float)xSpeedIn, (float)ySpeedIn, (float)zSpeedIn); @@ -123,7 +123,7 @@ public class EntitySpellParticleFX extends EntityFX public static class WitchFactory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { EntityFX entityfx = new EntitySpellParticleFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); ((EntitySpellParticleFX)entityfx).setBaseSpellTextureIndex(144); diff --git a/client/src/main/java/client/renderer/particle/EntitySplashFX.java b/client/src/main/java/client/renderer/particle/EntitySplashFX.java index 8c1f93ab..7566ef84 100755 --- a/client/src/main/java/client/renderer/particle/EntitySplashFX.java +++ b/client/src/main/java/client/renderer/particle/EntitySplashFX.java @@ -20,7 +20,7 @@ public class EntitySplashFX extends EntityDownfallFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntitySplashFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/EntitySuspendFX.java b/client/src/main/java/client/renderer/particle/EntitySuspendFX.java index 2e9893fd..fc5ef56d 100755 --- a/client/src/main/java/client/renderer/particle/EntitySuspendFX.java +++ b/client/src/main/java/client/renderer/particle/EntitySuspendFX.java @@ -44,7 +44,7 @@ public class EntitySuspendFX extends EntityFX public static class Factory implements IParticleFactory { - public EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_) + public EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data) { return new EntitySuspendFX(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn); } diff --git a/client/src/main/java/client/renderer/particle/IParticleFactory.java b/client/src/main/java/client/renderer/particle/IParticleFactory.java index f018fda4..534606ab 100755 --- a/client/src/main/java/client/renderer/particle/IParticleFactory.java +++ b/client/src/main/java/client/renderer/particle/IParticleFactory.java @@ -4,5 +4,5 @@ import common.world.World; public interface IParticleFactory { - EntityFX getEntityFX(int particleID, World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int... p_178902_15_); + EntityFX getEntityFX(World worldIn, double xCoordIn, double yCoordIn, double zCoordIn, double xSpeedIn, double ySpeedIn, double zSpeedIn, int data); } diff --git a/client/src/main/java/client/world/WorldClient.java b/client/src/main/java/client/world/WorldClient.java index 29329195..8f6e1548 100755 --- a/client/src/main/java/client/world/WorldClient.java +++ b/client/src/main/java/client/world/WorldClient.java @@ -424,15 +424,14 @@ public class WorldClient extends AWorldClient // } public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, - double zOffset, int... data) { - this.spawnEntityFX(particleType, particleType.getShouldIgnoreRange(), xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data); + double zOffset, int data) { + this.spawnEntityFX(particleType, particleType.isUnlimited(), xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data); } - public EntityFX spawnEntityFX(ParticleType particle, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] parameters) + public EntityFX spawnEntityFX(ParticleType particle, boolean ignoreRange, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int data) { if (this.gm.getRenderViewEntity() != null) { - int particleID = particle.getParticleID(); // int i = this.gm.particleSetting; // // if (i == 1 && this.rand.zrange(3) == 0) @@ -446,14 +445,14 @@ public class WorldClient extends AWorldClient if (ignoreRange) { - return this.gm.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, parameters); + return this.gm.effectRenderer.spawnEffectParticle(particle, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data); } else { double d3 = 16.0D; if(d0 * d0 + d1 * d1 + d2 * d2 > 256.0D) return null; - return this.gm.effectRenderer.spawnEffectParticle(particleID, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, parameters); + return this.gm.effectRenderer.spawnEffectParticle(particle, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, data); } } return null; @@ -630,7 +629,7 @@ public class WorldClient extends AWorldClient double d8 = (double)l * d20 + this.rand.gaussian() * 0.01D; double d10 = -0.03D + this.rand.gaussian() * 0.01D; double d12 = (double)i * d20 + this.rand.gaussian() * 0.01D; - this.spawnEntityFX(ParticleType.SMOKE_NORMAL, ParticleType.SMOKE_NORMAL.getShouldIgnoreRange(), d21, d4, d6, d8, d10, d12, new int[0]); + this.spawnEntityFX(ParticleType.SMOKE_NORMAL, ParticleType.SMOKE_NORMAL.isUnlimited(), d21, d4, d6, d8, d10, d12, 0); } return; @@ -653,7 +652,7 @@ public class WorldClient extends AWorldClient for (int i1 = 0; i1 < 8; ++i1) { - this.spawnEntityFX(ParticleType.ITEM_CRACK, ParticleType.ITEM_CRACK.getShouldIgnoreRange(), d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, new int[] {ItemRegistry.getId(Items.potion)}); + this.spawnEntityFX(ParticleType.ITEM_CRACK, ParticleType.ITEM_CRACK.isUnlimited(), d13, d14, d16, this.rand.gaussian() * 0.15D, this.rand.doublev() * 0.2D, this.rand.gaussian() * 0.15D, ItemRegistry.getId(Items.potion)); } ParticleType enumparticletypes = ParticleType.WATER_SPLASH; @@ -681,7 +680,7 @@ public class WorldClient extends AWorldClient double d24 = Math.cos(d23) * d22; double d9 = 0.01D + this.rand.doublev() * 0.5D; double d11 = Math.sin(d23) * d22; - EntityFX entityfx = this.spawnEntityFX(enumparticletypes, enumparticletypes.getShouldIgnoreRange(), d13 + d24 * 0.1D, d14 + 0.3D, d16 + d11 * 0.1D, d24, d9, d11, new int[0]); + EntityFX entityfx = this.spawnEntityFX(enumparticletypes, enumparticletypes.isUnlimited(), d13 + d24 * 0.1D, d14 + 0.3D, d16 + d11 * 0.1D, d24, d9, d11, 0); if (entityfx != null) { diff --git a/common/src/main/java/common/entity/npc/EntityNPC.java b/common/src/main/java/common/entity/npc/EntityNPC.java index 675814da..124ca8b7 100755 --- a/common/src/main/java/common/entity/npc/EntityNPC.java +++ b/common/src/main/java/common/entity/npc/EntityNPC.java @@ -1274,14 +1274,14 @@ public abstract class EntityNPC extends EntityLiving oy + this.rand.doublev() * (double)this.height, oz + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, 8, (this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F, - 0.15D); + 0.15D, 0); this.worldObj.playAuxSFX(1005, this.getPosition(), 0); ((AWorldServer)this.worldObj).spawnParticle(ParticleType.PORTAL, this.posX + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, this.posY + this.rand.doublev() * (double)this.height, this.posZ + (this.rand.doublev() - 0.5D) * (double)this.width * 2.0D, 8, (this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F, (this.rand.floatv() - 0.5F) * 0.2F, - 0.15D); + 0.15D, 0); return true; } } diff --git a/common/src/main/java/common/entity/projectile/EntityHook.java b/common/src/main/java/common/entity/projectile/EntityHook.java index c08ba981..ce4c5f58 100755 --- a/common/src/main/java/common/entity/projectile/EntityHook.java +++ b/common/src/main/java/common/entity/projectile/EntityHook.java @@ -417,8 +417,8 @@ public class EntityHook extends Entity implements IObjectData this.motionY -= 0.20000000298023224D; this.playSound(SoundEvent.SPLASH, 0.25F); float f8 = (float)ExtMath.floord(this.getEntityBoundingBox().minY); - worldserver.spawnParticle(ParticleType.WATER_BUBBLE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D); - worldserver.spawnParticle(ParticleType.WATER_WAKE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D); + worldserver.spawnParticle(ParticleType.WATER_BUBBLE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, 0); + worldserver.spawnParticle(ParticleType.WATER_WAKE, this.posX, (double)(f8 + 1.0F), this.posZ, (int)(1.0F + this.width * 20.0F), (double)this.width, 0.0D, (double)this.width, 0.20000000298023224D, 0); this.ticksCatchable = this.rand.range(10, 30); } else @@ -436,13 +436,13 @@ public class EntityHook extends Entity implements IObjectData { if (this.rand.floatv() < 0.15F) { - worldserver.spawnParticle(ParticleType.WATER_BUBBLE, d13, d15 - 0.10000000149011612D, d16, 1, (double)f10, 0.1D, (double)f11, 0.0D); + worldserver.spawnParticle(ParticleType.WATER_BUBBLE, d13, d15 - 0.10000000149011612D, d16, 1, (double)f10, 0.1D, (double)f11, 0.0D, 0); } float f3 = f10 * 0.04F; float f4 = f11 * 0.04F; - worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)f4, 0.01D, (double)(-f3), 1.0D); - worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)(-f4), 0.01D, (double)f3, 1.0D); + worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)f4, 0.01D, (double)(-f3), 1.0D, 0); + worldserver.spawnParticle(ParticleType.WATER_WAKE, d13, d15, d16, 0, (double)(-f4), 0.01D, (double)f3, 1.0D, 0); } } } @@ -475,7 +475,7 @@ public class EntityHook extends Entity implements IObjectData if (block == Blocks.water || block == Blocks.flowing_water) { - worldserver.spawnParticle(ParticleType.WATER_SPLASH, d12, d14, d6, this.rand.range(2, 3), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D); + worldserver.spawnParticle(ParticleType.WATER_SPLASH, d12, d14, d6, this.rand.range(2, 3), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, 0); } } diff --git a/common/src/main/java/common/model/ParticleType.java b/common/src/main/java/common/model/ParticleType.java index 64b28fb3..37830ede 100755 --- a/common/src/main/java/common/model/ParticleType.java +++ b/common/src/main/java/common/model/ParticleType.java @@ -1,119 +1,66 @@ package common.model; -import java.util.List; -import java.util.Map; +import common.util.Identifyable; -import common.collect.Lists; -import common.collect.Maps; +public enum ParticleType implements Identifyable { + EXPLOSION_NORMAL("explode", true), + EXPLOSION_LARGE("largeexplode", true), + EXPLOSION_HUGE("hugeexplosion", true), + FIREWORKS_SPARK("fireworksSpark"), + WATER_BUBBLE("bubble"), + WATER_SPLASH("splash"), + WATER_WAKE("wake"), + SUSPENDED("suspended"), + SUSPENDED_DEPTH("depthsuspend"), + CRIT("crit"), + CRIT_MAGIC("magicCrit"), + SMOKE_NORMAL("smoke"), + SMOKE_LARGE("largesmoke"), + SPELL("spell"), + SPELL_INSTANT("instantSpell"), + SPELL_MOB("mobSpell"), + SPELL_MOB_AMBIENT("mobSpellAmbient"), + SPELL_WITCH("witchMagic"), + DRIP_WATER("dripWater"), + DRIP_LAVA("dripLava"), + GROW("grow"), + TOWN_AURA("townaura"), + NOTE("note"), + PORTAL("portal"), + ENCHANTMENT_TABLE("enchantmenttable"), + FLAME("flame"), + LAVA("lava"), + FOOTSTEP("footstep"), + CLOUD("cloud"), + REDSTONE("reddust"), + SNOWBALL("snowballpoof"), + SNOW_SHOVEL("snowshovel"), + SLIME("slime"), + HEART("heart"), + ITEM_CRACK("iconcrack"), + BLOCK_CRACK("blockcrack"), + BLOCK_DUST("blockdust"), + WATER_DROP("droplet"), + ITEM_TAKE("take"), + HAIL_CORN("hail"); -public enum ParticleType -{ - EXPLOSION_NORMAL("explode", 0, true), - EXPLOSION_LARGE("largeexplode", 1, true), - EXPLOSION_HUGE("hugeexplosion", 2, true), - FIREWORKS_SPARK("fireworksSpark", 3, false), - WATER_BUBBLE("bubble", 4, false), - WATER_SPLASH("splash", 5, false), - WATER_WAKE("wake", 6, false), - SUSPENDED("suspended", 7, false), - SUSPENDED_DEPTH("depthsuspend", 8, false), - CRIT("crit", 9, false), - CRIT_MAGIC("magicCrit", 10, false), - SMOKE_NORMAL("smoke", 11, false), - SMOKE_LARGE("largesmoke", 12, false), - SPELL("spell", 13, false), - SPELL_INSTANT("instantSpell", 14, false), - SPELL_MOB("mobSpell", 15, false), - SPELL_MOB_AMBIENT("mobSpellAmbient", 16, false), - SPELL_WITCH("witchMagic", 17, false), - DRIP_WATER("dripWater", 18, false), - DRIP_LAVA("dripLava", 19, false), -// VILLAGER_ANGRY("angryVillager", 20, false), - GROW("grow", 21, false), - TOWN_AURA("townaura", 22, false), - NOTE("note", 23, false), - PORTAL("portal", 24, false), - ENCHANTMENT_TABLE("enchantmenttable", 25, false), - FLAME("flame", 26, false), - LAVA("lava", 27, false), - FOOTSTEP("footstep", 28, false), - CLOUD("cloud", 29, false), - REDSTONE("reddust", 30, false), - SNOWBALL("snowballpoof", 31, false), - SNOW_SHOVEL("snowshovel", 32, false), - SLIME("slime", 33, false), - HEART("heart", 34, false), -// BARRIER("barrier", 35, false), - 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); + private final String name; + private final boolean unlimited; - private final String particleName; - private final int particleID; - private final boolean shouldIgnoreRange; - private final boolean argument; - private static final Map PARTICLES = Maps.newHashMap(); - private static final String[] PARTICLE_NAMES; + private ParticleType(String name, boolean unlimited) { + this.name = name; + this.unlimited = unlimited; + } - private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited, boolean argumentCountIn) - { - this.particleName = particleNameIn; - this.particleID = particleIDIn; - this.shouldIgnoreRange = unlimited; - this.argument = argumentCountIn; - } + private ParticleType(String name) { + this(name, false); + } - private ParticleType(String particleNameIn, int particleIDIn, boolean unlimited) - { - this(particleNameIn, particleIDIn, unlimited, false); - } + public String getName() { + return this.name; + } - public static String[] getParticleNames() - { - return PARTICLE_NAMES; - } - - public String getParticleName() - { - return this.particleName; - } - - public int getParticleID() - { - return this.particleID; - } - - public boolean hasArgument() - { - return this.argument; - } - - public boolean getShouldIgnoreRange() - { - return this.shouldIgnoreRange; - } - - public static ParticleType getParticleFromId(int particleId) - { - return PARTICLES.get(particleId); - } - - static { - List list = Lists.newArrayList(); - - for (ParticleType enumparticletypes : values()) - { - PARTICLES.put(enumparticletypes.getParticleID(), enumparticletypes); - - if (!enumparticletypes.getParticleName().endsWith("_")) - { - list.add(enumparticletypes.getParticleName()); - } - } - - PARTICLE_NAMES = list.toArray(new String[list.size()]); - } + public boolean isUnlimited() { + return this.unlimited; + } } diff --git a/common/src/main/java/common/packet/SPacketParticles.java b/common/src/main/java/common/packet/SPacketParticles.java index 6d44d612..476888bb 100755 --- a/common/src/main/java/common/packet/SPacketParticles.java +++ b/common/src/main/java/common/packet/SPacketParticles.java @@ -45,13 +45,7 @@ public class SPacketParticles implements Packet */ public void readPacketData(PacketBuffer buf) throws IOException { - this.particleType = ParticleType.getParticleFromId(buf.readInt()); - - if (this.particleType == null) - { - this.particleType = ParticleType.HEART; //TODO: ??? - } - + this.particleType = buf.readEnumValue(ParticleType.class); this.longDistance = buf.readBoolean(); this.xCoord = buf.readFloat(); this.yCoord = buf.readFloat(); @@ -61,8 +55,7 @@ public class SPacketParticles implements Packet this.zOffset = buf.readFloat(); this.particleSpeed = buf.readFloat(); this.particleCount = buf.readInt(); - if(this.particleType.hasArgument()) - this.particleArgument = buf.readVarInt(); + this.particleArgument = buf.readVarInt(); } /** @@ -70,7 +63,7 @@ public class SPacketParticles implements Packet */ public void writePacketData(PacketBuffer buf) throws IOException { - buf.writeInt(this.particleType.getParticleID()); + buf.writeEnumValue(this.particleType); buf.writeBoolean(this.longDistance); buf.writeFloat(this.xCoord); buf.writeFloat(this.yCoord); @@ -80,8 +73,7 @@ public class SPacketParticles implements Packet buf.writeFloat(this.zOffset); buf.writeFloat(this.particleSpeed); buf.writeInt(this.particleCount); - if(this.particleType.hasArgument()) - buf.writeVarInt(this.particleArgument); + buf.writeVarInt(this.particleArgument); } public ParticleType getParticleType() diff --git a/common/src/main/java/common/world/AWorldServer.java b/common/src/main/java/common/world/AWorldServer.java index 81089d6c..4bda75dd 100644 --- a/common/src/main/java/common/world/AWorldServer.java +++ b/common/src/main/java/common/world/AWorldServer.java @@ -32,7 +32,7 @@ public abstract class AWorldServer extends World { public abstract void strikeLightning(double x, double y, double z, int color, int damage, boolean fire, EntityLiving summoner); public abstract void resetWeather(); public abstract void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, double yOffset, - double zOffset, double particleSpeed, int... particleArguments); + double zOffset, double particleSpeed, int data); public abstract long getSeed(); public abstract boolean isExterminated(); public abstract boolean exterminate(); diff --git a/common/src/main/java/common/world/Explosion.java b/common/src/main/java/common/world/Explosion.java index c9d687ef..032cd7ea 100755 --- a/common/src/main/java/common/world/Explosion.java +++ b/common/src/main/java/common/world/Explosion.java @@ -171,7 +171,7 @@ public class Explosion worldObj.setState(blockpos, Blocks.air.getState(), 3); if(rand.chance(1000)) { worldObj.playSound(SoundEvent.EXPLODE, explosionX + x, explosionY + y, explosionZ + z, 4.0F); - ((AWorldServer)worldObj).spawnParticle(ParticleType.EXPLOSION_HUGE, explosionX + x, explosionY + y, explosionZ + z, 0, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, 1.0); + ((AWorldServer)worldObj).spawnParticle(ParticleType.EXPLOSION_HUGE, explosionX + x, explosionY + y, explosionZ + z, 0, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, rand.gaussian() * 0.02D, 1.0, 0); } } } diff --git a/common/src/main/java/common/world/World.java b/common/src/main/java/common/world/World.java index 803a6469..056322a0 100755 --- a/common/src/main/java/common/world/World.java +++ b/common/src/main/java/common/world/World.java @@ -2089,7 +2089,12 @@ public abstract class World implements IWorldAccess { } public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, - double zOffset, int... data) { + double zOffset, int data) { + } + + public final void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, + double zOffset) { + this.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, 0); } // public Difficulty getDifficulty() { diff --git a/server/src/main/java/server/world/WorldServer.java b/server/src/main/java/server/world/WorldServer.java index 6578c2d1..586bafe1 100755 --- a/server/src/main/java/server/world/WorldServer.java +++ b/server/src/main/java/server/world/WorldServer.java @@ -1288,15 +1288,15 @@ public final class WorldServer extends AWorldServer { } public void spawnParticle(ParticleType particleType, double xCoord, double yCoord, double zCoord, int numberOfParticles, double xOffset, - double yOffset, double zOffset, double particleSpeed, int... particleArguments) { + double yOffset, double zOffset, double particleSpeed, int data) { this.spawnParticle(particleType, false, xCoord, yCoord, zCoord, numberOfParticles, xOffset, yOffset, zOffset, particleSpeed, - particleArguments); + data); } public void spawnParticle(ParticleType particleType, boolean longDistance, double xCoord, double yCoord, double zCoord, - int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int[] particleArguments) { + int numberOfParticles, double xOffset, double yOffset, double zOffset, double particleSpeed, int data) { Packet packet = new SPacketParticles(particleType, longDistance, (float)xCoord, (float)yCoord, (float)zCoord, (float)xOffset, - (float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, particleArguments.length == 0 ? 0 : particleArguments[0]); + (float)yOffset, (float)zOffset, (float)particleSpeed, numberOfParticles, data); for(int i = 0; i < this.players.size(); ++i) { EntityNPC entityplayermp = this.players.get(i);