Skip to content

Commit

Permalink
done (hopefully)
Browse files Browse the repository at this point in the history
  • Loading branch information
MCTian-mi committed Dec 4, 2024
1 parent 9660ea6 commit 546672d
Show file tree
Hide file tree
Showing 33 changed files with 127 additions and 49 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,24 @@
import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.pipeline.ColourMultiplier;
import codechicken.lib.render.pipeline.IVertexOperation;
import codechicken.lib.vec.Cuboid6;
import codechicken.lib.vec.Matrix4;
import gregtech.api.GTValues;
import gregtech.api.capability.GregtechCapabilities;
import gregtech.api.capability.IEnergyContainer;
import gregtech.api.gui.ModularUI;
import gregtech.api.metatileentity.IDataInfoProvider;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.MetaTileEntityHolder;
import gregtech.api.util.GTUtility;
import gregtech.client.renderer.texture.Textures;
import gregtech.client.renderer.texture.cube.SimpleSidedCubeRenderer;
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.fluids.FluidStack;
Expand All @@ -36,18 +35,19 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;


public abstract class MetaTileEntityDelegator extends MetaTileEntity implements IDelegator, IDataInfoProvider {
public abstract class MetaTileEntityDelegator extends MetaTileEntity implements IDelegator {

protected final Predicate<Capability<?>> capFilter;
protected final int baseColor;

public MetaTileEntityDelegator(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter) {
public MetaTileEntityDelegator(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter, int baseColor) {
super(metaTileEntityId);
this.capFilter = capFilter;
this.baseColor = baseColor;
}

@Override
Expand Down Expand Up @@ -75,30 +75,31 @@ protected <T> T getDelegatedCapability(Capability<T> capability, EnumFacing side
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
IVertexOperation[] colouredPipeline = ArrayUtils.add(pipeline,
new ColourMultiplier(GTUtility.convertRGBtoOpaqueRGBA_CL(this.getPaintingColorForRendering())));
getBaseRenderer().render(renderState, translation, colouredPipeline);
for (EnumFacing facing : EnumFacing.values()) {
Textures.renderFace(renderState, translation, colouredPipeline, facing, Cuboid6.full, this.getBaseTexture(), BlockRenderLayer.CUTOUT_MIPPED);
}
}

@SideOnly(Side.CLIENT)
protected SimpleSidedCubeRenderer getBaseRenderer() {
return Textures.VOLTAGE_CASINGS[GTValues.LV];
protected TextureAtlasSprite getBaseTexture() {
return Textures.PIPE_SIDE;
}

@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, @NotNull List<String> tooltip, boolean advanced) {
super.addInformation(stack, world, tooltip, advanced);
// TODO
tooltip.add(I18n.format("gregtech.machine.delegator.tooltip.non_recursion"));
}

@SideOnly(Side.CLIENT)
public Pair<TextureAtlasSprite, Integer> getParticleTexture() {
return Pair.of(getBaseRenderer().getParticleSprite(), getPaintingColorForRendering());
return Pair.of(getBaseTexture(), getPaintingColorForRendering());
}

@Override
@NotNull
public List<ITextComponent> getDataInfo() {
return new ArrayList<>(); // TODO
public int getDefaultPaintingColor() {
return this.baseColor;
}

@Override
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/supersymmetry/client/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
import supersymmetry.Supersymmetry;
import supersymmetry.api.integration.theoneprobe.TheOneProbeCompatibility;
import supersymmetry.api.recipes.catalysts.CatalystGroup;
import supersymmetry.api.recipes.catalysts.CatalystInfo;
import supersymmetry.common.CommonProxy;
Expand Down Expand Up @@ -46,7 +45,6 @@ public void load() {
super.load();
SuSyMetaBlocks.registerColors();
SuSyFluidTooltipLoader.registerTooltips();
TheOneProbeCompatibility.registerCompatibility();
}

@SubscribeEvent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ public static void init() {
ELECTROLYTIC_CELL = registerMetaTileEntity(14634, new MetaTileEntityElectrolyticCell(susyId("electrolytic_cell")));
GRAVITY_SEPARATOR = registerMetaTileEntity(15052, new MetaTileEntityGravitySeparator(susyId("gravity_separator")));

INV_BRIDGE = registerMetaTileEntity(14733, new MetaTileEntityBridge(susyId("bridge.inv"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, SusyTextures.INV_BRIDGE));
TANK_BRIDGE = registerMetaTileEntity(14734, new MetaTileEntityBridge(susyId("bridge.tank"), cap -> cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.TANK_BRIDGE));
INV_TANK_BRIDGE = registerMetaTileEntity(14735, new MetaTileEntityBridge(susyId("bridge.inv_tank"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.INV_TANK_BRIDGE));
UNIVERSAL_BRIDGE = registerMetaTileEntity(14736, new MetaTileEntityBridge(susyId("bridge.universal"), cap -> true, SusyTextures.UNIVERSAL_BRIDGE));

INV_EXTENDER = registerMetaTileEntity(14737, new MetaTileEntityExtender(susyId("extender.inv"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, SusyTextures.INV_EXTENDER));
TANK_EXTENDER = registerMetaTileEntity(14738, new MetaTileEntityExtender(susyId("extender.tank"), cap -> cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.TANK_EXTENDER));
INV_TANK_EXTENDER = registerMetaTileEntity(14739, new MetaTileEntityExtender(susyId("extender.inv_tank"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.INV_TANK_EXTENDER));
UNIVERSAL_EXTENDER = registerMetaTileEntity(14740, new MetaTileEntityExtender(susyId("extender.universal"), cap -> true, SusyTextures.UNIVERSAL_EXTENDER));
INV_BRIDGE = registerMetaTileEntity(14733, new MetaTileEntityBridge(susyId("bridge.inv"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, SusyTextures.INV_BRIDGE, Materials.Steel));
TANK_BRIDGE = registerMetaTileEntity(14734, new MetaTileEntityBridge(susyId("bridge.tank"), cap -> cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.TANK_BRIDGE, Materials.Steel));
INV_TANK_BRIDGE = registerMetaTileEntity(14735, new MetaTileEntityBridge(susyId("bridge.inv_tank"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.INV_TANK_BRIDGE, Materials.Steel));
UNIVERSAL_BRIDGE = registerMetaTileEntity(14736, new MetaTileEntityBridge(susyId("bridge.universal"), cap -> true, SusyTextures.UNIVERSAL_BRIDGE, Materials.StainlessSteel));

INV_EXTENDER = registerMetaTileEntity(14737, new MetaTileEntityExtender(susyId("extender.inv"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, SusyTextures.INV_EXTENDER, Materials.Steel));
TANK_EXTENDER = registerMetaTileEntity(14738, new MetaTileEntityExtender(susyId("extender.tank"), cap -> cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.TANK_EXTENDER, Materials.Steel));
INV_TANK_EXTENDER = registerMetaTileEntity(14739, new MetaTileEntityExtender(susyId("extender.inv_tank"), cap -> cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY || cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, SusyTextures.INV_TANK_EXTENDER, Materials.Steel));
UNIVERSAL_EXTENDER = registerMetaTileEntity(14740, new MetaTileEntityExtender(susyId("extender.universal"), cap -> true, SusyTextures.UNIVERSAL_EXTENDER, Materials.StainlessSteel));

PRIMITIVE_SMELTER = registerMetaTileEntity(14800, new MetaTileEntityPrimitiveSmelter(susyId("primitive_smelter")));
PRIMITIVE_ITEM_IMPORT = registerMetaTileEntity(14801, new MetaTileEntityPrimitiveItemBus(susyId("primitive_item_import"), false));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import codechicken.lib.vec.Matrix4;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.unification.material.Material;
import gregtech.client.renderer.ICubeRenderer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.ResourceLocation;
Expand All @@ -18,14 +19,18 @@ public class MetaTileEntityBridge extends MetaTileEntityDelegator {

protected final ICubeRenderer renderer;

public MetaTileEntityBridge(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter, ICubeRenderer renderer) {
super(metaTileEntityId, capFilter);
public MetaTileEntityBridge(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter, ICubeRenderer renderer, Material baseMaterial) {
this(metaTileEntityId, capFilter, renderer, baseMaterial.getMaterialRGB());
}

public MetaTileEntityBridge(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter, ICubeRenderer renderer, int baseColor) {
super(metaTileEntityId, capFilter, baseColor);
this.renderer = renderer;
}

@Override
public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) {
return new MetaTileEntityBridge(metaTileEntityId, capFilter, renderer);
return new MetaTileEntityBridge(metaTileEntityId, capFilter, renderer, baseColor);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import codechicken.lib.vec.Matrix4;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.unification.material.Material;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
Expand All @@ -31,14 +32,18 @@ public class MetaTileEntityExtender extends MetaTileEntityDelegator {
protected final ExtenderRender renderer;
protected EnumFacing inputFacing;

public MetaTileEntityExtender(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter, ExtenderRender renderer) {
super(metaTileEntityId, capFilter);
public MetaTileEntityExtender(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter, ExtenderRender renderer, Material baseMaterial) {
this(metaTileEntityId, capFilter, renderer, baseMaterial.getMaterialRGB());
}

public MetaTileEntityExtender(ResourceLocation metaTileEntityId, Predicate<Capability<?>> capFilter, ExtenderRender renderer, int baseColor) {
super(metaTileEntityId, capFilter, baseColor);
this.renderer = renderer;
}

@Override
public MetaTileEntity createMetaTileEntity(IGregTechTileEntity iGregTechTileEntity) {
return new MetaTileEntityExtender(metaTileEntityId, capFilter, renderer);
return new MetaTileEntityExtender(metaTileEntityId, capFilter, renderer, baseColor);
}

@Override
Expand Down Expand Up @@ -103,7 +108,7 @@ public void receiveCustomData(int dataId, @NotNull PacketBuffer buf) {

@Override
public boolean isValidFrontFacing(EnumFacing facing) {
return super.isValidFrontFacing(facing) && facing != inputFacing;
return facing != getFrontFacing() && facing != inputFacing;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.*;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.TextFormatting;
Expand All @@ -47,11 +50,11 @@
import org.jetbrains.annotations.NotNull;
import supersymmetry.api.SusyLog;
import supersymmetry.api.capability.impl.EvapRecipeLogic;
import supersymmetry.api.integration.EvaporationPoolInfoProvider;
import supersymmetry.api.recipes.SuSyRecipeMaps;
import supersymmetry.api.recipes.properties.EvaporationEnergyProperty;
import supersymmetry.common.blocks.BlockEvaporationBed;
import supersymmetry.common.blocks.SuSyBlocks;
import supersymmetry.integration.theoneprobe.provider.EvaporationPoolInfoProvider;

import javax.annotation.Nonnull;
import java.util.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package supersymmetry.integration.theoneprobe;

import gregtech.api.modules.GregTechModule;
import gregtech.api.util.Mods;
import gregtech.integration.IntegrationSubmodule;
import mcjty.theoneprobe.TheOneProbe;
import mcjty.theoneprobe.api.ITheOneProbe;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import supersymmetry.Supersymmetry;
import supersymmetry.integration.theoneprobe.provider.DelegatorInfoProvider;
import supersymmetry.integration.theoneprobe.provider.EvaporationPoolInfoProvider;
import supersymmetry.modules.SuSyModules;

@GregTechModule(
moduleID = SuSyModules.MODULE_TOP,
containerID = Supersymmetry.MODID,
modDependencies = Mods.Names.THE_ONE_PROBE,
name = "SuSy TheOneProbe Integration",
description = "SuSy TheOneProbe Integration Module")
public class TheOneProbeModule extends IntegrationSubmodule {

@Override
public void init(FMLInitializationEvent event) {
getLogger().info("TheOneProbe found. Enabling SuSy top integration...");
ITheOneProbe oneProbe = TheOneProbe.theOneProbeImp;
oneProbe.registerProvider(new EvaporationPoolInfoProvider());
oneProbe.registerProvider(new DelegatorInfoProvider());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package supersymmetry.integration.theoneprobe.provider;

import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import mcjty.theoneprobe.api.IProbeHitData;
import mcjty.theoneprobe.api.IProbeInfo;
import mcjty.theoneprobe.api.IProbeInfoProvider;
import mcjty.theoneprobe.api.ProbeMode;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import supersymmetry.Supersymmetry;
import supersymmetry.api.metatileentity.logistics.IDelegator;

public class DelegatorInfoProvider implements IProbeInfoProvider {

@Override
public String getID() {
return Supersymmetry.MODID + ":delegator_info_provider";
}

@Override
public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState state,
IProbeHitData data) {
if (state.getBlock().hasTileEntity(state)) {
TileEntity te = world.getTileEntity(data.getPos());
if (te instanceof IGregTechTileEntity igtte) {
MetaTileEntity mte = igtte.getMetaTileEntity();
if (mte instanceof IDelegator delegator) {
probeInfo.text(I18n.format("gregtech.top.delegator.delegating_face",
delegator.getDelegatingFacing(data.getSideHit())));
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package supersymmetry.api.integration;
package supersymmetry.integration.theoneprobe.provider;

import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
Expand Down
1 change: 1 addition & 0 deletions src/main/java/supersymmetry/modules/SuSyModules.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ public class SuSyModules implements IModuleContainer {
public static final String MODULE_CORE = "susy_core";
public static final String MODULE_BDSAndM = "bdsandm_integration";
public static final String MODULE_BAUBLES = "baubles_integration";
public static final String MODULE_TOP = "susy_top_integration";

@Override
public String getID() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions src/main/resources/assets/susy/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -757,15 +757,26 @@ gregtech.machine.dumping_hatch=Dumping Hatch
gregtech.machine.dumping_hatch.lv.name=Dumping Hatch

# Logistics
gregtech.machine.delegator.tooltip.non_recursion=§6Cannot be attached to other Delegators!
gregtech.top.delegator.delegating_face=Delegating: %s

gregtech.machine.bridge.inv.name=Inventory Bridge
gregtech.machine.bridge.inv.tooltip=§bRelays Inventories
gregtech.machine.bridge.tank.name=Tank Bridge
gregtech.machine.bridge.tank.tooltip=§bRelays Tanks
gregtech.machine.bridge.inv_tank.name=Inventory and Tank Bridge
gregtech.machine.bridge.inv_tank.tooltip=§bRelays Inventories and Tanks
gregtech.machine.bridge.universal.name=Universal Bridge
gregtech.machine.bridge.universal.tooltip=§bRelays Everything

gregtech.machine.extender.inv.name=Inventory Extender
gregtech.machine.extender.inv.tooltip=§bRelays Inventories
gregtech.machine.extender.tank.name=Tank Extender
gregtech.machine.extender.tank.tooltip=§bRelays Tanks
gregtech.machine.extender.inv_tank.name=Inventory and Tank Extender
gregtech.machine.extender.inv_tank.tooltip=§bRelays Inventories and Tanks
gregtech.machine.extender.universal.name=Universal Extender
gregtech.machine.extender.universal.tooltip=§bRelays Everything

# Metaitems
metaitem.catalyst_bed_support_grid.name=Catalyst Bed Support Grid
Expand Down

0 comments on commit 546672d

Please sign in to comment.