Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTOS stuff #115

Merged
merged 40 commits into from
Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
91648bb
rewrite WorldSceneRenderer
Yefancy Aug 24, 2021
ef77b21
Orbit Camera
Yefancy Aug 24, 2021
a3b6644
using gluUnproject + rayTrace for more accurate and more reliable res…
Yefancy Aug 24, 2021
4bbad19
rewrite renderer again (real world renderer rn)
Yefancy Aug 25, 2021
9d289df
finish console app
Yefancy Aug 27, 2021
76cf77e
support IControllable AbstractRecipeLogic RecipeLogicSteam
Yefancy Aug 27, 2021
69fb65b
Quantum chest + tank
Yefancy Aug 27, 2021
4049b4f
fix ref
Yefancy Aug 27, 2021
30c4cf1
Update SimpleMachineMetaTileEntity.java
Yefancy Aug 28, 2021
cc0de0c
Merge branch 'master' into app_console
Yefancy Aug 29, 2021
ab0b16f
support maintenance and fix capability
Yefancy Aug 29, 2021
cbfaca7
Terminal hw upgrade (#128)
Yefancy Aug 31, 2021
85fea91
Merge branch 'master' into app_console
Yefancy Aug 31, 2021
c5f41ec
battery energy cost
Yefancy Sep 2, 2021
c086e9c
Merge branch 'master' into app_console
Yefancy Sep 2, 2021
b2edc8c
Squashed commit of the following:
Yefancy Sep 4, 2021
b635ea5
rebase fix conflicts
Yefancy Sep 4, 2021
8242ad4
battery
Yefancy Sep 4, 2021
d133921
Merge branch 'master' into app_console
Yefancy Sep 4, 2021
99faf56
battery manager
Yefancy Sep 4, 2021
9072fec
move nbt to terminal/config
Yefancy Sep 5, 2021
07250a3
add block drawinforeground method in destop
Yefancy Sep 5, 2021
754fc19
Hardware manager
Yefancy Sep 6, 2021
1dc47d6
fix terminal background app add ShaderTexture add config for renderin…
Yefancy Sep 6, 2021
e296756
fix dialog close bug + rawshadertexture
Yefancy Sep 7, 2021
b60d995
cleanup events
Yefancy Sep 7, 2021
062bb8c
comments for terminal api
Yefancy Sep 7, 2021
c766083
finish hardware sys
Yefancy Sep 9, 2021
c71c91a
app store (Semi-finished)
Yefancy Sep 10, 2021
fa97c70
finish app store
Yefancy Sep 11, 2021
12ad469
fix blockApp fix string configurator fix add stream add hardware page
Yefancy Sep 11, 2021
2b2eedf
clean up
Yefancy Sep 11, 2021
8cc7666
DepthTextureHook
Yefancy Sep 11, 2021
67f788d
finish depthtexture hook
Yefancy Sep 12, 2021
d9bbe72
rework AR apps
Yefancy Sep 13, 2021
202405c
multiblock AR app
Yefancy Sep 16, 2021
722c657
world prospector
Yefancy Sep 17, 2021
5f933f1
Squashed commit of the following:
Yefancy Sep 17, 2021
1c37d06
Squashed commit of the following:
Yefancy Sep 17, 2021
d4485db
Update MachineBuilderWidget.java
Yefancy Sep 17, 2021
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
5 changes: 1 addition & 4 deletions src/main/java/gregtech/GregTechMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import gregtech.api.model.ResourcePackHook;
import gregtech.api.net.NetworkHandler;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.terminal.util.GuideJsonLoader;
import gregtech.api.terminal.TerminalRegistry;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.IMaterialHandler;
import gregtech.api.unification.material.MaterialRegistry;
Expand All @@ -37,8 +37,6 @@
import gregtech.common.worldgen.WorldGenRubberTree;
import gregtech.integration.theoneprobe.TheOneProbeCompatibility;
import gregtech.loaders.dungeon.DungeonLootLoader;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.SimpleReloadableResourceManager;
import gregtech.loaders.recipe.component.AnnotatedComponentHandlerLoader;
import net.minecraftforge.classloading.FMLForgePlugin;
import net.minecraftforge.fluids.FluidRegistry;
Expand Down Expand Up @@ -66,7 +64,6 @@ public class GregTechMod {
BlockOreFactory.init();
BlockCompressedFactory.init();
BlockFrameFactory.init();
((SimpleReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new GuideJsonLoader());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import gregtech.api.capability.tool.IScrewdriverItem;
import gregtech.api.capability.tool.ISoftHammerItem;
import gregtech.api.capability.tool.IWrenchItem;
import gregtech.api.terminal.hardware.HardwareProvider;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.capabilities.Capability;
Expand Down Expand Up @@ -41,6 +42,9 @@ public class GregtechCapabilities {
@CapabilityInject(IMultiblockController.class)
public static Capability<IMultiblockController> CAPABILITY_MULTIBLOCK_CONTROLLER = null;

@CapabilityInject(HardwareProvider.class)
public static Capability<HardwareProvider> CAPABILITY_HARDWARE_PROVIDER = null;

private static final ResourceLocation CAPABILITY_EU_TO_FE = new ResourceLocation(GTValues.MODID, "fe_capability");

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package gregtech.api.capability;

import gregtech.api.capability.impl.AbstractRecipeLogic;
import gregtech.api.cover.ICoverable;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityInject;
Expand All @@ -18,4 +19,7 @@ public class GregtechTileCapabilities {
@CapabilityInject(IActiveOutputSide.class)
public static Capability<IActiveOutputSide> CAPABILITY_ACTIVE_OUTPUT_SIDE = null;

@CapabilityInject(AbstractRecipeLogic.class)
public static Capability<AbstractRecipeLogic> CAPABILITY_RECIPE_LOGIC = null;

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@ public interface IActiveOutputSide {

boolean isAutoOutputFluids();

boolean isAllowInputFromOutputSide();
boolean isAllowInputFromOutputSideItems();

boolean isAllowInputFromOutputSideFluids();
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package gregtech.api.capability;

import gregtech.api.capability.impl.AbstractRecipeLogic;
import gregtech.api.capability.tool.ICutterItem;
import gregtech.api.capability.tool.IScrewdriverItem;
import gregtech.api.capability.tool.ISoftHammerItem;
import gregtech.api.capability.tool.IWrenchItem;
import gregtech.api.cover.ICoverable;
import gregtech.api.terminal.hardware.HardwareProvider;
import gregtech.api.worldgen.generator.GTWorldGenCapability;
import net.minecraft.nbt.NBTBase;
import net.minecraft.util.EnumFacing;
Expand Down Expand Up @@ -42,6 +44,8 @@ public static void init() {
registerCapabilityWithNoDefault(IActiveOutputSide.class);
registerCapabilityWithNoDefault(IFuelable.class);
registerCapabilityWithNoDefault(IMultiblockController.class);
registerCapabilityWithNoDefault(AbstractRecipeLogic.class);
registerCapabilityWithNoDefault(HardwareProvider.class);

registerCapabilityWithNoDefault(IWrenchItem.class);
registerCapabilityWithNoDefault(ICutterItem.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import net.minecraftforge.common.util.Constants;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.IItemHandlerModifiable;

import java.util.ArrayList;
Expand Down Expand Up @@ -108,6 +107,8 @@ public <T> T getCapability(Capability<T> capability) {
return GregtechTileCapabilities.CAPABILITY_WORKABLE.cast(this);
} else if (capability == GregtechTileCapabilities.CAPABILITY_CONTROLLABLE) {
return GregtechTileCapabilities.CAPABILITY_CONTROLLABLE.cast(this);
} else if (capability == GregtechTileCapabilities.CAPABILITY_RECIPE_LOGIC) {
return GregtechTileCapabilities.CAPABILITY_RECIPE_LOGIC.cast(this);
}
return null;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/gregtech/api/gui/GuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public class GuiTextures {
public static final TextureArea BUTTON_OVERCLOCK = TextureArea.fullImage("textures/gui/widget/button_overclock.png");
public static final TextureArea BUTTON_RIGHT = TextureArea.fullImage("textures/gui/widget/right.png");
public static final TextureArea BUTTON_SWITCH_VIEW = TextureArea.fullImage("textures/gui/widget/button_switch_view.png");
public static final TextureArea BUTTON_WORKING_ENABLE = TextureArea.fullImage("textures/gui/widget/button_working_enable.png");
public static final TextureArea CLIPBOARD_BUTTON = TextureArea.fullImage("textures/gui/widget/clipboard_button.png");
public static final SizedTextureArea CLIPBOARD_TEXT_BOX = AdoptableTextureArea.fullImage("textures/gui/widget/clipboard_text_box.png", 9, 18, 1, 1);
public static final TextureArea DISTRIBUTION_MODE = TextureArea.fullImage("textures/gui/widget/button_distribution_mode.png");
Expand Down Expand Up @@ -203,5 +204,7 @@ public class GuiTextures {
public final static TextureArea ICON_LOCATION = TextureArea.fullImage("textures/gui/terminal/icon/guide_hover.png");
public final static TextureArea ICON_VISIBLE = TextureArea.fullImage("textures/gui/terminal/icon/appearance_hover.png");
public final static TextureArea ICON_CALCULATOR = TextureArea.fullImage("textures/gui/terminal/icon/other/calculator_hover.png");
public final static TextureArea UI_FRAME_SIDE_UP = TextureArea.fullImage("textures/gui/terminal/frame_side_up.png");
public final static TextureArea UI_FRAME_SIDE_DOWN = TextureArea.fullImage("textures/gui/terminal/frame_side_down.png");

}
5 changes: 1 addition & 4 deletions src/main/java/gregtech/api/gui/INativeWidget.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@
* That means controls are delegated to vanilla {@link net.minecraft.client.gui.inventory.GuiContainer}
* Rendering is still handled by widget via helpers in {@link gregtech.api.gui.IRenderContext}
*/
public interface INativeWidget extends EnableNotifiedWidget {
public interface INativeWidget {

ItemStack VANILLA_LOGIC = new ItemStack(Items.AIR);

@Override
void setEnabled(boolean isEnabled);

/**
* You should return MC slot handle instance you created earlier
*
Expand Down
1 change: 1 addition & 0 deletions src/main/java/gregtech/api/gui/ModularUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public final class ModularUI implements ISizeProvider {
private final ImmutableList<Runnable> uiCloseCallback;

public boolean isJEIHandled;
public boolean needNativeClick;

/**
* UIHolder of this modular UI
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/gregtech/api/gui/Widget.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,11 +275,11 @@ protected void writeClientAction(int id, Consumer<PacketBuffer> packetBufferWrit
}

@SideOnly(Side.CLIENT)
public void drawBorder(int x, int y, int width, int height, int stroke, int stroke_width) {
drawGradientRect(x - stroke_width, y - stroke_width, width + 2 * stroke_width, stroke_width, stroke, stroke);
drawGradientRect(x - stroke_width, y + height, width + 2 * stroke_width, stroke_width, stroke, stroke);
drawGradientRect(x - stroke_width, y - stroke_width, stroke_width, height + 2 * stroke_width, stroke, stroke);
drawGradientRect(x + width, y - stroke_width, stroke_width, height + 2 * stroke_width, stroke, stroke);
public static void drawBorder(int x, int y, int width, int height, int color, int border) {
drawSolidRect(x - border, y - border, width + 2 * border, border, color);
drawSolidRect(x - border, y + height, width + 2 * border, border, color);
drawSolidRect(x - border, y, border, height, color);
drawSolidRect(x + width, y, border, height, color);
}

@SideOnly(Side.CLIENT)
Expand All @@ -291,18 +291,18 @@ public void drawHoveringText(ItemStack itemStack, List<String> tooltip, int maxT
}

@SideOnly(Side.CLIENT)
public void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, boolean center) {
public static void drawStringSized(String text, double x, double y, int color, boolean dropShadow, float scale, boolean center) {
GlStateManager.pushMatrix();
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
double scaledTextWidth = center ? fontRenderer.getStringWidth(text) * scale : 0.0;
GlStateManager.translate(x + scaledTextWidth / 2.0, y, 0.0f);
GlStateManager.translate(x - scaledTextWidth / 2.0, y, 0.0f);
GlStateManager.scale(scale, scale, scale);
fontRenderer.drawString(text, 0, 0, color, dropShadow);
GlStateManager.popMatrix();
}

@SideOnly(Side.CLIENT)
public void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, float scale) {
public static void drawStringFixedCorner(String text, double x, double y, int color, boolean dropShadow, float scale) {
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
double scaledWidth = fontRenderer.getStringWidth(text) * scale;
double scaledHeight = fontRenderer.FONT_HEIGHT * scale;
Expand Down
28 changes: 14 additions & 14 deletions src/main/java/gregtech/api/gui/impl/ModularUIGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,6 @@ public void setHoveredSlot(Slot hoveredSlot) {
this.hoveredSlot = hoveredSlot;
}

@Deprecated
public void drawSlotContents(Slot slot) {
GlStateManager.enableDepth();
RenderHelper.enableGUIStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
drawSlot(slot);
GlStateManager.enableDepth();
GlStateManager.enableBlend();
GlStateManager.disableLighting();
}

@Deprecated
public void renderSlotOverlay(Slot slot) {
GlStateManager.disableDepth();
Expand Down Expand Up @@ -240,17 +228,25 @@ protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOEx
for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) {
Widget widget = modularUI.guiWidgets.get(i);
if(widget.isVisible() && widget.isActive() && widget.mouseClicked(mouseX, mouseY, mouseButton)) {
if (getModularUI().needNativeClick) {
super.mouseClicked(mouseX, mouseY, mouseButton);
getModularUI().needNativeClick = false;
}
return;
}
}
super.mouseClicked(mouseX, mouseY, mouseButton);
// super.mouseClicked(mouseX, mouseY, mouseButton);
}

@Override
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) {
for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) {
Widget widget = modularUI.guiWidgets.get(i);
if(widget.isVisible() && widget.isActive() && widget.mouseDragged(mouseX, mouseY, clickedMouseButton, timeSinceLastClick)) {
if (getModularUI().needNativeClick) {
super.mouseClickMove(mouseX, mouseY, clickedMouseButton, timeSinceLastClick);
getModularUI().needNativeClick = false;
}
return;
}
}
Expand All @@ -262,10 +258,14 @@ protected void mouseReleased(int mouseX, int mouseY, int state) {
for (int i = modularUI.guiWidgets.size() - 1; i >= 0; i--) {
Widget widget = modularUI.guiWidgets.get(i);
if(widget.isVisible() && widget.isActive() && widget.mouseReleased(mouseX, mouseY, state)) {
if (getModularUI().needNativeClick) {
super.mouseReleased(mouseX, mouseY, state);
getModularUI().needNativeClick = false;
}
return;
}
}
super.mouseReleased(mouseX, mouseY, state);
// super.mouseReleased(mouseX, mouseY, state);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ public void draw(double x, double y, int width, int height) {
bufferbuilder.pos(x, y, 0.0D).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.color(1, 1, 1, 1);
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package gregtech.api.gui.resources;

import gregtech.api.gui.widgets.SlotWidget;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL14;

public class ItemStackTexture implements IGuiTexture{
private final ItemStack[] itemStack;
Expand Down Expand Up @@ -35,6 +38,8 @@ public void updateTick() {

@Override
public void draw(double x, double y, int width, int height) {
RenderHelper.disableStandardItemLighting();
GlStateManager.disableDepth();
RenderHelper.enableGUIStandardItemLighting();
GlStateManager.pushMatrix();
GlStateManager.scale(width / 16f, height / 16f, 0.0001);
Expand Down
Loading