Skip to content

Commit

Permalink
Merge pull request #42 from slprime/compressor_size
Browse files Browse the repository at this point in the history
Change Neutronium Compressor Ingredient Size View
  • Loading branch information
Dream-Master authored Oct 6, 2024
2 parents 734c439 + 5af0973 commit 0ab7937
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 21 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Add your dependencies here

dependencies {
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.14-GTNH:dev")
devOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.38-GTNH:dev")

compileOnly("com.github.GTNewHorizons:ForestryMC:4.9.7:api") {
transitive = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,40 +34,40 @@ public CompressionHandler() {

public class CachedCompression extends CachedRecipe {

private PositionedStack ingred;
private PositionedStack result;
private int cost;

public CachedCompression(CompressorRecipe recipe) {
this.ingred = new PositionedStack(recipe.getIngredient(), 51, 16);
this.result = new PositionedStack(recipe.getOutput(), 111, 16);
this.cost = recipe.getCost();
this(recipe.getOutput(), recipe.getCost(), recipe.getIngredient());
}

public CachedCompression(ItemStack output, int price, ItemStack ingredient) {
public CachedCompression(ItemStack output, int price, Object ingredient) {
this.ingred = new PositionedStack(ingredient, 51, 16);
this.result = new PositionedStack(output, 111, 16);
cost = price;
this.cost = price;
}

@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 48, Arrays.asList(ingred));
return getCycledIngredients(cycleticks / 48, Arrays.asList(this.ingred));
}

@Override
public PositionedStack getResult() {
return result;
return this.result;
}

public void computeVisuals() {
ingred.generatePermutations();
for (ItemStack item : this.ingred.items) item.stackSize = this.cost;
this.ingred.item.stackSize = this.cost;
this.ingred.generatePermutations();
}

public int getCost() {
return cost;
}

private int cost;

PositionedStack ingred;
PositionedStack result;
}

@Override
Expand Down Expand Up @@ -111,16 +111,19 @@ public void loadCraftingRecipes(ItemStack result) {

@Override
public void loadUsageRecipes(String inputId, Object... ingredients) {
if (inputId.equals("extreme_compression") && getClass() == CompressionHandler.class)
if (inputId.equals("extreme_compression") && getClass() == CompressionHandler.class) {
loadCraftingRecipes("extreme_compression");
else super.loadUsageRecipes(inputId, ingredients);
} else {
super.loadUsageRecipes(inputId, ingredients);
}
}

@Override
public void loadUsageRecipes(ItemStack ingredient) {
for (CompressorRecipe recipe : CompressorManager.getRecipes()) {
if (safeOre(recipe) && recipe.validInput(ingredient)) {
CachedCompression r = new CachedCompression(recipe.getOutput(), recipe.getCost(), ingredient);
r.computeVisuals();
arecipes.add(r);
}
}
Expand All @@ -136,12 +139,6 @@ public String getGuiTexture() {
return "avaritia:textures/gui/compressor.png";
}

@Override
public void drawForeground(int recipe) {
super.drawForeground(recipe);
fontRender.drawString(((CachedCompression) arecipes.get(recipe)).getCost() + "", 50, 38, 4210752);
}

@Override
public void drawExtras(int recipe) {
drawProgressBar(74, 15, 176, 14, 24, 16, 48, 0);
Expand Down

0 comments on commit 0ab7937

Please sign in to comment.