Compare commits

...
2 Commits
Author SHA1 Message Date
Alexdoru 3bc6720dec Prevent loading chunks while ticking blocks (#110) 2026-03-12 21:33:00 +01:00
UltraProdigy 1083f52a30 Optimize Image & Workflow (#108) 2026-03-07 10:30:44 +01:00
177 changed files with 73 additions and 66 deletions

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
name: Optimize images
on:
pull_request:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
push:
branches: [ master, main, release/** ]
paths:
- "**/*.png"
jobs:
optimize-images:
uses: GTNewHorizons/GTNH-Actions-Workflows/.github/workflows/optimize-images.yml@master
secrets: inherit
@@ -36,29 +36,29 @@ public class BlockFruitPod extends BlockCocoa {
}
public static TileFruitPod getPodTile(IBlockAccess world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (!(tile instanceof TileFruitPod)) {
return null;
final TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileFruitPod) {
return (TileFruitPod) tile;
}
return (TileFruitPod) tile;
return null;
}
@Override
public void updateTick(World world, int x, int y, int z, Random rand) {
if (!world.checkChunksExist(x - 1, y, z - 1, x + 1, y, z + 1)) {
return;
}
if (!canBlockStay(world, x, y, z)) {
dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
final int meta = world.getBlockMetadata(x, y, z);
this.dropBlockAsItem(world, x, y, z, meta, 0);
world.setBlockToAir(x, y, z);
return;
}
TileFruitPod tile = getPodTile(world, x, y, z);
if (tile == null) {
return;
final TileFruitPod tile = getPodTile(world, x, y, z);
if (tile != null) {
tile.onBlockTick();
}
tile.onBlockTick();
}
@SuppressWarnings("deprecation")
@@ -84,31 +84,26 @@ public class BlockSoil extends Block implements IItemTyped {
}
@Override
public void updateTick(World world, int i, int j, int k, Random random) {
public void updateTick(World world, int x, int y, int z, Random random) {
if (world.isRemote) {
return;
}
int meta = world.getBlockMetadata(i, j, k);
int meta = world.getBlockMetadata(x, y, z);
SoilType type = getTypeFromMeta(meta);
if (type == SoilType.HUMUS) {
updateTickHumus(world, i, j, k);
if (world.checkChunksExist(x - 1, y + 1, z - 1, x + 1, y + 1, z + 1)) {
if (isEnrooted(world, x, y, z)) {
degradeSoil(world, x, y, z);
}
}
} else if (type == SoilType.BOG_EARTH) {
updateTickBogEarth(world, i, j, k);
}
}
private static void updateTickHumus(World world, int i, int j, int k) {
if (isEnrooted(world, i, j, k)) {
degradeSoil(world, i, j, k);
}
}
private static void updateTickBogEarth(World world, int i, int j, int k) {
if (isMoistened(world, i, j, k)) {
matureBog(world, i, j, k);
if (world.checkChunksExist(x - 2, y, z - 2, x + 2, y, z + 2)) {
if (isMoistened(world, x, y, z)) {
matureBog(world, x, y, z);
}
}
}
}
@@ -122,7 +117,6 @@ public class BlockSoil extends Block implements IItemTyped {
}
}
}
return false;
}
@@ -156,7 +150,6 @@ public class BlockSoil extends Block implements IItemTyped {
}
private static boolean isMoistened(World world, int x, int y, int z) {
for (int i = -2; i < 3; i++) {
for (int j = -2; j < 3; j++) {
Block block = world.getBlock(x + i, y, z + j);
@@ -165,7 +158,6 @@ public class BlockSoil extends Block implements IItemTyped {
}
}
}
return false;
}
@@ -193,7 +193,7 @@ public class BlockForestryFluid extends BlockFluidClassic {
super.updateTick(world, x, y, z, rand);
// Start fires if the fluid is lava-like
if (getMaterial() == Material.lava) {
if (getMaterial() == Material.lava && world.checkChunksExist(x - 4, y, z - 4, x + 4, y, z + 4)) {
int rangeUp = rand.nextInt(3);
for (int i = 0; i < rangeUp; ++i) {
@@ -72,51 +72,54 @@ public class BlockMushroom extends BlockSapling implements IItemTyped {
}
@Override
public void updateTick(World world, int i, int j, int k, Random random) {
public void updateTick(World world, int x, int y, int z, Random random) {
if (world.isRemote) {
return;
}
int meta = world.getBlockMetadata(i, j, k);
MushroomType type = getTypeFromMeta(meta);
int maturity = meta >> 2;
final int meta = world.getBlockMetadata(x, y, z);
final MushroomType type = getTypeFromMeta(meta);
final int maturity = meta >> 2;
tickGermling(world, i, j, k, random, type, maturity);
tickGermling(world, x, y, z, random, type, maturity);
}
private void tickGermling(World world, int i, int j, int k, Random random, MushroomType type, int maturity) {
int lightvalue = world.getBlockLightValue(i, j + 1, k);
private void tickGermling(World world, int x, int y, int z, Random random, MushroomType type, int maturity) {
if (random.nextInt(2) != 0) {
return;
}
if (maturity != 3) {
maturity = 3;
int matX = maturity << 2;
int meta = (matX | type.ordinal());
world.setBlockMetadataWithNotify(i, j, k, meta, Constants.FLAG_BLOCK_SYNCH);
} else if (lightvalue <= 7) {
func_149878_d(world, i, j, k, random);
final int matX = maturity << 2;
final int meta = (matX | type.ordinal());
world.setBlockMetadataWithNotify(x, y, z, meta, Constants.FLAG_BLOCK_SYNCH);
} else {
if (world.checkChunksExist(x - 1, y, z - 1, x + 1, y, z + 1)) {
final int lightvalue = world.getBlockLightValue(x, y + 1, z);
if (lightvalue <= 7) {
func_149878_d(world, x, y, z, random);
}
}
}
}
@Override
public void func_149878_d(World world, int i, int j, int k, Random random) {
MushroomType type = getTypeFromMeta(world.getBlockMetadata(i, j, k));
public void func_149878_d(World world, int x, int y, int z, Random random) {
MushroomType type = getTypeFromMeta(world.getBlockMetadata(x, y, z));
world.setBlockToAir(i, j, k);
if (!generators[type.ordinal()].generate(world, random, i, j, k)) {
world.setBlock(i, j, k, this, type.ordinal(), 0);
world.setBlockToAir(x, y, z);
if (!generators[type.ordinal()].generate(world, random, x, y, z)) {
world.setBlock(x, y, z, this, type.ordinal(), 0);
}
}
@Override
public MushroomType getTypeFromMeta(int meta) {
meta %= MushroomType.values().length;
return MushroomType.values()[meta];
return switch (meta % 2) {
case 0 -> MushroomType.BROWN;
case 1 -> MushroomType.RED;
default -> throw new IllegalStateException("Unexpected value: " + meta);
};
}
/* ICONS */
@@ -135,15 +138,10 @@ public class BlockMushroom extends BlockSapling implements IItemTyped {
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int meta) {
MushroomType type = getTypeFromMeta(meta);
switch (type) {
case BROWN:
return Blocks.brown_mushroom.getIcon(side, meta);
case RED:
return Blocks.red_mushroom.getIcon(side, meta);
default:
return null;
}
final MushroomType type = getTypeFromMeta(meta);
return switch (type) {
case BROWN -> Blocks.brown_mushroom.getIcon(side, meta);
case RED -> Blocks.red_mushroom.getIcon(side, meta);
};
}
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 B

After

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 445 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 207 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 424 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 319 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 B

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 346 B

After

Width:  |  Height:  |  Size: 345 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 349 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 326 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 232 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 362 B

After

Width:  |  Height:  |  Size: 359 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 239 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 384 B

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 375 B

After

Width:  |  Height:  |  Size: 371 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 318 B

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 240 B

After

Width:  |  Height:  |  Size: 228 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 219 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 179 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 168 B

After

Width:  |  Height:  |  Size: 161 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 215 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 284 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 287 B

After

Width:  |  Height:  |  Size: 286 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 186 B

After

Width:  |  Height:  |  Size: 183 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.1 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 114 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 B

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 339 B

After

Width:  |  Height:  |  Size: 337 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 334 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 234 B

After

Width:  |  Height:  |  Size: 233 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 B

After

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 211 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 949 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 898 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 338 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 938 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 820 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 862 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 850 B

After

Width:  |  Height:  |  Size: 847 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 919 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 947 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 860 B

After

Width:  |  Height:  |  Size: 857 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 864 B

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 860 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 958 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 861 B

After

Width:  |  Height:  |  Size: 858 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 931 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 864 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 920 B

After

Width:  |  Height:  |  Size: 831 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

After

Width:  |  Height:  |  Size: 562 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 382 B

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 378 B

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 B

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 B

After

Width:  |  Height:  |  Size: 348 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 380 B

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 389 B

After

Width:  |  Height:  |  Size: 388 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 369 B

After

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 B

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 191 B

After

Width:  |  Height:  |  Size: 190 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 259 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 590 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 B

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

After

Width:  |  Height:  |  Size: 253 B

Loaded 100 of 177 files, more files were not shown because too many files have changed in this diff. Show more