mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-30 09:50:51 +01:00
updated getStackHeight so it's the same as the devbuild
This commit is contained in:
parent
47865f0ec5
commit
3600a8f53c
@ -3542,31 +3542,30 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public double getStackHeight(short x, short y, boolean calculateHeightmap, HabboItem exclude) {
|
public double getStackHeight(short x, short y, boolean calculateHeightmap, HabboItem exclude) {
|
||||||
|
|
||||||
if (x < 0 || y < 0 || this.layout == null)
|
if (x < 0 || y < 0 || this.layout == null)
|
||||||
return calculateHeightmap ? Short.MAX_VALUE : 0.0;
|
return calculateHeightmap ? Short.MAX_VALUE : 0.0;
|
||||||
|
|
||||||
double height = this.layout.getHeightAtSquare(x, y);
|
|
||||||
boolean canStack = true;
|
|
||||||
boolean stackHelper = false;
|
|
||||||
THashSet<HabboItem> items = this.getItemsAt(x, y);
|
|
||||||
if (items != null) {
|
|
||||||
for (HabboItem item : items) {
|
|
||||||
if (item == exclude) continue;
|
|
||||||
|
|
||||||
if (item instanceof InteractionStackHelper) {
|
|
||||||
stackHelper = true;
|
|
||||||
height = item.getExtradata().isEmpty() ? Double.valueOf("0.0") : (Double.valueOf(item.getExtradata()) / 100);
|
|
||||||
canStack = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean pluginHelper = false;
|
boolean pluginHelper = false;
|
||||||
if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) {
|
if (Emulator.getPluginManager().isRegistered(FurnitureStackHeightEvent.class, true)) {
|
||||||
FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this));
|
FurnitureStackHeightEvent event = Emulator.getPluginManager().fireEvent(new FurnitureStackHeightEvent(x, y, this));
|
||||||
stackHelper = event.hasPluginHelper();
|
if(event.hasPluginHelper()) {
|
||||||
|
return calculateHeightmap ? event.getHeight() * 256.0D : event.getHeight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double height = this.layout.getHeightAtSquare(x, y);
|
||||||
|
boolean canStack = true;
|
||||||
|
|
||||||
|
THashSet<HabboItem> stackHelpers = this.getItemsAt(InteractionStackHelper.class, x, y);
|
||||||
|
|
||||||
|
if(stackHelpers.size() > 0) {
|
||||||
|
for(HabboItem item : stackHelpers) {
|
||||||
|
if (item == exclude) continue;
|
||||||
|
return calculateHeightmap ? item.getZ() * 256.0D : item.getZ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!stackHelper && !pluginHelper) {
|
|
||||||
HabboItem item = this.getTopItemAt(x, y, exclude);
|
HabboItem item = this.getTopItemAt(x, y, exclude);
|
||||||
if (item != null) {
|
if (item != null) {
|
||||||
canStack = item.getBaseItem().allowStack();
|
canStack = item.getBaseItem().allowStack();
|
||||||
@ -3576,9 +3575,7 @@ public class Room implements Comparable<Room>, ISerialize, Runnable {
|
|||||||
HabboItem lowestChair = this.getLowestChair(x, y);
|
HabboItem lowestChair = this.getLowestChair(x, y);
|
||||||
if (lowestChair != null && lowestChair != exclude) {
|
if (lowestChair != null && lowestChair != exclude) {
|
||||||
canStack = true;
|
canStack = true;
|
||||||
height = lowestChair.getZ() + Item.getCurrentHeight(lowestChair);
|
height = lowestChair.getZ();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calculateHeightmap) {
|
if (calculateHeightmap) {
|
||||||
|
@ -9,12 +9,14 @@ public class FurnitureStackHeightEvent extends Event {
|
|||||||
public final short y;
|
public final short y;
|
||||||
public final Room room;
|
public final Room room;
|
||||||
private boolean pluginHelper;
|
private boolean pluginHelper;
|
||||||
|
private Double height;
|
||||||
|
|
||||||
public FurnitureStackHeightEvent(short x, short y, Room room) {
|
public FurnitureStackHeightEvent(short x, short y, Room room) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.room = room;
|
this.room = room;
|
||||||
this.pluginHelper = false;
|
this.pluginHelper = false;
|
||||||
|
this.height = 0.0D;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPluginHelper(boolean helper) {
|
public void setPluginHelper(boolean helper) {
|
||||||
@ -24,4 +26,12 @@ public class FurnitureStackHeightEvent extends Event {
|
|||||||
public boolean hasPluginHelper() {
|
public boolean hasPluginHelper() {
|
||||||
return this.pluginHelper;
|
return this.pluginHelper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHeight(Double height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getHeight() {
|
||||||
|
return this.height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user