Style fixes

This commit is contained in:
thedarkcolour 2026-05-31 21:31:11 -07:00
parent bec66622a0
commit a5d25a09f7
9 changed files with 45 additions and 46 deletions

View File

@ -229,7 +229,7 @@ public class MechanicalHammerBlockEntity extends AbstractMachineBlockEntity<Mech
@Override @Override
public boolean isItemValid(int slot, ItemStack stack) { public boolean isItemValid(int slot, ItemStack stack) {
if (slot == INPUT_SLOT) { if (slot == INPUT_SLOT) {
return hammer.getRecipeCaches().getHammerRecipe(stack.getItem()) != null; return this.hammer.getRecipeCaches().getHammerRecipe(stack.getItem()) != null;
} else if (slot == HAMMER_SLOT) { } else if (slot == HAMMER_SLOT) {
return stack.is(EItemTags.HAMMERS); return stack.is(EItemTags.HAMMERS);
} else { } else {

View File

@ -184,7 +184,7 @@ public class MechanicalSieveBlockEntity extends AbstractMachineBlockEntity<Mecha
@Override @Override
public boolean isItemValid(int slot, ItemStack stack) { public boolean isItemValid(int slot, ItemStack stack) {
if (slot == INPUT_SLOT) { if (slot == INPUT_SLOT) {
return !sieve.getRecipeCaches().getSieveRecipes(getStackInSlot(1).getItem(), stack).isEmpty(); return !this.sieve.getRecipeCaches().getSieveRecipes(getStackInSlot(1).getItem(), stack).isEmpty();
} else if (slot == MESH_SLOT) { } else if (slot == MESH_SLOT) {
return stack.is(EItemTags.SIEVE_MESHES); return stack.is(EItemTags.SIEVE_MESHES);
} else { } else {

View File

@ -1,7 +1,6 @@
package thedarkcolour.exdeorum.blockentity.logic; package thedarkcolour.exdeorum.blockentity.logic;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import thedarkcolour.exdeorum.recipe.RecipeUtil;
import thedarkcolour.exdeorum.recipe.sieve.SieveRecipe; import thedarkcolour.exdeorum.recipe.sieve.SieveRecipe;
import java.util.List; import java.util.List;
@ -13,6 +12,6 @@ public class CompressedSieveLogic extends SieveLogic {
@Override @Override
protected List<? extends SieveRecipe> getDropsFor(ItemStack contents) { protected List<? extends SieveRecipe> getDropsFor(ItemStack contents) {
return owner.getRecipeCaches().getCompressedSieveRecipes(this.mesh.getItem(), contents); return this.owner.getRecipeCaches().getCompressedSieveRecipes(this.mesh.getItem(), contents);
} }
} }

View File

@ -130,7 +130,7 @@ public class SieveLogic {
} }
protected List<? extends SieveRecipe> getDropsFor(ItemStack contents) { protected List<? extends SieveRecipe> getDropsFor(ItemStack contents) {
return owner.getRecipeCaches().getSieveRecipes(this.mesh.getItem(), contents); return this.owner.getRecipeCaches().getSieveRecipes(this.mesh.getItem(), contents);
} }
protected int getResultAmount(SieveRecipe recipe, LootContext context, RandomSource rand) { protected int getResultAmount(SieveRecipe recipe, LootContext context, RandomSource rand) {

View File

@ -71,7 +71,8 @@ public class ClientHandler {
fmlBus.addListener(ClientHandler::onPlayerRespawn); fmlBus.addListener(ClientHandler::onPlayerRespawn);
fmlBus.addListener(ClientHandler::onPlayerLogout); fmlBus.addListener(ClientHandler::onPlayerLogout);
fmlBus.addListener(ClientHandler::onScreenOpen); fmlBus.addListener(ClientHandler::onScreenOpen);
fmlBus.addListener(EventPriority.HIGHEST, ClientHandler::onRecipesUpdated); // We need to be at HIGH or HIGHEST to be called before JEI // we need to be at HIGH or HIGHEST to be called before JEI
fmlBus.addListener(EventPriority.HIGHEST, ClientHandler::onRecipesUpdated);
if (ModList.get().isLoaded(ModIds.JEI) || ModList.get().isLoaded(ModIds.EMI)) { if (ModList.get().isLoaded(ModIds.JEI) || ModList.get().isLoaded(ModIds.EMI)) {
modBus.addListener(ClientHandler::registerAdditionalModels); modBus.addListener(ClientHandler::registerAdditionalModels);

View File

@ -29,7 +29,6 @@ public class ClientsideCode {
private static final RecipeCaches RECIPE_CACHES = new RecipeCaches(); private static final RecipeCaches RECIPE_CACHES = new RecipeCaches();
public static RecipeCaches getRecipeCaches() { public static RecipeCaches getRecipeCaches() {
assert EffectiveSide.get().isClient() : Thread.currentThread().getName();
return RECIPE_CACHES; return RECIPE_CACHES;
} }

View File

@ -44,7 +44,7 @@ public class CycleTimer {
public void onDraw() { public void onDraw() {
if (!Screen.hasShiftDown()) { if (!Screen.hasShiftDown()) {
if (pausedDuration > 0) { if (this.pausedDuration > 0) {
this.startTime += this.pausedDuration; this.startTime += this.pausedDuration;
this.pausedDuration = 0; this.pausedDuration = 0;
} }

View File

@ -75,7 +75,7 @@ class SieveCategory implements IRecipeCategory<XeiSieveRecipe> {
@Override @Override
public int getHeight() { public int getHeight() {
return XeiUtil.SIEVE_ROW_START + XeiUtil.SIEVE_ROW_HEIGHT * rows.intValue(); return XeiUtil.SIEVE_ROW_START + XeiUtil.SIEVE_ROW_HEIGHT * this.rows.intValue();
} }
@Override @Override

View File

@ -41,60 +41,60 @@ public class RecipeCaches {
private CrucibleHeatRecipeCache crucibleHeatRecipeCache; private CrucibleHeatRecipeCache crucibleHeatRecipeCache;
public List<SieveRecipe> getSieveRecipes(Item mesh, ItemStack item) { public List<SieveRecipe> getSieveRecipes(Item mesh, ItemStack item) {
return sieveRecipeCache.getRecipe(mesh, item); return this.sieveRecipeCache.getRecipe(mesh, item);
} }
public List<CompressedSieveRecipe> getCompressedSieveRecipes(Item mesh, ItemStack item) { public List<CompressedSieveRecipe> getCompressedSieveRecipes(Item mesh, ItemStack item) {
return compressedSieveRecipeCache.getRecipe(mesh, item); return this.compressedSieveRecipeCache.getRecipe(mesh, item);
} }
@Nullable @Nullable
public CrucibleRecipe getLavaCrucibleRecipe(ItemStack item) { public CrucibleRecipe getLavaCrucibleRecipe(ItemStack item) {
return lavaCrucibleRecipeCache.getRecipe(item); return this.lavaCrucibleRecipeCache.getRecipe(item);
} }
@Nullable @Nullable
public CrucibleRecipe getWaterCrucibleRecipe(ItemStack item) { public CrucibleRecipe getWaterCrucibleRecipe(ItemStack item) {
return waterCrucibleRecipeCache.getRecipe(item); return this.waterCrucibleRecipeCache.getRecipe(item);
} }
@Nullable @Nullable
public BarrelCompostRecipe getBarrelCompostRecipe(ItemStack item) { public BarrelCompostRecipe getBarrelCompostRecipe(ItemStack item) {
return barrelCompostRecipeCache.getRecipe(item); return this.barrelCompostRecipeCache.getRecipe(item);
} }
@Nullable @Nullable
public HammerRecipe getHammerRecipe(Item item) { public HammerRecipe getHammerRecipe(Item item) {
return hammerRecipeCache.getRecipe(item); return this.hammerRecipeCache.getRecipe(item);
} }
public Collection<RecipeHolder<HammerRecipe>> getCachedHammerRecipes() { public Collection<RecipeHolder<HammerRecipe>> getCachedHammerRecipes() {
return hammerRecipeCache.getAllRecipes(); return this.hammerRecipeCache.getAllRecipes();
} }
@Nullable @Nullable
public CompressedHammerRecipe getCompressedHammerRecipe(Item item) { public CompressedHammerRecipe getCompressedHammerRecipe(Item item) {
return compressedHammerRecipeCache.getRecipe(item); return this.compressedHammerRecipeCache.getRecipe(item);
} }
public Collection<RecipeHolder<CompressedHammerRecipe>> getCachedCompressedHammerRecipes() { public Collection<RecipeHolder<CompressedHammerRecipe>> getCachedCompressedHammerRecipes() {
return compressedHammerRecipeCache.getAllRecipes(); return this.compressedHammerRecipeCache.getAllRecipes();
} }
public List<CrookRecipe> getCrookRecipes(BlockState state) { public List<CrookRecipe> getCrookRecipes(BlockState state) {
return crookRecipeCache.getRecipes(state); return this.crookRecipeCache.getRecipes(state);
} }
public boolean isCompostable(ItemStack stack) { public boolean isCompostable(ItemStack stack) {
return barrelCompostRecipeCache != null && barrelCompostRecipeCache.getRecipe(stack) != null; return this.barrelCompostRecipeCache != null && this.barrelCompostRecipeCache.getRecipe(stack) != null;
} }
public int getHeatValue(BlockState state) { public int getHeatValue(BlockState state) {
return crucibleHeatRecipeCache.getValue(state); return this.crucibleHeatRecipeCache.getValue(state);
} }
public ObjectSet<Object2IntMap.Entry<BlockState>> getHeatSources() { public ObjectSet<Object2IntMap.Entry<BlockState>> getHeatSources() {
return crucibleHeatRecipeCache.getEntries(); return this.crucibleHeatRecipeCache.getEntries();
} }
// todo stop using the RecipeManager // todo stop using the RecipeManager
@ -111,7 +111,7 @@ public class RecipeCaches {
@Nullable @Nullable
public BarrelFluidMixingRecipe getFluidMixingRecipe(FluidStack base, Fluid additive) { public BarrelFluidMixingRecipe getFluidMixingRecipe(FluidStack base, Fluid additive) {
var recipe = barrelFluidMixingRecipeCache.getRecipe(base.getFluid(), additive); var recipe = this.barrelFluidMixingRecipeCache.getRecipe(base.getFluid(), additive);
if (recipe != null && base.getAmount() >= recipe.baseFluid().amount()) { if (recipe != null && base.getAmount() >= recipe.baseFluid().amount()) {
return recipe; return recipe;
} else { } else {
@ -122,37 +122,37 @@ public class RecipeCaches {
@Nullable @Nullable
public FluidTransformationRecipe getFluidTransformationRecipe(Fluid baseFluid, BlockState catalystState) { public FluidTransformationRecipe getFluidTransformationRecipe(Fluid baseFluid, BlockState catalystState) {
if (baseFluid != Fluids.EMPTY) { if (baseFluid != Fluids.EMPTY) {
return fluidTransformationRecipeCache.getRecipe(baseFluid, catalystState); return this.fluidTransformationRecipeCache.getRecipe(baseFluid, catalystState);
} else { } else {
return null; return null;
} }
} }
public void reload(RecipeManager recipes) { public void reload(RecipeManager recipes) {
barrelCompostRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.BARREL_COMPOST); this.barrelCompostRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.BARREL_COMPOST);
lavaCrucibleRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.LAVA_CRUCIBLE); this.lavaCrucibleRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.LAVA_CRUCIBLE);
waterCrucibleRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.WATER_CRUCIBLE); this.waterCrucibleRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.WATER_CRUCIBLE);
hammerRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.HAMMER).trackAllRecipes(); this.hammerRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.HAMMER).trackAllRecipes();
compressedHammerRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.COMPRESSED_HAMMER).trackAllRecipes(); this.compressedHammerRecipeCache = new SingleIngredientRecipeCache<>(recipes, ERecipeTypes.COMPRESSED_HAMMER).trackAllRecipes();
sieveRecipeCache = new SieveRecipeCache<>(recipes, ERecipeTypes.SIEVE); this.sieveRecipeCache = new SieveRecipeCache<>(recipes, ERecipeTypes.SIEVE);
compressedSieveRecipeCache = new SieveRecipeCache<>(recipes, ERecipeTypes.COMPRESSED_SIEVE); this.compressedSieveRecipeCache = new SieveRecipeCache<>(recipes, ERecipeTypes.COMPRESSED_SIEVE);
barrelFluidMixingRecipeCache = new BarrelFluidMixingRecipeCache(recipes); this.barrelFluidMixingRecipeCache = new BarrelFluidMixingRecipeCache(recipes);
fluidTransformationRecipeCache = new FluidTransformationRecipeCache(recipes); this.fluidTransformationRecipeCache = new FluidTransformationRecipeCache(recipes);
crookRecipeCache = new CrookRecipeCache(recipes); this.crookRecipeCache = new CrookRecipeCache(recipes);
crucibleHeatRecipeCache = new CrucibleHeatRecipeCache(recipes); this.crucibleHeatRecipeCache = new CrucibleHeatRecipeCache(recipes);
} }
public void unload() { public void unload() {
barrelCompostRecipeCache = null; this.barrelCompostRecipeCache = null;
lavaCrucibleRecipeCache = null; this.lavaCrucibleRecipeCache = null;
waterCrucibleRecipeCache = null; this.waterCrucibleRecipeCache = null;
hammerRecipeCache = null; this.hammerRecipeCache = null;
compressedHammerRecipeCache = null; this.compressedHammerRecipeCache = null;
sieveRecipeCache = null; this.sieveRecipeCache = null;
compressedSieveRecipeCache = null; this.compressedSieveRecipeCache = null;
barrelFluidMixingRecipeCache = null; this.barrelFluidMixingRecipeCache = null;
fluidTransformationRecipeCache = null; this.fluidTransformationRecipeCache = null;
crookRecipeCache = null; this.crookRecipeCache = null;
crucibleHeatRecipeCache = null; this.crucibleHeatRecipeCache = null;
} }
} }