Compare commits

..

No commits in common. "14c42e6d5748e44cd62bfefa5bb111bcc1b3e5fb" and "38daf28115f246b1936be7ead77143df584e55ad" have entirely different histories.

8 changed files with 56 additions and 33 deletions

View file

@ -76,7 +76,7 @@ public class BlockPoweredFurnace extends DirectionalBlock.Container {
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return defaultBlockState().setValue(HORIZONTAL_FACING, context.getHorizontalDirection().getOpposite()).setValue(LIT, false); return defaultBlockState().setValue(HORIZONTAL_FACING, context.getNearestLookingDirection().getOpposite()).setValue(LIT, false);
} }
@Override @Override

View file

@ -22,7 +22,7 @@ public abstract class DirectionalBlock extends BlockBase {
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite());
} }
@Override @Override
@ -41,7 +41,7 @@ public abstract class DirectionalBlock extends BlockBase {
@Override @Override
public BlockState getStateForPlacement(BlockItemUseContext context) { public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.defaultBlockState().setValue(FACING, context.getHorizontalDirection().getOpposite()); return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite());
} }
@Override @Override

View file

@ -10,7 +10,6 @@
package de.ellpeck.actuallyadditions.mod.inventory; package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.crafting.SingleItem;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput; import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotOutput;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPoweredFurnace;
@ -25,7 +24,6 @@ import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType; import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import javax.annotation.Nonnull;
import java.util.Objects; import java.util.Objects;
public class ContainerFurnaceDouble extends Container { public class ContainerFurnaceDouble extends Container {
@ -55,9 +53,8 @@ public class ContainerFurnaceDouble extends Container {
return new ContainerFurnaceDouble(windowId, inv, (TileEntityPoweredFurnace) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos()))); return new ContainerFurnaceDouble(windowId, inv, (TileEntityPoweredFurnace) Objects.requireNonNull(inv.player.level.getBlockEntity(data.readBlockPos())));
} }
@Nonnull
@Override @Override
public ItemStack quickMoveStack(@Nonnull PlayerEntity player, int slot) { public ItemStack quickMoveStack(PlayerEntity player, int slot) {
int inventoryStart = 4; int inventoryStart = 4;
int inventoryEnd = inventoryStart + 26; int inventoryEnd = inventoryStart + 26;
int hotbarStart = inventoryEnd + 1; int hotbarStart = inventoryEnd + 1;
@ -79,7 +76,7 @@ public class ContainerFurnaceDouble extends Container {
//Other Slots in Inventory excluded //Other Slots in Inventory excluded
else if (slot >= inventoryStart) { else if (slot >= inventoryStart) {
// TODO: VALIDATE // TODO: VALIDATE
IRecipe<?> irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(newStack), this.furnace.getLevel()).orElse(null); IRecipe<?> irecipe = this.furnace.getLevel().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(newStack), this.furnace.getLevel()).orElse(null);
if (irecipe == null) { if (irecipe == null) {
return StackUtil.getEmpty(); return StackUtil.getEmpty();
} }
@ -124,7 +121,7 @@ public class ContainerFurnaceDouble extends Container {
} }
@Override @Override
public boolean stillValid(@Nonnull PlayerEntity player) { public boolean stillValid(PlayerEntity player) {
return this.furnace.canPlayerUse(player); return this.furnace.canPlayerUse(player);
} }
} }

View file

@ -30,7 +30,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils; import net.minecraftforge.fml.client.gui.GuiUtils;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.xml.soap.Text;
import java.util.Collections; import java.util.Collections;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -68,7 +67,6 @@ public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f); titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10; titleLabelY = -10;
this.buttonAutoSplit = new Buttons.SmallerButton(this.leftPos, this.topPos, new StringTextComponent("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0)); this.buttonAutoSplit = new Buttons.SmallerButton(this.leftPos, this.topPos, new StringTextComponent("S"), (button) -> PacketHandlerHelper.sendButtonPacket(this.tileFurnace, 0));
buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? TextFormatting.DARK_GREEN.getColor() : TextFormatting.RED.getColor());
this.addButton(this.buttonAutoSplit); this.addButton(this.buttonAutoSplit);
} }
@ -76,11 +74,21 @@ public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
@Override @Override
public void tick() { public void tick() {
super.tick(); super.tick();
buttonAutoSplit.setFGColor(this.tileFurnace.isAutoSplit ? TextFormatting.DARK_GREEN.getColor() : TextFormatting.RED.getColor());
this.buttonAutoSplit.setMessage(new StringTextComponent("S").withStyle(this.tileFurnace.isAutoSplit
? TextFormatting.DARK_GREEN
: TextFormatting.RED));
} }
// @Override
// protected void actionPerformed(Button button) throws IOException {
// if (button.id == 0) {
// PacketHandlerHelper.sendButtonPacket(this.tileFurnace, button.id);
// }
// }
@Override @Override
public void renderBg(@Nonnull MatrixStack matrices, float f, int x, int y) { public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION); this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);

View file

@ -33,7 +33,7 @@ public final class PacketHandlerHelper {
compound.putInt("X", pos.getX()); compound.putInt("X", pos.getX());
compound.putInt("Y", pos.getY()); compound.putInt("Y", pos.getY());
compound.putInt("Z", pos.getZ()); compound.putInt("Z", pos.getZ());
compound.putString("WorldID", tile.getLevel().dimension().location().toString()); compound.putString("WorldID", tile.getLevel().dimension().getRegistryName().toString());
compound.putInt("PlayerID", Minecraft.getInstance().player.getId()); compound.putInt("PlayerID", Minecraft.getInstance().player.getId());
compound.putInt("ButtonID", buttonId); compound.putInt("ButtonID", buttonId);
PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER)); PacketHandler.THE_NETWORK.sendToServer(new PacketClientToServer(compound, PacketHandler.GUI_BUTTON_TO_TILE_HANDLER));

View file

@ -103,7 +103,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
@Override @Override
public void updateEntity() { public void updateEntity() {
super.updateEntity(); super.updateEntity();
if (!level.isClientSide) { if (!this.level.isClientSide) {
boolean flag = this.currentBurnTime > 0; boolean flag = this.currentBurnTime > 0;
if (this.currentBurnTime > 0 && currentRecipe != null) { if (this.currentBurnTime > 0 && currentRecipe != null) {
@ -117,14 +117,16 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
if (!this.isRedstonePowered && this.currentBurnTime <= 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) { if (!this.isRedstonePowered && this.currentBurnTime <= 0 && this.storage.getEnergyStored() < this.storage.getMaxEnergyStored()) {
ItemStack stack = this.inv.getStackInSlot(0); ItemStack stack = this.inv.getStackInSlot(0);
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.stream().filter(r -> r.matches(stack)).findFirst().ifPresent(recipe -> { for (SolidFuelRecipe fuelRecipe : ActuallyAdditionsAPI.SOLID_FUEL_RECIPES) {
this.currentRecipe = recipe; if (fuelRecipe.matches(stack)) {
this.maxBurnTime = recipe.getBurnTime(); this.currentRecipe = fuelRecipe;
this.maxBurnTime = fuelRecipe.getBurnTime();
this.currentBurnTime = this.maxBurnTime; this.currentBurnTime = this.maxBurnTime;
this.inv.setStackInSlot(0, StackUtil.shrinkForContainer(stack, 1)); this.inv.setStackInSlot(0, StackUtil.shrinkForContainer(stack, 1));
}); break;
} else }
this.currentRecipe = null; }
}
} }
if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) { if (flag != this.currentBurnTime > 0 || this.lastCompare != this.getComparatorStrength()) {

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.SingleItem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFurnaceDouble;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA;
@ -26,7 +25,6 @@ import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
import net.minecraft.inventory.container.INamedContainerProvider; import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.AbstractCookingRecipe;
import net.minecraft.item.crafting.IRecipeType; import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.BlockStateProperties;
@ -39,7 +37,6 @@ import net.minecraftforge.common.util.Constants;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider { public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements IButtonReactor, INamedContainerProvider {
@ -186,7 +183,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
@Override @Override
public IAcceptor getAcceptor() { public IAcceptor getAcceptor() {
return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && StackUtil.isValid(level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new SingleItem(stack), this.level).map(AbstractCookingRecipe::getResultItem).orElse(ItemStack.EMPTY)); return (slot, stack, automation) -> !automation || (slot == SLOT_INPUT_1 || slot == SLOT_INPUT_2) && StackUtil.isValid(level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(stack), this.level).map(recipe -> recipe.getResultItem()).orElse(ItemStack.EMPTY));
} }
@Override @Override
@ -196,16 +193,19 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
public boolean canSmeltOn(int theInput, int theOutput) { public boolean canSmeltOn(int theInput, int theOutput) {
if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) {
ItemStack output = level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(this.inv.getStackInSlot(theInput)), this.level).map(AbstractCookingRecipe::getResultItem).orElse(ItemStack.EMPTY); ItemStack output = level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(this.inv.getStackInSlot(theInput)), this.level).map(recipe -> recipe.getResultItem()).orElse(ItemStack.EMPTY);
if (StackUtil.isValid(output)) { if (StackUtil.isValid(output)) {
return !StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).sameItem(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount(); if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput)) || this.inv.getStackInSlot(theOutput).sameItem(output) && this.inv.getStackInSlot(theOutput).getCount() <= this.inv.getStackInSlot(theOutput).getMaxStackSize() - output.getCount()) {
return true;
} }
} }
}
return false; return false;
} }
public void finishBurning(int theInput, int theOutput) { public void finishBurning(int theInput, int theOutput) {
ItemStack output = level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(this.inv.getStackInSlot(theInput)), this.level).map(AbstractCookingRecipe::getResultItem).orElse(ItemStack.EMPTY); ItemStack output = level.getServer().getRecipeManager().getRecipeFor(IRecipeType.SMELTING, new Inventory(this.inv.getStackInSlot(theInput)), this.level).map(recipe -> recipe.getResultItem()).orElse(ItemStack.EMPTY);
if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput))) { if (!StackUtil.isValid(this.inv.getStackInSlot(theOutput))) {
this.inv.setStackInSlot(theOutput, output.copy()); this.inv.setStackInSlot(theOutput, output.copy());
} else if (this.inv.getStackInSlot(theOutput).getItem() == output.getItem()) { } else if (this.inv.getStackInSlot(theOutput).getItem() == output.getItem()) {
@ -236,7 +236,6 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
return this.lazyEnergy; return this.lazyEnergy;
} }
@Nonnull
@Override @Override
public ITextComponent getDisplayName() { public ITextComponent getDisplayName() {
return new TranslationTextComponent("container.actuallyadditions.furnaceDouble"); return new TranslationTextComponent("container.actuallyadditions.furnaceDouble");
@ -244,7 +243,7 @@ public class TileEntityPoweredFurnace extends TileEntityInventoryBase implements
@Nullable @Nullable
@Override @Override
public Container createMenu(int windowId, @Nonnull PlayerInventory playerInventory, @Nonnull PlayerEntity player) { public Container createMenu(int windowId, PlayerInventory playerInventory, PlayerEntity player) {
return new ContainerFurnaceDouble(windowId, playerInventory, this); return new ContainerFurnaceDouble(windowId, playerInventory, this);
} }
} }

View file

@ -88,6 +88,23 @@
"item.banner.actuallyadditionsDrill.magenta": "Magenta Drill Pattern", "item.banner.actuallyadditionsDrill.magenta": "Magenta Drill Pattern",
"item.banner.actuallyadditionsDrill.orange": "Orange Drill Pattern", "item.banner.actuallyadditionsDrill.orange": "Orange Drill Pattern",
"item.banner.actuallyadditionsDrill.white": "White Drill Pattern", "item.banner.actuallyadditionsDrill.white": "White Drill Pattern",
"_comment": "NEI Integration",
"container.nei.actuallyadditions.crushing": "Crusher",
"container.nei.actuallyadditions.crushingDouble": "Double Crusher",
"container.nei.actuallyadditions.ballOfHair": "Ball Of Fur Usage",
"container.nei.actuallyadditions.compost": "Compost",
"container.nei.actuallyadditions.furnaceDouble": "Powered Furnace",
"container.nei.actuallyadditions.treasureChest": "Treasure Chest",
"container.nei.actuallyadditions.treasureChest.info": "Items at",
"container.nei.actuallyadditions.coffee": "Coffee Maker",
"container.nei.actuallyadditions.coffee.special": "Special Feature",
"container.nei.actuallyadditions.coffee.maxAmount": "Max Amount",
"container.nei.actuallyadditions.coffee.extra.milk": "+01:00, -1 Level",
"container.nei.actuallyadditions.reconstructor": "Atomic Reconstructor",
"container.nei.actuallyadditions.empowerer": "Empowerer",
"container.nei.actuallyadditions.booklet": "Actually Additions Manual",
"container.nei.actuallyadditions.booklet.header": "The <item>Actually Additions Manual<r> says:",
"container.nei.actuallyadditions.booklet.noText": "Nothing, apparently! But that doesn't matter. Just click the button on the bottom to see the item inside the booklet and look through its pages to find some fancy stuff!",
"_comment": "Damage Sources", "_comment": "Damage Sources",
"death.actuallyadditions.atomicReconstructor.1": "%s got atomically reconstructed.", "death.actuallyadditions.atomicReconstructor.1": "%s got atomically reconstructed.",
"death.actuallyadditions.atomicReconstructor.2": "The Atomic Reconstructor caught %s in its sight.", "death.actuallyadditions.atomicReconstructor.2": "The Atomic Reconstructor caught %s in its sight.",
@ -106,7 +123,7 @@
"block.actuallyadditions.giant_chest_large": "Large Storage Crate", "block.actuallyadditions.giant_chest_large": "Large Storage Crate",
"block.actuallyadditions.crusher": "Crusher", "block.actuallyadditions.crusher": "Crusher",
"block.actuallyadditions.double_crusher": "Double Crusher", "block.actuallyadditions.double_crusher": "Double Crusher",
"block.actuallyadditions.powered_furnace": "Powered Furnace", "block.actuallyadditions.furnace_double": "Powered Furnace",
"block.actuallyadditions.fishing_net": "Fishing Net", "block.actuallyadditions.fishing_net": "Fishing Net",
"block.actuallyadditions.furnace_solar": "Solar Panel", "block.actuallyadditions.furnace_solar": "Solar Panel",
"block.actuallyadditions.heat_collector": "Heat Collector", "block.actuallyadditions.heat_collector": "Heat Collector",