Remove unused imports

This commit is contained in:
IThundxr 2025-02-23 14:42:39 -05:00
parent 89ba8a76bc
commit a6d512356c
Failed to generate hash of commit
31 changed files with 223 additions and 264 deletions

View file

@ -1,9 +1,6 @@
package com.simibubi.create;
import com.simibubi.create.AllSoundEvents.SoundEntry;
import com.tterrag.registrate.providers.ProviderType;
import net.minecraftforge.data.loading.DatagenModLoader;
import java.util.function.BiConsumer;
import org.lwjgl.glfw.GLFW;
@ -12,13 +9,12 @@ import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.KeyMapping;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screens.Screen;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import java.util.function.BiConsumer;
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
public enum AllKeys {

View file

@ -4,8 +4,6 @@ import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import org.jetbrains.annotations.NotNull;
import com.simibubi.create.AllPackets;
@ -29,6 +27,7 @@ import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NumericTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.Component;
import net.minecraftforge.network.PacketDistributor;
@ -130,7 +129,7 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
@LuaFunction(mainThread = true)
public final void setTrainName(String name) throws LuaException {
Train train = getTrainOrThrow();
train.name = Component.literal(name);
train.name = Component.literal(name);
AllPackets.getChannel().send(PacketDistributor.ALL.noArg(), new TrainEditPacket.TrainEditReturnPacket(train.id, name, train.icon.getId(), train.mapColorIndex));
}
@ -211,8 +210,8 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
for (String compoundKey : compoundTag.getAllKeys()) {
table.put(
StringHelper.camelCaseToSnakeCase(compoundKey),
fromNBTTag(compoundKey, compoundTag.get(compoundKey))
StringHelper.camelCaseToSnakeCase(compoundKey),
fromNBTTag(compoundKey, compoundTag.get(compoundKey))
);
}
@ -256,11 +255,11 @@ public class StationPeripheral extends SyncedPeripheral<StationBlockEntity> {
throw new LuaException("table key is not of type string");
compound.put(
// Items serialize their resource location as "id" and not as "Id".
// This check is needed to see if the 'i' should be left lowercase or not.
// Items store "count" in the same compound tag, so we can check for its presence to see if this is a serialized item
compoundKey.equals("id") && v.containsKey("count") ? "id" : StringHelper.snakeCaseToCamelCase(compoundKey),
toNBTTag(compoundKey, v.get(compoundKey))
// Items serialize their resource location as "id" and not as "Id".
// This check is needed to see if the 'i' should be left lowercase or not.
// Items store "count" in the same compound tag, so we can check for its presence to see if this is a serialized item
compoundKey.equals("id") && v.containsKey("count") ? "id" : StringHelper.snakeCaseToCamelCase(compoundKey),
toNBTTag(compoundKey, v.get(compoundKey))
);
}

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.contraptions.pulley;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.AllSpriteShifts;
import com.simibubi.create.content.processing.burner.ScrollInstance;
@ -13,7 +12,6 @@ import dev.engine_room.flywheel.lib.instance.InstanceTypes;
import dev.engine_room.flywheel.lib.instance.TransformedInstance;
import dev.engine_room.flywheel.lib.model.Models;
import net.createmod.catnip.render.SpriteShiftEntry;
import net.createmod.ponder.render.VirtualRenderHelper;
public class RopePulleyVisual extends AbstractPulleyVisual<PulleyBlockEntity> {
public RopePulleyVisual(VisualizationContext context, PulleyBlockEntity blockEntity, float partialTick) {

View file

@ -38,7 +38,7 @@ import net.minecraft.world.level.material.Fluids;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.world.phys.shapes.VoxelShape;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.network.NetworkHooks;
@ -120,7 +120,7 @@ public class ToolboxBlock extends HorizontalDirectionalBlock implements SimpleWa
@Override
public BlockState updateShape(BlockState state, Direction direction, BlockState neighbourState, LevelAccessor world,
BlockPos pos, BlockPos neighbourPos) {
BlockPos pos, BlockPos neighbourPos) {
if (state.getValue(WATERLOGGED))
world.scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickDelay(world));
return state;
@ -133,7 +133,7 @@ public class ToolboxBlock extends HorizontalDirectionalBlock implements SimpleWa
@Override
public InteractionResult use(BlockState state, Level world, BlockPos pos, Player player, InteractionHand hand,
BlockHitResult ray) {
BlockHitResult ray) {
if (player == null || player.isCrouching())
return InteractionResult.PASS;
@ -164,7 +164,7 @@ public class ToolboxBlock extends HorizontalDirectionalBlock implements SimpleWa
FluidState ifluidstate = context.getLevel()
.getFluidState(context.getClickedPos());
return super.getStateForPlacement(context).setValue(FACING, context.getHorizontalDirection()
.getOpposite())
.getOpposite())
.setValue(WATERLOGGED, Boolean.valueOf(ifluidstate.getType() == Fluids.WATER));
}

View file

@ -1,13 +1,12 @@
package com.simibubi.create.content.fluids;
import com.simibubi.create.content.fluids.potion.PotionFluid;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.material.FluidState;
import net.minecraftforge.fluids.ForgeFlowingFluid;
public class VirtualFluid extends ForgeFlowingFluid {

View file

@ -19,14 +19,13 @@ import dev.engine_room.flywheel.lib.visualization.SimpleBlockEntityVisualizer;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.level.block.state.properties.Property;
public class OrientedRotatingVisual<T extends KineticBlockEntity> extends KineticBlockEntityVisual<T> {
protected final RotatingInstance rotatingModel;
/**
* @param from The source model orientation to rotate away from.
* @param to The orientation to rotate to.
* @param from The source model orientation to rotate away from.
* @param to The orientation to rotate to.
* @param model The model to spin.
*/
public OrientedRotatingVisual(VisualizationContext context, T blockEntity, float partialTick, Direction from, Direction to, Model model) {

View file

@ -2,11 +2,8 @@ package com.simibubi.create.content.kinetics.crank;
import java.util.List;
import org.jetbrains.annotations.Nullable;
import com.google.common.collect.ImmutableList;
import com.simibubi.create.AllBlocks;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
import com.simibubi.create.content.kinetics.base.KineticBlockEntityRenderer;
import com.simibubi.create.content.kinetics.transmission.sequencer.SequencedGearshiftBlockEntity.SequenceContext;
@ -19,12 +16,9 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsFormatt
import com.simibubi.create.foundation.blockEntity.behaviour.scrollValue.ScrollValueBehaviour;
import com.simibubi.create.foundation.utility.CreateLang;
import dev.engine_room.flywheel.api.model.Model;
import dev.engine_room.flywheel.lib.model.Models;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.render.CachedBuffers;
import net.createmod.catnip.render.SuperByteBuffer;
import net.createmod.catnip.math.VecHelper;
import net.createmod.ponder.render.VirtualRenderHelper;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
@ -106,7 +100,7 @@ public class ValveHandleBlockEntity extends HandCrankBlockEntity {
return (inUse > 0 && totalUseTicks > 0
? Mth.lerp(Math.min(totalUseTicks, totalUseTicks - inUse + partialTicks) / (float) totalUseTicks,
startAngle, targetAngle)
startAngle, targetAngle)
: targetAngle) * Mth.DEG_TO_RAD * (backwards ? -1 : 1) * step;
}
@ -143,7 +137,8 @@ public class ValveHandleBlockEntity extends HandCrankBlockEntity {
}
@Override
protected void copySequenceContextFrom(KineticBlockEntity sourceBE) {}
protected void copySequenceContextFrom(KineticBlockEntity sourceBE) {
}
@Override
@OnlyIn(Dist.CLIENT)
@ -167,8 +162,8 @@ public class ValveHandleBlockEntity extends HandCrankBlockEntity {
@Override
public ValueSettingsBoard createBoard(Player player, BlockHitResult hitResult) {
ImmutableList<Component> rows = ImmutableList.of(Component.literal("\u27f3")
.withStyle(ChatFormatting.BOLD),
ImmutableList<Component> rows = ImmutableList.of(Component.literal("\u27f3")
.withStyle(ChatFormatting.BOLD),
Component.literal("\u27f2")
.withStyle(ChatFormatting.BOLD));
return new ValueSettingsBoard(label, 180, 45, rows, new ValueSettingsFormatter(this::formatValue));

View file

@ -3,8 +3,6 @@ package com.simibubi.create.content.kinetics.drill;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.contraptions.behaviour.MovementContext;
import com.simibubi.create.content.contraptions.render.ActorVisual;
import com.simibubi.create.content.kinetics.base.RotatingInstance;
import com.simibubi.create.foundation.render.AllInstanceTypes;
import com.simibubi.create.foundation.virtualWorld.VirtualRenderWorld;
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
@ -12,30 +10,29 @@ import dev.engine_room.flywheel.lib.instance.InstanceTypes;
import dev.engine_room.flywheel.lib.instance.TransformedInstance;
import dev.engine_room.flywheel.lib.model.Models;
import net.createmod.catnip.animation.AnimationTickHolder;
import net.createmod.catnip.math.VecHelper;
import net.createmod.catnip.math.AngleHelper;
import net.createmod.catnip.math.VecHelper;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.world.level.block.state.BlockState;
public class DrillActorVisual extends ActorVisual {
TransformedInstance drillHead;
private final Direction facing;
TransformedInstance drillHead;
private final Direction facing;
private double rotation;
private double previousRotation;
public DrillActorVisual(VisualizationContext visualizationContext, VirtualRenderWorld contraption, MovementContext context) {
super(visualizationContext, contraption, context);
public DrillActorVisual(VisualizationContext visualizationContext, VirtualRenderWorld contraption, MovementContext context) {
super(visualizationContext, contraption, context);
BlockState state = context.state;
BlockState state = context.state;
facing = state.getValue(DrillBlock.FACING);
facing = state.getValue(DrillBlock.FACING);
drillHead = instancerProvider.instancer(InstanceTypes.TRANSFORMED, Models.partial(AllPartialModels.DRILL_HEAD))
.createInstance();
}
.createInstance();
}
@Override
public void tick() {
@ -53,7 +50,7 @@ public class DrillActorVisual extends ActorVisual {
}
@Override
public void beginFrame() {
public void beginFrame() {
drillHead.setIdentityTransform()
.translate(context.localPos)
.center()
@ -61,7 +58,7 @@ public class DrillActorVisual extends ActorVisual {
.rotateZDegrees((float) getRotation())
.uncenter()
.setChanged();
}
}
protected double getRotation() {
return AngleHelper.angleLerp(AnimationTickHolder.getPartialTicks(), previousRotation, rotation);

View file

@ -10,7 +10,6 @@ import com.simibubi.create.content.kinetics.base.RotatingInstance;
import com.simibubi.create.foundation.render.AllInstanceTypes;
import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.instance.Instancer;
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
import dev.engine_room.flywheel.lib.instance.AbstractInstance;
import dev.engine_room.flywheel.lib.instance.FlatLit;
@ -18,20 +17,19 @@ import dev.engine_room.flywheel.lib.model.Models;
import net.createmod.catnip.data.Iterate;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.LightLayer;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
public class GearboxVisual extends KineticBlockEntityVisual<GearboxBlockEntity> {
protected final EnumMap<Direction, RotatingInstance> keys = new EnumMap<>(Direction.class);
protected Direction sourceFacing;
protected final EnumMap<Direction, RotatingInstance> keys = new EnumMap<>(Direction.class);
protected Direction sourceFacing;
public GearboxVisual(VisualizationContext context, GearboxBlockEntity blockEntity, float partialTick) {
super(context, blockEntity, partialTick);
public GearboxVisual(VisualizationContext context, GearboxBlockEntity blockEntity, float partialTick) {
super(context, blockEntity, partialTick);
final Direction.Axis boxAxis = blockState.getValue(BlockStateProperties.AXIS);
updateSourceFacing();
updateSourceFacing();
var instancer = instancerProvider().instancer(AllInstanceTypes.ROTATING, Models.partial(AllPartialModels.SHAFT_HALF));
@ -48,58 +46,58 @@ public class GearboxVisual extends KineticBlockEntityVisual<GearboxBlockEntity>
.rotateToFace(Direction.SOUTH, direction)
.setChanged();
keys.put(direction, instance);
}
}
keys.put(direction, instance);
}
}
private float getSpeed(Direction direction) {
float speed = blockEntity.getSpeed();
private float getSpeed(Direction direction) {
float speed = blockEntity.getSpeed();
if (speed != 0 && sourceFacing != null) {
if (sourceFacing.getAxis() == direction.getAxis())
speed *= sourceFacing == direction ? 1 : -1;
else if (sourceFacing.getAxisDirection() == direction.getAxisDirection())
speed *= -1;
}
return speed;
}
if (speed != 0 && sourceFacing != null) {
if (sourceFacing.getAxis() == direction.getAxis())
speed *= sourceFacing == direction ? 1 : -1;
else if (sourceFacing.getAxisDirection() == direction.getAxisDirection())
speed *= -1;
}
return speed;
}
protected void updateSourceFacing() {
if (blockEntity.hasSource()) {
BlockPos source = blockEntity.source.subtract(pos);
sourceFacing = Direction.getNearest(source.getX(), source.getY(), source.getZ());
} else {
sourceFacing = null;
}
}
protected void updateSourceFacing() {
if (blockEntity.hasSource()) {
BlockPos source = blockEntity.source.subtract(pos);
sourceFacing = Direction.getNearest(source.getX(), source.getY(), source.getZ());
} else {
sourceFacing = null;
}
}
@Override
public void update(float pt) {
updateSourceFacing();
for (Map.Entry<Direction, RotatingInstance> key : keys.entrySet()) {
Direction direction = key.getKey();
Direction.Axis axis = direction.getAxis();
@Override
public void update(float pt) {
updateSourceFacing();
for (Map.Entry<Direction, RotatingInstance> key : keys.entrySet()) {
Direction direction = key.getKey();
Direction.Axis axis = direction.getAxis();
key.getValue()
.setup(blockEntity, axis, getSpeed(direction))
.setChanged();
}
}
}
@Override
public void updateLight(float partialTick) {
relight(keys.values().toArray(FlatLit[]::new));
}
@Override
public void updateLight(float partialTick) {
relight(keys.values().toArray(FlatLit[]::new));
}
@Override
protected void _delete() {
keys.values().forEach(AbstractInstance::delete);
keys.clear();
}
@Override
protected void _delete() {
keys.values().forEach(AbstractInstance::delete);
keys.clear();
}
@Override
public void collectCrumblingInstances(Consumer<Instance> consumer) {
keys.values()
.forEach(consumer);
.forEach(consumer);
}
}

View file

@ -23,7 +23,6 @@ import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.theme.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.core.Direction;
import net.minecraft.util.Mth;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
@ -121,10 +120,10 @@ public class ArmVisual extends SingleAxisRotatingVisual<ArmBlockEntity> implemen
int color = Color.rainbowColor(ticks * 100)
.getRGB();
updateAngles(baseAngle, lowerArmAngle, upperArmAngle, headAngle, color);
}
}
private void animateArm() {
updateAngles(this.baseAngle, this.lowerArmAngle - 135, this.upperArmAngle - 90, this.headAngle, 0xFFFFFF);
updateAngles(this.baseAngle, this.lowerArmAngle - 135, this.upperArmAngle - 90, this.headAngle, 0xFFFFFF);
}
private void updateAngles(float baseAngle, float lowerArmAngle, float upperArmAngle, float headAngle, int color) {
@ -163,7 +162,7 @@ public class ArmVisual extends SingleAxisRotatingVisual<ArmBlockEntity> implemen
boolean hasItem = !item.isEmpty();
boolean isBlockItem = hasItem && (item.getItem() instanceof BlockItem)
&& itemRenderer.getModel(item, Minecraft.getInstance().level, null, 0)
.isGui3d();
.isGui3d();
for (int index : Iterate.zeroAndOne) {
poseStack.pushPose();
@ -182,7 +181,7 @@ public class ArmVisual extends SingleAxisRotatingVisual<ArmBlockEntity> implemen
public void update(float pt) {
super.update(pt);
instancerProvider().instancer(InstanceTypes.TRANSFORMED, Models.partial(blockEntity.goggles ? AllPartialModels.ARM_CLAW_BASE_GOGGLES : AllPartialModels.ARM_CLAW_BASE))
.stealInstance(claw);
.stealInstance(claw);
}
@Override
@ -193,7 +192,7 @@ public class ArmVisual extends SingleAxisRotatingVisual<ArmBlockEntity> implemen
}
@Override
protected void _delete() {
protected void _delete() {
super._delete();
models.forEach(AbstractInstance::delete);
}

View file

@ -5,11 +5,9 @@ import java.util.function.Consumer;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.kinetics.base.RotatingInstance;
import com.simibubi.create.content.kinetics.base.SingleAxisRotatingVisual;
import com.simibubi.create.content.kinetics.simpleRelays.encased.EncasedCogVisual;
import com.simibubi.create.foundation.render.AllInstanceTypes;
import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.model.Model;
import dev.engine_room.flywheel.api.visual.DynamicVisual;
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
import dev.engine_room.flywheel.lib.instance.InstanceTypes;
@ -34,7 +32,7 @@ public class MixerVisual extends SingleAxisRotatingVisual<MechanicalMixerBlockEn
mixerHead.setRotationAxis(Direction.Axis.Y);
mixerPole = instancerProvider().instancer(InstanceTypes.ORIENTED, Models.partial(AllPartialModels.MECHANICAL_MIXER_POLE))
.createInstance();
.createInstance();
animate(partialTick);
}
@ -55,15 +53,15 @@ public class MixerVisual extends SingleAxisRotatingVisual<MechanicalMixerBlockEn
float speed = mixer.getRenderedHeadRotationSpeed(pt);
mixerHead.setPosition(getVisualPosition())
.nudge(0, -renderedHeadOffset, 0)
.setRotationalSpeed(speed * 2 * RotatingInstance.SPEED_MULTIPLIER)
.setChanged();
.nudge(0, -renderedHeadOffset, 0)
.setRotationalSpeed(speed * 2 * RotatingInstance.SPEED_MULTIPLIER)
.setChanged();
}
private void transformPole(float renderedHeadOffset) {
mixerPole.position(getVisualPosition())
.translatePosition(0, -renderedHeadOffset, 0)
.setChanged();
.translatePosition(0, -renderedHeadOffset, 0)
.setChanged();
}
@Override

View file

@ -4,8 +4,6 @@ import java.util.function.Consumer;
import org.jetbrains.annotations.Nullable;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import com.simibubi.create.AllPartialModels;
import com.simibubi.create.content.kinetics.base.IRotate;
import com.simibubi.create.content.kinetics.base.KineticBlockEntity;
@ -18,14 +16,10 @@ import dev.engine_room.flywheel.api.instance.Instance;
import dev.engine_room.flywheel.api.model.Model;
import dev.engine_room.flywheel.api.visualization.VisualizationContext;
import dev.engine_room.flywheel.lib.model.Models;
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
import dev.engine_room.flywheel.lib.transform.TransformStack;
import net.createmod.catnip.data.Iterate;
import net.minecraft.core.Direction;
import net.minecraft.core.Direction.AxisDirection;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
public class EncasedCogVisual extends KineticBlockEntityVisual<KineticBlockEntity> {

View file

@ -17,7 +17,6 @@ import net.createmod.catnip.gui.element.GuiGameElement;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.nbt.ListTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.item.ItemStack;
public class SequencedGearshiftScreen extends AbstractSimiScreen {
@ -169,7 +168,7 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
if (def.hasValueParameter) {
String text = def.formatValue(instruction.value);
int stringWidth = font.width(text);
label(graphics, 90 + (12 - stringWidth / 2), yOffset - 1, Component.literal(text));
label(graphics, 90 + (12 - stringWidth / 2), yOffset - 1, Component.literal(text));
}
if (def.hasSpeedParameter)
label(graphics, 127, yOffset - 1, instruction.speedModifier.label);
@ -180,9 +179,9 @@ public class SequencedGearshiftScreen extends AbstractSimiScreen {
}
private void renderAdditional(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks, int guiLeft, int guiTop,
AllGuiTextures background) {
AllGuiTextures background) {
GuiGameElement.of(renderedItem).<GuiGameElement
.GuiRenderBuilder>at(guiLeft + background.getWidth() + 6, guiTop + background.getHeight() - 56, 100)
.GuiRenderBuilder>at(guiLeft + background.getWidth() + 6, guiTop + background.getHeight() - 56, 100)
.scale(5)
.render(graphics);
}

View file

@ -8,12 +8,10 @@ import dev.engine_room.flywheel.lib.instance.InstanceTypes;
import dev.engine_room.flywheel.lib.instance.TransformedInstance;
import dev.engine_room.flywheel.lib.model.Models;
import dev.engine_room.flywheel.lib.model.baked.PartialModel;
import dev.engine_room.flywheel.lib.transform.Translate;
import dev.engine_room.flywheel.lib.visual.AbstractEntityVisual;
import dev.engine_room.flywheel.lib.visual.SimpleDynamicVisual;
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.registries.ForgeRegistries;

View file

@ -4,14 +4,12 @@ import java.util.List;
import java.util.function.BiPredicate;
import java.util.function.Function;
import com.mojang.serialization.Codec;
import org.jetbrains.annotations.NotNull;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import org.jetbrains.annotations.NotNull;
public final class SingletonItemAttribute implements ItemAttribute {
private final Type type;
private final BiPredicate<ItemStack, Level> predicate;
@ -34,10 +32,12 @@ public final class SingletonItemAttribute implements ItemAttribute {
}
@Override
public void save(CompoundTag nbt) {} // NO-OP
public void save(CompoundTag nbt) {
} // NO-OP
@Override
public void load(CompoundTag nbt) {} // NO-OP
public void load(CompoundTag nbt) {
} // NO-OP
@Override
public String getTranslationKey() {

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.logistics.item.filter.attribute.legacydeserializers;
import java.util.function.Function;
import java.util.function.Supplier;
import org.jetbrains.annotations.ApiStatus;

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.logistics.item.filter.attribute.legacydeserializers;
import java.util.Map;
import java.util.function.Supplier;
import com.google.common.collect.ImmutableBiMap;
import com.simibubi.create.content.logistics.item.filter.attribute.AllItemAttributeTypes;

View file

@ -7,8 +7,6 @@ import java.util.Optional;
import javax.annotation.Nullable;
import net.minecraft.network.chat.MutableComponent;
import org.lwjgl.glfw.GLFW;
import com.google.common.collect.ImmutableList;
@ -25,10 +23,10 @@ import com.simibubi.create.foundation.gui.widget.IconButton;
import com.simibubi.create.foundation.gui.widget.ScrollInput;
import com.simibubi.create.foundation.utility.CreateLang;
import net.createmod.catnip.gui.UIRenderHelper;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.animation.LerpedFloat;
import net.createmod.catnip.animation.LerpedFloat.Chaser;
import net.createmod.catnip.gui.UIRenderHelper;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.Font;
import net.minecraft.client.gui.GuiGraphics;
@ -41,6 +39,7 @@ import net.minecraft.util.FormattedCharSequence;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<StockKeeperCategoryMenu>
@ -92,7 +91,7 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
editorConfirm = new IconButton(leftPos + 36 + 131, topPos + 59, AllIcons.I_CONFIRM);
menu.slotsActive = true;
editorEditBox = new EditBox(font, leftPos + 47, topPos + 28, 124, 10, Component.empty());
editorEditBox = new EditBox(font, leftPos + 47, topPos + 28, 124, 10, Component.empty());
editorEditBox.setTextColor(0xffeeeeee);
editorEditBox.setBordered(false);
editorEditBox.setFocused(false);
@ -100,10 +99,10 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
editorEditBox.setMaxLength(28);
editorEditBox.setValue(index == -1 || schedule.get(index)
.isEmpty() ? CreateLang.translate("gui.stock_ticker.new_category")
.string()
: schedule.get(index)
.getHoverName()
.getString());
.string()
: schedule.get(index)
.getHoverName()
.getString());
editingIndex = index;
editingItem = index == -1 ? ItemStack.EMPTY : schedule.get(index);
@ -212,7 +211,7 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
}
public int renderScheduleEntry(GuiGraphics graphics, int i, ItemStack entry, int yOffset, int mouseX, int mouseY,
float partialTicks) {
float partialTicks) {
int cardWidth = CARD_WIDTH;
int cardHeader = CARD_HEADER;
int cardHeight = cardHeader;
@ -233,11 +232,11 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
entry.isEmpty() ? CreateLang.translate("gui.stock_ticker.empty_category_name_placeholder")
.string()
: entry.getHoverName()
.getString(20)
.stripTrailing()
+ (entry.getHoverName()
.getString()
.length() > 20 ? "..." : ""),
.getString(20)
.stripTrailing()
+ (entry.getHoverName()
.getString()
.length() > 20 ? "..." : ""),
35, 5, 0x656565, false);
matrixStack.popPose();
@ -418,7 +417,7 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
super.renderForeground(graphics, mouseX, mouseY, partialTicks);
GuiGameElement.of(AllBlocks.STOCK_TICKER.asStack()).<GuiGameElement
.GuiRenderBuilder>at(leftPos + AllGuiTextures.STOCK_KEEPER_CATEGORY.getWidth() + 12,
.GuiRenderBuilder>at(leftPos + AllGuiTextures.STOCK_KEEPER_CATEGORY.getWidth() + 12,
topPos + imageHeight - 39, -190)
.scale(3)
.render(graphics);
@ -431,14 +430,14 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
if (hoveredSlot instanceof SlotItemHandler && hoveredSlot.getItem()
.isEmpty()) {
graphics.renderComponentTooltip(font, List.of(CreateLang.translate("gui.stock_ticker.category_filter")
.color(ScrollInput.HEADER_RGB)
.component(),
CreateLang.translate("gui.stock_ticker.category_filter_tip")
.style(ChatFormatting.GRAY)
.component(),
CreateLang.translate("gui.stock_ticker.category_filter_tip_1")
.style(ChatFormatting.GRAY)
.component()),
.color(ScrollInput.HEADER_RGB)
.component(),
CreateLang.translate("gui.stock_ticker.category_filter_tip")
.style(ChatFormatting.GRAY)
.component(),
CreateLang.translate("gui.stock_ticker.category_filter_tip_1")
.style(ChatFormatting.GRAY)
.component()),
mouseX, mouseY);
}

View file

@ -16,7 +16,6 @@ import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringB
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour;
import com.simibubi.create.foundation.blockEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment;
import com.simibubi.create.foundation.fluid.FluidIngredient;
import com.simibubi.create.foundation.item.SmartInventory;
import com.simibubi.create.foundation.recipe.DummyCraftingContainer;
import com.simibubi.create.foundation.recipe.IRecipeTypeInfo;

View file

@ -1,13 +1,9 @@
package com.simibubi.create.content.processing.burner;
import org.joml.Quaternionf;
import org.joml.Quaternionfc;
import dev.engine_room.flywheel.api.instance.InstanceHandle;
import dev.engine_room.flywheel.api.instance.InstanceType;
import dev.engine_room.flywheel.lib.instance.TransformedInstance;
import net.createmod.catnip.render.SpriteShiftEntry;
import net.minecraft.core.Vec3i;
public class ScrollTransformedInstance extends TransformedInstance {
public float speedU;
@ -29,6 +25,7 @@ public class ScrollTransformedInstance extends TransformedInstance {
public ScrollTransformedInstance setSpriteShift(SpriteShiftEntry spriteShift) {
return setSpriteShift(spriteShift, 0.5f, 0.5f);
}
public ScrollTransformedInstance setSpriteShift(SpriteShiftEntry spriteShift, float factorU, float factorV) {
float spriteWidth = spriteShift.getTarget()
.getU1()

View file

@ -16,16 +16,15 @@ import com.simibubi.create.foundation.utility.CreateLang;
import com.simibubi.create.infrastructure.ponder.AllCreatePonderTags;
import dev.engine_room.flywheel.lib.transform.TransformStack;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.gui.AbstractSimiScreen;
import net.createmod.catnip.gui.ScreenOpener;
import net.createmod.catnip.gui.element.GuiGameElement;
import net.createmod.catnip.gui.widget.AbstractSimiWidget;
import net.createmod.catnip.data.Iterate;
import net.createmod.ponder.foundation.ui.PonderTagScreen;
import net.minecraft.ChatFormatting;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -160,21 +159,21 @@ public class ThresholdSwitchScreen extends AbstractSimiScreen {
}
graphics.drawString(font,
Component.literal("\u2265 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? onAbove.getState() / valueStep
: blockEntity.format(onAbove.getState() / valueStep, stacks)
.getString())),
graphics.drawString(font,
Component.literal("\u2265 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? onAbove.getState() / valueStep
: blockEntity.format(onAbove.getState() / valueStep, stacks)
.getString())),
x + 53, y + 28, 0xFFFFFFFF, true);
graphics.drawString(font,
Component.literal("\u2264 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? offBelow.getState() / valueStep
: blockEntity.format(offBelow.getState() / valueStep, stacks)
.getString())),
graphics.drawString(font,
Component.literal("\u2264 " + (typeOfCurrentTarget == ThresholdType.UNSUPPORTED ? ""
: forItems ? offBelow.getState() / valueStep
: blockEntity.format(offBelow.getState() / valueStep, stacks)
.getString())),
x + 53, y + 28 + 24, 0xFFFFFFFF, true);
GuiGameElement.of(renderedItem).<GuiGameElement
.GuiRenderBuilder>at(x + background.getWidth() + 6, y + background.getHeight() - 56, -200)
.GuiRenderBuilder>at(x + background.getWidth() + 6, y + background.getHeight() - 56, -200)
.scale(5)
.render(graphics);
@ -183,7 +182,7 @@ public class ThresholdSwitchScreen extends AbstractSimiScreen {
ItemStack displayItem = blockEntity.getDisplayItemForScreen();
GuiGameElement.of(displayItem.isEmpty() ? new ItemStack(Items.BARRIER) : displayItem).<GuiGameElement
.GuiRenderBuilder>at(itemX, itemY, 0)
.GuiRenderBuilder>at(itemX, itemY, 0)
.render(graphics);
int torchX = x + 23;
@ -202,7 +201,7 @@ public class ThresholdSwitchScreen extends AbstractSimiScreen {
for (boolean power : Iterate.trueAndFalse) {
GuiGameElement.of(Blocks.REDSTONE_TORCH.defaultBlockState()
.setValue(RedstoneTorchBlock.LIT, blockEntity.isInverted() ^ power))
.setValue(RedstoneTorchBlock.LIT, blockEntity.isInverted() ^ power))
.scale(20)
.render(graphics);
ms.translate(0, 26, 0);

View file

@ -27,7 +27,6 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.level.Level;
@ -92,9 +91,9 @@ public class ServerSchematicLoader {
public void handleNewUpload(ServerPlayer player, String schematic, long size, BlockPos pos) {
String playerPath = getSchematicPath() + "/" + player.getGameProfile()
.getName();
.getName();
String playerSchematicId = player.getGameProfile()
.getName() + "/" + schematic;
.getName() + "/" + schematic;
FilesHelper.createFolderIfMissing(playerPath);
// Unsupported Format
@ -104,11 +103,11 @@ public class ServerSchematicLoader {
}
Path playerSchematicsPath = Paths.get(getSchematicPath(), player.getGameProfile()
.getName())
.toAbsolutePath();
.getName())
.toAbsolutePath();
Path uploadPath = playerSchematicsPath.resolve(schematic)
.normalize();
.normalize();
if (!uploadPath.startsWith(playerSchematicsPath)) {
Create.LOGGER.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
return;
@ -140,8 +139,8 @@ public class ServerSchematicLoader {
if (count >= getConfig().maxSchematics.get()) {
Stream<Path> list2 = Files.list(Paths.get(playerPath));
Optional<Path> lastFilePath = list2.filter(f -> !Files.isDirectory(f))
.min(Comparator.comparingLong(f -> f.toFile()
.lastModified()));
.min(Comparator.comparingLong(f -> f.toFile()
.lastModified()));
list2.close();
if (lastFilePath.isPresent()) {
Files.deleteIfExists(lastFilePath.get());
@ -164,9 +163,9 @@ public class ServerSchematicLoader {
protected boolean validateSchematicSizeOnServer(ServerPlayer player, long size) {
Integer maxFileSize = getConfig().maxTotalSchematicSize.get();
if (size > maxFileSize * 1000) {
player.sendSystemMessage(CreateLang.translateDirect("schematics.uploadTooLarge")
player.sendSystemMessage(CreateLang.translateDirect("schematics.uploadTooLarge")
.append(Component.literal(" (" + size / 1000 + " KB).")));
player.sendSystemMessage(CreateLang.translateDirect("schematics.maxAllowedSize")
player.sendSystemMessage(CreateLang.translateDirect("schematics.maxAllowedSize")
.append(Component.literal(" " + maxFileSize + " KB")));
return false;
}
@ -179,7 +178,7 @@ public class ServerSchematicLoader {
public void handleWriteRequest(ServerPlayer player, String schematic, byte[] data) {
String playerSchematicId = player.getGameProfile()
.getName() + "/" + schematic;
.getName() + "/" + schematic;
if (activeUploads.containsKey(playerSchematicId)) {
SchematicUploadEntry entry = activeUploads.get(playerSchematicId);
@ -249,7 +248,7 @@ public class ServerSchematicLoader {
public void handleFinishedUpload(ServerPlayer player, String schematic) {
String playerSchematicId = player.getGameProfile()
.getName() + "/" + schematic;
.getName() + "/" + schematic;
if (activeUploads.containsKey(playerSchematicId)) {
try {
@ -294,10 +293,10 @@ public class ServerSchematicLoader {
}
Path schematicPath = Paths.get(getSchematicPath())
.toAbsolutePath();
.toAbsolutePath();
Path path = schematicPath.resolve(playerSchematicId)
.normalize();
.normalize();
if (!path.startsWith(schematicPath)) {
Create.LOGGER.warn("Attempted Schematic Upload with directory escape: {}", playerSchematicId);
return;
@ -314,8 +313,8 @@ public class ServerSchematicLoader {
return;
SchematicExportResult result = SchematicExport.saveSchematic(
playerSchematics, schematic, true,
world, pos, pos.offset(bounds).offset(-1, -1, -1)
playerSchematics, schematic, true,
world, pos, pos.offset(bounds).offset(-1, -1, -1)
);
if (result != null)
player.setItemInHand(InteractionHand.MAIN_HAND,

View file

@ -26,7 +26,7 @@ import com.simibubi.create.infrastructure.config.AllConfigs;
import net.minecraft.client.Minecraft;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@ -162,12 +162,12 @@ public class ClientSchematicLoader {
try {
Files.list(Paths.get("schematics/"))
.filter(f -> !Files.isDirectory(f) && f.getFileName().toString().endsWith(".nbt")).forEach(path -> {
if (Files.isDirectory(path))
return;
.filter(f -> !Files.isDirectory(f) && f.getFileName().toString().endsWith(".nbt")).forEach(path -> {
if (Files.isDirectory(path))
return;
availableSchematics.add(Component.literal(path.getFileName().toString()));
});
availableSchematics.add(Component.literal(path.getFileName().toString()));
});
} catch (NoSuchFileException e) {
// No Schematics created yet
} catch (IOException e) {

View file

@ -7,8 +7,6 @@ import java.util.Map;
import java.util.Objects;
import java.util.function.Supplier;
import net.minecraft.tags.ItemTags;
import org.apache.commons.lang3.ArrayUtils;
import com.simibubi.create.foundation.data.TagGen;
@ -23,9 +21,9 @@ import com.tterrag.registrate.util.entry.BlockEntry;
import com.tterrag.registrate.util.nullness.NonNullBiConsumer;
import com.tterrag.registrate.util.nullness.NonNullFunction;
import net.createmod.catnip.platform.CatnipServices;
import net.createmod.catnip.data.Iterate;
import net.createmod.catnip.lang.Lang;
import net.createmod.catnip.platform.CatnipServices;
import net.minecraft.data.recipes.RecipeCategory;
import net.minecraft.data.recipes.ShapelessRecipeBuilder;
import net.minecraft.resources.ResourceLocation;
@ -41,6 +39,7 @@ import net.minecraft.world.level.block.WeatheringCopperSlabBlock;
import net.minecraft.world.level.block.WeatheringCopperStairBlock;
import net.minecraft.world.level.block.state.BlockBehaviour.Properties;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.generators.ModelProvider;
import net.minecraftforge.fml.util.ObfuscationReflectionHelper;
@ -49,6 +48,7 @@ public class CopperBlockSet {
protected static final int WEATHER_STATE_COUNT = WEATHER_STATES.length;
protected static final Map<WeatherState, Supplier<Block>> BASE_BLOCKS = new EnumMap<>(WeatherState.class);
static {
BASE_BLOCKS.put(WeatherState.UNAFFECTED, () -> Blocks.COPPER_BLOCK);
BASE_BLOCKS.put(WeatherState.EXPOSED, () -> Blocks.EXPOSED_COPPER);
@ -57,7 +57,7 @@ public class CopperBlockSet {
}
public static final Variant<?>[] DEFAULT_VARIANTS =
new Variant<?>[] { BlockVariant.INSTANCE, SlabVariant.INSTANCE, StairVariant.INSTANCE };
new Variant<?>[]{BlockVariant.INSTANCE, SlabVariant.INSTANCE, StairVariant.INSTANCE};
protected final String name;
protected final String generalDirectory; // Leave empty for root folder
@ -84,7 +84,7 @@ public class CopperBlockSet {
}
public CopperBlockSet(AbstractRegistrate<?> registrate, String name, String endTextureName, Variant<?>[] variants,
NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe, String generalDirectory, NonNullBiConsumer<WeatherState, Block> onRegister) {
NonNullBiConsumer<DataGenContext<Block, ?>, RegistrateRecipeProvider> mainBlockRecipe, String generalDirectory, NonNullBiConsumer<WeatherState, Block> onRegister) {
this.name = name;
this.generalDirectory = generalDirectory;
this.endTextureName = endTextureName;
@ -116,7 +116,7 @@ public class CopperBlockSet {
}
protected <T extends Block> BlockEntry<?> createEntry(AbstractRegistrate<?> registrate, Variant<T> variant,
WeatherState state, boolean waxed) {
WeatherState state, boolean waxed) {
String name = "";
if (waxed) {
name += "waxed_";
@ -211,20 +211,21 @@ public class CopperBlockSet {
NonNullFunction<Properties, T> getFactory(CopperBlockSet blocks, WeatherState state, boolean waxed);
default void generateLootTable(RegistrateBlockLootTables lootTable, T block, CopperBlockSet blocks,
WeatherState state, boolean waxed) {
WeatherState state, boolean waxed) {
lootTable.dropSelf(block);
}
void generateRecipes(BlockEntry<?> blockVariant, DataGenContext<Block, T> ctx, RegistrateRecipeProvider prov);
void generateBlockState(DataGenContext<Block, T> ctx, RegistrateBlockstateProvider prov, CopperBlockSet blocks,
WeatherState state, boolean waxed);
WeatherState state, boolean waxed);
}
public static class BlockVariant implements Variant<Block> {
public static final BlockVariant INSTANCE = new BlockVariant();
protected BlockVariant() {}
protected BlockVariant() {
}
@Override
public String getSuffix() {
@ -242,7 +243,7 @@ public class CopperBlockSet {
@Override
public void generateBlockState(DataGenContext<Block, Block> ctx, RegistrateBlockstateProvider prov,
CopperBlockSet blocks, WeatherState state, boolean waxed) {
CopperBlockSet blocks, WeatherState state, boolean waxed) {
Block block = ctx.get();
String path = CatnipServices.REGISTRIES.getKeyOrThrow(block)
.getPath();
@ -256,21 +257,23 @@ public class CopperBlockSet {
// End texture and base texture aren't equal, so we should use cube_column.
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
prov.simpleBlock(block, prov.models()
.cubeColumn(path, texture, endTexture));
.cubeColumn(path, texture, endTexture));
}
}
@Override
public void generateRecipes(BlockEntry<?> blockVariant, DataGenContext<Block, Block> ctx,
RegistrateRecipeProvider prov) {}
RegistrateRecipeProvider prov) {
}
}
public static class SlabVariant implements Variant<SlabBlock> {
public static final SlabVariant INSTANCE = new SlabVariant();
protected SlabVariant() {}
protected SlabVariant() {
}
@Override
public String getSuffix() {
@ -279,7 +282,7 @@ public class CopperBlockSet {
@Override
public NonNullFunction<Properties, SlabBlock> getFactory(CopperBlockSet blocks, WeatherState state,
boolean waxed) {
boolean waxed) {
if (waxed) {
return SlabBlock::new;
} else {
@ -289,13 +292,13 @@ public class CopperBlockSet {
@Override
public void generateLootTable(RegistrateBlockLootTables lootTable, SlabBlock block, CopperBlockSet blocks,
WeatherState state, boolean waxed) {
WeatherState state, boolean waxed) {
lootTable.add(block, lootTable.createSlabItemTable(block));
}
@Override
public void generateBlockState(DataGenContext<Block, SlabBlock> ctx, RegistrateBlockstateProvider prov,
CopperBlockSet blocks, WeatherState state, boolean waxed) {
CopperBlockSet blocks, WeatherState state, boolean waxed) {
ResourceLocation fullModel =
prov.modLoc(ModelProvider.BLOCK_FOLDER + "/" + getWeatherStatePrefix(state) + blocks.getName());
@ -308,7 +311,7 @@ public class CopperBlockSet {
@Override
public void generateRecipes(BlockEntry<?> blockVariant, DataGenContext<Block, SlabBlock> ctx,
RegistrateRecipeProvider prov) {
RegistrateRecipeProvider prov) {
prov.slab(DataIngredient.items(blockVariant.get()), RecipeCategory.BUILDING_BLOCKS, ctx::get, null, true);
}
}
@ -329,7 +332,7 @@ public class CopperBlockSet {
@Override
public NonNullFunction<Properties, StairBlock> getFactory(CopperBlockSet blocks, WeatherState state,
boolean waxed) {
boolean waxed) {
if (!blocks.hasVariant(parent)) {
throw new IllegalStateException(
"Cannot add StairVariant '" + toString() + "' without parent Variant '" + parent.toString() + "'!");
@ -353,7 +356,7 @@ public class CopperBlockSet {
@Override
public void generateBlockState(DataGenContext<Block, StairBlock> ctx, RegistrateBlockstateProvider prov,
CopperBlockSet blocks, WeatherState state, boolean waxed) {
CopperBlockSet blocks, WeatherState state, boolean waxed) {
String baseLoc = ModelProvider.BLOCK_FOLDER + "/" + blocks.generalDirectory + getWeatherStatePrefix(state);
ResourceLocation texture = prov.modLoc(baseLoc + blocks.getName());
ResourceLocation endTexture = prov.modLoc(baseLoc + blocks.getEndTextureName());
@ -362,7 +365,7 @@ public class CopperBlockSet {
@Override
public void generateRecipes(BlockEntry<?> blockVariant, DataGenContext<Block, StairBlock> ctx,
RegistrateRecipeProvider prov) {
RegistrateRecipeProvider prov) {
prov.stairs(DataIngredient.items(blockVariant.get()), RecipeCategory.BUILDING_BLOCKS, ctx::get, null, true);
}
}

View file

@ -16,13 +16,13 @@ import com.simibubi.create.foundation.blockEntity.behaviour.ValueSettingsFormatt
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.util.Mth;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.Vec3;
import net.minecraftforge.common.util.FakePlayer;
public class ScrollValueBehaviour extends BlockEntityBehaviour implements ValueSettingsBehaviour {
@ -156,7 +156,7 @@ public class ScrollValueBehaviour extends BlockEntityBehaviour implements ValueS
@Override
public ValueSettingsBoard createBoard(Player player, BlockHitResult hitResult) {
return new ValueSettingsBoard(label, max, 10, ImmutableList.of(Component.literal("Value")),
return new ValueSettingsBoard(label, max, 10, ImmutableList.of(Component.literal("Value")),
new ValueSettingsFormatter(ValueSettings::format));
}

View file

@ -9,7 +9,6 @@ import static net.minecraft.world.level.block.state.properties.BlockStatePropert
import java.util.function.Supplier;
import com.simibubi.create.AllTags.AllBlockTags;
import com.simibubi.create.Create;
import com.tterrag.registrate.providers.DataGenContext;
import com.tterrag.registrate.providers.RegistrateBlockstateProvider;
import com.tterrag.registrate.util.DataIngredient;
@ -24,6 +23,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.IronBarsBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.material.MapColor;
import net.minecraftforge.client.model.generators.ModelFile;
public class MetalBarsGen {
@ -112,7 +112,7 @@ public class MetalBarsGen {
}
private static ModelFile barsSubModel(RegistrateBlockstateProvider p, String name, String suffix,
boolean specialEdge) {
boolean specialEdge) {
ResourceLocation barsTexture = p.modLoc("block/bars/" + name + "_bars");
ResourceLocation edgeTexture = specialEdge ? p.modLoc("block/bars/" + name + "_bars_edge") : barsTexture;
return p.models()
@ -123,7 +123,7 @@ public class MetalBarsGen {
}
public static BlockEntry<IronBarsBlock> createBars(String name, boolean specialEdge,
Supplier<DataIngredient> ingredient, MapColor color) {
Supplier<DataIngredient> ingredient, MapColor color) {
return REGISTRATE.block(name + "_bars", IronBarsBlock::new)
.addLayer(() -> RenderType::cutoutMipped)
.initialProperties(() -> Blocks.IRON_BARS)

View file

@ -2,7 +2,6 @@ package com.simibubi.create.foundation.fluid;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@ -23,6 +22,7 @@ import net.minecraft.tags.TagKey;
import net.minecraft.util.GsonHelper;
import net.minecraft.world.level.material.FlowingFluid;
import net.minecraft.world.level.material.Fluid;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.registries.ForgeRegistries;

View file

@ -22,7 +22,6 @@ import net.minecraft.network.chat.ClickEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.ComponentUtils;
import net.minecraft.network.chat.HoverEvent;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.util.Mth;
@ -49,8 +48,8 @@ public class DumpRailwaysCommand {
CommandSourceStack source = ctx.getSource();
fillReport(source.getLevel(), source.getPosition(),
(s, f) -> source.sendSuccess(() -> {
return Component.literal(s).withStyle(st -> st.withColor(f));
}, false),
return Component.literal(s).withStyle(st -> st.withColor(f));
}, false),
(c) -> source.sendSuccess(() -> c, false));
return 1;
});
@ -58,7 +57,7 @@ public class DumpRailwaysCommand {
// https://www.compart.com/en/unicode/search?q=box+drawings+light#characters
static void fillReport(ServerLevel level, Vec3 location, BiConsumer<String, Integer> chat,
Consumer<Component> chatRaw) {
Consumer<Component> chatRaw) {
GlobalRailwayManager railways = Create.RAILWAYS;
@ -85,7 +84,7 @@ public class DumpRailwaysCommand {
chat.accept(graph.id.toString()
.substring(0, 5) + " with "
+ graph.getNodes()
.size()
.size()
+ " Nodes", white);
Collection<SignalBoundary> signals = graph.getPoints(EdgePointType.SIGNAL);
if (!signals.isEmpty())
@ -113,9 +112,9 @@ public class DumpRailwaysCommand {
chat.accept("", white);
for (Train train : nearestTrains) {
chat.accept(String.format("┬%1$s: %2$s, %3$d Wagons",
train.id.toString().substring(0, 5),
train.name.getString(),
train.carriages.size()
train.id.toString().substring(0, 5),
train.name.getString(),
train.carriages.size()
), bright);
if (train.derailed)
chat.accept("├─Derailed", orange);
@ -135,9 +134,9 @@ public class DumpRailwaysCommand {
ScheduleRuntime runtime = train.runtime;
if (runtime.getSchedule() != null) {
chat.accept("├─Schedule, Entry " + runtime.currentEntry + ", "
+ (runtime.paused ? "Paused"
+ (runtime.paused ? "Paused"
: runtime.state.name()
.replaceAll("_", " ")),
.replaceAll("_", " ")),
runtime.paused ? darkBlue : blue);
} else
chat.accept("├─Idle, No Schedule", darkBlue);
@ -163,29 +162,29 @@ public class DumpRailwaysCommand {
}
private static Component createDeleteButton(Train train) {
return Component.literal("└─").withStyle(style -> style.withColor(blue)).append(
return Component.literal("└─").withStyle(style -> style.withColor(blue)).append(
ComponentUtils.wrapInSquareBrackets(
Component.literal("Remove").withStyle(style -> style.withColor(orange))
Component.literal("Remove").withStyle(style -> style.withColor(orange))
).withStyle(style -> {
return style
.withColor(blue)
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/c train remove " + train.id.toString()))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Click to remove ").append(train.name)));
}
return style
.withColor(blue)
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/c train remove " + train.id.toString()))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Click to remove ").append(train.name)));
}
)
);
}
private static Component createTeleportButton(Train train) {
return Component.literal("├─").withStyle(style -> style.withColor(darkBlue)).append(
return Component.literal("├─").withStyle(style -> style.withColor(darkBlue)).append(
ComponentUtils.wrapInSquareBrackets(
Component.literal("Teleport").withStyle(style -> style.withColor(orange))
).withStyle(style -> {
return style
.withColor(darkBlue)
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/c train tp " + train.id.toString()))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Click to teleport to ").append(train.name)));
}
return style
.withColor(darkBlue)
.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/c train tp " + train.id.toString()))
.withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal("Click to teleport to ").append(train.name)));
}
)
);
}

View file

@ -12,7 +12,6 @@ import com.simibubi.create.infrastructure.gametest.CreateGameTestHelper;
import com.simibubi.create.infrastructure.gametest.GameTestGroup;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.gametest.framework.GameTest;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.server.level.ServerLevel;
@ -36,8 +35,8 @@ public class TestMisc {
BlockPos redEndTop = helper.absolutePos(new BlockPos(5, 4, 7));
ServerLevel level = helper.getLevel();
SchematicExport.saveSchematic(
SchematicExport.SCHEMATICS.resolve("uploaded/Deployer"), "schematicannon_gametest", true,
level, whiteEndBottom, redEndTop
SchematicExport.SCHEMATICS.resolve("uploaded/Deployer"), "schematicannon_gametest", true,
level, whiteEndBottom, redEndTop
);
ItemStack schematic =
SchematicItem.create(level, "schematicannon_gametest.nbt", "Deployer");

View file

@ -18,7 +18,6 @@ import net.createmod.ponder.api.scene.Selection;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.phys.AABB;
@ -150,7 +149,7 @@ public class ElevatorScenes {
scene.idle(75);
scene.overlay().showControls(util.vector().blockSurface(util.grid().at(3, 6, 2), Direction.NORTH), Pointing.RIGHT, 60)
.rightClick();
.rightClick();
scene.idle(7);
scene.effects().indicateSuccess(util.grid().at(3, 6, 2));
scene.world().toggleRedstonePower(util.select().position(1, 13, 2));
@ -173,7 +172,7 @@ public class ElevatorScenes {
scene.idle(80);
scene.overlay().showControls(util.vector().blockSurface(util.grid().at(1, 1, 2), Direction.UP), Pointing.DOWN, 60)
.rightClick();
.rightClick();
scene.idle(7);
scene.overlay().showOutlineWithText(util.select().position(1, 1, 2), 60)
.placeNearTarget()
@ -241,7 +240,7 @@ public class ElevatorScenes {
scene.idle(10);
scene.overlay().showControls(util.vector().blockSurface(util.grid().at(4, 2, 2), Direction.UP), Pointing.DOWN, 60)
.scroll();
.scroll();
scene.idle(15);
scene.overlay().showText(90)
.placeNearTarget()
@ -250,7 +249,7 @@ public class ElevatorScenes {
scene.idle(85);
scene.overlay().showControls(util.vector().blockSurface(util.grid().at(4, 2, 2), Direction.UP), Pointing.DOWN, 10)
.rightClick();
.rightClick();
scene.idle(7);
scene.world().cycleBlockProperty(midContact, ElevatorContactBlock.POWERING);
scene.world().cycleBlockProperty(topContact, ElevatorContactBlock.CALLING);
@ -266,7 +265,7 @@ public class ElevatorScenes {
scene.idle(15);
scene.overlay().showControls(util.vector().blockSurface(util.grid().at(3, 6, 2), Direction.NORTH), Pointing.RIGHT, 60)
.rightClick();
.rightClick();
scene.idle(7);
scene.effects().indicateSuccess(util.grid().at(3, 6, 2));
scene.world().movePulley(pulleyPos, -1, 0);
@ -282,7 +281,7 @@ public class ElevatorScenes {
scene.idle(20);
scene.overlay().showControls(util.vector().blockSurface(util.grid().at(3, 6, 2), Direction.NORTH), Pointing.RIGHT, 60)
.rightClick();
.rightClick();
scene.idle(7);
scene.effects().indicateSuccess(util.grid().at(3, 6, 2));
scene.world().movePulley(pulleyPos, 1, 0);
@ -361,14 +360,14 @@ public class ElevatorScenes {
scene.world().showSectionAndMerge(util.select().position(nixiePos), Direction.DOWN, camLink);
scene.idle(15);
scene.overlay().showControls(util.vector().blockSurface(util.grid().at(4, 1, 0), Direction.UP), Pointing.DOWN, 15)
.rightClick()
.withItem(AllBlocks.DISPLAY_LINK.asStack());
.rightClick()
.withItem(AllBlocks.DISPLAY_LINK.asStack());
scene.world().toggleRedstonePower(util.select().position(1, 14, 2));
scene.idle(15);
scene.world().showSectionAndMerge(util.select().position(linkPos), Direction.DOWN, camLink);
scene.world().flashDisplayLink(linkPos);
scene.world().modifyBlockEntityNBT(util.select().position(nixiePos), NixieTubeBlockEntity.class, nbt -> {
Component component = Component.literal("0F");
Component component = Component.literal("0F");
nbt.putString("RawCustomText", component.getString());
nbt.putString("CustomText", Component.Serializer.toJson(component));
});
@ -399,7 +398,7 @@ public class ElevatorScenes {
scene.world().flashDisplayLink(linkPos);
scene.world().modifyBlockEntityNBT(util.select().position(nixiePos), NixieTubeBlockEntity.class, nbt -> {
Component component = Component.literal("1F");
Component component = Component.literal("1F");
nbt.putString("RawCustomText", component.getString());
nbt.putString("CustomText", Component.Serializer.toJson(component));
});
@ -415,7 +414,7 @@ public class ElevatorScenes {
scene.world().flashDisplayLink(linkPos);
scene.world().modifyBlockEntityNBT(util.select().position(nixiePos), NixieTubeBlockEntity.class, nbt -> {
Component component = Component.literal("2F");
Component component = Component.literal("2F");
nbt.putString("RawCustomText", component.getString());
nbt.putString("CustomText", Component.Serializer.toJson(component));
});

View file

@ -30,7 +30,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.world.item.DyeColor;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
@ -507,10 +506,10 @@ public class RedstoneScenes {
scene.title("analog_lever", "Controlling signals using the Analog Lever");
scene.configureBasePlate(0, 0, 5);
BlockPos[] wireLocations = new BlockPos[] { util.grid().at(2, 1, 1), util.grid().at(2, 1, 0), util.grid().at(1, 1, 0),
BlockPos[] wireLocations = new BlockPos[]{util.grid().at(2, 1, 1), util.grid().at(2, 1, 0), util.grid().at(1, 1, 0),
util.grid().at(0, 1, 0), util.grid().at(0, 1, 1), util.grid().at(0, 1, 2), util.grid().at(0, 1, 3),
util.grid().at(0, 1, 4), util.grid().at(1, 1, 4), util.grid().at(2, 1, 4), util.grid().at(3, 1, 4),
util.grid().at(4, 1, 4), util.grid().at(4, 1, 3), util.grid().at(4, 1, 2), util.grid().at(4, 1, 1) };
util.grid().at(4, 1, 4), util.grid().at(4, 1, 3), util.grid().at(4, 1, 2), util.grid().at(4, 1, 1)};
Selection leverSelection = util.select().fromTo(2, 1, 2, 2, 2, 2);
Selection lamp = util.select().position(4, 1, 0);
@ -638,7 +637,7 @@ public class RedstoneScenes {
.withItem(clipboard);
scene.idle(7);
Component component = Component.literal("CREATE");
Component component = Component.literal("CREATE");
for (int i = 0; i < 3; i++) {
final int index = i;
scene.world().modifyBlockEntityNBT(util.select().position(3 - i, 1, 3), NixieTubeBlockEntity.class, nbt -> {