Compare commits

..
Author SHA1 Message Date
Martin Robertz 92bf2aba66 Merge remote-tracking branch 'slprime/panel-alignment-center-to-edges' into dev 2026-02-07 18:52:28 +01:00
Martin Robertz e781d2e49a Merge remote-tracking branch 'slprime/search-page-reset' into dev 2026-02-07 18:52:25 +01:00
Martin Robertz 2f4397f236 Merge remote-tracking branch 'NealDeal34/master' into dev 2026-02-07 18:52:21 +01:00
slprime ebe95b3cf1 Align panels from center to edges 2026-02-07 19:01:11 +02:00
slprime d9881fe81c fix first check 2026-02-07 18:55:44 +02:00
slprime c2e4d168e9 Reset item panel page on search result size change 2026-02-07 18:49:07 +02:00
NealDeal34 23015aa613 update
Replace WeakHashMap with ConcurrentHashMap for thread safety, and improve logging for entity creation and loading.
2026-02-07 13:38:49 +08:00
Martin Robertz 83c54ec6c6 Merge remote-tracking branch 'NealDeal34/master' into dev 2026-02-06 20:56:05 +01:00
NealDeal34 688c2c1f36 Revert wrong merge of test branches 2026-02-04 02:43:21 +08:00
NealDeal34 22280ea320 Revert "sync" 2026-02-04 02:32:04 +08:00
NealDeal34 6df14438c5 Merge pull request #2 from NealDeal34/2.8.55-GTNH
sync
2026-02-04 02:26:07 +08:00
NealDeal34 0b1019bdf0 Merge branch 'GTNewHorizons:master' into 2.8.55-GTNH 2026-02-04 02:22:35 +08:00
NealDeal34 a811d20299 Merge branch 'master' into master 2026-02-04 02:06:52 +08:00
NealDeal34 4e1835ed12 sa 2026-01-28 05:01:39 +08:00
NealDeal34 1db5809cde Update build-and-test.yml 2026-01-28 04:48:32 +08:00
github-actions[bot] fa4411ad2e Apply spotless formatting [skip ci] 2026-01-27 20:46:02 +00:00
NealDeal34 80f7455e7f Refactor spotless-format job and git tagging
Removed output for formatted files in spotless-format job and adjusted git tag handling.
2026-01-28 04:44:05 +08:00
NealDeal34 b9cac67ec7 Update GitHub Actions workflow for release builds 2026-01-28 04:40:05 +08:00
NealDeal34 41a6cc0711 Update build-and-test.yml 2026-01-28 04:27:17 +08:00
NealDeal34 319ed409f1 update 2026-01-28 04:16:10 +08:00
NealDeal34 ad153f1c0a sa 2026-01-28 04:02:42 +08:00
Martin Robertz e340423b28 Merge branch 'master' into master 2026-01-26 21:30:13 +01:00
NealDeal34 7b0feb16f9 Refactor ItemMobSpawner for clarity 2026-01-27 04:09:48 +08:00
NealDeal34 e0b34e8b9a Update method call for setting entity name in spawner 2026-01-27 03:58:06 +08:00
NealDeal34 c533f6f1b5 Refactor ItemMobSpawner for thread safety and clarity 2026-01-27 03:51:51 +08:00
NealDeal34 140977be2e Merge branch 'GTNewHorizons:master' into 2.7.28-GTNH 2026-01-27 03:43:02 +08:00
Martin Robertz 8a13af1969 Merge branch 'master' into master 2026-01-10 01:49:44 +01:00
Martin Robertz d6d50a968d sa 2026-01-02 08:59:20 +01:00
NealDeal34 43459d4b41 Update ItemMobSpawner.java 2025-12-30 15:57:58 +08:00
NealDeal34 2a1aff073b Update ItemMobSpawner.java 2025-12-30 15:39:49 +08:00
NealDeal34 73eea57d11 Update ItemMobSpawner.java 2025-12-30 15:34:47 +08:00
NealDeal34 9b84ea7804 Update ItemMobSpawner.java 2025-12-30 15:32:57 +08:00
NealDeal34 de42a43b2c update 2025-12-30 03:50:49 +08:00
NealDeal34 b89734f3e6 Added checks for abstract classes when retrieving entities 2025-12-30 03:19:36 +08:00
NealDeal34 7445d96531 Add workflow_dispatch trigger to release-tags.yml 2025-12-30 02:42:47 +08:00
NealDeal34 dc997626c1 Refactor getEntity method to handle abstract classes 2025-12-30 02:41:45 +08:00
5 changed files with 58 additions and 69 deletions

No files matched your search

@@ -509,31 +509,30 @@ public class BookmarkPanel extends PanelWidget<BookmarkGrid> {
}
}
@Override
public Rectangle4i calculateBounds() {
final GuiContainer gui = NEIClientUtils.getGuiContainer();
final int width = (gui.width - gui.xSize) / 2 - PADDING * 2;
final Rectangle4i bounds = new Rectangle4i(
PADDING,
PADDING,
(gui.width - 176) / 2 - PADDING * 2,
gui.height - PADDING * 2);
final int maxWidth = (gui.width - 176) / 2 - PADDING * 2;
final int maxHeight = gui.height - PADDING * 2;
final int freeSpace = (gui.width - gui.xSize) / 2 - PADDING * 2;
int paddingLeft = (int) Math
.ceil(bounds.w * NEIClientConfig.getSetting("world.panels.bookmarks.left").getIntValue() / 100000.0);
int paddingTop = (int) Math
.ceil(bounds.h * NEIClientConfig.getSetting("world.panels.bookmarks.top").getIntValue() / 100000.0);
int paddingRight = (int) Math
.ceil(bounds.w * NEIClientConfig.getSetting("world.panels.bookmarks.right").getIntValue() / 100000.0);
int paddingBottom = (int) Math
.ceil(bounds.h * NEIClientConfig.getSetting("world.panels.bookmarks.bottom").getIntValue() / 100000.0);
final int paddingLeft = (int) Math
.ceil(maxWidth * NEIClientConfig.getSetting("world.panels.bookmarks.left").getIntValue() / 100000.0);
final int paddingTop = (int) Math
.ceil(maxHeight * NEIClientConfig.getSetting("world.panels.bookmarks.top").getIntValue() / 100000.0);
final int paddingRight = (int) Math
.ceil(maxWidth * NEIClientConfig.getSetting("world.panels.bookmarks.right").getIntValue() / 100000.0);
final int paddingBottom = (int) Math
.ceil(maxHeight * NEIClientConfig.getSetting("world.panels.bookmarks.bottom").getIntValue() / 100000.0);
bounds.h = Math.max(ItemsGrid.SLOT_SIZE, bounds.h - paddingTop - paddingBottom);
bounds.y = bounds.y + Math.min(paddingTop, bounds.h - ItemsGrid.SLOT_SIZE);
final int width = Math.max(
ItemsGrid.SLOT_SIZE,
snapDownToMultiple(
Math.min(freeSpace - paddingLeft, maxWidth - paddingLeft - paddingRight),
ItemsGrid.SLOT_SIZE));
final int height = Math.max(ItemsGrid.SLOT_SIZE, maxHeight - paddingTop - paddingBottom);
bounds.w = Math.max(ItemsGrid.SLOT_SIZE, Math.min(bounds.w - paddingLeft - paddingRight, width - paddingLeft));
bounds.x = bounds.x + Math.min(paddingLeft, bounds.w - ItemsGrid.SLOT_SIZE);
return bounds;
return new Rectangle4i(paddingLeft + PADDING, paddingTop + PADDING, width, height);
}
protected ItemStack getDraggedStackWithQuantity(ItemStack itemStack) {
@@ -17,7 +17,6 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
@@ -34,22 +33,7 @@ public class ItemMobSpawner extends ItemBlock {
private static final Map<Class<? extends Entity>, String> ENTITY_CLASS_TO_NAME_CACHE = new ConcurrentHashMap<>();
public static int idPig = 90;
private static volatile boolean loaded = false;
// For asm
public static int placedX;
public static int placedY;
public static int placedZ;
public static void setLastPlacedPosition(int x, int y, int z) {
placedX = x;
placedY = y;
placedZ = z;
}
public static int[] getLastPlacedPosition() {
return new int[] { placedX, placedY, placedZ };
}
private static boolean loaded = false;
public ItemMobSpawner() {
super(Blocks.mob_spawner);
@@ -65,22 +49,15 @@ public class ItemMobSpawner extends ItemBlock {
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer entityplayer, World world, int x, int y, int z, int side,
float hitX, float hitY, float hitZ) {
placedX = x;
placedY = y;
placedZ = z;
boolean placed = super.onItemUse(itemstack, entityplayer, world, x, y, z, side, hitX, hitY, hitZ);
if (placed && !world.isRemote) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityMobSpawner) {
TileEntityMobSpawner spawner = (TileEntityMobSpawner) tileEntity;
if (world.getTileEntity(x, y, z) instanceof TileEntityMobSpawner) {
TileEntityMobSpawner spawner = (TileEntityMobSpawner) world.getTileEntity(x, y, z);
String mobType = getMobTypeFromItemStack(itemstack);
if (mobType != null) {
spawner.func_145881_a().setEntityName(mobType);
world.markBlockForUpdate(x, y, z);
NEICPH.sendMobSpawnerID(x, y, z, mobType);
spawner.func_145881_a().setEntityName(mobType);
}
}
return true;
@@ -230,6 +207,10 @@ public class ItemMobSpawner extends ItemBlock {
}
synchronized (ItemMobSpawner.class) {
if (loaded) {
return;
}
try {
for (Map.Entry<Class<? extends Entity>, String> entry : ((Map<Class<? extends Entity>, String>) EntityList.classToStringMapping)
.entrySet()) {
+26 -21
View File
@@ -75,7 +75,13 @@ public class ItemPanel extends PanelWidget<ItemsPanelGrid> {
}
public static void updateItemList(ArrayList<ItemStack> newItems) {
ItemPanels.itemPanel.getGrid().setItems(newItems);
final ItemsPanelGrid grid = ItemPanels.itemPanel.getGrid();
if (grid.rawItems.size() != newItems.size()) {
grid.setPage(0);
}
grid.setItems(newItems);
ItemPanels.itemPanel.realItems = newItems;
}
@@ -115,31 +121,30 @@ public class ItemPanel extends PanelWidget<ItemsPanelGrid> {
return String.format("%d/%d", getPage(), Math.max(1, getNumPages()));
}
@Override
public Rectangle4i calculateBounds() {
final GuiContainer gui = NEIClientUtils.getGuiContainer();
final int width = (gui.width - gui.xSize) / 2 - PADDING * 2;
final Rectangle4i bounds = new Rectangle4i(
(gui.width + gui.xSize) / 2 + PADDING,
PADDING,
(gui.width - 176) / 2 - PADDING * 2,
gui.height - PADDING * 2);
final int maxWidth = (gui.width - 176) / 2 - PADDING * 2;
final int maxHeight = gui.height - PADDING * 2;
final int freeSpace = (gui.width - gui.xSize) / 2 - PADDING * 2;
int paddingLeft = (int) Math
.ceil(bounds.w * NEIClientConfig.getSetting("world.panels.items.left").getIntValue() / 100000.0);
int paddingTop = (int) Math
.ceil(bounds.h * NEIClientConfig.getSetting("world.panels.items.top").getIntValue() / 100000.0);
int paddingRight = (int) Math
.ceil(bounds.w * NEIClientConfig.getSetting("world.panels.items.right").getIntValue() / 100000.0);
int paddingBottom = (int) Math
.ceil(bounds.h * NEIClientConfig.getSetting("world.panels.items.bottom").getIntValue() / 100000.0);
final int paddingLeft = (int) Math
.ceil(maxWidth * NEIClientConfig.getSetting("world.panels.items.left").getIntValue() / 100000.0);
final int paddingTop = (int) Math
.ceil(maxHeight * NEIClientConfig.getSetting("world.panels.items.top").getIntValue() / 100000.0);
final int paddingRight = (int) Math
.ceil(maxWidth * NEIClientConfig.getSetting("world.panels.items.right").getIntValue() / 100000.0);
final int paddingBottom = (int) Math
.ceil(maxHeight * NEIClientConfig.getSetting("world.panels.items.bottom").getIntValue() / 100000.0);
bounds.h = Math.max(ItemsGrid.SLOT_SIZE, bounds.h - paddingTop - paddingBottom);
bounds.y = bounds.y + Math.min(paddingTop, bounds.h - ItemsGrid.SLOT_SIZE);
final int width = Math.max(
ItemsGrid.SLOT_SIZE,
snapDownToMultiple(
Math.min(freeSpace - paddingRight, maxWidth - paddingLeft - paddingRight),
ItemsGrid.SLOT_SIZE));
final int height = Math.max(ItemsGrid.SLOT_SIZE, maxHeight - paddingTop - paddingBottom);
bounds.w = Math.max(ItemsGrid.SLOT_SIZE, Math.min(bounds.w - paddingLeft - paddingRight, width - paddingRight));
bounds.x = bounds.x + Math.max(0, width - bounds.w - paddingRight);
return bounds;
return new Rectangle4i(gui.width - width - PADDING - paddingRight, paddingTop + PADDING, width, height);
}
@Override
@@ -70,7 +70,7 @@ public class ItemsPanelGrid extends ItemsGrid<ItemsPanelGrid.ItemsPanelGridSlot,
}
public ArrayList<ItemStack> newItems;
public ArrayList<ItemStack> rawItems;
public ArrayList<ItemStack> rawItems = new ArrayList<>();
protected List<ItemsPanelGridSlot> gridMask;
protected final Map<Integer, Integer> itemToGroup = new HashMap<>();
@@ -84,6 +84,10 @@ public abstract class PanelWidget<T extends ItemsGrid<? extends ItemsGridSlot, ?
public abstract Rectangle4i calculateBounds();
protected static int snapDownToMultiple(int value, int multiple) {
return (value / multiple) * multiple;
}
public void resize(GuiContainer gui) {
final Rectangle4i bounds = calculateBounds();