Removed color provider
This commit is contained in:
parent
2c8862a37b
commit
4040597a6d
475 changed files with 5411 additions and 7521 deletions
|
@ -26,30 +26,29 @@ import ru.betterend.client.gui.slot.SmelterOutputSlot;
|
|||
import ru.betterend.recipe.builders.AlloyingRecipe;
|
||||
|
||||
public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> {
|
||||
|
||||
public final static MenuType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(
|
||||
BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
|
||||
|
||||
|
||||
public final static MenuType<EndStoneSmelterScreenHandler> HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(BetterEnd.makeID(EndStoneSmelter.ID), EndStoneSmelterScreenHandler::new);
|
||||
|
||||
private final Container inventory;
|
||||
private final ContainerData propertyDelegate;
|
||||
protected final Level world;
|
||||
|
||||
|
||||
public EndStoneSmelterScreenHandler(int syncId, Inventory playerInventory) {
|
||||
this(syncId, playerInventory, new SimpleContainer(4), new SimpleContainerData(4));
|
||||
}
|
||||
|
||||
|
||||
public EndStoneSmelterScreenHandler(int syncId, Inventory playerInventory, Container inventory, ContainerData propertyDelegate) {
|
||||
super(HANDLER_TYPE, syncId);
|
||||
this.inventory = inventory;
|
||||
this.propertyDelegate = propertyDelegate;
|
||||
this.world = playerInventory.player.level;
|
||||
|
||||
|
||||
addDataSlots(propertyDelegate);
|
||||
addSlot(new Slot(inventory, 0, 45, 17));
|
||||
addSlot(new Slot(inventory, 1, 67, 17));
|
||||
addSlot(new SmelterFuelSlot(this, inventory, 2, 56, 53));
|
||||
addSlot(new SmelterOutputSlot(playerInventory.player, inventory, 3, 129, 35));
|
||||
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 9; ++j) {
|
||||
addSlot(new Slot(playerInventory, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
|
@ -59,77 +58,77 @@ public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> {
|
|||
addSlot(new Slot(playerInventory, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MenuType<?> getType() {
|
||||
return HANDLER_TYPE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fillCraftSlotsStackedContents(StackedContents finder) {
|
||||
if (inventory instanceof StackedContentsCompatible) {
|
||||
((StackedContentsCompatible) inventory).fillStackedContents(finder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void clearCraftingContent() {
|
||||
inventory.clearContent();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean recipeMatches(Recipe<? super Container> recipe) {
|
||||
return recipe.matches(inventory, world);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getResultSlotIndex() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getGridWidth() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getGridHeight() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getSize() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public RecipeBookType getRecipeBookType() {
|
||||
return RecipeBookType.BLAST_FURNACE;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean shouldMoveToInventory(int i) {
|
||||
return i != this.getResultSlotIndex();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean stillValid(Player player) {
|
||||
return inventory.stillValid(player);
|
||||
}
|
||||
|
||||
|
||||
protected boolean isSmeltable(ItemStack itemStack) {
|
||||
return world.getRecipeManager().getRecipeFor(AlloyingRecipe.TYPE, new SimpleContainer(itemStack), world).isPresent();
|
||||
}
|
||||
|
||||
|
||||
public boolean isFuel(ItemStack itemStack) {
|
||||
return EndStoneSmelterBlockEntity.canUseAsFuel(itemStack);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ItemStack quickMoveStack(Player player, int index) {
|
||||
Slot slot = slots.get(index);
|
||||
if (slot == null || !slot.hasItem()) return ItemStack.EMPTY;
|
||||
|
||||
|
||||
ItemStack slotStack = slot.getItem();
|
||||
ItemStack itemStack = slotStack.copy();
|
||||
if (index == 3) {
|
||||
|
@ -161,30 +160,30 @@ public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> {
|
|||
else if (!moveItemStackTo(slotStack, 4, 40, false)) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
if (slotStack.isEmpty()) {
|
||||
slot.set(ItemStack.EMPTY);
|
||||
}
|
||||
else {
|
||||
slot.setChanged();
|
||||
}
|
||||
|
||||
|
||||
if (slotStack.getCount() == itemStack.getCount()) {
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
|
||||
slot.onTake(player, slotStack);
|
||||
|
||||
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public int getSmeltProgress() {
|
||||
int time = propertyDelegate.get(2);
|
||||
int timeTotal = propertyDelegate.get(3);
|
||||
return timeTotal != 0 && time != 0 ? time * 24 / timeTotal : 0;
|
||||
}
|
||||
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public int getFuelProgress() {
|
||||
int fuelTime = propertyDelegate.get(1);
|
||||
|
@ -193,7 +192,7 @@ public class EndStoneSmelterScreenHandler extends RecipeBookMenu<Container> {
|
|||
}
|
||||
return propertyDelegate.get(0) * 13 / fuelTime;
|
||||
}
|
||||
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public boolean isBurning() {
|
||||
return propertyDelegate.get(0) > 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue