OK Goggle

- Press/Spout placement offset no longer activates when clicking the side of a block
- Press/Spout placement offset no longer activates on invalid belt slopes
- Block-items without innate fluid handling no longer require sneaking to be placed next to item drains
- The Goggle overlay can now be activated by external add-ons
- The Goggle overlay default colour now has less opacity
- The Goggle overlay now fades in over a couple ticks
This commit is contained in:
simibubi 2021-07-27 15:25:25 +02:00
parent eea9778840
commit 85be4be395
4 changed files with 101 additions and 10 deletions

39
log.txt Normal file
View file

@ -0,0 +1,39 @@
- Bump minimum required Forge version to 36.2.0
- Fixed backtank not rendering on all players
- Added config options that allow some more customization of the goggle overlay
- Fixed crash when simultaneously converting and destroying a Peculiar Bell
- Fixed Stockpile Switch not updating its signal when the inventory it's watching is moved
- Fixed Potato Cannon projectiles being able to move players in creative mode
- Fixed Lectern Controller not rendering buttons when being used by a different player
- Create now uses the milk fluid introduced by Forge
- Fixed mixer and press not checking for recipes once more after completing
- Fixed incorrect damage displayed in the tooltip of potato cannons
- Allow registering custom effect handlers for open ended pipes
- Fixed capitalization in English subtitles
- Now skipping item-drain JEI integration with missing item outputs
- Goggles icon no longer renders when menu button is set invisible
- Fixed missing blaze burner in JEI's display of heated compacting recipes
- Added support for custom namespaces in ponder
- Make ponder files use Minecraft's resource system
- Allow easily registering and generating ponder lang for any namespace
- Create now partially uses the Official Mappings provided by Mojang
- Fixed upright items rendered on depots
- Fixed invalid textures on Potato cannon model
- Mechanical Arms remember their targets when placed by Schematicannon
- Mechanical Arms will now rotate/mirror their targets when rotated/mirrored in a schematic or contraption
- Added milling recipes for beetroots and sea pickles
- Press/Spout placement offset no longer activates when clicking the side of a block
- Press/Spout placement offset no longer activates on invalid belt slopes
- Block-items without innate fluid handling no longer require sneaking to be placed next to item drains
- The Goggle overlay can now be activated by external add-ons
- The Goggle overlay default colour now has less opacity
- The Goggle overlay now fades in over a couple ticks
Updates to zh_cn.json by Water-Moon
Updates to ja_jp.json by CKenJa
Updates to ru_ru.json by pgkrol & Hanqnero
Updates to ko_kr.json by qkrehf2 & Red1854th
Updates to zh_tw.json by simba-fs

View file

@ -1,6 +1,8 @@
package com.simibubi.create.content.contraptions.components;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.content.contraptions.relays.belt.BeltBlock;
import com.simibubi.create.content.contraptions.relays.belt.BeltSlope;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -25,7 +27,7 @@ public class AssemblyOperatorBlockItem extends BlockItem {
.getOpposite());
BlockState placedOnState = context.getLevel()
.getBlockState(placedOnPos);
if (operatesOn(placedOnState)) {
if (operatesOn(placedOnState) && context.getClickedFace() == Direction.UP) {
if (context.getLevel()
.getBlockState(placedOnPos.above(2))
.getMaterial()
@ -44,7 +46,9 @@ public class AssemblyOperatorBlockItem extends BlockItem {
}
protected boolean operatesOn(BlockState placedOnState) {
return AllBlocks.BASIN.has(placedOnState) || AllBlocks.BELT.has(placedOnState) || AllBlocks.DEPOT.has(placedOnState) || AllBlocks.WEIGHTED_EJECTOR.has(placedOnState);
if (AllBlocks.BELT.has(placedOnState))
return placedOnState.getValue(BeltBlock.SLOPE) == BeltSlope.HORIZONTAL;
return AllBlocks.BASIN.has(placedOnState) || AllBlocks.DEPOT.has(placedOnState) || AllBlocks.WEIGHTED_EJECTOR.has(placedOnState);
}
}

View file

@ -12,6 +12,7 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.InventoryHelper;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.pathfinding.PathType;
import net.minecraft.tileentity.TileEntity;
@ -24,6 +25,7 @@ import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.fluids.capability.CapabilityFluidHandler;
public class ItemDrainBlock extends Block implements IWrenchable, ITE<ItemDrainTileEntity> {
@ -36,6 +38,11 @@ public class ItemDrainBlock extends Block implements IWrenchable, ITE<ItemDrainT
BlockRayTraceResult hit) {
ItemStack heldItem = player.getItemInHand(handIn);
if (heldItem.getItem() instanceof BlockItem
&& !heldItem.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY)
.isPresent())
return ActionResultType.PASS;
return onTileEntityUse(worldIn, pos, te -> {
if (!heldItem.isEmpty()) {
te.internalTank.allowInsertion();

View file

@ -1,8 +1,10 @@
package com.simibubi.create.content.contraptions.goggles;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.simibubi.create.AllBlocks;
@ -12,9 +14,11 @@ import com.simibubi.create.content.contraptions.components.structureMovement.IDi
import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock;
import com.simibubi.create.content.contraptions.components.structureMovement.piston.PistonExtensionPoleBlock;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.config.CClient;
import com.simibubi.create.foundation.gui.GuiGameElement;
import com.simibubi.create.foundation.gui.Theme;
import com.simibubi.create.foundation.tileEntity.behaviour.ValueBox;
import com.simibubi.create.foundation.utility.ColorHelper;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.Lang;
import com.simibubi.create.foundation.utility.outliner.Outline;
@ -31,6 +35,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.ITextProperties;
@ -39,14 +44,21 @@ import net.minecraftforge.fml.client.gui.GuiUtils;
public class GoggleOverlayRenderer {
private static final List<Supplier<Boolean>> customGogglePredicates = new LinkedList<>();
private static final Map<Object, OutlineEntry> outlines = CreateClient.OUTLINER.getOutlines();
public static int hoverTicks = 0;
public static BlockPos lastHovered = null;
public static void renderOverlay(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay,
float partialTicks) {
RayTraceResult objectMouseOver = Minecraft.getInstance().hitResult;
if (!(objectMouseOver instanceof BlockRayTraceResult))
if (!(objectMouseOver instanceof BlockRayTraceResult)) {
lastHovered = null;
hoverTicks = 0;
return;
}
for (OutlineEntry entry : outlines.values()) {
if (!entry.isAlive())
@ -62,8 +74,16 @@ public class GoggleOverlayRenderer {
BlockPos pos = result.getBlockPos();
ItemStack headSlot = mc.player.getItemBySlot(EquipmentSlotType.HEAD);
TileEntity te = world.getBlockEntity(pos);
if (lastHovered == null || lastHovered.equals(pos))
hoverTicks++;
else
hoverTicks = 0;
lastHovered = pos;
boolean wearingGoggles = AllItems.GOGGLES.isIn(headSlot);
for (Supplier<Boolean> supplier : customGogglePredicates)
wearingGoggles |= supplier.get();
boolean hasGoggleInformation = te instanceof IHaveGoggleInformation;
boolean hasHoveringInformation = te instanceof IHaveHoveringInformation;
@ -150,18 +170,31 @@ public class GoggleOverlayRenderer {
tooltipHeight += 2; // gap between title lines and next lines
}
int posX = tooltipScreen.width / 2 + AllConfigs.CLIENT.overlayOffsetX.get();
int posY = tooltipScreen.height / 2 + AllConfigs.CLIENT.overlayOffsetY.get();
CClient cfg = AllConfigs.CLIENT;
int posX = tooltipScreen.width / 2 + cfg.overlayOffsetX.get();
int posY = tooltipScreen.height / 2 + cfg.overlayOffsetY.get();
posX = Math.min(posX, tooltipScreen.width - tooltipTextWidth - 20);
posY = Math.min(posY, tooltipScreen.height - tooltipHeight - 20);
Boolean useCustom = AllConfigs.CLIENT.overlayCustomColor.get();
int colorBackground = useCustom ? AllConfigs.CLIENT.overlayBackgroundColor.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BACKGROUND);
int colorBorderTop = useCustom ? AllConfigs.CLIENT.overlayBorderColorTop.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BORDER, true);
int colorBorderBot = useCustom ? AllConfigs.CLIENT.overlayBorderColorBot.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BORDER, false);
GuiUtils.drawHoveringText(ms, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1, colorBackground, colorBorderTop, colorBorderBot, mc.font);
float fade = MathHelper.clamp((hoverTicks + partialTicks) / 12f, 0, 1);
Boolean useCustom = cfg.overlayCustomColor.get();
int colorBackground = useCustom ? cfg.overlayBackgroundColor.get()
: ColorHelper.applyAlpha(Theme.i(Theme.Key.VANILLA_TOOLTIP_BACKGROUND), .75f);
int colorBorderTop =
useCustom ? cfg.overlayBorderColorTop.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BORDER, true);
int colorBorderBot =
useCustom ? cfg.overlayBorderColorBot.get() : Theme.i(Theme.Key.VANILLA_TOOLTIP_BORDER, false);
if (fade < 1) {
ms.translate((1 - fade) * Math.signum(cfg.overlayOffsetX.get() + .5f) * 4, 0, 0);
colorBackground = ColorHelper.applyAlpha(colorBackground, fade);
colorBorderTop = ColorHelper.applyAlpha(colorBorderTop, fade);
colorBorderBot = ColorHelper.applyAlpha(colorBorderBot, fade);
}
GuiUtils.drawHoveringText(ms, tooltip, posX, posY, tooltipScreen.width, tooltipScreen.height, -1,
colorBackground, colorBorderTop, colorBorderBot, mc.font);
ItemStack item = AllItems.GOGGLES.asStack();
GuiGameElement.of(item)
@ -170,6 +203,14 @@ public class GoggleOverlayRenderer {
ms.popPose();
}
/**
* Use this method to add custom entry points to the goggle overay, e.g. custom
* armor, handheld alternatives, etc.
*/
public static void registerCustomGoggleCondition(Supplier<Boolean> condition) {
customGogglePredicates.add(condition);
}
public static final class TooltipScreen extends Screen {
public TooltipScreen(ITextComponent p_i51108_1_) {
super(p_i51108_1_);