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

Change the implementation of transformers #13

Merged
merged 5 commits into from
Jul 6, 2021
Merged
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 @@ -12,6 +12,7 @@
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.MetaTileEntityHolder;
import gregtech.api.metatileentity.TieredMetaTileEntity;
import gregtech.api.render.SimpleOverlayRenderer;
import gregtech.api.render.Textures;
import gregtech.api.util.PipelineUtil;
import gregtech.common.tools.DamageValues;
Expand All @@ -27,6 +28,7 @@
import net.minecraft.world.World;

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

public class MetaTileEntityTransformer extends TieredMetaTileEntity {
Expand Down Expand Up @@ -96,25 +98,28 @@ protected void reinitializeEnergyContainer() {
if (isTransformUp) {
//storage = 1 amp high; input = tier / 4; amperage = 4; output = tier; amperage = 1
this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L, tierVoltage / 4, 4, tierVoltage, 1);
} else {
((EnergyContainerHandler) this.energyContainer).setSideInputCondition(s -> s != getFrontFacing());
((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s == getFrontFacing());
} else{
//storage = 1 amp high; input = tier; amperage = 1; output = tier / 4; amperage = 4
this.energyContainer = new EnergyContainerHandler(this, tierVoltage * 8L, tierVoltage, 1, tierVoltage / 4, 4);
((EnergyContainerHandler) this.energyContainer).setSideInputCondition(s -> s == getFrontFacing());
((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s != getFrontFacing());
}
((EnergyContainerHandler) this.energyContainer).setSideInputCondition(s -> s == getFrontFacing());
((EnergyContainerHandler) this.energyContainer).setSideOutputCondition(s -> s == getFrontFacing().getOpposite());
}

@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);
if (isTransformUp) {
Textures.ENERGY_OUT_MULTI.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN.renderSided(getFrontFacing().getOpposite(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
} else {
Textures.ENERGY_IN_MULTI.renderSided(getFrontFacing(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_OUT.renderSided(getFrontFacing().getOpposite(), renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));

SimpleOverlayRenderer frontFacetexture = isTransformUp ? Textures.ENERGY_OUT_MULTI : Textures.ENERGY_IN_MULTI;
SimpleOverlayRenderer OtherFacetexture = isTransformUp ? Textures.ENERGY_IN_MULTI : Textures.ENERGY_OUT_MULTI;
frontFacetexture.renderSided(frontFacing,renderState,translation,PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Arrays.stream(EnumFacing.values()).filter(f -> f != frontFacing)
.forEach((f -> OtherFacetexture.renderSided(f,renderState,translation,PipelineUtil.color(pipeline, GTValues.VC[getTier() -1]))));

}
}


@Override
public boolean isValidFrontFacing(EnumFacing facing) {
Expand Down