Fixed server crashes.
This commit is contained in:
@@ -15,7 +15,7 @@ import com.raoulvdberge.refinedstorage.render.collision.constants.ConstantsCable
|
||||
import com.raoulvdberge.refinedstorage.tile.TileBase;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileCable;
|
||||
import com.raoulvdberge.refinedstorage.tile.TileNode;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyBool;
|
||||
@@ -165,7 +165,7 @@ public class BlockCable extends BlockNode {
|
||||
for (CollisionGroup group : getCollisions(world.getTileEntity(pos), state)) {
|
||||
if (group.canAccessGui()) {
|
||||
for (AxisAlignedBB aabb : group.getItems()) {
|
||||
if (RenderUtils.isInBounds(aabb, hitX, hitY, hitZ)) {
|
||||
if (CollisionUtils.isInBounds(aabb, hitX, hitY, hitZ)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ public class BlockCable extends BlockNode {
|
||||
Cover coverDown = coverManager.getCover(EnumFacing.DOWN);
|
||||
|
||||
if (coverNorth != null) {
|
||||
groups.add(new CollisionGroup().addItem(RenderUtils.getBounds(
|
||||
groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds(
|
||||
coverWest != null ? 2 : 0, coverDown != null ? 2 : 0, 0,
|
||||
coverEast != null ? 14 : 16, coverUp != null ? 14 : 16, 2
|
||||
)));
|
||||
@@ -232,7 +232,7 @@ public class BlockCable extends BlockNode {
|
||||
}
|
||||
|
||||
if (coverEast != null) {
|
||||
groups.add(new CollisionGroup().addItem(RenderUtils.getBounds(
|
||||
groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds(
|
||||
14, coverDown != null ? 2 : 0, 0,
|
||||
16, coverUp != null ? 14 : 16, 16
|
||||
)));
|
||||
@@ -243,7 +243,7 @@ public class BlockCable extends BlockNode {
|
||||
}
|
||||
|
||||
if (coverSouth != null) {
|
||||
groups.add(new CollisionGroup().addItem(RenderUtils.getBounds(
|
||||
groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds(
|
||||
coverEast != null ? 14 : 16, coverDown != null ? 2 : 0, 16,
|
||||
coverWest != null ? 2 : 0, coverUp != null ? 14 : 16, 14
|
||||
)));
|
||||
@@ -254,7 +254,7 @@ public class BlockCable extends BlockNode {
|
||||
}
|
||||
|
||||
if (coverWest != null) {
|
||||
groups.add(new CollisionGroup().addItem(RenderUtils.getBounds(
|
||||
groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds(
|
||||
0, coverDown != null ? 2 : 0, 0,
|
||||
2, coverUp != null ? 14 : 16, 16
|
||||
)));
|
||||
@@ -265,7 +265,7 @@ public class BlockCable extends BlockNode {
|
||||
}
|
||||
|
||||
if (coverUp != null) {
|
||||
groups.add(new CollisionGroup().addItem(RenderUtils.getBounds(
|
||||
groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds(
|
||||
0, 14, 0,
|
||||
16, 16, 16
|
||||
)));
|
||||
@@ -276,7 +276,7 @@ public class BlockCable extends BlockNode {
|
||||
}
|
||||
|
||||
if (coverDown != null) {
|
||||
groups.add(new CollisionGroup().addItem(RenderUtils.getBounds(
|
||||
groups.add(new CollisionGroup().addItem(CollisionUtils.getBounds(
|
||||
0, 0, 0,
|
||||
16, 2, 16
|
||||
)));
|
||||
@@ -292,7 +292,7 @@ public class BlockCable extends BlockNode {
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean p_185477_7_) {
|
||||
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn, boolean isActualState) {
|
||||
for (CollisionGroup group : getCollisions(world.getTileEntity(pos), this.getActualState(state, world, pos))) {
|
||||
for (AxisAlignedBB aabb : group.getItems()) {
|
||||
addCollisionBoxToList(pos, entityBox, collidingBoxes, aabb);
|
||||
|
||||
@@ -1,108 +1,69 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision.constants;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public final class ConstantsCable {
|
||||
public static final CollisionGroup CORE = new CollisionGroup().addItem(RenderUtils.getBounds(6, 6, 6, 10, 10, 10));
|
||||
public static final CollisionGroup NORTH = new CollisionGroup().addItem(RenderUtils.getBounds(6, 6, 0, 10, 10, 6));
|
||||
public static final CollisionGroup EAST = new CollisionGroup().addItem(RenderUtils.getBounds(10, 6, 6, 16, 10, 10));
|
||||
public static final CollisionGroup SOUTH = new CollisionGroup().addItem(RenderUtils.getBounds(6, 6, 10, 10, 10, 16));
|
||||
public static final CollisionGroup WEST = new CollisionGroup().addItem(RenderUtils.getBounds(0, 6, 6, 6, 10, 10));
|
||||
public static final CollisionGroup UP = new CollisionGroup().addItem(RenderUtils.getBounds(6, 10, 6, 10, 16, 10));
|
||||
public static final CollisionGroup DOWN = new CollisionGroup().addItem(RenderUtils.getBounds(6, 0, 6, 10, 6, 10));
|
||||
public static final CollisionGroup CORE = new CollisionGroup().addItem(getBounds(6, 6, 6, 10, 10, 10));
|
||||
public static final CollisionGroup NORTH = new CollisionGroup().addItem(getBounds(6, 6, 0, 10, 10, 6));
|
||||
public static final CollisionGroup EAST = new CollisionGroup().addItem(getBounds(10, 6, 6, 16, 10, 10));
|
||||
public static final CollisionGroup SOUTH = new CollisionGroup().addItem(getBounds(6, 6, 10, 10, 10, 16));
|
||||
public static final CollisionGroup WEST = new CollisionGroup().addItem(getBounds(0, 6, 6, 6, 10, 10));
|
||||
public static final CollisionGroup UP = new CollisionGroup().addItem(getBounds(6, 10, 6, 10, 16, 10));
|
||||
public static final CollisionGroup DOWN = new CollisionGroup().addItem(getBounds(6, 0, 6, 10, 6, 10));
|
||||
|
||||
public static final CollisionGroup HOLDER_NORTH = new CollisionGroup().addItem(getHolderBoundsAabb(EnumFacing.NORTH));
|
||||
public static final CollisionGroup HOLDER_EAST = new CollisionGroup().addItem(getHolderBoundsAabb(EnumFacing.EAST));
|
||||
public static final CollisionGroup HOLDER_SOUTH = new CollisionGroup().addItem(getHolderBoundsAabb(EnumFacing.SOUTH));
|
||||
public static final CollisionGroup HOLDER_WEST = new CollisionGroup().addItem(getHolderBoundsAabb(EnumFacing.WEST));
|
||||
public static final CollisionGroup HOLDER_UP = new CollisionGroup().addItem(getHolderBoundsAabb(EnumFacing.UP));
|
||||
public static final CollisionGroup HOLDER_DOWN = new CollisionGroup().addItem(getHolderBoundsAabb(EnumFacing.DOWN));
|
||||
public static final CollisionGroup HOLDER_NORTH = new CollisionGroup().addItem(getHolderBounds(EnumFacing.NORTH));
|
||||
public static final CollisionGroup HOLDER_EAST = new CollisionGroup().addItem(getHolderBounds(EnumFacing.EAST));
|
||||
public static final CollisionGroup HOLDER_SOUTH = new CollisionGroup().addItem(getHolderBounds(EnumFacing.SOUTH));
|
||||
public static final CollisionGroup HOLDER_WEST = new CollisionGroup().addItem(getHolderBounds(EnumFacing.WEST));
|
||||
public static final CollisionGroup HOLDER_UP = new CollisionGroup().addItem(getHolderBounds(EnumFacing.UP));
|
||||
public static final CollisionGroup HOLDER_DOWN = new CollisionGroup().addItem(getHolderBounds(EnumFacing.DOWN));
|
||||
|
||||
public static Pair<Vector3f, Vector3f> getCoverBounds(EnumFacing side) {
|
||||
|
||||
public static AxisAlignedBB getBounds(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {
|
||||
return new AxisAlignedBB((float) fromX / 16F, (float) fromY / 16F, (float) fromZ / 16F, (float) toX / 16F, (float) toY / 16F, (float) toZ / 16F);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static AxisAlignedBB getCoverBounds(EnumFacing side) {
|
||||
switch (side) {
|
||||
case DOWN:
|
||||
return Pair.of(
|
||||
new Vector3f(0, 0, 0),
|
||||
new Vector3f(16, 2, 16)
|
||||
);
|
||||
return getBounds(0, 0, 0, 16, 2, 16);
|
||||
case UP:
|
||||
return Pair.of(
|
||||
new Vector3f(0, 14, 0),
|
||||
new Vector3f(16, 16, 16)
|
||||
);
|
||||
return getBounds(0, 14, 0, 16, 16, 16);
|
||||
case NORTH:
|
||||
return Pair.of(
|
||||
new Vector3f(0, 0, 0),
|
||||
new Vector3f(16, 16, 2)
|
||||
);
|
||||
return getBounds(0, 0, 0, 16, 16, 2);
|
||||
case SOUTH:
|
||||
return Pair.of(
|
||||
new Vector3f(0, 0, 14),
|
||||
new Vector3f(16, 16, 16)
|
||||
);
|
||||
return getBounds(0, 0, 14, 16, 16, 16);
|
||||
case WEST:
|
||||
return Pair.of(
|
||||
new Vector3f(0, 0, 0),
|
||||
new Vector3f(2, 16, 16)
|
||||
);
|
||||
return getBounds(0, 0, 0, 2, 16, 16);
|
||||
case EAST:
|
||||
return Pair.of(
|
||||
new Vector3f(14, 0, 0),
|
||||
new Vector3f(16, 16, 16)
|
||||
);
|
||||
return getBounds(14, 0, 0, 16, 16, 16);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static Pair<Vector3f, Vector3f> getHolderBounds(EnumFacing side) {
|
||||
@Nonnull
|
||||
public static AxisAlignedBB getHolderBounds(EnumFacing side) {
|
||||
switch (side) {
|
||||
case DOWN:
|
||||
return Pair.of(
|
||||
new Vector3f(7, 2, 7),
|
||||
new Vector3f(9, 6, 9)
|
||||
);
|
||||
return getBounds(7, 2, 7, 9, 6, 9);
|
||||
case UP:
|
||||
return Pair.of(
|
||||
new Vector3f(7, 10, 7),
|
||||
new Vector3f(9, 14, 9)
|
||||
);
|
||||
return getBounds(7, 10, 7, 9, 14, 9);
|
||||
case NORTH:
|
||||
return Pair.of(
|
||||
new Vector3f(7, 7, 2),
|
||||
new Vector3f(9, 9, 6)
|
||||
);
|
||||
return getBounds(7, 7, 2, 9, 9, 6);
|
||||
case SOUTH:
|
||||
return Pair.of(
|
||||
new Vector3f(7, 7, 10),
|
||||
new Vector3f(9, 9, 14)
|
||||
);
|
||||
return getBounds(7, 7, 10, 9, 9, 14);
|
||||
case WEST:
|
||||
return Pair.of(
|
||||
new Vector3f(2, 7, 7),
|
||||
new Vector3f(6, 9, 9)
|
||||
);
|
||||
return getBounds(2, 7, 7, 6, 9, 9);
|
||||
case EAST:
|
||||
return Pair.of(
|
||||
new Vector3f(10, 7, 7),
|
||||
new Vector3f(14, 9, 9)
|
||||
);
|
||||
return getBounds(10, 7, 7, 14, 9, 9);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static AxisAlignedBB getHolderBoundsAabb(EnumFacing side) {
|
||||
Pair<Vector3f, Vector3f> bounds = getHolderBounds(side);
|
||||
|
||||
return RenderUtils.getBounds(
|
||||
(int) bounds.getLeft().getX(), (int) bounds.getLeft().getY(), (int) bounds.getLeft().getZ(),
|
||||
(int) bounds.getRight().getX(), (int) bounds.getRight().getY(), (int) bounds.getRight().getZ()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision.constants;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
|
||||
public final class ConstantsConstructor {
|
||||
public static final CollisionGroup HEAD_NORTH = new CollisionGroup().addItem(RenderUtils.getBounds(2, 2, 0, 14, 14, 2)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_EAST = new CollisionGroup().addItem(RenderUtils.getBounds(14, 2, 2, 16, 14, 14)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_SOUTH = new CollisionGroup().addItem(RenderUtils.getBounds(2, 2, 14, 14, 14, 16)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_WEST = new CollisionGroup().addItem(RenderUtils.getBounds(0, 2, 2, 2, 14, 14)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_DOWN = new CollisionGroup().addItem(RenderUtils.getBounds(2, 0, 2, 14, 2, 14)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_UP = new CollisionGroup().addItem(RenderUtils.getBounds(2, 14, 2, 14, 16, 14)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_NORTH = new CollisionGroup().addItem(CollisionUtils.getBounds(2, 2, 0, 14, 14, 2)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_EAST = new CollisionGroup().addItem(CollisionUtils.getBounds(14, 2, 2, 16, 14, 14)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_SOUTH = new CollisionGroup().addItem(CollisionUtils.getBounds(2, 2, 14, 14, 14, 16)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_WEST = new CollisionGroup().addItem(CollisionUtils.getBounds(0, 2, 2, 2, 14, 14)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_DOWN = new CollisionGroup().addItem(CollisionUtils.getBounds(2, 0, 2, 14, 2, 14)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_UP = new CollisionGroup().addItem(CollisionUtils.getBounds(2, 14, 2, 14, 16, 14)).setCanAccessGui(true);
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision.constants;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
public final class ConstantsExporter {
|
||||
public static final AxisAlignedBB LINE_NORTH_1_AABB = RenderUtils.getBounds(6, 6, 0, 10, 10, 2);
|
||||
public static final AxisAlignedBB LINE_NORTH_2_AABB = RenderUtils.getBounds(5, 5, 2, 11, 11, 4);
|
||||
public static final AxisAlignedBB LINE_NORTH_3_AABB = RenderUtils.getBounds(3, 3, 4, 13, 13, 6);
|
||||
public static final AxisAlignedBB LINE_NORTH_1_AABB = CollisionUtils.getBounds(6, 6, 0, 10, 10, 2);
|
||||
public static final AxisAlignedBB LINE_NORTH_2_AABB = CollisionUtils.getBounds(5, 5, 2, 11, 11, 4);
|
||||
public static final AxisAlignedBB LINE_NORTH_3_AABB = CollisionUtils.getBounds(3, 3, 4, 13, 13, 6);
|
||||
public static final CollisionGroup LINE_NORTH = new CollisionGroup().addItem(LINE_NORTH_1_AABB).addItem(LINE_NORTH_2_AABB).addItem(LINE_NORTH_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_EAST_1_AABB = RenderUtils.getBounds(14, 6, 6, 16, 10, 10);
|
||||
public static final AxisAlignedBB LINE_EAST_2_AABB = RenderUtils.getBounds(12, 5, 5, 14, 11, 11);
|
||||
public static final AxisAlignedBB LINE_EAST_3_AABB = RenderUtils.getBounds(10, 3, 3, 12, 13, 13);
|
||||
public static final AxisAlignedBB LINE_EAST_1_AABB = CollisionUtils.getBounds(14, 6, 6, 16, 10, 10);
|
||||
public static final AxisAlignedBB LINE_EAST_2_AABB = CollisionUtils.getBounds(12, 5, 5, 14, 11, 11);
|
||||
public static final AxisAlignedBB LINE_EAST_3_AABB = CollisionUtils.getBounds(10, 3, 3, 12, 13, 13);
|
||||
public static final CollisionGroup LINE_EAST = new CollisionGroup().addItem(LINE_EAST_1_AABB).addItem(LINE_EAST_2_AABB).addItem(LINE_EAST_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_SOUTH_1_AABB = RenderUtils.getBounds(6, 6, 14, 10, 10, 16);
|
||||
public static final AxisAlignedBB LINE_SOUTH_2_AABB = RenderUtils.getBounds(5, 5, 12, 11, 11, 14);
|
||||
public static final AxisAlignedBB LINE_SOUTH_3_AABB = RenderUtils.getBounds(3, 3, 10, 13, 13, 12);
|
||||
public static final AxisAlignedBB LINE_SOUTH_1_AABB = CollisionUtils.getBounds(6, 6, 14, 10, 10, 16);
|
||||
public static final AxisAlignedBB LINE_SOUTH_2_AABB = CollisionUtils.getBounds(5, 5, 12, 11, 11, 14);
|
||||
public static final AxisAlignedBB LINE_SOUTH_3_AABB = CollisionUtils.getBounds(3, 3, 10, 13, 13, 12);
|
||||
public static final CollisionGroup LINE_SOUTH = new CollisionGroup().addItem(LINE_SOUTH_1_AABB).addItem(LINE_SOUTH_2_AABB).addItem(LINE_SOUTH_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_WEST_1_AABB = RenderUtils.getBounds(0, 6, 6, 2, 10, 10);
|
||||
public static final AxisAlignedBB LINE_WEST_2_AABB = RenderUtils.getBounds(2, 5, 5, 4, 11, 11);
|
||||
public static final AxisAlignedBB LINE_WEST_3_AABB = RenderUtils.getBounds(4, 3, 3, 6, 13, 13);
|
||||
public static final AxisAlignedBB LINE_WEST_1_AABB = CollisionUtils.getBounds(0, 6, 6, 2, 10, 10);
|
||||
public static final AxisAlignedBB LINE_WEST_2_AABB = CollisionUtils.getBounds(2, 5, 5, 4, 11, 11);
|
||||
public static final AxisAlignedBB LINE_WEST_3_AABB = CollisionUtils.getBounds(4, 3, 3, 6, 13, 13);
|
||||
public static final CollisionGroup LINE_WEST = new CollisionGroup().addItem(LINE_WEST_1_AABB).addItem(LINE_WEST_2_AABB).addItem(LINE_WEST_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_UP_1_AABB = RenderUtils.getBounds(6, 14, 6, 10, 16, 10);
|
||||
public static final AxisAlignedBB LINE_UP_2_AABB = RenderUtils.getBounds(5, 12, 5, 11, 14, 11);
|
||||
public static final AxisAlignedBB LINE_UP_3_AABB = RenderUtils.getBounds(3, 10, 3, 13, 12, 13);
|
||||
public static final AxisAlignedBB LINE_UP_1_AABB = CollisionUtils.getBounds(6, 14, 6, 10, 16, 10);
|
||||
public static final AxisAlignedBB LINE_UP_2_AABB = CollisionUtils.getBounds(5, 12, 5, 11, 14, 11);
|
||||
public static final AxisAlignedBB LINE_UP_3_AABB = CollisionUtils.getBounds(3, 10, 3, 13, 12, 13);
|
||||
public static final CollisionGroup LINE_UP = new CollisionGroup().addItem(LINE_UP_1_AABB).addItem(LINE_UP_2_AABB).addItem(LINE_UP_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_DOWN_1_AABB = RenderUtils.getBounds(6, 0, 6, 10, 2, 10);
|
||||
public static final AxisAlignedBB LINE_DOWN_2_AABB = RenderUtils.getBounds(5, 2, 5, 11, 4, 11);
|
||||
public static final AxisAlignedBB LINE_DOWN_3_AABB = RenderUtils.getBounds(3, 4, 3, 13, 6, 13);
|
||||
public static final AxisAlignedBB LINE_DOWN_1_AABB = CollisionUtils.getBounds(6, 0, 6, 10, 2, 10);
|
||||
public static final AxisAlignedBB LINE_DOWN_2_AABB = CollisionUtils.getBounds(5, 2, 5, 11, 4, 11);
|
||||
public static final AxisAlignedBB LINE_DOWN_3_AABB = CollisionUtils.getBounds(3, 4, 3, 13, 6, 13);
|
||||
public static final CollisionGroup LINE_DOWN = new CollisionGroup().addItem(LINE_DOWN_1_AABB).addItem(LINE_DOWN_2_AABB).addItem(LINE_DOWN_3_AABB).setCanAccessGui(true);
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision.constants;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
|
||||
public final class ConstantsExternalStorage {
|
||||
public static final CollisionGroup HEAD_NORTH = new CollisionGroup().addItem(RenderUtils.getBounds(3, 3, 0, 13, 13, 2)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_EAST = new CollisionGroup().addItem(RenderUtils.getBounds(14, 3, 3, 16, 13, 13)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_SOUTH = new CollisionGroup().addItem(RenderUtils.getBounds(3, 3, 14, 13, 13, 16)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_WEST = new CollisionGroup().addItem(RenderUtils.getBounds(0, 3, 3, 2, 13, 13)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_UP = new CollisionGroup().addItem(RenderUtils.getBounds(3, 14, 3, 13, 16, 13)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_DOWN = new CollisionGroup().addItem(RenderUtils.getBounds(3, 0, 3, 13, 2, 13)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_NORTH = new CollisionGroup().addItem(CollisionUtils.getBounds(3, 3, 0, 13, 13, 2)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_EAST = new CollisionGroup().addItem(CollisionUtils.getBounds(14, 3, 3, 16, 13, 13)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_SOUTH = new CollisionGroup().addItem(CollisionUtils.getBounds(3, 3, 14, 13, 13, 16)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_WEST = new CollisionGroup().addItem(CollisionUtils.getBounds(0, 3, 3, 2, 13, 13)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_UP = new CollisionGroup().addItem(CollisionUtils.getBounds(3, 14, 3, 13, 16, 13)).setCanAccessGui(true);
|
||||
public static final CollisionGroup HEAD_DOWN = new CollisionGroup().addItem(CollisionUtils.getBounds(3, 0, 3, 13, 2, 13)).setCanAccessGui(true);
|
||||
}
|
||||
|
||||
@@ -1,37 +1,37 @@
|
||||
package com.raoulvdberge.refinedstorage.render.collision.constants;
|
||||
|
||||
import com.raoulvdberge.refinedstorage.render.collision.CollisionGroup;
|
||||
import com.raoulvdberge.refinedstorage.util.RenderUtils;
|
||||
import com.raoulvdberge.refinedstorage.util.CollisionUtils;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
public final class ConstantsImporter {
|
||||
public static final AxisAlignedBB LINE_NORTH_1_AABB = RenderUtils.getBounds(6, 6, 4, 10, 10, 6);
|
||||
public static final AxisAlignedBB LINE_NORTH_2_AABB = RenderUtils.getBounds(5, 5, 2, 11, 11, 4);
|
||||
public static final AxisAlignedBB LINE_NORTH_3_AABB = RenderUtils.getBounds(3, 3, 0, 13, 13, 2);
|
||||
public static final AxisAlignedBB LINE_NORTH_1_AABB = CollisionUtils.getBounds(6, 6, 4, 10, 10, 6);
|
||||
public static final AxisAlignedBB LINE_NORTH_2_AABB = CollisionUtils.getBounds(5, 5, 2, 11, 11, 4);
|
||||
public static final AxisAlignedBB LINE_NORTH_3_AABB = CollisionUtils.getBounds(3, 3, 0, 13, 13, 2);
|
||||
public static final CollisionGroup LINE_NORTH = new CollisionGroup().addItem(LINE_NORTH_1_AABB).addItem(LINE_NORTH_2_AABB).addItem(LINE_NORTH_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_EAST_1_AABB = RenderUtils.getBounds(10, 6, 6, 12, 10, 10);
|
||||
public static final AxisAlignedBB LINE_EAST_2_AABB = RenderUtils.getBounds(12, 5, 5, 14, 11, 11);
|
||||
public static final AxisAlignedBB LINE_EAST_3_AABB = RenderUtils.getBounds(14, 3, 3, 16, 13, 13);
|
||||
public static final AxisAlignedBB LINE_EAST_1_AABB = CollisionUtils.getBounds(10, 6, 6, 12, 10, 10);
|
||||
public static final AxisAlignedBB LINE_EAST_2_AABB = CollisionUtils.getBounds(12, 5, 5, 14, 11, 11);
|
||||
public static final AxisAlignedBB LINE_EAST_3_AABB = CollisionUtils.getBounds(14, 3, 3, 16, 13, 13);
|
||||
public static final CollisionGroup LINE_EAST = new CollisionGroup().addItem(LINE_EAST_1_AABB).addItem(LINE_EAST_2_AABB).addItem(LINE_EAST_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_SOUTH_1_AABB = RenderUtils.getBounds(6, 6, 10, 10, 10, 12);
|
||||
public static final AxisAlignedBB LINE_SOUTH_2_AABB = RenderUtils.getBounds(5, 5, 12, 11, 11, 14);
|
||||
public static final AxisAlignedBB LINE_SOUTH_3_AABB = RenderUtils.getBounds(3, 3, 14, 13, 13, 16);
|
||||
public static final AxisAlignedBB LINE_SOUTH_1_AABB = CollisionUtils.getBounds(6, 6, 10, 10, 10, 12);
|
||||
public static final AxisAlignedBB LINE_SOUTH_2_AABB = CollisionUtils.getBounds(5, 5, 12, 11, 11, 14);
|
||||
public static final AxisAlignedBB LINE_SOUTH_3_AABB = CollisionUtils.getBounds(3, 3, 14, 13, 13, 16);
|
||||
public static final CollisionGroup LINE_SOUTH = new CollisionGroup().addItem(LINE_SOUTH_1_AABB).addItem(LINE_SOUTH_2_AABB).addItem(LINE_SOUTH_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_WEST_1_AABB = RenderUtils.getBounds(4, 6, 6, 6, 10, 10);
|
||||
public static final AxisAlignedBB LINE_WEST_2_AABB = RenderUtils.getBounds(2, 5, 5, 4, 11, 11);
|
||||
public static final AxisAlignedBB LINE_WEST_3_AABB = RenderUtils.getBounds(0, 3, 3, 2, 13, 13);
|
||||
public static final AxisAlignedBB LINE_WEST_1_AABB = CollisionUtils.getBounds(4, 6, 6, 6, 10, 10);
|
||||
public static final AxisAlignedBB LINE_WEST_2_AABB = CollisionUtils.getBounds(2, 5, 5, 4, 11, 11);
|
||||
public static final AxisAlignedBB LINE_WEST_3_AABB = CollisionUtils.getBounds(0, 3, 3, 2, 13, 13);
|
||||
public static final CollisionGroup LINE_WEST = new CollisionGroup().addItem(LINE_WEST_1_AABB).addItem(LINE_WEST_2_AABB).addItem(LINE_WEST_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_UP_1_AABB = RenderUtils.getBounds(6, 10, 6, 10, 12, 10);
|
||||
public static final AxisAlignedBB LINE_UP_2_AABB = RenderUtils.getBounds(5, 12, 5, 11, 14, 11);
|
||||
public static final AxisAlignedBB LINE_UP_3_AABB = RenderUtils.getBounds(3, 14, 3, 13, 16, 13);
|
||||
public static final AxisAlignedBB LINE_UP_1_AABB = CollisionUtils.getBounds(6, 10, 6, 10, 12, 10);
|
||||
public static final AxisAlignedBB LINE_UP_2_AABB = CollisionUtils.getBounds(5, 12, 5, 11, 14, 11);
|
||||
public static final AxisAlignedBB LINE_UP_3_AABB = CollisionUtils.getBounds(3, 14, 3, 13, 16, 13);
|
||||
public static final CollisionGroup LINE_UP = new CollisionGroup().addItem(LINE_UP_1_AABB).addItem(LINE_UP_2_AABB).addItem(LINE_UP_3_AABB).setCanAccessGui(true);
|
||||
|
||||
public static final AxisAlignedBB LINE_DOWN_1_AABB = RenderUtils.getBounds(6, 4, 6, 10, 6, 10);
|
||||
public static final AxisAlignedBB LINE_DOWN_2_AABB = RenderUtils.getBounds(5, 2, 5, 11, 4, 11);
|
||||
public static final AxisAlignedBB LINE_DOWN_3_AABB = RenderUtils.getBounds(3, 0, 3, 13, 2, 13);
|
||||
public static final AxisAlignedBB LINE_DOWN_1_AABB = CollisionUtils.getBounds(6, 4, 6, 10, 6, 10);
|
||||
public static final AxisAlignedBB LINE_DOWN_2_AABB = CollisionUtils.getBounds(5, 2, 5, 11, 4, 11);
|
||||
public static final AxisAlignedBB LINE_DOWN_3_AABB = CollisionUtils.getBounds(3, 0, 3, 13, 2, 13);
|
||||
public static final CollisionGroup LINE_DOWN = new CollisionGroup().addItem(LINE_DOWN_1_AABB).addItem(LINE_DOWN_2_AABB).addItem(LINE_DOWN_3_AABB).setCanAccessGui(true);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.lwjgl.util.vector.Vector3f;
|
||||
@@ -84,42 +85,40 @@ public class BakedModelCableCover implements IBakedModel {
|
||||
}
|
||||
|
||||
private static void addNormalCover(List<BakedQuad> quads, TextureAtlasSprite sprite, EnumFacing coverSide, boolean hasUp, boolean hasDown, boolean hasEast, boolean hasWest, boolean handle) {
|
||||
Pair<Vector3f, Vector3f> bounds = ConstantsCable.getCoverBounds(coverSide);
|
||||
AxisAlignedBB bounds = ConstantsCable.getCoverBounds(coverSide);
|
||||
|
||||
Vector3f from = new Vector3f((float) bounds.minX * 16, (float) bounds.minY * 16, (float) bounds.minZ * 16);
|
||||
Vector3f to = new Vector3f((float) bounds.maxX * 16, (float) bounds.maxY * 16, (float) bounds.maxZ * 16);
|
||||
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
if (hasWest) {
|
||||
bounds.getLeft().setX(2);
|
||||
from.setX(2);
|
||||
}
|
||||
|
||||
if (hasEast) {
|
||||
bounds.getRight().setX(14);
|
||||
to.setX(14);
|
||||
}
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
if (hasWest) {
|
||||
bounds.getLeft().setX(2);
|
||||
from.setX(2);
|
||||
}
|
||||
|
||||
if (hasEast) {
|
||||
bounds.getRight().setX(14);
|
||||
to.setX(14);
|
||||
}
|
||||
}
|
||||
|
||||
if (coverSide.getAxis() != EnumFacing.Axis.Y) {
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
}
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
}
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
quads.addAll(new CubeBuilder().from(from.getX(), from.getY(), from.getZ()).to(to.getX(), to.getY(), to.getZ()).addFaces(face -> new CubeBuilder.Face(face, sprite)).bake());
|
||||
|
||||
if (handle) {
|
||||
if (GREY_SPRITE == null) {
|
||||
@@ -128,61 +127,60 @@ public class BakedModelCableCover implements IBakedModel {
|
||||
|
||||
bounds = ConstantsCable.getHolderBounds(coverSide);
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
from = new Vector3f((float) bounds.minX * 16, (float) bounds.minY * 16, (float) bounds.minZ * 16);
|
||||
to = new Vector3f((float) bounds.maxX * 16, (float) bounds.maxY * 16, (float) bounds.maxZ * 16);
|
||||
|
||||
.addFaces(face -> new CubeBuilder.Face(face, GREY_SPRITE))
|
||||
|
||||
.bake()
|
||||
);
|
||||
quads.addAll(new CubeBuilder().from(from.getX(), from.getY(), from.getZ()).to(to.getX(), to.getY(), to.getZ()).addFaces(face -> new CubeBuilder.Face(face, GREY_SPRITE)).bake());
|
||||
}
|
||||
}
|
||||
|
||||
private static void addHollowCover(List<BakedQuad> quads, TextureAtlasSprite sprite, EnumFacing coverSide, boolean hasUp, boolean hasDown, boolean hasEast, boolean hasWest) {
|
||||
Pair<Vector3f, Vector3f> bounds = ConstantsCable.getCoverBounds(coverSide);
|
||||
AxisAlignedBB bounds = ConstantsCable.getCoverBounds(coverSide);
|
||||
|
||||
Vector3f from = new Vector3f((float) bounds.minX * 16, (float) bounds.minY * 16, (float) bounds.minZ * 16);
|
||||
Vector3f to = new Vector3f((float) bounds.maxX * 16, (float) bounds.maxY * 16, (float) bounds.maxZ * 16);
|
||||
|
||||
if (coverSide.getAxis() != EnumFacing.Axis.Y) {
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
}
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
}
|
||||
}
|
||||
|
||||
// Right
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
if (hasWest) {
|
||||
bounds.getLeft().setX(2);
|
||||
from.setX(2);
|
||||
} else {
|
||||
bounds.getLeft().setX(0);
|
||||
from.setX(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setX(6);
|
||||
to.setX(6);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
if (hasEast) {
|
||||
bounds.getRight().setX(14);
|
||||
to.setX(14);
|
||||
} else {
|
||||
bounds.getRight().setX(16);
|
||||
to.setX(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setX(10);
|
||||
from.setX(10);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getLeft().setZ(0);
|
||||
bounds.getRight().setZ(6);
|
||||
from.setZ(0);
|
||||
to.setZ(6);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(10);
|
||||
bounds.getRight().setZ(16);
|
||||
from.setZ(10);
|
||||
to.setZ(16);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(10);
|
||||
bounds.getRight().setZ(16);
|
||||
from.setZ(10);
|
||||
to.setZ(16);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
@@ -190,203 +188,206 @@ public class BakedModelCableCover implements IBakedModel {
|
||||
// Left
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
if (hasEast) {
|
||||
bounds.getRight().setX(14);
|
||||
to.setX(14);
|
||||
} else {
|
||||
bounds.getRight().setX(16);
|
||||
to.setX(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setX(10);
|
||||
from.setX(10);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
if (hasWest) {
|
||||
bounds.getLeft().setX(2);
|
||||
from.setX(2);
|
||||
} else {
|
||||
bounds.getLeft().setX(0);
|
||||
from.setX(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setX(6);
|
||||
to.setX(6);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getRight().setZ(16);
|
||||
bounds.getLeft().setZ(10);
|
||||
to.setZ(16);
|
||||
from.setZ(10);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(0);
|
||||
bounds.getRight().setZ(6);
|
||||
from.setZ(0);
|
||||
to.setZ(6);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(0);
|
||||
bounds.getRight().setZ(6);
|
||||
from.setZ(0);
|
||||
to.setZ(6);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
|
||||
// Bottom
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
bounds.getLeft().setX(6);
|
||||
bounds.getRight().setX(10);
|
||||
from.setX(6);
|
||||
to.setX(10);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(6);
|
||||
to.setY(6);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
bounds.getLeft().setX(6);
|
||||
bounds.getRight().setX(10);
|
||||
from.setX(6);
|
||||
to.setX(10);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(6);
|
||||
to.setY(6);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getLeft().setZ(6);
|
||||
bounds.getRight().setZ(10);
|
||||
from.setZ(6);
|
||||
to.setZ(10);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(6);
|
||||
to.setY(6);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(6);
|
||||
bounds.getRight().setZ(10);
|
||||
from.setZ(6);
|
||||
to.setZ(10);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(6);
|
||||
to.setY(6);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(6);
|
||||
bounds.getRight().setZ(10);
|
||||
from.setZ(6);
|
||||
to.setZ(10);
|
||||
|
||||
bounds.getLeft().setX(0);
|
||||
bounds.getRight().setX(6);
|
||||
from.setX(0);
|
||||
to.setX(6);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
|
||||
// Up
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
bounds.getLeft().setX(6);
|
||||
bounds.getRight().setX(10);
|
||||
from.setX(6);
|
||||
to.setX(10);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(10);
|
||||
from.setY(10);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
bounds.getLeft().setX(6);
|
||||
bounds.getRight().setX(10);
|
||||
from.setX(6);
|
||||
to.setX(10);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(10);
|
||||
from.setY(10);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getLeft().setZ(6);
|
||||
bounds.getRight().setZ(10);
|
||||
from.setZ(6);
|
||||
to.setZ(10);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(10);
|
||||
from.setY(10);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(6);
|
||||
bounds.getRight().setZ(10);
|
||||
from.setZ(6);
|
||||
to.setZ(10);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(10);
|
||||
from.setY(10);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(6);
|
||||
bounds.getRight().setZ(10);
|
||||
from.setZ(6);
|
||||
to.setZ(10);
|
||||
|
||||
bounds.getLeft().setX(10);
|
||||
bounds.getRight().setX(16);
|
||||
from.setX(10);
|
||||
to.setX(16);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
}
|
||||
|
||||
private static void addHollowWideCover(List<BakedQuad> quads, TextureAtlasSprite sprite, EnumFacing coverSide, boolean hasUp, boolean hasDown, boolean hasEast, boolean hasWest) {
|
||||
Pair<Vector3f, Vector3f> bounds = ConstantsCable.getCoverBounds(coverSide);
|
||||
AxisAlignedBB bounds = ConstantsCable.getCoverBounds(coverSide);
|
||||
|
||||
Vector3f from = new Vector3f((float) bounds.minX * 16, (float) bounds.minY * 16, (float) bounds.minZ * 16);
|
||||
Vector3f to = new Vector3f((float) bounds.maxX * 16, (float) bounds.maxY * 16, (float) bounds.maxZ * 16);
|
||||
|
||||
if (coverSide.getAxis() != EnumFacing.Axis.Y) {
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
}
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
}
|
||||
}
|
||||
|
||||
// Right
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
if (hasWest) {
|
||||
bounds.getLeft().setX(2);
|
||||
from.setX(2);
|
||||
} else {
|
||||
bounds.getLeft().setX(0);
|
||||
from.setX(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setX(3);
|
||||
to.setX(3);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
if (hasEast) {
|
||||
bounds.getRight().setX(14);
|
||||
to.setX(14);
|
||||
} else {
|
||||
bounds.getRight().setX(16);
|
||||
to.setX(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setX(13);
|
||||
from.setX(13);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getLeft().setZ(0);
|
||||
bounds.getRight().setZ(3);
|
||||
from.setZ(0);
|
||||
to.setZ(3);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(13);
|
||||
bounds.getRight().setZ(16);
|
||||
from.setZ(13);
|
||||
to.setZ(16);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(13);
|
||||
bounds.getRight().setZ(16);
|
||||
from.setZ(13);
|
||||
to.setZ(16);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
@@ -394,154 +395,154 @@ public class BakedModelCableCover implements IBakedModel {
|
||||
// Left
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
if (hasEast) {
|
||||
bounds.getRight().setX(14);
|
||||
to.setX(14);
|
||||
} else {
|
||||
bounds.getRight().setX(16);
|
||||
to.setX(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setX(13);
|
||||
from.setX(13);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
if (hasWest) {
|
||||
bounds.getLeft().setX(2);
|
||||
from.setX(2);
|
||||
} else {
|
||||
bounds.getLeft().setX(0);
|
||||
from.setX(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setX(3);
|
||||
to.setX(3);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getRight().setZ(16);
|
||||
bounds.getLeft().setZ(13);
|
||||
to.setZ(16);
|
||||
from.setZ(13);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(0);
|
||||
bounds.getRight().setZ(3);
|
||||
from.setZ(0);
|
||||
to.setZ(3);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(0);
|
||||
bounds.getRight().setZ(3);
|
||||
from.setZ(0);
|
||||
to.setZ(3);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
|
||||
// Bottom
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
bounds.getLeft().setX(3);
|
||||
bounds.getRight().setX(13);
|
||||
from.setX(3);
|
||||
to.setX(13);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(3);
|
||||
to.setY(3);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
bounds.getLeft().setX(3);
|
||||
bounds.getRight().setX(13);
|
||||
from.setX(3);
|
||||
to.setX(13);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(3);
|
||||
to.setY(3);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getLeft().setZ(3);
|
||||
bounds.getRight().setZ(13);
|
||||
from.setZ(3);
|
||||
to.setZ(13);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(3);
|
||||
to.setY(3);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(3);
|
||||
bounds.getRight().setZ(13);
|
||||
from.setZ(3);
|
||||
to.setZ(13);
|
||||
|
||||
if (hasDown) {
|
||||
bounds.getLeft().setY(2);
|
||||
from.setY(2);
|
||||
} else {
|
||||
bounds.getLeft().setY(0);
|
||||
from.setY(0);
|
||||
}
|
||||
|
||||
bounds.getRight().setY(3);
|
||||
to.setY(3);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(3);
|
||||
bounds.getRight().setZ(13);
|
||||
from.setZ(3);
|
||||
to.setZ(13);
|
||||
|
||||
bounds.getLeft().setX(0);
|
||||
bounds.getRight().setX(3);
|
||||
from.setX(0);
|
||||
to.setX(3);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
|
||||
// Up
|
||||
if (coverSide == EnumFacing.NORTH) {
|
||||
bounds.getLeft().setX(3);
|
||||
bounds.getRight().setX(13);
|
||||
from.setX(3);
|
||||
to.setX(13);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(13);
|
||||
from.setY(13);
|
||||
} else if (coverSide == EnumFacing.SOUTH) {
|
||||
bounds.getLeft().setX(3);
|
||||
bounds.getRight().setX(13);
|
||||
from.setX(3);
|
||||
to.setX(13);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(13);
|
||||
from.setY(13);
|
||||
} else if (coverSide == EnumFacing.EAST) {
|
||||
bounds.getLeft().setZ(3);
|
||||
bounds.getRight().setZ(13);
|
||||
from.setZ(3);
|
||||
to.setZ(13);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(13);
|
||||
from.setY(13);
|
||||
} else if (coverSide == EnumFacing.WEST) {
|
||||
bounds.getLeft().setZ(3);
|
||||
bounds.getRight().setZ(13);
|
||||
from.setZ(3);
|
||||
to.setZ(13);
|
||||
|
||||
if (hasUp) {
|
||||
bounds.getRight().setY(14);
|
||||
to.setY(14);
|
||||
} else {
|
||||
bounds.getRight().setY(16);
|
||||
to.setY(16);
|
||||
}
|
||||
|
||||
bounds.getLeft().setY(13);
|
||||
from.setY(13);
|
||||
} else if (coverSide == EnumFacing.DOWN || coverSide == EnumFacing.UP) {
|
||||
bounds.getLeft().setZ(3);
|
||||
bounds.getRight().setZ(13);
|
||||
from.setZ(3);
|
||||
to.setZ(13);
|
||||
|
||||
bounds.getLeft().setX(13);
|
||||
bounds.getRight().setX(16);
|
||||
from.setX(13);
|
||||
to.setX(16);
|
||||
}
|
||||
|
||||
quads.addAll(new CubeBuilder()
|
||||
.from(bounds.getLeft().getX(), bounds.getLeft().getY(), bounds.getLeft().getZ())
|
||||
.to(bounds.getRight().getX(), bounds.getRight().getY(), bounds.getRight().getZ())
|
||||
.from(from.getX(), from.getY(), from.getZ())
|
||||
.to(to.getX(), to.getY(), to.getZ())
|
||||
.addFaces(face -> new CubeBuilder.Face(face, sprite))
|
||||
.bake()
|
||||
);
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.raoulvdberge.refinedstorage.util;
|
||||
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
|
||||
public final class CollisionUtils {
|
||||
public static AxisAlignedBB getBounds(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {
|
||||
return new AxisAlignedBB((float) fromX / 16F, (float) fromY / 16F, (float) fromZ / 16F, (float) toX / 16F, (float) toY / 16F, (float) toZ / 16F);
|
||||
}
|
||||
|
||||
public static boolean isInBounds(AxisAlignedBB aabb, float hitX, float hitY, float hitZ) {
|
||||
return hitX >= aabb.minX && hitX <= aabb.maxX && hitY >= aabb.minY && hitY <= aabb.maxY && hitZ >= aabb.minZ && hitZ <= aabb.maxZ;
|
||||
}
|
||||
}
|
||||
@@ -21,7 +21,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockRenderLayer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
@@ -33,8 +32,6 @@ import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||
import net.minecraftforge.fml.client.config.GuiUtils;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.vecmath.Matrix4f;
|
||||
@@ -54,14 +51,6 @@ public final class RenderUtils {
|
||||
|
||||
private static final VertexFormat ITEM_FORMAT_WITH_LIGHTMAP = new VertexFormat(DefaultVertexFormats.ITEM).addElement(DefaultVertexFormats.TEX_2S);
|
||||
|
||||
public static AxisAlignedBB getBounds(int fromX, int fromY, int fromZ, int toX, int toY, int toZ) {
|
||||
return new AxisAlignedBB((float) fromX / 16F, (float) fromY / 16F, (float) fromZ / 16F, (float) toX / 16F, (float) toY / 16F, (float) toZ / 16F);
|
||||
}
|
||||
|
||||
public static boolean isInBounds(AxisAlignedBB aabb, float hitX, float hitY, float hitZ) {
|
||||
return hitX >= aabb.minX && hitX <= aabb.maxX && hitY >= aabb.minY && hitY <= aabb.maxY && hitZ >= aabb.minZ && hitZ <= aabb.maxZ;
|
||||
}
|
||||
|
||||
public static String shorten(String text, int length) {
|
||||
if (text.length() > length) {
|
||||
text = text.substring(0, length) + "...";
|
||||
@@ -400,7 +389,6 @@ public final class RenderUtils {
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static List<String> getItemTooltip(ItemStack stack) {
|
||||
List<String> lines = stack.getTooltip(Minecraft.getMinecraft().player, Minecraft.getMinecraft().gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL);
|
||||
|
||||
@@ -416,7 +404,6 @@ public final class RenderUtils {
|
||||
return lines;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static VertexFormat getFormatWithLightMap(VertexFormat format) {
|
||||
if (FMLClientHandler.instance().hasOptifine() || !ForgeModContainer.forgeLightPipelineEnabled) {
|
||||
return format;
|
||||
@@ -437,7 +424,6 @@ public final class RenderUtils {
|
||||
return format;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static TextureAtlasSprite getSprite(IBakedModel coverModel, IBlockState coverState, EnumFacing facing, long rand) {
|
||||
TextureAtlasSprite sprite = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user