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 all 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 @@ -13,7 +13,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.Material;
Expand All @@ -39,8 +39,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.common.MinecraftForge;
Expand Down Expand Up @@ -71,7 +69,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();
}
2 changes: 2 additions & 0 deletions src/main/java/gregtech/api/capability/IElectricItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public interface IElectricItem {
*/
boolean canProvideChargeExternally();

boolean chargeable();

/**
* Adds charge listener to this electric item
*
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ public boolean canProvideChargeExternally() {
return this.canProvideEnergyExternally;
}

@Override
public boolean chargeable() {
return chargeable;
}

@Override
public long charge(long amount, int chargerTier, boolean ignoreTransferLimit, boolean simulate) {
if (itemStack.getCount() != 1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderWorldLastEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
Expand All @@ -34,17 +32,15 @@
* @Description: ParticleManger register, spawn, efficient rendering, update our custom particles.
*/
@SideOnly(Side.CLIENT)
@Mod.EventBusSubscriber(Side.CLIENT)
public class GTParticleManager {
public static GTParticleManager instance = new GTParticleManager();
public final static GTParticleManager INSTANCE = new GTParticleManager();

private static World currentWorld = null;
private static ParticleManager particleManager = Minecraft.getMinecraft().effectRenderer;

private final Map<IGTParticleHandler, ArrayDeque<GTParticle>[]> renderQueue = new HashMap<>();
private final Queue<Tuple<IGTParticleHandler, GTParticle>> newParticleQueue = new ArrayDeque<>();

private GTParticleManager() { }

public void addEffect(Particle... particles) {
if (particleManager == null) {
particleManager = Minecraft.getMinecraft().effectRenderer;
Expand All @@ -59,9 +55,7 @@ public void addEffect(Particle... particles) {
}

public void updateEffects() {
for (int i = 0; i < 4; ++i) {
updateEffectLayer(i);
}
updateEffectLayer();
if (!newParticleQueue.isEmpty()) {
for (Tuple<IGTParticleHandler, GTParticle> handlerParticle = newParticleQueue.poll(); handlerParticle != null; handlerParticle = newParticleQueue.poll()) {
IGTParticleHandler handler = handlerParticle.getFirst();
Expand All @@ -79,20 +73,28 @@ public void updateEffects() {
}
}

private void updateEffectLayer(int layer) {
private void updateEffectLayer() {
if (renderQueue.isEmpty()) return;
boolean empty = true;
for (ArrayDeque<GTParticle>[] array : renderQueue.values()) {
ArrayDeque<GTParticle> queue = array[layer];
if (!queue.isEmpty()) {
Iterator<GTParticle> iterator = queue.iterator();
while (iterator.hasNext()) {
Particle particle = iterator.next();
tickParticle(particle);
if (!particle.isAlive()) {
iterator.remove();
for (int layer = 0; layer < 4; ++layer) {
ArrayDeque<GTParticle> queue = array[layer];
if (!queue.isEmpty()) {
empty = false;
Iterator<GTParticle> iterator = queue.iterator();
while (iterator.hasNext()) {
Particle particle = iterator.next();
tickParticle(particle);
if (!particle.isAlive()) {
iterator.remove();
}
}
}
}
}
if (empty) {
renderQueue.clear();
}
}

public void clearAllEffects() {
Expand Down Expand Up @@ -123,6 +125,7 @@ public String call() {
}

public void renderParticles(Entity entityIn, float partialTicks) {
if (renderQueue.isEmpty()) return;
float rotationX = ActiveRenderInfo.getRotationX();
float rotationZ = ActiveRenderInfo.getRotationZ();
float rotationYZ = ActiveRenderInfo.getRotationYZ();
Expand All @@ -141,8 +144,6 @@ public void renderParticles(Entity entityIn, float partialTicks) {

renderGlParticlesInLayer(tessellator, entityIn, partialTicks, rotationX, rotationZ, rotationYZ, rotationXY, rotationXZ);



GlStateManager.depthMask(true);
GlStateManager.disableBlend();
GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
Expand Down Expand Up @@ -185,7 +186,6 @@ public String getStatistics() {
return " GLFX: " + g;
}

@SubscribeEvent
public static void clientTick(TickEvent.ClientTickEvent event) {
Minecraft mc = Minecraft.getMinecraft();
if (event.phase != TickEvent.Phase.END || mc.isGamePaused()) {
Expand All @@ -194,24 +194,22 @@ public static void clientTick(TickEvent.ClientTickEvent event) {

if (currentWorld != mc.world) {
currentWorld = mc.world;
instance.clearAllEffects();
INSTANCE.clearAllEffects();
}

if (mc.world != null) {
instance.updateEffects();
INSTANCE.updateEffects();
}
}

@SubscribeEvent
public static void renderWorld(RenderWorldLastEvent event) {
instance.renderParticles(Minecraft.getMinecraft().player, event.getPartialTicks());
INSTANCE.renderParticles(Minecraft.getMinecraft().player, event.getPartialTicks());
}

@SubscribeEvent
public static void debugOverlay(RenderGameOverlayEvent.Text event) {
if (event.getLeft().size() >= 5 && instance != null) {
if (event.getLeft().size() >= 5) {
String particleTxt = event.getLeft().get(4);
particleTxt += "." + TextFormatting.GOLD + " BC-P: " + instance.getStatistics();
particleTxt += "." + TextFormatting.GOLD + " BC-P: " + INSTANCE.getStatistics();
event.getLeft().set(4, particleTxt);
}
}
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 @@ -37,6 +37,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 @@ -202,5 +203,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
Loading