Skip to content

Commit

Permalink
Autoformat and optimize imports
Browse files Browse the repository at this point in the history
Signed-off-by: Noaaan <noaaan@hotmail.com>
  • Loading branch information
Noaaan committed Dec 9, 2023
1 parent eff1243 commit 1172465
Show file tree
Hide file tree
Showing 37 changed files with 130 additions and 189 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ArrayPropertyDelegate;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.*;
import net.minecraft.screen.slot.Slot;
import wraith.alloyforgery.block.ForgeControllerBlockEntity;
import wraith.alloyforgery.forges.ForgeFuelRegistry;
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/wraith/alloyforgery/AlloyForgery.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
import wraith.alloyforgery.data.RecipeTagLoader;
import wraith.alloyforgery.forges.ForgeRegistry;
import wraith.alloyforgery.forges.FuelDataLoader;
import wraith.alloyforgery.recipe.AlloyForgeRecipe;
import wraith.alloyforgery.recipe.AlloyForgeRecipeSerializer;
import wraith.alloyforgery.recipe.BlastFurnaceRecipeAdapter;
import wraith.alloyforgery.recipe.*;
import wraith.alloyforgery.utils.RecipeInjector;

public class AlloyForgery implements ModInitializer {
Expand Down
5 changes: 1 addition & 4 deletions src/main/java/wraith/alloyforgery/AlloyForgeryItemGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import net.minecraft.text.Text;
import wraith.alloyforgery.block.ForgeControllerBlock;
import wraith.alloyforgery.forges.ForgeRegistry;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.*;

public class AlloyForgeryItemGroup {

Expand Down
1 change: 0 additions & 1 deletion src/main/java/wraith/alloyforgery/ForgeControllerItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import org.jetbrains.annotations.Nullable;
import wraith.alloyforgery.block.ForgeControllerBlock;
import wraith.alloyforgery.forges.ForgeDefinition;

import java.util.List;

public class ForgeControllerItem extends BlockItem {
Expand Down
13 changes: 3 additions & 10 deletions src/main/java/wraith/alloyforgery/block/ForgeControllerBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,15 @@
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.transfer.v1.fluid.FluidStorageUtil;
import net.minecraft.block.*;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityTicker;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.state.property.*;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Formatting;
import net.minecraft.util.Hand;
import net.minecraft.util.ItemScatterer;
import net.minecraft.util.*;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,28 @@
import net.fabricmc.fabric.api.transfer.v1.transaction.TransactionContext;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.block.entity.HopperBlockEntity;
import net.minecraft.block.entity.*;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.fluid.Fluids;
import net.minecraft.inventory.Inventories;
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.*;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
import net.minecraft.util.ItemScatterer;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.*;
import org.jetbrains.annotations.Nullable;
import wraith.alloyforgery.AlloyForgeScreenHandler;
import wraith.alloyforgery.AlloyForgery;
import wraith.alloyforgery.forges.ForgeDefinition;
import wraith.alloyforgery.forges.ForgeFuelRegistry;
import wraith.alloyforgery.forges.ForgeRegistry;
import wraith.alloyforgery.forges.*;
import wraith.alloyforgery.mixin.HopperBlockEntityAccessor;
import wraith.alloyforgery.recipe.AlloyForgeRecipe;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Optional;
import java.util.*;

@SuppressWarnings("UnstableApiUsage")
public class ForgeControllerBlockEntity extends BlockEntity implements ImplementedInventory, SidedInventory, NamedScreenHandlerFactory, InsertionOnlyStorage<FluidVariant> {
Expand Down Expand Up @@ -155,7 +143,7 @@ public int getCurrentSmeltTime() {
return currentSmeltTime;
}

public ForgeDefinition getForgeDefinition(){
public ForgeDefinition getForgeDefinition() {
return this.forgeDefinition;
}

Expand Down Expand Up @@ -228,7 +216,7 @@ public void tick() {
// 1: Check if the inventory is full
// 2: Prevent crafting when we know that there is not enough fuel to craft at all
// 3: Prevent recipe checking if the inventory has not changed
if(this.isEmpty()){
if (this.isEmpty()) {
this.currentSmeltTime = 0;

return;
Expand All @@ -242,11 +230,11 @@ public void tick() {

//--

if(this.recipeCache.isEmpty() || !this.recipeCache.get().matches(this, this.world)) {
if (this.recipeCache.isEmpty() || !this.recipeCache.get().matches(this, this.world)) {
this.recipeCache = this.world.getRecipeManager().getFirstMatch(AlloyForgeRecipe.Type.INSTANCE, this, this.world);
}

if(this.recipeCache.isEmpty() && this.requiredTierToCraft != -1){
if (this.recipeCache.isEmpty() && this.requiredTierToCraft != -1) {
this.requiredTierToCraft = -1;
}

Expand Down Expand Up @@ -294,15 +282,15 @@ public void tick() {
}
}

private boolean canSmelt(AlloyForgeRecipe recipe){
private boolean canSmelt(AlloyForgeRecipe recipe) {
final var outputStack = this.getStack(10);
final var recipeOutput = recipe.getOutput(this.forgeDefinition.forgeTier());

if(recipe.getMinForgeTier() > this.forgeDefinition.forgeTier()){
if (recipe.getMinForgeTier() > this.forgeDefinition.forgeTier()) {
this.requiredTierToCraft = recipe.getMinForgeTier();

return false;
} else if(requiredTierToCraft != -1){
} else if (requiredTierToCraft != -1) {
this.requiredTierToCraft = -1;
}

Expand All @@ -315,7 +303,7 @@ private void handleForgingRemainders(DefaultedList<ItemStack> remainderList) {
}
}

public void attemptInsertOnIndex(int i, ItemStack itemstack){
public void attemptInsertOnIndex(int i, ItemStack itemstack) {
if (itemstack.isEmpty()) return;

var slotStack = this.getStack(i);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package wraith.alloyforgery.block;

import net.minecraft.item.ItemStack;

import java.util.List;

public class ItemStackComparisonUtil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.text.Text;
import wraith.alloyforgery.AlloyForgeScreenHandler;
import wraith.alloyforgery.AlloyForgery;

import java.util.List;

public class AlloyForgeScreen extends BaseUIModelHandledScreen<FlowLayout, AlloyForgeScreenHandler> {
Expand Down Expand Up @@ -48,11 +47,11 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {

int requiredTier = this.handler.getRequiredTierData();

if(requiredTier <= -1) {
if (requiredTier <= -1) {
this.invalidCross
.visibleArea(PositionedRectangle.of(0, 0, 0, 0))
.tooltip(List.<TooltipComponent>of());
} else{
} else {
this.invalidCross
.resetVisibleArea()
.tooltip(Text.translatable("tooltip.alloy_forgery.invalid_tier", requiredTier));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package wraith.alloyforgery.client;

import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.api.*;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import wraith.alloyforgery.AlloyForgery;
import wraith.alloyforgery.data.RecipeTagLoader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import net.minecraft.util.Identifier;
import wraith.alloyforgery.AlloyForgery;

import java.util.HashMap;
import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.jetbrains.annotations.Nullable;
import wraith.alloyforgery.AlloyForgery;
import wraith.alloyforgery.recipe.AlloyForgeRecipe;

import java.util.*;

public class AlloyForgeryEmiRecipe implements EmiRecipe {
Expand All @@ -31,7 +30,7 @@ public class AlloyForgeryEmiRecipe implements EmiRecipe {

private final Identifier recipeID;

public AlloyForgeryEmiRecipe(AlloyForgeRecipe recipe){
public AlloyForgeryEmiRecipe(AlloyForgeRecipe recipe) {
//Convert inputs to a list of EMI Ingredients
List<EmiIngredient> convertedInputs = new ArrayList<>();
for (Map.Entry<Ingredient, Integer> entry : recipe.getIngredientsMap().entrySet()) {
Expand Down Expand Up @@ -110,7 +109,7 @@ public void addWidgets(WidgetHolder widgets) {
})));
}

private static OrderedText minTierText(Object tierArg){
private static OrderedText minTierText(Object tierArg) {
return Text.translatable("container.alloy_forgery.rei.min_tier", tierArg).asOrderedText();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraft.screen.slot.Slot;
import org.jetbrains.annotations.Nullable;
import wraith.alloyforgery.AlloyForgeScreenHandler;

import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package wraith.alloyforgery.compat.emi;

import com.mojang.blaze3d.systems.RenderSystem;
import dev.emi.emi.api.widget.Bounds;
import dev.emi.emi.api.widget.ButtonWidget;
import dev.emi.emi.api.widget.Widget;
import dev.emi.emi.api.widget.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.tooltip.TooltipComponent;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;

import java.util.List;
import java.util.function.BooleanSupplier;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package wraith.alloyforgery.compat.emi;

import dev.emi.emi.api.widget.Bounds;
import dev.emi.emi.api.widget.TextWidget;
import dev.emi.emi.api.widget.Widget;
import dev.emi.emi.api.widget.*;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.text.OrderedText;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void registerCategories(CategoryRegistry registry) {
@Override
public void registerScreens(ScreenRegistry registry) {
registry.registerClickArea(screen -> {
if(screen.getScreenHandler().getRequiredTierData() > -1) return new Rectangle();
if (screen.getScreenHandler().getRequiredTierData() > -1) return new Rectangle();

return new Rectangle(screen.rootX() + 142, screen.rootY() + 20, 21, 24);
}, AlloyForgeScreen.class, AlloyForgeryCommonPlugin.ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import me.shedaniel.rei.api.common.transfer.info.stack.SlotAccessor;
import net.minecraft.inventory.Inventory;
import wraith.alloyforgery.AlloyForgeScreenHandler;

import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import wraith.alloyforgery.AlloyForgery;
import wraith.alloyforgery.forges.ForgeRegistry;
import wraith.alloyforgery.recipe.AlloyForgeRecipe;

import java.util.ArrayList;
import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,10 @@
import me.shedaniel.rei.api.common.entry.EntryIngredient;
import me.shedaniel.rei.api.common.util.EntryIngredients;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.*;
import net.minecraft.recipe.Ingredient;
import net.minecraft.util.Identifier;
import wraith.alloyforgery.recipe.AlloyForgeRecipe;

import java.util.*;

public class AlloyForgingDisplay implements Display {
Expand All @@ -40,7 +37,7 @@ private AlloyForgingDisplay(List<EntryIngredient> inputs, EntryIngredient output
this.recipeID = recipeID;
}

public static AlloyForgingDisplay of(AlloyForgeRecipe recipe){
public static AlloyForgingDisplay of(AlloyForgeRecipe recipe) {
List<EntryIngredient> convertedInputs = new ArrayList<>();

for (Map.Entry<Ingredient, Integer> entry : recipe.getIngredientsMap().entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.slf4j.Logger;
import wraith.alloyforgery.AlloyForgery;
import wraith.alloyforgery.recipe.AlloyForgeRecipe;

import java.util.HashMap;
import java.util.Map;

Expand All @@ -32,7 +31,7 @@ public AlloyForgeryGlobalRemaindersLoader() {
protected void apply(Map<Identifier, JsonElement> prepared, ResourceManager manager, Profiler profiler) {
prepared.forEach((identifier, jsonElement) -> {
try {
if(jsonElement instanceof JsonObject jsonObject){
if (jsonElement instanceof JsonObject jsonObject) {
var remainders = new HashMap<Item, ItemStack>();

for (var remainderEntry : JsonHelper.getObject(jsonObject, "remainders").entrySet()) {
Expand Down
Loading

0 comments on commit 1172465

Please sign in to comment.