mirror of
https://github.com/GTNewHorizons/Binnie.git
synced 2026-11-19 19:59:49 +00:00
Improve code readability in binnie.extratrees package
This commit is contained in:
1 parent
adccdd181a
commit
96e4814ae3
225 files changed
+8968
-9306
No files matched your search
@@ -1,455 +1,442 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.30
|
||||
//
|
||||
|
||||
package binnie.extratrees.carpentry;
|
||||
|
||||
import binnie.extratrees.api.IDesign;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IToolHammer;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import binnie.extratrees.api.ILayout;
|
||||
import binnie.extratrees.api.IDesignSystem;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import binnie.extratrees.api.IDesignMaterial;
|
||||
import binnie.extratrees.api.IDesign;
|
||||
|
||||
public class DesignBlock
|
||||
{
|
||||
IDesign design;
|
||||
IDesignMaterial primaryMaterial;
|
||||
IDesignMaterial secondaryMaterial;
|
||||
int rotation;
|
||||
ForgeDirection facing;
|
||||
boolean panel;
|
||||
public class DesignBlock {
|
||||
protected IDesign design;
|
||||
protected IDesignMaterial primaryMaterial;
|
||||
protected IDesignMaterial secondaryMaterial;
|
||||
protected int rotation;
|
||||
protected ForgeDirection facing;
|
||||
protected boolean panel;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " { design:" + this.design + " }, { primary:" + this.primaryMaterial + " }, { secondary:" + this.secondaryMaterial + " }, { rotation:" + this.rotation + " }, { facing:" + this.facing + " }";
|
||||
}
|
||||
|
||||
public IDesign getDesign() {
|
||||
return this.design;
|
||||
}
|
||||
|
||||
public IDesignMaterial getPrimaryMaterial() {
|
||||
return this.primaryMaterial;
|
||||
}
|
||||
|
||||
public IDesignMaterial getSecondaryMaterial() {
|
||||
return this.secondaryMaterial;
|
||||
}
|
||||
|
||||
DesignBlock(final IDesignSystem system, final IDesignMaterial primaryWood, final IDesignMaterial secondaryWood, final IDesign design, final int rotation, final ForgeDirection dir) {
|
||||
DesignBlock(IDesignSystem system, IDesignMaterial primaryWood, IDesignMaterial secondaryWood, IDesign design, int rotation, ForgeDirection dir) {
|
||||
this.rotation = 0;
|
||||
this.facing = ForgeDirection.UP;
|
||||
this.panel = false;
|
||||
this.design = design;
|
||||
this.primaryMaterial = primaryWood;
|
||||
this.secondaryMaterial = secondaryWood;
|
||||
this.rotation = rotation;
|
||||
this.facing = dir;
|
||||
facing = ForgeDirection.UP;
|
||||
panel = false;
|
||||
primaryMaterial = primaryWood;
|
||||
secondaryMaterial = secondaryWood;
|
||||
facing = dir;
|
||||
|
||||
if (design == null) {
|
||||
this.design = EnumDesign.Blank;
|
||||
}
|
||||
if (primaryWood == null) {
|
||||
this.primaryMaterial = system.getDefaultMaterial();
|
||||
primaryMaterial = system.getDefaultMaterial();
|
||||
}
|
||||
if (secondaryWood == null) {
|
||||
this.secondaryMaterial = system.getDefaultMaterial();
|
||||
secondaryMaterial = system.getDefaultMaterial();
|
||||
}
|
||||
if (this.rotation > 3 || this.rotation < 0) {
|
||||
if (rotation > 3 || rotation < 0) {
|
||||
this.rotation = 0;
|
||||
}
|
||||
if (this.facing == null || this.facing == ForgeDirection.UNKNOWN) {
|
||||
this.facing = ForgeDirection.UP;
|
||||
if (facing == null || facing == ForgeDirection.UNKNOWN) {
|
||||
facing = ForgeDirection.UP;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + " { design:" + design + " }, { primary:" + primaryMaterial + " }, { secondary:" + secondaryMaterial + " }, { rotation:" + rotation + " }, { facing:" + facing + " }";
|
||||
}
|
||||
|
||||
public IDesign getDesign() {
|
||||
return design;
|
||||
}
|
||||
|
||||
public IDesignMaterial getPrimaryMaterial() {
|
||||
return primaryMaterial;
|
||||
}
|
||||
|
||||
public IDesignMaterial getSecondaryMaterial() {
|
||||
return secondaryMaterial;
|
||||
}
|
||||
|
||||
public int getPrimaryColour() {
|
||||
return this.getPrimaryMaterial().getColour();
|
||||
return getPrimaryMaterial().getColour();
|
||||
}
|
||||
|
||||
public int getSecondaryColour() {
|
||||
return this.getSecondaryMaterial().getColour();
|
||||
return getSecondaryMaterial().getColour();
|
||||
}
|
||||
|
||||
ForgeDirection getRotation(final ForgeDirection dir, final ModuleCarpentry.Axis axis) {
|
||||
// TODO unused method?
|
||||
ForgeDirection getRotation(ForgeDirection dir, ModuleCarpentry.Axis axis) {
|
||||
if (axis == ModuleCarpentry.Axis.Y) {
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
return ForgeDirection.NORTH;
|
||||
case EAST:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case SOUTH:
|
||||
return ForgeDirection.EAST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
case NORTH: {
|
||||
return ForgeDirection.WEST;
|
||||
}
|
||||
case SOUTH: {
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
case WEST: {
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
default: {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (axis == ModuleCarpentry.Axis.X) {
|
||||
return dir;
|
||||
} else if (axis == ModuleCarpentry.Axis.X) {
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
return ForgeDirection.UP;
|
||||
case EAST:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.WEST;
|
||||
|
||||
case WEST:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
case UP: {
|
||||
return ForgeDirection.WEST;
|
||||
}
|
||||
case WEST: {
|
||||
return ForgeDirection.DOWN;
|
||||
}
|
||||
case DOWN: {
|
||||
return ForgeDirection.EAST;
|
||||
}
|
||||
default: {
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return dir;
|
||||
} else {
|
||||
switch (dir) {
|
||||
case SOUTH: {
|
||||
return ForgeDirection.UP;
|
||||
}
|
||||
case UP: {
|
||||
return ForgeDirection.NORTH;
|
||||
}
|
||||
case NORTH: {
|
||||
return ForgeDirection.DOWN;
|
||||
}
|
||||
case DOWN: {
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
default: {
|
||||
return dir;
|
||||
}
|
||||
case SOUTH:
|
||||
return ForgeDirection.UP;
|
||||
|
||||
case UP:
|
||||
return ForgeDirection.NORTH;
|
||||
|
||||
case NORTH:
|
||||
return ForgeDirection.DOWN;
|
||||
|
||||
case DOWN:
|
||||
return ForgeDirection.SOUTH;
|
||||
}
|
||||
return dir;
|
||||
}
|
||||
}
|
||||
|
||||
public ILayout getLayout(ForgeDirection dir) {
|
||||
ForgeDirection adjustedDir;
|
||||
dir = (adjustedDir = dir.getRotation(ForgeDirection.DOWN));
|
||||
switch (this.getFacing()) {
|
||||
case DOWN: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
switch (getFacing()) {
|
||||
case DOWN:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
|
||||
case EAST:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.NORTH);
|
||||
break;
|
||||
|
||||
case NORTH:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
|
||||
case SOUTH:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.NORTH);
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
}
|
||||
case SOUTH: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.EAST);
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.SOUTH);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < this.rotation; ++i) {
|
||||
|
||||
for (int i = 0; i < rotation; ++i) {
|
||||
adjustedDir = adjustedDir.getRotation(ForgeDirection.DOWN);
|
||||
}
|
||||
ILayout layout = null;
|
||||
|
||||
ILayout layout;
|
||||
switch (adjustedDir) {
|
||||
case EAST: {
|
||||
layout = this.getDesign().getEastPattern();
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = this.getDesign().getNorthPattern();
|
||||
break;
|
||||
}
|
||||
case SOUTH: {
|
||||
layout = this.getDesign().getSouthPattern();
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
layout = this.getDesign().getWestPattern();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = this.getDesign().getBottomPattern();
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
layout = this.getDesign().getTopPattern();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Label_1107: {
|
||||
switch (this.getFacing()) {
|
||||
case UP: {
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
layout = getDesign().getEastPattern();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
switch (dir) {
|
||||
case UP:
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
case WEST: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case NORTH:
|
||||
layout = getDesign().getNorthPattern();
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
switch (dir) {
|
||||
case SOUTH:
|
||||
|
||||
case SOUTH:
|
||||
layout = getDesign().getSouthPattern();
|
||||
break;
|
||||
|
||||
case WEST:
|
||||
layout = getDesign().getWestPattern();
|
||||
break;
|
||||
|
||||
case DOWN:
|
||||
layout = getDesign().getBottomPattern();
|
||||
break;
|
||||
|
||||
default:
|
||||
layout = getDesign().getTopPattern();
|
||||
}
|
||||
|
||||
// TODO remove label
|
||||
Label_1107:
|
||||
{
|
||||
switch (getFacing()) {
|
||||
case UP: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipHorizontal();
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.flipHorizontal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.EAST) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.WEST) {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
switch (dir) {
|
||||
case NORTH: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
case UP: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipVertical();
|
||||
switch (dir) {
|
||||
case UP:
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break;
|
||||
}
|
||||
case EAST:
|
||||
case NORTH:
|
||||
case SOUTH:
|
||||
case WEST: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.DOWN || dir == ForgeDirection.UP) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
switch (dir) {
|
||||
case SOUTH:
|
||||
case UP: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipHorizontal();
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.flipHorizontal();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.EAST) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
}
|
||||
if (dir == ForgeDirection.WEST) {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
switch (dir) {
|
||||
case NORTH: {
|
||||
layout = layout.rotateRight();
|
||||
break;
|
||||
}
|
||||
case SOUTH:
|
||||
case UP: {
|
||||
layout = layout.rotateLeft();
|
||||
break;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.rotateLeft().flipVertical();
|
||||
break;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WEST: {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NORTH: {
|
||||
switch (dir) {
|
||||
case WEST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipHorizontal();
|
||||
break Label_1107;
|
||||
case NORTH: {
|
||||
switch (dir) {
|
||||
case WEST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case EAST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipHorizontal();
|
||||
break Label_1107;
|
||||
}
|
||||
case SOUTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
case SOUTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case UP: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case SOUTH: {
|
||||
for (int j = 0; j < rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
case SOUTH: {
|
||||
switch (dir) {
|
||||
case EAST: {
|
||||
layout = layout.rotateLeft();
|
||||
break Label_1107;
|
||||
}
|
||||
case WEST: {
|
||||
layout = layout.rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case UP: {
|
||||
layout = layout.rotateRight().rotateRight();
|
||||
break Label_1107;
|
||||
}
|
||||
case DOWN: {
|
||||
layout = layout.flipVertical();
|
||||
break Label_1107;
|
||||
}
|
||||
case NORTH: {
|
||||
layout = layout.flipHorizontal();
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateLeft();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
case SOUTH: {
|
||||
for (int j = 0; j < this.rotation; ++j) {
|
||||
layout = layout.rotateRight();
|
||||
}
|
||||
break Label_1107;
|
||||
}
|
||||
default: {
|
||||
break Label_1107;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return layout;
|
||||
}
|
||||
|
||||
public IIcon getPrimaryIcon(final IDesignSystem system, final ForgeDirection dir) {
|
||||
final ILayout l = this.getLayout(dir);
|
||||
return (l == null) ? null : l.getPrimaryIcon(system);
|
||||
public IIcon getPrimaryIcon(IDesignSystem system, ForgeDirection dir) {
|
||||
ILayout layout = getLayout(dir);
|
||||
return (layout == null) ? null : layout.getPrimaryIcon(system);
|
||||
}
|
||||
|
||||
public IIcon getSecondaryIcon(final IDesignSystem system, final ForgeDirection dir) {
|
||||
final ILayout l = this.getLayout(dir);
|
||||
return (l == null) ? null : l.getSecondaryIcon(system);
|
||||
public IIcon getSecondaryIcon(IDesignSystem system, ForgeDirection dir) {
|
||||
ILayout layout = getLayout(dir);
|
||||
return (layout == null) ? null : layout.getSecondaryIcon(system);
|
||||
}
|
||||
|
||||
public IIcon getIcon(final IDesignSystem system, final boolean secondary, final ForgeDirection dir) {
|
||||
return secondary ? this.getSecondaryIcon(system, dir) : this.getPrimaryIcon(system, dir);
|
||||
public IIcon getIcon(IDesignSystem system, boolean secondary, ForgeDirection dir) {
|
||||
return secondary ? getSecondaryIcon(system, dir) : getPrimaryIcon(system, dir);
|
||||
}
|
||||
|
||||
public ForgeDirection getFacing() {
|
||||
return this.facing;
|
||||
return facing;
|
||||
}
|
||||
|
||||
public void setFacing(ForgeDirection facing) {
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public int getRotation() {
|
||||
return this.rotation;
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public void rotate(final int face, final ItemStack hammer, final EntityPlayer player, final World world, final int x, final int y, final int z) {
|
||||
final ForgeDirection dir = ForgeDirection.getOrientation(face);
|
||||
final IToolHammer hammerI = (IToolHammer) hammer.getItem();
|
||||
public void rotate(int face, ItemStack hammer, EntityPlayer player, World world, int x, int y, int z) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(face);
|
||||
IToolHammer hammerI = (IToolHammer) hammer.getItem();
|
||||
if (player.isSneaking()) {
|
||||
if (this.panel) {
|
||||
ForgeDirection newFacing = this.getFacing();
|
||||
if (panel) {
|
||||
ForgeDirection newFacing = getFacing();
|
||||
do {
|
||||
newFacing = ForgeDirection.getOrientation(newFacing.ordinal() + 1);
|
||||
if (newFacing == ForgeDirection.UNKNOWN) {
|
||||
newFacing = ForgeDirection.DOWN;
|
||||
}
|
||||
} while (newFacing != this.getFacing() && !BlockCarpentryPanel.isValidPanelPlacement(world, x, y, z, newFacing));
|
||||
if (newFacing != this.getFacing()) {
|
||||
} while (newFacing != getFacing() && !BlockCarpentryPanel.isValidPanelPlacement(world, x, y, z, newFacing));
|
||||
|
||||
if (newFacing != getFacing()) {
|
||||
hammerI.onHammerUsed(hammer, player);
|
||||
}
|
||||
this.setFacing(newFacing);
|
||||
}
|
||||
else {
|
||||
if (dir != this.getFacing()) {
|
||||
setFacing(newFacing);
|
||||
} else {
|
||||
if (dir != getFacing()) {
|
||||
hammerI.onHammerUsed(hammer, player);
|
||||
}
|
||||
this.setFacing(dir);
|
||||
setFacing(dir);
|
||||
}
|
||||
}
|
||||
else {
|
||||
++this.rotation;
|
||||
} else {
|
||||
rotation++;
|
||||
hammerI.onHammerUsed(hammer, player);
|
||||
}
|
||||
if (this.rotation > 3) {
|
||||
this.rotation = 0;
|
||||
|
||||
if (rotation > 3) {
|
||||
rotation = 0;
|
||||
}
|
||||
if (this.rotation < 0) {
|
||||
this.rotation = 3;
|
||||
if (rotation < 0) {
|
||||
rotation = 3;
|
||||
}
|
||||
}
|
||||
|
||||
public void setFacing(final ForgeDirection facing) {
|
||||
this.facing = facing;
|
||||
}
|
||||
|
||||
public int getBlockMetadata(final IDesignSystem system) {
|
||||
public int getBlockMetadata(IDesignSystem system) {
|
||||
return ModuleCarpentry.getBlockMetadata(system, this);
|
||||
}
|
||||
|
||||
public int getItemMetadata(final IDesignSystem system) {
|
||||
public int getItemMetadata(IDesignSystem system) {
|
||||
return ModuleCarpentry.getItemMetadata(system, this);
|
||||
}
|
||||
|
||||
public void setPanel() {
|
||||
this.panel = true;
|
||||
panel = true;
|
||||
}
|
||||
|
||||
public String getString() {
|
||||
String type = "";
|
||||
if (this.getPrimaryMaterial() != this.getSecondaryMaterial()) {
|
||||
type = this.getPrimaryMaterial().getName() + " and " + this.getSecondaryMaterial().getName();
|
||||
String type;
|
||||
if (getPrimaryMaterial() != getSecondaryMaterial()) {
|
||||
type = getPrimaryMaterial().getName() + " and " + getSecondaryMaterial().getName();
|
||||
} else {
|
||||
type = getPrimaryMaterial().getName();
|
||||
}
|
||||
else {
|
||||
type = this.getPrimaryMaterial().getName();
|
||||
}
|
||||
return super.toString() + " " + "{" + type + " " + this.getDesign().getName() + " " + (this.panel ? "Panel" : "Tile") + ", Facing:" + this.getFacing().toString() + ", Rotation:" + this.getRotation() + "}";
|
||||
return super.toString() + " " + "{" + type + " " + getDesign().getName() + " " + (panel ? "Panel" : "Tile") + ", Facing:" + getFacing().toString() + ", Rotation:" + getRotation() + "}";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user