mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 15:23:16 +00:00
API and other consistency fixes
This commit is contained in:
1 parent
8af7ec270a
commit
3126f144d2
32 files changed
+100
-170
No files matched your search
@@ -12,6 +12,7 @@ import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,12 @@ public class BlockIndex implements Comparable<BlockIndex> {
|
||||
/**
|
||||
* Creates an index for a block located on x, y. z
|
||||
*/
|
||||
public BlockIndex(BlockPos pos) {
|
||||
this.x = pos.getX();
|
||||
this.y = pos.getY();
|
||||
this.z = pos.getZ();
|
||||
}
|
||||
|
||||
public BlockIndex(int x, int y, int z) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -48,7 +55,7 @@ public class BlockIndex implements Comparable<BlockIndex> {
|
||||
}
|
||||
|
||||
public BlockIndex(TileEntity entity) {
|
||||
this(entity.xCoord, entity.yCoord, entity.zCoord);
|
||||
this(entity.getPos());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +87,7 @@ public class BlockIndex implements Comparable<BlockIndex> {
|
||||
}
|
||||
|
||||
public Block getBlock(World world) {
|
||||
return world.getBlock(x, y, z);
|
||||
return world.getBlockState(new BlockPos(x, y, z)).getBlock();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,10 +11,7 @@ package buildcraft.api.core;
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public enum EnumColor {
|
||||
|
||||
@@ -105,8 +102,6 @@ public enum EnumColor {
|
||||
0xEA7835,
|
||||
0xe4e4e4};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private static IIcon[] brushIcons;
|
||||
|
||||
public int getDarkHex() {
|
||||
return DARK_HEX[ordinal()];
|
||||
@@ -189,13 +184,4 @@ public enum EnumColor {
|
||||
}
|
||||
return b.toString().trim();
|
||||
}
|
||||
|
||||
public static void setIconArray(IIcon[] icons) {
|
||||
brushIcons = icons;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return brushIcons [ordinal()];
|
||||
}
|
||||
}
|
||||
@@ -8,24 +8,10 @@
|
||||
*/
|
||||
package buildcraft.api.core;
|
||||
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public interface IIconProvider {
|
||||
|
||||
/**
|
||||
* @param iconIndex
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
IIcon getIcon(int iconIndex);
|
||||
|
||||
/**
|
||||
* A call for the provider to register its Icons. This may be called multiple times but should only be executed once per provider
|
||||
* @param iconRegister
|
||||
*/
|
||||
@SideOnly(Side.CLIENT)
|
||||
void registerIcons(IIconRegister iconRegister);
|
||||
|
||||
}
|
||||
@@ -16,30 +16,30 @@ import net.minecraft.util.EnumFacing;
|
||||
|
||||
public class Position implements ISerializable {
|
||||
public double x, y, z;
|
||||
public ForgeDirection orientation;
|
||||
public EnumFacing orientation;
|
||||
|
||||
public Position() {
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
orientation = null;
|
||||
}
|
||||
|
||||
public Position(double ci, double cj, double ck) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
orientation = null;
|
||||
}
|
||||
|
||||
public Position(double ci, double cj, double ck, ForgeDirection corientation) {
|
||||
public Position(double ci, double cj, double ck, EnumFacing corientation) {
|
||||
x = ci;
|
||||
y = cj;
|
||||
z = ck;
|
||||
orientation = corientation;
|
||||
|
||||
if (orientation == null) {
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
orientation = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,17 +55,17 @@ public class Position implements ISerializable {
|
||||
}
|
||||
|
||||
public Position(TileEntity tile) {
|
||||
x = tile.xCoord;
|
||||
y = tile.yCoord;
|
||||
z = tile.zCoord;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
x = tile.getPos().getX();
|
||||
y = tile.getPos().getY();
|
||||
z = tile.getPos().getZ();
|
||||
orientation = null;
|
||||
}
|
||||
|
||||
public Position(BlockIndex index) {
|
||||
x = index.x;
|
||||
y = index.y;
|
||||
z = index.z;
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
orientation = null;
|
||||
}
|
||||
|
||||
public void moveRight(double step) {
|
||||
@@ -137,7 +137,7 @@ public class Position implements ISerializable {
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound) {
|
||||
if (orientation == null) {
|
||||
orientation = ForgeDirection.UNKNOWN;
|
||||
orientation = null;
|
||||
}
|
||||
|
||||
nbttagcompound.setDouble("i", x);
|
||||
@@ -150,7 +150,7 @@ public class Position implements ISerializable {
|
||||
x = nbttagcompound.getDouble("i");
|
||||
y = nbttagcompound.getDouble("j");
|
||||
z = nbttagcompound.getDouble("k");
|
||||
orientation = ForgeDirection.values() [nbttagcompound.getByte("orientation")];
|
||||
orientation = EnumFacing.VALUES [nbttagcompound.getByte("orientation")];
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -181,7 +181,7 @@ public class Position implements ISerializable {
|
||||
x = stream.readDouble();
|
||||
y = stream.readDouble();
|
||||
z = stream.readDouble();
|
||||
orientation = ForgeDirection.getOrientation(stream.readByte());
|
||||
orientation = EnumFacing.getFront(stream.readByte());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,7 +21,7 @@ public interface ICullable {
|
||||
//They are used to effectively cull obstructed sides while processing facades.
|
||||
//Make sure your implementation is correct otherwise expect FPS drop
|
||||
|
||||
void setRenderSide(ForgeDirection side, boolean render);
|
||||
void setRenderSide(EnumFacing side, boolean render);
|
||||
|
||||
void setRenderAllSides();
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
package buildcraft.api.core.render;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface ITextureStateManager {
|
||||
void set(IIcon icon);
|
||||
}
|
||||
@@ -9,14 +9,9 @@
|
||||
package buildcraft.api.core.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public interface ITextureStates extends ICullable {
|
||||
|
||||
ITextureStateManager getTextureState();
|
||||
|
||||
IIcon getIcon(int side, int meta);
|
||||
|
||||
Block getBlock();
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user