Removed Symmetry Particles from block registry

- Fixed fluid rendering in fan recipe JEI
- Made symmetry mirror models partials instead of blockstates
- Ported symmetry wand GUI Screen
This commit is contained in:
simibubi 2020-05-18 15:51:24 +02:00
parent 78cee0bd5e
commit 9c96ee8bb8
23 changed files with 218 additions and 398 deletions

View file

@ -70,6 +70,10 @@ public enum AllBlockPartials {
ROPE_HALF_MAGNET("pulley/rope_half_magnet"),
MILLSTONE_COG("millstone/inner"),
SYMMETRY_PLANE("symmetry_effect/plane"),
SYMMETRY_CROSSPLANE("symmetry_effect/crossplane"),
SYMMETRY_TRIPLEPLANE("symmetry_effect/tripleplane"),
;
private ResourceLocation modelLocation;

View file

@ -52,9 +52,6 @@ import com.simibubi.create.modules.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.modules.contraptions.relays.encased.AdjustablePulleyBlock;
import com.simibubi.create.modules.contraptions.relays.encased.EncasedBeltBlock;
import com.simibubi.create.modules.contraptions.relays.gauge.GaugeBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock;
import com.simibubi.create.modules.curiosities.symmetry.block.TriplePlaneSymmetryBlock;
import com.simibubi.create.modules.logistics.block.RedstoneLinkBlock;
import com.simibubi.create.modules.logistics.block.StockswitchBlock;
import com.simibubi.create.modules.logistics.block.belts.observer.BeltObserverBlock;
@ -95,7 +92,6 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.Tag;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -208,9 +204,9 @@ public enum AllBlocks implements NonNullSupplier<Block> {
_4_(Sections.CURIOSITIES),
SYMMETRY_PLANE(PlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
SYMMETRY_CROSSPLANE(CrossPlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
SYMMETRY_TRIPLEPLANE(TriplePlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
// SYMMETRY_PLANE(PlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
// SYMMETRY_CROSSPLANE(CrossPlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
// SYMMETRY_TRIPLEPLANE(TriplePlaneSymmetryBlock::new, ComesWith.NO_BLOCKITEM),
_5_(Sections.SCHEMATICS),

View file

@ -32,7 +32,9 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
public void setRecipe(IRecipeLayout recipeLayout, T recipe, IIngredients ingredients) {
IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 20, 47);
itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks()));
itemStacks.set(0, Arrays.asList(recipe.getIngredients()
.get(0)
.getMatchingStacks()));
itemStacks.init(1, false, 139, 47);
itemStacks.set(1, recipe.getRecipeOutput());
@ -50,7 +52,6 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
public void draw(T recipe, double mouseX, double mouseY) {
renderWidgets(recipe, mouseX, mouseY);
RenderSystem.pushMatrix();
RenderSystem.translatef(56, 33, 0);
RenderSystem.rotatef(-12.5f, 1, 0, 0);
RenderSystem.rotatef(22.5f, 0, 1, 0);
@ -69,7 +70,6 @@ public abstract class ProcessingViaFanCategory<T extends IRecipe<?>> extends Cre
renderAttachedBlock();
RenderSystem.popMatrix();
}
public abstract void renderAttachedBlock();

View file

@ -8,14 +8,18 @@ import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.AngleHelper;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.VecHelper;
import com.simibubi.create.foundation.utility.WrappedWorld;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.FireBlock;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Atlases;
import net.minecraft.client.renderer.BlockRendererDispatcher;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderHelper;
@ -23,12 +27,17 @@ import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.fluid.Fluid;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.Direction.AxisDirection;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.LightType;
import net.minecraft.world.World;
import net.minecraftforge.client.model.data.EmptyModelData;
public class GuiGameElement {
@ -52,7 +61,7 @@ public class GuiGameElement {
public static GuiRenderBuilder of(Fluid fluid) {
return new GuiBlockStateRenderBuilder(fluid.getDefaultState()
.getBlockState()
.with(FlowingFluidBlock.LEVEL, 5));
.with(FlowingFluidBlock.LEVEL, 0));
}
public static abstract class GuiRenderBuilder {
@ -155,7 +164,8 @@ public class GuiGameElement {
BlockRendererDispatcher blockRenderer = mc.getBlockRendererDispatcher();
IRenderTypeBuffer.Impl buffer = mc.getBufferBuilders()
.getEntityVertexConsumers();
RenderType renderType = RenderTypeLookup.getEntityBlockLayer(blockState);
RenderType renderType = blockState.getBlock() == Blocks.AIR ? Atlases.getEntityTranslucent()
: RenderTypeLookup.getEntityBlockLayer(blockState);
IVertexBuilder vb = buffer.getBuffer(renderType);
MatrixStack ms = new MatrixStack();
@ -200,18 +210,38 @@ public class GuiGameElement {
super.renderModel(blockRenderer, buffer, renderType, vb, ms);
if (blockState.getFluidState().isEmpty())
if (blockState.getFluidState()
.isEmpty())
return;
// TODO fluids are not visible for some reason. See fan washing recipes in JEI for an example use case
for (RenderType type : RenderType.getBlockLayers()) {
if (!RenderTypeLookup.canRenderInLayer(blockState.getFluidState(), type))
continue;
RenderSystem.pushMatrix();
RenderHelper.disableStandardItemLighting();
ClientWorld world = Minecraft.getInstance().world;
if (renderWorld == null || renderWorld.getWorld() != world)
renderWorld = new FluidRenderWorld(world);
for (Direction d : Iterate.directions) {
vb = buffer.getBuffer(type);
blockRenderer.renderFluid(new BlockPos(0, 0, 0), Minecraft.getInstance().world, vb,
blockState.getFluidState());
if (d.getAxisDirection() == AxisDirection.POSITIVE)
continue;
RenderSystem.pushMatrix();
RenderSystem.translated(.5, .5, .5);
RenderSystem.rotatef(AngleHelper.horizontalAngle(d), 0, 1, 0);
RenderSystem.rotatef(AngleHelper.verticalAngle(d) - 90, 0, 0, 1);
RenderSystem.translated(-.5, -.5, -.5);
blockRenderer.renderFluid(new BlockPos(0, 1, 0), renderWorld, vb, blockState.getFluidState());
buffer.draw(type);
RenderSystem.popMatrix();
}
RenderHelper.enable();
RenderSystem.popMatrix();
break;
}
}
@ -248,4 +278,24 @@ public class GuiGameElement {
}
}
private static FluidRenderWorld renderWorld;
private static class FluidRenderWorld extends WrappedWorld {
public FluidRenderWorld(World world) {
super(world);
}
@Override
public int getLightLevel(LightType p_226658_1_, BlockPos p_226658_2_) {
return 15;
}
@Override
public BlockState getBlockState(BlockPos pos) {
return Blocks.AIR.getDefaultState();
}
}
}

View file

@ -3,15 +3,21 @@ package com.simibubi.create.modules.curiosities.symmetry;
import java.util.Random;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import com.simibubi.create.AllItems;
import com.simibubi.create.foundation.utility.AnimationTickHolder;
import com.simibubi.create.modules.curiosities.symmetry.mirror.EmptyMirror;
import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror;
import net.minecraft.block.Blocks;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.player.ClientPlayerEntity;
import net.minecraft.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.Atlases;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
@ -40,7 +46,8 @@ public class SymmetryHandler {
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onBlockPlaced(EntityPlaceEvent event) {
if (event.getWorld().isRemote())
if (event.getWorld()
.isRemote())
return;
if (!(event.getEntity() instanceof PlayerEntity))
return;
@ -48,7 +55,10 @@ public class SymmetryHandler {
PlayerEntity player = (PlayerEntity) event.getEntity();
PlayerInventory inv = player.inventory;
for (int i = 0; i < PlayerInventory.getHotbarSize(); i++) {
if (!inv.getStackInSlot(i).isEmpty() && inv.getStackInSlot(i).getItem() == AllItems.SYMMETRY_WAND.get()) {
if (!inv.getStackInSlot(i)
.isEmpty()
&& inv.getStackInSlot(i)
.getItem() == AllItems.SYMMETRY_WAND.get()) {
SymmetryWandItem.apply(player.world, inv.getStackInSlot(i), player, event.getPos(),
event.getPlacedBlock());
}
@ -57,13 +67,15 @@ public class SymmetryHandler {
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onBlockDestroyed(BreakEvent event) {
if (event.getWorld().isRemote())
if (event.getWorld()
.isRemote())
return;
PlayerEntity player = event.getPlayer();
PlayerInventory inv = player.inventory;
for (int i = 0; i < PlayerInventory.getHotbarSize(); i++) {
if (!inv.getStackInSlot(i).isEmpty() && AllItems.SYMMETRY_WAND.typeOf(inv.getStackInSlot(i))) {
if (!inv.getStackInSlot(i)
.isEmpty() && AllItems.SYMMETRY_WAND.typeOf(inv.getStackInSlot(i))) {
SymmetryWandItem.remove(player.world, inv.getStackInSlot(i), player, event.getPos());
}
}
@ -77,8 +89,10 @@ public class SymmetryHandler {
for (int i = 0; i < PlayerInventory.getHotbarSize(); i++) {
ItemStack stackInSlot = player.inventory.getStackInSlot(i);
if (stackInSlot != null && AllItems.SYMMETRY_WAND.typeOf(stackInSlot)
&& SymmetryWandItem.isEnabled(stackInSlot)) {
if (!AllItems.SYMMETRY_WAND.typeOf(stackInSlot))
continue;
if (!SymmetryWandItem.isEnabled(stackInSlot))
continue;
SymmetryMirror mirror = SymmetryWandItem.getMirror(stackInSlot);
if (mirror instanceof EmptyMirror)
continue;
@ -87,9 +101,11 @@ public class SymmetryHandler {
float yShift = 0;
double speed = 1 / 16d;
yShift = MathHelper.sin((float) ((tickCounter) * speed)) / 5f;
yShift = MathHelper.sin((float) (AnimationTickHolder.getRenderTick() * speed)) / 5f;
IRenderTypeBuffer buffer = Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers();
IRenderTypeBuffer buffer = Minecraft.getInstance()
.getBufferBuilders()
.getEntityVertexConsumers();
ActiveRenderInfo info = mc.gameRenderer.getActiveRenderInfo();
Vec3d view = info.getProjectedView();
@ -98,15 +114,25 @@ public class SymmetryHandler {
ms.translate(-view.getX(), -view.getY(), -view.getZ());
ms.translate(pos.getX(), pos.getY(), pos.getZ());
ms.translate(0, yShift + .2f, 0);
mc.getBlockRendererDispatcher().renderModel(mirror.getModel(), pos, player.world, ms, buffer.getBuffer(Atlases.getEntityTranslucent()),
false, player.world.getRandom(), EmptyModelData.INSTANCE);
mirror.applyModelTransform(ms);
IBakedModel model = mirror.getModel()
.get();
IVertexBuilder builder = buffer.getBuffer(RenderType.getTranslucent());
Minecraft.getInstance().getBufferBuilders().getEntityVertexConsumers().draw(Atlases.getEntityTranslucent());
mc.getBlockRendererDispatcher()
.getBlockModelRenderer()
.renderModel(player.world, model, Blocks.AIR.getDefaultState(), pos, ms, builder, true,
player.world.getRandom(), MathHelper.getPositionRandom(pos), OverlayTexture.DEFAULT_UV,
EmptyModelData.INSTANCE);
Minecraft.getInstance()
.getBufferBuilders()
.getEntityVertexConsumers()
.draw(Atlases.getEntityTranslucent());
ms.pop();
}
}
}
@OnlyIn(Dist.CLIENT)
@SubscribeEvent
@ -138,7 +164,8 @@ public class SymmetryHandler {
double offsetX = (r.nextDouble() - 0.5) * 0.3;
double offsetZ = (r.nextDouble() - 0.5) * 0.3;
Vec3d pos = mirror.getPosition().add(0.5 + offsetX, 1 / 4d, 0.5 + offsetZ);
Vec3d pos = mirror.getPosition()
.add(0.5 + offsetX, 1 / 4d, 0.5 + offsetZ);
Vec3d speed = new Vec3d(0, r.nextDouble() * 1 / 8f, 0);
mc.world.addParticle(ParticleTypes.END_ROD, pos.x, pos.y, pos.z, speed.x, speed.y, speed.z);
}
@ -153,7 +180,8 @@ public class SymmetryHandler {
Vec3d end = new Vec3d(to).add(0.5, 0.5, 0.5);
Vec3d diff = end.subtract(start);
Vec3d step = diff.normalize().scale(density);
Vec3d step = diff.normalize()
.scale(density);
int steps = (int) (diff.length() / step.length());
Random r = new Random();
@ -161,9 +189,8 @@ public class SymmetryHandler {
Vec3d pos = start.add(step.scale(i));
Vec3d speed = new Vec3d(0, r.nextDouble() * -40f, 0);
Minecraft.getInstance().world.addParticle(
new RedstoneParticleData(1, 1, 1, 1),
pos.x, pos.y, pos.z, speed.x, speed.y, speed.z);
Minecraft.getInstance().world.addParticle(new RedstoneParticleData(1, 1, 1, 1), pos.x, pos.y, pos.z,
speed.x, speed.y, speed.z);
}
Vec3d speed = new Vec3d(0, r.nextDouble() * 1 / 32f, 0);

View file

@ -1,12 +1,11 @@
package com.simibubi.create.modules.curiosities.symmetry;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
import com.mojang.blaze3d.systems.RenderSystem;
import com.simibubi.create.AllPackets;
import com.simibubi.create.ScreenResources;
import com.simibubi.create.foundation.gui.AbstractSimiScreen;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.gui.widgets.Label;
import com.simibubi.create.foundation.gui.widgets.ScrollInput;
import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput;
@ -18,18 +17,11 @@ import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror;
import com.simibubi.create.modules.curiosities.symmetry.mirror.SymmetryMirror;
import com.simibubi.create.modules.curiosities.symmetry.mirror.TriplePlaneMirror;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.inventory.container.PlayerContainer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.client.model.data.EmptyModelData;
import net.minecraftforge.fml.network.PacketDistributor;
public class SymmetryWandScreen extends AbstractSimiScreen {
@ -43,7 +35,6 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
private final String orientation = Lang.translate("gui.symmetryWand.orientation");
private SymmetryMirror currentElement;
private float animationProgress;
private ItemStack wand;
private Hand hand;
@ -56,7 +47,6 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
}
this.hand = hand;
this.wand = wand;
animationProgress = 0;
}
@Override
@ -117,12 +107,6 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
widgets.add(areaAlign);
}
@Override
public void tick() {
super.tick();
animationProgress++;
}
@Override
protected void renderWindow(int mouseX, int mouseY, float partialTicks) {
ScreenResources.WAND_SYMMETRY.draw(this, guiLeft, guiTop);
@ -133,54 +117,32 @@ public class SymmetryWandScreen extends AbstractSimiScreen {
font.drawString(mirrorType, x - 5, y, ScreenResources.FONT_COLOR);
font.drawString(orientation, x - 5, y + 20, ScreenResources.FONT_COLOR);
minecraft.getTextureManager()
.bindTexture(PlayerContainer.BLOCK_ATLAS_TEXTURE);
RenderSystem.enableBlend();
renderBlock();
renderBlock();
RenderSystem.pushLightingAttributes();
RenderSystem.pushMatrix();
RenderHelper.enable();
RenderSystem.enableBlend();
RenderSystem.enableRescaleNormal();
RenderSystem.enableAlphaTest();
RenderSystem.alphaFunc(516, 0.1F);
RenderSystem.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderSystem.translated((this.width - this.sWidth) / 2 + 250, this.height / 2 + this.sHeight / 2, 100);
RenderSystem.rotatef(-30, .4f, 0, -.2f);
RenderSystem.rotatef(90 + 0.2f * animationProgress, 0, 1, 0);
RenderSystem.scaled(100, -100, 100);
itemRenderer.renderItem(wand, TransformType.NONE, 0xF000F0, OverlayTexture.DEFAULT_UV, new MatrixStack(),
Minecraft.getInstance()
.getBufferBuilders()
.getEntityVertexConsumers());
RenderSystem.disableAlphaTest();
RenderSystem.disableRescaleNormal();
RenderSystem.disableLighting();
RenderSystem.translated(0, 0, 200);
RenderSystem.rotatef(-20, -3.5f, 1, 1);
GuiGameElement.of(wand)
.at(guiLeft + 220, guiTop + 220)
.scale(4)
.render();
RenderSystem.popMatrix();
RenderSystem.popAttributes();
}
protected void renderBlock() {
MatrixStack ms = new MatrixStack();
IRenderTypeBuffer buffer = Minecraft.getInstance()
.getBufferBuilders()
.getEntityVertexConsumers();
RenderSystem.pushMatrix();
ms.translate(guiLeft + 15, guiTop - 117, 20);
MatrixStack ms = new MatrixStack();
ms.translate(guiLeft + 18, guiTop + 11, 20);
ms.multiply(new Vector3f(.3f, 1f, 0f).getDegreesQuaternion(-22.5f));
ms.scale(32, -32, 32);
ms.translate(0, -5, 0);
minecraft.getBlockRendererDispatcher()
.renderBlock(currentElement.getModel(), ms, buffer, 0xF000F0, OverlayTexture.DEFAULT_UV,
EmptyModelData.INSTANCE);
currentElement.applyModelTransform(ms);
RenderSystem.multMatrix(ms.peek()
.getModel());
GuiGameElement.of(currentElement.getModel())
.render();
RenderSystem.popMatrix();
}
@Override

View file

@ -1,27 +0,0 @@
package com.simibubi.create.modules.curiosities.symmetry.block;
import com.simibubi.create.modules.curiosities.symmetry.mirror.CrossPlaneMirror;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer.Builder;
public class CrossPlaneSymmetryBlock extends SymmetryBlock {
public static final EnumProperty<CrossPlaneMirror.Align> align = EnumProperty.create("align",
CrossPlaneMirror.Align.class);
public CrossPlaneSymmetryBlock() {
super(Properties.create(Material.AIR));
this.setDefaultState(getDefaultState().with(align, CrossPlaneMirror.Align.Y));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(align);
super.fillStateContainer(builder);
}
}

View file

@ -1,26 +0,0 @@
package com.simibubi.create.modules.curiosities.symmetry.block;
import com.simibubi.create.modules.curiosities.symmetry.mirror.PlaneMirror;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer.Builder;
public class PlaneSymmetryBlock extends SymmetryBlock {
public static final EnumProperty<PlaneMirror.Align> align = EnumProperty.create("align", PlaneMirror.Align.class);
public PlaneSymmetryBlock() {
super(Properties.create(Material.AIR));
this.setDefaultState(getDefaultState().with(align, PlaneMirror.Align.XY));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(align);
super.fillStateContainer(builder);
}
}

View file

@ -1,13 +0,0 @@
package com.simibubi.create.modules.curiosities.symmetry.block;
import com.simibubi.create.foundation.block.IRenderUtilityBlock;
import net.minecraft.block.Block;
public class SymmetryBlock extends Block implements IRenderUtilityBlock {
public SymmetryBlock(Properties properties) {
super(properties.noDrops());
}
}

View file

@ -1,12 +0,0 @@
package com.simibubi.create.modules.curiosities.symmetry.block;
import net.minecraft.block.material.Material;
public class TriplePlaneSymmetryBlock extends SymmetryBlock {
public TriplePlaneSymmetryBlock() {
super(Properties.create(Material.AIR));
}
}

View file

@ -5,9 +5,10 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.curiosities.symmetry.block.CrossPlaneSymmetryBlock;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
@ -84,9 +85,16 @@ public class CrossPlaneMirror extends SymmetryMirror {
}
@Override
public BlockState getModel() {
return AllBlocks.SYMMETRY_CROSSPLANE.get().getDefaultState().with(CrossPlaneSymmetryBlock.align,
(Align) orientation);
public AllBlockPartials getModel() {
return AllBlockPartials.SYMMETRY_CROSSPLANE;
}
@Override
public void applyModelTransform(MatrixStack ms) {
super.applyModelTransform(ms);
ms.translate(.5, .5, .5);
ms.multiply(VecHelper.rotateY(((Align) orientation) == Align.Y ? 0 : 45));
ms.translate(-.5, -.5, -.5);
}
@Override

View file

@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlockPartials;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
@ -48,7 +49,7 @@ public class EmptyMirror extends SymmetryMirror {
}
@Override
public BlockState getModel() {
public AllBlockPartials getModel() {
return null;
}

View file

@ -5,9 +5,10 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.modules.curiosities.symmetry.block.PlaneSymmetryBlock;
import com.simibubi.create.foundation.utility.VecHelper;
import net.minecraft.block.BlockState;
import net.minecraft.util.IStringSerializable;
@ -80,8 +81,16 @@ public class PlaneMirror extends SymmetryMirror {
}
@Override
public BlockState getModel() {
return AllBlocks.SYMMETRY_PLANE.get().getDefaultState().with(PlaneSymmetryBlock.align, (Align) orientation);
public AllBlockPartials getModel() {
return AllBlockPartials.SYMMETRY_PLANE;
}
@Override
public void applyModelTransform(MatrixStack ms) {
super.applyModelTransform(ms);
ms.translate(.5, .5, .5);
ms.multiply(VecHelper.rotateY(((Align) orientation) == Align.XY ? 0 : 90));
ms.translate(-.5, -.5, -.5);
}
@Override

View file

@ -5,6 +5,8 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState;
@ -77,7 +79,9 @@ public abstract class SymmetryMirror {
public abstract String typeName();
public abstract BlockState getModel();
public abstract AllBlockPartials getModel();
public void applyModelTransform(MatrixStack ms) {}
private static final String $ORIENTATION = "direction";
private static final String $POSITION = "pos";
@ -126,7 +130,8 @@ public abstract class SymmetryMirror {
}
protected Vec3d getDiff(BlockPos position) {
return this.position.scale(-1).add(position.getX(), position.getY(), position.getZ());
return this.position.scale(-1)
.add(position.getX(), position.getY(), position.getZ());
}
protected BlockPos getIDiff(BlockPos position) {
@ -160,11 +165,13 @@ public abstract class SymmetryMirror {
}
protected BlockState flipD1(BlockState in) {
return in.rotate(Rotation.COUNTERCLOCKWISE_90).mirror(Mirror.FRONT_BACK);
return in.rotate(Rotation.COUNTERCLOCKWISE_90)
.mirror(Mirror.FRONT_BACK);
}
protected BlockState flipD2(BlockState in) {
return in.rotate(Rotation.COUNTERCLOCKWISE_90).mirror(Mirror.LEFT_RIGHT);
return in.rotate(Rotation.COUNTERCLOCKWISE_90)
.mirror(Mirror.LEFT_RIGHT);
}
protected BlockPos flipX(BlockPos position) {

View file

@ -5,7 +5,7 @@ import java.util.List;
import java.util.Map;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllBlockPartials;
import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.block.BlockState;
@ -42,8 +42,8 @@ public class TriplePlaneMirror extends SymmetryMirror {
}
@Override
public BlockState getModel() {
return AllBlocks.SYMMETRY_TRIPLEPLANE.get().getDefaultState();
public AllBlockPartials getModel() {
return AllBlockPartials.SYMMETRY_TRIPLEPLANE;
}
@Override

View file

@ -1,7 +0,0 @@
{
"forgemarker": 1,
"variants": {
"align=y": { "model": "create:block/symmetry_crossplane"},
"align=d": { "model": "create:block/symmetry_crossplane_diagonal"}
}
}

View file

@ -1,6 +0,0 @@
{
"variants": {
"align=xy": { "model": "create:block/symmetry_plane" },
"align=yz": { "model": "create:block/symmetry_plane", "y": 90 }
}
}

View file

@ -1,5 +0,0 @@
{
"variants": {
"": { "model": "create:block/symmetry_tripleplane" }
}
}

View file

@ -1,148 +0,0 @@
{
"__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
"textures": {
"0": "block/white_stained_glass",
"1": "block/obsidian",
"2": "block/packed_ice"
},
"elements": [
{
"name": "Mirror",
"from": [ 4.0, 1.0, 7.500000007450581 ],
"to": [ 7.0, 12.0, 8.50000000745058 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
"faces": {
"north": { "texture": "#0", "uv": [ 4.0, 1.0, 7.0, 12.0 ] },
"east": { "texture": "#0", "uv": [ 3.0, 1.0, 4.0, 12.0 ] },
"south": { "texture": "#0", "uv": [ 4.0, 1.0, 7.0, 12.0 ] },
"west": { "texture": "#0", "uv": [ 12.0, 1.0, 13.0, 12.0 ] },
"up": { "texture": "#0", "uv": [ 4.0, 1.0, 7.0, 2.0 ] },
"down": { "texture": "#0", "uv": [ 4.0, 14.0, 7.0, 15.0 ] }
}
},
{
"name": "rod_left_bottom",
"from": [ 1.2000000029802322, 3.0, 7.0 ],
"to": [ 3.2000000029802322, 4.0, 9.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 },
"faces": {
"north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
"down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
}
},
{
"name": "rod_left_top",
"from": [ 1.2000000029802322, 12.0, 7.0 ],
"to": [ 3.2000000029802322, 13.0, 9.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 },
"faces": {
"north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
"down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
}
},
{
"name": "rod_left",
"from": [ 2.0, 4.0, 7.499999992549419 ],
"to": [ 3.0, 12.0, 8.49999999254942 ],
"shade": false,
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 },
"faces": {
"north": { "texture": "#2", "uv": [ 3.0, 1.0, 4.0, 9.0 ] },
"east": { "texture": "#2", "uv": [ 3.0, 0.0, 4.0, 8.0 ] },
"south": { "texture": "#2", "uv": [ 3.0, 1.0, 4.0, 9.0 ] },
"west": { "texture": "#2", "uv": [ 5.0, 1.0, 6.0, 9.0 ] }
}
},
{
"name": "rod_right_bottom",
"from": [ 12.799999997019768, 3.0, 7.0 ],
"to": [ 14.799999997019768, 4.0, 9.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 },
"faces": {
"north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
"down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
}
},
{
"name": "rod_right",
"from": [ 13.0, 4.0, 7.499999992549419 ],
"to": [ 14.0, 12.0, 8.49999999254942 ],
"shade": false,
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 },
"faces": {
"north": { "texture": "#2", "uv": [ 3.0, 2.0, 4.0, 10.0 ] },
"east": { "texture": "#2", "uv": [ 3.0, 3.0, 4.0, 11.0 ] },
"south": { "texture": "#2", "uv": [ 4.0, 3.0, 5.0, 11.0 ] },
"west": { "texture": "#2", "uv": [ 5.0, 0.0, 6.0, 8.0 ] }
}
},
{
"name": "rod_right_top",
"from": [ 12.799999997019768, 12.0, 7.0 ],
"to": [ 14.799999997019768, 13.0, 9.0 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 22.5 },
"faces": {
"north": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"east": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"south": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"west": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 1.0 ] },
"up": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] },
"down": { "texture": "#1", "uv": [ 0.0, 0.0, 2.0, 2.0 ] }
}
},
{
"name": "CrossMirror",
"from": [ 7.499999992549419, 4.0, 9.50000000745058 ],
"to": [ 8.49999999254942, 15.0, 12.50000000745058 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
"faces": {
"north": { "texture": "#0", "uv": [ 4.0, 1.0, 5.0, 12.0 ] },
"east": { "texture": "#0", "uv": [ 3.0, 1.0, 6.0, 12.0 ] },
"south": { "texture": "#0", "uv": [ 4.0, 1.0, 5.0, 12.0 ] },
"west": { "texture": "#0", "uv": [ 9.0, 1.0, 12.0, 12.0 ] },
"up": { "texture": "#0", "uv": [ 3.0, 3.0, 4.0, 6.0 ] },
"down": { "texture": "#0", "uv": [ 5.0, 9.0, 6.0, 12.0 ] }
}
},
{
"name": "Mirror II",
"from": [ 9.0, 3.0, 7.500000007450581 ],
"to": [ 12.0, 14.0, 8.50000000745058 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
"faces": {
"north": { "texture": "#0", "uv": [ 4.0, 1.0, 7.0, 12.0 ] },
"east": { "texture": "#0", "uv": [ 3.0, 1.0, 4.0, 12.0 ] },
"south": { "texture": "#0", "uv": [ 4.0, 1.0, 7.0, 12.0 ] },
"west": { "texture": "#0", "uv": [ 12.0, 1.0, 13.0, 12.0 ] },
"up": { "texture": "#0", "uv": [ 4.0, 1.0, 7.0, 2.0 ] },
"down": { "texture": "#0", "uv": [ 4.0, 14.0, 7.0, 15.0 ] }
}
},
{
"name": "CrossMirror II",
"from": [ 7.499999992549419, 2.0, 3.5000000074505806 ],
"to": [ 8.49999999254942, 13.0, 6.500000007450581 ],
"rotation": { "origin": [ 8.0, 8.0, 8.0 ], "axis": "y", "angle": 45.0 },
"faces": {
"north": { "texture": "#0", "uv": [ 4.0, 1.0, 5.0, 12.0 ] },
"east": { "texture": "#0", "uv": [ 3.0, 1.0, 6.0, 12.0 ] },
"south": { "texture": "#0", "uv": [ 4.0, 3.0, 5.0, 14.0 ] },
"west": { "texture": "#0", "uv": [ 9.0, 2.0, 12.0, 13.0 ] },
"up": { "texture": "#0", "uv": [ 4.0, 3.0, 5.0, 6.0 ] },
"down": { "texture": "#0", "uv": [ 4.0, 8.0, 5.0, 11.0 ] }
}
}
]
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB