Skip to content

Commit

Permalink
Cache a few nussed values() calls, remove useless class
Browse files Browse the repository at this point in the history
The only way to make its inventory icon is setting the getSpriteNumber number, but I can't because it's not meta sensitive and there's no way to use only item icons for just the mangrove propagule.
  • Loading branch information
Roadhog360 committed Nov 16, 2023
1 parent 56dd2fe commit fec27be
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 45 deletions.
4 changes: 2 additions & 2 deletions src/main/java/ganymedes01/etfuturum/ModBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public enum ModBlocks {
WEEPING_VINES(ConfigBlocksItems.enableCrimsonBlocks, new BlockWeepingVines()),
TWISTING_VINES(ConfigBlocksItems.enableWarpedBlocks, new BlockTwistingVines()),

SAPLING(ConfigBlocksItems.enableCherryBlocks && ConfigBlocksItems.enableMangroveBlocks, new BlockModernSapling(), ItemBlockModernSapling.class),
SAPLING(ConfigBlocksItems.enableCherryBlocks && ConfigBlocksItems.enableMangroveBlocks, new BlockModernSapling()),
LEAVES(ConfigBlocksItems.enableCherryBlocks && ConfigBlocksItems.enableMangroveBlocks, new BlockModernLeaves()),
WOOD_PLANKS(ConfigBlocksItems.woodVariants, new BlockModernWoodPlanks()),
WOOD_SLAB(ConfigBlocksItems.woodVariants, new BlockModernWoodSlab(false)),
Expand Down Expand Up @@ -494,7 +494,7 @@ public enum ModBlocks {
public static final ModBlocks[] VALUES = values();

public static void init() {
for (ModBlocks block : values()) {
for (ModBlocks block : VALUES) {
if (block.isEnabled()) {
if (block.getItemBlock() != null || !block.getHasItemBlock()) {
GameRegistry.registerBlock(block.get(), block.getItemBlock(), block.name().toLowerCase());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ganymedes01/etfuturum/ModItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public enum ModItems {
public static final ModItems[] VALUES = values();

public static void init() {
for (ModItems item : values()) {
for (ModItems item : VALUES) {
if (item.isEnabled()) { //Honestly what do you think it's doing lmfao
GameRegistry.registerItem(item.get(), item.name().toLowerCase());
}
Expand Down

This file was deleted.

17 changes: 8 additions & 9 deletions src/main/java/ganymedes01/etfuturum/core/utils/Rotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@ public enum Rotation {
COUNTERCLOCKWISE_90("rotate_270");//West

private final String name;
private static final String[] ROTATION_NAMES = new String[values().length];
public static final Rotation[] VALUES = values();
private static final String[] ROTATION_NAMES = new String[VALUES.length];

static {
int i = 0;
for (Rotation rotation : values()) {
ROTATION_NAMES[i++] = rotation.name;
}
}

Rotation(String nameIn) {
this.name = nameIn;
Expand Down Expand Up @@ -141,12 +148,4 @@ public int rotate(int p_185833_1_, int p_185833_2_) {
return p_185833_1_;
}
}

static {
int i = 0;

for (Rotation rotation : values()) {
ROTATION_NAMES[i++] = rotation.name;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public final ForgeDirection getFacingFromInt(int i) {
if (i < 0 || i > 3) {
throw new IllegalArgumentException("Facing int must be at least 0 and at most 3!");
}
return ForgeDirection.values()[i + 2];
return ForgeDirection.VALID_DIRECTIONS[i + 2];
}

public final int getIntFromFacing(ForgeDirection dir) {
Expand Down

0 comments on commit fec27be

Please sign in to comment.