mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-25 14:34:33 +00:00
Merge branch 'master-MC1.12' of https://github.com/ForestryMC/Binnie into master-MC1.12
This commit is contained in:
commit
fdb9a14962
167 files changed
+809
-513
No files matched your search
+5
-6
@@ -1,10 +1,9 @@
|
||||
archivesBaseName = 'all-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":botany")
|
||||
compile project(":core")
|
||||
compile project(":extrabees")
|
||||
compile project(":extratrees")
|
||||
compile project(":genetics")
|
||||
runtimeOnly project(":botany")
|
||||
runtimeOnly project(":core")
|
||||
runtimeOnly project(":extrabees")
|
||||
runtimeOnly project(":extratrees")
|
||||
runtimeOnly project(":genetics")
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
archivesBaseName = 'api-' + mcversion
|
||||
@@ -0,0 +1,5 @@
|
||||
archivesBaseName = 'botany-api-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":core-api")
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
-1
@@ -1,8 +1,9 @@
|
||||
archivesBaseName = 'botany-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":core")
|
||||
compile project(":botany-api")
|
||||
compile project(":extratrees-api")
|
||||
|
||||
// TODO: remove
|
||||
compile project(":extratrees")
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
package binnie.botany.genetics;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.api.genetics.IFieldKitPlugin;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.texture.BinnieCoreTexture;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
@@ -136,4 +144,32 @@ public class FlowerBreedingSystem extends BreedingSystem {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFieldKitPlugin getFieldKitPlugin() {
|
||||
return new IFieldKitPlugin() {
|
||||
@Override
|
||||
public Map<IChromosomeType, IPoint> getChromosomePickerPositions() {
|
||||
Map<IChromosomeType, IPoint> positions = new HashMap<>();
|
||||
positions.put(EnumFlowerChromosome.SPECIES, new Point(35, 81));
|
||||
positions.put(EnumFlowerChromosome.PRIMARY, new Point(36, 28));
|
||||
positions.put(EnumFlowerChromosome.SECONDARY, new Point(27, 13));
|
||||
positions.put(EnumFlowerChromosome.FERTILITY, new Point(47, 15));
|
||||
positions.put(EnumFlowerChromosome.TERRITORY, new Point(54, 31));
|
||||
positions.put(EnumFlowerChromosome.EFFECT, new Point(15, 55));
|
||||
positions.put(EnumFlowerChromosome.LIFESPAN, new Point(23, 38));
|
||||
positions.put(EnumFlowerChromosome.TEMPERATURE_TOLERANCE, new Point(17, 77));
|
||||
positions.put(EnumFlowerChromosome.HUMIDITY_TOLERANCE, new Point(52, 51));
|
||||
positions.put(EnumFlowerChromosome.PH_TOLERANCE, new Point(54, 80));
|
||||
positions.put(EnumFlowerChromosome.SAPPINESS, new Point(41, 42));
|
||||
positions.put(EnumFlowerChromosome.STEM, new Point(37, 63));
|
||||
return positions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITexture getTypeTexture() {
|
||||
return new StandardTexture(0, 96, 96, 96, BinnieCoreTexture.GUI_BREEDING);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -27,7 +28,6 @@ import binnie.core.gui.database.PageSpeciesMutations;
|
||||
import binnie.core.gui.database.PageSpeciesOverview;
|
||||
import binnie.core.gui.database.PageSpeciesResultant;
|
||||
import binnie.core.gui.database.WindowAbstractDatabase;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
@@ -82,7 +82,7 @@ public class WindowBotanistDatabase extends WindowAbstractDatabase {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createListBox(Area area) {
|
||||
public void createListBox(IArea area) {
|
||||
listBox = new ControlListBox<IFlowerColor>(modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12) {
|
||||
@Override
|
||||
public IWidget createOption(IFlowerColor value, int y) {
|
||||
|
||||
+5
-1
@@ -98,13 +98,16 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
def mainProjects = [':api', ':botany', ':core', ':extrabees', ':extratrees', ':genetics'].collect{ subproject -> project(subproject) }
|
||||
def mainProjects = [':core', ':core-api', ':botany', ':botany-api', ':extrabees', 'extrabees-api', ':extratrees', 'extratrees-api', ':genetics', 'genetics-api']
|
||||
.collect{ subproject -> project(subproject) }
|
||||
mainProjects.each { subproject -> evaluationDependsOn( subproject.path ) }
|
||||
jar.dependsOn mainProjects.tasks['classes']
|
||||
jar {
|
||||
mainProjects.each { subproject ->
|
||||
from subproject.sourceSets.main.output.classesDirs
|
||||
from subproject.sourceSets.api.output.classesDirs
|
||||
from subproject.sourceSets.main.output.resourcesDir
|
||||
from subproject.sourceSets.api.output.resourcesDir
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +118,7 @@ task sourcesJar(type: Jar, dependsOn: mainProjects.tasks['classes']) {
|
||||
exclude 'assets'
|
||||
exclude 'mcmod.info'
|
||||
}
|
||||
from(subproject.sourceSets.api.allSource)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
archivesBaseName = 'core-api-' + mcversion
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+2
@@ -145,4 +145,6 @@ public interface IBreedingSystem {
|
||||
Collection<IChromosomeType> getActiveKaryotype();
|
||||
|
||||
ItemStack getDefaultMember(String uid);
|
||||
|
||||
IFieldKitPlugin getFieldKitPlugin();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package binnie.core.api.genetics;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
public interface IFieldKitPlugin {
|
||||
Map<IChromosomeType, IPoint> getChromosomePickerPositions();
|
||||
|
||||
ITexture getTypeTexture();
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.genetics.api;
|
||||
package binnie.core.api.genetics;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package binnie.genetics.api;
|
||||
package binnie.core.api.genetics;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
+10
-10
@@ -1,7 +1,7 @@
|
||||
package binnie.core.gui.geometry;
|
||||
package binnie.core.api.gui;
|
||||
|
||||
public enum Position {
|
||||
Top(0, -1),
|
||||
public enum Alignment {
|
||||
TOP(0, -1),
|
||||
BOTTOM(0, 1),
|
||||
LEFT(-1, 0),
|
||||
RIGHT(1, 0);
|
||||
@@ -9,7 +9,7 @@ public enum Position {
|
||||
int x;
|
||||
int y;
|
||||
|
||||
Position(int x, final int y) {
|
||||
Alignment(int x, final int y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
@@ -22,19 +22,19 @@ public enum Position {
|
||||
return this.y;
|
||||
}
|
||||
|
||||
public Position opposite() {
|
||||
public Alignment opposite() {
|
||||
switch (this) {
|
||||
case BOTTOM: {
|
||||
return Position.Top;
|
||||
return Alignment.TOP;
|
||||
}
|
||||
case LEFT: {
|
||||
return Position.RIGHT;
|
||||
return Alignment.RIGHT;
|
||||
}
|
||||
case RIGHT: {
|
||||
return Position.LEFT;
|
||||
return Alignment.LEFT;
|
||||
}
|
||||
case Top: {
|
||||
return Position.BOTTOM;
|
||||
case TOP: {
|
||||
return Alignment.BOTTOM;
|
||||
}
|
||||
default: {
|
||||
throw new IllegalStateException();
|
||||
@@ -0,0 +1,43 @@
|
||||
package binnie.core.api.gui;
|
||||
|
||||
public interface IArea {
|
||||
IPoint pos();
|
||||
|
||||
IPoint getPosition();
|
||||
|
||||
void setPosition(IPoint position);
|
||||
|
||||
IPoint size();
|
||||
|
||||
IPoint getSize();
|
||||
|
||||
void setSize(IPoint size);
|
||||
|
||||
boolean contains(IPoint position);
|
||||
|
||||
int xPos();
|
||||
|
||||
int yPos();
|
||||
|
||||
int width();
|
||||
|
||||
int height();
|
||||
|
||||
void setXPos(int xPos);
|
||||
|
||||
void setYPos(int yPos);
|
||||
|
||||
void setWidth(int width);
|
||||
|
||||
void setHeight(int height);
|
||||
|
||||
IArea inset(IBorder border);
|
||||
|
||||
IArea outset(int outset);
|
||||
|
||||
IArea outset(IBorder border);
|
||||
|
||||
IArea inset(int inset);
|
||||
|
||||
IArea shift(int dx, int f);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package binnie.core.api.gui;
|
||||
|
||||
public interface IBorder {
|
||||
int getTop();
|
||||
|
||||
int getBottom();
|
||||
|
||||
int getLeft();
|
||||
|
||||
int getRight();
|
||||
|
||||
void setTop(int amount);
|
||||
|
||||
void setBottom(int amount);
|
||||
|
||||
void setLeft(int amount);
|
||||
|
||||
void setRight(int amount);
|
||||
|
||||
boolean isNonZero();
|
||||
|
||||
IBorder add(IBorder o);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package binnie.core.api.gui;
|
||||
|
||||
public interface IPoint {
|
||||
|
||||
IPoint sub(IPoint point);
|
||||
|
||||
IPoint sub(int xPos, int yPos);
|
||||
|
||||
IPoint add(IPoint other);
|
||||
|
||||
IPoint add(int xPos, int yPos);
|
||||
|
||||
IPoint copy();
|
||||
|
||||
int xPos();
|
||||
|
||||
int yPos();
|
||||
|
||||
boolean equals(IPoint other);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package binnie.core.api.gui;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface ITexture {
|
||||
IArea getArea();
|
||||
|
||||
IBorder getBorder();
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ResourceLocation getResourceLocation();
|
||||
|
||||
IBorder getTotalPadding();
|
||||
|
||||
int width();
|
||||
|
||||
int height();
|
||||
|
||||
ITexture crop(Alignment anchor, int dist);
|
||||
|
||||
ITexture crop(IBorder crop);
|
||||
}
|
||||
File renamed without changes.
+1
-1
@@ -1,5 +1,5 @@
|
||||
archivesBaseName = 'core-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":core-api")
|
||||
}
|
||||
@@ -11,10 +11,6 @@ import forestry.api.genetics.EnumTolerance;
|
||||
import forestry.api.genetics.IAllele;
|
||||
import forestry.core.genetics.alleles.EnumAllele;
|
||||
|
||||
import binnie.botany.api.gardening.EnumAcidity;
|
||||
import binnie.botany.api.gardening.EnumMoisture;
|
||||
import binnie.botany.api.gardening.EnumSoilType;
|
||||
import binnie.botany.api.genetics.EnumFlowerColor;
|
||||
import binnie.core.util.I18N;
|
||||
|
||||
public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper {
|
||||
@@ -70,10 +66,6 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper {
|
||||
return getAllele(getUid(saplings));
|
||||
}
|
||||
|
||||
public static IAllele getAllele(EnumFlowerColor color) {
|
||||
return color.getFlowerColorAllele();
|
||||
}
|
||||
|
||||
public static IAllele getAllele(int number) {
|
||||
return getAllele("forestry.i" + number + "d");
|
||||
}
|
||||
@@ -97,17 +89,17 @@ public class AlleleHelper extends forestry.core.genetics.alleles.AlleleHelper {
|
||||
return AlleleManager.climateHelper.toDisplay(humidity);
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumMoisture moisture) {
|
||||
return I18N.localise("botany.moisture." + moisture.getName());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumAcidity acidity) {
|
||||
return I18N.localise("botany.ph." + acidity.getName());
|
||||
}
|
||||
|
||||
public static String toDisplay(EnumSoilType soilType) {
|
||||
return I18N.localise("botany.soil." + soilType.getName());
|
||||
}
|
||||
// public static String toDisplay(EnumMoisture moisture) {
|
||||
// return I18N.localise("botany.moisture." + moisture.getName());
|
||||
// }
|
||||
//
|
||||
// public static String toDisplay(EnumAcidity acidity) {
|
||||
// return I18N.localise("botany.ph." + acidity.getName());
|
||||
// }
|
||||
//
|
||||
// public static String toDisplay(EnumSoilType soilType) {
|
||||
// return I18N.localise("botany.soil." + soilType.getName());
|
||||
// }
|
||||
|
||||
public static String toDisplay(EnumTolerance tolerance) {
|
||||
return toAlleleDisplay("tolerance", tolerance.name());
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import binnie.genetics.api.IGene;
|
||||
import binnie.core.api.genetics.IGene;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package binnie.core.genetics;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import binnie.genetics.api.IItemAnalysable;
|
||||
import binnie.core.api.genetics.IItemAnalysable;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@@ -2,10 +2,10 @@ package binnie.core.gui;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
|
||||
public interface ITopLevelWidget extends IWidget {
|
||||
Point getAbsoluteMousePosition();
|
||||
IPoint getAbsoluteMousePosition();
|
||||
|
||||
@Nullable
|
||||
IWidget getMousedOverWidget();
|
||||
|
||||
@@ -3,13 +3,13 @@ package binnie.core.gui;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.events.Event;
|
||||
import binnie.core.gui.events.EventHandler;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
|
||||
public interface IWidget {
|
||||
/**
|
||||
@@ -24,25 +24,25 @@ public interface IWidget {
|
||||
/**
|
||||
* @return the position of this widget
|
||||
*/
|
||||
Point getPosition();
|
||||
IPoint getPosition();
|
||||
|
||||
Point getAbsolutePosition();
|
||||
IPoint getAbsolutePosition();
|
||||
|
||||
void setPosition(Point position);
|
||||
void setPosition(IPoint position);
|
||||
|
||||
/**
|
||||
* @return the size of this widget
|
||||
*/
|
||||
Point getSize();
|
||||
IPoint getSize();
|
||||
|
||||
void setOffset(final Point p0);
|
||||
void setOffset(final IPoint p0);
|
||||
|
||||
/**
|
||||
* @return the area of this widget
|
||||
*/
|
||||
Area getArea();
|
||||
IArea getArea();
|
||||
|
||||
Point getRelativeMousePosition();
|
||||
IPoint getRelativeMousePosition();
|
||||
|
||||
int getYPos();
|
||||
|
||||
@@ -105,9 +105,9 @@ public interface IWidget {
|
||||
void delete();
|
||||
|
||||
@Nullable
|
||||
Area getCroppedZone();
|
||||
IArea getCroppedZone();
|
||||
|
||||
void setCroppedZone(IWidget widget, Area area);
|
||||
void setCroppedZone(IWidget widget, IArea area);
|
||||
|
||||
boolean isCroppedWidet();
|
||||
|
||||
|
||||
@@ -8,22 +8,23 @@ import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import org.lwjgl.input.Mouse;
|
||||
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.events.EventWidget;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
|
||||
public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
protected Point mousePosition;
|
||||
protected IPoint mousePosition;
|
||||
@Nullable
|
||||
IWidget mousedOverWidget;
|
||||
@Nullable
|
||||
IWidget draggedWidget;
|
||||
@Nullable
|
||||
IWidget focusedWidget;
|
||||
Point dragStart;
|
||||
IPoint dragStart;
|
||||
|
||||
public TopLevelWidget() {
|
||||
super(null);
|
||||
@@ -156,7 +157,7 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
private Collection<IWidget> getQueuedWidgets(final IWidget widget) {
|
||||
List<IWidget> widgets = new ArrayList<>();
|
||||
boolean addChildren = true;
|
||||
Area croppedZone = widget.getCroppedZone();
|
||||
IArea croppedZone = widget.getCroppedZone();
|
||||
if (croppedZone != null) {
|
||||
addChildren = croppedZone.contains(widget.getCropWidget().getRelativeMousePosition());
|
||||
}
|
||||
@@ -188,7 +189,7 @@ public abstract class TopLevelWidget extends Widget implements ITopLevelWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getAbsoluteMousePosition() {
|
||||
public IPoint getAbsoluteMousePosition() {
|
||||
return this.mousePosition;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,9 @@ import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -13,22 +16,21 @@ import binnie.core.gui.events.Event;
|
||||
import binnie.core.gui.events.EventHandler;
|
||||
import binnie.core.gui.events.EventWidget;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
|
||||
public class Widget implements IWidget {
|
||||
@Nullable
|
||||
private final IWidget parent;
|
||||
@Nullable
|
||||
private Area cropArea;
|
||||
private IArea cropArea;
|
||||
@Nullable
|
||||
private IWidget cropWidget;
|
||||
private boolean cropped;
|
||||
private int color;
|
||||
private List<IWidget> children;
|
||||
private List<IWidgetAttribute> attributes;
|
||||
private Point position;
|
||||
private Point size;
|
||||
private Point offset;
|
||||
private IPoint position;
|
||||
private IPoint size;
|
||||
private IPoint offset;
|
||||
private Collection<EventHandler<? extends Event>> eventHandlers;
|
||||
private boolean visible;
|
||||
|
||||
@@ -142,7 +144,7 @@ public class Widget implements IWidget {
|
||||
|
||||
/* GEOMETRY */
|
||||
@Override
|
||||
public final void setPosition(Point position) {
|
||||
public final void setPosition(IPoint position) {
|
||||
if (!position.equals(this.position)) {
|
||||
this.position = new Point(position);
|
||||
this.callEvent(new EventWidget.ChangePosition(this));
|
||||
@@ -150,40 +152,40 @@ public class Widget implements IWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Point getPosition() {
|
||||
public final IPoint getPosition() {
|
||||
return this.position.add(this.offset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Point getSize() {
|
||||
public final IPoint getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Area getArea() {
|
||||
public final IArea getArea() {
|
||||
return new Area(Point.ZERO, this.getSize());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public final Area getCroppedZone() {
|
||||
public final IArea getCroppedZone() {
|
||||
return this.cropArea;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setCroppedZone(final IWidget relative, final Area area) {
|
||||
public final void setCroppedZone(final IWidget relative, final IArea area) {
|
||||
this.cropArea = area;
|
||||
this.cropped = true;
|
||||
this.cropWidget = relative;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Point getAbsolutePosition() {
|
||||
public final IPoint getAbsolutePosition() {
|
||||
IWidget parent = this.getParent();
|
||||
return parent == null ? this.getPosition() : parent.getAbsolutePosition().add(this.getPosition());
|
||||
}
|
||||
|
||||
public final void setSize(final Point vector) {
|
||||
public final void setSize(final IPoint vector) {
|
||||
if (!vector.equals(this.size)) {
|
||||
this.size = new Point(vector);
|
||||
this.callEvent(new EventWidget.ChangeSize(this));
|
||||
@@ -191,7 +193,7 @@ public class Widget implements IWidget {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void setOffset(final Point vector) {
|
||||
public final void setOffset(final IPoint vector) {
|
||||
if (vector != this.offset) {
|
||||
this.offset = new Point(vector);
|
||||
this.callEvent(new EventWidget.ChangeOffset(this));
|
||||
@@ -277,30 +279,30 @@ public class Widget implements IWidget {
|
||||
return this.hasAttribute(Attribute.MOUSE_OVER);
|
||||
}
|
||||
|
||||
public Point getMousePosition() {
|
||||
public IPoint getMousePosition() {
|
||||
return this.getTopParent().getAbsoluteMousePosition();
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Point getRelativeMousePosition() {
|
||||
public final IPoint getRelativeMousePosition() {
|
||||
IWidget parent = this.getParent();
|
||||
return parent == null ? this.getMousePosition() : parent.getRelativeMousePosition().sub(this.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean calculateIsMouseOver() {
|
||||
final Point mouse = this.getRelativeMousePosition();
|
||||
final IPoint mouse = this.getRelativeMousePosition();
|
||||
if (!this.cropped || this.cropArea == null) {
|
||||
return this.isMouseOverWidget(mouse);
|
||||
}
|
||||
final IWidget cropRelative = (this.cropWidget != null) ? this.cropWidget : this;
|
||||
final Point pos = Point.sub(cropRelative.getAbsolutePosition(), this.getAbsolutePosition());
|
||||
final Point size = new Point(this.cropArea.size().xPos(), this.cropArea.size().yPos());
|
||||
final IPoint pos = Point.sub(cropRelative.getAbsolutePosition(), this.getAbsolutePosition());
|
||||
final IPoint size = new Point(this.cropArea.size().xPos(), this.cropArea.size().yPos());
|
||||
final boolean inCrop = mouse.xPos() > pos.xPos() && mouse.yPos() > pos.yPos() && mouse.xPos() < pos.xPos() + size.xPos() && mouse.yPos() < pos.yPos() + size.yPos();
|
||||
return inCrop && this.isMouseOverWidget(mouse);
|
||||
}
|
||||
|
||||
public boolean isMouseOverWidget(final Point relativeMouse) {
|
||||
public boolean isMouseOverWidget(final IPoint relativeMouse) {
|
||||
return this.getArea().contains(relativeMouse);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.core.gui.controls;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -7,7 +10,6 @@ import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.controls.core.IControlValue;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.TextJustification;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
|
||||
@@ -15,11 +17,11 @@ public class ControlText extends Control implements IControlValue<String> {
|
||||
private String text;
|
||||
private TextJustification align;
|
||||
|
||||
public ControlText(final IWidget parent, final Point pos, final String text) {
|
||||
public ControlText(final IWidget parent, final IPoint pos, final String text) {
|
||||
this(parent, new Area(pos, new Point(500, 0)), text, TextJustification.TOP_LEFT);
|
||||
}
|
||||
|
||||
public ControlText(final IWidget parent, final Area area, final String text, final TextJustification align) {
|
||||
public ControlText(final IWidget parent, final IArea area, final String text, final TextJustification align) {
|
||||
super(parent, area.pos().xPos(), area.pos().yPos(), area.size().xPos(), area.size().yPos());
|
||||
this.text = text;
|
||||
this.align = align;
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.core.gui.controls.tab;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
@@ -12,13 +15,10 @@ import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.controls.core.IControlValue;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.events.EventValueChanged;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.minecraft.control.ControlItemDisplay;
|
||||
import binnie.core.gui.minecraft.control.ControlTabIcon;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
public class ControlTab<T> extends Control implements ITooltip, IControlValue<T> {
|
||||
@@ -61,7 +61,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
return this.getValue().equals(this.tabBar.getValue());
|
||||
}
|
||||
|
||||
public Position getTabPosition() {
|
||||
public Alignment getTabPosition() {
|
||||
return this.tabBar.getDirection();
|
||||
}
|
||||
|
||||
@@ -78,16 +78,16 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
} else if (this.isCurrentSelection()) {
|
||||
texture = CraftGUITexture.TAB;
|
||||
}
|
||||
final Texture lTexture = CraftGUI.RENDER.getTexture(texture);
|
||||
final Position position = this.getTabPosition();
|
||||
Texture iTexture = lTexture.crop(position, 8);
|
||||
final Area area = this.getArea();
|
||||
final ITexture lTexture = CraftGUI.RENDER.getTexture(texture);
|
||||
final Alignment alignment = this.getTabPosition();
|
||||
ITexture iTexture = lTexture.crop(alignment, 8);
|
||||
final IArea area = this.getArea();
|
||||
if (texture == CraftGUITexture.TAB_DISABLED) {
|
||||
if (position == Position.Top || position == Position.LEFT) {
|
||||
area.setPosition(area.getPosition().sub(new Point(4 * position.x(), 4 * position.y())));
|
||||
area.setSize(area.getSize().add(new Point(4 * position.x(), 4 * position.y())));
|
||||
if (alignment == Alignment.TOP || alignment == Alignment.LEFT) {
|
||||
area.setPosition(area.getPosition().sub(new Point(4 * alignment.x(), 4 * alignment.y())));
|
||||
area.setSize(area.getSize().add(new Point(4 * alignment.x(), 4 * alignment.y())));
|
||||
} else {
|
||||
area.setSize(area.getSize().sub(new Point(4 * position.x(), 4 * position.y())));
|
||||
area.setSize(area.getSize().sub(new Point(4 * alignment.x(), 4 * alignment.y())));
|
||||
}
|
||||
}
|
||||
CraftGUI.RENDER.texture(iTexture, area);
|
||||
@@ -101,7 +101,7 @@ public class ControlTab<T> extends Control implements ITooltip, IControlValue<T>
|
||||
}
|
||||
if (icon.hasOutline()) {
|
||||
iTexture = CraftGUI.RENDER.getTexture(CraftGUITexture.TAB_OUTLINE);
|
||||
iTexture = iTexture.crop(position, 8);
|
||||
iTexture = iTexture.crop(alignment, 8);
|
||||
RenderUtil.setColour(icon.getOutlineColour());
|
||||
CraftGUI.RENDER.texture(iTexture, area.inset(2));
|
||||
}
|
||||
|
||||
@@ -9,21 +9,21 @@ import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.controls.core.IControlValue;
|
||||
import binnie.core.gui.events.EventHandler;
|
||||
import binnie.core.gui.events.EventValueChanged;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
|
||||
public class ControlTabBar<T> extends Control implements IControlValue<T> {
|
||||
private T value;
|
||||
private Position position;
|
||||
private Alignment alignment;
|
||||
|
||||
public ControlTabBar(final IWidget parent, final int x, final int y, final int width, final int height, final Position position, final Collection<T> values) {
|
||||
this(parent, x, y, width, height, position, Iterables.get(values, 0));
|
||||
public ControlTabBar(final IWidget parent, final int x, final int y, final int width, final int height, final Alignment alignment, final Collection<T> values) {
|
||||
this(parent, x, y, width, height, alignment, Iterables.get(values, 0));
|
||||
setValues(values);
|
||||
}
|
||||
|
||||
public ControlTabBar(final IWidget parent, final int x, final int y, final int width, final int height, final Position position, final T value) {
|
||||
public ControlTabBar(final IWidget parent, final int x, final int y, final int width, final int height, final Alignment alignment, final T value) {
|
||||
super(parent, x, y, width, height);
|
||||
this.value = value;
|
||||
this.position = position;
|
||||
this.alignment = alignment;
|
||||
this.addEventHandler(EventValueChanged.class, EventHandler.Origin.DIRECT_CHILD, this, event -> {
|
||||
ControlTabBar.this.setValue((T) event.getValue());
|
||||
});
|
||||
@@ -33,12 +33,12 @@ public class ControlTabBar<T> extends Control implements IControlValue<T> {
|
||||
deleteAllChildren();
|
||||
final float length = values.size();
|
||||
int tabDimension = (int) (this.getSize().yPos() / length);
|
||||
if (this.position == Position.Top || this.position == Position.BOTTOM) {
|
||||
if (this.alignment == Alignment.TOP || this.alignment == Alignment.BOTTOM) {
|
||||
tabDimension = (int) (this.getSize().xPos() / length);
|
||||
}
|
||||
int j = 0;
|
||||
for (final T value : values) {
|
||||
if (this.position == Position.Top || this.position == Position.BOTTOM) {
|
||||
if (this.alignment == Alignment.TOP || this.alignment == Alignment.BOTTOM) {
|
||||
this.createTab(j * tabDimension, 0, tabDimension, this.getSize().yPos(), value);
|
||||
} else {
|
||||
this.createTab(0, j * tabDimension, this.getSize().xPos(), tabDimension, value);
|
||||
@@ -65,7 +65,7 @@ public class ControlTabBar<T> extends Control implements IControlValue<T> {
|
||||
}
|
||||
}
|
||||
|
||||
public Position getDirection() {
|
||||
return this.position;
|
||||
public Alignment getDirection() {
|
||||
return this.alignment;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
package binnie.core.gui.database;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import binnie.core.api.gui.IArea;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
@@ -30,7 +30,7 @@ class ControlBreedingProgress extends Control {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.PANEL_BLACK, this.getArea());
|
||||
final Area area = this.getArea().inset(1);
|
||||
final IArea area = this.getArea().inset(1);
|
||||
area.setSize(new Point(Math.round(area.size().xPos() * this.percentage), area.size().yPos()));
|
||||
RenderUtil.setColour(this.colour);
|
||||
CraftGUI.RENDER.texture(ControlBreedingProgress.Progress, area);
|
||||
|
||||
@@ -7,6 +7,8 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
@@ -29,10 +31,8 @@ import binnie.core.gui.controls.tab.ControlTabBar;
|
||||
import binnie.core.gui.events.EventHandler;
|
||||
import binnie.core.gui.events.EventTextEdit;
|
||||
import binnie.core.gui.events.EventValueChanged;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.CraftGUIUtil;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.minecraft.MinecraftGUI;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.gui.minecraft.control.ControlHelp;
|
||||
@@ -134,7 +134,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
this.createMode(Mode.BRANCHES, new BranchesModeWidgets());
|
||||
this.createMode(Mode.BREEDER, new BreederModeWidgets());
|
||||
this.addTabs();
|
||||
final ControlTabBar<IDatabaseMode> tab = new ControlTabBar<IDatabaseMode>(this, 176 + this.selectionBoxWidth, 24, 22, 176, Position.RIGHT, this.modePages.getValues()) {
|
||||
final ControlTabBar<IDatabaseMode> tab = new ControlTabBar<IDatabaseMode>(this, 176 + this.selectionBoxWidth, 24, 22, 176, Alignment.RIGHT, this.modePages.getValues()) {
|
||||
@Override
|
||||
public ControlTab<IDatabaseMode> createTab(final int x, final int y, final int w, final int h, final IDatabaseMode value) {
|
||||
return new ControlTab<IDatabaseMode>(this, x, y, w, h, value) {
|
||||
@@ -148,7 +148,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
CraftGUIUtil.linkWidgets(tab, this.modePages);
|
||||
this.changeMode(Mode.SPECIES);
|
||||
for (final IDatabaseMode mode : this.modes.keySet()) {
|
||||
this.modes.get(mode).infoTabs = new ControlTabBar<>(this.modes.get(mode).modePage, 8, 24, 16, 176, Position.LEFT, this.modes.get(mode).infoPages.getValues());
|
||||
this.modes.get(mode).infoTabs = new ControlTabBar<>(this.modes.get(mode).modePage, 8, 24, 16, 176, Alignment.LEFT, this.modes.get(mode).infoPages.getValues());
|
||||
CraftGUIUtil.linkWidgets(this.modes.get(mode).infoTabs, this.modes.get(mode).infoPages);
|
||||
}
|
||||
}
|
||||
@@ -208,14 +208,14 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
public ModeWidgets(final IDatabaseMode mode, final WindowAbstractDatabase database) {
|
||||
this.database = database;
|
||||
this.modePage = new ControlPage<>(database.modePages, 0, 0, database.getSize().xPos(), database.getSize().yPos(), mode);
|
||||
final Area listBoxArea = database.panelSearch.getArea().inset(2);
|
||||
final IArea listBoxArea = database.panelSearch.getArea().inset(2);
|
||||
this.createListBox(listBoxArea);
|
||||
CraftGUIUtil.alignToWidget(this.listBox, database.panelSearch);
|
||||
CraftGUIUtil.moveWidget(this.listBox, new Point(2, 2));
|
||||
CraftGUIUtil.alignToWidget(this.infoPages = new ControlPages<>(this.modePage, 0, 0, 144, 176), database.panelInformation);
|
||||
}
|
||||
|
||||
public abstract void createListBox(final Area p0);
|
||||
public abstract void createListBox(final IArea p0);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -225,7 +225,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createListBox(final Area area) {
|
||||
public void createListBox(final IArea area) {
|
||||
final GameProfile playerName = WindowAbstractDatabase.this.getUsername();
|
||||
final Collection<IAlleleSpecies> speciesList = this.database.isNEI ? this.database.system.getAllSpecies() : this.database.system.getDiscoveredSpecies(this.database.getWorld(), playerName);
|
||||
ControlSpeciesBox controlSpeciesBox = new ControlSpeciesBox(this.modePage, area.xPos(), area.yPos(), area.width(), area.height());
|
||||
@@ -241,7 +241,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createListBox(final Area area) {
|
||||
public void createListBox(final IArea area) {
|
||||
final EntityPlayer player = this.database.getPlayer();
|
||||
final GameProfile playerName = player.getGameProfile();
|
||||
final Collection<IClassification> speciesList = this.database.isNEI ? this.database.system.getAllBranches() : this.database.system.getDiscoveredBranches(this.database.getWorld(), playerName);
|
||||
@@ -258,7 +258,7 @@ public abstract class WindowAbstractDatabase extends Window {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createListBox(final Area area) {
|
||||
public void createListBox(final IArea area) {
|
||||
this.listBox = new ControlListBox(this.modePage, area.xPos(), area.yPos(), area.width(), area.height(), 12);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
package binnie.core.gui.fieldkit;
|
||||
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
|
||||
import binnie.core.Binnie;
|
||||
import binnie.core.gui.Attribute;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
@@ -18,6 +12,10 @@ import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
import binnie.core.gui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.texture.BinnieCoreTexture;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ControlChromoPicker extends Control implements ITooltip {
|
||||
Texture Selected;
|
||||
|
||||
@@ -1,114 +1,52 @@
|
||||
package binnie.core.gui.fieldkit;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeChromosome;
|
||||
import forestry.api.arboriculture.EnumTreeChromosome;
|
||||
import forestry.api.arboriculture.TreeManager;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import forestry.api.lepidopterology.ButterflyManager;
|
||||
import forestry.api.lepidopterology.EnumButterflyChromosome;
|
||||
|
||||
import binnie.botany.api.BotanyAPI;
|
||||
import binnie.botany.api.genetics.EnumFlowerChromosome;
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import binnie.core.api.genetics.IFieldKitPlugin;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.controls.core.IControlValue;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
import binnie.core.gui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.texture.BinnieCoreTexture;
|
||||
import com.google.common.base.Preconditions;
|
||||
import forestry.api.genetics.IChromosomeType;
|
||||
import forestry.api.genetics.ISpeciesRoot;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class ControlChromosome extends Control implements IControlValue<IChromosomeType> {
|
||||
private Texture BeeTexture;
|
||||
private Texture TreeTexture;
|
||||
private Texture MothTexture;
|
||||
private Texture FlowerTexture;
|
||||
@Nullable
|
||||
private IChromosomeType chromo;
|
||||
@Nullable
|
||||
private ISpeciesRoot species;
|
||||
private IBreedingSystem breedingSystem;
|
||||
|
||||
public ControlChromosome(IWidget parent, int x, int y) {
|
||||
super(parent, x, y, 96, 96);
|
||||
BeeTexture = new StandardTexture(0, 0, 96, 96, BinnieCoreTexture.GUI_BREEDING);
|
||||
TreeTexture = new StandardTexture(96, 0, 96, 96, BinnieCoreTexture.GUI_BREEDING);
|
||||
MothTexture = new StandardTexture(96, 96, 96, 96, BinnieCoreTexture.GUI_BREEDING);
|
||||
FlowerTexture = new StandardTexture(0, 96, 96, 96, BinnieCoreTexture.GUI_BREEDING);
|
||||
chromo = null;
|
||||
species = null;
|
||||
}
|
||||
|
||||
public ISpeciesRoot getRoot() {
|
||||
Preconditions.checkState(species != null, "root has not been set");
|
||||
return species;
|
||||
Preconditions.checkState(breedingSystem != null, "root has not been set");
|
||||
return breedingSystem.getSpeciesRoot();
|
||||
}
|
||||
|
||||
public void setRoot(@Nullable ISpeciesRoot root) {
|
||||
if (root != species) {
|
||||
species = root;
|
||||
public void setSystem(@Nullable IBreedingSystem breedingSystem) {
|
||||
if (this.breedingSystem != breedingSystem) {
|
||||
this.breedingSystem = breedingSystem;
|
||||
deleteAllChildren();
|
||||
if (root == BeeManager.beeRoot) {
|
||||
new ControlChromoPicker(this, 28, 47, EnumBeeChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 28, 72, EnumBeeChromosome.SPEED);
|
||||
new ControlChromoPicker(this, 19, 20, EnumBeeChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 55, 65, EnumBeeChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 28, 1, EnumBeeChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 61, 37, EnumBeeChromosome.NEVER_SLEEPS);
|
||||
new ControlChromoPicker(this, 81, 76, EnumBeeChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 44, 21, EnumBeeChromosome.TOLERATES_RAIN);
|
||||
new ControlChromoPicker(this, 3, 37, EnumBeeChromosome.CAVE_DWELLING);
|
||||
new ControlChromoPicker(this, 4, 65, EnumBeeChromosome.FLOWER_PROVIDER);
|
||||
new ControlChromoPicker(this, 83, 27, EnumBeeChromosome.FLOWERING);
|
||||
new ControlChromoPicker(this, 71, 10, EnumBeeChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 84, 54, EnumBeeChromosome.EFFECT);
|
||||
} else if (root == TreeManager.treeRoot) {
|
||||
new ControlChromoPicker(this, 48, 48, EnumTreeChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 43, 84, EnumTreeChromosome.HEIGHT);
|
||||
new ControlChromoPicker(this, 25, 63, EnumTreeChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 72, 57, EnumTreeChromosome.FRUITS);
|
||||
new ControlChromoPicker(this, 21, 43, EnumTreeChromosome.YIELD);
|
||||
new ControlChromoPicker(this, 15, 17, EnumTreeChromosome.SAPPINESS);
|
||||
new ControlChromoPicker(this, 67, 15, EnumTreeChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 70, 34, EnumTreeChromosome.MATURATION);
|
||||
new ControlChromoPicker(this, 45, 67, EnumTreeChromosome.GIRTH);
|
||||
new ControlChromoPicker(this, 5, 70, EnumTreeChromosome.FIREPROOF);
|
||||
} else if (root == BotanyAPI.flowerRoot) {
|
||||
new ControlChromoPicker(this, 35, 81, EnumFlowerChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 36, 28, EnumFlowerChromosome.PRIMARY);
|
||||
new ControlChromoPicker(this, 27, 13, EnumFlowerChromosome.SECONDARY);
|
||||
new ControlChromoPicker(this, 47, 15, EnumFlowerChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 54, 31, EnumFlowerChromosome.TERRITORY);
|
||||
new ControlChromoPicker(this, 15, 55, EnumFlowerChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 23, 38, EnumFlowerChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 17, 77, EnumFlowerChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 52, 51, EnumFlowerChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 54, 80, EnumFlowerChromosome.PH_TOLERANCE);
|
||||
new ControlChromoPicker(this, 41, 42, EnumFlowerChromosome.SAPPINESS);
|
||||
new ControlChromoPicker(this, 37, 63, EnumFlowerChromosome.STEM);
|
||||
} else if (root == ButterflyManager.butterflyRoot) {
|
||||
new ControlChromoPicker(this, 40, 40, EnumButterflyChromosome.SPECIES);
|
||||
new ControlChromoPicker(this, 63, 32, EnumButterflyChromosome.SIZE);
|
||||
new ControlChromoPicker(this, 32, 63, EnumButterflyChromosome.SPEED);
|
||||
new ControlChromoPicker(this, 11, 27, EnumButterflyChromosome.LIFESPAN);
|
||||
new ControlChromoPicker(this, 16, 12, EnumButterflyChromosome.METABOLISM);
|
||||
new ControlChromoPicker(this, 17, 63, EnumButterflyChromosome.FERTILITY);
|
||||
new ControlChromoPicker(this, 34, 12, EnumButterflyChromosome.TEMPERATURE_TOLERANCE);
|
||||
new ControlChromoPicker(this, 22, 46, EnumButterflyChromosome.HUMIDITY_TOLERANCE);
|
||||
new ControlChromoPicker(this, 53, 26, EnumButterflyChromosome.NOCTURNAL);
|
||||
new ControlChromoPicker(this, 71, 53, EnumButterflyChromosome.TOLERANT_FLYER);
|
||||
new ControlChromoPicker(this, 78, 12, EnumButterflyChromosome.FIRE_RESIST);
|
||||
new ControlChromoPicker(this, 55, 55, EnumButterflyChromosome.FLOWER_PROVIDER);
|
||||
new ControlChromoPicker(this, 27, 31, EnumButterflyChromosome.EFFECT);
|
||||
new ControlChromoPicker(this, 87, 45, EnumButterflyChromosome.COCOON);
|
||||
|
||||
if (breedingSystem != null) {
|
||||
IFieldKitPlugin fieldKitPlugin = breedingSystem.getFieldKitPlugin();
|
||||
fieldKitPlugin.getChromosomePickerPositions();
|
||||
|
||||
for (Map.Entry<IChromosomeType, IPoint> entry : fieldKitPlugin.getChromosomePickerPositions().entrySet()) {
|
||||
IChromosomeType chromosomeType = entry.getKey();
|
||||
IPoint position = entry.getValue();
|
||||
new ControlChromoPicker(this, position.xPos(), position.yPos(), chromosomeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,28 +64,20 @@ public class ControlChromosome extends Control implements IControlValue<IChromos
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
if (species == null) {
|
||||
if (breedingSystem == null) {
|
||||
return;
|
||||
}
|
||||
super.onRenderBackground(guiWidth, guiHeight);
|
||||
Texture text = getTypeTexture();
|
||||
CraftGUI.RENDER.texture(text, Point.ZERO);
|
||||
ITexture texture = getTypeTexture();
|
||||
CraftGUI.RENDER.texture(texture, Point.ZERO);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Texture getTypeTexture() {
|
||||
if (species == BeeManager.beeRoot) {
|
||||
return BeeTexture;
|
||||
private ITexture getTypeTexture() {
|
||||
if (breedingSystem == null) {
|
||||
return null;
|
||||
}
|
||||
if (species == TreeManager.treeRoot) {
|
||||
return TreeTexture;
|
||||
}
|
||||
if (species == ButterflyManager.butterflyRoot) {
|
||||
return MothTexture;
|
||||
}
|
||||
if (species == BotanyAPI.flowerRoot) {
|
||||
return FlowerTexture;
|
||||
}
|
||||
return null;
|
||||
IFieldKitPlugin fieldKitPlugin = breedingSystem.getFieldKitPlugin();
|
||||
return fieldKitPlugin.getTypeTexture();
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
import binnie.core.api.genetics.IBreedingSystem;
|
||||
import binnie.core.genetics.ManagerGenetics;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -33,7 +35,6 @@ import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.events.EventHandler;
|
||||
import binnie.core.gui.events.EventValueChanged;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.TextJustification;
|
||||
import binnie.core.gui.minecraft.InventoryType;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
@@ -168,7 +169,11 @@ public class WindowFieldKit extends Window {
|
||||
return;
|
||||
}
|
||||
final ISpeciesRoot root = AlleleManager.alleleRegistry.getSpeciesRoot(item);
|
||||
this.chromo.setRoot(root);
|
||||
if (root == null) {
|
||||
return;
|
||||
}
|
||||
IBreedingSystem system = Binnie.GENETICS.getSystem(root);
|
||||
this.chromo.setSystem(system);
|
||||
final Random rand = new Random();
|
||||
this.info.clear();
|
||||
for (final IChromosomeType type : root.getKaryotype()) {
|
||||
@@ -179,12 +184,12 @@ public class WindowFieldKit extends Window {
|
||||
for (String pref = root.getUID() + ".fieldkit." + type.getName().toLowerCase() + "."; I18N.canLocalise(pref + i); ++i) {
|
||||
infos.add(I18N.localise(pref + i));
|
||||
}
|
||||
String text = Binnie.GENETICS.getSystem(root).getAlleleName(type, allele);
|
||||
String text = system.getAlleleName(type, allele);
|
||||
if (!infos.isEmpty()) {
|
||||
text = infos.get(rand.nextInt(infos.size()));
|
||||
}
|
||||
this.info.put(type, text);
|
||||
this.chromo.setRoot(root);
|
||||
this.chromo.setSystem(system);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -213,7 +218,7 @@ public class WindowFieldKit extends Window {
|
||||
this.analyseProgress = 1;
|
||||
} else {
|
||||
this.startAnalysing();
|
||||
this.chromo.setRoot(null);
|
||||
this.chromo.setSystem(null);
|
||||
if (this.damageKit()) {
|
||||
return;
|
||||
}
|
||||
@@ -228,7 +233,7 @@ public class WindowFieldKit extends Window {
|
||||
} else {
|
||||
this.isAnalysing = false;
|
||||
this.analyseProgress = 1;
|
||||
this.chromo.setRoot(null);
|
||||
this.chromo.setSystem(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
@ParametersAreNonnullByDefault
|
||||
@MethodsReturnNonnullByDefault
|
||||
@FieldsAreNonnullByDefault
|
||||
package binnie.core.gui.fieldkit;
|
||||
|
||||
import javax.annotation.ParametersAreNonnullByDefault;
|
||||
|
||||
import binnie.core.util.FieldsAreNonnullByDefault;
|
||||
import mcp.MethodsReturnNonnullByDefault;
|
||||
@@ -35,7 +35,7 @@ import binnie.core.gui.events.EventHandler;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.events.EventValueChanged;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.minecraft.MinecraftGUI;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.gui.minecraft.control.ControlItemDisplay;
|
||||
@@ -72,7 +72,7 @@ public class WindowGenesis extends Window {
|
||||
public void initialiseClient() {
|
||||
new ControlPlayerInventory(this);
|
||||
this.setTitle(I18N.localise("binniecore.gui.genesis.title"));
|
||||
final ControlTabBar<IBreedingSystem> tabSystems = new ControlTabBar<IBreedingSystem>(this, 8, 28, 23, 100, Position.LEFT, Binnie.GENETICS.getActiveSystems()) {
|
||||
final ControlTabBar<IBreedingSystem> tabSystems = new ControlTabBar<IBreedingSystem>(this, 8, 28, 23, 100, Alignment.LEFT, Binnie.GENETICS.getActiveSystems()) {
|
||||
@Override
|
||||
public ControlTab<IBreedingSystem> createTab(final int x, final int y, final int w, final int h, final IBreedingSystem value) {
|
||||
return new ControlTabIcon<IBreedingSystem>(this, x, y, w, h, value) {
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
package binnie.core.gui.geometry;
|
||||
|
||||
public final class Area {
|
||||
private Point pos;
|
||||
private Point size;
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IBorder;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
|
||||
public final class Area implements IArea {
|
||||
private IPoint pos;
|
||||
private IPoint size;
|
||||
|
||||
public Area(final Area area) {
|
||||
this(area.pos().xPos(), area.pos().yPos(), area.size().xPos(), area.size().yPos());
|
||||
}
|
||||
|
||||
public Area(final Point pos, final Point size) {
|
||||
public Area(final IPoint pos, final IPoint size) {
|
||||
this(pos.xPos(), pos.yPos(), size.xPos(), size.yPos());
|
||||
}
|
||||
|
||||
@@ -29,79 +33,98 @@ public final class Area {
|
||||
this.size = new Point(w, h);
|
||||
}
|
||||
|
||||
public Point pos() {
|
||||
@Override
|
||||
public IPoint pos() {
|
||||
return this.pos;
|
||||
}
|
||||
|
||||
public Point getPosition() {
|
||||
@Override
|
||||
public IPoint getPosition() {
|
||||
return this.pos;
|
||||
}
|
||||
|
||||
public void setPosition(final Point position) {
|
||||
@Override
|
||||
public void setPosition(final IPoint position) {
|
||||
this.pos = position.copy();
|
||||
}
|
||||
|
||||
public Point size() {
|
||||
@Override
|
||||
public IPoint size() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public Point getSize() {
|
||||
@Override
|
||||
public IPoint getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
public void setSize(final Point size) {
|
||||
@Override
|
||||
public void setSize(final IPoint size) {
|
||||
this.size = size.copy();
|
||||
}
|
||||
|
||||
public boolean contains(final Point position) {
|
||||
@Override
|
||||
public boolean contains(final IPoint position) {
|
||||
return position.xPos() >= this.pos().xPos() && position.yPos() >= this.pos.yPos() && position.xPos() <= this.pos().xPos() + this.size().xPos() && position.yPos() <= this.pos().yPos() + this.size().yPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos() {
|
||||
return this.pos().xPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos() {
|
||||
return this.pos().yPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int width() {
|
||||
return this.size().xPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int height() {
|
||||
return this.size().yPos();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setXPos(final int xPos) {
|
||||
this.pos = new Point(xPos, this.pos.yPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setYPos(final int yPos) {
|
||||
this.pos = new Point(this.pos.xPos(), yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth(final int width) {
|
||||
this.size = new Point(width, this.size.yPos());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(final int height) {
|
||||
this.size = new Point(this.size.xPos(), height);
|
||||
}
|
||||
|
||||
public Area inset(final Border border) {
|
||||
return new Area(this.xPos() + border.l(), this.yPos() + border.t(), this.width() - border.l() - border.r(), this.height() - border.t() - border.b());
|
||||
@Override
|
||||
public IArea inset(final IBorder border) {
|
||||
return new Area(this.xPos() + border.getLeft(), this.yPos() + border.getTop(), this.width() - border.getLeft() - border.getRight(), this.height() - border.getTop() - border.getBottom());
|
||||
}
|
||||
|
||||
public Area outset(final int outset) {
|
||||
@Override
|
||||
public IArea outset(final int outset) {
|
||||
return this.outset(new Border(outset));
|
||||
}
|
||||
|
||||
public Area outset(final Border border) {
|
||||
return new Area(this.xPos() - border.l(), this.yPos() - border.t(), this.width() + border.l() + border.r(), this.height() + border.t() + border.b());
|
||||
@Override
|
||||
public IArea outset(final IBorder border) {
|
||||
return new Area(this.xPos() - border.getLeft(), this.yPos() - border.getTop(), this.width() + border.getLeft() + border.getRight(), this.height() + border.getTop() + border.getBottom());
|
||||
}
|
||||
|
||||
public Area inset(final int inset) {
|
||||
@Override
|
||||
public IArea inset(final int inset) {
|
||||
return this.inset(new Border(inset));
|
||||
}
|
||||
|
||||
@@ -110,7 +133,8 @@ public final class Area {
|
||||
return this.width() + "x" + this.height() + "@" + this.xPos() + "," + this.yPos();
|
||||
}
|
||||
|
||||
public Area shift(final int dx, final int f) {
|
||||
@Override
|
||||
public IArea shift(final int dx, final int f) {
|
||||
return new Area(this.xPos() + dx, this.yPos() + f, this.width(), this.height());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
package binnie.core.gui.geometry;
|
||||
|
||||
public class Border {
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.api.gui.IBorder;
|
||||
|
||||
public class Border implements IBorder {
|
||||
public static final Border ZERO = new Border(0);
|
||||
int t;
|
||||
int b;
|
||||
@@ -26,76 +29,66 @@ public class Border {
|
||||
this.r = r;
|
||||
}
|
||||
|
||||
public Border(final Position edge, final int n) {
|
||||
this((edge == Position.Top) ? n : 0, (edge == Position.RIGHT) ? n : 0, (edge == Position.BOTTOM) ? n : 0, (edge == Position.LEFT) ? n : 0);
|
||||
public Border(final Alignment edge, final int n) {
|
||||
this((edge == Alignment.TOP) ? n : 0, (edge == Alignment.RIGHT) ? n : 0, (edge == Alignment.BOTTOM) ? n : 0, (edge == Alignment.LEFT) ? n : 0);
|
||||
}
|
||||
|
||||
public Border(final Border padding) {
|
||||
this(padding.t(), padding.r(), padding.b(), padding.l());
|
||||
this(padding.getTop(), padding.getRight(), padding.getBottom(), padding.getLeft());
|
||||
}
|
||||
|
||||
public int t() {
|
||||
@Override
|
||||
public int getTop() {
|
||||
return this.t;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
@Override
|
||||
public int getBottom() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public int l() {
|
||||
@Override
|
||||
public int getLeft() {
|
||||
return this.l;
|
||||
}
|
||||
|
||||
public int r() {
|
||||
@Override
|
||||
public int getRight() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
public int t(final int n) {
|
||||
return this.t = n;
|
||||
@Override
|
||||
public void setTop(final int amount) {
|
||||
this.t = amount;
|
||||
}
|
||||
|
||||
public int b(final int n) {
|
||||
return this.b = n;
|
||||
@Override
|
||||
public void setBottom(final int amount) {
|
||||
this.b = amount;
|
||||
}
|
||||
|
||||
public int l(final int n) {
|
||||
return this.l = n;
|
||||
@Override
|
||||
public void setLeft(final int amount) {
|
||||
this.l = amount;
|
||||
}
|
||||
|
||||
public int r(final int n) {
|
||||
return this.r = n;
|
||||
@Override
|
||||
public void setRight(final int amount) {
|
||||
this.r = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNonZero() {
|
||||
return this.t != 0.0f || this.b != 0.0f || this.l != 0.0f || this.r != 0.0f;
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Point tl() {
|
||||
return new Point(this.l(), this.t());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Point tr() {
|
||||
return new Point(this.r(), this.t());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Point bl() {
|
||||
return new Point(this.l(), this.b());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Point br() {
|
||||
return new Point(this.r(), this.b());
|
||||
}
|
||||
|
||||
public Border add(final Border o) {
|
||||
return new Border(this.t() + o.t(), this.r() + o.r(), this.b() + o.b(), this.l() + o.l());
|
||||
@Override
|
||||
public IBorder add(final IBorder o) {
|
||||
return new Border(this.getTop() + o.getTop(), this.getRight() + o.getRight(), this.getBottom() + o.getBottom(), this.getLeft() + o.getLeft());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.t() + "-" + this.r() + "-" + this.b() + "-" + this.l();
|
||||
return this.getTop() + "-" + this.getRight() + "-" + this.getBottom() + "-" + this.getLeft();
|
||||
}
|
||||
}
|
||||
@@ -1,17 +1,18 @@
|
||||
package binnie.core.gui.geometry;
|
||||
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.IControlValue;
|
||||
import binnie.core.gui.events.EventValueChanged;
|
||||
|
||||
public class CraftGUIUtil {
|
||||
public static void alignToWidget(final IWidget target, final IWidget relativeTo) {
|
||||
final Point startPos = target.getAbsolutePosition();
|
||||
final Point endPos = relativeTo.getAbsolutePosition();
|
||||
final IPoint startPos = target.getAbsolutePosition();
|
||||
final IPoint endPos = relativeTo.getAbsolutePosition();
|
||||
moveWidget(target, endPos.sub(startPos));
|
||||
}
|
||||
|
||||
public static void moveWidget(final IWidget target, final Point movement) {
|
||||
public static void moveWidget(final IWidget target, final IPoint movement) {
|
||||
target.setPosition(target.getPosition().add(movement));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package binnie.core.gui.geometry;
|
||||
|
||||
public class Point {
|
||||
import binnie.core.api.gui.IPoint;
|
||||
|
||||
public class Point implements IPoint {
|
||||
public static final Point ZERO = new Point(0, 0);
|
||||
|
||||
private final int xPos;
|
||||
@@ -11,44 +13,56 @@ public class Point {
|
||||
this.yPos = yPos;
|
||||
}
|
||||
|
||||
public Point(Point point) {
|
||||
public Point(IPoint point) {
|
||||
this.xPos = point.xPos();
|
||||
this.yPos = point.yPos();
|
||||
}
|
||||
|
||||
public static Point add(Point firstPoint, Point secondPoint) {
|
||||
public static IPoint add(IPoint firstPoint, IPoint secondPoint) {
|
||||
return new Point(firstPoint.xPos() + secondPoint.xPos(), firstPoint.yPos() + secondPoint.yPos());
|
||||
}
|
||||
|
||||
public static Point sub(Point firstPoint, Point secondPoint) {
|
||||
public static IPoint sub(IPoint firstPoint, IPoint secondPoint) {
|
||||
return new Point(firstPoint.xPos() - secondPoint.xPos(), firstPoint.yPos() - secondPoint.yPos());
|
||||
}
|
||||
|
||||
public Point sub(Point point) {
|
||||
@Override
|
||||
public IPoint sub(IPoint point) {
|
||||
return sub(this, point);
|
||||
}
|
||||
|
||||
public Point add(Point other) {
|
||||
@Override
|
||||
public IPoint sub(int xPos, int yPos) {
|
||||
return new Point(xPos() - xPos, yPos() - yPos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPoint add(IPoint other) {
|
||||
return add(this, other);
|
||||
}
|
||||
|
||||
public Point add(int xPos, int yPos) {
|
||||
return add(this, new Point(xPos, yPos));
|
||||
@Override
|
||||
public IPoint add(int xPos, int yPos) {
|
||||
return new Point(xPos() + xPos, yPos() + yPos);
|
||||
}
|
||||
|
||||
public Point copy() {
|
||||
@Override
|
||||
public IPoint copy() {
|
||||
return new Point(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos() {
|
||||
return this.xPos;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos() {
|
||||
return this.yPos;
|
||||
}
|
||||
|
||||
public boolean equals(final Point other) {
|
||||
@Override
|
||||
public boolean equals(final IPoint other) {
|
||||
return this.xPos() == other.xPos() && this.yPos() == other.yPos();
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package binnie.core.gui.minecraft;
|
||||
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -9,7 +10,6 @@ import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.events.EventHandler;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
@@ -43,7 +43,7 @@ public abstract class Dialog extends Control {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOverWidget(final Point relativeMouse) {
|
||||
public boolean isMouseOverWidget(final IPoint relativeMouse) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
@@ -29,7 +31,6 @@ import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.events.EventKey;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -346,7 +347,7 @@ public class GuiCraftGUI extends GuiContainer {
|
||||
return this.fontRenderer;
|
||||
}
|
||||
|
||||
public void resize(final Point size) {
|
||||
public void resize(final IPoint size) {
|
||||
this.xSize = size.xPos();
|
||||
this.ySize = size.yPos();
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
|
||||
@@ -2,6 +2,8 @@ package binnie.core.gui.minecraft.control;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -15,9 +17,7 @@ import binnie.core.gui.ITooltip;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.minecraft.MinecraftTooltip;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
@@ -29,9 +29,9 @@ import binnie.core.machines.power.IProcess;
|
||||
|
||||
public class ControlEnergyBar extends Control implements ITooltip {
|
||||
public static boolean isError;
|
||||
private Position direction;
|
||||
private Alignment direction;
|
||||
|
||||
public ControlEnergyBar(final IWidget parent, final int x, final int y, final int width, final int height, final Position direction) {
|
||||
public ControlEnergyBar(final IWidget parent, final int x, final int y, final int width, final int height, final Alignment direction) {
|
||||
super(parent, x, y, width, height);
|
||||
this.direction = direction;
|
||||
this.addAttribute(Attribute.MOUSE_OVER);
|
||||
@@ -87,9 +87,9 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
final float percentage = this.getPercentage() / 100.0f;
|
||||
int colourFromPercentage = this.getColourFromPercentage(percentage);
|
||||
RenderUtil.setColour(colourFromPercentage);
|
||||
final Area area = this.getArea();
|
||||
final IArea area = this.getArea();
|
||||
switch (this.direction) {
|
||||
case Top:
|
||||
case TOP:
|
||||
case BOTTOM: {
|
||||
final int height = Math.round(area.size().yPos() * percentage);
|
||||
area.setSize(new Point(area.size().xPos(), height));
|
||||
@@ -118,11 +118,11 @@ public class ControlEnergyBar extends Control implements ITooltip {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
if (this.isMouseOver() && Window.get(this).getGui().isHelpMode()) {
|
||||
final Area area = this.getArea();
|
||||
final IArea area = this.getArea();
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(Tooltip.Type.HELP));
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
|
||||
} else if (ControlEnergyBar.isError) {
|
||||
final Area area = this.getArea();
|
||||
final IArea area = this.getArea();
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.ERROR));
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package binnie.core.gui.minecraft.control;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.util.ITooltipFlag;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -14,7 +16,6 @@ import binnie.core.gui.ITooltip;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
|
||||
@@ -54,7 +55,7 @@ public class ControlItemDisplay extends Control implements ITooltip {
|
||||
return;
|
||||
}
|
||||
|
||||
final Point relativeToWindow = this.getAbsolutePosition().sub(this.getTopParent().getPosition());
|
||||
final IPoint relativeToWindow = this.getAbsolutePosition().sub(this.getTopParent().getPosition());
|
||||
if (relativeToWindow.xPos() > Window.get(this).getSize().xPos() + 100 || relativeToWindow.yPos() > Window.get(this).getSize().yPos() + 100) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
@@ -26,7 +29,6 @@ import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.minecraft.GuiCraftGUI;
|
||||
import binnie.core.gui.minecraft.MinecraftTooltip;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
@@ -110,9 +112,9 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
GlStateManager.enableBlend();
|
||||
{
|
||||
GlStateManager.blendFunc(770, 771);
|
||||
final Point pos = this.getAbsolutePosition();
|
||||
final Point offset = new Point(0, height - squaled);
|
||||
final Area limited = this.getArea().inset(1);
|
||||
final IPoint pos = this.getAbsolutePosition();
|
||||
final IPoint offset = new Point(0, height - squaled);
|
||||
final IArea limited = this.getArea().inset(1);
|
||||
if (this.horizontal) {
|
||||
limited.setSize(new Point(limited.width() - 1, limited.height()));
|
||||
}
|
||||
@@ -140,12 +142,12 @@ public class ControlLiquidTank extends Control implements ITooltip {
|
||||
CraftGUI.RENDER.texture(this.horizontal ? CraftGUITexture.HORIZONTAL_LIQUID_TANK_OVERLAY : CraftGUITexture.LIQUID_TANK_OVERLAY, Point.ZERO);
|
||||
GuiCraftGUI gui = Window.get(this).getGui();
|
||||
if (this.isMouseOver() && gui.isHelpMode()) {
|
||||
final Area area = this.getArea();
|
||||
final IArea area = this.getArea();
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(Tooltip.Type.HELP));
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
|
||||
}
|
||||
if (ControlLiquidTank.tankError.contains(this.tankID)) {
|
||||
final Area area = this.getArea();
|
||||
final IArea area = this.getArea();
|
||||
RenderUtil.setColour(MinecraftTooltip.getOutline(MinecraftTooltip.Type.ERROR));
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.OUTLINE, area.outset(1));
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package binnie.core.gui.minecraft.control;
|
||||
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
|
||||
public class ControlMachineProgress extends ControlProgress {
|
||||
public ControlMachineProgress(final IWidget parent, final int x, final int y, final Texture base, final Texture progress, final Position dir) {
|
||||
public ControlMachineProgress(final IWidget parent, final int x, final int y, final Texture base, final Texture progress, final Alignment dir) {
|
||||
super(parent, x, y, base, progress, dir);
|
||||
}
|
||||
}
|
||||
@@ -5,15 +5,15 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
|
||||
public class ControlProgress extends ControlProgressBase {
|
||||
private Texture progressBlank;
|
||||
private Texture progressBar;
|
||||
private Position direction;
|
||||
private Alignment direction;
|
||||
|
||||
public ControlProgress(final IWidget parent, final int x, final int y, final Texture progressBlank, final Texture progressBar, final Position dir) {
|
||||
public ControlProgress(final IWidget parent, final int x, final int y, final Texture progressBlank, final Texture progressBar, final Alignment dir) {
|
||||
super(parent, x, y, (progressBlank == null) ? 0 : progressBlank.width(), (progressBlank == null) ? 0 : progressBlank.height());
|
||||
this.progressBlank = progressBlank;
|
||||
this.progressBar = progressBar;
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package binnie.core.gui.minecraft.control;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
@@ -11,21 +15,19 @@ import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Border;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.geometry.TextJustification;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
public class ControlSlide extends Control {
|
||||
private Area expanded;
|
||||
private Area shrunk;
|
||||
private IArea expanded;
|
||||
private IArea shrunk;
|
||||
private boolean slideActive;
|
||||
private Position anchor;
|
||||
private Alignment anchor;
|
||||
private String label;
|
||||
|
||||
public ControlSlide(final IWidget parent, final int x, final int y, final int w, final int h, final Position anchor2) {
|
||||
public ControlSlide(final IWidget parent, final int x, final int y, final int w, final int h, final Alignment anchor2) {
|
||||
super(parent, x, y, w, h);
|
||||
this.slideActive = true;
|
||||
this.label = null;
|
||||
@@ -46,11 +48,11 @@ public class ControlSlide extends Control {
|
||||
final int lw = RenderUtil.getTextWidth(this.label) + 16;
|
||||
final int lh = RenderUtil.getTextHeight() + 16;
|
||||
final boolean hor = this.anchor.x() != 0;
|
||||
final Area ar = this.isSlideActive() ? this.expanded : this.shrunk;
|
||||
Area tabArea = new Area(hor ? (-lh / 2) : (-lw / 2), hor ? (-lw / 2) : (-lh / 2), hor ? lh : lw, hor ? lw : lh);
|
||||
final IArea ar = this.isSlideActive() ? this.expanded : this.shrunk;
|
||||
IArea tabArea = new Area(hor ? (-lh / 2) : (-lw / 2), hor ? (-lw / 2) : (-lh / 2), hor ? lh : lw, hor ? lw : lh);
|
||||
final Point shift = new Point(ar.width() * (1 - this.anchor.x()) / 2, ar.height() * (1 - this.anchor.y()) / 2);
|
||||
tabArea = tabArea.shift(shift.xPos() - (-3 + lh / 2) * this.anchor.x(), shift.yPos() - (-3 + lh / 2) * this.anchor.y());
|
||||
Texture texture = CraftGUI.RENDER.getTexture(this.isSlideActive() ? CraftGUITexture.TAB : CraftGUITexture.TAB_DISABLED).crop(this.anchor.opposite(), 8);
|
||||
ITexture texture = CraftGUI.RENDER.getTexture(this.isSlideActive() ? CraftGUITexture.TAB : CraftGUITexture.TAB_DISABLED).crop(this.anchor.opposite(), 8);
|
||||
CraftGUI.RENDER.texture(texture, tabArea);
|
||||
texture = CraftGUI.RENDER.getTexture(CraftGUITexture.TAB_OUTLINE).crop(this.anchor.opposite(), 8);
|
||||
CraftGUI.RENDER.texture(texture, tabArea.inset(2));
|
||||
@@ -67,7 +69,7 @@ public class ControlSlide extends Control {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.WINDOW, this.getArea());
|
||||
final Object slideTexture = (this.anchor == Position.BOTTOM) ? CraftGUITexture.SLIDE_DOWN : ((this.anchor == Position.Top) ? CraftGUITexture.SLIDE_UP : ((this.anchor == Position.LEFT) ? CraftGUITexture.SLIDE_LEFT : CraftGUITexture.SLIDE_RIGHT));
|
||||
final Object slideTexture = (this.anchor == Alignment.BOTTOM) ? CraftGUITexture.SLIDE_DOWN : ((this.anchor == Alignment.TOP) ? CraftGUITexture.SLIDE_UP : ((this.anchor == Alignment.LEFT) ? CraftGUITexture.SLIDE_LEFT : CraftGUITexture.SLIDE_RIGHT));
|
||||
CraftGUI.RENDER.texture(slideTexture, new Point((this.anchor.x() + 1) * this.getWidth() / 2 - 8, (this.anchor.y() + 1) * this.getHeight() / 2 - 8));
|
||||
}
|
||||
|
||||
@@ -84,7 +86,7 @@ public class ControlSlide extends Control {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOverWidget(final Point relativeMouse) {
|
||||
public boolean isMouseOverWidget(final IPoint relativeMouse) {
|
||||
return this.getArea().outset(this.isSlideActive() ? 16 : 8).outset(new Border(this.anchor.opposite(), 16)).contains(relativeMouse);
|
||||
}
|
||||
|
||||
@@ -95,7 +97,7 @@ public class ControlSlide extends Control {
|
||||
|
||||
public void setSlide(final boolean b) {
|
||||
this.slideActive = b;
|
||||
final Area area = this.isSlideActive() ? this.expanded : this.shrunk;
|
||||
final IArea area = this.isSlideActive() ? this.expanded : this.shrunk;
|
||||
this.setSize(area.size());
|
||||
this.setPosition(area.pos());
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.multiplayer.PlayerControllerMP;
|
||||
@@ -24,7 +26,6 @@ import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.events.EventMouse;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.minecraft.CustomSlot;
|
||||
import binnie.core.gui.minecraft.GuiCraftGUI;
|
||||
import binnie.core.gui.minecraft.InventoryType;
|
||||
@@ -131,7 +132,7 @@ public class ControlSlot extends ControlSlotBase {
|
||||
}
|
||||
highlighted = true;
|
||||
final int c = highlight.getKey().getColour();
|
||||
Area area = this.getArea();
|
||||
IArea area = this.getArea();
|
||||
if (this.getParent() instanceof ControlSlotArray || this.getParent() instanceof ControlPlayerInventory) {
|
||||
area = this.getParent().getArea();
|
||||
area.setPosition(Point.ZERO.sub(this.getPosition()));
|
||||
|
||||
@@ -7,7 +7,7 @@ import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.Tooltip;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.minecraft.Window;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.machines.Machine;
|
||||
@@ -30,7 +30,7 @@ public class ControlSlotCharge extends Control {
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
CraftGUI.RENDER.texture(CraftGUITexture.PANEL_BLACK, this.getArea());
|
||||
CraftGUI.RENDER.texturePercentage(CraftGUI.RENDER.getTexture(CraftGUITexture.SLOT_CHARGE), this.getArea().inset(1), Position.BOTTOM, this.getCharge());
|
||||
CraftGUI.RENDER.texturePercentage(CraftGUI.RENDER.getTexture(CraftGUITexture.SLOT_CHARGE), this.getArea().inset(1), Alignment.BOTTOM, this.getCharge());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package binnie.core.gui.renderer;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
@@ -29,7 +32,6 @@ import forestry.api.core.ForestryAPI;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.TextJustification;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -128,12 +130,12 @@ public class RenderUtil {
|
||||
return (fontRenderer == null) ? 0 : fontRenderer.FONT_HEIGHT;
|
||||
}
|
||||
|
||||
public static void drawText(final Point pos, final String text, final int colour) {
|
||||
public static void drawText(final IPoint pos, final String text, final int colour) {
|
||||
drawText(new Area(pos, new Point(500, 500)), TextJustification.TOP_LEFT, text, colour);
|
||||
}
|
||||
|
||||
public static void drawText(final Area area, final TextJustification justification, final String text, final int colour) {
|
||||
final Point pos = area.pos();
|
||||
public static void drawText(final IArea area, final TextJustification justification, final String text, final int colour) {
|
||||
final IPoint pos = area.pos();
|
||||
if (area.size().xPos() <= 0.0f) {
|
||||
return;
|
||||
}
|
||||
@@ -159,15 +161,15 @@ public class RenderUtil {
|
||||
GuiUtils.drawGradientRect(0, (int) left, (int) top, (int) right, (int) bottom, color, color);
|
||||
}
|
||||
|
||||
public static void drawSolidRect(final Area area, final int colour) {
|
||||
public static void drawSolidRect(final IArea area, final int colour) {
|
||||
drawSolidRect(area.pos().xPos(), area.pos().yPos(), area.pos().xPos() + area.size().xPos(), area.pos().yPos() + area.size().yPos(), 0xFF000000 | colour);
|
||||
}
|
||||
|
||||
public static void drawSolidRectWithAlpha(final Area area, final int color) {
|
||||
public static void drawSolidRectWithAlpha(final IArea area, final int color) {
|
||||
drawSolidRect(area.pos().xPos(), area.pos().yPos(), area.pos().xPos() + area.size().xPos(), area.pos().yPos() + area.size().yPos(), color);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(final Area area, final int startColor, final int endColor) {
|
||||
public static void drawGradientRect(final IArea area, final int startColor, final int endColor) {
|
||||
GuiUtils.drawGradientRect(0, area.pos().xPos(), area.pos().yPos(), area.pos().xPos() + area.size().xPos(), area.pos().yPos() + area.size().yPos(), startColor, endColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,11 @@ package binnie.core.gui.renderer;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import binnie.core.api.gui.IBorder;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -14,22 +19,18 @@ import org.lwjgl.opengl.GL11;
|
||||
|
||||
import binnie.core.BinnieCore;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Border;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.resource.IStyleSheet;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class TextureRenderer {
|
||||
private IStyleSheet styleSheet;
|
||||
|
||||
private static void renderTexturePadded(final Area area, final Area texture, final Border padding) {
|
||||
int borderLeft = padding.l();
|
||||
int borderRight = padding.r();
|
||||
int borderTop = padding.t();
|
||||
int borderBottom = padding.b();
|
||||
private static void renderTexturePadded(final IArea area, final IArea texture, final IBorder padding) {
|
||||
int borderLeft = padding.getLeft();
|
||||
int borderRight = padding.getRight();
|
||||
int borderTop = padding.getTop();
|
||||
int borderBottom = padding.getBottom();
|
||||
final int posX = area.pos().xPos();
|
||||
final int posY = area.pos().yPos();
|
||||
final int width = area.size().xPos();
|
||||
@@ -46,7 +47,6 @@ public class TextureRenderer {
|
||||
borderLeft = width / 2;
|
||||
borderRight = width / 2;
|
||||
}
|
||||
final Point origin = area.pos();
|
||||
GuiUtils.drawTexturedModalRect(posX, posY, u, v, borderLeft, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX + width - borderRight, posY, u + textWidth - borderRight, v, borderRight, borderTop, 0);
|
||||
GuiUtils.drawTexturedModalRect(posX, posY + height - borderBottom, u, v + textHeight - borderBottom, borderLeft, borderBottom, 0);
|
||||
@@ -101,8 +101,8 @@ public class TextureRenderer {
|
||||
RenderUtil.setColour(widget.getColor());
|
||||
if (widget.isCroppedWidet()) {
|
||||
final IWidget cropRelative = (widget.getCropWidget() != null) ? widget.getCropWidget() : widget;
|
||||
final Point pos = cropRelative.getAbsolutePosition();
|
||||
final Area cropZone = widget.getCroppedZone();
|
||||
final IPoint pos = cropRelative.getAbsolutePosition();
|
||||
final IArea cropZone = widget.getCroppedZone();
|
||||
GL11.glEnable(GL11.GL_SCISSOR_TEST);
|
||||
this.limitArea(new Area(pos.add(cropZone.pos()), cropZone.size()), guiWidth, guiHeight);
|
||||
}
|
||||
@@ -117,53 +117,53 @@ public class TextureRenderer {
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
public Texture getTexture(final Object key) {
|
||||
if (key instanceof Texture) {
|
||||
return (Texture) key;
|
||||
public ITexture getTexture(final Object key) {
|
||||
if (key instanceof ITexture) {
|
||||
return (ITexture) key;
|
||||
}
|
||||
return this.styleSheet.getTexture(key);
|
||||
}
|
||||
|
||||
public void setTexture(@Nullable final Texture texture) {
|
||||
public void setTexture(@Nullable final ITexture texture) {
|
||||
if (texture != null) {
|
||||
BinnieCore.getBinnieProxy().bindTexture(texture.getFilename().getResourceLocation());
|
||||
BinnieCore.getBinnieProxy().bindTexture(texture.getResourceLocation());
|
||||
}
|
||||
}
|
||||
|
||||
public void texture(final Object texture, final Point position) {
|
||||
public void texture(final Object texture, final IPoint position) {
|
||||
this.texture(this.getTexture(texture), position);
|
||||
}
|
||||
|
||||
public void texture(@Nullable final Texture texture, final Point position) {
|
||||
public void texture(@Nullable final ITexture texture, final IPoint position) {
|
||||
if (texture == null) {
|
||||
return;
|
||||
}
|
||||
this.setTexture(texture);
|
||||
final Point point = position.sub(new Point(texture.getBorder().l(), texture.getBorder().t()));
|
||||
final Area textureArea = texture.getArea().outset(texture.getBorder());
|
||||
final IPoint point = position.sub(texture.getBorder().getLeft(), texture.getBorder().getTop());
|
||||
final IArea textureArea = texture.getArea().outset(texture.getBorder());
|
||||
GuiUtils.drawTexturedModalRect(point.xPos(), point.yPos(), textureArea.pos().xPos(), textureArea.pos().yPos(), textureArea.size().xPos(), textureArea.size().yPos(), 0);
|
||||
}
|
||||
|
||||
public void texture(final Object window, final Area area) {
|
||||
public void texture(final Object window, final IArea area) {
|
||||
this.texture(this.getTexture(window), area);
|
||||
}
|
||||
|
||||
public void texture(@Nullable final Texture texture, final Area area) {
|
||||
public void texture(@Nullable final ITexture texture, final IArea area) {
|
||||
if (texture == null) {
|
||||
return;
|
||||
}
|
||||
this.setTexture(texture);
|
||||
final Area textureArea = texture.getArea().outset(texture.getBorder());
|
||||
final Area targetArea = area.outset(texture.getBorder());
|
||||
final IArea textureArea = texture.getArea().outset(texture.getBorder());
|
||||
final IArea targetArea = area.outset(texture.getBorder());
|
||||
if (textureArea.width() == targetArea.width() && textureArea.height() == targetArea.height()) {
|
||||
final Point position = targetArea.pos();
|
||||
final IPoint position = targetArea.pos();
|
||||
GuiUtils.drawTexturedModalRect(position.xPos(), position.yPos(), textureArea.pos().xPos(), textureArea.pos().yPos(), textureArea.size().xPos(), textureArea.size().yPos(), 0);
|
||||
} else {
|
||||
renderTexturePadded(targetArea, textureArea, texture.getTotalPadding());
|
||||
}
|
||||
}
|
||||
|
||||
public void limitArea(final Area area, int guiWidth, int guiHeight) {
|
||||
public void limitArea(final IArea area, int guiWidth, int guiHeight) {
|
||||
float x = area.pos().xPos();
|
||||
float y = area.pos().yPos();
|
||||
float w = area.size().xPos();
|
||||
@@ -185,15 +185,15 @@ public class TextureRenderer {
|
||||
return fontRenderer.listFormattedStringToWidth(text, width).size() * RenderUtil.getTextHeight();
|
||||
}
|
||||
|
||||
public void texturePercentage(final Texture texture, final Area area, final Position direction, final float percentage) {
|
||||
final int dist = (direction == Position.Top || direction == Position.BOTTOM) ? Math.round(percentage * texture.height()) : Math.round(percentage * texture.width());
|
||||
final int dim = (direction == Position.Top || direction == Position.BOTTOM) ? texture.height() : texture.width();
|
||||
public void texturePercentage(final ITexture texture, final IArea area, final Alignment direction, final float percentage) {
|
||||
final int dist = (direction == Alignment.TOP || direction == Alignment.BOTTOM) ? Math.round(percentage * texture.height()) : Math.round(percentage * texture.width());
|
||||
final int dim = (direction == Alignment.TOP || direction == Alignment.BOTTOM) ? texture.height() : texture.width();
|
||||
int x = area.pos().xPos();
|
||||
int y = area.pos().yPos();
|
||||
int w = area.size().xPos();
|
||||
int h = area.size().yPos();
|
||||
switch (direction) {
|
||||
case Top: {
|
||||
case TOP: {
|
||||
h *= percentage;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,17 @@
|
||||
package binnie.core.gui.resource;
|
||||
|
||||
import binnie.core.api.gui.IBorder;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Border;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
|
||||
public class Texture {
|
||||
public class Texture implements ITexture {
|
||||
private final Area area;
|
||||
private final Border padding;
|
||||
private final Border border;
|
||||
@@ -22,58 +24,66 @@ public class Texture {
|
||||
this.binnieTexture = binnieTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Area getArea() {
|
||||
return this.area;
|
||||
}
|
||||
|
||||
public Border getBorder() {
|
||||
@Override
|
||||
public IBorder getBorder() {
|
||||
return this.border;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BinnieResource getFilename() {
|
||||
return this.binnieTexture.getTexture();
|
||||
public ResourceLocation getResourceLocation() {
|
||||
return this.binnieTexture.getTexture().getResourceLocation();
|
||||
}
|
||||
|
||||
public Border getTotalPadding() {
|
||||
@Override
|
||||
public IBorder getTotalPadding() {
|
||||
return this.padding.add(this.border);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int width() {
|
||||
return this.getArea().width();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int height() {
|
||||
return this.getArea().height();
|
||||
}
|
||||
|
||||
public Texture crop(final Position anchor, final int dist) {
|
||||
@Override
|
||||
public ITexture crop(final Alignment anchor, final int dist) {
|
||||
return this.crop(new Border(anchor.opposite(), dist));
|
||||
}
|
||||
|
||||
public Texture crop(final Border crop) {
|
||||
@Override
|
||||
public ITexture crop(final IBorder crop) {
|
||||
final Texture copy = new Texture(this.area, this.padding, this.border, this.binnieTexture);
|
||||
if (crop.b() > 0) {
|
||||
copy.border.b(0);
|
||||
copy.padding.b(copy.padding.b() - Math.min(crop.b(), copy.padding.b()));
|
||||
copy.area.setHeight(copy.area.height() - crop.b());
|
||||
if (crop.getBottom() > 0) {
|
||||
copy.border.setBottom(0);
|
||||
copy.padding.setBottom(copy.padding.getBottom() - Math.min(crop.getBottom(), copy.padding.getBottom()));
|
||||
copy.area.setHeight(copy.area.height() - crop.getBottom());
|
||||
}
|
||||
if (crop.t() > 0) {
|
||||
copy.border.t(0);
|
||||
copy.padding.t(copy.padding.t() - Math.min(crop.t(), copy.padding.t()));
|
||||
copy.area.setHeight(copy.area.height() - crop.t());
|
||||
copy.area.setYPos(copy.area.yPos() + crop.t());
|
||||
if (crop.getTop() > 0) {
|
||||
copy.border.setTop(0);
|
||||
copy.padding.setTop(copy.padding.getTop() - Math.min(crop.getTop(), copy.padding.getTop()));
|
||||
copy.area.setHeight(copy.area.height() - crop.getTop());
|
||||
copy.area.setYPos(copy.area.yPos() + crop.getTop());
|
||||
}
|
||||
if (crop.r() > 0) {
|
||||
copy.border.r(0);
|
||||
copy.padding.r(copy.padding.r() - Math.min(crop.r(), copy.padding.r()));
|
||||
copy.area.setWidth(copy.area.width() - crop.r());
|
||||
if (crop.getRight() > 0) {
|
||||
copy.border.setRight(0);
|
||||
copy.padding.setRight(copy.padding.getRight() - Math.min(crop.getRight(), copy.padding.getRight()));
|
||||
copy.area.setWidth(copy.area.width() - crop.getRight());
|
||||
}
|
||||
if (crop.l() > 0) {
|
||||
copy.border.l(0);
|
||||
copy.padding.l(copy.padding.l() - Math.min(crop.l(), copy.padding.l()));
|
||||
copy.area.setWidth(copy.area.width() - crop.l());
|
||||
copy.area.setXPos(copy.area.xPos() + crop.l());
|
||||
if (crop.getLeft() > 0) {
|
||||
copy.border.setLeft(0);
|
||||
copy.padding.setLeft(copy.padding.getLeft() - Math.min(crop.getLeft(), copy.padding.getLeft()));
|
||||
copy.area.setWidth(copy.area.width() - crop.getLeft());
|
||||
copy.area.setXPos(copy.area.xPos() + crop.getLeft());
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package binnie.core.gui.resource.minecraft;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.geometry.Border;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
import binnie.core.resource.IBinnieTexture;
|
||||
|
||||
public class StandardTexture extends Texture {
|
||||
@@ -19,7 +19,7 @@ public class StandardTexture extends Texture {
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public BinnieResource getTexture() {
|
||||
return this.getFilename();
|
||||
public ResourceLocation getTexture() {
|
||||
return this.getResourceLocation();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
package binnie.core.gui.window;
|
||||
|
||||
import binnie.core.api.gui.IArea;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import binnie.core.gui.CraftGUI;
|
||||
import binnie.core.gui.IWidget;
|
||||
import binnie.core.gui.controls.core.Control;
|
||||
import binnie.core.gui.geometry.Area;
|
||||
import binnie.core.gui.minecraft.MinecraftGUI;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
|
||||
@@ -18,7 +18,7 @@ public class Panel extends Control {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Panel(final IWidget parent, final Area area, final IPanelType type) {
|
||||
public Panel(final IWidget parent, final IArea area, final IPanelType type) {
|
||||
this(parent, area.xPos(), area.yPos(), area.width(), area.height(), type);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.window.WindowMachine;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
@@ -41,8 +44,7 @@ import binnie.core.gui.events.EventTextEdit;
|
||||
import binnie.core.gui.events.EventValueChanged;
|
||||
import binnie.core.gui.geometry.Border;
|
||||
import binnie.core.gui.geometry.CraftGUIUtil;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.geometry.Position;
|
||||
import binnie.core.api.gui.Alignment;
|
||||
import binnie.core.gui.minecraft.Dialog;
|
||||
import binnie.core.gui.minecraft.EnumColor;
|
||||
import binnie.core.gui.minecraft.IWindowAffectsShiftClick;
|
||||
@@ -55,10 +57,8 @@ import binnie.core.gui.minecraft.control.ControlSlot;
|
||||
import binnie.core.gui.minecraft.control.ControlSlotArray;
|
||||
import binnie.core.gui.minecraft.control.ControlTabIcon;
|
||||
import binnie.core.gui.renderer.RenderUtil;
|
||||
import binnie.core.gui.resource.Texture;
|
||||
import binnie.core.gui.resource.minecraft.CraftGUITexture;
|
||||
import binnie.core.gui.window.Panel;
|
||||
import binnie.core.gui.window.WindowMachine;
|
||||
import binnie.core.machines.Machine;
|
||||
import binnie.core.machines.transfer.TransferRequest;
|
||||
|
||||
@@ -103,7 +103,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
final int compartmentWidth = compartmentPageWidth + (doubleTabbed ? 48 : 24);
|
||||
final int compartmentHeight = compartmentPageHeight;
|
||||
final Control controlCompartment = new Control(this, x, y, compartmentWidth, compartmentHeight);
|
||||
final ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0, 0, 24, compartmentPageHeight, Position.LEFT, Arrays.asList(tabs1)) {
|
||||
final ControlTabBar<Integer> tab = new ControlTabBar<Integer>(controlCompartment, 0, 0, 24, compartmentPageHeight, Alignment.LEFT, Arrays.asList(tabs1)) {
|
||||
@Override
|
||||
public ControlTab<Integer> createTab(final int x, final int y, final int w, final int h, final Integer value) {
|
||||
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
|
||||
@@ -155,7 +155,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderForeground(int guiWidth, int guiHeight) {
|
||||
final Texture iTexture = CraftGUI.RENDER.getTexture(CraftGUITexture.TAB_OUTLINE);
|
||||
final ITexture iTexture = CraftGUI.RENDER.getTexture(CraftGUITexture.TAB_OUTLINE);
|
||||
RenderUtil.setColour(WindowCompartment.this.getTab(WindowCompartment.this.panels.get(this)).getColor().getColor());
|
||||
CraftGUI.RENDER.texture(iTexture, this.getArea().inset(3));
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
}
|
||||
x += compartmentPageWidth;
|
||||
if (tabs2.length > 0) {
|
||||
final ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0, 24, compartmentPageHeight, Position.RIGHT, Arrays.asList(tabs2)) {
|
||||
final ControlTabBar<Integer> tab2 = new ControlTabBar<Integer>(controlCompartment, 24 + compartmentPageWidth, 0, 24, compartmentPageHeight, Alignment.RIGHT, Arrays.asList(tabs2)) {
|
||||
@Override
|
||||
public ControlTab<Integer> createTab(final int x, final int y, final int w, final int h, final Integer value) {
|
||||
return new ControlTabIcon<Integer>(this, x, y, w, h, value) {
|
||||
@@ -213,7 +213,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
this.setSize(new Point(Math.max(32 + compartmentWidth, 252), this.getHeight()));
|
||||
controlCompartment.setPosition(new Point((this.getWidth() - controlCompartment.getWidth()) / 2, controlCompartment.getYPos()));
|
||||
final ControlPlayerInventory invent = new ControlPlayerInventory(this, true);
|
||||
final ControlSlide slide = new ControlSlide(this, 0, 134, 136, 92, Position.LEFT);
|
||||
final ControlSlide slide = new ControlSlide(this, 0, 134, 136, 92, Alignment.LEFT);
|
||||
slide.setLabel("Tab Properties");
|
||||
slide.setSlide(false);
|
||||
slide.addHelp("Tab Properties");
|
||||
@@ -278,7 +278,7 @@ public class WindowCompartment extends WindowMachine implements IWindowAffectsSh
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onRenderBackground(int guiWidth, int guiHeight) {
|
||||
final Object texture = this.isMouseOver() ? CraftGUITexture.TAB_HIGHLIGHTED : CraftGUITexture.TAB;
|
||||
CraftGUI.RENDER.texture(CraftGUI.RENDER.getTexture(texture).crop(Position.BOTTOM, 8), this.getArea());
|
||||
CraftGUI.RENDER.texture(CraftGUI.RENDER.getTexture(texture).crop(Alignment.BOTTOM, 8), this.getArea());
|
||||
}
|
||||
};
|
||||
searchButton.addHelp("Search Button");
|
||||
|
||||
@@ -20,7 +20,6 @@ import binnie.core.AbstractMod;
|
||||
import binnie.core.network.BinnieCorePacketID;
|
||||
import binnie.core.network.INetworkedEntity;
|
||||
import binnie.core.network.packet.MessageUpdate;
|
||||
import binnie.core.resource.BinnieResource;
|
||||
|
||||
public abstract class BinnieProxy extends BinnieModProxy implements IBinnieProxy {
|
||||
private short uniqueTextureUID;
|
||||
@@ -29,7 +28,7 @@ public abstract class BinnieProxy extends BinnieModProxy implements IBinnieProxy
|
||||
this.uniqueTextureUID = 1200;
|
||||
}
|
||||
|
||||
public boolean checkTexture(final BinnieResource location) {
|
||||
public boolean checkTexture(final ResourceLocation location) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ public final class BinnieProxyClient extends BinnieProxy implements IBinnieProxy
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkTexture(final BinnieResource location) {
|
||||
final SimpleTexture texture = new SimpleTexture(location.getResourceLocation());
|
||||
public boolean checkTexture(final ResourceLocation location) {
|
||||
final SimpleTexture texture = new SimpleTexture(location);
|
||||
try {
|
||||
texture.loadTexture(this.getMinecraftInstance().getResourceManager());
|
||||
} catch (IOException e) {
|
||||
|
||||
@@ -20,6 +20,10 @@ public class BinnieResource {
|
||||
}
|
||||
|
||||
public ResourceLocation getResourceLocation() {
|
||||
return this.path.endsWith(".png") ? new ResourceLocation(this.mod, "textures/" + this.type.toString() + "/" + this.path) : new ResourceLocation(this.mod, this.type.toString() + "/" + this.path);
|
||||
if (this.path.endsWith(".png")) {
|
||||
return new ResourceLocation(this.mod, "textures/" + this.type.toString() + "/" + this.path);
|
||||
} else {
|
||||
return new ResourceLocation(this.mod, this.type.toString() + "/" + this.path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
archivesBaseName = 'extrabees-api-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":core-api")
|
||||
}
|
||||
File renamed without changes.
@@ -1,6 +1,7 @@
|
||||
archivesBaseName = 'extrabees-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":api")
|
||||
compile project(":core")
|
||||
compile project(":core-api")
|
||||
compile project(":extrabees-api")
|
||||
}
|
||||
@@ -1,12 +1,20 @@
|
||||
package binnie.extrabees.genetics;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import binnie.core.api.genetics.IFieldKitPlugin;
|
||||
import binnie.core.api.gui.IPoint;
|
||||
import binnie.core.api.gui.ITexture;
|
||||
import binnie.core.genetics.BreedingSystem;
|
||||
import binnie.core.genetics.ForestryAllele;
|
||||
import binnie.core.genetics.Tolerance;
|
||||
import binnie.core.genetics.VirtualBeeHousing;
|
||||
import binnie.core.gui.geometry.Point;
|
||||
import binnie.core.gui.resource.minecraft.StandardTexture;
|
||||
import binnie.core.texture.BinnieCoreTexture;
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -147,4 +155,33 @@ public class BeeBreedingSystem extends BreedingSystem {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFieldKitPlugin getFieldKitPlugin() {
|
||||
return new IFieldKitPlugin() {
|
||||
@Override
|
||||
public Map<IChromosomeType, IPoint> getChromosomePickerPositions() {
|
||||
Map<IChromosomeType, IPoint> positions = new HashMap<>();
|
||||
positions.put(EnumBeeChromosome.SPECIES, new Point(28, 47));
|
||||
positions.put(EnumBeeChromosome.SPEED, new Point(28, 72));
|
||||
positions.put(EnumBeeChromosome.LIFESPAN, new Point(19, 20));
|
||||
positions.put(EnumBeeChromosome.FERTILITY, new Point(55, 65));
|
||||
positions.put(EnumBeeChromosome.TEMPERATURE_TOLERANCE, new Point(28, 1));
|
||||
positions.put(EnumBeeChromosome.NEVER_SLEEPS, new Point(61, 37));
|
||||
positions.put(EnumBeeChromosome.HUMIDITY_TOLERANCE, new Point(81, 76));
|
||||
positions.put(EnumBeeChromosome.TOLERATES_RAIN, new Point(44, 21));
|
||||
positions.put(EnumBeeChromosome.CAVE_DWELLING, new Point(3, 37));
|
||||
positions.put(EnumBeeChromosome.FLOWER_PROVIDER, new Point(4, 65));
|
||||
positions.put(EnumBeeChromosome.FLOWERING, new Point(83, 27));
|
||||
positions.put(EnumBeeChromosome.TERRITORY, new Point(71, 10));
|
||||
positions.put(EnumBeeChromosome.EFFECT, new Point(84, 54));
|
||||
return positions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITexture getTypeTexture() {
|
||||
return new StandardTexture(0, 0, 96, 96, BinnieCoreTexture.GUI_BREEDING);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
archivesBaseName = 'extratrees-api-' + mcversion
|
||||
|
||||
dependencies {
|
||||
compile project(":core-api")
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loaded 100 of 167 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user