Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fml.client.config.GuiUtils;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;

import javax.annotation.Nonnull;
Expand All @@ -55,30 +54,33 @@ private static List<String> getAddActionInfo() {
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action"));
// Quite a sight, isn't it?
// It was truly a beautiful sight...
final boolean shift = isShiftKeyDown();
final boolean ctrl = isCtrlKeyDown();

if (isShiftDown() && isControlDown()) {
if (shift && ctrl) {
String keyCombination =
"SHIFT + CTRL";
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.multiply",
keyCombination));
keyCombination));
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.divide",
keyCombination));
keyCombination));
} else {
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.increase.normal"));
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.decrease.normal"));
final int i = ctrl ? 100 : shift ? 10 : 1;
final String keyCombination = ctrl ? "CTRL" : shift ? "SHIFT" : null;
if (keyCombination != null) {
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.increase",
keyCombination, i));
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.decrease",
keyCombination, i));
} else {
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.increase.normal"));
tooltip.add(TextFormatting.GRAY + I18n.format("gui.meiteminputbus.inv_action.decrease.normal"));
}
}

return tooltip;
}

private static boolean isControlDown() {
return Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) || Keyboard.isKeyDown(Keyboard.KEY_RCONTROL);
}

private static boolean isShiftDown() {
return Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT);
}

@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
Expand Down Expand Up @@ -124,7 +126,10 @@ private boolean isScrollingUp(int wheel) {
}

private int getUpdatedCount(boolean isScrollingUp, int currentAmount) {
if (isShiftDown() && isControlDown()) {
final boolean shift = isShiftKeyDown();
final boolean ctrl = isCtrlKeyDown();

if (shift && ctrl) {
if (isScrollingUp) {
// Overflow protection
if (currentAmount <= Integer.MAX_VALUE / 2) {
Expand All @@ -135,14 +140,15 @@ private int getUpdatedCount(boolean isScrollingUp, int currentAmount) {
return Math.max(1, currentAmount / 2);
}
} else {
int i = ctrl ? 100 : shift ? 10 : 1;
if (isScrollingUp) {
// Overflow protection
if (currentAmount < Integer.MAX_VALUE) {
return 1 + currentAmount;
return i + currentAmount;
}
return Integer.MAX_VALUE;
} else {
return Math.max(1, currentAmount - 1);
return Math.max(1, currentAmount - i);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
import github.kasuminova.mmce.common.util.InfItemFluidHandler;
import hellfirepvp.modularmachinery.ModularMachinery;
import hellfirepvp.modularmachinery.common.base.Mods;
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
Expand All @@ -38,7 +40,7 @@ public class GuiMEPatternProvider extends AEBaseGuiContainerDynamic {

protected final MEPatternProvider owner;

protected final PatternProviderIngredientList stackList = new PatternProviderIngredientList();
protected final PatternProviderIngredientList stackList = new PatternProviderIngredientList();
protected final ButtonElements<MEPatternProvider.WorkModeSetting> workModeSetting = new ButtonElements<>();

public GuiMEPatternProvider(final MEPatternProvider owner, final EntityPlayer player) {
Expand Down Expand Up @@ -108,6 +110,7 @@ public GuiMEPatternProvider(final MEPatternProvider owner, final EntityPlayer pl
.addElement(MEPatternProvider.WorkModeSetting.CRAFTING_LOCK_MODE, TextureProperties.of(140 + 18 + 18, 196, 16, 16))
// ButtonTexture 0
.addElement(MEPatternProvider.WorkModeSetting.ENHANCED_BLOCKING_MODE, TextureProperties.of(140 - 18, 196, 16, 16))
.addElement(MEPatternProvider.WorkModeSetting.ISOLATION_INPUT, TextureProperties.of(140 - 18 - 18, 196, 16, 16))
// ButtonTexture 5
.setMouseDownTexture(140 + 18 + 18 + 18 + 18 + 18, 196)
// ButtonTexture 5
Expand All @@ -127,6 +130,8 @@ public GuiMEPatternProvider(final MEPatternProvider owner, final EntityPlayer pl
+ I18n.format("gui.mepatternprovider.crafting_lock_mode.desc"));
tooltips.add((current == MEPatternProvider.WorkModeSetting.ENHANCED_BLOCKING_MODE ? I18n.format("gui.mepatternprovider.current") : "")
+ I18n.format("gui.mepatternprovider.enhanced_blocking_mode.desc"));
tooltips.add((current == MEPatternProvider.WorkModeSetting.ISOLATION_INPUT ? I18n.format("gui.mepatternprovider.current") : "")
+ I18n.format("gui.mepatternprovider.isolation_input.desc"));
return tooltips;
})
.setOnClickedListener((btn) -> {
Expand All @@ -143,6 +148,8 @@ public GuiMEPatternProvider(final MEPatternProvider owner, final EntityPlayer pl
ModularMachinery.NET_CHANNEL.sendToServer(new PktMEPatternProviderAction(PktMEPatternProviderAction.Action.ENABLE_CRAFTING_LOCK_MODE));
case ENHANCED_BLOCKING_MODE ->
ModularMachinery.NET_CHANNEL.sendToServer(new PktMEPatternProviderAction(PktMEPatternProviderAction.Action.ENABLE_ENHANCED_BLOCKING_MODE));
case ISOLATION_INPUT ->
ModularMachinery.NET_CHANNEL.sendToServer(new PktMEPatternProviderAction(PktMEPatternProviderAction.Action.ENABLE_ENHANCED_ISOLATION_INPUT));
}
})
.setWidthHeight(16, 16);
Expand Down Expand Up @@ -222,12 +229,25 @@ public MEPatternProvider getOwner() {

public void updateGUIState() {
InfItemFluidHandler infHandler = owner.getInfHandler();
stackList.setStackList(infHandler.getItemStackList(), infHandler.getFluidStackList(), infHandler.getGasStackList());

List<ItemStack> itemStacks = new ObjectArrayList<>(infHandler.getItemStackList());
List<FluidStack> fluids = new ObjectArrayList<>(infHandler.getFluidStackList());
List<Object> gass = new ObjectArrayList<>(infHandler.getGasStackList());

for (var component : owner.getCombinationComponents()) {
var h = (InfItemFluidHandler) component.getContainerProvider();
itemStacks.addAll(h.getItemStackList());
fluids.addAll(h.getFluidStackList());
gass.addAll(h.getGasStackList());
}

stackList.setStackList(itemStacks, fluids, gass);
workModeSetting.setCurrentSelection(owner.getWorkMode());
}

public void setStackList(final List<ItemStack> itemStackList, final List<FluidStack> fluidStackList, final List<?> gasStackList) {
stackList.setStackList(itemStackList, fluidStackList, gasStackList);
public void setStackList(final NBTTagCompound tagCompound) {
owner.readProviderHandlerNBT(tagCompound, true);
updateGUIState();
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
import hellfirepvp.modularmachinery.ModularMachinery;
import hellfirepvp.modularmachinery.common.CommonProxy;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class BlockMEFluidInputBus extends BlockMEFluidBus {

Expand Down Expand Up @@ -42,4 +48,12 @@ public boolean onBlockActivated(@Nonnull final World worldIn, @Nonnull final Blo
public TileEntity createTileEntity(final World world, final IBlockState state) {
return new MEFluidInputBus();
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List<String> tooltip, @NotNull ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add(I18n.format("tooltip.groupinput.block"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,22 @@
import hellfirepvp.modularmachinery.ModularMachinery;
import hellfirepvp.modularmachinery.common.CommonProxy;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class BlockMEGasInputBus extends BlockMEGasBus {

Expand Down Expand Up @@ -43,4 +49,11 @@ public TileEntity createTileEntity(final World world, final IBlockState state) {
return new MEGasInputBus();
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List<String> tooltip, @NotNull ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add(I18n.format("tooltip.groupinput.block"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import hellfirepvp.modularmachinery.common.lib.ItemsMM;
import hellfirepvp.modularmachinery.common.util.IOInventory;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand All @@ -18,9 +20,13 @@
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class BlockMEItemInputBus extends BlockMEItemBus {
@Override
Expand Down Expand Up @@ -118,4 +124,12 @@ public void onBlockPlacedBy(@Nonnull final World worldIn,
bus.readConfigInventoryNBT(tag.getCompoundTag("configInventory"));
}
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List<String> tooltip, @NotNull ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add(I18n.format("tooltip.groupinput.block"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
Expand All @@ -20,9 +23,11 @@
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class BlockMEPatternMirrorImage extends BlockMachineComponent {

Expand Down Expand Up @@ -98,4 +103,11 @@ public BlockRenderLayer getRenderLayer() {
public EnumBlockRenderType getRenderType(@Nonnull IBlockState state) {
return EnumBlockRenderType.MODEL;
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List<String> tooltip, @NotNull ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add(I18n.format("tooltip.mepatternmirrorimage"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import hellfirepvp.modularmachinery.common.CommonProxy;
import hellfirepvp.modularmachinery.common.lib.ItemsMM;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand All @@ -21,9 +23,13 @@
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.World;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.List;

public class BlockMEPatternProvider extends BlockMEMachineComponent {

Expand Down Expand Up @@ -120,4 +126,12 @@ public void onBlockPlacedBy(@Nonnull final World worldIn,
provider.readProviderNBT(tag.getCompoundTag("patternProvider"));
}
}
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@NotNull ItemStack stack, @Nullable World worldIn, @NotNull List<String> tooltip, @NotNull ITooltipFlag flagIn) {
super.addInformation(stack, worldIn, tooltip, flagIn);
tooltip.add(I18n.format("tooltip.groupinput.block"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import appeng.helpers.InventoryAction;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.Platform;
import github.kasuminova.mmce.common.network.PktMEPatternProviderHandlerItems;
import github.kasuminova.mmce.common.tile.MEPatternProvider;
import github.kasuminova.mmce.common.util.AEFluidInventoryUpgradeable;
import hellfirepvp.modularmachinery.ModularMachinery;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.inventory.IContainerListener;
Expand All @@ -32,6 +34,11 @@ public class ContainerMEPatternProvider extends AEBaseContainer implements IFlui
public ContainerMEPatternProvider(final MEPatternProvider owner, final EntityPlayer player) {
super(player.inventory, owner);
this.owner = owner;

if (player instanceof EntityPlayerMP p) {
ModularMachinery.NET_CHANNEL.sendTo(new PktMEPatternProviderHandlerItems(owner), p);
}

this.tankSync = new FluidSyncHelper(owner.getSubFluidHandler(), 0);

this.bindPlayerInventory(getInventoryPlayer(), 0, 114);
Expand Down
Loading
Loading