More porting, cleaning up ui code.

Coal generator seems to work...
This commit is contained in:
Flanks255 2021-12-28 20:36:23 -06:00
parent 4cb639a94a
commit c6c232d648
67 changed files with 251 additions and 186 deletions

View file

@ -710,8 +710,9 @@ a63b57c27d8548ddd13d64d18b098d4f5c127a30 data/actuallyadditions/recipes/restonia
85d2537a973d520c9eaaf2f15109c265faa2df3a data/actuallyadditions/recipes/rice_slime_potion.json
d4ca5d77d16ff6fdfc60e665694fdd97bce25463 data/actuallyadditions/recipes/shock_suppressor.json
655fab699bb97ec252deb61d91fbef6f4738fe1c data/actuallyadditions/recipes/single_battery.json
f4b41a12da3d0d24f155a6fb0fc170eeea9947b0 data/actuallyadditions/recipes/solid_fuel/charcoal.json
ddae8379266c710a96811ab1d68bfb9973db7515 data/actuallyadditions/recipes/solid_fuel/coal.json
8cb9b0e94a5de6e0bb74d808207ddf041d444280 data/actuallyadditions/recipes/solid_fuel/charcoal.json
3a4c2b0ca2e150ef24edb2defe018f6574cb4827 data/actuallyadditions/recipes/solid_fuel/coal.json
9d2105a32a4781f3fd10a70f97ba243b1c0ceb34 data/actuallyadditions/recipes/solid_fuel/stick.json
8ebd738f3968564e22ba6841eb821e5064c78588 data/actuallyadditions/recipes/stone_aiot.json
bc7a41d9f36cc43e146e0b727b6f439cc0d29343 data/actuallyadditions/recipes/teleport_staff.json
bdf7dbf563485903e444400d341e56d0bf308481 data/actuallyadditions/recipes/tiny_torch.json

View file

@ -3,6 +3,6 @@
"item": {
"item": "minecraft:charcoal"
},
"total_energy": 1600,
"burn_time": 48000
"total_energy": 48000,
"burn_time": 1600
}

View file

@ -3,6 +3,6 @@
"item": {
"item": "minecraft:coal"
},
"total_energy": 1600,
"burn_time": 48000
"total_energy": 48000,
"burn_time": 1600
}

View file

@ -29,16 +29,17 @@ public class SolidFuelGenerator extends RecipeProvider {
@Override
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) {
addFuel(consumer, "coal", Items.COAL, 48000, 1600);
addFuel(consumer, "stick", Items.STICK, 1000, 200); //TEST
addFuel(consumer, "charcoal", Items.CHARCOAL, 48000, 1600);
}
private void addFuel(Consumer<IFinishedRecipe> consumer, String name, Item item, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), burnTime, energy));
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), energy, burnTime));
}
private void addFuel(Consumer<IFinishedRecipe> consumer, String name, Ingredient item, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, burnTime, energy));
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime));
}
private void addFuel(Consumer<IFinishedRecipe> consumer, String name, ITag tag, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), burnTime, energy));
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime));
}
}

View file

@ -89,7 +89,7 @@ public class BlockAtomicReconstructor extends FullyDirectionalBlock.Container im
}
@Nullable
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityAtomicReconstructor();
}

View file

@ -39,7 +39,7 @@ public class BlockBatteryBox extends BlockContainerBase {
// }
@Nullable
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityBatteryBox();
}

View file

@ -28,7 +28,7 @@ public class BlockBioReactor extends BlockContainerBase {
super(ActuallyBlocks.defaultPickProps(0, 2.0F, 10.0F));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityBioReactor();
}

View file

@ -35,7 +35,7 @@ public class BlockBreaker extends FullyDirectionalBlock.Container {
}
@Nullable
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader world) {
return this.isPlacer
? new TileEntityPlacer()

View file

@ -40,7 +40,7 @@ public class BlockCanolaPress extends BlockContainerBase {
// }
@Nullable
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader world) {
return new TileEntityCanolaPress();
}

View file

@ -26,6 +26,7 @@ import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import javax.annotation.Nullable;
import java.util.Random;
public class BlockCoalGenerator extends DirectionalBlock.Container {
@ -34,7 +35,13 @@ public class BlockCoalGenerator extends DirectionalBlock.Container {
}
@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
public boolean hasTileEntity(BlockState state) {
return true;
}
@Nullable
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new TileEntityCoalGenerator();
}

View file

@ -48,7 +48,7 @@ public class BlockCoffeeMachine extends DirectionalBlock.Container {
}
@Nullable
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityCoffeeMachine();
}

View file

@ -47,7 +47,7 @@ public class BlockCrusher extends BlockContainerBase {
this.registerDefaultState(getStateDefinition().any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return this.isDouble
? new TileEntityCrusherDouble()

View file

@ -36,7 +36,7 @@ public class BlockDisplayStand extends BlockContainerBase {
}
@Nullable
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityDisplayStand();
}

View file

@ -28,7 +28,7 @@ public class BlockDropper extends FullyDirectionalBlock.Container {
super(ActuallyBlocks.defaultPickProps(0));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityDropper();
}

View file

@ -35,7 +35,7 @@ public class BlockEmpowerer extends BlockContainerBase {
}
@Nullable
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityEmpowerer();
}

View file

@ -33,7 +33,7 @@ public class BlockEnergizer extends BlockContainerBase {
this.isEnergizer = isEnergizer;
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return this.isEnergizer
? new TileEntityEnergizer()

View file

@ -30,7 +30,7 @@ public class BlockFarmer extends DirectionalBlock.Container {
super(ActuallyBlocks.defaultPickProps(0));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityFarmer();
}

View file

@ -30,7 +30,7 @@ public class BlockFeeder extends BlockContainerBase {
super(ActuallyBlocks.defaultPickProps(0, 0.5F, 6.0F));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityFeeder();
}

View file

@ -33,7 +33,7 @@ public class BlockFermentingBarrel extends BlockContainerBase {
super(Properties.of(Material.WOOD).harvestTool(ToolType.AXE).harvestLevel(0).strength(0.5F, 5.0F).sound(SoundType.WOOD));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityFermentingBarrel();
}

View file

@ -38,7 +38,7 @@ public class BlockFireworkBox extends BlockContainerBase {
return this.openGui(world, player, pos, TileEntityFireworkBox.class);
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityFireworkBox();
}

View file

@ -33,7 +33,7 @@ public class BlockFluidCollector extends FullyDirectionalBlock.Container {
this.isPlacer = isPlacer;
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return this.isPlacer
? new TileEntityFluidPlacer()

View file

@ -24,7 +24,7 @@ public class BlockHeatCollector extends BlockContainerBase {
super(ActuallyBlocks.defaultPickProps(0, 2.5F, 10.0F));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityHeatCollector();
}

View file

@ -26,7 +26,7 @@ public class BlockItemInterface extends BlockContainerBase {
super(ActuallyBlocks.defaultPickProps(0));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityItemInterface();
}

View file

@ -146,7 +146,7 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
return ActionResultType.FAIL;
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader world) {
switch (this.type) {
case ITEM:

View file

@ -37,7 +37,7 @@ public class BlockLavaFactoryController extends DirectionalBlock.Container imple
super(ActuallyBlocks.defaultPickProps(0, 4.5F, 20.0F));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityLavaFactoryController();
}

View file

@ -30,7 +30,7 @@ public class BlockLeafGenerator extends DirectionalBlock.Container {
super(Properties.of(Material.METAL).strength(5.0F, 10.0F).harvestTool(ToolType.PICKAXE).harvestLevel(0).strength(5.0F, 10.0F).sound(SoundType.METAL));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityLeafGenerator();
}

View file

@ -30,7 +30,7 @@ public class BlockLongRangeBreaker extends FullyDirectionalBlock.Container {
super(ActuallyBlocks.defaultPickProps(0));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityLongRangeBreaker();
}

View file

@ -36,7 +36,7 @@ public class BlockOilGenerator extends DirectionalBlock.Container {
super(ActuallyBlocks.defaultPickProps(0).randomTicks());
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityOilGenerator();
}

View file

@ -80,7 +80,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay {
return this.type == Type.PLACER || this.type == Type.BREAKER;
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
switch (this.type) {
case PLACER:

View file

@ -25,7 +25,7 @@ public class BlockPhantomBooster extends BlockContainerBase {
super(ActuallyBlocks.defaultPickProps(0));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader world) {
return new TileEntityPhantomBooster();
}

View file

@ -38,7 +38,7 @@ public class BlockPlayerInterface extends BlockContainerBase implements IHudDisp
super(ActuallyBlocks.defaultPickProps(0, 4.5F, 10.0F));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityPlayerInterface();
}

View file

@ -45,7 +45,7 @@ public class BlockPoweredFurnace extends BlockContainerBase {
registerDefaultState(getStateDefinition().any().setValue(HORIZONTAL_FACING, Direction.NORTH).setValue(LIT, false));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityPoweredFurnace();
}

View file

@ -30,7 +30,7 @@ public class BlockRangedCollector extends BlockContainerBase {
super(ActuallyBlocks.defaultPickProps(0));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityRangedCollector();
}

View file

@ -44,7 +44,7 @@ public class BlockVerticalDigger extends DirectionalBlock.Container implements I
return this.openGui(worldIn, player, pos, TileEntityVerticalDigger.class);
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader world) {
return new TileEntityVerticalDigger();
}

View file

@ -29,7 +29,7 @@ public class BlockXPSolidifier extends DirectionalBlock.Container {
super(ActuallyBlocks.defaultPickProps(0, 2.5F, 10.0F));
}
@Override
//@Override
public TileEntity newBlockEntity(IBlockReader worldIn) {
return new TileEntityXPSolidifier();
}

View file

@ -43,7 +43,7 @@ import net.minecraftforge.fml.network.NetworkHooks;
import javax.annotation.Nullable;
import java.util.Random;
public abstract class BlockContainerBase extends ContainerBlock {
public abstract class BlockContainerBase extends Block {
public BlockContainerBase(Properties properties) {
super(properties);
}
@ -51,13 +51,13 @@ public abstract class BlockContainerBase extends ContainerBlock {
public ActionResultType openGui(World world, PlayerEntity player, BlockPos pos, Class<? extends INamedContainerProvider> expectedInstance) {
if (!world.isClientSide) {
TileEntity tile = world.getBlockEntity(pos);
if (tile != null && tile.getClass().isInstance(expectedInstance)) {
if (expectedInstance.isInstance(tile)) {
NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tile, pos);
}
return ActionResultType.SUCCESS;
}
return ActionResultType.PASS;
return ActionResultType.SUCCESS;
}
private void dropInventory(World world, BlockPos position) {

View file

@ -14,21 +14,21 @@ import net.minecraft.block.AbstractBlock.Properties;
* Wrapper for Directional block states extending from our base blocks. It's not super nice but it'll do.
*/
public abstract class DirectionalBlock extends BlockBase {
// public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
//
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;
public DirectionalBlock(Properties properties) {
super(properties);
}
//
// @Override
// public BlockState getStateForPlacement(BlockItemUseContext context) {
// return this.getDefaultState().with(FACING, context.getNearestLookingDirection().getOpposite());
// }
//
// @Override
// protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
// builder.add(FACING);
// }
@Override
public BlockState getStateForPlacement(BlockItemUseContext context) {
return this.defaultBlockState().setValue(FACING, context.getNearestLookingDirection().getOpposite());
}
@Override
protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) {
builder.add(FACING);
}
public abstract static class Container extends BlockContainerBase {
public static final DirectionProperty FACING = BlockStateProperties.HORIZONTAL_FACING;

View file

@ -91,13 +91,6 @@ public enum ConfigIntValues {
1,
Integer.MAX_VALUE,
"The energy use of the Atomic Reconstructor's Mining Lens."),
COAL_GENERATOR_CF_PRODUCTION(
"Coal Generator Energy Production",
ConfigCategories.MACHINE_VALUES,
30,
1,
Integer.MAX_VALUE,
"The Coal Generator's Energy Production in CF/tick while burning."),
LEAF_GENERATOR_COOLDOWN(
"Leaf Generator Cooldown",
ConfigCategories.MACHINE_VALUES,

View file

@ -14,18 +14,26 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public abstract class GuiWtfMojang<T extends Container> extends ContainerScreen<T> {
import javax.annotation.Nonnull;
public GuiWtfMojang(T inventorySlotsIn, PlayerInventory inventory) {
super(inventorySlotsIn, inventory, StringTextComponent.EMPTY);
public abstract class AAScreen<T extends Container> extends ContainerScreen<T> {
public AAScreen(T container, PlayerInventory inventory, ITextComponent pTitle) {
super(container, inventory, pTitle);
}
@Override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
public void render(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
this.renderTooltip(matrixStack, mouseX, mouseY);
}
@Override
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
font.draw(matrices, this.title, titleLabelX, titleLabelY, 0xFFFFFF);
}
}

View file

@ -26,8 +26,10 @@ import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
public class CrusherScreen extends AAScreen<CrusherContainer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_grinder");
private static final ResourceLocation RES_LOC_DOUBLE = AssetUtil.getGuiLocation("gui_grinder_double");
@ -38,7 +40,7 @@ public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
private Button buttonAutoSplit;
public CrusherScreen(CrusherContainer container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.tileGrinder = container.tileGrinder;
this.isDouble = container.isDouble;
this.imageWidth = 176;
@ -76,7 +78,7 @@ public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
}
@Override
public void render(MatrixStack matrixStack, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrixStack, int x, int y, float f) {
super.render(matrixStack, x, y, f);
this.energy.render(matrixStack, x, y);
@ -87,7 +89,7 @@ public class CrusherScreen extends GuiWtfMojang<CrusherContainer> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileGrinder);
}

View file

@ -17,8 +17,10 @@ import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.fml.client.gui.GuiUtils;
import java.text.NumberFormat;
import java.util.ArrayList;
@ -82,9 +84,9 @@ public class EnergyDisplay extends AbstractGui {
if (this.isMouseOver(mouseX, mouseY)) {
Minecraft mc = Minecraft.getInstance();
List<String> text = new ArrayList<>();
text.add(this.getOverlayText());
//GuiUtils.drawHoveringText(matrices, text, mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font);
List<StringTextComponent> text = new ArrayList<>();
text.add(new StringTextComponent(this.getOverlayText()));
GuiUtils.drawHoveringText(matrices, text, mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font);
}
}
@ -98,6 +100,6 @@ public class EnergyDisplay extends AbstractGui {
private String getOverlayText() {
NumberFormat format = NumberFormat.getInstance();
return String.format("%s/%s %s", format.format(this.rfReference.getEnergyStored()), format.format(this.rfReference.getMaxEnergyStored()), I18n.get("actuallyadditions.cflong"));
return String.format("%s/%s %s", format.format(this.rfReference.getEnergyStored()), format.format(this.rfReference.getMaxEnergyStored()), I18n.get("actuallyadditions.fe"));
}
}

View file

@ -19,7 +19,9 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
public class GuiBag extends GuiWtfMojang<ContainerBag> {
import javax.annotation.Nonnull;
public class GuiBag extends AAScreen<ContainerBag> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bag");
private static final ResourceLocation RES_LOC_VOID = AssetUtil.getGuiLocation("gui_void_bag");
@ -29,7 +31,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
private Button buttonAutoInsert;
public GuiBag(ContainerBag container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.imageWidth = 176;
this.imageHeight = 90 + 86;
this.isVoid = container.isVoid;
@ -75,7 +77,7 @@ public class GuiBag extends GuiWtfMojang<ContainerBag> {
}*/
@Override
public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
public void render(@Nonnull MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
super.render(stack, mouseX, mouseY, partialTicks);
this.filter.drawHover(mouseX, mouseY);

View file

@ -20,14 +20,16 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
import javax.annotation.Nonnull;
public class GuiBioReactor extends AAScreen<ContainerBioReactor> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_bio_reactor");
private final TileEntityBioReactor tile;
private EnergyDisplay energy;
public GuiBioReactor(ContainerBioReactor container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.tile = container.tile;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -40,13 +42,13 @@ public class GuiBioReactor extends GuiWtfMojang<ContainerBioReactor> {
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
public void render(@Nonnull MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.render(matrices, mouseX, mouseY, partialTicks);
//this.energy.render(mouseX, mouseY);
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tile);
}

View file

@ -21,26 +21,23 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiBreaker extends GuiWtfMojang<ContainerBreaker> {
public class GuiBreaker extends AAScreen<ContainerBreaker> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityBreaker breaker;
public GuiBreaker(ContainerBreaker container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.breaker = container.breaker;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
}
@Override
protected void renderLabels(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.breaker);
}
@Override
protected void renderBg(MatrixStack matrices, float partialTicks, int x, int y) {
protected void renderBg(@Nonnull MatrixStack matrices, float partialTicks, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.getMinecraft().getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);

View file

@ -21,8 +21,10 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
public class GuiCanolaPress extends AAScreen<ContainerCanolaPress> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_canola_press");
private final TileEntityCanolaPress press;
@ -30,7 +32,7 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
private FluidDisplay fluid;
public GuiCanolaPress(ContainerCanolaPress container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.press = container.press;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -44,7 +46,7 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
@ -52,7 +54,7 @@ public class GuiCanolaPress extends GuiWtfMojang<ContainerCanolaPress> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.press);
}

View file

@ -15,21 +15,25 @@ import com.mojang.blaze3d.systems.RenderSystem;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCoalGenerator;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator;
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
public class GuiCoalGenerator extends AAScreen<ContainerCoalGenerator> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coal_generator");
private final TileEntityCoalGenerator generator;
private EnergyDisplay energy;
public GuiCoalGenerator(ContainerCoalGenerator container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.generator = container.generator;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -39,17 +43,16 @@ public class GuiCoalGenerator extends GuiWtfMojang<ContainerCoalGenerator> {
public void init() {
super.init();
this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.generator.storage);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
renderBackground(matrices);
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.generator);
renderTooltip(matrices, x, y);
}
@Override

View file

@ -23,8 +23,10 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
public class GuiCoffeeMachine extends AAScreen<ContainerCoffeeMachine> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_coffee_machine");
private final TileEntityCoffeeMachine machine;
@ -33,7 +35,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
private FluidDisplay fluid;
public GuiCoffeeMachine(ContainerCoffeeMachine container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.machine = container.machine;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -51,7 +53,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
String text2 = this.machine.coffeeCacheAmount + "/" + TileEntityCoffeeMachine.COFFEE_CACHE_MAX_AMOUNT + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.coffee");
@ -64,7 +66,7 @@ public class GuiCoffeeMachine extends GuiWtfMojang<ContainerCoffeeMachine> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.machine);
}

View file

@ -21,15 +21,17 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBreaker> {
public class GuiDirectionalBreaker extends AAScreen<ContainerDirectionalBreaker> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_directional_breaker");
private final TileEntityLongRangeBreaker breaker;
private EnergyDisplay energy;
public GuiDirectionalBreaker(ContainerDirectionalBreaker container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.breaker = container.breaker;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -42,14 +44,14 @@ public class GuiDirectionalBreaker extends GuiWtfMojang<ContainerDirectionalBrea
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.breaker);
}

View file

@ -22,20 +22,22 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiDrill extends GuiWtfMojang<ContainerDrill> {
public class GuiDrill extends AAScreen<ContainerDrill> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_drill");
public GuiDrill(ContainerDrill container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.imageWidth = 176;
this.imageHeight = 54 + 86;
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".drill.name"));
}

View file

@ -21,22 +21,24 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiDropper extends GuiWtfMojang<ContainerDropper> {
public class GuiDropper extends AAScreen<ContainerDropper> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityDropper dropper;
public GuiDropper(ContainerDropper container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.dropper = container.dropper;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.dropper);
}

View file

@ -21,15 +21,17 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiEnergizer extends GuiWtfMojang<ContainerEnergizer> {
public class GuiEnergizer extends AAScreen<ContainerEnergizer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer");
private final TileEntityEnergizer energizer;
private EnergyDisplay energy;
public GuiEnergizer(ContainerEnergizer container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.energizer = container.energizer;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -42,13 +44,13 @@ public class GuiEnergizer extends GuiWtfMojang<ContainerEnergizer> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.energizer);
}

View file

@ -21,16 +21,18 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiEnervator extends GuiWtfMojang<ContainerEnervator> {
public class GuiEnervator extends AAScreen<ContainerEnervator> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_energizer");
private final TileEntityEnervator enervator;
private EnergyDisplay energy;
public GuiEnervator(ContainerEnervator container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.enervator = container.enervator;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -43,13 +45,13 @@ public class GuiEnervator extends GuiWtfMojang<ContainerEnervator> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.enervator);
}

View file

@ -21,9 +21,11 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
public class GuiFarmer extends AAScreen<ContainerFarmer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_farmer");
private final TileEntityFarmer farmer;
@ -31,7 +33,7 @@ public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
private EnergyDisplay energy;
public GuiFarmer(ContainerFarmer container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.farmer = container.farmer;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -45,7 +47,7 @@ public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.farmer);
}
@ -63,7 +65,7 @@ public class GuiFarmer extends GuiWtfMojang<ContainerFarmer> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
}

View file

@ -23,21 +23,23 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
public class GuiFeeder extends AAScreen<ContainerFeeder> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_feeder");
public final TileEntityFeeder tileFeeder;
public GuiFeeder(ContainerFeeder container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.tileFeeder = container.feeder;
this.imageWidth = 176;
this.imageHeight = 70 + 86;
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
if (x >= this.leftPos + 69 && y >= this.topPos + 30 && x <= this.leftPos + 69 + 10 && y <= this.topPos + 30 + 10) {
String[] array = new String[]{this.tileFeeder.currentAnimalAmount + " " + StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.animals"), this.tileFeeder.currentAnimalAmount >= 2 && this.tileFeeder.currentAnimalAmount < TileEntityFeeder.THRESHOLD
@ -50,7 +52,7 @@ public class GuiFeeder extends GuiWtfMojang<ContainerFeeder> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileFeeder);
}

View file

@ -21,9 +21,11 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel> {
public class GuiFermentingBarrel extends AAScreen<ContainerFermentingBarrel> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fermenting_barrel");
private final TileEntityFermentingBarrel press;
@ -31,14 +33,14 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
private FluidDisplay output;
public GuiFermentingBarrel(ContainerFermentingBarrel container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.press = container.barrel;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.input.render(matrices, x, y);
this.output.render(matrices, x, y);
@ -52,7 +54,7 @@ public class GuiFermentingBarrel extends GuiWtfMojang<ContainerFermentingBarrel>
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.press);
}

View file

@ -22,19 +22,21 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiFilter extends GuiWtfMojang<ContainerFilter> {
public class GuiFilter extends AAScreen<ContainerFilter> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_filter");
public GuiFilter(ContainerFilter container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.imageWidth = 176;
this.imageHeight = 90 + 86;
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, StringUtil.localize("container." + ActuallyAdditions.MODID + ".filter.name"));
}

View file

@ -21,23 +21,25 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
public class GuiFluidCollector extends AAScreen<ContainerFluidCollector> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_fluid_collector");
private final TileEntityFluidCollector collector;
private FluidDisplay fluid;
public GuiFluidCollector(ContainerFluidCollector container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.collector = container.collector;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.fluid.render(matrices, x, y);
@ -50,7 +52,7 @@ public class GuiFluidCollector extends GuiWtfMojang<ContainerFluidCollector> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.collector);
}

View file

@ -24,8 +24,10 @@ import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
public class GuiFurnaceDouble extends AAScreen<ContainerFurnaceDouble> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_furnace_double");
private final TileEntityPoweredFurnace tileFurnace;
@ -34,14 +36,14 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
private Button buttonAutoSplit;
public GuiFurnaceDouble(ContainerFurnaceDouble container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.tileFurnace = container.furnace;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
@ -79,7 +81,7 @@ public class GuiFurnaceDouble extends GuiWtfMojang<ContainerFurnaceDouble> {
// }
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tileFurnace);
}

View file

@ -24,8 +24,10 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelayItemWhitelist> {
public class GuiLaserRelayItemWhitelist extends AAScreen<ContainerLaserRelayItemWhitelist> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_laser_relay_item_whitelist");
private final TileEntityLaserRelayItemAdvanced tile;
@ -37,7 +39,7 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
private Button buttonSmartWhitelistRight;
public GuiLaserRelayItemWhitelist(ContainerLaserRelayItemWhitelist container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.tile = container.tile;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -70,7 +72,7 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
// }
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
//
// if (this.buttonSmartWhitelistLeft.isMouseOver() || this.buttonSmartWhitelistRight.isMouseOver()) {
@ -85,7 +87,7 @@ public class GuiLaserRelayItemWhitelist extends GuiWtfMojang<ContainerLaserRelay
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.tile);
String s1 = StringUtil.localize("info." + ActuallyAdditions.MODID + ".gui.inbound");

View file

@ -22,15 +22,17 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
public class GuiMiner extends AAScreen<ContainerMiner> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityVerticalDigger miner;
public GuiMiner(ContainerMiner container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.miner = container.miner;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -50,7 +52,7 @@ public class GuiMiner extends GuiWtfMojang<ContainerMiner> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.miner);
}

View file

@ -23,9 +23,11 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
public class GuiOilGenerator extends AAScreen<ContainerOilGenerator> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_oil_generator");
private final TileEntityOilGenerator generator;
@ -34,7 +36,7 @@ public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
private FluidDisplay fluid;
public GuiOilGenerator(ContainerOilGenerator container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.generator = container.generator;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -48,14 +50,14 @@ public class GuiOilGenerator extends GuiWtfMojang<ContainerOilGenerator> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
this.energy.render(matrices, x, y);
this.fluid.render(matrices, x, y);
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.generator);
}

View file

@ -21,14 +21,16 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
public class GuiPhantomPlacer extends AAScreen<ContainerPhantomPlacer> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_breaker");
private final TileEntityPhantomPlacer placer;
public GuiPhantomPlacer(ContainerPhantomPlacer container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.placer = container.placer;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -53,7 +55,7 @@ public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
public void render(@Nonnull MatrixStack matrices, int mouseX, int mouseY, float partialTicks) {
super.render(matrices, mouseX, mouseY, partialTicks);
// if (!this.placer.isBreaker && this.buttonList.get(0).isMouseOver()) {
@ -78,7 +80,7 @@ public class GuiPhantomPlacer extends GuiWtfMojang<ContainerPhantomPlacer> {
// }
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.placer);
}

View file

@ -21,9 +21,11 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
public class GuiRangedCollector extends AAScreen<ContainerRangedCollector> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_ranged_collector");
private final TileEntityRangedCollector collector;
@ -31,7 +33,7 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
private FilterSettingsGui filter;
public GuiRangedCollector(ContainerRangedCollector container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.collector = container.collector;
this.imageWidth = 176;
this.imageHeight = 86 + 86;
@ -45,7 +47,7 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
}
@Override
public void render(MatrixStack matrices, int x, int y, float f) {
public void render(@Nonnull MatrixStack matrices, int x, int y, float f) {
super.render(matrices, x, y, f);
//this.filter.drawHover(matrices, x, y);
@ -59,7 +61,7 @@ public class GuiRangedCollector extends GuiWtfMojang<ContainerRangedCollector> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.collector);
}

View file

@ -22,15 +22,17 @@ import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nonnull;
@OnlyIn(Dist.CLIENT)
public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
public class GuiXPSolidifier extends AAScreen<ContainerXPSolidifier> {
private static final ResourceLocation RES_LOC = AssetUtil.getGuiLocation("gui_xp_solidifier");
private final TileEntityXPSolidifier solidifier;
public GuiXPSolidifier(ContainerXPSolidifier container, PlayerInventory inventory, ITextComponent title) {
super(container, inventory);
super(container, inventory, title);
this.solidifier = container.solidifier;
this.imageWidth = 176;
this.imageHeight = 93 + 86;
@ -71,7 +73,7 @@ public class GuiXPSolidifier extends GuiWtfMojang<ContainerXPSolidifier> {
}
@Override
public void renderLabels(MatrixStack matrices, int x, int y) {
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.solidifier);
}

View file

@ -19,6 +19,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.SUpdateTileEntityPacket;
import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction;
@ -35,7 +36,7 @@ import net.minecraftforge.items.IItemHandler;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public abstract class TileEntityBase extends TileEntity implements ITickable {
public abstract class TileEntityBase extends TileEntity implements ITickableTileEntity {
public boolean isRedstonePowered;
public boolean isPulseMode;
@ -48,17 +49,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
super(type);
}
private static void register(Class<? extends TileEntityBase> tileClass) {
// TODO: [port] migrate to register system.
// try {
// //This is hacky and dirty but it works so whatever
// ResourceLocation name = new ResourceLocation(ActuallyAdditions.MODID, tileClass.newInstance().name);
// GameRegistry.registerTileEntity(tileClass, name);
// } catch (Exception e) {
// ActuallyAdditions.LOGGER.fatal("Registering a TileEntity failed!", e);
// }
}
@Override
public CompoundNBT save(CompoundNBT compound) {
this.writeSyncableNBT(compound, NBTType.SAVE_TILE);
@ -271,7 +261,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable {
}
protected boolean sendUpdateWithInterval() {
if (this.ticksElapsed % ConfigIntValues.TILE_ENTITY_UPDATE_INTERVAL.getValue() == 0) {
if (this.ticksElapsed % 5 == 0) { //TODO was a config TILE_ENTITY_UPDATE_INTERVAL
this.sendUpdate();
return true;
} else {

View file

@ -27,8 +27,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.ForgeHooks;
@ -72,6 +74,8 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
if (type != NBTType.SAVE_BLOCK) {
compound.putInt("BurnTime", this.currentBurnTime);
compound.putInt("MaxBurnTime", this.maxBurnTime);
if (currentRecipe != null)
compound.putString("currentRecipe", currentRecipe.getId().toString());
}
this.storage.writeToNBT(compound);
super.writeSyncableNBT(compound, type);
@ -82,6 +86,15 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
if (type != NBTType.SAVE_BLOCK) {
this.currentBurnTime = compound.getInt("BurnTime");
this.maxBurnTime = compound.getInt("MaxBurnTime");
if (compound.contains("currentRecipe")) {
ResourceLocation id = new ResourceLocation(compound.getString("currentRecipe"));
for (SolidFuelRecipe fuelRecipe : ActuallyAdditionsAPI.SOLID_FUEL_RECIPES) {
if (fuelRecipe.getId().equals(id)) {
this.currentRecipe = fuelRecipe;
break;
}
}
}
}
this.storage.readFromNBT(compound);
super.readSyncableNBT(compound, type);
@ -137,7 +150,13 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
@Override
public IAcceptor getAcceptor() {
return (slot, stack, automation) -> ForgeHooks.getBurnTime(stack) > 0;
return (slot, stack, automation) -> {
SingleItem singleItem = new SingleItem(stack);
for (SolidFuelRecipe recipe : ActuallyAdditionsAPI.SOLID_FUEL_RECIPES) {
if (recipe.matches(singleItem, null))return true;
}
return false;
};
}
@Override
@ -177,7 +196,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements
@Override
public ITextComponent getDisplayName() {
return StringTextComponent.EMPTY;
return new TranslationTextComponent("container.actuallyadditions.coalGenerator");
}
@Nullable

View file

@ -4,9 +4,9 @@
"achievement.page.actuallyadditions": "Actually Additions",
"actuallyadditions.lolWutHowUDoDis": "This is bugged. Throw it away. Please.",
"tooltip.actuallyadditions.disabled": "Disabled Object",
"actuallyadditions.cft": "CF/t",
"actuallyadditions.cf": "CF",
"actuallyadditions.cflong": "Crystal Flux",
"actuallyadditions.fet": "FE/t",
"actuallyadditions.fe": "FE",
"actuallyadditions.felong": "Forge Energy",
"misc.actuallyadditions.power_long": "%s/%s Crystal Flux",
"misc.actuallyadditions.power_single": "%s Crystal Flux",
"misc.actuallyadditions.power_single_short": "%s CF",