mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-05 01:45:00 +01:00
Fix some rendering, update model
This commit is contained in:
parent
dbede41eba
commit
5d54ed4682
7 changed files with 60 additions and 93 deletions
|
@ -1106,6 +1106,7 @@ public class AllBlocks {
|
||||||
public static final BlockEntry<MirrorBlock> MIRROR =
|
public static final BlockEntry<MirrorBlock> MIRROR =
|
||||||
REGISTRATE.block("mirror", MirrorBlock::new)
|
REGISTRATE.block("mirror", MirrorBlock::new)
|
||||||
.initialProperties(SharedProperties::softMetal)
|
.initialProperties(SharedProperties::softMetal)
|
||||||
|
.properties(Block.Properties::nonOpaque)
|
||||||
.addLayer(() -> RenderType::getCutoutMipped)
|
.addLayer(() -> RenderType::getCutoutMipped)
|
||||||
.tag(AllBlockTags.SAFE_NBT.tag)
|
.tag(AllBlockTags.SAFE_NBT.tag)
|
||||||
.blockstate(BlockStateGen.axisBlockProvider(true))
|
.blockstate(BlockStateGen.axisBlockProvider(true))
|
||||||
|
|
|
@ -38,10 +38,6 @@ public class AllShapes {
|
||||||
.add(2, 13, 2, 14, 16, 14)
|
.add(2, 13, 2, 14, 16, 14)
|
||||||
.add(0, 0, 14, 16, 16, 16)
|
.add(0, 0, 14, 16, 16, 16)
|
||||||
.forHorizontalAxis(),
|
.forHorizontalAxis(),
|
||||||
MIRROR = shape(0, 0, 0, 16, 2, 16)
|
|
||||||
.add(1, 2, 1, 15, 14, 15)
|
|
||||||
.add(0, 14, 0, 16, 16, 16)
|
|
||||||
.forAxis(),
|
|
||||||
SAIL_FRAME_COLLISION = shape(0, 5, 0, 16, 9, 16).erase(2, 0, 2, 14, 16, 14)
|
SAIL_FRAME_COLLISION = shape(0, 5, 0, 16, 9, 16).erase(2, 0, 2, 14, 16, 14)
|
||||||
.forDirectional(),
|
.forDirectional(),
|
||||||
SAIL_FRAME = shape(0, 5, 0, 16, 9, 16).forDirectional(), SAIL = shape(0, 5, 0, 16, 10, 16).forDirectional(),
|
SAIL_FRAME = shape(0, 5, 0, 16, 9, 16).forDirectional(), SAIL = shape(0, 5, 0, 16, 10, 16).forDirectional(),
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.simibubi.create.content.optics.mirror;
|
package com.simibubi.create.content.optics.mirror;
|
||||||
|
|
||||||
import com.simibubi.create.AllShapes;
|
import javax.annotation.ParametersAreNonnullByDefault;
|
||||||
|
|
||||||
import com.simibubi.create.AllTileEntities;
|
import com.simibubi.create.AllTileEntities;
|
||||||
import com.simibubi.create.content.contraptions.relays.encased.AbstractEncasedShaftBlock;
|
import com.simibubi.create.content.contraptions.relays.encased.AbstractEncasedShaftBlock;
|
||||||
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
import com.simibubi.create.content.contraptions.wrench.IWrenchable;
|
||||||
|
@ -9,13 +10,8 @@ import com.simibubi.create.foundation.block.ITE;
|
||||||
import mcp.MethodsReturnNonnullByDefault;
|
import mcp.MethodsReturnNonnullByDefault;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
|
||||||
import net.minecraft.util.math.shapes.ISelectionContext;
|
|
||||||
import net.minecraft.util.math.shapes.VoxelShape;
|
|
||||||
import net.minecraft.world.IBlockReader;
|
import net.minecraft.world.IBlockReader;
|
||||||
|
|
||||||
import javax.annotation.ParametersAreNonnullByDefault;
|
|
||||||
|
|
||||||
@MethodsReturnNonnullByDefault
|
@MethodsReturnNonnullByDefault
|
||||||
@ParametersAreNonnullByDefault
|
@ParametersAreNonnullByDefault
|
||||||
public class MirrorBlock extends AbstractEncasedShaftBlock implements IWrenchable, ITE<MirrorTileEntity> {
|
public class MirrorBlock extends AbstractEncasedShaftBlock implements IWrenchable, ITE<MirrorTileEntity> {
|
||||||
|
@ -29,11 +25,6 @@ public class MirrorBlock extends AbstractEncasedShaftBlock implements IWrenchabl
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
|
||||||
return AllShapes.MIRROR.get(state.get(AXIS));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<MirrorTileEntity> getTileEntityClass() {
|
public Class<MirrorTileEntity> getTileEntityClass() {
|
||||||
return MirrorTileEntity.class;
|
return MirrorTileEntity.class;
|
||||||
|
|
|
@ -7,7 +7,6 @@ import com.simibubi.create.AllBlockPartials;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||||
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer;
|
||||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
|
@ -37,23 +36,11 @@ public class MirrorRenderer extends KineticTileEntityRenderer {
|
||||||
|
|
||||||
final Direction.Axis facing = te.getBlockState()
|
final Direction.Axis facing = te.getBlockState()
|
||||||
.get(BlockStateProperties.AXIS);
|
.get(BlockStateProperties.AXIS);
|
||||||
SuperByteBuffer superBuffer = AllBlockPartials.MIRROR_PLANE.renderOn(te.getBlockState());
|
SuperByteBuffer superBuffer = AllBlockPartials.MIRROR_PLANE.renderOnDirectionalSouth(te.getBlockState(), te.getBeamRotationAround());
|
||||||
|
|
||||||
float interpolatedAngle = te.getInterpolatedAngle(partialTicks - 1);
|
float interpolatedAngle = te.getInterpolatedAngle(partialTicks - 1);
|
||||||
kineticRotationTransform(superBuffer, te, facing, (float) (interpolatedAngle / 180 * Math.PI), light);
|
kineticRotationTransform(superBuffer, te, facing, (float) (interpolatedAngle / 180 * Math.PI), light);
|
||||||
|
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getTranslucent()));
|
||||||
switch (facing) {
|
|
||||||
case X:
|
|
||||||
superBuffer.rotateCentered(Direction.UP, AngleHelper.rad(90));
|
|
||||||
break;
|
|
||||||
case Y:
|
|
||||||
superBuffer.rotateCentered(Direction.EAST, AngleHelper.rad(90));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
superBuffer.rotateCentered(Direction.UP, AngleHelper.rad(180));
|
|
||||||
}
|
|
||||||
|
|
||||||
superBuffer.renderInto(ms, buffer.getBuffer(RenderType.getSolid()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -125,15 +125,20 @@ public class MirrorTileEntity extends KineticTileEntity implements ILightHandler
|
||||||
|
|
||||||
private void updateReflections() {
|
private void updateReflections() {
|
||||||
new HashMap<>(beams).forEach(Beam::removeSubBeam);
|
new HashMap<>(beams).forEach(Beam::removeSubBeam);
|
||||||
beams.replaceAll((b, v) -> reflectBeam(b));
|
|
||||||
|
Map<Beam, Beam> newBeams = new HashMap<>();
|
||||||
|
for (Beam beam : beams.keySet()) {
|
||||||
|
newBeams.put(beam, reflectBeam(beam));
|
||||||
|
}
|
||||||
|
beams = newBeams;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector3d getReflectionAngle(Vector3d inputAngle) {
|
private Vector3d getReflectionAngle(Vector3d inputAngle) {
|
||||||
inputAngle = inputAngle.normalize();
|
inputAngle = inputAngle.normalize();
|
||||||
Vector3d normal = new Matrix3d().asIdentity()
|
Vector3d normal = new Matrix3d().asIdentity()
|
||||||
.asAxisRotation(getAxis(), AngleHelper.rad(angle))
|
.asAxisRotation(getAxis(), AngleHelper.rad(angle))
|
||||||
.transform(inputAngle);
|
.transform(VecHelper.UP);
|
||||||
return VecHelper.step(inputAngle.subtract(normal.scale(2 * inputAngle.dotProduct(normal))));
|
return inputAngle.subtract(normal.scale(2 * inputAngle.dotProduct(normal)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,24 +1,13 @@
|
||||||
{
|
{
|
||||||
"credit": "Made with Blockbench",
|
"credit": "Made with Blockbench",
|
||||||
"parent": "block/block",
|
"parent": "block/cube_all",
|
||||||
"textures": {
|
"textures": {
|
||||||
"3": "create:block/gearbox_top",
|
"3": "create:block/gearbox_top",
|
||||||
"4": "create:block/gearbox",
|
"4": "create:block/gearbox",
|
||||||
"particle": "create:item/refined_radiance"
|
"particle": "create:item/refined_radiance",
|
||||||
|
"all": "block/glass"
|
||||||
},
|
},
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
|
||||||
"name": "front",
|
|
||||||
"from": [1, 2, 1],
|
|
||||||
"to": [3, 14, 3],
|
|
||||||
"rotation": {"angle": 0, "axis": "x", "origin": [8, 8, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [14, 0, 2, 2], "rotation": 270, "texture": "#3"},
|
|
||||||
"east": {"uv": [2, 2, 14, 0], "rotation": 270, "texture": "#3"},
|
|
||||||
"south": {"uv": [14, 14, 2, 16], "rotation": 90, "texture": "#3"},
|
|
||||||
"west": {"uv": [2, 16, 14, 14], "rotation": 90, "texture": "#3"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "side",
|
"name": "side",
|
||||||
"from": [2, 1, 2],
|
"from": [2, 1, 2],
|
||||||
|
@ -99,18 +88,6 @@
|
||||||
"down": {"uv": [0, 2, 2, 14], "rotation": 180, "texture": "#4"}
|
"down": {"uv": [0, 2, 2, 14], "rotation": 180, "texture": "#4"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "front",
|
|
||||||
"from": [1, 2, 13],
|
|
||||||
"to": [3, 14, 15],
|
|
||||||
"rotation": {"angle": 0, "axis": "x", "origin": [8, -10, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [2, 14, 14, 16], "rotation": 270, "texture": "#3"},
|
|
||||||
"east": {"uv": [2, 0, 14, 2], "rotation": 270, "texture": "#3"},
|
|
||||||
"south": {"uv": [2, 0, 14, 2], "rotation": 90, "texture": "#3"},
|
|
||||||
"west": {"uv": [2, 14, 14, 16], "rotation": 90, "texture": "#3"}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "side_frame",
|
"name": "side_frame",
|
||||||
"from": [0, 0, 0],
|
"from": [0, 0, 0],
|
||||||
|
@ -168,27 +145,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "front",
|
"from": [0, 2, 0],
|
||||||
"from": [13, 2, 13],
|
"to": [16, 14, 16],
|
||||||
"to": [15, 14, 15],
|
|
||||||
"rotation": {"angle": 0, "axis": "x", "origin": [8, -10, 8]},
|
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [2, 16, 14, 14], "rotation": 270, "texture": "#3"},
|
"north": {"uv": [0, 2, 16, 14], "texture": "#all"},
|
||||||
"east": {"uv": [14, 14, 2, 16], "rotation": 270, "texture": "#3"},
|
"east": {"uv": [0, 2, 16, 14], "texture": "#all"},
|
||||||
"south": {"uv": [2, 2, 14, 0], "rotation": 90, "texture": "#3"},
|
"south": {"uv": [0, 2, 16, 14], "texture": "#all"},
|
||||||
"west": {"uv": [14, 0, 2, 2], "rotation": 90, "texture": "#3"}
|
"west": {"uv": [0, 2, 16, 14], "texture": "#all"},
|
||||||
}
|
"up": {"uv": [0, 0, 16, 16], "texture": "#missing"},
|
||||||
},
|
"down": {"uv": [0, 0, 16, 16], "texture": "#missing"}
|
||||||
{
|
|
||||||
"name": "front",
|
|
||||||
"from": [13, 2, 1],
|
|
||||||
"to": [15, 14, 3],
|
|
||||||
"rotation": {"angle": 0, "axis": "x", "origin": [8, 8, 8]},
|
|
||||||
"faces": {
|
|
||||||
"north": {"uv": [14, 2, 2, 0], "rotation": 270, "texture": "#3"},
|
|
||||||
"east": {"uv": [14, 16, 2, 14], "rotation": 270, "texture": "#3"},
|
|
||||||
"south": {"uv": [14, 16, 2, 14], "rotation": 90, "texture": "#3"},
|
|
||||||
"west": {"uv": [14, 2, 2, 0], "rotation": 90, "texture": "#3"}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -196,7 +161,12 @@
|
||||||
{
|
{
|
||||||
"name": "group",
|
"name": "group",
|
||||||
"origin": [8, 8, 8],
|
"origin": [8, 8, 8],
|
||||||
"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
|
"children": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "glass",
|
||||||
|
"origin": [8, 8, 8],
|
||||||
|
"children": [10]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -10,29 +10,46 @@
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"name": "Mirror",
|
"name": "Mirror",
|
||||||
"from": [2, 9.5, 2],
|
"from": [2, 7.5, 2],
|
||||||
"to": [14, 10.5, 14],
|
"to": [14, 8.5, 14],
|
||||||
|
"rotation": {"angle": 0, "axis": "x", "origin": [8, 8, 8]},
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [2, 2, 14, 14], "rotation": 180, "texture": "#2_0"},
|
"north": {"uv": [4, 1, 12, 2], "rotation": 180, "texture": "#2_0"},
|
||||||
"east": {"uv": [3, 1, 4, 15], "rotation": 270, "texture": "#2_0"},
|
"east": {"uv": [3, 1, 4, 15], "rotation": 90, "texture": "#2_0"},
|
||||||
"south": {"uv": [4, 1, 12, 2], "texture": "#2_0"},
|
"south": {"uv": [2, 2, 14, 14], "texture": "#2_0"},
|
||||||
"west": {"uv": [12, 1, 13, 15], "rotation": 90, "texture": "#2_0"},
|
"west": {"uv": [12, 1, 13, 15], "rotation": 270, "texture": "#2_0"},
|
||||||
"up": {"uv": [2, 2, 14, 14], "rotation": 180, "texture": "#2_0"},
|
"up": {"uv": [4, 1, 12, 15], "texture": "#2_0"},
|
||||||
"down": {"uv": [4, 1, 12, 15], "texture": "#2_0"}
|
"down": {"uv": [2, 2, 14, 14], "rotation": 180, "texture": "#2_0"}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Axis",
|
"name": "Axis",
|
||||||
"from": [6, 6, 0],
|
"from": [6, 6, 0],
|
||||||
"to": [10, 10, 16],
|
"to": [10, 10, 3],
|
||||||
"shade": false,
|
"shade": false,
|
||||||
|
"rotation": {"angle": 0, "axis": "x", "origin": [8, 8, 8]},
|
||||||
"faces": {
|
"faces": {
|
||||||
"north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"},
|
"north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"},
|
||||||
"east": {"uv": [6, 0, 10, 16], "rotation": 270, "texture": "#0"},
|
"east": {"uv": [6, 0, 10, 3], "rotation": 90, "texture": "#0"},
|
||||||
"south": {"uv": [6, 6, 10, 10], "texture": "#1"},
|
"south": {"uv": [6, 6, 10, 10], "texture": "#1"},
|
||||||
"west": {"uv": [6, 0, 10, 16], "rotation": 90, "texture": "#0"},
|
"west": {"uv": [6, 0, 10, 3], "rotation": 270, "texture": "#0"},
|
||||||
"up": {"uv": [6, 0, 10, 16], "rotation": 180, "texture": "#0"},
|
"up": {"uv": [6, 0, 10, 3], "texture": "#0"},
|
||||||
"down": {"uv": [6, 0, 10, 16], "texture": "#0"}
|
"down": {"uv": [6, 0, 10, 3], "rotation": 180, "texture": "#0"}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Axis",
|
||||||
|
"from": [6, 6, 13],
|
||||||
|
"to": [10, 10, 16],
|
||||||
|
"shade": false,
|
||||||
|
"rotation": {"angle": 0, "axis": "x", "origin": [8, 8, 8]},
|
||||||
|
"faces": {
|
||||||
|
"north": {"uv": [6, 6, 10, 10], "rotation": 180, "texture": "#1"},
|
||||||
|
"east": {"uv": [6, 13, 10, 16], "rotation": 90, "texture": "#0"},
|
||||||
|
"south": {"uv": [6, 6, 10, 10], "texture": "#1"},
|
||||||
|
"west": {"uv": [6, 13, 10, 16], "rotation": 270, "texture": "#0"},
|
||||||
|
"up": {"uv": [6, 13, 10, 16], "texture": "#0"},
|
||||||
|
"down": {"uv": [6, 13, 10, 16], "rotation": 180, "texture": "#0"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue