mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-21 20:52:22 +00:00
Split "api" into one api module for every module
This commit is contained in:
1 parent
8600dc9e66
commit
ef90f2228b
87 files changed
+44
-18
No files matched your search
@@ -0,0 +1,79 @@
|
||||
package binnie.extratrees.api.carpentry;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IPattern;
|
||||
|
||||
public class Layout implements ILayout {
|
||||
IPattern pattern;
|
||||
boolean inverted;
|
||||
|
||||
private Layout(final IPattern pattern, final boolean inverted) {
|
||||
this.pattern = pattern;
|
||||
this.inverted = inverted;
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern, final boolean inverted) {
|
||||
return new Layout(pattern, inverted);
|
||||
}
|
||||
|
||||
public static ILayout get(final IPattern pattern) {
|
||||
return new Layout(pattern, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPattern getPattern() {
|
||||
return this.pattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInverted() {
|
||||
return this.inverted;
|
||||
}
|
||||
|
||||
ILayout newLayout(final ILayout newLayout) {
|
||||
return new Layout(newLayout.getPattern(), this.inverted ^ newLayout.isInverted());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateRight() {
|
||||
return this.rotateLeft().rotateLeft().rotateLeft();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout rotateLeft() {
|
||||
return this.newLayout(this.pattern.getRotation());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipHorizontal() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout flipVertical() {
|
||||
return this.newLayout(this.pattern.getHorizontalFlip().rotateLeft().rotateLeft());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getPrimarySprite(IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getSecondarySprite(system) : this.pattern.getPrimarySprite(system);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public TextureAtlasSprite getSecondarySprite(IDesignSystem system) {
|
||||
return this.inverted ? this.pattern.getPrimarySprite(system) : this.pattern.getSecondarySprite(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ILayout invert() {
|
||||
return new Layout(this.pattern, !this.inverted);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user