aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/kubatech/Tags.java4
-rw-r--r--src/main/java/kubatech/api/DynamicInventory.java469
-rw-r--r--src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java84
-rw-r--r--src/main/java/kubatech/loaders/RecipeLoader.java13
-rw-r--r--src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeEntityCrusher.java296
-rw-r--r--src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeIndustrialGreenhouse.java534
-rw-r--r--src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_MegaIndustrialApiary.java571
-rw-r--r--src/main/resources/assets/kubatech/lang/en_US.lang9
-rw-r--r--src/main/resources/assets/kubatech/textures/gui/MobHandler.pngbin7548 -> 0 bytes
-rw-r--r--src/main/resources/assets/kubatech/textures/gui/logo_13x15_dark.pngbin0 -> 10194 bytes
-rw-r--r--src/main/resources/assets/kubatech/textures/gui/slot/gray_spawner.pngbin0 -> 3761 bytes
-rw-r--r--src/main/resources/assets/kubatech/textures/gui/slot/gray_sword.pngbin0 -> 645 bytes
12 files changed, 1005 insertions, 975 deletions
diff --git a/src/main/java/kubatech/Tags.java b/src/main/java/kubatech/Tags.java
index a49dc60207..cd596921a9 100644
--- a/src/main/java/kubatech/Tags.java
+++ b/src/main/java/kubatech/Tags.java
@@ -25,7 +25,7 @@ package kubatech;
public class Tags {
// GRADLETOKEN_* will be replaced by your configuration values at build time
- public static final String MODID = "GRADLETOKEN_MODID";
- public static final String MODNAME = "GRADLETOKEN_MODNAME";
+ public static final String MODID = "kubatech";
+ public static final String MODNAME = "KubaTech";
public static final String VERSION = "GRADLETOKEN_VERSION";
}
diff --git a/src/main/java/kubatech/api/DynamicInventory.java b/src/main/java/kubatech/api/DynamicInventory.java
new file mode 100644
index 0000000000..ef89c3a341
--- /dev/null
+++ b/src/main/java/kubatech/api/DynamicInventory.java
@@ -0,0 +1,469 @@
+package kubatech.api;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.function.Supplier;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import org.lwjgl.opengl.GL11;
+
+import com.gtnewhorizons.modularui.api.GlStateManager;
+import com.gtnewhorizons.modularui.api.ModularUITextures;
+import com.gtnewhorizons.modularui.api.drawable.IDrawable;
+import com.gtnewhorizons.modularui.api.drawable.ItemDrawable;
+import com.gtnewhorizons.modularui.api.drawable.Text;
+import com.gtnewhorizons.modularui.api.drawable.UITexture;
+import com.gtnewhorizons.modularui.api.math.Alignment;
+import com.gtnewhorizons.modularui.api.math.Color;
+import com.gtnewhorizons.modularui.api.screen.ModularWindow;
+import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+import com.gtnewhorizons.modularui.api.widget.Widget;
+import com.gtnewhorizons.modularui.common.internal.Theme;
+import com.gtnewhorizons.modularui.common.internal.wrapper.ModularGui;
+import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
+import com.gtnewhorizons.modularui.common.widget.ChangeableWidget;
+import com.gtnewhorizons.modularui.common.widget.DynamicPositionedRow;
+import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
+import com.gtnewhorizons.modularui.common.widget.Scrollable;
+import com.kuba6000.mobsinfo.api.utils.ItemID;
+
+import kubatech.api.helpers.GTHelper;
+import kubatech.api.utils.ModUtils;
+
+public class DynamicInventory<T> {
+
+ int width, height;
+ Supplier<Integer> slotsGetter;
+ private int slots = 0;
+ private int usedSlots = 0;
+ List<T> inventory;
+ TInventoryGetter<T> inventoryGetter;
+ TInventoryInjector inventoryInjector = null;
+ TInventoryExtractor<T> inventoryExtractor = null;
+ TInventoryReplacerOrMerger inventoryReplacer = null;
+ Supplier<Boolean> isEnabledGetter = null;
+ boolean isEnabled = true;
+
+ public DynamicInventory(int width, int height, Supplier<Integer> slotsGetter, List<T> inventory,
+ TInventoryGetter<T> inventoryGetter) {
+ this.width = width;
+ this.height = height;
+ this.slotsGetter = slotsGetter;
+ this.inventory = inventory;
+ this.inventoryGetter = inventoryGetter;
+ }
+
+ public DynamicInventory<T> allowInventoryInjection(TInventoryInjector inventoryInjector) {
+ this.inventoryInjector = inventoryInjector;
+ return this;
+ }
+
+ public DynamicInventory<T> allowInventoryExtraction(TInventoryExtractor<T> inventoryExtractor) {
+ this.inventoryExtractor = inventoryExtractor;
+ return this;
+ }
+
+ public DynamicInventory<T> allowInventoryReplace(TInventoryReplacerOrMerger inventoryReplacer) {
+ this.inventoryReplacer = inventoryReplacer;
+ return this;
+ }
+
+ public DynamicInventory<T> setEnabled(Supplier<Boolean> isEnabled) {
+ this.isEnabledGetter = isEnabled;
+ return this;
+ }
+
+ public UITexture getItemSlot() {
+ return ModularUITextures.ITEM_SLOT;
+ }
+
+ @SuppressWarnings("UnstableApiUsage")
+ public Widget asWidget(ModularWindow.Builder builder, UIBuildContext buildContext) {
+ ChangeableWidget container = new ChangeableWidget(() -> createWidget(buildContext.getPlayer()));
+
+ // TODO: Only reset the widget when there are more slot stacks, otherwise just refresh them somehow
+
+ container.attachSyncer(new FakeSyncWidget.IntegerSyncer(() -> {
+ if (slots != slotsGetter.get()) {
+ slots = slotsGetter.get();
+ container.notifyChangeNoSync();
+ }
+ return slots;
+ }, i -> {
+ if (slots != i) {
+ slots = i;
+ container.notifyChangeNoSync();
+ }
+ }), builder)
+ .attachSyncer(new FakeSyncWidget.IntegerSyncer(() -> {
+ if (usedSlots != inventory.size()) {
+ usedSlots = inventory.size();
+ container.notifyChangeNoSync();
+ }
+ return usedSlots;
+ }, i -> {
+ if (usedSlots != i) {
+ usedSlots = i;
+ container.notifyChangeNoSync();
+ }
+ }), builder)
+ .attachSyncer(new FakeSyncWidget.ListSyncer<>(() -> {
+ HashMap<ItemID, Integer> itemMap = new HashMap<>();
+ HashMap<ItemID, ItemStack> stackMap = new HashMap<>();
+ HashMap<ItemID, ArrayList<Integer>> realSlotMap = new HashMap<>();
+ for (int i = 0, mStorageSize = inventory.size(); i < mStorageSize; i++) {
+ ItemStack stack = inventoryGetter.get(inventory.get(i));
+ ItemID id = ItemID.createNoCopy(stack, false);
+ itemMap.merge(id, 1, Integer::sum);
+ stackMap.putIfAbsent(id, stack);
+ realSlotMap.computeIfAbsent(id, unused -> new ArrayList<>())
+ .add(i);
+ }
+ List<GTHelper.StackableItemSlot> newDrawables = new ArrayList<>();
+ for (Map.Entry<ItemID, Integer> entry : itemMap.entrySet()) {
+ newDrawables.add(
+ new GTHelper.StackableItemSlot(
+ entry.getValue(),
+ stackMap.get(entry.getKey()),
+ realSlotMap.get(entry.getKey())));
+ }
+ if (!Objects.equals(newDrawables, drawables)) {
+ drawables = newDrawables;
+ container.notifyChangeNoSync();
+ }
+ return drawables;
+ }, l -> {
+ drawables.clear();
+ drawables.addAll(l);
+ container.notifyChangeNoSync();
+ }, (buffer, i) -> {
+ try {
+ i.write(buffer);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }, buffer -> {
+ try {
+ return GTHelper.StackableItemSlot.read(buffer);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }), builder);
+ if (isEnabledGetter != null) {
+ container.attachSyncer(new FakeSyncWidget.BooleanSyncer(isEnabledGetter, i -> isEnabled = i), builder);
+ }
+ return container;
+ }
+
+ List<GTHelper.StackableItemSlot> drawables = new ArrayList<>();
+
+ private Widget createWidget(EntityPlayer player) {
+ Scrollable dynamicInventoryWidget = new Scrollable().setVerticalScroll();
+
+ ArrayList<Widget> buttons = new ArrayList<>();
+
+ if (!ModUtils.isClientThreaded()) {
+ HashMap<ItemID, Integer> itemMap = new HashMap<>();
+ HashMap<ItemID, ItemStack> stackMap = new HashMap<>();
+ HashMap<ItemID, ArrayList<Integer>> realSlotMap = new HashMap<>();
+ for (int i = 0, inventorySize = inventory.size(); i < inventorySize; i++) {
+ ItemStack stack = inventoryGetter.get(inventory.get(i));
+ ItemID id = ItemID.createNoCopy(stack, false);
+ itemMap.merge(id, 1, Integer::sum);
+ stackMap.putIfAbsent(id, stack);
+ realSlotMap.computeIfAbsent(id, unused -> new ArrayList<>())
+ .add(i);
+ }
+ drawables = new ArrayList<>();
+ for (Map.Entry<ItemID, Integer> entry : itemMap.entrySet()) {
+ drawables.add(
+ new GTHelper.StackableItemSlot(
+ entry.getValue(),
+ stackMap.get(entry.getKey()),
+ realSlotMap.get(entry.getKey())));
+ }
+ }
+
+ for (int ID = 0; ID < drawables.size(); ID++) {
+ final int finalID = ID;
+ buttons.add(new ButtonWidget() {
+
+ @Override
+ public void drawBackground(float partialTicks) {
+ super.drawBackground(partialTicks);
+ if (!isEnabled) {
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_BLEND);
+ GlStateManager.colorMask(true, true, true, false);
+ ModularGui.drawSolidRect(1, 1, 16, 16, Color.withAlpha(Color.BLACK.normal, 0x80));
+ GlStateManager.colorMask(true, true, true, true);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+ // Copied from SlotWidget#draw
+ else if (isHovering() && !getContext().getCursor()
+ .hasDraggable()) {
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_BLEND);
+ GlStateManager.colorMask(true, true, true, false);
+ ModularGui.drawSolidRect(1, 1, 16, 16, Theme.INSTANCE.getSlotHighlight());
+ GlStateManager.colorMask(true, true, true, true);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+ }
+ }.setPlayClickSound(false)
+ .setOnClick((clickData, widget) -> {
+ if (!(player instanceof EntityPlayerMP)) return;
+ if (!isEnabledGetter.get()) return;
+
+ if (clickData.mouseButton == 2) {
+ // special button handler goes here
+ if (drawables.size() <= finalID) return;
+ if (player.capabilities.isCreativeMode && player.inventory.getItemStack() == null) {
+ int realID = drawables.get(finalID).realSlots.get(0);
+ ItemStack stack = inventoryGetter.get(inventory.get(realID))
+ .copy();
+ stack.stackSize = stack.getMaxStackSize();
+ player.inventory.setItemStack(stack);
+ ((EntityPlayerMP) player).isChangingQuantityOnly = false;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ }
+ } else if (clickData.shift) {
+ if (inventoryExtractor == null) return;
+ if (drawables.size() <= finalID) return;
+ int realID = drawables.get(finalID).realSlots.get(0);
+ T removed = inventoryExtractor.extract(realID);
+ if (removed != null) {
+ ItemStack stack = inventoryGetter.get(removed);
+ if (player.inventory.addItemStackToInventory(stack))
+ player.inventoryContainer.detectAndSendChanges();
+ else player.entityDropItem(stack, 0.f);
+ return;
+ }
+ } else {
+ ItemStack input = player.inventory.getItemStack();
+ if (input != null) {
+ if (drawables.size() > finalID) {
+ if (inventoryReplacer == null) return;
+ int realID = drawables.get(finalID).realSlots.get(0);
+ ItemStack removed = inventoryReplacer.replaceOrMerge(realID, input);
+ if (removed == null) return;
+ player.inventory.setItemStack(removed.stackSize == 0 ? null : removed);
+ } else {
+ if (inventoryInjector == null) return;
+ if (clickData.mouseButton == 1) {
+ ItemStack copy = input.copy();
+ copy.stackSize = 1;
+ ItemStack leftover = inventoryInjector.inject(copy);
+ if (leftover == null) return;
+ input.stackSize--;
+ if (input.stackSize > 0) {
+ ((EntityPlayerMP) player).isChangingQuantityOnly = true;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ } else player.inventory.setItemStack(null);
+ } else {
+ ItemStack leftover = inventoryInjector.inject(input);
+ if (leftover == null) return;
+ if (input.stackSize > 0) {
+ ((EntityPlayerMP) player).isChangingQuantityOnly = true;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ } else player.inventory.setItemStack(null);
+ }
+ }
+ ((EntityPlayerMP) player).isChangingQuantityOnly = false;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ }
+ if (drawables.size() > finalID) {
+ if (inventoryExtractor == null) return;
+ int realID = drawables.get(finalID).realSlots.get(0);
+ T removed = inventoryExtractor.extract(realID);
+ if (removed != null) {
+ ItemStack stack = inventoryGetter.get(removed);
+ player.inventory.setItemStack(stack);
+ ((EntityPlayerMP) player).isChangingQuantityOnly = false;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ }
+ }
+ }
+ })
+ .setBackground(
+ () -> new IDrawable[] { getItemSlot(),
+ new ItemDrawable(drawables.size() > finalID ? drawables.get(finalID).stack : null)
+ .withFixedSize(16, 16, 1, 1),
+ new Text(
+ (drawables.size() > finalID && drawables.get(finalID).count > 1)
+ ? (drawables.get(finalID).count > 99 ? "+99"
+ : String.valueOf(drawables.get(finalID).count))
+ : "").color(Color.WHITE.normal)
+ .alignment(Alignment.TopLeft)
+ .withOffset(1, 1),
+ new Text(
+ (drawables.size() > finalID && drawables.get(finalID).stack.stackSize > 1)
+ ? String.valueOf(drawables.get(finalID).stack.stackSize)
+ : "").color(Color.WHITE.normal)
+ .shadow()
+ .alignment(Alignment.BottomRight) })
+ .dynamicTooltip(() -> {
+ if (drawables.size() > finalID) {
+ List<String> tip = new ArrayList<>(
+ Collections.singletonList(drawables.get(finalID).stack.getDisplayName()));
+ if (drawables.get(finalID).count > 1) tip.add(
+ EnumChatFormatting.DARK_PURPLE + "There are "
+ + drawables.get(finalID).count
+ + " identical slots");
+ return tip;
+ }
+ return Collections.emptyList();
+ })
+ .setSize(18, 18));
+ }
+
+ buttons.add(new ButtonWidget() {
+
+ @Override
+ public void drawBackground(float partialTicks) {
+ super.drawBackground(partialTicks);
+ if (!isEnabled) {
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_BLEND);
+ GlStateManager.colorMask(true, true, true, false);
+ ModularGui.drawSolidRect(1, 1, 16, 16, Color.withAlpha(Color.BLACK.normal, 0x80));
+ GlStateManager.colorMask(true, true, true, true);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+ // Copied from SlotWidget#draw
+ else if (isHovering() && !getContext().getCursor()
+ .hasDraggable()) {
+ GL11.glDisable(GL11.GL_LIGHTING);
+ GL11.glEnable(GL11.GL_BLEND);
+ GlStateManager.colorMask(true, true, true, false);
+ ModularGui.drawSolidRect(1, 1, 16, 16, Theme.INSTANCE.getSlotHighlight());
+ GlStateManager.colorMask(true, true, true, true);
+ GL11.glDisable(GL11.GL_BLEND);
+ }
+ }
+ }.setPlayClickSound(false)
+ .setOnClick((clickData, widget) -> {
+ if (!(player instanceof EntityPlayerMP)) return;
+ if (!isEnabledGetter.get()) return;
+ ItemStack input = player.inventory.getItemStack();
+ if (input != null) {
+ if (clickData.mouseButton == 1) {
+ ItemStack copy = input.copy();
+ copy.stackSize = 1;
+ ItemStack leftover = inventoryInjector.inject(copy);
+ if (leftover == null) return;
+ input.stackSize--;
+ if (input.stackSize > 0) {
+ ((EntityPlayerMP) player).isChangingQuantityOnly = true;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ } else player.inventory.setItemStack(null);
+ } else {
+ ItemStack leftover = inventoryInjector.inject(input);
+ if (leftover == null) return;
+ if (input.stackSize > 0) {
+ ((EntityPlayerMP) player).isChangingQuantityOnly = true;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ } else player.inventory.setItemStack(null);
+ }
+ ((EntityPlayerMP) player).isChangingQuantityOnly = false;
+ ((EntityPlayerMP) player).updateHeldItem();
+ return;
+ }
+ })
+ .setBackground(
+ () -> new IDrawable[] { getItemSlot(),
+ new Text(
+ (slots - usedSlots) <= 1 ? ""
+ : ((slots - usedSlots) > 99 ? "+99" : String.valueOf((slots - usedSlots))))
+ .color(Color.WHITE.normal)
+ .alignment(Alignment.TopLeft)
+ .withOffset(1, 1) })
+ .dynamicTooltip(() -> {
+ List<String> tip = new ArrayList<>(Collections.singleton(EnumChatFormatting.GRAY + "Empty slot"));
+ if (slots - usedSlots > 1)
+ tip.add(EnumChatFormatting.DARK_PURPLE + "There are " + (slots - usedSlots) + " identical slots");
+ return tip;
+ })
+ .setSize(18, 18));
+
+ final int perRow = width / 18;
+ for (int i = 0, imax = ((buttons.size() - 1) / perRow); i <= imax; i++) {
+ DynamicPositionedRow row = new DynamicPositionedRow().setSynced(false);
+ for (int j = 0, jmax = (i == imax ? (buttons.size() - 1) % perRow : (perRow - 1)); j <= jmax; j++) {
+ final int finalI = i * perRow;
+ final int finalJ = j;
+ final int ID = finalI + finalJ;
+ row.widget(buttons.get(ID));
+ }
+ dynamicInventoryWidget.widget(row.setPos(0, i * 18));
+ }
+
+ return dynamicInventoryWidget.setSize(width, height);
+ }
+
+ @FunctionalInterface
+ public interface TInventoryGetter<T> {
+
+ /**
+ * Allows to get an ItemStack from the dynamic inventory
+ *
+ * @param from Dynamic inventory item from which we want to take an item out
+ * @return ItemStack or null if inaccessible
+ */
+ ItemStack get(T from);
+ }
+
+ @FunctionalInterface
+ public interface TInventoryInjector {
+
+ /**
+ * Allows to insert an item to the dynamic inventory
+ *
+ * @param what ItemStack which we are trying to insert
+ * @return Leftover ItemStack (stackSize == 0 if everything has been inserted) or null
+ */
+ ItemStack inject(ItemStack what);
+ }
+
+ @FunctionalInterface
+ public interface TInventoryExtractor<T> {
+
+ /**
+ * Allows to extract an item from the dynamic inventory
+ *
+ * @param where Index from where we want to take an item out
+ * @return Item that we took out or null
+ */
+ T extract(int where);
+ }
+
+ @FunctionalInterface
+ public interface TInventoryReplacerOrMerger {
+
+ /**
+ * Allows to replace an item in Dynamic Inventory
+ *
+ * @param where which index we want to replace
+ * @param stack what stack we want to replace it with
+ * @return Stack that we are left with or null
+ */
+ ItemStack replaceOrMerge(int where, ItemStack stack);
+ }
+
+}
diff --git a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java
index e561e712fe..119ce94019 100644
--- a/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java
+++ b/src/main/java/kubatech/api/implementations/KubaTechGTMultiBlockBase.java
@@ -20,9 +20,11 @@
package kubatech.api.implementations;
+import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
import static kubatech.api.Variables.ln2;
import static kubatech.api.Variables.ln4;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
@@ -33,6 +35,11 @@ import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fluids.FluidStack;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
+import com.gtnewhorizons.modularui.api.drawable.Text;
+import com.gtnewhorizons.modularui.api.drawable.UITexture;
+import com.gtnewhorizons.modularui.api.math.Color;
+import com.gtnewhorizons.modularui.api.math.MainAxisAlignment;
+import com.gtnewhorizons.modularui.api.math.Pos2d;
import com.gtnewhorizons.modularui.api.screen.ITileWithModularUI;
import com.gtnewhorizons.modularui.api.screen.ModularUIContext;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
@@ -42,6 +49,10 @@ import com.gtnewhorizons.modularui.common.builder.UIBuilder;
import com.gtnewhorizons.modularui.common.builder.UIInfo;
import com.gtnewhorizons.modularui.common.internal.wrapper.ModularGui;
import com.gtnewhorizons.modularui.common.internal.wrapper.ModularUIContainer;
+import com.gtnewhorizons.modularui.common.widget.Column;
+import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
+import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn;
+import com.gtnewhorizons.modularui.common.widget.SlotWidget;
import gregtech.api.enums.GT_Values;
import gregtech.api.gui.modularui.GT_UITextures;
@@ -50,6 +61,7 @@ import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
import gregtech.common.tileentities.machines.GT_MetaTileEntity_Hatch_OutputBus_ME;
+import kubatech.Tags;
public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T>>
extends GT_MetaTileEntity_ExtendedPowerMultiBlockBase<T> {
@@ -244,6 +256,76 @@ public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_Exten
// UI stuff
+ public static final UITexture PICTURE_KUBATECH_LOGO = UITexture.fullImage(Tags.MODID, "gui/logo_13x15_dark");
+
+ @Override
+ public boolean useModularUI() {
+ return true;
+ }
+
+ @Override
+ public void addGregTechLogo(ModularWindow.Builder builder) {
+ builder.widget(
+ new DrawableWidget().setDrawable(PICTURE_KUBATECH_LOGO)
+ .setSize(13, 15)
+ .setPos(191 - 13, 86 - 15)
+ .addTooltip(new Text(Tags.MODNAME).color(Color.GRAY.normal))
+ .setTooltipShowUpDelay(TOOLTIP_DELAY));
+ }
+
+ protected List<SlotWidget> slotWidgets = new ArrayList<>(1);
+
+ public void createInventorySlots() {
+ final SlotWidget inventorySlot = new SlotWidget(inventoryHandler, 1);
+ inventorySlot.setBackground(GT_UITextures.SLOT_DARK_GRAY);
+ slotWidgets.add(inventorySlot);
+ }
+
+ @Override
+ public Pos2d getPowerSwitchButtonPos() {
+ return new Pos2d(174, 166 - (slotWidgets.size() * 18));
+ }
+
+ @Override
+ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
+ builder.widget(
+ new DrawableWidget().setDrawable(GT_UITextures.PICTURE_SCREEN_BLACK)
+ .setPos(4, 4)
+ .setSize(190, 85));
+
+ slotWidgets.clear();
+ createInventorySlots();
+
+ Column slotsColumn = new Column();
+ for (int i = slotWidgets.size() - 1; i >= 0; i--) {
+ slotsColumn.widget(slotWidgets.get(i));
+ }
+ builder.widget(
+ slotsColumn.setAlignment(MainAxisAlignment.END)
+ .setPos(173, 167 - 1));
+
+ final DynamicPositionedColumn screenElements = new DynamicPositionedColumn();
+ drawTexts(screenElements, slotWidgets.size() > 0 ? slotWidgets.get(0) : null);
+ builder.widget(screenElements);
+
+ builder.widget(createPowerSwitchButton(builder))
+ .widget(createVoidExcessButton(builder))
+ .widget(createInputSeparationButton(builder))
+ .widget(createBatchModeButton(builder))
+ .widget(createLockToSingleRecipeButton(builder));
+
+ DynamicPositionedColumn configurationElements = new DynamicPositionedColumn();
+ addConfigurationWidgets(configurationElements, buildContext);
+
+ builder.widget(
+ configurationElements.setAlignment(MainAxisAlignment.END)
+ .setPos(getPowerSwitchButtonPos().subtract(0, 18)));
+ }
+
+ protected void addConfigurationWidgets(DynamicPositionedColumn configurationElements, UIBuildContext buildContext) {
+
+ }
+
protected static String voltageTooltipFormatted(int tier) {
return GT_Values.TIER_COLORS[tier] + GT_Values.VN[tier] + EnumChatFormatting.GRAY;
}
@@ -252,4 +334,6 @@ public abstract class KubaTechGTMultiBlockBase<T extends GT_MetaTileEntity_Exten
protected static final Function<Integer, IDrawable> toggleButtonTextureGetter = val -> val == 0
? GT_UITextures.OVERLAY_BUTTON_CROSS
: GT_UITextures.OVERLAY_BUTTON_CHECKMARK;
+ protected static final Function<Integer, IDrawable[]> toggleButtonBackgroundGetter = val -> new IDrawable[] {
+ val == 0 ? GT_UITextures.BUTTON_STANDARD : GT_UITextures.BUTTON_STANDARD_PRESSED };
}
diff --git a/src/main/java/kubatech/loaders/RecipeLoader.java b/src/main/java/kubatech/loaders/RecipeLoader.java
index b8e8abfc8f..a9492a6535 100644
--- a/src/main/java/kubatech/loaders/RecipeLoader.java
+++ b/src/main/java/kubatech/loaders/RecipeLoader.java
@@ -165,15 +165,22 @@ public class RecipeLoader {
}
private static boolean registerMTE(ItemList item, Class<? extends MetaTileEntity> mte, String aName,
- String aNameRegional, boolean dep) {
+ String aNameRegional, boolean... deps) {
if (MTEID > MTEIDMax) throw new RuntimeException("MTE ID's");
- registerMTEUsingID(MTEID, item, mte, aName, aNameRegional, dep);
+ boolean dep = registerMTEUsingID(MTEID, item, mte, aName, aNameRegional, deps);
MTEID++;
return dep;
}
private static boolean registerMTEUsingID(int ID, ItemList item, Class<? extends MetaTileEntity> mte, String aName,
- String aNameRegional, boolean dep) {
+ String aNameRegional, boolean... deps) {
+ boolean dep = true;
+ for (boolean b : deps) {
+ if (!b) {
+ dep = false;
+ break;
+ }
+ }
if (dep) {
try {
item.set(
diff --git a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeEntityCrusher.java b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeEntityCrusher.java
index b7fec167cb..25b5a43d8f 100644
--- a/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeEntityCrusher.java
+++ b/src/main/java/kubatech/tileentity/gregtech/multiblock/GT_MetaTileEntity_ExtremeEntityCrusher.java
@@ -24,7 +24,6 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.isAir;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
-import static com.kuba6000.mobsinfo.api.MobRecipe.MobNameToRecipeMap;
import static gregtech.api.enums.GT_HatchElement.Energy;
import static gregtech.api.enums.GT_HatchElement.InputBus;
import static gregtech.api.enums.GT_HatchElement.Maintenance;
@@ -34,6 +33,7 @@ import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE_GLOW;
import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_DISTILLATION_TOWER_GLOW;
+import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY;
import static gregtech.api.util.GT_StructureUtility.buildHatchAdder;
import static gregtech.api.util.GT_StructureUtility.ofFrame;
import static kubatech.api.Variables.Author;
@@ -61,7 +61,6 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.EnumChatFormatting;
-import net.minecraft.util.StatCollector;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.WorldProviderHell;
@@ -82,20 +81,14 @@ import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import com.gtnewhorizons.modularui.api.drawable.Text;
+import com.gtnewhorizons.modularui.api.drawable.UITexture;
+import com.gtnewhorizons.modularui.api.forge.ItemStackHandler;
import com.gtnewhorizons.modularui.api.math.Color;
-import com.gtnewhorizons.modularui.api.math.Pos2d;
-import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.CycleButtonWidget;
-import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
import com.gtnewhorizons.modularui.common.widget.DynamicPositionedColumn;
-import com.gtnewhorizons.modularui.common.widget.DynamicPositionedRow;
-import com.gtnewhorizons.modularui.common.widget.DynamicTextWidget;
-import com.gtnewhorizons.modularui.common.widget.FakeSyncWidget;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
-import com.gtnewhorizons.modularui.common.widget.TextWidget;
import com.kuba6000.mobsinfo.api.utils.FastRandom;
-import com.kuba6000.mobsinfo.api.utils.ItemID;
import com.mojang.authlib.GameProfile;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
@@ -121,6 +114,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energ
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
+import gregtech.api.recipe.check.SimpleCheckRecipeResult;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
import gregtech.api.util.GT_Utility;
@@ -129,6 +123,7 @@ import kubatech.api.LoaderReference;
import kubatech.api.helpers.ReflectionHelper;
import kubatech.api.implementations.KubaTechGTMultiBlockBase;
import kubatech.api.tileentity.CustomTileEntityPacketHandler;
+import kubatech.api.utils.ModUtils;
import kubatech.client.effect.EntityRenderer;
import kubatech.loaders.MobHandlerLoader;
import kubatech.network.CustomTileEntityPacket;
@@ -223,6 +218,10 @@ public class GT_MetaTileEntity_ExtremeEntityCrusher
aNBT.setBoolean("mAnimationEnabled", mAnimationEnabled);
aNBT.setByte("mGlassTier", mGlassTier);
aNBT.setBoolean("mIsProducingInfernalDrops", mIsProducingInfernalDrops);
+ if (weaponCache.getStackInSlot(0) != null) aNBT.setTag(
+ "weaponCache",
+ weaponCache.getStackInSlot(0)
+ .writeToNBT(new NBTTagCompound()));
}
@Override
@@ -233,6 +232,8 @@ public class GT_MetaTileEntity_ExtremeEntityCrusher
mGlassTier = aNBT.getByte("mGlassTier");
mIsProducingInfernalDrops = !aNBT.hasKey("mIsProducingInfernalDrops")
|| aNBT.getBoolean("mIsProducingInfernalDrops");
+ if (aNBT.hasKey("weaponCache"))
+ weaponCache.setStackInSlot(0, ItemStack.loadItemStackFromNBT(aNBT.getCompoundTag("weaponCache")));
}
@Override
@@ -266,7 +267,7 @@ public class GT_MetaTileEntity_ExtremeEntityCrusher
.addInfo("Base energy usage: 2,000 EU/t")
.addInfo("Supports perfect OC, minimum time: 20 ticks, after that multiplies the outputs.")
.addInfo("Recipe time is based on mob health.")
- .addInfo("You can additionally put a weapon in the ULV input bus.")
+ .addInfo("You can additionally put a weapon inside the GUI.")
.addInfo("It will speed up the process and apply the looting level from the weapon (maximum 4 levels).")
.addInfo(EnumChatFormatting.RED + "Enchanting the spikes inside does nothing!")
.addInfo("Also produces 120 Liquid XP per operation.")
@@ -287,10 +288,6 @@ public class GT_MetaTileEntity_ExtremeEntityCrusher
.addOtherStructurePart("Steel Frame Box", "All vertical edges without corners")
.addOtherStructurePart("Diamond spikes", "Inside second layer")
.addOutputBus("Any bottom casing", 1)
- .addOtherStructurePart(
- "1x ULV " + StatCollector.translateToLocal("GT5U.MBTT.InputBus"),
- "Any bottom casing",
- 1)
.addOutputHatch("Any bottom casing", 1)
.addEnergyHatch("Any bottom casing", 1)
.addMaintenanceHatch("Any bottom casing", 1)
@@ -478,12 +475,41