Added spotless back and reformatted

This commit is contained in:
Sebastian Hartte
2020-07-27 20:07:27 +02:00
parent 49296915c9
commit 780f68952b
593 changed files with 4192 additions and 3969 deletions
@@ -18,17 +18,19 @@
package appeng.attributes;
import alexiil.mc.lib.attributes.Attribute;
import alexiil.mc.lib.attributes.Attributes;
import alexiil.mc.lib.attributes.SearchOptions;
import appeng.api.storage.IStorageMonitorableAccessor;
import appeng.parts.AEBasePart;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.Attribute;
import alexiil.mc.lib.attributes.Attributes;
import alexiil.mc.lib.attributes.SearchOptions;
import appeng.api.storage.IStorageMonitorableAccessor;
import appeng.parts.AEBasePart;
/**
* Utility class that holds various attributes, both by AE2 and other Mods.
*/
@@ -37,8 +39,8 @@ public final class MEAttributes {
private MEAttributes() {
}
public static Attribute<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR
= Attributes.createDefaulted(IStorageMonitorableAccessor.class, new NullMENetworkAccessor());
public static Attribute<IStorageMonitorableAccessor> STORAGE_MONITORABLE_ACCESSOR = Attributes
.createDefaulted(IStorageMonitorableAccessor.class, new NullMENetworkAccessor());
public static <T> T getFirstAttributeOnSide(Attribute<T> attribute, BlockEntity be, Direction side) {
World world = be.getWorld();
@@ -49,7 +51,8 @@ public final class MEAttributes {
return attribute.getFirstOrNull(world, be.getPos().offset(side), SearchOptions.inDirection(side.getOpposite()));
}
// Convenience function to get an attribute of the block that is in front of a part
// Convenience function to get an attribute of the block that is in front of a
// part
public static <T> T getAttributeInFrontOfPart(Attribute<T> attribute, AEBasePart part) {
BlockEntity self = part.getHost().getTile();
Direction direction = part.getSide().getFacing();
+7 -8
View File
@@ -21,24 +21,24 @@ package appeng.block;
import javax.annotation.Nullable;
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.BlockView;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.World;
import net.fabricmc.fabric.api.tool.attribute.v1.FabricToolTags;
import net.minecraft.world.WorldAccess;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
@@ -68,8 +68,7 @@ public abstract class AEBaseBlock extends Block {
public static FabricBlockSettings defaultProps(Material material, MaterialColor color) {
return FabricBlockSettings.of(material, color)
// These values previousls were encoded in AEBaseBlock
.strength(2.2f, 11.f)
.breakByTool(FabricToolTags.PICKAXES, 0)
.strength(2.2f, 11.f).breakByTool(FabricToolTags.PICKAXES, 0)
.sounds(getDefaultSoundByMaterial(material));
}
@@ -20,24 +20,24 @@ package appeng.block;
import java.util.List;
import appeng.block.networking.WirelessBlock;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.client.item.TooltipContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction;
import net.minecraft.text.Text;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
import appeng.block.misc.LightDetectorBlock;
import appeng.block.misc.SkyCompassBlock;
import appeng.block.networking.WirelessBlock;
import appeng.me.helpers.IGridProxyable;
import appeng.tile.AEBaseBlockEntity;
@@ -18,14 +18,9 @@
package appeng.block;
import appeng.core.Api;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerUnits;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
import java.text.MessageFormat;
import java.util.List;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.object.builder.v1.client.model.FabricModelPredicateProviderRegistry;
@@ -38,24 +33,27 @@ import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import net.minecraft.world.World;
import java.text.MessageFormat;
import java.util.List;
import appeng.api.config.AccessRestriction;
import appeng.api.config.Actionable;
import appeng.api.config.PowerUnits;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.implementations.items.IAEItemPowerStorage;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.localization.GuiText;
public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEItemPowerStorage {
public AEBaseBlockItemChargeable(Block id, Settings props) {
super(id, props);
FabricModelPredicateProviderRegistry.register(
this,
new Identifier(AppEng.MOD_ID, "fill_level"),
FabricModelPredicateProviderRegistry.register(this, new Identifier(AppEng.MOD_ID, "fill_level"),
(is, world, entity) -> {
double curPower = getAECurrentPower(is);
double maxPower = getAEMaxPower(is);
return (int) Math.round(100 * curPower / maxPower);
}
);
});
}
@Override
@@ -73,8 +71,7 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
final double percent = internalCurrentPower / internalMaxPower;
lines.add(GuiText.StoredEnergy.text()
.copy()
lines.add(GuiText.StoredEnergy.text().copy()
.append(':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower))
.append(new TranslatableText(PowerUnits.AE.unlocalizedName))
.append(" - " + MessageFormat.format("{0,number,#.##%}", percent)));
+21 -20
View File
@@ -25,11 +25,6 @@ import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import alexiil.mc.lib.attributes.AttributeList;
import alexiil.mc.lib.attributes.AttributeProvider;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.block.networking.CableBusBlock;
import appeng.tile.networking.CableBusBlockEntity;
import com.google.common.collect.Lists;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents;
@@ -39,28 +34,35 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.LiteralText;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import alexiil.mc.lib.attributes.AttributeList;
import alexiil.mc.lib.attributes.AttributeProvider;
import alexiil.mc.lib.attributes.item.FixedItemInv;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.api.util.IOrientable;
import appeng.tile.AEBaseInvBlockEntity;
import appeng.block.networking.CableBusBlock;
import appeng.tile.AEBaseBlockEntity;
import appeng.tile.AEBaseInvBlockEntity;
import appeng.tile.networking.CableBusBlockEntity;
import appeng.tile.storage.SkyChestBlockEntity;
import appeng.util.Platform;
import appeng.util.SettingsFrom;
public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBaseBlock implements BlockEntityProvider, AttributeProvider {
public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBaseBlock
implements BlockEntityProvider, AttributeProvider {
@Nonnull
private Class<T> blockEntityClass;
@@ -141,22 +143,21 @@ public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBas
}
/**
* Calculate redstone output level.
* 0 if completely empty, 1 if _any_ item is present, up to 15 if all slots are full.
* Calculate redstone output level. 0 if completely empty, 1 if _any_ item is
* present, up to 15 if all slots are full.
*/
private int getRedstoneFromFixedItemInv(FixedItemInv inv) {
boolean foundAnything = false; // ANY slots non-empty?
float fillRatio = 0;
for (int i = 0; i < inv.getSlotCount(); ++i)
{
for (int i = 0; i < inv.getSlotCount(); ++i) {
ItemStack stack = inv.getInvStack(i);
if (stack.isEmpty()) {
continue;
}
int slotMaxCount = inv.getMaxAmount(i, stack);
fillRatio += stack.getCount() / (float)Math.min(slotMaxCount, stack.getMaxCount());
fillRatio += stack.getCount() / (float) Math.min(slotMaxCount, stack.getMaxCount());
foundAnything = true;
}
@@ -192,8 +193,8 @@ public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBas
}
@Override
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player,
Hand hand, BlockHitResult hit) {
public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand,
BlockHitResult hit) {
ItemStack heldItem;
if (player != null && !player.getStackInHand(hand).isEmpty()) {
heldItem = player.getStackInHand(hand);
@@ -271,7 +272,7 @@ public abstract class AEBaseTileBlock<T extends AEBaseBlockEntity> extends AEBas
}
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
return ActionResult.PASS;
}
@@ -18,11 +18,6 @@
package appeng.block.crafting;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.CraftingCPUContainer;
import appeng.tile.crafting.CraftingBlockEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
@@ -34,6 +29,12 @@ import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.CraftingCPUContainer;
import appeng.tile.crafting.CraftingBlockEntity;
public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> extends AEBaseTileBlock<T> {
public static final BooleanProperty FORMED = BooleanProperty.of("formed");
public static final BooleanProperty POWERED = BooleanProperty.of("powered");
@@ -77,8 +78,7 @@ public abstract class AbstractCraftingUnitBlock<T extends CraftingBlockEntity> e
}
@Override
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
BlockHitResult hit) {
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockHitResult hit) {
final CraftingBlockEntity tg = this.getBlockEntity(w, pos);
if (tg != null && !p.isInSneakingPose() && tg.isFormed() && tg.isActive()) {
@@ -21,8 +21,8 @@ package appeng.block.crafting;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@@ -56,8 +56,7 @@ public class MolecularAssemblerBlock extends AEBaseTileBlock<MolecularAssemblerB
}
@Override
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand,
BlockHitResult hit) {
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity p, Hand hand, BlockHitResult hit) {
final MolecularAssemblerBlockEntity tg = this.getBlockEntity(w, pos);
if (tg != null && !p.isInSneakingPose()) {
if (!tg.isClient()) {
@@ -20,33 +20,33 @@ package appeng.block.grindstone;
import javax.annotation.Nullable;
import appeng.util.FakePlayer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.World;
import appeng.api.implementations.tiles.ICrankable;
import appeng.block.AEBaseTileBlock;
import appeng.core.stats.AeStats;
import appeng.tile.AEBaseBlockEntity;
import appeng.tile.grindstone.CrankBlockEntity;
import appeng.util.FakePlayer;
public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
@@ -79,8 +79,8 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
}
@Override
public void onPlaced(final World world, final BlockPos pos, final BlockState state,
final LivingEntity placer, final ItemStack stack) {
public void onPlaced(final World world, final BlockPos pos, final BlockState state, final LivingEntity placer,
final ItemStack stack) {
final AEBaseBlockEntity tile = this.getBlockEntity(world, pos);
if (tile != null) {
final Direction mnt = this.findCrankable(world, pos);
@@ -95,7 +95,8 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
}
@Override
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
final Direction up) {
final BlockEntity te = w.getBlockEntity(pos);
return !(te instanceof CrankBlockEntity) || this.isCrankable(w, pos, up.getOpposite());
}
@@ -155,8 +156,8 @@ public class CrankBlock extends AEBaseTileBlock<CrankBlockEntity> {
final double xOff = -0.15 * up.getOffsetX();
final double yOff = -0.15 * up.getOffsetY();
final double zOff = -0.15 * up.getOffsetZ();
return VoxelShapes.cuboid(
new Box(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85));
return VoxelShapes
.cuboid(new Box(xOff + 0.15, yOff + 0.15, zOff + 0.15, xOff + 0.85, yOff + 0.85, zOff + 0.85));
}
}
@@ -21,8 +21,8 @@ package appeng.block.grindstone;
import javax.annotation.Nullable;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
@@ -25,8 +25,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
@@ -23,28 +23,28 @@ import java.util.function.Function;
import javax.annotation.Nullable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.model.json.Transformation;
import net.minecraft.client.util.math.AffineTransformation;
import net.minecraft.util.math.Box;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.ShapeContext;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.model.json.Transformation;
import net.minecraft.client.util.math.AffineTransformation;
import net.minecraft.client.util.math.Vector3f;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
@@ -110,8 +110,9 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
for (int bolts = 0; bolts < 3; bolts++) {
if (AppEng.instance().shouldAddParticles(r)) {
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, xOff + 0.5 + pos.getX(),
yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0, 0.0, 0.0);
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING,
xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0, 0.0,
0.0);
}
}
}
@@ -171,8 +172,7 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
ShapeContext context) {
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return VoxelShapes.cuboid(new Box(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
}
@@ -183,7 +183,8 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerBlockEntity> {
@Environment(EnvType.CLIENT)
private static Pair<ItemStack, Transformation> getRenderedItem(ChargerBlockEntity tile) {
Transformation transform = new Transformation(new Vector3f(), new Vector3f(0.5f, 0.375f, 0.5f), new Vector3f(1f, 1f, 1f));
Transformation transform = new Transformation(new Vector3f(), new Vector3f(0.5f, 0.375f, 0.5f),
new Vector3f(1f, 1f, 1f));
return new ImmutablePair<>(tile.getInternalInventory().getInvStack(0), transform);
}
@@ -25,13 +25,13 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import appeng.api.util.IOrientable;
@@ -19,18 +19,18 @@
package appeng.block.misc;
import net.minecraft.block.*;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.World;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
@@ -56,7 +56,8 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
}
@Override
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) {
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos,
final Direction side) {
if (w instanceof World && this.getBlockEntity(w, pos).isReady()) {
// FIXME: This is ... uhm... fishy
return ((World) w).getLightLevel(pos) - 6;
@@ -70,7 +71,8 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
return true;
}
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState, WorldAccess world, BlockPos pos, BlockPos posFrom) {
public BlockState getStateForNeighborUpdate(BlockState state, Direction direction, BlockState newState,
WorldAccess world, BlockPos pos, BlockPos posFrom) {
final Direction up = this.getOrientable(world, pos).getUp();
if (!this.canPlaceAt(world, pos, up.getOpposite())) {
// FIXME: Double check that this actually updates neighbors
@@ -86,7 +88,8 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
}
@Override
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
final Direction up) {
return this.canPlaceAt(w, pos, up.getOpposite());
}
@@ -106,13 +109,11 @@ public class LightDetectorBlock extends AEBaseTileBlock<LightDetectorBlockEntity
final double xOff = -0.3 * up.getOffsetX();
final double yOff = -0.3 * up.getOffsetY();
final double zOff = -0.3 * up.getOffsetZ();
return VoxelShapes
.cuboid(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
return VoxelShapes.cuboid(new Box(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
ShapeContext context) {
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return VoxelShapes.empty();
}
@@ -24,28 +24,28 @@ import java.util.Random;
import javax.annotation.Nullable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.block.Material;
import net.minecraft.block.ShapeContext;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.block.Material;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.property.DirectionProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.Properties;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import appeng.api.util.IOrientable;
import appeng.api.util.IOrientableBlock;
@@ -80,8 +80,7 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
public static final BooleanProperty ODD = BooleanProperty.of("odd");
public QuartzFixtureBlock() {
super(defaultProps(Material.SUPPORTED).noCollision().strength(0).lightLevel(14)
.sounds(BlockSoundGroup.GLASS));
super(defaultProps(Material.SUPPORTED).noCollision().strength(0).lightLevel(14).sounds(BlockSoundGroup.GLASS));
this.setDefaultState(getDefaultState().with(FACING, Direction.UP).with(ODD, false));
}
@@ -117,8 +116,8 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
// Break the fixture if the block it is attached to is changed so that it could
// no longer be placed
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState, WorldAccess worldIn,
BlockPos pos, BlockPos facingPos) {
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState,
WorldAccess worldIn, BlockPos pos, BlockPos facingPos) {
Direction fixtureFacing = state.get(FACING);
if (facing.getOpposite() == fixtureFacing && !canPlaceAt(worldIn, pos, facing)) {
return Blocks.AIR.getDefaultState();
@@ -127,7 +126,8 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
}
@Override
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
final Direction up) {
// FIXME: I think this entire method -> not required, but not sure... are quartz
// fixtures rotateable???
return this.canPlaceAt(w, pos, up.getOpposite());
@@ -21,17 +21,17 @@ package appeng.block.misc;
import java.util.Random;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.block.Material;
import net.minecraft.client.MinecraftClient;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.sound.BlockSoundGroup;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.Direction;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import net.fabricmc.api.Environment;
import appeng.api.util.IOrientableBlock;
import appeng.block.AEBaseTileBlock;
@@ -52,7 +52,8 @@ public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAc
}
@Override
protected BlockState updateBlockStateFromTileEntity(BlockState currentState, QuartzGrowthAcceleratorBlockEntity te) {
protected BlockState updateBlockStateFromTileEntity(BlockState currentState,
QuartzGrowthAcceleratorBlockEntity te) {
return currentState.with(POWERED, te.isPowered());
}
@@ -134,7 +135,8 @@ public class QuartzGrowthAcceleratorBlock extends AEBaseTileBlock<QuartzGrowthAc
ry += dz * forward.getOffsetY();
rz += dz * forward.getOffsetZ();
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D, 0.0D);
MinecraftClient.getInstance().particleManager.addParticle(ParticleTypes.LIGHTNING, rx, ry, rz, 0.0D, 0.0D,
0.0D);
}
}
@@ -25,12 +25,12 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
@@ -19,8 +19,8 @@
package appeng.block.misc;
import net.fabricmc.api.EnvType;
import net.minecraft.client.render.RenderLayer;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.RenderLayer;
import appeng.api.util.AEColor;
import appeng.bootstrap.BlockRenderingCustomizer;
@@ -21,16 +21,16 @@ package appeng.block.misc;
import net.minecraft.block.Block;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import net.minecraft.world.WorldView;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.tile.misc.SkyCompassBlockEntity;
@@ -42,7 +42,8 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
}
@Override
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward, final Direction up) {
public boolean isValidOrientation(final WorldAccess w, final BlockPos pos, final Direction forward,
final Direction up) {
final SkyCompassBlockEntity sc = this.getBlockEntity(w, pos);
if (sc != null) {
return false;
@@ -145,8 +146,7 @@ public class SkyCompassBlock extends AEBaseTileBlock<SkyCompassBlockEntity> {
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
ShapeContext context) {
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return VoxelShapes.empty();
}
@@ -20,33 +20,32 @@ package appeng.block.misc;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.projectile.PersistentProjectileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.sound.SoundCategory;
import net.minecraft.sound.SoundEvents;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.sound.SoundCategory;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.explosion.Explosion;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.minecraft.world.explosion.Explosion;
import appeng.block.AEBaseBlock;
import appeng.entity.TinyTNTPrimedEntity;
public class TinyTNTBlock extends AEBaseBlock {
private static final VoxelShape SHAPE = VoxelShapes
.cuboid(new Box(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f));
private static final VoxelShape SHAPE = VoxelShapes.cuboid(new Box(0.25f, 0.0f, 0.25f, 0.75f, 0.5f, 0.75f));
public TinyTNTBlock(Settings props) {
super(props);
@@ -80,16 +79,17 @@ public class TinyTNTBlock extends AEBaseBlock {
public void startFuse(final World w, final BlockPos pos, final LivingEntity igniter) {
if (!w.isClient) {
final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(w, pos.getX() + 0.5F,
pos.getY(), pos.getZ() + 0.5F, igniter);
final TinyTNTPrimedEntity primedTinyTNTEntity = new TinyTNTPrimedEntity(w, pos.getX() + 0.5F, pos.getY(),
pos.getZ() + 0.5F, igniter);
w.spawnEntity(primedTinyTNTEntity);
w.playSound(null, primedTinyTNTEntity.getX(), primedTinyTNTEntity.getY(),
primedTinyTNTEntity.getZ(), SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1);
w.playSound(null, primedTinyTNTEntity.getX(), primedTinyTNTEntity.getY(), primedTinyTNTEntity.getZ(),
SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1, 1);
}
}
@Override
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos, boolean notify) {
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block block, BlockPos fromPos,
boolean notify) {
if (world.isReceivingRedstonePower(pos)) {
this.startFuse(world, pos, null);
world.removeBlock(pos, false);
@@ -28,13 +28,13 @@ import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.particle.ParticleTypes;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
@@ -18,25 +18,11 @@
package appeng.block.networking;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.PartItemStack;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.cablebus.CableBusBakedModel;
import appeng.client.render.cablebus.CableBusBreakingParticle;
import appeng.client.render.cablebus.CableBusRenderState;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ClickPacket;
import appeng.helpers.AEMaterials;
import appeng.integration.abstraction.IAEFacade;
import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
import appeng.tile.networking.CableBusBlockEntity;
import appeng.util.Platform;
import java.util.List;
import java.util.Random;
import javax.annotation.Nullable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.event.client.player.ClientPickBlockGatherCallback;
@@ -70,19 +56,32 @@ import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;
import appeng.api.parts.IFacadeContainer;
import appeng.api.parts.IFacadePart;
import appeng.api.parts.PartItemStack;
import appeng.api.parts.SelectedPart;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.cablebus.CableBusBakedModel;
import appeng.client.render.cablebus.CableBusBreakingParticle;
import appeng.client.render.cablebus.CableBusRenderState;
import appeng.core.AppEng;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ClickPacket;
import appeng.helpers.AEMaterials;
import appeng.integration.abstraction.IAEFacade;
import appeng.parts.ICableBusContainer;
import appeng.parts.NullCableBusContainer;
import appeng.tile.networking.CableBusBlockEntity;
import appeng.util.Platform;
public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implements IAEFacade {
private static final ICableBusContainer NULL_CABLE_BUS = new NullCableBusContainer();
public CableBusBlock() {
super(defaultProps(AEMaterials.GLASS)
.nonOpaque()
.dropsNothing()
.dynamicBounds());
super(defaultProps(AEMaterials.GLASS).nonOpaque().dropsNothing().dynamicBounds());
}
static {
@@ -92,8 +91,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
BlockState blockState = player.world.getBlockState(((BlockHitResult) result).getBlockPos());
if (blockState.getBlock() instanceof CableBusBlock) {
CableBusBlock cableBus = (CableBusBlock) blockState.getBlock();
return cableBus.getPickBlock(blockState,
result, player.world, blockResult.getBlockPos(), player);
return cableBus.getPickBlock(blockState, result, player.world, blockResult.getBlockPos(), player);
}
}
return ItemStack.EMPTY;
@@ -112,7 +110,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
}
@Override
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos, final Direction side) {
public int getWeakRedstonePower(final BlockState state, final BlockView w, final BlockPos pos,
final Direction side) {
return this.cb(w, pos).isProvidingWeakPower(side.getOpposite()); // TODO:
// IS
// OPPOSITE!?
@@ -144,21 +143,18 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
// FIXME FABRIC return this.cb(world, pos).getLightValue();
// FIXME FABRIC }
// FIXME: Must hook isClimbing ourselves
// FIXME FABRIC @Override
// FIXME FABRIC public boolean isLadder(BlockState state, WorldView world, BlockPos pos, LivingEntity entity) {
// FIXME FABRIC return this.cb(world, pos).isLadder(entity);
// FIXME FABRIC }
@Override
public boolean canReplace(BlockState state, ItemPlacementContext context) {
// FIXME: Potentially check the fluid one too
return super.canReplace(state, context) && this.cb(context.getWorld(), context.getBlockPos()).isEmpty();
}
// FIXME FABRIC Hook does not exist
// FIXME FABRIC @Override
// FIXME FABRIC public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player,
@@ -185,7 +181,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
// FIXME FABRIC }
public ItemStack getPickBlock(BlockState state, HitResult target, BlockView world, BlockPos pos,
PlayerEntity player) {
PlayerEntity player) {
final Vec3d v3 = target.getPos().subtract(pos.getX(), pos.getY(), pos.getZ());
final SelectedPart sp = this.cb(world, pos).selectPart(v3);
@@ -198,11 +194,11 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
return ItemStack.EMPTY;
}
// FIXME FABRIC MIXIN net.minecraft.client.particle.ParticleManager.addBlockBreakingParticles
// FIXME FABRIC MIXIN
// net.minecraft.client.particle.ParticleManager.addBlockBreakingParticles
@Environment(EnvType.CLIENT)
public boolean addHitEffects(final BlockState state, final World world, final HitResult target,
final ParticleManager effectRenderer) {
final ParticleManager effectRenderer) {
// Half the particle rate. Since we're spawning concentrated on a specific spot,
// our particle effect otherwise looks too strong
@@ -218,8 +214,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
ICableBusContainer cb = this.cb(world, blockPos);
// Our built-in model has the actual baked sprites we need
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager()
.getModel(this.getDefaultState());
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager().getModel(this.getDefaultState());
// We cannot add the effect if we don't have the model
if (!(model instanceof CableBusBakedModel)) {
@@ -238,21 +233,20 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
double z = target.getPos().z;
// FIXME: Check how this looks, probably like shit, maybe provide parts the
// ability to supply particle textures???
effectRenderer
.addParticle(new CableBusBreakingParticle((ClientWorld) world, x, y, z, texture).scale(0.8F));
effectRenderer.addParticle(new CableBusBreakingParticle((ClientWorld) world, x, y, z, texture).scale(0.8F));
}
return true;
}
// FIXME FABRIC: Mixin to net.minecraft.client.particle.ParticleManager.addBlockBreakParticles
// FIXME FABRIC: Mixin to
// net.minecraft.client.particle.ParticleManager.addBlockBreakParticles
@Environment(EnvType.CLIENT)
public boolean addDestroyEffects(BlockState state, World world, BlockPos pos, ParticleManager effectRenderer) {
ICableBusContainer cb = this.cb(world, pos);
// Our built-in model has the actual baked sprites we need
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager()
.getModel(this.getDefaultState());
BakedModel model = MinecraftClient.getInstance().getBlockRenderManager().getModel(this.getDefaultState());
// We cannot add the effect if we dont have the model
if (!(model instanceof CableBusBakedModel)) {
@@ -280,8 +274,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
// FIXME: Check how this looks, probably like shit, maybe provide parts the
// ability to supply particle textures???
Particle effect = new CableBusBreakingParticle((ClientWorld) world, x, y, z, x - pos.getX() - 0.5D,
y - pos.getY() - 0.5D, z - pos.getZ() - 0.5D, texture);
Particle effect = new CableBusBreakingParticle((ClientWorld) world, x, y, z,
x - pos.getX() - 0.5D, y - pos.getY() - 0.5D, z - pos.getZ() - 0.5D, texture);
effectRenderer.addParticle(effect);
}
}
@@ -293,7 +287,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
@Override
public void neighborUpdate(BlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos,
boolean isMoving) {
boolean isMoving) {
if (Platform.isServer()) {
this.cb(world, pos).onneighborUpdate(world, pos, fromPos);
}
@@ -334,7 +328,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
if (this.cb(worldIn, pos).clicked(player, Hand.MAIN_HAND, hitVec)) {
NetworkHandler.instance().sendToServer(new ClickPacket(pos, brtr.getSide(), (float) hitVec.x,
(float) hitVec.y, (float) hitVec.z, Hand.MAIN_HAND, true));
(float) hitVec.y, (float) hitVec.z, Hand.MAIN_HAND, true));
}
}
}
@@ -347,15 +341,15 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
@Override
public ActionResult onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
final @Nullable ItemStack heldItem, final BlockHitResult hit) {
// Transform from world into block space
Vec3d hitVec = hit.getPos();
Vec3d hitInBlock = new Vec3d(hitVec.x - pos.getX(), hitVec.y - pos.getY(), hitVec.z - pos.getZ());
return this.cb(w, pos).activate(player, hand, hitInBlock) ? ActionResult.SUCCESS : ActionResult.PASS;
}
public boolean recolorBlock(final BlockView world, final BlockPos pos, final Direction side,
final DyeColor color, final PlayerEntity who) {
public boolean recolorBlock(final BlockView world, final BlockPos pos, final Direction side, final DyeColor color,
final PlayerEntity who) {
try {
return this.cb(world, pos).recolourBlock(side, AEColor.values()[color.ordinal()], who);
} catch (final Throwable ignored) {
@@ -399,7 +393,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusBlockEntity> implemen
return VoxelShapes.empty();
} else {
Entity entity = null;
// FIXME FABRIC: even EntityShapeContext doesn't give us the actual entity we're colliding with :|
// FIXME FABRIC: even EntityShapeContext doesn't give us the actual entity we're
// colliding with :|
return te.getCableBus().getCollisionShape(entity);
}
}
@@ -20,13 +20,13 @@ package appeng.block.networking;
import javax.annotation.Nullable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.BlockState;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.client.color.block.BlockColorProvider;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.BlockRenderView;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import appeng.api.util.AEColor;
import appeng.parts.CableBusContainer;
@@ -20,11 +20,11 @@ package appeng.block.networking;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.RenderLayer;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import net.minecraft.client.render.RenderLayer;
/**
* Customizes the rendering behavior for cable busses, which are the biggest
@@ -35,7 +35,8 @@ public class CableBusRendering extends BlockRenderingCustomizer {
@Override
@Environment(EnvType.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
// FIXME This is straight up impossible in Vanilla, and questionable if it's actually needed.
// FIXME This is straight up impossible in Vanilla, and questionable if it's
// actually needed.
// FIXME rendering.renderType(rt -> true);
rendering.renderType(RenderLayer.getCutout());
@@ -18,19 +18,19 @@
package appeng.block.networking;
import appeng.tile.networking.ControllerBlockEntity;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.WorldAccess;
import net.minecraft.util.math.Direction;
import net.minecraft.world.World;
import net.minecraft.world.WorldAccess;
import appeng.block.AEBaseTileBlock;
import appeng.tile.networking.ControllerBlockEntity;
public class ControllerBlock extends AEBaseTileBlock<ControllerBlockEntity> {
@@ -86,8 +86,8 @@ public class ControllerBlock extends AEBaseTileBlock<ControllerBlockEntity> {
* texture feel for the controller based on how it is placed.
*/
@Override
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState, WorldAccess world,
BlockPos pos, BlockPos facingPos) {
public BlockState getStateForNeighborUpdate(BlockState state, Direction facing, BlockState facingState,
WorldAccess world, BlockPos pos, BlockPos facingPos) {
// FIXME: this might work, or might _NOT_ work, but needs to be investigated
@@ -20,17 +20,17 @@ package appeng.block.networking;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.EnumProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.math.Box;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
@@ -83,7 +83,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessBlockEntity> {
@Override
public ActionResult onUse(BlockState state, World w, BlockPos pos, PlayerEntity player, Hand hand,
BlockHitResult hit) {
BlockHitResult hit) {
final WirelessBlockEntity tg = this.getBlockEntity(w, pos);
if (tg != null && !player.isInSneakingPose()) {
@@ -1,9 +1,9 @@
package appeng.block.networking;
import net.minecraft.client.render.RenderLayer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.RenderLayer;
import appeng.api.util.AEColor;
import appeng.bootstrap.BlockRenderingCustomizer;
@@ -1,10 +1,16 @@
package appeng.block.paint;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.AppEng;
import appeng.helpers.Splotch;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
import net.fabricmc.fabric.api.rendering.data.v1.RenderAttachedBlockView;
@@ -22,12 +28,9 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockRenderView;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import java.util.function.Supplier;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.AppEng;
import appeng.helpers.Splotch;
/**
* Renders paint blocks, which render multiple "splotches" that have been
@@ -56,7 +59,8 @@ class PaintSplotchesBakedModel implements BakedModel, FabricBakedModel {
}
@Override
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos,
Supplier<Random> randomSupplier, RenderContext context) {
Object renderAttachment = ((RenderAttachedBlockView) blockView).getBlockEntityRenderAttachment(pos);
if (!(renderAttachment instanceof PaintSplotches)) {
@@ -18,23 +18,23 @@
package appeng.block.paint;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.block.MaterialColor;
import net.minecraft.block.ShapeContext;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemPlacementContext;
import net.minecraft.item.ItemStack;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import appeng.block.AEBaseTileBlock;
import appeng.tile.misc.PaintSplotchesBlockEntity;
@@ -1,7 +1,15 @@
package appeng.block.paint;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import javax.annotation.Nullable;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.ModelBakeSettings;
import net.minecraft.client.render.model.ModelLoader;
@@ -10,22 +18,18 @@ import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
public class PaintSplotchesModel implements UnbakedModel {
@Nullable
@Override
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter,
ModelBakeSettings rotationContainer, Identifier modelId) {
return new PaintSplotchesBakedModel(textureGetter);
}
@Override
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter, Set<Pair<String, String>> unresolvedTextureReferences) {
public Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter,
Set<Pair<String, String>> unresolvedTextureReferences) {
return PaintSplotchesBakedModel.getRequiredTextures();
}
@@ -1,9 +1,9 @@
package appeng.block.paint;
import net.minecraft.client.render.RenderLayer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.RenderLayer;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
@@ -1,10 +1,17 @@
package appeng.block.qnb;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.Api;
import appeng.core.AppEng;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
@@ -24,13 +31,9 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.world.BlockRenderView;
import javax.annotation.Nullable;
import java.util.EnumSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
import java.util.function.Function;
import java.util.function.Supplier;
import appeng.client.render.cablebus.CubeBuilder;
import appeng.core.Api;
import appeng.core.AppEng;
class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
@@ -40,12 +43,12 @@ class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
new Identifier(AppEng.MOD_ID, "block/quantum_ring"));
private static final SpriteIdentifier TEXTURE_RING_LIGHT = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
new Identifier(AppEng.MOD_ID, "block/quantum_ring_light"));
private static final SpriteIdentifier TEXTURE_RING_LIGHT_CORNER = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
new Identifier(AppEng.MOD_ID, "block/quantum_ring_light_corner"));
private static final SpriteIdentifier TEXTURE_RING_LIGHT_CORNER = new SpriteIdentifier(
SpriteAtlasTexture.BLOCK_ATLAS_TEX, new Identifier(AppEng.MOD_ID, "block/quantum_ring_light_corner"));
private static final SpriteIdentifier TEXTURE_CABLE_GLASS = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
new Identifier(AppEng.MOD_ID, "part/cable/glass/transparent"));
private static final SpriteIdentifier TEXTURE_COVERED_CABLE = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
new Identifier(AppEng.MOD_ID, "part/cable/covered/transparent"));
private static final SpriteIdentifier TEXTURE_COVERED_CABLE = new SpriteIdentifier(
SpriteAtlasTexture.BLOCK_ATLAS_TEX, new Identifier(AppEng.MOD_ID, "part/cable/covered/transparent"));
private static final float DEFAULT_RENDER_MIN = 2.0f;
private static final float DEFAULT_RENDER_MAX = 14.0f;
@@ -89,7 +92,8 @@ class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
}
@Override
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context) {
public void emitBlockQuads(BlockRenderView blockView, BlockState state, BlockPos pos,
Supplier<Random> randomSupplier, RenderContext context) {
QnbFormedState formedState = getState(blockView, pos);
if (formedState == null) {
@@ -185,7 +189,7 @@ class QnbFormedBakedModel implements BakedModel, FabricBakedModel {
}
private void renderCableAt(CubeBuilder builder, float thickness, Sprite texture, float pull,
Set<Direction> connections) {
Set<Direction> connections) {
builder.setTexture(texture);
if (connections.contains(Direction.WEST)) {
@@ -1,9 +1,14 @@
package appeng.block.qnb;
import appeng.client.render.BasicUnbakedModel;
import appeng.core.AppEng;
import java.util.Collection;
import java.util.function.Function;
import java.util.stream.Stream;
import javax.annotation.Nullable;
import com.google.common.collect.ImmutableSet;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.ModelBakeSettings;
import net.minecraft.client.render.model.ModelLoader;
@@ -11,10 +16,8 @@ import net.minecraft.client.texture.Sprite;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.util.Identifier;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.function.Function;
import java.util.stream.Stream;
import appeng.client.render.BasicUnbakedModel;
import appeng.core.AppEng;
public class QnbFormedModel implements BasicUnbakedModel {
@@ -22,7 +25,8 @@ public class QnbFormedModel implements BasicUnbakedModel {
@Nullable
@Override
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter, ModelBakeSettings rotationContainer, Identifier modelId) {
public BakedModel bake(ModelLoader loader, Function<SpriteIdentifier, Sprite> textureGetter,
ModelBakeSettings rotationContainer, Identifier modelId) {
BakedModel ringModel = loader.bake(MODEL_RING, rotationContainer);
return new QnbFormedBakedModel(ringModel, textureGetter);
}
@@ -20,11 +20,11 @@ package appeng.block.qnb;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateManager;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
@@ -1,9 +1,9 @@
package appeng.block.qnb;
import net.minecraft.client.render.RenderLayer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.RenderLayer;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
@@ -23,14 +23,14 @@ import java.util.Random;
import javax.annotation.Nullable;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
@@ -51,8 +51,8 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
static {
final double onePixel = 2.0 / 16.0;
SHAPE = VoxelShapes.cuboid(
new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
SHAPE = VoxelShapes
.cuboid(new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
}
public QuantumLinkChamberBlock() {
@@ -65,8 +65,8 @@ public class QuantumLinkChamberBlock extends QuantumBaseBlock {
if (bridge != null) {
if (bridge.hasQES()) {
if (AppEng.instance().shouldAddParticles(rand)) {
AppEng.instance().spawnEffect(EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5,
null);
AppEng.instance().spawnEffect(EffectType.Energy, w, pos.getX() + 0.5, pos.getY() + 0.5,
pos.getZ() + 0.5, null);
}
}
}
@@ -20,9 +20,9 @@ package appeng.block.qnb;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.BlockPos;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
@@ -51,7 +51,7 @@ public class QuantumRingBlock extends QuantumBaseBlock {
}
private static VoxelShape createShape(double onePixel) {
return VoxelShapes.cuboid(
new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
return VoxelShapes
.cuboid(new Box(onePixel, onePixel, onePixel, 1.0 - onePixel, 1.0 - onePixel, 1.0 - onePixel));
}
}
@@ -18,7 +18,6 @@
package appeng.block.spatial;
import appeng.block.AEBaseBlock;
import net.minecraft.block.*;
import net.minecraft.block.piston.PistonBehavior;
import net.minecraft.item.ItemGroup;
@@ -32,13 +31,16 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldView;
import net.minecraft.world.explosion.Explosion;
import appeng.block.AEBaseBlock;
/**
* This block is used to fill empty space in spatial dimensions and delinates
* the border of a spatial dimensions's usable space.
*/
public class MatrixFrameBlock extends AEBaseBlock {
private static final Material MATERIAL = new Material(MaterialColor.CLEAR, false, true, true, false, false, false, PistonBehavior.PUSH_ONLY);
private static final Material MATERIAL = new Material(MaterialColor.CLEAR, false, true, true, false, false, false,
PistonBehavior.PUSH_ONLY);
public MatrixFrameBlock() {
super(Settings.of(MATERIAL).strength(-1.0F, 6000000.0F).nonOpaque().dropsNothing());
@@ -55,8 +57,7 @@ public class MatrixFrameBlock extends AEBaseBlock {
}
@Override
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos,
ShapeContext context) {
public VoxelShape getCollisionShape(BlockState state, BlockView worldIn, BlockPos pos, ShapeContext context) {
return VoxelShapes.fullCube();
}
@@ -27,8 +27,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
@@ -20,24 +20,24 @@ package appeng.block.storage;
import javax.annotation.Nullable;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ChestContainer;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Material;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.state.StateManager;
import net.minecraft.state.property.BooleanProperty;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.ChestContainer;
import appeng.core.localization.PlayerMessages;
import appeng.tile.storage.ChestBlockEntity;
@@ -25,8 +25,8 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
@@ -20,26 +20,26 @@ package appeng.block.storage;
import javax.annotation.Nullable;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.SkyChestContainer;
import net.minecraft.block.BlockRenderType;
import net.minecraft.block.BlockState;
import net.minecraft.block.ShapeContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.block.ShapeContext;
import net.minecraft.util.shape.VoxelShape;
import net.minecraft.util.shape.VoxelShapes;
import net.minecraft.world.BlockView;
import net.minecraft.world.World;
import appeng.block.AEBaseTileBlock;
import appeng.container.ContainerLocator;
import appeng.container.ContainerOpener;
import appeng.container.implementations.SkyChestContainer;
import appeng.tile.storage.SkyChestBlockEntity;
import appeng.util.Platform;
@@ -18,6 +18,24 @@
package appeng.bootstrap;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import appeng.api.definitions.IBlockDefinition;
import appeng.api.features.AEFeature;
import appeng.block.AEBaseBlock;
@@ -29,22 +47,6 @@ import appeng.core.CreativeTab;
import appeng.core.features.BlockDefinition;
import appeng.core.features.TileDefinition;
import appeng.util.Platform;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.function.BiFunction;
import java.util.function.Supplier;
class BlockDefinitionBuilder implements IBlockBuilder {
@@ -55,7 +55,7 @@ public class BlockEntityBuilder<T extends AEBaseBlockEntity> {
private final EnumSet<AEFeature> features = EnumSet.noneOf(AEFeature.class);
public BlockEntityBuilder(FeatureFactory factory, String id, Class<T> tileClass,
Function<BlockEntityType<T>, T> supplier) {
Function<BlockEntityType<T>, T> supplier) {
this.factory = factory;
this.id = AppEng.makeId(id);
this.tileClass = tileClass;
@@ -20,7 +20,6 @@ package appeng.bootstrap;
import java.util.function.BiFunction;
import appeng.client.render.model.AutoRotatingBakedModel;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.rendering.v1.ColorProviderRegistry;
@@ -33,6 +32,7 @@ import net.minecraft.util.Identifier;
import appeng.block.AEBaseTileBlock;
import appeng.bootstrap.components.BlockColorComponent;
import appeng.bootstrap.components.RenderTypeComponent;
import appeng.client.render.model.AutoRotatingBakedModel;
class BlockRendering implements IBlockRendering {
@@ -1,6 +1,9 @@
package appeng.bootstrap;
import appeng.api.features.AEFeature;
import java.util.Collections;
import java.util.EnumSet;
import java.util.function.Consumer;
import net.fabricmc.fabric.api.object.builder.v1.entity.FabricEntityTypeBuilder;
import net.fabricmc.fabric.impl.object.builder.FabricEntityType;
import net.minecraft.entity.Entity;
@@ -8,9 +11,7 @@ import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.util.registry.Registry;
import java.util.Collections;
import java.util.EnumSet;
import java.util.function.Consumer;
import appeng.api.features.AEFeature;
/**
* Helper to register a custom Entity with Minecraft.
@@ -29,16 +29,16 @@ import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.Block;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.entity.Entity;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.item.Item;
import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.util.Identifier;
import net.fabricmc.api.EnvType;
import appeng.api.features.AEFeature;
import appeng.bootstrap.components.ModelOverrideComponent;
@@ -86,7 +86,7 @@ public class FeatureFactory {
}
public <T extends AEBaseBlockEntity> BlockEntityBuilder<T> tileEntity(String id, Class<T> teClass,
Function<BlockEntityType<T>, T> factory) {
Function<BlockEntityType<T>, T> factory) {
return new BlockEntityBuilder<>(this, id, teClass, factory).features(this.defaultFeatures);
}
@@ -18,9 +18,9 @@
package appeng.bootstrap;
import net.minecraft.client.color.item.ItemColorProvider;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.color.item.ItemColorProvider;
/**
* Allows the rendering of an item to be customized.
@@ -26,12 +26,14 @@ import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.block.DispenserBlock;
import net.minecraft.block.dispenser.DispenserBehavior;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import appeng.api.features.AEFeature;
import appeng.bootstrap.components.IInitComponent;
@@ -39,8 +41,6 @@ import appeng.core.AppEng;
import appeng.core.CreativeTab;
import appeng.core.features.ItemDefinition;
import appeng.util.Platform;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
class ItemDefinitionBuilder implements IItemBuilder {
@@ -18,10 +18,10 @@
package appeng.bootstrap;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.color.item.ItemColorProvider;
import net.minecraft.item.Item;
import net.fabricmc.api.EnvType;
import appeng.bootstrap.components.ItemColorComponent;
@@ -18,8 +18,8 @@
package appeng.bootstrap;
import net.fabricmc.api.Environment;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
/**
* A callback that allows the rendering of a item to be customized. Sadly this
@@ -1,12 +1,12 @@
package appeng.bootstrap;
import java.util.Map;
import net.fabricmc.fabric.api.event.Event;
import net.fabricmc.fabric.api.event.EventFactory;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.util.Identifier;
import java.util.Map;
@FunctionalInterface
public interface ModelsReloadCallback {
@@ -20,10 +20,10 @@ package appeng.bootstrap;
import java.util.function.Function;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
import appeng.tile.AEBaseBlockEntity;
@@ -21,15 +21,15 @@ package appeng.bootstrap;
import appeng.tile.AEBaseBlockEntity;
/**
* A callback that allows the rendering of a block entity to be customized. Sadly
* this class is required and no lambdas can be used due to them not being able
* to be annotated with @OnlyIn(CLIENT).
* A callback that allows the rendering of a block entity to be customized.
* Sadly this class is required and no lambdas can be used due to them not being
* able to be annotated with @OnlyIn(CLIENT).
*/
public interface TileEntityRenderingCustomizer<T extends AEBaseBlockEntity> {
/**
* Declared as a default method because we will carve out the implementations that
* override this method on the Server side.
* Declared as a default method because we will carve out the implementations
* that override this method on the Server side.
*/
default void customize(TileEntityRendering<T> rendering) {
}
@@ -1,12 +1,12 @@
package appeng.bootstrap.components;
import java.util.Map;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.util.Identifier;
import appeng.bootstrap.IBootstrapComponent;
import java.util.Map;
public interface IModelBakeComponent extends IBootstrapComponent {
void onModelsReloaded(Map<Identifier, BakedModel> loadedModels);
@@ -1,6 +1,5 @@
package appeng.bootstrap.components;
import appeng.bootstrap.IBootstrapComponent;
@FunctionalInterface
@@ -1,6 +1,7 @@
package appeng.bootstrap.components;
import com.google.common.base.Preconditions;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.minecraft.block.Block;
import net.minecraft.client.render.RenderLayer;
+115 -108
View File
@@ -1,5 +1,38 @@
package appeng.client;
import java.util.Collection;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.client.render.entity.ItemEntityRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.HitResult;
import net.minecraft.world.World;
import appeng.api.parts.CableRenderMode;
import appeng.block.crafting.AbstractCraftingUnitBlock;
import appeng.block.paint.PaintSplotchesModel;
@@ -124,37 +157,6 @@ import appeng.hooks.ClientTickHandler;
import appeng.parts.automation.PlaneModel;
import appeng.tile.crafting.MolecularAssemblerRenderer;
import appeng.util.Platform;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.fabricmc.fabric.api.client.model.ModelLoadingRegistry;
import net.fabricmc.fabric.api.client.particle.v1.ParticleFactoryRegistry;
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
import net.fabricmc.fabric.api.client.screenhandler.v1.ScreenRegistry;
import net.fabricmc.fabric.api.event.client.ClientSpriteRegistryCallback;
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.options.KeyBinding;
import net.minecraft.client.render.entity.ItemEntityRenderer;
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.UnbakedModel;
import net.minecraft.client.util.SpriteIdentifier;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.integrated.IntegratedServer;
import net.minecraft.util.Identifier;
import net.minecraft.util.hit.HitResult;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.Collection;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.function.Supplier;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Environment(EnvType.CLIENT)
public final class AppEngClient extends AppEngBase {
@@ -182,8 +184,7 @@ public final class AppEngClient extends AppEngBase {
ModelsReloadCallback.EVENT.register(this::onModelsReloaded);
callDeferredBootstrapComponents(IClientSetupComponent.class,
IClientSetupComponent::setup);
callDeferredBootstrapComponents(IClientSetupComponent.class, IClientSetupComponent::setup);
registerModelProviders();
registerParticleRenderers();
registerEntityRenderers();
@@ -191,7 +192,8 @@ public final class AppEngClient extends AppEngBase {
registerTextures();
registerScreens();
// On the client, we'll register for server startup/shutdown to properly setup WorldData
// On the client, we'll register for server startup/shutdown to properly setup
// WorldData
// each time the integrated server starts&stops
ServerLifecycleEvents.SERVER_STARTED.register(WorldData::onServerStarting);
ServerLifecycleEvents.SERVER_STOPPING.register(server -> WorldData.instance().onServerStopping());
@@ -265,8 +267,7 @@ public final class AppEngClient extends AppEngBase {
final int range = 16 * 16;
client.worldRenderer.scheduleBlockRenders(x - range, y - range, z - range, x + range, y + range,
z + range);
client.worldRenderer.scheduleBlockRenders(x - range, y - range, z - range, x + range, y + range, z + range);
}
@Override
@@ -295,7 +296,8 @@ public final class AppEngClient extends AppEngBase {
registry.register(TinyTNTPrimedEntity.TYPE, (dispatcher, context) -> new TinyTNTPrimedRenderer(dispatcher));
EntityRendererRegistry.Factory itemEntityFactory = (dispatcher, context) -> new ItemEntityRenderer(dispatcher, context.getItemRenderer());
EntityRendererRegistry.Factory itemEntityFactory = (dispatcher, context) -> new ItemEntityRenderer(dispatcher,
context.getItemRenderer());
registry.register(SingularityEntity.TYPE, itemEntityFactory);
registry.register(GrowingCrystalEntity.TYPE, itemEntityFactory);
registry.register(ChargedQuartzEntity.TYPE, itemEntityFactory);
@@ -316,10 +318,7 @@ public final class AppEngClient extends AppEngBase {
}
public void registerTextures() {
Stream<Collection<SpriteIdentifier>> sprites = Stream.of(
SkyChestTESR.SPRITES,
InscriberTESR.SPRITES
);
Stream<Collection<SpriteIdentifier>> sprites = Stream.of(SkyChestTESR.SPRITES, InscriberTESR.SPRITES);
// Group every needed sprite by atlas, since every atlas has their own event
Map<Identifier, List<SpriteIdentifier>> groupedByAtlas = sprites.flatMap(Collection::stream)
@@ -327,12 +326,11 @@ public final class AppEngClient extends AppEngBase {
// Register to the stitch event for each atlas
for (Map.Entry<Identifier, List<SpriteIdentifier>> entry : groupedByAtlas.entrySet()) {
ClientSpriteRegistryCallback.event(entry.getKey())
.register((spriteAtlasTexture, registry) -> {
for (SpriteIdentifier spriteIdentifier : entry.getValue()) {
registry.register(spriteIdentifier.getTextureId());
}
});
ClientSpriteRegistryCallback.event(entry.getKey()).register((spriteAtlasTexture, registry) -> {
for (SpriteIdentifier spriteIdentifier : entry.getValue()) {
registry.register(spriteIdentifier.getTextureId());
}
});
}
}
@@ -344,27 +342,30 @@ public final class AppEngClient extends AppEngBase {
ModelLoadingRegistry.INSTANCE.registerVariantProvider((resourceManager) -> {
return (modelIdentifier, modelProviderContext) -> {
if (MolecularAssemblerRenderer.LIGHTS_MODEL.equals(modelIdentifier)) {
return modelProviderContext.loadModel(new Identifier(modelIdentifier.getNamespace(), modelIdentifier.getPath()));
return modelProviderContext
.loadModel(new Identifier(modelIdentifier.getNamespace(), modelIdentifier.getPath()));
}
return null;
};
});
ModelLoadingRegistry.INSTANCE.registerResourceProvider(rm -> new CableBusModelLoader((PartModels) Api.INSTANCE.registries().partModels()));
ModelLoadingRegistry.INSTANCE.registerResourceProvider(
rm -> new CableBusModelLoader((PartModels) Api.INSTANCE.registries().partModels()));
addBuiltInModel("block/quartz_glass", GlassModel::new);
addBuiltInModel("block/sky_compass", SkyCompassModel::new);
addBuiltInModel("item/sky_compass", SkyCompassModel::new);
addBuiltInModel("block/quartz_glass", GlassModel::new);
addBuiltInModel("block/sky_compass", SkyCompassModel::new);
addBuiltInModel("item/sky_compass", SkyCompassModel::new);
// FIXME FABRIC addBuiltInModel("item/dummy_fluid_item", DummyFluidItemModel::new);
addBuiltInModel("item/memory_card", MemoryCardModel::new);
addBuiltInModel("item/biometric_card", BiometricCardModel::new);
addBuiltInModel("block/drive", DriveModel::new);
addBuiltInModel("color_applicator", ColorApplicatorModel::new); // FIXME need to wire this up (this might just not be needed)
addBuiltInModel("block/spatial_pylon", SpatialPylonModel::new);
addBuiltInModel("block/paint", PaintSplotchesModel::new);
addBuiltInModel("block/qnb/qnb_formed", QnbFormedModel::new);
addBuiltInModel("part/p2p/p2p_tunnel_frequency", P2PTunnelFrequencyModel::new);
addBuiltInModel("item/facade", FacadeItemModel::new);
addBuiltInModel("item/memory_card", MemoryCardModel::new);
addBuiltInModel("item/biometric_card", BiometricCardModel::new);
addBuiltInModel("block/drive", DriveModel::new);
addBuiltInModel("color_applicator", ColorApplicatorModel::new); // FIXME need to wire this up (this might just
// not be needed)
addBuiltInModel("block/spatial_pylon", SpatialPylonModel::new);
addBuiltInModel("block/paint", PaintSplotchesModel::new);
addBuiltInModel("block/qnb/qnb_formed", QnbFormedModel::new);
addBuiltInModel("part/p2p/p2p_tunnel_frequency", P2PTunnelFrequencyModel::new);
addBuiltInModel("item/facade", FacadeItemModel::new);
addPlaneModel("part/annihilation_plane", "part/annihilation_plane");
addPlaneModel("part/annihilation_plane_on", "part/annihilation_plane_on");
@@ -377,13 +378,20 @@ public final class AppEngClient extends AppEngBase {
addPlaneModel("part/formation_plane", "part/formation_plane");
addPlaneModel("part/formation_plane_on", "part/formation_plane_on");
addBuiltInModel("block/crafting/1k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_1K));
addBuiltInModel("block/crafting/4k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_4K));
addBuiltInModel("block/crafting/16k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_16K));
addBuiltInModel("block/crafting/64k_storage_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_64K));
addBuiltInModel("block/crafting/accelerator_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.ACCELERATOR));
addBuiltInModel("block/crafting/monitor_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.MONITOR));
addBuiltInModel("block/crafting/unit_formed", () -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.UNIT));
addBuiltInModel("block/crafting/1k_storage_formed",
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_1K));
addBuiltInModel("block/crafting/4k_storage_formed",
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_4K));
addBuiltInModel("block/crafting/16k_storage_formed",
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_16K));
addBuiltInModel("block/crafting/64k_storage_formed",
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.STORAGE_64K));
addBuiltInModel("block/crafting/accelerator_formed",
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.ACCELERATOR));
addBuiltInModel("block/crafting/monitor_formed",
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.MONITOR));
addBuiltInModel("block/crafting/unit_formed",
() -> new CraftingCubeModel(AbstractCraftingUnitBlock.CraftingUnitType.UNIT));
// FIXME FABRIC ModelLoaderRegistry.registerLoader(new Identifier(AppEng.MOD_ID, "uvlightmap"), UVLModelLoader.INSTANCE);
}
@@ -395,9 +403,8 @@ public final class AppEngClient extends AppEngBase {
}
private static <T extends UnbakedModel> void addBuiltInModel(String id, Supplier<T> modelFactory) {
ModelLoadingRegistry.INSTANCE.registerResourceProvider(
resourceManager -> new SimpleModelLoader<>(AppEng.makeId(id), modelFactory)
);
ModelLoadingRegistry.INSTANCE
.registerResourceProvider(resourceManager -> new SimpleModelLoader<>(AppEng.makeId(id), modelFactory));
}
private void registerScreens() {
@@ -406,43 +413,43 @@ public final class AppEngClient extends AppEngBase {
ScreenRegistry.register(SkyChestContainer.TYPE, SkyChestScreen::new);
ScreenRegistry.register(ChestContainer.TYPE, ChestScreen::new);
ScreenRegistry.register(WirelessContainer.TYPE, WirelessScreen::new);
ScreenRegistry.<MEMonitorableContainer, MEMonitorableScreen<MEMonitorableContainer>>register(
MEMonitorableContainer.TYPE, MEMonitorableScreen::new);
ScreenRegistry.register(MEPortableCellContainer.TYPE, MEPortableCellScreen::new);
ScreenRegistry.register(WirelessTermContainer.TYPE, WirelessTermScreen::new);
ScreenRegistry.register(NetworkStatusContainer.TYPE, NetworkStatusScreen::new);
ScreenRegistry.<CraftingCPUContainer, CraftingCPUScreen<CraftingCPUContainer>>register(
CraftingCPUContainer.TYPE, CraftingCPUScreen::new);
ScreenRegistry.register(NetworkToolContainer.TYPE, NetworkToolScreen::new);
ScreenRegistry.register(QuartzKnifeContainer.TYPE, QuartzKnifeScreen::new);
ScreenRegistry.register(DriveContainer.TYPE, DriveScreen::new);
ScreenRegistry.register(VibrationChamberContainer.TYPE, VibrationChamberScreen::new);
ScreenRegistry.register(CondenserContainer.TYPE, CondenserScreen::new);
ScreenRegistry.register(InterfaceContainer.TYPE, InterfaceScreen::new);
ScreenRegistry.register(FluidInterfaceContainer.TYPE, FluidInterfaceScreen::new);
ScreenRegistry.<UpgradeableContainer, UpgradeableScreen<UpgradeableContainer>>register(
UpgradeableContainer.TYPE, UpgradeableScreen::new);
ScreenRegistry.register(FluidIOContainer.TYPE, FluidIOScreen::new);
ScreenRegistry.register(IOPortContainer.TYPE, IOPortScreen::new);
ScreenRegistry.register(StorageBusContainer.TYPE, StorageBusScreen::new);
ScreenRegistry.register(FluidStorageBusContainer.TYPE, FluidStorageBusScreen::new);
ScreenRegistry.register(FormationPlaneContainer.TYPE, FormationPlaneScreen::new);
ScreenRegistry.register(FluidFormationPlaneContainer.TYPE, FluidFormationPlaneScreen::new);
ScreenRegistry.register(PriorityContainer.TYPE, PriorityScreen::new);
ScreenRegistry.register(SecurityStationContainer.TYPE, SecurityStationScreen::new);
ScreenRegistry.register(CraftingTermContainer.TYPE, CraftingTermScreen::new);
ScreenRegistry.register(PatternTermContainer.TYPE, PatternTermScreen::new);
ScreenRegistry.register(FluidTerminalContainer.TYPE, FluidTerminalScreen::new);
ScreenRegistry.register(LevelEmitterContainer.TYPE, LevelEmitterScreen::new);
ScreenRegistry.register(FluidLevelEmitterContainer.TYPE, FluidLevelEmitterScreen::new);
ScreenRegistry.register(SpatialIOPortContainer.TYPE, SpatialIOPortScreen::new);
ScreenRegistry.register(InscriberContainer.TYPE, InscriberScreen::new);
ScreenRegistry.register(CellWorkbenchContainer.TYPE, CellWorkbenchScreen::new);
ScreenRegistry.register(MolecularAssemblerContainer.TYPE, MolecularAssemblerScreen::new);
ScreenRegistry.register(CraftAmountContainer.TYPE, CraftAmountScreen::new);
ScreenRegistry.register(CraftConfirmContainer.TYPE, CraftConfirmScreen::new);
ScreenRegistry.register(InterfaceTerminalContainer.TYPE, InterfaceTerminalScreen::new);
ScreenRegistry.register(CraftingStatusContainer.TYPE, CraftingStatusScreen::new);
ScreenRegistry.<MEMonitorableContainer, MEMonitorableScreen<MEMonitorableContainer>>register(
MEMonitorableContainer.TYPE, MEMonitorableScreen::new);
ScreenRegistry.register(MEPortableCellContainer.TYPE, MEPortableCellScreen::new);
ScreenRegistry.register(WirelessTermContainer.TYPE, WirelessTermScreen::new);
ScreenRegistry.register(NetworkStatusContainer.TYPE, NetworkStatusScreen::new);
ScreenRegistry.<CraftingCPUContainer, CraftingCPUScreen<CraftingCPUContainer>>register(
CraftingCPUContainer.TYPE, CraftingCPUScreen::new);
ScreenRegistry.register(NetworkToolContainer.TYPE, NetworkToolScreen::new);
ScreenRegistry.register(QuartzKnifeContainer.TYPE, QuartzKnifeScreen::new);
ScreenRegistry.register(DriveContainer.TYPE, DriveScreen::new);
ScreenRegistry.register(VibrationChamberContainer.TYPE, VibrationChamberScreen::new);
ScreenRegistry.register(CondenserContainer.TYPE, CondenserScreen::new);
ScreenRegistry.register(InterfaceContainer.TYPE, InterfaceScreen::new);
ScreenRegistry.register(FluidInterfaceContainer.TYPE, FluidInterfaceScreen::new);
ScreenRegistry.<UpgradeableContainer, UpgradeableScreen<UpgradeableContainer>>register(
UpgradeableContainer.TYPE, UpgradeableScreen::new);
ScreenRegistry.register(FluidIOContainer.TYPE, FluidIOScreen::new);
ScreenRegistry.register(IOPortContainer.TYPE, IOPortScreen::new);
ScreenRegistry.register(StorageBusContainer.TYPE, StorageBusScreen::new);
ScreenRegistry.register(FluidStorageBusContainer.TYPE, FluidStorageBusScreen::new);
ScreenRegistry.register(FormationPlaneContainer.TYPE, FormationPlaneScreen::new);
ScreenRegistry.register(FluidFormationPlaneContainer.TYPE, FluidFormationPlaneScreen::new);
ScreenRegistry.register(PriorityContainer.TYPE, PriorityScreen::new);
ScreenRegistry.register(SecurityStationContainer.TYPE, SecurityStationScreen::new);
ScreenRegistry.register(CraftingTermContainer.TYPE, CraftingTermScreen::new);
ScreenRegistry.register(PatternTermContainer.TYPE, PatternTermScreen::new);
ScreenRegistry.register(FluidTerminalContainer.TYPE, FluidTerminalScreen::new);
ScreenRegistry.register(LevelEmitterContainer.TYPE, LevelEmitterScreen::new);
ScreenRegistry.register(FluidLevelEmitterContainer.TYPE, FluidLevelEmitterScreen::new);
ScreenRegistry.register(SpatialIOPortContainer.TYPE, SpatialIOPortScreen::new);
ScreenRegistry.register(InscriberContainer.TYPE, InscriberScreen::new);
ScreenRegistry.register(CellWorkbenchContainer.TYPE, CellWorkbenchScreen::new);
ScreenRegistry.register(MolecularAssemblerContainer.TYPE, MolecularAssemblerScreen::new);
ScreenRegistry.register(CraftAmountContainer.TYPE, CraftAmountScreen::new);
ScreenRegistry.register(CraftConfirmContainer.TYPE, CraftConfirmScreen::new);
ScreenRegistry.register(InterfaceTerminalContainer.TYPE, InterfaceTerminalScreen::new);
ScreenRegistry.register(CraftingStatusContainer.TYPE, CraftingStatusScreen::new);
}
}
@@ -24,8 +24,8 @@ import java.util.Locale;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.screen.slot.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
@@ -61,8 +61,7 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isDamaged())) {
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
.format(myStack.getStackSize());
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount)
.formatted(Formatting.GRAY));
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount).formatted(Formatting.GRAY));
}
if (myStack.getCountRequestable() > 0) {
@@ -18,9 +18,47 @@
package appeng.client.gui;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import com.mojang.blaze3d.systems.RenderSystem;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import alexiil.mc.lib.attributes.fluid.render.FluidRenderFace;
import alexiil.mc.lib.attributes.fluid.render.FluidVolumeRenderer;
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.CustomSlotWidget;
@@ -52,40 +90,6 @@ import appeng.fluids.client.render.FluidStackSizeRenderer;
import appeng.fluids.container.slots.IMEFluidSlot;
import appeng.helpers.InventoryAction;
import appeng.mixins.SlotMixin;
import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.Slot;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScreen<T> {
@@ -161,7 +165,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
}
}
protected void drawGuiSlot(MatrixStack matrices, CustomSlotWidget slot, int mouseX, int mouseY, float partialTicks) {
protected void drawGuiSlot(MatrixStack matrices, CustomSlotWidget slot, int mouseX, int mouseY,
float partialTicks) {
if (slot.isSlotEnabled()) {
final int left = slot.xPos();
final int top = slot.yPos();
@@ -252,13 +257,13 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
if (optionalSlot.isRenderDisabled()) {
final AppEngSlot aeSlot = (AppEngSlot) slot;
if (aeSlot.isSlotEnabled()) {
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1,
optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, 18);
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1, optionalSlot.getSourceX() - 1,
optionalSlot.getSourceY() - 1, 18, 18);
} else {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 0.4F);
RenderSystem.enableBlend();
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1,
optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1, 18, 18);
drawTexture(matrices, ox + aeSlot.x - 1, oy + aeSlot.y - 1, optionalSlot.getSourceX() - 1,
optionalSlot.getSourceY() - 1, 18, 18);
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
@@ -314,8 +319,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
if (this.drag_click.size() > 1) {
for (final Slot dr : this.drag_click) {
final InventoryActionPacket p = new InventoryActionPacket(
mouseButton == 0 ? InventoryAction.PICKUP_OR_SET_DOWN : InventoryAction.PLACE_SINGLE,
dr.id, 0);
mouseButton == 0 ? InventoryAction.PICKUP_OR_SET_DOWN : InventoryAction.PLACE_SINGLE, dr.id,
0);
NetworkHandler.instance().sendToServer(p);
}
}
@@ -329,7 +334,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
// TODO 1.9.4 aftermath - Whole SlotActionType thing, to be checked.
@Override
protected void onMouseClick(final Slot slot, final int slotIdx, final int mouseButton,
final SlotActionType clickType) {
final SlotActionType clickType) {
final PlayerEntity player = getPlayer();
if (slot instanceof FakeSlot) {
@@ -534,10 +539,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
return true;
} else {
for (final Slot s : slots) {
if (getSlotIndex(s) == j
&& s.inventory == this.handler.getPlayerInv()) {
NetworkHandler.instance()
.sendToServer(new SwapSlotsPacket(s.id, theSlot.id));
if (getSlotIndex(s) == j && s.inventory == this.handler.getPlayerInv()) {
NetworkHandler.instance().sendToServer(new SwapSlotsPacket(s.id, theSlot.id));
return true;
}
}
@@ -566,7 +569,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
return null;
}
public abstract void drawBG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY, float partialTicks);
public abstract void drawBG(MatrixStack matrices, int offsetX, int offsetY, int mouseX, int mouseY,
float partialTicks);
@Override
public boolean mouseScrolled(double x, double y, double wheelDelta) {
@@ -702,21 +706,16 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
final float par6 = 16;
vb.vertex(par1 + 0, par2 + par6, getZOffset())
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
.texture((par3 + 0) * f, (par4 + par6) * f1)
.next();
.texture((par3 + 0) * f, (par4 + par6) * f1).next();
final float par5 = 16;
vb.vertex(par1 + par5, par2 + par6, getZOffset())
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
.texture((par3 + par5) * f, (par4 + par6) * f1)
.next();
.texture((par3 + par5) * f, (par4 + par6) * f1).next();
vb.vertex(par1 + par5, par2 + 0, getZOffset())
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
.texture((par3 + par5) * f, (par4 + 0) * f1)
.next();
vb.vertex(par1 + 0, par2 + 0, getZOffset())
.color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
.texture((par3 + 0) * f, (par4 + 0) * f1)
.next();
.texture((par3 + par5) * f, (par4 + 0) * f1).next();
vb.vertex(par1 + 0, par2 + 0, getZOffset()).color(1.0f, 1.0f, 1.0f, aes.getOpacityOfIcon())
.texture((par3 + 0) * f, (par4 + 0) * f1).next();
tessellator.draw();
} catch (final Exception err) {
@@ -728,9 +727,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends HandledScr
if (!is.isEmpty() && s instanceof AppEngSlot) {
AppEngSlot aeSlot = (AppEngSlot) s;
if (aeSlot.getIsValid() == CalculatedValidity.NotAvailable) {
boolean isValid = s.canInsert(is) || s instanceof OutputSlot
|| s instanceof AppEngCraftingSlot || s instanceof DisabledSlot
|| s instanceof InaccessibleSlot || s instanceof FakeSlot
boolean isValid = s.canInsert(is) || s instanceof OutputSlot || s instanceof AppEngCraftingSlot
|| s instanceof DisabledSlot || s instanceof InaccessibleSlot || s instanceof FakeSlot
|| s instanceof RestrictedInputSlot || s instanceof SlotDisconnected;
if (isValid && s instanceof RestrictedInputSlot) {
try {
@@ -4,15 +4,17 @@ package appeng.client.gui;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import appeng.client.me.SlotME;
import com.mojang.datafixers.util.Pair;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.screen.slot.Slot;
import net.minecraft.item.ItemStack;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
import net.minecraft.util.Identifier;
import appeng.client.me.SlotME;
/**
* A proxy for a slot that will always return an itemstack with size 1, if there
* is an item in the slot. Used to prevent the default item count from
@@ -5,8 +5,9 @@ import java.util.function.Consumer;
import javax.annotation.Nullable;
import net.minecraft.client.render.item.ItemRenderer;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.text.Text;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
@@ -26,7 +27,6 @@ import appeng.parts.reporting.CraftingTerminalPart;
import appeng.parts.reporting.PatternTerminalPart;
import appeng.parts.reporting.TerminalPart;
import appeng.tile.storage.ChestBlockEntity;
import net.minecraft.text.Text;
/**
* Utility class for sub-screens of other containers that allow returning to the
@@ -99,8 +99,8 @@ final class AESubScreen {
label = previousContainerIcon.getName();
}
ItemRenderer itemRenderer = gui.getClient().getItemRenderer();
TabButton button = new TabButton(gui.getX() + x, gui.getY() + y, previousContainerIcon, label,
itemRenderer, btn -> goBack());
TabButton button = new TabButton(gui.getX() + x, gui.getY() + y, previousContainerIcon, label, itemRenderer,
btn -> goBack());
buttonAdder.accept(button);
return button;
}
@@ -43,35 +43,33 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
private ToggleButton copyMode;
public CellWorkbenchScreen(CellWorkbenchContainer container, PlayerInventory playerInventory,
Text title) {
public CellWorkbenchScreen(CellWorkbenchContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.backgroundHeight = 251;
}
@Override
protected void addButtons() {
this.fuzzyMode = this.addButton(new SettingToggleButton<>(this.x - 18, this.y + 68,
Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL, this::toggleFuzzyMode));
this.addButton(
new ActionButton(this.x - 18, this.y + 28, ActionItems.WRENCH, act1 -> action("Partition")));
this.fuzzyMode = this.addButton(new SettingToggleButton<>(this.x - 18, this.y + 68, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL, this::toggleFuzzyMode));
this.addButton(new ActionButton(this.x - 18, this.y + 28, ActionItems.WRENCH, act1 -> action("Partition")));
this.addButton(new ActionButton(this.x - 18, this.y + 8, ActionItems.CLOSE, act -> action("Clear")));
this.copyMode = this.addButton(new ToggleButton(this.x - 18, this.y + 48, 11 * 16 + 5, 12 * 16 + 5,
GuiText.CopyMode.text(), GuiText.CopyModeDesc.text(), act -> action("CopyMode")));
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.handleButtonVisibility();
this.bindTexture(this.getBackground());
drawTexture(matrices, offsetX, offsetY, 0, 0, 211 - 34, this.backgroundHeight);
if (this.drawUpgrades()) {
if (this.handler.availableUpgrades() <= 8) {
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35,
7 + this.handler.availableUpgrades() * 18);
drawTexture(matrices, offsetX + 177, offsetY + (7 + (this.handler.availableUpgrades()) * 18),
177, 151, 35, 7);
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 7 + this.handler.availableUpgrades() * 18);
drawTexture(matrices, offsetX + 177, offsetY + (7 + (this.handler.availableUpgrades()) * 18), 177, 151,
35, 7);
} else if (this.handler.availableUpgrades() <= 16) {
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18);
drawTexture(matrices, offsetX + 177, offsetY + (7 + (8) * 18), 177, 151, 35, 7);
@@ -81,8 +79,7 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
if (dx == 8) {
drawTexture(matrices, offsetX + 177 + 27, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7);
} else {
drawTexture(matrices, offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151,
35 - 8, 7);
drawTexture(matrices, offsetX + 177 + 27 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8, 7);
}
} else {
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 7 + 8 * 18);
@@ -94,11 +91,10 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
final int dx = this.handler.availableUpgrades() - 16;
drawTexture(matrices, offsetX + 177 + 27 + 18, offsetY, 186, 0, 35 - 8, 7 + dx * 18);
if (dx == 8) {
drawTexture(matrices, offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8,
7);
drawTexture(matrices, offsetX + 177 + 27 + 18, offsetY + (7 + (dx) * 18), 186, 151, 35 - 8, 7);
} else {
drawTexture(matrices, offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151,
35 - 8, 7);
drawTexture(matrices, offsetX + 177 + 27 + 18 + 4, offsetY + (7 + (dx) * 18), 186 + 4, 151, 35 - 8,
7);
}
}
}
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.ChestContainer;
@@ -42,8 +41,8 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
public void init() {
super.init();
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
this.itemRenderer, btn -> openPriority()));
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
btn -> openPriority()));
}
private void openPriority() {
@@ -57,7 +56,8 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/chest.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.CondenserOutput;
import appeng.api.config.Settings;
import appeng.client.gui.AEBaseScreen;
@@ -49,8 +48,8 @@ public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
this.mode = new ServerSettingToggleButton<>(128 + this.x, 52 + this.y, Settings.CONDENSER_OUTPUT,
this.handler.getOutput());
this.addButton(new ProgressBar(this.handler, "guis/condenser.png", 120 + this.x, 25 + this.y, 178,
25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.text()));
this.addButton(new ProgressBar(this.handler, "guis/condenser.png", 120 + this.x, 25 + this.y, 178, 25, 6, 18,
Direction.VERTICAL, GuiText.StoredEnergy.text()));
this.addButton(this.mode);
}
@@ -64,7 +63,8 @@ public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/condenser.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
@@ -23,7 +23,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.NumberEntryType;
import appeng.container.implementations.CraftAmountContainer;
@@ -54,8 +53,8 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
this.amountToCraft.setMinValue(1);
this.amountToCraft.addButtons(children::add, this::addButton);
this.next = this.addButton(
new ButtonWidget(this.x + 128, this.y + 51, 38, 20, GuiText.Next.text(), this::confirm));
this.next = this
.addButton(new ButtonWidget(this.x + 128, this.y + 51, 38, 20, GuiText.Next.text(), this::confirm));
subGui.addBackButton(this::addButton, 154, 0);
}
@@ -71,7 +70,8 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.next.setMessage(hasShiftDown() ? GuiText.Start.text() : GuiText.Next.text());
this.bindTexture("guis/craft_amt.png");
@@ -33,7 +33,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
@@ -171,8 +170,8 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
dsp = GuiText.Simulation.text();
} else {
dsp = this.handler.getCpuAvailableBytes() > 0
? (GuiText.Bytes.withSuffix(": " + this.handler.getCpuAvailableBytes() + " : ").append(
GuiText.CoProcessors.text()).append(": " + this.handler.getCpuCoProcessors()))
? (GuiText.Bytes.withSuffix(": " + this.handler.getCpuAvailableBytes() + " : ")
.append(GuiText.CoProcessors.text()).append(": " + this.handler.getCpuCoProcessors()))
: GuiText.Bytes.withSuffix(": N/A : ").append(GuiText.CoProcessors.text()).append(": N/A");
}
@@ -326,7 +325,8 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.setScrollBar();
this.bindTexture("guis/craftingreport.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
@@ -26,15 +26,14 @@ import java.util.concurrent.TimeUnit;
import com.google.common.base.Joiner;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import org.apache.commons.lang3.time.DurationFormatUtils;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
@@ -307,7 +306,8 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/craftingcpu.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -34,8 +34,7 @@ public class CraftingStatusScreen extends CraftingCPUScreen<CraftingStatusContai
private ButtonWidget selectCPU;
public CraftingStatusScreen(CraftingStatusContainer container, PlayerInventory playerInventory,
Text title) {
public CraftingStatusScreen(CraftingStatusContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.subGui = new AESubScreen(this, container.getTarget());
}
@@ -64,8 +64,8 @@ public class CraftingTermScreen extends MEMonitorableScreen<CraftingTermContaine
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.draw(matrices, GuiText.CraftingTerminal.text(), 8, this.backgroundHeight - 96 + 1 - this.getReservedSpace(),
4210752);
this.textRenderer.draw(matrices, GuiText.CraftingTerminal.text(), 8,
this.backgroundHeight - 96 + 1 - this.getReservedSpace(), 4210752);
}
@Override
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.TabButton;
import appeng.container.implementations.DriveContainer;
@@ -42,8 +41,8 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
public void init() {
super.init();
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
btn -> openPriorityGui()));
}
private void openPriorityGui() {
@@ -57,7 +56,8 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/drive.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -38,21 +38,19 @@ public class FormationPlaneScreen extends UpgradeableScreen<FormationPlaneContai
private SettingToggleButton<YesNo> placeMode;
public FormationPlaneScreen(FormationPlaneContainer container, PlayerInventory playerInventory,
Text title) {
public FormationPlaneScreen(FormationPlaneContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.backgroundHeight = 251;
}
@Override
protected void addButtons() {
this.placeMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.PLACE_BLOCK,
YesNo.YES);
this.placeMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.PLACE_BLOCK, YesNo.YES);
this.fuzzyMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
btn -> openPriorityGui()));
this.addButton(this.placeMode);
this.addButton(this.fuzzyMode);
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.GrinderContainer;
import appeng.core.localization.GuiText;
@@ -41,7 +40,8 @@ public class GrinderScreen extends AEBaseScreen<GrinderContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/grinder.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -47,13 +47,13 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
protected void addButtons() {
this.fullMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.FULLNESS_MODE,
FullnessMode.EMPTY);
this.operationMode = new ServerSettingToggleButton<>(this.x + 80, this.y + 17,
Settings.OPERATION_MODE, OperationMode.EMPTY);
this.operationMode = new ServerSettingToggleButton<>(this.x + 80, this.y + 17, Settings.OPERATION_MODE,
OperationMode.EMPTY);
this.addButton(this.operationMode);
this.addButton(this.fullMode);
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28,
Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.REDSTONE_CONTROLLED,
RedstoneMode.IGNORE);
addButton(this.redstoneMode);
}
@@ -76,7 +76,8 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
super.drawBG(matrices, offsetX, offsetY, mouseX, mouseY, partialTicks);
final IDefinitions definitions = Api.instance().definitions();
@@ -23,7 +23,6 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ProgressBar;
import appeng.client.gui.widgets.ProgressBar.Direction;
@@ -54,14 +53,16 @@ public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.pb.setFullMsg(new LiteralText(this.handler.getCurrentProgress() * 100 / this.handler.getMaxProgress() + "%"));
this.pb.setFullMsg(
new LiteralText(this.handler.getCurrentProgress() * 100 / this.handler.getMaxProgress() + "%"));
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.Inscriber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/inscriber.png");
this.pb.x = 135 + this.x;
this.pb.y = 39 + this.y;
@@ -69,11 +70,11 @@ public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
drawTexture(matrices, offsetX, offsetY, 0, 0, 211 - 34, this.backgroundHeight);
if (this.drawUpgrades()) {
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35,
14 + this.handler.availableUpgrades() * 18);
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 14 + this.handler.availableUpgrades() * 18);
}
if (this.hasToolbox()) {
drawTexture(matrices, offsetX + 178, offsetY + this.backgroundHeight - 90, 178, this.backgroundHeight - 90, 68, 68);
drawTexture(matrices, offsetX + 178, offsetY + this.backgroundHeight - 90, 178, this.backgroundHeight - 90,
68, 68);
}
}
@@ -47,15 +47,14 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
@Override
protected void addButtons() {
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
btn -> openPriorityGui()));
this.blockMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.BLOCK, YesNo.NO);
this.addButton(this.blockMode);
this.interfaceMode = new ToggleButton(this.x - 18, this.y + 26, 84, 85,
GuiText.InterfaceTerminal.text(), GuiText.InterfaceTerminalHint.text(),
btn -> selectNextInterfaceMode());
this.interfaceMode = new ToggleButton(this.x - 18, this.y + 26, 84, 85, GuiText.InterfaceTerminal.text(),
GuiText.InterfaceTerminalHint.text(), btn -> selectNextInterfaceMode());
this.addButton(this.interfaceMode);
}
@@ -27,20 +27,20 @@ import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
import alexiil.mc.lib.attributes.Simulation;
import com.google.common.collect.HashMultimap;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag;
import net.minecraft.text.Text;
import alexiil.mc.lib.attributes.Simulation;
import appeng.api.storage.channels.IItemStorageChannel;
import appeng.client.ActionKey;
@@ -69,8 +69,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
private boolean refreshList = false;
private AETextField searchField;
public InterfaceTerminalScreen(InterfaceTerminalContainer container, PlayerInventory playerInventory,
Text title) {
public InterfaceTerminalScreen(InterfaceTerminalContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
final Scrollbar scrollbar = new Scrollbar();
this.setScrollBar(scrollbar);
@@ -142,7 +141,8 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/interfaceterminal.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
@@ -223,7 +223,8 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
for (int x = 0; x < current.getInventory().getSlotCount(); x++) {
final String which = Integer.toString(x);
if (invData.contains(which)) {
current.getInventory().setInvStack(x, ItemStack.fromTag(invData.getCompound(which)), Simulation.ACTION);
current.getInventory().setInvStack(x, ItemStack.fromTag(invData.getCompound(which)),
Simulation.ACTION);
}
}
} catch (final NumberFormatException ignored) {
@@ -68,12 +68,12 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
protected void addButtons() {
this.levelMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.LEVEL_TYPE,
LevelType.ITEM_LEVEL);
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28,
Settings.REDSTONE_EMITTER, RedstoneMode.LOW_SIGNAL);
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.REDSTONE_EMITTER,
RedstoneMode.LOW_SIGNAL);
this.fuzzyMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.craftingMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48,
Settings.CRAFT_VIA_REDSTONE, YesNo.NO);
this.craftingMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.CRAFT_VIA_REDSTONE,
YesNo.NO);
this.addButton(this.levelMode);
this.addButton(this.redstoneMode);
this.addButton(this.craftingMode);
@@ -100,14 +100,16 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
if (notCraftingMode) {
if (currentLevelMode == LevelType.ENERGY_LEVEL) {
this.textRenderer.draw(matrices, PowerUnits.AE.textComponent().getString(), 110, 44, COLOR_DARK_GRAY);
this.textRenderer.draw(matrices, PowerUnits.AE.textComponent().getString(), 110, 44,
COLOR_DARK_GRAY);
}
}
}
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
super.drawBG(matrices, offsetX, offsetY, mouseX, mouseY, partialTicks);
this.level.render(matrices, mouseX, mouseY, partialTicks);
}
@@ -20,13 +20,12 @@ package appeng.client.gui.implementations;
import java.util.List;
import appeng.mixins.SlotMixin;
import net.minecraft.client.util.math.MatrixStack;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.screen.slot.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text;
import appeng.api.config.SearchBoxMode;
@@ -63,6 +62,7 @@ import appeng.core.sync.packets.ConfigValuePacket;
import appeng.core.sync.packets.SwitchGuisPacket;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.integration.abstraction.ReiFacade;
import appeng.mixins.SlotMixin;
import appeng.parts.reporting.AbstractTerminalPart;
import appeng.tile.misc.SecurityStationBlockEntity;
import appeng.util.IConfigManagerHost;
@@ -205,13 +205,13 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
}
if (this.viewCell || this instanceof WirelessTermScreen) {
this.viewModeToggle = this.addButton(new SettingToggleButton<>(this.x - 18, offset,
Settings.VIEW_MODE, getSortDisplay(), this::toggleServerSetting));
this.viewModeToggle = this.addButton(new SettingToggleButton<>(this.x - 18, offset, Settings.VIEW_MODE,
getSortDisplay(), this::toggleServerSetting));
offset += 20;
}
this.addButton(this.sortDirToggle = new SettingToggleButton<>(this.x - 18, offset,
Settings.SORT_DIRECTION, getSortDir(), this::toggleServerSetting));
this.addButton(this.sortDirToggle = new SettingToggleButton<>(this.x - 18, offset, Settings.SORT_DIRECTION,
getSortDir(), this::toggleServerSetting));
offset += 20;
SearchBoxMode searchMode = AEConfig.instance().getTerminalSearchMode();
@@ -225,8 +225,7 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
this::toggleTerminalStyle));
}
this.searchField = new AETextField(this.textRenderer, this.x + Math.max(80, this.offsetX), this.y + 4, 90,
12);
this.searchField = new AETextField(this.textRenderer, this.x + Math.max(80, this.offsetX), this.y + 4, 90, 12);
this.searchField.setHasBorder(false);
this.searchField.setMaxLength(25);
this.searchField.setEditableColor(0xFFFFFF);
@@ -319,7 +318,8 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture(this.getBackground());
final int x_width = 197;
@@ -333,8 +333,8 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
drawTexture(matrices, offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
}
drawTexture(matrices, offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width,
99 + this.reservedSpace - this.lowerTextureOffset);
drawTexture(matrices, offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18,
x_width, 99 + this.reservedSpace - this.lowerTextureOffset);
if (this.viewCell) {
boolean update = false;
@@ -25,8 +25,7 @@ import appeng.container.implementations.MEPortableCellContainer;
public class MEPortableCellScreen extends MEMonitorableScreen<MEPortableCellContainer> {
public MEPortableCellScreen(MEPortableCellContainer container, PlayerInventory playerInventory,
Text title) {
public MEPortableCellScreen(MEPortableCellContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
}
@@ -52,8 +52,8 @@ public class MolecularAssemblerScreen extends UpgradeableScreen<MolecularAssembl
@Override
protected void addButtons() {
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8,
Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.REDSTONE_CONTROLLED,
RedstoneMode.IGNORE);
addButton(this.redstoneMode);
}
@@ -64,7 +64,8 @@ public class MolecularAssemblerScreen extends UpgradeableScreen<MolecularAssembl
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.pb.x = 148 + this.x;
this.pb.y = 48 + this.y;
super.drawBG(matrices, offsetX, offsetY, mouseX, mouseY, partialTicks);
@@ -25,11 +25,10 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.screen.slot.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.slot.Slot;
import net.minecraft.text.Text;
import appeng.api.config.SortDir;
import appeng.api.config.SortOrder;
import appeng.api.config.ViewItems;
@@ -50,8 +49,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
private final int rows = 4;
private int tooltip = -1;
public NetworkStatusScreen(NetworkStatusContainer container, PlayerInventory playerInventory,
Text title) {
public NetworkStatusScreen(NetworkStatusContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
final Scrollbar scrollbar = new Scrollbar();
@@ -106,17 +104,18 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
this.textRenderer.draw(matrices, GuiText.NetworkDetails.text(), 8, 6, 4210752);
this.textRenderer.draw(matrices,
GuiText.StoredPower.text() + ": " + Platform.formatPowerLong(handler.getCurrentPower(), false),
13, 16, 4210752);
GuiText.StoredPower.text() + ": " + Platform.formatPowerLong(handler.getCurrentPower(), false), 13, 16,
4210752);
this.textRenderer.draw(matrices,
GuiText.MaxPower.text() + ": " + Platform.formatPowerLong(handler.getMaxPower(), false), 13, 26,
4210752);
this.textRenderer.draw(matrices, GuiText.PowerInputRate.text() + ": "
+ Platform.formatPowerLong(handler.getAverageAddition(), true), 13, 143 - 10, 4210752);
this.textRenderer.draw(matrices,
GuiText.PowerUsageRate.text() + ": " + Platform.formatPowerLong(handler.getPowerUsage(), true),
13, 143 - 20, 4210752);
GuiText.PowerInputRate.text() + ": " + Platform.formatPowerLong(handler.getAverageAddition(), true), 13,
143 - 10, 4210752);
this.textRenderer.draw(matrices,
GuiText.PowerUsageRate.text() + ": " + Platform.formatPowerLong(handler.getPowerUsage(), true), 13,
143 - 20, 4210752);
final int sectionLength = 30;
@@ -143,8 +142,9 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
final int w = this.textRenderer.getWidth(str);
this.textRenderer.draw(matrices, str, (int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * 18 + yo + 6) * 2, 4210752);
this.textRenderer.draw(matrices, str,
(int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * 18 + yo + 6) * 2,
4210752);
RenderSystem.popMatrix();
final int posX = x * sectionLength + xo + sectionLength - 18;
@@ -155,8 +155,8 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
toolTip.add(GuiText.Installed.withSuffix(": " + (refStack.getStackSize())));
if (refStack.getCountRequestable() > 0) {
toolTip.add(GuiText.EnergyDrain.withSuffix(": "
+ Platform.formatPowerLong(refStack.getCountRequestable(), true)));
toolTip.add(GuiText.EnergyDrain
.withSuffix(": " + Platform.formatPowerLong(refStack.getCountRequestable(), true)));
}
toolPosX = x * sectionLength + xo + sectionLength - 8;
@@ -180,7 +180,8 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/networkstatus.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -223,8 +224,8 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
currentToolTip.add(GuiText.Installed.withSuffix(": " + myStack.getStackSize()));
currentToolTip.add(GuiText.EnergyDrain.withSuffix(": "
+ Platform.formatPowerLong(myStack.getCountRequestable(), true)));
currentToolTip.add(GuiText.EnergyDrain
.withSuffix(": " + Platform.formatPowerLong(myStack.getCountRequestable(), true)));
this.drawTooltip(matrices, x, y, currentToolTip);
}
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ToggleButton;
import appeng.container.implementations.NetworkToolContainer;
@@ -43,9 +42,8 @@ public class NetworkToolScreen extends AEBaseScreen<NetworkToolContainer> {
public void init() {
super.init();
this.tFacades = new ToggleButton(this.x - 18, this.y + 8, 23, 22,
GuiText.TransparentFacades.text(), GuiText.TransparentFacadesHint.text(),
btn -> toggleFacades());
this.tFacades = new ToggleButton(this.x - 18, this.y + 8, 23, 22, GuiText.TransparentFacades.text(),
GuiText.TransparentFacadesHint.text(), btn -> toggleFacades());
this.addButton(this.tFacades);
}
@@ -65,7 +63,8 @@ public class NetworkToolScreen extends AEBaseScreen<NetworkToolContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/toolbox.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -6,14 +6,14 @@ import java.util.function.LongConsumer;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.NumberEntryType;
import appeng.client.gui.widgets.ITickingWidget;
import appeng.client.gui.widgets.NumberBox;
import appeng.core.AEConfig;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
/**
* A utility widget that consists of a text-field to enter a number with
@@ -88,17 +88,24 @@ public class NumberEntryWidget implements ITickingWidget {
int top = parent.getY() + y;
addButton.accept(this.plus1 = new ButtonWidget(left, top, 22, 20, new LiteralText("+" + a), btn -> addQty(a)));
addButton.accept(this.plus10 = new ButtonWidget(left + 28, top, 28, 20, new LiteralText("+" + b), btn -> addQty(b)));
addButton.accept(this.plus100 = new ButtonWidget(left + 62, top, 32, 20, new LiteralText("+" + c), btn -> addQty(c)));
addButton.accept(this.plus1000 = new ButtonWidget(left + 100, top, 38, 20, new LiteralText("+" + d), btn -> addQty(d)));
addButton.accept(
this.plus10 = new ButtonWidget(left + 28, top, 28, 20, new LiteralText("+" + b), btn -> addQty(b)));
addButton.accept(
this.plus100 = new ButtonWidget(left + 62, top, 32, 20, new LiteralText("+" + c), btn -> addQty(c)));
addButton.accept(
this.plus1000 = new ButtonWidget(left + 100, top, 38, 20, new LiteralText("+" + d), btn -> addQty(d)));
// Placing this here will give a sensible tab order
addChildren.accept(this.level);
addButton.accept(this.minus1 = new ButtonWidget(left, top + 42, 22, 20, new LiteralText("-" + a), btn -> addQty(-a)));
addButton.accept(this.minus10 = new ButtonWidget(left + 28, top + 42, 28, 20, new LiteralText("-" + b), btn -> addQty(-b)));
addButton.accept(this.minus100 = new ButtonWidget(left + 62, top + 42, 32, 20, new LiteralText("-" + c), btn -> addQty(-c)));
addButton.accept(this.minus1000 = new ButtonWidget(left + 100, top + 42, 38, 20, new LiteralText("-" + d), btn -> addQty(-d)));
addButton.accept(
this.minus1 = new ButtonWidget(left, top + 42, 22, 20, new LiteralText("-" + a), btn -> addQty(-a)));
addButton.accept(this.minus10 = new ButtonWidget(left + 28, top + 42, 28, 20, new LiteralText("-" + b),
btn -> addQty(-b)));
addButton.accept(this.minus100 = new ButtonWidget(left + 62, top + 42, 32, 20, new LiteralText("-" + c),
btn -> addQty(-c)));
addButton.accept(this.minus1000 = new ButtonWidget(left + 100, top + 42, 38, 20, new LiteralText("-" + d),
btn -> addQty(-d)));
}
private void addQty(final long i) {
@@ -18,7 +18,6 @@
package appeng.client.gui.implementations;
import appeng.mixins.SlotMixin;
import net.minecraft.block.Blocks;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
@@ -33,6 +32,7 @@ import appeng.container.slot.AppEngSlot;
import appeng.core.localization.GuiText;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
import appeng.mixins.SlotMixin;
public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer> {
@@ -126,8 +126,8 @@ public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer>
}
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.draw(matrices, GuiText.PatternTerminal.text(), 8, this.backgroundHeight - 96 + 2 - this.getReservedSpace(),
4210752);
this.textRenderer.draw(matrices, GuiText.PatternTerminal.text(), 8,
this.backgroundHeight - 96 + 2 - this.getReservedSpace(), 4210752);
}
@Override
@@ -66,7 +66,8 @@ public class PriorityScreen extends AEBaseScreen<PriorityContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture(getBackground());
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.QNBContainer;
import appeng.core.localization.GuiText;
@@ -41,7 +40,8 @@ public class QNBScreen extends AEBaseScreen<QNBContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/chest.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -18,16 +18,15 @@
package appeng.client.gui.implementations;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import appeng.client.ActionKey;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.QuartzKnifeContainer;
@@ -49,7 +48,8 @@ public class QuartzKnifeScreen extends AEBaseScreen<QuartzKnifeContainer> {
public void init() {
super.init();
this.name = new TextFieldWidget(this.textRenderer, this.x + 24, this.y + 32, 79, this.textRenderer.fontHeight, LiteralText.EMPTY);
this.name = new TextFieldWidget(this.textRenderer, this.x + 24, this.y + 32, 79, this.textRenderer.fontHeight,
LiteralText.EMPTY);
this.name.setHasBorder(false);
this.name.setMaxLength(32);
this.name.setEditableColor(0xFFFFFF);
@@ -64,7 +64,8 @@ public class QuartzKnifeScreen extends AEBaseScreen<QuartzKnifeContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/quartzknife.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
this.name.render(matrices, mouseX, mouseY, partialTicks);
@@ -38,8 +38,7 @@ public class SecurityStationScreen extends MEMonitorableScreen<SecurityStationCo
private ToggleButton build;
private ToggleButton security;
public SecurityStationScreen(SecurityStationContainer container, PlayerInventory playerInventory,
Text title) {
public SecurityStationScreen(SecurityStationContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.setCustomSortOrder(false);
this.setReservedSpace(33);
@@ -59,9 +58,9 @@ public class SecurityStationScreen extends MEMonitorableScreen<SecurityStationCo
super.init();
final int top = this.y + this.backgroundHeight - 116;
this.inject = this.addButton(new ToggleButton(this.x + 56, top, 11 * 16, 12 * 16,
SecurityPermissions.INJECT.nameText(), SecurityPermissions.INJECT.tooltipText(),
btn -> toggleOption(SecurityPermissions.INJECT)));
this.inject = this
.addButton(new ToggleButton(this.x + 56, top, 11 * 16, 12 * 16, SecurityPermissions.INJECT.nameText(),
SecurityPermissions.INJECT.tooltipText(), btn -> toggleOption(SecurityPermissions.INJECT)));
this.extract = this.addButton(new ToggleButton(this.x + 56 + 18, top, 11 * 16 + 1, 12 * 16 + 1,
SecurityPermissions.EXTRACT.nameText(), SecurityPermissions.EXTRACT.tooltipText(),
@@ -83,8 +82,8 @@ public class SecurityStationScreen extends MEMonitorableScreen<SecurityStationCo
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawFG(matrices, offsetX, offsetY, mouseX, mouseY);
this.textRenderer.draw(matrices, GuiText.SecurityCardEditor.text(), 8, this.backgroundHeight - 96 + 1 - this.getReservedSpace(),
4210752);
this.textRenderer.draw(matrices, GuiText.SecurityCardEditor.text(), 8,
this.backgroundHeight - 96 + 1 - this.getReservedSpace(), 4210752);
}
@Override
@@ -20,9 +20,8 @@ package appeng.client.gui.implementations;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.Identifier;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import appeng.client.gui.AEBaseScreen;
import appeng.container.implementations.SkyChestContainer;
@@ -45,7 +44,8 @@ public class SkyChestScreen extends AEBaseScreen<SkyChestContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
bindTexture(TEXTURE);
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.CommonButtons;
import appeng.container.implementations.SpatialIOPortContainer;
@@ -31,8 +30,7 @@ import appeng.util.Platform;
public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
public SpatialIOPortScreen(SpatialIOPortContainer container, PlayerInventory playerInventory,
Text title) {
public SpatialIOPortScreen(SpatialIOPortContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.backgroundHeight = 199;
}
@@ -45,13 +43,14 @@ public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
@Override
public void drawFG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.textRenderer.draw(matrices, GuiText.StoredPower.withSuffix(": "
+ Platform.formatPowerLong(this.handler.getCurrentPower(), false)), 13, 21, 4210752);
this.textRenderer.draw(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getMaxPower(), false)), 13,
31, 4210752);
this.textRenderer.draw(matrices, GuiText.RequiredPower.withSuffix(": "
+ Platform.formatPowerLong(this.handler.getRequiredPower(), false)), 13, 73, 4210752);
GuiText.StoredPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getCurrentPower(), false)),
13, 21, 4210752);
this.textRenderer.draw(matrices,
GuiText.MaxPower.withSuffix(": " + Platform.formatPowerLong(this.handler.getMaxPower(), false)), 13, 31,
4210752);
this.textRenderer.draw(matrices, GuiText.RequiredPower
.withSuffix(": " + Platform.formatPowerLong(this.handler.getRequiredPower(), false)), 13, 73, 4210752);
this.textRenderer.draw(matrices,
GuiText.Efficiency.withSuffix(": " + (((float) this.handler.getEfficency()) / 100) + '%'), 13, 83,
4210752);
@@ -60,17 +59,19 @@ public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96, 4210752);
if (this.handler.xSize != 0 && this.handler.ySize != 0 && this.handler.zSize != 0) {
final Text text = GuiText.SCSSize.withSuffix(": " + this.handler.xSize + "x" + this.handler.ySize
+ "x" + this.handler.zSize);
final Text text = GuiText.SCSSize
.withSuffix(": " + this.handler.xSize + "x" + this.handler.ySize + "x" + this.handler.zSize);
this.textRenderer.draw(matrices, text, 13, 93, 4210752);
} else {
this.textRenderer.draw(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()), 13, 93, 4210752);
this.textRenderer.draw(matrices, GuiText.SCSSize.withSuffix(": ").append(GuiText.SCSInvalid.text()), 13, 93,
4210752);
}
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/spatialio.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -54,13 +54,13 @@ public class StorageBusScreen extends UpgradeableScreen<StorageBusContainer> {
addButton(new ActionButton(this.x - 18, this.y + 28, ActionItems.WRENCH, btn -> partition()));
this.rwMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.ACCESS,
AccessRestriction.READ_WRITE);
this.storageFilter = new ServerSettingToggleButton<>(this.x - 18, this.y + 68,
Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY);
this.storageFilter = new ServerSettingToggleButton<>(this.x - 18, this.y + 68, Settings.STORAGE_FILTER,
StorageFilter.EXTRACTABLE_ONLY);
this.fuzzyMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 88, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(new TabButton(this.x + 154, this.y, 2 + 4 * 16, GuiText.Priority.text(), this.itemRenderer,
btn -> openPriorityGui()));
this.addButton(this.storageFilter);
this.addButton(this.fuzzyMode);
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.api.config.FuzzyMode;
import appeng.api.config.RedstoneMode;
import appeng.api.config.SchedulingMode;
@@ -68,17 +67,16 @@ public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScr
}
protected void addButtons() {
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8,
Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE);
this.redstoneMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 8, Settings.REDSTONE_CONTROLLED,
RedstoneMode.IGNORE);
addButton(this.redstoneMode);
this.fuzzyMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 28, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
addButton(this.fuzzyMode);
this.craftMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.CRAFT_ONLY,
YesNo.NO);
this.craftMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 48, Settings.CRAFT_ONLY, YesNo.NO);
addButton(this.craftMode);
this.schedulingMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 68,
Settings.SCHEDULING_MODE, SchedulingMode.DEFAULT);
this.schedulingMode = new ServerSettingToggleButton<>(this.x - 18, this.y + 68, Settings.SCHEDULING_MODE,
SchedulingMode.DEFAULT);
addButton(this.schedulingMode);
}
@@ -105,7 +103,8 @@ public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScr
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.handleButtonVisibility();
this.bindTexture(this.getBackground());
@@ -114,7 +113,8 @@ public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScr
drawTexture(matrices, offsetX + 177, offsetY, 177, 0, 35, 14 + this.cvb.availableUpgrades() * 18);
}
if (this.hasToolbox()) {
drawTexture(matrices, offsetX + 178, offsetY + this.backgroundHeight - 90, 178, this.backgroundHeight - 90, 68, 68);
drawTexture(matrices, offsetX + 178, offsetY + this.backgroundHeight - 90, 178, this.backgroundHeight - 90,
68, 68);
}
}
@@ -25,7 +25,6 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.ProgressBar;
import appeng.client.gui.widgets.ProgressBar.Direction;
@@ -37,8 +36,7 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
private ProgressBar pb;
public VibrationChamberScreen(VibrationChamberContainer container, PlayerInventory playerInventory,
Text title) {
public VibrationChamberScreen(VibrationChamberContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
this.backgroundHeight = 166;
}
@@ -56,8 +54,8 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
this.textRenderer.draw(matrices, this.getGuiDisplayName(GuiText.VibrationChamber.text()), 8, 6, 4210752);
this.textRenderer.draw(matrices, GuiText.inventory.text(), 8, this.backgroundHeight - 96 + 3, 4210752);
this.pb.setFullMsg(new LiteralText(VibrationChamberBlockEntity.POWER_PER_TICK * this.handler.getCurrentProgress()
/ VibrationChamberBlockEntity.DILATION_SCALING + " AE/t"));
this.pb.setFullMsg(new LiteralText(VibrationChamberBlockEntity.POWER_PER_TICK
* this.handler.getCurrentProgress() / VibrationChamberBlockEntity.DILATION_SCALING + " AE/t"));
if (this.handler.getRemainingBurnTime() > 0) {
final int i1 = this.handler.getRemainingBurnTime() * 12 / 100;
@@ -70,7 +68,8 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/vibchamber.png");
this.pb.x = 99 + this.x;
this.pb.y = 36 + this.y;
@@ -22,7 +22,6 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.Text;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.widgets.CommonButtons;
import appeng.container.implementations.WirelessContainer;
@@ -62,7 +61,8 @@ public class WirelessScreen extends AEBaseScreen<WirelessContainer> {
}
@Override
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
public void drawBG(MatrixStack matrices, final int offsetX, final int offsetY, final int mouseX, final int mouseY,
float partialTicks) {
this.bindTexture("guis/wireless.png");
drawTexture(matrices, offsetX, offsetY, 0, 0, this.backgroundWidth, this.backgroundHeight);
}
@@ -26,8 +26,7 @@ import appeng.container.implementations.MEPortableCellContainer;
// FIXME: Extended from GuiPortableCell before... Why?
public class WirelessTermScreen extends MEMonitorableScreen<MEPortableCellContainer> {
public WirelessTermScreen(MEPortableCellContainer container, PlayerInventory playerInventory,
Text title) {
public WirelessTermScreen(MEPortableCellContainer container, PlayerInventory playerInventory, Text title) {
super(container, playerInventory, title);
}
@@ -53,7 +53,7 @@ public class AETextField extends TextFieldWidget {
* @param height absolute height
*/
public AETextField(final TextRenderer fontRenderer, final int xPos, final int yPos, final int width,
final int height) {
final int height) {
super(fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - (int) fontRenderer.getWidth("_"),
height - 2 * PADDING, LiteralText.EMPTY);
@@ -87,11 +87,13 @@ public class AETextField extends TextFieldWidget {
public void renderButton(MatrixStack matrices, int mouseX, int mouseY, float partial) {
if (this.isVisible()) {
if (this.isFocused()) {
fill(matrices, this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1,
this.y + this.height + PADDING - 1, 0xFF606060);
fill(matrices, this.x - PADDING + 1, this.y - PADDING + 1,
this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFF606060);
} else {
fill(matrices, this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1,
this.y + this.height + PADDING - 1, 0xFFA8A8A8);
fill(matrices, this.x - PADDING + 1, this.y - PADDING + 1,
this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFFA8A8A8);
}
super.renderButton(matrices, mouseX, mouseY, partial);
}
@@ -21,11 +21,12 @@ package appeng.client.gui.widgets;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import appeng.api.config.ActionItems;
import appeng.core.localization.ButtonToolTips;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import appeng.api.config.ActionItems;
import appeng.core.localization.ButtonToolTips;
public class ActionButton extends IconButton implements ITooltip {
private static final Pattern PATTERN_NEW_LINE = Pattern.compile("\\n", Pattern.LITERAL);
private final int iconIndex;
@@ -30,7 +30,8 @@ public abstract class CustomSlotWidget extends DrawableHelper implements IToolti
public void slotClicked(final ItemStack clickStack, final int mouseButton) {
}
public abstract void drawContent(final MinecraftClient mc, final int mouseX, final int mouseY, final float partialTicks);
public abstract void drawContent(final MinecraftClient mc, final int mouseX, final int mouseY,
final float partialTicks);
public void drawBackground(MatrixStack matrices, int guileft, int guitop, int currentZIndex) {
}
@@ -28,8 +28,7 @@ import net.minecraft.text.LiteralText;
import net.minecraft.util.Identifier;
public abstract class IconButton extends ButtonWidget implements ITooltip {
public static final Identifier TEXTURE_STATES = new Identifier("appliedenergistics2",
"textures/guis/states.png");
public static final Identifier TEXTURE_STATES = new Identifier("appliedenergistics2", "textures/guis/states.png");
private boolean halfSize = false;
@@ -35,7 +35,7 @@ public class NumberBox extends TextFieldWidget {
private long maxValue;
public NumberBox(final TextRenderer fontRenderer, final int x, final int y, final int width, final int height,
final Class<?> type, LongConsumer changeListener) {
final Class<?> type, LongConsumer changeListener) {
super(fontRenderer, x, y, width, height, new LiteralText("0"));
this.setText("0");
setChangedListener(this::handleTextChanged);

Some files were not shown because too many files have changed in this diff Show More