Motion commotion

- Update recipe for redstone contact
- Counteracted ejector inaccuracies caused by deferred activation
- Rewired ponder vertex sorting to evade Optifine incompatibilities
This commit is contained in:
simibubi 2021-03-28 00:45:14 +01:00
parent d28e60a059
commit fcae7e5c9a
8 changed files with 58 additions and 73 deletions

View file

@ -2914,7 +2914,7 @@ fc75c87159569cb6ee978e6d51b0c3b0f504b5de data/create/recipes/crafting/logistics/
a32ac53848862837f3044ff9c81ed62c1134fe4f data/create/recipes/crafting/logistics/powered_latch.json
660eb73bcc66c1528cbd4d4204ad6b771f4bd721 data/create/recipes/crafting/logistics/powered_toggle_latch.json
74b8a38d252cce564cc63db2ade41ed2d656d025 data/create/recipes/crafting/logistics/pulse_repeater.json
bb73dac60392f4811df033c3d1d3256df5e022af data/create/recipes/crafting/logistics/redstone_contact.json
739f0d8b7f98a5639ed37f7fb8ce474d5e6ba0c6 data/create/recipes/crafting/logistics/redstone_contact.json
bc511f7c225750743ae3e985502fa65beb1e7b8d data/create/recipes/crafting/logistics/redstone_link.json
10b16358664f2bb8a11589ef8ba3d69ee8d3b9fc data/create/recipes/crafting/logistics/stockpile_switch.json
0dc99b8a8c68d6a9250c3a1167ffb565be9622ec data/create/recipes/crafting/materials/andesite_alloy.json

View file

@ -1,19 +1,19 @@
{
"type": "minecraft:crafting_shaped",
"pattern": [
"WDW",
" S ",
"WDW"
"CWC",
"CCC"
],
"key": {
"W": {
"tag": "forge:dusts/redstone"
},
"D": {
"item": "create:brass_casing"
"C": {
"item": "minecraft:cobblestone"
},
"S": {
"tag": "forge:ingots/iron"
"tag": "forge:plates/iron"
}
},
"result": {

View file

@ -480,15 +480,16 @@ public class AllBlocks {
.item()
.transform(customItemModel("_", "block"))
.register();
public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR = REGISTRATE.block("weighted_ejector", EjectorBlock::new)
.initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque)
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180))
.transform(StressConfigDefaults.setImpact(2.0))
.item(EjectorItem::new)
.transform(customItemModel())
.register();
public static final BlockEntry<EjectorBlock> WEIGHTED_EJECTOR =
REGISTRATE.block("weighted_ejector", EjectorBlock::new)
.initialProperties(SharedProperties::stone)
.properties(Block.Properties::nonOpaque)
.blockstate((c, p) -> p.horizontalBlock(c.getEntry(), AssetLookup.partialBaseModel(c, p), 180))
.transform(StressConfigDefaults.setImpact(2.0))
.item(EjectorItem::new)
.transform(customItemModel())
.register();
public static final BlockEntry<ChuteBlock> CHUTE = REGISTRATE.block("chute", ChuteBlock::new)
.initialProperties(SharedProperties::softMetal)
@ -906,6 +907,15 @@ public class AllBlocks {
.transform(customItemModel())
.register();
public static final BlockEntry<RedstoneContactBlock> REDSTONE_CONTACT =
REGISTRATE.block("redstone_contact", RedstoneContactBlock::new)
.initialProperties(SharedProperties::stone)
.onRegister(addMovementBehaviour(new ContactMovementBehaviour()))
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
.item()
.transform(customItemModel("_", "block"))
.register();
public static final BlockEntry<HarvesterBlock> MECHANICAL_HARVESTER =
REGISTRATE.block("mechanical_harvester", HarvesterBlock::new)
.initialProperties(SharedProperties::stone)
@ -1150,15 +1160,6 @@ public class AllBlocks {
.onRegister(connectedTextures(new BrassTunnelCTBehaviour()))
.register();
public static final BlockEntry<RedstoneContactBlock> REDSTONE_CONTACT =
REGISTRATE.block("redstone_contact", RedstoneContactBlock::new)
.initialProperties(SharedProperties::stone)
.onRegister(addMovementBehaviour(new ContactMovementBehaviour()))
.blockstate((c, p) -> p.directionalBlock(c.get(), AssetLookup.forPowered(c, p)))
.item()
.transform(customItemModel("_", "block"))
.register();
public static final BlockEntry<ContentObserverBlock> CONTENT_OBSERVER =
REGISTRATE.block("content_observer", ContentObserverBlock::new)
.initialProperties(SharedProperties::stone)

View file

@ -302,22 +302,27 @@ public class EjectorTileEntity extends KineticTileEntity {
}
if (state == State.RETRACTING) {
lidProgress.updateChaseSpeed(0);
if (lidProgress.getValue() == 0 && doLogic) {
state = State.CHARGED;
lidProgress.setValue(0);
sendData();
if (lidProgress.getChaseTarget() == 1 && !lidProgress.settled()) {
lidProgress.tickChaser();
} else {
lidProgress.updateChaseTarget(0);
lidProgress.updateChaseSpeed(0);
if (lidProgress.getValue() == 0 && doLogic) {
state = State.CHARGED;
lidProgress.setValue(0);
sendData();
}
float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1);
lidProgress.setValue(value);
int soundRate = (int) (1 / (getWindUpSpeed() * 5)) + 1;
float volume = .125f;
float pitch = 1.5f - lidProgress.getValue();
if (((int) world.getGameTime()) % soundRate == 0 && doLogic)
world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume,
pitch);
}
float value = MathHelper.clamp(lidProgress.getValue() - getWindUpSpeed(), 0, 1);
lidProgress.setValue(value);
int soundRate = (int) (1 / (getWindUpSpeed() * 5)) + 1;
float volume = .125f;
float pitch = 1.5f - lidProgress.getValue();
if (((int) world.getGameTime()) % soundRate == 0 && doLogic)
world.playSound(null, pos, SoundEvents.BLOCK_WOODEN_BUTTON_CLICK_OFF, SoundCategory.BLOCKS, volume,
pitch);
}
if (state != prevState)
@ -509,10 +514,6 @@ public class EjectorTileEntity extends KineticTileEntity {
public void setTarget(int horizontalDistance, int verticalDistance) {
launcher.set(Math.max(1, horizontalDistance), verticalDistance);
if (horizontalDistance == 0 && verticalDistance == 0) {
state = State.CHARGED;
lidProgress.startWithValue(0);
}
sendData();
}

View file

@ -36,7 +36,7 @@ public class EntityLauncher {
public void applyMotion(Entity entity, Direction facing) {
Vec3d motionVec = new Vec3d(0, yMotion, xMotion);
motionVec = VecHelper.rotate(motionVec, AngleHelper.horizontalAngle(facing), Axis.Y);
entity.setMotion(motionVec.x, motionVec.y, motionVec.z);
entity.setMotion(motionVec.x * .91, motionVec.y * .98, motionVec.z * .91);
}
public int getHorizontalDistance() {

View file

@ -790,11 +790,11 @@ public class StandardRecipeGen extends CreateRecipeProvider {
REDSTONE_CONTACT = create(AllBlocks.REDSTONE_CONTACT).returns(2)
.unlockedBy(I::brassCasing)
.viaShaped(b -> b.key('W', I.redstone())
.key('D', I.brassCasing())
.key('S', I.iron())
.patternLine("WDW")
.key('C', Blocks.COBBLESTONE)
.key('S', I.ironSheet())
.patternLine(" S ")
.patternLine("WDW")),
.patternLine("CWC")
.patternLine("CCC")),
ANDESITE_FUNNEL = create(AllBlocks.ANDESITE_FUNNEL).returns(2)
.unlockedBy(I::andesite)

View file

@ -369,7 +369,6 @@ public class PonderUI extends NavigatableSimiScreen {
}
protected void renderVisibleScenes(int mouseX, int mouseY, float partialTicks) {
SuperRenderTypeBuffer.vertexSortingOrigin = new BlockPos(0, 0, 800);
renderScene(mouseX, mouseY, index, partialTicks);
float lazyIndexValue = lazyIndex.getValue(partialTicks);
if (Math.abs(lazyIndexValue - index) > 1 / 512f)
@ -388,13 +387,21 @@ public class PonderUI extends NavigatableSimiScreen {
RenderSystem.enableBlend();
RenderSystem.enableDepthTest();
RenderSystem.pushMatrix();
// has to be outside of MS transforms, important for vertex sorting
RenderSystem.translated(0, 0, 800);
ms.push();
ms.translate(0, 0, -800);
story.transform.updateScreenParams(width, height, slide);
story.transform.apply(ms, partialTicks, false);
story.transform.updateSceneRVE(partialTicks);
story.renderScene(buffer, ms, partialTicks);
buffer.draw();
RenderSystem.popMatrix();
MutableBoundingBox bounds = story.getBounds();
RenderSystem.pushMatrix();
RenderSystem.multMatrix(ms.peek()
@ -933,10 +940,4 @@ public class PonderUI extends NavigatableSimiScreen {
skipCooling = 15;
}
@Override
public void removed() {
super.removed();
SuperRenderTypeBuffer.vertexSortingOrigin = BlockPos.ZERO;
}
}

View file

@ -1,7 +1,5 @@
package com.simibubi.create.foundation.renderState;
import java.util.Objects;
import java.util.Optional;
import java.util.SortedMap;
import com.mojang.blaze3d.systems.RenderSystem;
@ -15,11 +13,9 @@ import net.minecraft.client.renderer.RegionRenderCacheBuilder;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
public class SuperRenderTypeBuffer implements IRenderTypeBuffer {
public static BlockPos vertexSortingOrigin = BlockPos.ZERO;
static SuperRenderTypeBuffer instance;
public static SuperRenderTypeBuffer getInstance() {
@ -100,20 +96,6 @@ public class SuperRenderTypeBuffer implements IRenderTypeBuffer {
super(new BufferBuilder(256), createEntityBuilders());
}
public void draw(RenderType p_228462_1_) {
BlockPos v = vertexSortingOrigin;
BufferBuilder bufferbuilder = layerBuffers.getOrDefault(p_228462_1_, this.fallbackBuffer);
boolean flag = Objects.equals(this.currentLayer, p_228462_1_.asOptional());
if (flag || bufferbuilder != this.fallbackBuffer) {
if (this.activeConsumers.remove(bufferbuilder)) {
p_228462_1_.draw(bufferbuilder, v.getX(), v.getY(), v.getZ());
if (flag) {
this.currentLayer = Optional.empty();
}
}
}
}
}
}