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 3 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 @@ -96,25 +96,126 @@ 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]));
if (frontFacing == EnumFacing.NORTH) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is too messy, we need to cut it down by a lot

Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}
if (frontFacing == EnumFacing.SOUTH) {
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline,GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));

}
if(frontFacing ==EnumFacing.EAST){
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}
if(frontFacing ==EnumFacing.WEST){
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}
if(frontFacing ==EnumFacing.DOWN){
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}

if(frontFacing ==EnumFacing.UP){
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}
}
}
else{
if (frontFacing == EnumFacing.NORTH) {
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}
if (frontFacing == EnumFacing.SOUTH) {
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));

}
if(frontFacing ==EnumFacing.EAST){
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}
if(frontFacing ==EnumFacing.WEST){
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}
if(frontFacing ==EnumFacing.DOWN){
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}

if(frontFacing ==EnumFacing.UP){
Textures.ENERGY_IN_MULTI.renderSided(EnumFacing.UP, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier()]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.SOUTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.EAST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.WEST, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.NORTH, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
Textures.ENERGY_OUT_MULTI.renderSided(EnumFacing.DOWN, renderState, translation, PipelineUtil.color(pipeline, GTValues.VC[getTier() - 1]));
}

}
}


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