mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-27 23:47:38 +01:00
Defer. Everything.
- Millstone now accepts items from belts/ejectors directly - Fixed Redstone-triggered components losing tile data after moved by a Contraption - Super glue between non-solids can now be removed while the glue item is equipped - Fixed Deployers not able to interact with glued blocks - Fixed incorrect lang mapping of UI button descriptions - Placement assist block preview now lights properly, doesn't z-fight and fades in gradually - Pickaxe and Axe are now effective on piston extension poles - Fixed block breaking animations inside the ponder UI - Fixed Ponder Scenes rendering on top of the progress bar - Fixed Mechanical Press not retracting when items were removed early - Fixed Windmill Bearings allowing to be moved while assembled - Mechanical Pistons now silence the "missing poles" error after poles were added
This commit is contained in:
parent
13f0823ccb
commit
2fc26f1112
18 changed files with 222 additions and 52 deletions
|
@ -1,9 +1,12 @@
|
|||
package com.simibubi.create.content.contraptions.components.millstone;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.simibubi.create.AllRecipeTypes;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour;
|
||||
import com.simibubi.create.foundation.utility.VecHelper;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
|
@ -39,6 +42,12 @@ public class MillstoneTileEntity extends KineticTileEntity {
|
|||
capability = LazyOptional.of(MillstoneInventoryHandler::new);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
|
||||
behaviours.add(new DirectBeltInputBehaviour(this));
|
||||
super.addBehaviours(behaviours);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
|
|
@ -24,7 +24,6 @@ import com.simibubi.create.foundation.utility.VecHelper;
|
|||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.ItemEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
@ -188,6 +187,9 @@ public class MechanicalPressTileEntity extends BasinOperatingTileEntity {
|
|||
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION_ON_BELT.playOnServer(world, pos);
|
||||
else
|
||||
AllSoundEvents.MECHANICAL_PRESS_ACTIVATION.playOnServer(world, pos);
|
||||
|
||||
if (!world.isRemote)
|
||||
sendData();
|
||||
}
|
||||
|
||||
if (!world.isRemote && runningTicks > CYCLE) {
|
||||
|
|
|
@ -13,6 +13,8 @@ import com.simibubi.create.content.contraptions.components.structureMovement.bea
|
|||
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingTileEntity;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.SailBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingTileEntity;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerBlock;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock;
|
||||
|
@ -88,6 +90,11 @@ public class BlockMovementTraits {
|
|||
if (te instanceof MechanicalBearingTileEntity)
|
||||
return !((MechanicalBearingTileEntity) te).isRunning();
|
||||
}
|
||||
if (block instanceof WindmillBearingBlock) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if (te instanceof WindmillBearingTileEntity)
|
||||
return !((WindmillBearingTileEntity) te).isRunning();
|
||||
}
|
||||
if (block instanceof ClockworkBearingBlock) {
|
||||
TileEntity te = world.getTileEntity(pos);
|
||||
if (te instanceof ClockworkBearingTileEntity)
|
||||
|
|
|
@ -58,6 +58,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
@ -185,7 +186,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
if (!isValidFace(world, pos2, getFacingDirection())
|
||||
&& !isValidFace(world, pos, getFacingDirection().getOpposite()))
|
||||
return false;
|
||||
if (isSideSticky(world, pos2, getFacingDirection()) || isSideSticky(world, pos, getFacingDirection().getOpposite()))
|
||||
if (isSideSticky(world, pos2, getFacingDirection())
|
||||
|| isSideSticky(world, pos, getFacingDirection().getOpposite()))
|
||||
return false;
|
||||
return world.getEntitiesInAABBexcluding(this, getBoundingBox(), e -> e instanceof SuperGlueEntity)
|
||||
.isEmpty();
|
||||
|
@ -227,7 +229,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
|
||||
if (state.getBlock() instanceof AbstractChassisBlock) {
|
||||
BooleanProperty glueableSide = ((AbstractChassisBlock) state.getBlock()).getGlueableSide(state, direction);
|
||||
if (glueableSide == null) return false;
|
||||
if (glueableSide == null)
|
||||
return false;
|
||||
return state.get(glueableSide);
|
||||
}
|
||||
|
||||
|
@ -255,7 +258,13 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
public boolean attackEntityFrom(DamageSource source, float amount) {
|
||||
if (this.isInvulnerableTo(source))
|
||||
return false;
|
||||
if (isAlive() && !world.isRemote && isVisible()) {
|
||||
Entity immediateSource = source.getImmediateSource();
|
||||
if (!isVisible() && immediateSource instanceof PlayerEntity) {
|
||||
if (!AllItems.SUPER_GLUE.isIn(((PlayerEntity) immediateSource).getHeldItemMainhand()))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isAlive() && !world.isRemote) {
|
||||
remove();
|
||||
markVelocityChanged();
|
||||
onBroken(source.getTrueSource());
|
||||
|
@ -297,6 +306,8 @@ public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnDat
|
|||
|
||||
@Override
|
||||
public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) {
|
||||
if (player instanceof FakePlayer)
|
||||
return ActionResultType.PASS;
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
|
||||
triggerPlaceBlock(player, hand);
|
||||
});
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.components.structureMovement.piston;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllBlocks;
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllSoundEvents;
|
||||
|
@ -30,6 +32,7 @@ import net.minecraft.util.math.shapes.VoxelShapes;
|
|||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.common.Tags;
|
||||
|
||||
public class MechanicalPistonBlock extends DirectionalAxisKineticBlock implements ITE<MechanicalPistonTileEntity> {
|
||||
|
@ -97,6 +100,35 @@ public class MechanicalPistonBlock extends DirectionalAxisKineticBlock implement
|
|||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState state, World world, BlockPos pos, Block p_220069_4_, BlockPos fromPos,
|
||||
boolean p_220069_6_) {
|
||||
Direction direction = state.get(FACING);
|
||||
if (!fromPos.equals(pos.offset(direction.getOpposite())))
|
||||
return;
|
||||
if (!world.isRemote && !world.getPendingBlockTicks()
|
||||
.isTickPending(pos, this))
|
||||
world.getPendingBlockTicks()
|
||||
.scheduleTick(pos, this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random r) {
|
||||
Direction direction = state.get(FACING);
|
||||
BlockState pole = worldIn.getBlockState(pos.offset(direction.getOpposite()));
|
||||
if (!AllBlocks.PISTON_EXTENSION_POLE.has(pole))
|
||||
return;
|
||||
if (pole.get(PistonExtensionPoleBlock.FACING)
|
||||
.getAxis() != direction.getAxis())
|
||||
return;
|
||||
withTileEntityDo(worldIn, pos, te -> {
|
||||
if (te.lastException == null)
|
||||
return;
|
||||
te.lastException = null;
|
||||
te.sendData();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||
return AllTileEntities.MECHANICAL_PISTON.create();
|
||||
|
|
|
@ -41,6 +41,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ToolType;
|
||||
|
||||
public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements IWrenchable, IWaterLoggable {
|
||||
|
||||
|
@ -51,6 +52,26 @@ public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements
|
|||
setDefaultState(getDefaultState().with(FACING, Direction.UP).with(BlockStateProperties.WATERLOGGED, false));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToolType getHarvestTool(BlockState state) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHarvestBlock(BlockState state, IBlockReader world, BlockPos pos, PlayerEntity player) {
|
||||
for (ToolType toolType : player.getHeldItemMainhand()
|
||||
.getToolTypes()) {
|
||||
if (isToolEffective(state, toolType))
|
||||
return true;
|
||||
}
|
||||
return super.canHarvestBlock(state, world, pos, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isToolEffective(BlockState state, ToolType tool) {
|
||||
return tool == ToolType.AXE || tool == ToolType.PICKAXE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PushReaction getPushReaction(BlockState state) {
|
||||
return PushReaction.NORMAL;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.contraptions.relays.advanced.sequencer;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllItems;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock;
|
||||
|
@ -29,6 +31,7 @@ import net.minecraft.util.math.BlockRayTraceResult;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
@ -62,7 +65,14 @@ public class SequencedGearshiftBlock extends HorizontalAxisKineticBlock implemen
|
|||
boolean isMoving) {
|
||||
if (worldIn.isRemote)
|
||||
return;
|
||||
if (!worldIn.getPendingBlockTicks()
|
||||
.isTickPending(pos, this))
|
||||
worldIn.getPendingBlockTicks()
|
||||
.scheduleTick(pos, this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random r) {
|
||||
boolean previouslyPowered = state.get(STATE) != 0;
|
||||
boolean isPowered = worldIn.isBlockPowered(pos);
|
||||
withTileEntityDo(worldIn, pos, sgte -> sgte.onRedstoneUpdate(isPowered, previouslyPowered));
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.logistics.block.chute;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
|
@ -13,6 +15,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class SmartChuteBlock extends AbstractChuteBlock {
|
||||
|
||||
|
@ -29,6 +32,14 @@ public class SmartChuteBlock extends AbstractChuteBlock {
|
|||
super.neighborChanged(state, worldIn, pos, blockIn, fromPos, isMoving);
|
||||
if (worldIn.isRemote)
|
||||
return;
|
||||
if (!worldIn.getPendingBlockTicks()
|
||||
.isTickPending(pos, this))
|
||||
worldIn.getPendingBlockTicks()
|
||||
.scheduleTick(pos, this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random r) {
|
||||
boolean previouslyPowered = state.get(POWERED);
|
||||
if (previouslyPowered != worldIn.isBlockPowered(pos))
|
||||
worldIn.setBlockState(pos, state.cycle(POWERED), 2);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.logistics.block.funnel;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
|
@ -25,6 +27,7 @@ import net.minecraft.util.math.BlockPos;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
@ -68,6 +71,14 @@ public abstract class AbstractFunnelBlock extends Block implements ITE<FunnelTil
|
|||
InvManipulationBehaviour behaviour = TileEntityBehaviour.get(worldIn, pos, InvManipulationBehaviour.TYPE);
|
||||
if (behaviour != null)
|
||||
behaviour.onNeighborChanged(fromPos);
|
||||
if (!worldIn.getPendingBlockTicks()
|
||||
.isTickPending(pos, this))
|
||||
worldIn.getPendingBlockTicks()
|
||||
.scheduleTick(pos, this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random r) {
|
||||
boolean previouslyPowered = state.get(POWERED);
|
||||
if (previouslyPowered != worldIn.isBlockPowered(pos))
|
||||
worldIn.setBlockState(pos, state.cycle(POWERED), 2);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.logistics.block.redstone;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
|
@ -26,6 +28,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class NixieTubeBlock extends HorizontalBlock implements ITE<NixieTubeTileEntity> {
|
||||
|
||||
|
@ -116,13 +119,25 @@ public class NixieTubeBlock extends HorizontalBlock implements ITE<NixieTubeTile
|
|||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(BlockState p_220069_1_, World p_220069_2_, BlockPos p_220069_3_, Block p_220069_4_,
|
||||
BlockPos p_220069_5_, boolean p_220069_6_) {
|
||||
updateDisplayedRedstoneValue(p_220069_1_, p_220069_2_, p_220069_3_);
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block p_220069_4_, BlockPos p_220069_5_,
|
||||
boolean p_220069_6_) {
|
||||
if (worldIn.isRemote)
|
||||
return;
|
||||
if (!worldIn.getPendingBlockTicks()
|
||||
.isTickPending(pos, this))
|
||||
worldIn.getPendingBlockTicks()
|
||||
.scheduleTick(pos, this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random r) {
|
||||
updateDisplayedRedstoneValue(state, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
if (state.getBlock() == oldState.getBlock() || isMoving)
|
||||
return;
|
||||
updateDisplayedRedstoneValue(state, worldIn, pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simibubi.create.content.logistics.block.redstone;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.simibubi.create.AllShapes;
|
||||
import com.simibubi.create.AllTileEntities;
|
||||
import com.simibubi.create.foundation.block.ITE;
|
||||
|
@ -26,6 +28,7 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||
import net.minecraft.world.IBlockReader;
|
||||
import net.minecraft.world.IWorldReader;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
|
||||
public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE<RedstoneLinkTileEntity> {
|
||||
|
||||
|
@ -41,8 +44,10 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE<Red
|
|||
@Override
|
||||
public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos,
|
||||
boolean isMoving) {
|
||||
Direction blockFacing = state.get(FACING);
|
||||
if (worldIn.isRemote)
|
||||
return;
|
||||
|
||||
Direction blockFacing = state.get(FACING);
|
||||
if (fromPos.equals(pos.offset(blockFacing.getOpposite()))) {
|
||||
if (!isValidPosition(state, worldIn, pos)) {
|
||||
worldIn.destroyBlock(pos, true);
|
||||
|
@ -50,17 +55,25 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE<Red
|
|||
}
|
||||
}
|
||||
|
||||
updateTransmittedSignal(state, worldIn, pos, blockFacing);
|
||||
if (!worldIn.getPendingBlockTicks()
|
||||
.isTickPending(pos, this))
|
||||
worldIn.getPendingBlockTicks()
|
||||
.scheduleTick(pos, this, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scheduledTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random r) {
|
||||
updateTransmittedSignal(state, worldIn, pos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
|
||||
if (state.getBlock() == oldState.getBlock() || isMoving)
|
||||
return;
|
||||
updateTransmittedSignal(state, worldIn, pos, state.get(FACING));
|
||||
updateTransmittedSignal(state, worldIn, pos);
|
||||
}
|
||||
|
||||
public void updateTransmittedSignal(BlockState state, World worldIn, BlockPos pos, Direction blockFacing) {
|
||||
public void updateTransmittedSignal(BlockState state, World worldIn, BlockPos pos) {
|
||||
if (worldIn.isRemote)
|
||||
return;
|
||||
if (state.get(RECEIVER))
|
||||
|
@ -171,7 +184,8 @@ public class RedstoneLinkBlock extends ProperDirectionalBlock implements ITE<Red
|
|||
BlockPos neighbourPos = pos.offset(state.get(FACING)
|
||||
.getOpposite());
|
||||
BlockState neighbour = worldIn.getBlockState(neighbourPos);
|
||||
return !neighbour.getMaterial().isReplaceable();
|
||||
return !neighbour.getMaterial()
|
||||
.isReplaceable();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -47,9 +47,8 @@ public class TooltipHelper {
|
|||
private static final Map<Item, Supplier<String>> tooltipReferrals = new HashMap<>();
|
||||
|
||||
public static IFormattableTextComponent holdShift(Palette color, boolean highlighted) {
|
||||
TextFormatting colorFormat = highlighted ? color.hColor : color.color;
|
||||
return Lang.translate("tooltip.holdKey", Lang.translate("tooltip.keyShift")
|
||||
.formatted(colorFormat))
|
||||
return Lang.translate("tooltip.holdForDescription", Lang.translate("tooltip.keyShift")
|
||||
.formatted(TextFormatting.GRAY))
|
||||
.formatted(TextFormatting.DARK_GRAY);
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ public class PonderProgressBar extends AbstractSimiWidget {
|
|||
hovered = clicked(mouseX, mouseY);
|
||||
|
||||
ms.push();
|
||||
ms.translate(0, 0, 150);
|
||||
ms.translate(0, 0, 250);
|
||||
/*
|
||||
* ponderButtons are at z+400
|
||||
* renderBox is at z+100
|
||||
|
@ -182,9 +182,9 @@ public class PonderProgressBar extends AbstractSimiWidget {
|
|||
if (selected) {
|
||||
FontRenderer font = Minecraft.getInstance().fontRenderer;
|
||||
GuiUtils.drawGradientRect(ms.peek()
|
||||
.getModel(), 500, keyframePos, 10, keyframePos + 1, 10 + height, endColor, startColor);
|
||||
.getModel(), 100, keyframePos, 10, keyframePos + 1, 10 + height, endColor, startColor);
|
||||
ms.push();
|
||||
ms.translate(0, 0, 400);
|
||||
ms.translate(0, 0, 100);
|
||||
String text;
|
||||
int offset;
|
||||
if (activeScene.currentTime < keyframeTime) {
|
||||
|
|
|
@ -449,6 +449,7 @@ public class PonderScene {
|
|||
} else {
|
||||
// For block breaking overlay; Don't ask
|
||||
ms.scale(f, f, f);
|
||||
ms.translate(0.525, .2975, .9);
|
||||
ms.translate((basePlateSize + basePlateOffsetX) / -2f, -yOffset,
|
||||
(basePlateSize + basePlateOffsetZ) / -2f);
|
||||
float y = (float) (0.5065 * Math.pow(2.2975, Math.log(1 / scaleFactor) / Math.log(2))) / 30;
|
||||
|
|
|
@ -537,7 +537,7 @@ public class PonderUI extends NavigatableSimiScreen {
|
|||
{
|
||||
// Chapter title
|
||||
ms.push();
|
||||
ms.translate(0, 0, 100);
|
||||
ms.translate(0, 0, 300);
|
||||
int x = 31 + 20 + 8;
|
||||
int y = 31;
|
||||
|
||||
|
|
|
@ -110,7 +110,7 @@ public class PonderButton extends AbstractSimiWidget {
|
|||
borderColorStart = ColorHelper.applyAlpha(borderColorStart, fade);
|
||||
borderColorEnd = ColorHelper.applyAlpha(borderColorEnd, fade);
|
||||
|
||||
ms.translate(0, 0, 300);
|
||||
ms.translate(0, 0, 400);
|
||||
PonderUI.renderBox(ms, x, y, width, height, backgroundColor, borderColorStart, borderColorEnd);
|
||||
ms.translate(0, 0, 100);
|
||||
|
||||
|
|
|
@ -14,12 +14,14 @@ import com.mojang.blaze3d.matrix.MatrixStack;
|
|||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer;
|
||||
import com.simibubi.create.foundation.utility.VirtualEmptyModelData;
|
||||
import com.simibubi.create.foundation.utility.placement.PlacementHelpers;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
|
@ -35,16 +37,17 @@ import net.minecraft.util.math.vector.Vector4f;
|
|||
public abstract class GhostBlockRenderer {
|
||||
|
||||
private static final GhostBlockRenderer transparent = new TransparentGhostBlockRenderer();
|
||||
|
||||
public static GhostBlockRenderer transparent() {
|
||||
return transparent;
|
||||
}
|
||||
|
||||
private static final GhostBlockRenderer standard = new DefaultGhostBlockRenderer();
|
||||
|
||||
public static GhostBlockRenderer standard() {
|
||||
return standard;
|
||||
}
|
||||
|
||||
|
||||
public abstract void render(MatrixStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params);
|
||||
|
||||
private static class DefaultGhostBlockRenderer extends GhostBlockRenderer {
|
||||
|
@ -52,7 +55,8 @@ public abstract class GhostBlockRenderer {
|
|||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params) {
|
||||
ms.push();
|
||||
|
||||
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
BlockRendererDispatcher dispatcher = Minecraft.getInstance()
|
||||
.getBlockRendererDispatcher();
|
||||
|
||||
IBakedModel model = dispatcher.getModelForState(params.state);
|
||||
|
||||
|
@ -62,7 +66,9 @@ public abstract class GhostBlockRenderer {
|
|||
BlockPos pos = params.pos;
|
||||
ms.translate(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
dispatcher.getBlockModelRenderer().renderModel(ms.peek(), vb, params.state, model, 1f, 1f, 1f, 0xF000F0, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE);
|
||||
dispatcher.getBlockModelRenderer()
|
||||
.renderModel(ms.peek(), vb, params.state, model, 1f, 1f, 1f, 0xF000F0, OverlayTexture.DEFAULT_UV,
|
||||
VirtualEmptyModelData.INSTANCE);
|
||||
|
||||
ms.pop();
|
||||
}
|
||||
|
@ -73,48 +79,61 @@ public abstract class GhostBlockRenderer {
|
|||
|
||||
public void render(MatrixStack ms, SuperRenderTypeBuffer buffer, GhostBlockParams params) {
|
||||
|
||||
//prepare
|
||||
// prepare
|
||||
ms.push();
|
||||
|
||||
//RenderSystem.pushMatrix();
|
||||
// RenderSystem.pushMatrix();
|
||||
|
||||
BlockRendererDispatcher dispatcher = Minecraft.getInstance().getBlockRendererDispatcher();
|
||||
Minecraft mc = Minecraft.getInstance();
|
||||
BlockRendererDispatcher dispatcher = mc.getBlockRendererDispatcher();
|
||||
|
||||
IBakedModel model = dispatcher.getModelForState(params.state);
|
||||
|
||||
//RenderType layer = RenderTypeLookup.getEntityBlockLayer(params.state);
|
||||
// RenderType layer = RenderTypeLookup.getEntityBlockLayer(params.state);
|
||||
RenderType layer = RenderType.getTranslucent();
|
||||
IVertexBuilder vb = buffer.getEarlyBuffer(layer);
|
||||
|
||||
BlockPos pos = params.pos;
|
||||
ms.translate(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
//dispatcher.getBlockModelRenderer().renderModel(ms.peek(), vb, params.state, model, 1f, 1f, 1f, 0xF000F0, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE);
|
||||
renderModel(params, ms.peek(), vb, params.state, model, 1f, 1f, 1f, 0xF000F0, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE);
|
||||
ms.translate(.5, .5, .5);
|
||||
ms.scale(.85f, .85f, .85f);
|
||||
ms.translate(-.5, -.5, -.5);
|
||||
|
||||
//buffer.draw();
|
||||
//clean
|
||||
//RenderSystem.popMatrix();
|
||||
// dispatcher.getBlockModelRenderer().renderModel(ms.peek(), vb, params.state, model, 1f, 1f, 1f, 0xF000F0, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE);
|
||||
renderModel(params, ms.peek(), vb, params.state, model, 1f, 1f, 1f,
|
||||
WorldRenderer.getLightmapCoordinates(mc.world, pos), OverlayTexture.DEFAULT_UV,
|
||||
VirtualEmptyModelData.INSTANCE);
|
||||
|
||||
// buffer.draw();
|
||||
// clean
|
||||
// RenderSystem.popMatrix();
|
||||
ms.pop();
|
||||
|
||||
}
|
||||
|
||||
//BlockModelRenderer
|
||||
public void renderModel(GhostBlockParams params, MatrixStack.Entry entry, IVertexBuilder vb, @Nullable BlockState state, IBakedModel model, float p_228804_5_, float p_228804_6_, float p_228804_7_, int p_228804_8_, int p_228804_9_, net.minecraftforge.client.model.data.IModelData modelData) {
|
||||
// BlockModelRenderer
|
||||
public void renderModel(GhostBlockParams params, MatrixStack.Entry entry, IVertexBuilder vb,
|
||||
@Nullable BlockState state, IBakedModel model, float p_228804_5_, float p_228804_6_, float p_228804_7_,
|
||||
int p_228804_8_, int p_228804_9_, net.minecraftforge.client.model.data.IModelData modelData) {
|
||||
Random random = new Random();
|
||||
|
||||
for (Direction direction : Direction.values()) {
|
||||
random.setSeed(42L);
|
||||
renderQuad(params, entry, vb, p_228804_5_, p_228804_6_, p_228804_7_, model.getQuads(state, direction, random, modelData), p_228804_8_, p_228804_9_);
|
||||
renderQuad(params, entry, vb, p_228804_5_, p_228804_6_, p_228804_7_,
|
||||
model.getQuads(state, direction, random, modelData), p_228804_8_, p_228804_9_);
|
||||
}
|
||||
|
||||
random.setSeed(42L);
|
||||
renderQuad(params, entry, vb, p_228804_5_, p_228804_6_, p_228804_7_, model.getQuads(state, (Direction) null, random, modelData), p_228804_8_, p_228804_9_);
|
||||
renderQuad(params, entry, vb, p_228804_5_, p_228804_6_, p_228804_7_,
|
||||
model.getQuads(state, (Direction) null, random, modelData), p_228804_8_, p_228804_9_);
|
||||
}
|
||||
|
||||
//BlockModelRenderer
|
||||
private static void renderQuad(GhostBlockParams params, MatrixStack.Entry p_228803_0_, IVertexBuilder p_228803_1_, float p_228803_2_, float p_228803_3_, float p_228803_4_, List<BakedQuad> p_228803_5_, int p_228803_6_, int p_228803_7_) {
|
||||
Float alpha = params.alphaSupplier.get();
|
||||
// BlockModelRenderer
|
||||
private static void renderQuad(GhostBlockParams params, MatrixStack.Entry p_228803_0_,
|
||||
IVertexBuilder p_228803_1_, float p_228803_2_, float p_228803_3_, float p_228803_4_,
|
||||
List<BakedQuad> p_228803_5_, int p_228803_6_, int p_228803_7_) {
|
||||
Float alpha = params.alphaSupplier.get() * .75f * PlacementHelpers.getCurrentAlpha();
|
||||
|
||||
for (BakedQuad bakedquad : p_228803_5_) {
|
||||
float f;
|
||||
|
@ -130,15 +149,19 @@ public abstract class GhostBlockRenderer {
|
|||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
quad(alpha, p_228803_1_, p_228803_0_, bakedquad, new float[]{1f, 1f, 1f, 1f}, f, f1, f2, new int[]{p_228803_6_, p_228803_6_, p_228803_6_, p_228803_6_}, p_228803_7_);
|
||||
quad(alpha, p_228803_1_, p_228803_0_, bakedquad, new float[] { 1f, 1f, 1f, 1f }, f, f1, f2,
|
||||
new int[] { p_228803_6_, p_228803_6_, p_228803_6_, p_228803_6_ }, p_228803_7_);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//IVertexBuilder
|
||||
static void quad(float alpha, IVertexBuilder vb, MatrixStack.Entry p_227890_1_, BakedQuad p_227890_2_, float[] p_227890_3_, float p_227890_4_, float p_227890_5_, float p_227890_6_, int[] p_227890_7_, int p_227890_8_) {
|
||||
// IVertexBuilder
|
||||
static void quad(float alpha, IVertexBuilder vb, MatrixStack.Entry p_227890_1_, BakedQuad p_227890_2_,
|
||||
float[] p_227890_3_, float p_227890_4_, float p_227890_5_, float p_227890_6_, int[] p_227890_7_,
|
||||
int p_227890_8_) {
|
||||
int[] aint = p_227890_2_.getVertexData();
|
||||
Vector3i Vector3i = p_227890_2_.getFace().getDirectionVec();
|
||||
Vector3i Vector3i = p_227890_2_.getFace()
|
||||
.getDirectionVec();
|
||||
Vector3f vector3f = new Vector3f((float) Vector3i.getX(), (float) Vector3i.getY(), (float) Vector3i.getZ());
|
||||
Matrix4f matrix4f = p_227890_1_.getModel();
|
||||
vector3f.transform(p_227890_1_.getNormal());
|
||||
|
@ -163,14 +186,14 @@ public abstract class GhostBlockRenderer {
|
|||
g = p_227890_3_[k] * p_227890_5_;
|
||||
b = p_227890_3_[k] * p_227890_6_;
|
||||
|
||||
|
||||
int l = vb.applyBakedLighting(p_227890_7_[k], bytebuffer);
|
||||
float f9 = bytebuffer.getFloat(16);
|
||||
float f10 = bytebuffer.getFloat(20);
|
||||
Vector4f vector4f = new Vector4f(f, f1, f2, 1.0F);
|
||||
vector4f.transform(matrix4f);
|
||||
vb.applyBakedNormals(vector3f, bytebuffer, p_227890_1_.getNormal());
|
||||
vb.vertex(vector4f.getX(), vector4f.getY(), vector4f.getZ(), r, g, b, alpha, f9, f10, p_227890_8_, l, vector3f.getX(), vector3f.getY(), vector3f.getZ());
|
||||
vb.vertex(vector4f.getX(), vector4f.getY(), vector4f.getZ(), r, g, b, alpha, f9, f10, p_227890_8_,
|
||||
l, vector3f.getX(), vector3f.getY(), vector3f.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,12 +157,16 @@ public class PlacementHelpers {
|
|||
|
||||
float screenY = res.getScaledHeight() / 2f;
|
||||
float screenX = res.getScaledWidth() / 2f;
|
||||
float progress = Math.min(animationTick / 10f/* + event.getPartialTicks()*/, 1f);
|
||||
float progress = getCurrentAlpha();
|
||||
|
||||
drawDirectionIndicator(event.getMatrixStack(), event.getPartialTicks(), screenX, screenY, progress);
|
||||
}
|
||||
}
|
||||
|
||||
public static float getCurrentAlpha() {
|
||||
return Math.min(animationTick / 10f/* + event.getPartialTicks()*/, 1f);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
private static void drawDirectionIndicator(MatrixStack ms, float partialTicks, float centerX, float centerY, float progress) {
|
||||
float r = .8f;
|
||||
|
|
Loading…
Reference in a new issue