Added spotless back and reformatted
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -18,8 +18,6 @@
|
||||
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
import appeng.container.interfaces.IProgressProvider;
|
||||
import appeng.core.localization.GuiText;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.widget.AbstractButtonWidget;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
@@ -27,6 +25,9 @@ import net.minecraft.text.LiteralText;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.container.interfaces.IProgressProvider;
|
||||
import appeng.core.localization.GuiText;
|
||||
|
||||
public class ProgressBar extends AbstractButtonWidget implements ITooltip {
|
||||
|
||||
private final IProgressProvider source;
|
||||
@@ -66,8 +67,7 @@ public class ProgressBar extends AbstractButtonWidget implements ITooltip {
|
||||
this.height - diff);
|
||||
} else {
|
||||
final int diff = this.width - (max > 0 ? (this.width * current) / max : 0);
|
||||
drawTexture(matrices, this.x, this.y, this.fill_u + diff, this.fill_v, this.width - diff,
|
||||
this.height);
|
||||
drawTexture(matrices, this.x, this.y, this.fill_u + diff, this.fill_v, this.width - diff, this.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -83,8 +83,7 @@ public class ProgressBar extends AbstractButtonWidget implements ITooltip {
|
||||
}
|
||||
|
||||
Text text = this.titleName != null ? this.titleName : LiteralText.EMPTY;
|
||||
return text.copy().append("\n" + this.source.getCurrentProgress() + " ")
|
||||
.append(GuiText.Of.text())
|
||||
return text.copy().append("\n" + this.source.getCurrentProgress() + " ").append(GuiText.Of.text())
|
||||
.append(" " + this.source.getMaxProgress());
|
||||
}
|
||||
|
||||
|
||||
@@ -20,10 +20,11 @@ package appeng.client.gui.widgets;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import appeng.client.gui.AEBaseScreen;
|
||||
|
||||
public class Scrollbar implements IScrollSource {
|
||||
|
||||
private int displayX = 0;
|
||||
@@ -36,7 +37,8 @@ public class Scrollbar implements IScrollSource {
|
||||
private int minScroll = 0;
|
||||
private int currentScroll = 0;
|
||||
|
||||
private final DrawableHelper drawable = new DrawableHelper(){};
|
||||
private final DrawableHelper drawable = new DrawableHelper() {
|
||||
};
|
||||
|
||||
public void draw(MatrixStack matrices, final AEBaseScreen<?> g) {
|
||||
g.bindTexture("minecraft", "gui/container/creative_inventory/tabs.png");
|
||||
|
||||
@@ -29,15 +29,14 @@ import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class TabButton 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 final ItemRenderer itemRenderer;
|
||||
private int hideEdge = 0;
|
||||
private int myIcon = -1;
|
||||
private ItemStack myItem;
|
||||
|
||||
public TabButton(final int x, final int y, final int ico, final Text message, final ItemRenderer ir,
|
||||
PressAction onPress) {
|
||||
PressAction onPress) {
|
||||
super(x, y, 22, 22, message, onPress);
|
||||
|
||||
this.myIcon = ico;
|
||||
|
||||
@@ -30,8 +30,7 @@ import net.minecraft.text.Text;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class ToggleButton 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 static final Pattern PATTERN_NEW_LINE = Pattern.compile("\\n", Pattern.LITERAL);
|
||||
private final int iconIdxOn;
|
||||
private final int iconIdxOff;
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import appeng.client.render.model.AutoRotatingBakedModel;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
|
||||
import appeng.client.render.model.AutoRotatingBakedModel;
|
||||
|
||||
public final class BakedModelUnwrapper {
|
||||
|
||||
private BakedModelUnwrapper() {
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
@@ -12,9 +7,15 @@ import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
/**
|
||||
* An unbaked model that has standard models as a dependency and produces a custom baked model
|
||||
* as a result.
|
||||
* An unbaked model that has standard models as a dependency and produces a
|
||||
* custom baked model as a result.
|
||||
*/
|
||||
public interface BasicUnbakedModel extends UnbakedModel {
|
||||
|
||||
@@ -28,13 +29,12 @@ public interface BasicUnbakedModel extends UnbakedModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
default Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter, Set<Pair<String, String>> unresolvedTextureReferences) {
|
||||
default Collection<SpriteIdentifier> getTextureDependencies(Function<Identifier, UnbakedModel> unbakedModelGetter,
|
||||
Set<Pair<String, String>> unresolvedTextureReferences) {
|
||||
return Stream.concat(
|
||||
getModelDependencies().stream()
|
||||
.map(unbakedModelGetter)
|
||||
.flatMap(ubm -> ubm.getTextureDependencies(unbakedModelGetter, unresolvedTextureReferences).stream()),
|
||||
getAdditionalTextures()
|
||||
).collect(Collectors.toList());
|
||||
getModelDependencies().stream().map(unbakedModelGetter).flatMap(
|
||||
ubm -> ubm.getTextureDependencies(unbakedModelGetter, unresolvedTextureReferences).stream()),
|
||||
getAdditionalTextures()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,13 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -32,11 +38,7 @@ 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.Supplier;
|
||||
import alexiil.mc.lib.attributes.fluid.volume.FluidVolume;
|
||||
|
||||
/**
|
||||
* @author DrummerMC
|
||||
@@ -57,7 +59,8 @@ public class DummyFluidBakedModel 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) {
|
||||
// Not used as an item model
|
||||
}
|
||||
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
import appeng.client.render.cablebus.FacadeBuilder;
|
||||
import appeng.items.parts.FacadeItem;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
@@ -30,9 +30,11 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
||||
import appeng.client.render.cablebus.FacadeBuilder;
|
||||
import appeng.items.parts.FacadeItem;
|
||||
|
||||
/**
|
||||
* This baked model class is used as a dispatcher to redirect the renderer to
|
||||
|
||||
@@ -18,8 +18,12 @@
|
||||
|
||||
package appeng.client.render;
|
||||
|
||||
import appeng.client.render.cablebus.FacadeBuilder;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -27,10 +31,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.Collections;
|
||||
import java.util.function.Function;
|
||||
import appeng.client.render.cablebus.FacadeBuilder;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* The model class for facades. Since facades wrap existing models, they don't
|
||||
@@ -43,7 +45,8 @@ public class FacadeItemModel 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 bakedBaseModel = loader.bake(MODEL_BASE, rotationContainer);
|
||||
FacadeBuilder facadeBuilder = new FacadeBuilder(loader);
|
||||
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.util.StringIdentifiable;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Matrix4f;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
|
||||
import net.fabricmc.fabric.api.client.model.ModelResourceProvider;
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* A quaint model provider that provides a single model with a single given resource identifier.
|
||||
* A quaint model provider that provides a single model with a single given
|
||||
* resource identifier.
|
||||
*/
|
||||
public class SimpleModelLoader<T extends UnbakedModel> implements ModelResourceProvider {
|
||||
|
||||
|
||||
@@ -20,15 +20,15 @@ package appeng.client.render;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import net.minecraft.client.render.BufferBuilder;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexFormats;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
|
||||
public class SpatialSkyRender {
|
||||
|
||||
@@ -46,9 +46,10 @@ public class SpatialSkyRender {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private static final Quaternion[] SKYBOX_SIDE_ROTATIONS = { Quaternion.IDENTITY, new Quaternion(90.0F, 0.0F, 0.0F, true),
|
||||
new Quaternion(-90.0F, 0.0F, 0.0F, true), new Quaternion(180.0F, 0.0F, 0.0F, true),
|
||||
new Quaternion(0.0F, 0.0F, 90.0F, true), new Quaternion(0.0F, 0.0F, -90.0F, true), };
|
||||
private static final Quaternion[] SKYBOX_SIDE_ROTATIONS = { Quaternion.IDENTITY,
|
||||
new Quaternion(90.0F, 0.0F, 0.0F, true), new Quaternion(-90.0F, 0.0F, 0.0F, true),
|
||||
new Quaternion(180.0F, 0.0F, 0.0F, true), new Quaternion(0.0F, 0.0F, 90.0F, true),
|
||||
new Quaternion(0.0F, 0.0F, -90.0F, true), };
|
||||
|
||||
public void render(MatrixStack matrixStack) {
|
||||
final long now = System.currentTimeMillis();
|
||||
|
||||
@@ -21,9 +21,9 @@ package appeng.client.render;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.util.math.AffineTransformation;
|
||||
import net.minecraft.client.render.Tessellator;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
@@ -72,10 +72,10 @@ public class StackSizeRenderer {
|
||||
null, new Vector3f(scaleFactor, scaleFactor, scaleFactor), null);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
final int X = (int) ((xPos + offset + 16.0f - fontRenderer.getWidth(text) * scaleFactor)
|
||||
* inverseScaleFactor);
|
||||
final int X = (int) ((xPos + offset + 16.0f - fontRenderer.getWidth(text) * scaleFactor) * inverseScaleFactor);
|
||||
final int Y = (int) ((yPos + offset + 16.0f - 7.0f * scaleFactor) * inverseScaleFactor);
|
||||
VertexConsumerProvider.Immediate buffer = VertexConsumerProvider.immediate(Tessellator.getInstance().getBuffer());
|
||||
VertexConsumerProvider.Immediate buffer = VertexConsumerProvider
|
||||
.immediate(Tessellator.getInstance().getBuffer());
|
||||
fontRenderer.draw(text, X, Y, 16777215, true, tm.getMatrix(), buffer, false, 0, 15728880);
|
||||
buffer.draw();
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
@@ -19,13 +19,12 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.render.OverlayTexture;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import net.minecraft.client.font.TextRenderer;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.client.render.model.json.ModelTransformation;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
@@ -82,7 +81,7 @@ public class TesrRenderHelper {
|
||||
* Render an item in 2D.
|
||||
*/
|
||||
public static void renderItem2d(MatrixStack matrixStack, VertexConsumerProvider buffers, ItemStack itemStack,
|
||||
float scale, int combinedLightIn, int combinedOverlayIn) {
|
||||
float scale, int combinedLightIn, int combinedOverlayIn) {
|
||||
if (!itemStack.isEmpty()) {
|
||||
matrixStack.push();
|
||||
// Push it out of the block face a bit to avoid z-fighting
|
||||
@@ -127,8 +126,7 @@ public class TesrRenderHelper {
|
||||
matrixStack.scale(1.0f / 62.0f, -1.0f / 62.0f, 1.0f / 62.0f);
|
||||
matrixStack.scale(0.5f, 0.5f, 0);
|
||||
matrixStack.translate(-0.5f * width, 0.0f, 0.5f);
|
||||
fr.draw(renderedStackSize, 0, 0, -1, false, matrixStack.peek().getModel(), buffers, false, 0,
|
||||
15728880);
|
||||
fr.draw(renderedStackSize, 0, 0, -1, false, matrixStack.peek().getModel(), buffers, false, 0, 15728880);
|
||||
matrixStack.pop();
|
||||
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ import java.util.function.Function;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
@@ -216,7 +216,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addConstrainedGlassConnection(Direction facing, AEColor cableColor, int distanceFromEdge,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
|
||||
// Glass connections reach only 6 voxels from the edge
|
||||
if (distanceFromEdge >= 6) {
|
||||
@@ -307,7 +307,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addConstrainedCoveredConnection(Direction facing, AEColor cableColor, int distanceFromEdge,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
// The core of a covered cable reaches up to 5 voxels from the block edge, so
|
||||
// drawing a connection can only occur from there onwards
|
||||
if (distanceFromEdge >= 5) {
|
||||
@@ -374,8 +374,7 @@ class CableBuilder {
|
||||
addCoveredCableSizedCube(facing, cubeBuilder);
|
||||
}
|
||||
|
||||
public void addStraightSmartConnection(Direction facing, AEColor cableColor, int channels,
|
||||
QuadEmitter emitter) {
|
||||
public void addStraightSmartConnection(Direction facing, AEColor cableColor, int channels, QuadEmitter emitter) {
|
||||
CubeBuilder cubeBuilder = new CubeBuilder(emitter);
|
||||
|
||||
Sprite texture = this.connectionTextures.get(AECableType.SMART).get(cableColor);
|
||||
@@ -401,7 +400,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addConstrainedSmartConnection(Direction facing, AEColor cableColor, int distanceFromEdge, int channels,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
// Same as with covered cables, the smart cable's core extends up to 5 voxels
|
||||
// away from the edge.
|
||||
// Drawing a connection to any point before that point is fruitless
|
||||
@@ -515,7 +514,7 @@ class CableBuilder {
|
||||
}
|
||||
|
||||
public void addStraightDenseSmartConnection(Direction facing, AEColor cableColor, int channels,
|
||||
QuadEmitter emitter) {
|
||||
QuadEmitter emitter) {
|
||||
CubeBuilder cubeBuilder = new CubeBuilder(emitter);
|
||||
|
||||
Sprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
|
||||
|
||||
@@ -18,10 +18,18 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
@@ -45,16 +53,10 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.parts.IPartModel;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.AEColor;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
@@ -72,8 +74,8 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
private final Sprite particleTexture;
|
||||
|
||||
CableBusBakedModel(CableBuilder cableBuilder, FacadeBuilder facadeBuilder,
|
||||
Map<Identifier, BakedModel> partModels, Sprite particleTexture) {
|
||||
CableBusBakedModel(CableBuilder cableBuilder, FacadeBuilder facadeBuilder, Map<Identifier, BakedModel> partModels,
|
||||
Sprite particleTexture) {
|
||||
this.cableBuilder = cableBuilder;
|
||||
this.facadeBuilder = facadeBuilder;
|
||||
this.partModels = partModels;
|
||||
@@ -97,7 +99,8 @@ public class CableBusBakedModel 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) {
|
||||
|
||||
CableBusRenderState renderState = getRenderState(blockView, pos);
|
||||
|
||||
@@ -131,8 +134,7 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
if (bakedModel instanceof IDynamicPartBakedModel) {
|
||||
((IDynamicPartBakedModel) bakedModel).emitQuads(blockView, state, pos, randomSupplier, context,
|
||||
facing, partModelData);
|
||||
}
|
||||
else if (bakedModel instanceof FabricBakedModel) {
|
||||
} else if (bakedModel instanceof FabricBakedModel) {
|
||||
((FabricBakedModel) bakedModel).emitBlockQuads(blockView, state, pos, randomSupplier, context);
|
||||
} else {
|
||||
context.fallbackConsumer().accept(bakedModel);
|
||||
@@ -253,8 +255,7 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
switch (cableType) {
|
||||
case GLASS:
|
||||
this.cableBuilder.addGlassConnection(facing, cableColor, connectionType, cableBusAdjacent,
|
||||
emitter);
|
||||
this.cableBuilder.addGlassConnection(facing, cableColor, connectionType, cableBusAdjacent, emitter);
|
||||
break;
|
||||
case COVERED:
|
||||
this.cableBuilder.addCoveredConnection(facing, cableColor, connectionType, cableBusAdjacent,
|
||||
@@ -323,7 +324,6 @@ public class CableBusBakedModel implements BakedModel, FabricBakedModel {
|
||||
return particleTexture instanceof MissingSprite;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean useAmbientOcclusion() {
|
||||
return true;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
import net.minecraft.client.particle.SpriteBillboardParticle;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
// Derived from Vanilla's BreakingParticle, but allows
|
||||
// a texture to be specified directly rather than via an itemstack
|
||||
@@ -16,7 +16,7 @@ public class CableBusBreakingParticle extends SpriteBillboardParticle {
|
||||
private final float field_217572_F;
|
||||
|
||||
public CableBusBreakingParticle(ClientWorld world, double x, double y, double z, double speedX, double speedY,
|
||||
double speedZ, Sprite sprite) {
|
||||
double speedZ, Sprite sprite) {
|
||||
super(world, x, y, z, speedX, speedY, speedZ);
|
||||
this.setSprite(sprite);
|
||||
this.gravityStrength = 1.0F;
|
||||
|
||||
@@ -18,11 +18,15 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
@@ -32,11 +36,10 @@ 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.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
|
||||
/**
|
||||
* The built-in model for the cable bus block.
|
||||
@@ -63,7 +66,8 @@ public class CableBusModel 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) {
|
||||
Map<Identifier, BakedModel> partModels = this.loadPartModels(loader, rotationContainer);
|
||||
|
||||
CableBuilder cableBuilder = new CableBuilder(textureGetter);
|
||||
@@ -77,9 +81,7 @@ public class CableBusModel implements BasicUnbakedModel {
|
||||
return new CableBusBakedModel(cableBuilder, facadeBuilder, partModels, particleTexture);
|
||||
}
|
||||
|
||||
|
||||
private Map<Identifier, BakedModel> loadPartModels(ModelLoader loader,
|
||||
ModelBakeSettings rotationContainer) {
|
||||
private Map<Identifier, BakedModel> loadPartModels(ModelLoader loader, ModelBakeSettings rotationContainer) {
|
||||
ImmutableMap.Builder<Identifier, BakedModel> result = ImmutableMap.builder();
|
||||
|
||||
for (Identifier location : this.partModels.getModels()) {
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
import net.fabricmc.fabric.api.client.model.ModelProviderContext;
|
||||
import net.fabricmc.fabric.api.client.model.ModelProviderException;
|
||||
import net.fabricmc.fabric.api.client.model.ModelResourceProvider;
|
||||
import net.minecraft.client.render.model.UnbakedModel;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.features.registries.PartModels;
|
||||
|
||||
public class CableBusModelLoader implements ModelResourceProvider {
|
||||
|
||||
private static final Identifier CABLE_BUS_MODEL = AppEng.makeId("block/cable_bus");
|
||||
@@ -19,7 +20,8 @@ public class CableBusModelLoader implements ModelResourceProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context) throws ModelProviderException {
|
||||
public UnbakedModel loadModelResource(Identifier resourceId, ModelProviderContext context)
|
||||
throws ModelProviderException {
|
||||
if (CABLE_BUS_MODEL.equals(resourceId)) {
|
||||
CableBusBakedModel.clearCache();
|
||||
return new CableBusModel(partModels);
|
||||
|
||||
@@ -25,9 +25,9 @@ import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Box;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import appeng.api.parts.IPartModel;
|
||||
|
||||
@@ -23,8 +23,8 @@ import java.util.Map;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.api.util.AECableType;
|
||||
|
||||
@@ -26,8 +26,8 @@ import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.QuadEmitter;
|
||||
import net.minecraft.client.render.*;
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.math.Vector4f;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
/**
|
||||
@@ -87,8 +87,7 @@ public class CubeBuilder {
|
||||
Sprite texture = this.textures.get(face);
|
||||
|
||||
QuadEmitter emitter = this.emitter;
|
||||
emitter.colorIndex(-1)
|
||||
.nominalFace(face);
|
||||
emitter.colorIndex(-1).nominalFace(face);
|
||||
|
||||
UvVector uv = new UvVector();
|
||||
|
||||
@@ -155,8 +154,8 @@ public class CubeBuilder {
|
||||
this.vertexIndex = 0;
|
||||
}
|
||||
|
||||
private UvVector getDefaultUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2,
|
||||
float y2, float z2) {
|
||||
private UvVector getDefaultUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2, float y2,
|
||||
float z2) {
|
||||
|
||||
UvVector uv = new UvVector();
|
||||
|
||||
@@ -202,8 +201,8 @@ public class CubeBuilder {
|
||||
return uv;
|
||||
}
|
||||
|
||||
private UvVector getStandardUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2,
|
||||
float y2, float z2) {
|
||||
private UvVector getStandardUv(Direction face, Sprite texture, float x1, float y1, float z1, float x2, float y2,
|
||||
float z2) {
|
||||
UvVector uv = new UvVector();
|
||||
switch (face) {
|
||||
case DOWN:
|
||||
@@ -376,8 +375,7 @@ public class CubeBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextures(Sprite up, Sprite down, Sprite north,
|
||||
Sprite south, Sprite east, Sprite west) {
|
||||
public void setTextures(Sprite up, Sprite down, Sprite north, Sprite south, Sprite east, Sprite west) {
|
||||
this.textures.put(Direction.UP, up);
|
||||
this.textures.put(Direction.DOWN, down);
|
||||
this.textures.put(Direction.NORTH, north);
|
||||
|
||||
@@ -23,8 +23,8 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.entity.BlockEntity;
|
||||
import net.minecraft.fluid.FluidState;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.world.chunk.light.LightingProvider;
|
||||
import net.minecraft.world.level.ColorResolver;
|
||||
|
||||
@@ -18,15 +18,19 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.core.Api;
|
||||
import appeng.mixins.MinecraftClientAccessor;
|
||||
import appeng.parts.misc.CableAnchorPart;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadClamper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadCornerKicker;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadFaceStripper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadReInterpolator;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadTinter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
@@ -51,17 +55,15 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Direction.Axis;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.util.AEAxisAlignedBB;
|
||||
import appeng.core.Api;
|
||||
import appeng.mixins.MinecraftClientAccessor;
|
||||
import appeng.parts.misc.CableAnchorPart;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadClamper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadCornerKicker;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadFaceStripper;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadReInterpolator;
|
||||
import appeng.thirdparty.codechicken.lib.model.pipeline.transformers.QuadTinter;
|
||||
|
||||
/**
|
||||
* The FacadeBuilder builds for facades..
|
||||
@@ -75,21 +77,15 @@ public class FacadeBuilder {
|
||||
public static final double THICK_THICKNESS = 2D / 16D;
|
||||
public static final double THIN_THICKNESS = 1D / 16D;
|
||||
|
||||
public static final Box[] THICK_FACADE_BOXES = new Box[]{
|
||||
new Box(0.0, 0.0, 0.0, 1.0, THICK_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THICK_THICKNESS, 0.0, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, 1.0, 1.0, THICK_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THICK_THICKNESS, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, THICK_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THICK_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0)};
|
||||
public static final Box[] THICK_FACADE_BOXES = new Box[] { new Box(0.0, 0.0, 0.0, 1.0, THICK_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THICK_THICKNESS, 0.0, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, 1.0, 1.0, THICK_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THICK_THICKNESS, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, THICK_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THICK_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0) };
|
||||
|
||||
public static final Box[] THIN_FACADE_BOXES = new Box[]{
|
||||
new Box(0.0, 0.0, 0.0, 1.0, THIN_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THIN_THICKNESS, 0.0, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, 1.0, 1.0, THIN_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THIN_THICKNESS, 1.0, 1.0, 1.0),
|
||||
new Box(0.0, 0.0, 0.0, THIN_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THIN_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0)};
|
||||
public static final Box[] THIN_FACADE_BOXES = new Box[] { new Box(0.0, 0.0, 0.0, 1.0, THIN_THICKNESS, 1.0),
|
||||
new Box(0.0, 1.0 - THIN_THICKNESS, 0.0, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, 1.0, 1.0, THIN_THICKNESS),
|
||||
new Box(0.0, 0.0, 1.0 - THIN_THICKNESS, 1.0, 1.0, 1.0), new Box(0.0, 0.0, 0.0, THIN_THICKNESS, 1.0, 1.0),
|
||||
new Box(1.0 - THIN_THICKNESS, 0.0, 0.0, 1.0, 1.0, 1.0) };
|
||||
|
||||
private final Map<Direction, Mesh> cableAnchorStilts;
|
||||
|
||||
@@ -98,8 +94,8 @@ public class FacadeBuilder {
|
||||
}
|
||||
|
||||
/**
|
||||
* Build a map of pre-rotated cable anchor stilts, which are the shortened cable anchors that
|
||||
* will still be visible for facades attached to a cable.
|
||||
* Build a map of pre-rotated cable anchor stilts, which are the shortened cable
|
||||
* anchors that will still be visible for facades attached to a cable.
|
||||
*/
|
||||
private Map<Direction, Mesh> buildCableAnchorStems(ModelLoader modelLoader) {
|
||||
Map<Direction, Mesh> stems = new EnumMap<>(Direction.class);
|
||||
@@ -139,9 +135,8 @@ public class FacadeBuilder {
|
||||
return stems;
|
||||
}
|
||||
|
||||
public Mesh getFacadeMesh(CableBusRenderState renderState,
|
||||
Supplier<Random> rand,
|
||||
Function<Identifier, BakedModel> modelLookup) {
|
||||
public Mesh getFacadeMesh(CableBusRenderState renderState, Supplier<Random> rand,
|
||||
Function<Identifier, BakedModel> modelLookup) {
|
||||
boolean transparent = Api.instance().partHelper().getCableRenderMode().transparentFacades;
|
||||
Map<Direction, FacadeRenderState> facadeStates = renderState.getFacades();
|
||||
List<Box> partBoxes = renderState.getBoundingBoxes();
|
||||
@@ -257,7 +252,8 @@ public class FacadeBuilder {
|
||||
|
||||
// Prebake the color tint into the quad
|
||||
if (quad.getColorIndex() != -1) {
|
||||
quadTinter = new QuadTinter(blockColors.getColor(blockState, facadeAccess, pos, quad.getColorIndex()));
|
||||
quadTinter = new QuadTinter(
|
||||
blockColors.getColor(blockState, facadeAccess, pos, quad.getColorIndex()));
|
||||
}
|
||||
|
||||
for (Box box : holeStrips) {
|
||||
@@ -311,15 +307,15 @@ public class FacadeBuilder {
|
||||
MeshBuilder meshBuilder = renderer.meshBuilder();
|
||||
QuadEmitter emitter = meshBuilder.getEmitter();
|
||||
|
||||
BakedModel model = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(textureItem, null,
|
||||
null);
|
||||
BakedModel model = MinecraftClient.getInstance().getItemRenderer().getHeldItemModel(textureItem, null, null);
|
||||
List<BakedQuad> modelQuads = model.getQuads(null, null, new Random());
|
||||
|
||||
//FIXME BakedPipeline pipeline = this.pipelines.get();
|
||||
// FIXME BakedPipeline pipeline = this.pipelines.get();
|
||||
//FIXME Quad collectorQuad = this.collectors.get();
|
||||
|
||||
// Grab pipeline elements.
|
||||
// FIXME QuadClamper clamper = pipeline.getElement("clamper", QuadClamper.class);
|
||||
// FIXME QuadClamper clamper = pipeline.getElement("clamper",
|
||||
// QuadClamper.class);
|
||||
// FIXME QuadTinter tinter = pipeline.getElement("tinter", QuadTinter.class);
|
||||
|
||||
QuadReInterpolator interpolator = new QuadReInterpolator();
|
||||
@@ -362,15 +358,18 @@ public class FacadeBuilder {
|
||||
for (BakedQuad quad : modelQuads) {
|
||||
|
||||
// Lookup the CachedFormat for this quads format.
|
||||
// FIXME CachedFormat format = CachedFormat.lookup(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
|
||||
// FIXME CachedFormat format =
|
||||
// CachedFormat.lookup(VertexFormats.POSITION_COLOR_TEXTURE_LIGHT_NORMAL);
|
||||
// Reset the pipeline.
|
||||
// FIXME pipeline.reset(format);
|
||||
// Reset the collector.
|
||||
//FIXME collectorQuad.reset(format);
|
||||
// FIXME collectorQuad.reset(format);
|
||||
// If we have a tint index, setup the tinter and enable it.
|
||||
// FIXME if (quad.hasTintIndex()) {
|
||||
// FIXME tinter.setTint(MinecraftClient.getInstance().getItemColors().getColor(textureItem, quad.getColorIndex()));
|
||||
// FIXME pipeline.enableElement("tinter");
|
||||
// FIXME
|
||||
// tinter.setTint(MinecraftClient.getInstance().getItemColors().getColor(textureItem,
|
||||
// quad.getColorIndex()));
|
||||
// FIXME pipeline.enableElement("tinter");
|
||||
// FIXME }
|
||||
// Disable elements we don't need for items.
|
||||
// FIXME pipeline.disableElement("face_stripper");
|
||||
@@ -383,7 +382,7 @@ public class FacadeBuilder {
|
||||
// FIXME quad.pipe(pipeline);
|
||||
// FIXME // Check the collector for data and add the quad if there was.
|
||||
// FIXME if (collectorQuad.full) {
|
||||
// FIXME facadeQuads.add(collectorQuad.bake());
|
||||
// FIXME facadeQuads.add(collectorQuad.bake());
|
||||
// FIXME }
|
||||
}
|
||||
return meshBuilder.build();
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.util.Platform;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
@@ -19,10 +23,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.Random;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.parts.IDynamicPartBakedModel;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class P2PTunnelFrequencyBakedModel implements IDynamicPartBakedModel {
|
||||
|
||||
@@ -32,15 +35,15 @@ public class P2PTunnelFrequencyBakedModel implements IDynamicPartBakedModel {
|
||||
|
||||
private final static Cache<Long, Mesh> modelCache = CacheBuilder.newBuilder().maximumSize(100).build();
|
||||
|
||||
private static final int[][] QUAD_OFFSETS = new int[][]{{4, 10, 2}, {10, 10, 2}, {4, 4, 2}, {10, 4, 2}};
|
||||
private static final int[][] QUAD_OFFSETS = new int[][] { { 4, 10, 2 }, { 10, 10, 2 }, { 4, 4, 2 }, { 10, 4, 2 } };
|
||||
|
||||
public P2PTunnelFrequencyBakedModel(final Sprite texture) {
|
||||
this.texture = texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier, RenderContext context,
|
||||
Direction partSide, @Nullable Object modelData) {
|
||||
public void emitQuads(BlockRenderView blockView, BlockState state, BlockPos pos, Supplier<Random> randomSupplier,
|
||||
RenderContext context, Direction partSide, @Nullable Object modelData) {
|
||||
if (!(modelData instanceof Long)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -10,9 +13,8 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
public class P2PTunnelFrequencyModel implements BasicUnbakedModel {
|
||||
|
||||
@@ -21,7 +23,8 @@ public class P2PTunnelFrequencyModel 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) {
|
||||
final Sprite texture = textureGetter.apply(TEXTURE);
|
||||
return new P2PTunnelFrequencyBakedModel(texture);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
|
||||
package appeng.client.render.cablebus;
|
||||
|
||||
import appeng.client.render.FacingToRotation;
|
||||
import java.util.EnumMap;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.MutableQuadView;
|
||||
@@ -28,7 +29,7 @@ import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
|
||||
import java.util.EnumMap;
|
||||
import appeng.client.render.FacingToRotation;
|
||||
|
||||
/**
|
||||
* Assuming a default-orientation of forward=NORTH and up=UP, this class rotates
|
||||
@@ -39,8 +40,8 @@ public class QuadRotator implements RenderContext.QuadTransform {
|
||||
|
||||
public static final RenderContext.QuadTransform NULL_TRANSFORM = quad -> true;
|
||||
|
||||
private static final EnumMap<FacingToRotation, RenderContext.QuadTransform> TRANSFORMS
|
||||
= new EnumMap<>(FacingToRotation.class);
|
||||
private static final EnumMap<FacingToRotation, RenderContext.QuadTransform> TRANSFORMS = new EnumMap<>(
|
||||
FacingToRotation.class);
|
||||
|
||||
static {
|
||||
for (FacingToRotation rotation : FacingToRotation.values()) {
|
||||
|
||||
@@ -23,9 +23,9 @@ import java.util.function.Function;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
|
||||
@@ -40,7 +40,6 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.tile.crafting.CraftingCubeModelData;
|
||||
import appeng.util.Platform;
|
||||
@@ -71,7 +70,8 @@ abstract class CraftingCubeBakedModel 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) {
|
||||
CraftingCubeModelData modelData = getModelData(blockView, pos);
|
||||
EnumSet<Direction> connections = modelData.getConnections();
|
||||
|
||||
@@ -275,8 +275,8 @@ abstract class CraftingCubeBakedModel implements BakedModel, FabricBakedModel {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder,
|
||||
float x1, float y1, float z1, float x2, float y2, float z2);
|
||||
protected abstract void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData,
|
||||
CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2);
|
||||
|
||||
@Override
|
||||
public boolean useAmbientOcclusion() {
|
||||
|
||||
@@ -18,9 +18,11 @@
|
||||
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -29,9 +31,9 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* The built-in model for the connected texture crafting cube.
|
||||
@@ -68,7 +70,8 @@ public class CraftingCubeModel 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) {
|
||||
// Retrieve our textures and pass them on to the baked model
|
||||
Sprite ringCorner = textureGetter.apply(RING_CORNER);
|
||||
Sprite ringSideHor = textureGetter.apply(RING_SIDE_HOR);
|
||||
@@ -94,7 +97,7 @@ public class CraftingCubeModel implements BasicUnbakedModel {
|
||||
}
|
||||
|
||||
private static Sprite getLightTexture(Function<SpriteIdentifier, Sprite> textureGetter,
|
||||
AbstractCraftingUnitBlock.CraftingUnitType type) {
|
||||
AbstractCraftingUnitBlock.CraftingUnitType type) {
|
||||
switch (type) {
|
||||
case ACCELERATOR:
|
||||
return textureGetter.apply(ACCELERATOR_LIGHT);
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.RenderLayer;
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
||||
import appeng.bootstrap.BlockRenderingCustomizer;
|
||||
import appeng.bootstrap.IBlockRendering;
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderDispatcher;
|
||||
import net.minecraft.client.render.block.entity.BlockEntityRenderer;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.client.render.TesrRenderHelper;
|
||||
@@ -43,7 +42,7 @@ public class CraftingMonitorTESR extends BlockEntityRenderer<CraftingMonitorBloc
|
||||
|
||||
@Override
|
||||
public void render(CraftingMonitorBlockEntity te, float partialTicks, MatrixStack matrixStack,
|
||||
VertexConsumerProvider buffers, int combinedLight, int combinedOverlay) {
|
||||
VertexConsumerProvider buffers, int combinedLight, int combinedOverlay) {
|
||||
|
||||
Direction facing = te.getForward();
|
||||
|
||||
|
||||
@@ -18,14 +18,13 @@
|
||||
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
import appeng.tile.crafting.CraftingCubeModelData;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
import appeng.block.crafting.AbstractCraftingUnitBlock;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.tile.crafting.CraftingCubeModelData;
|
||||
|
||||
/**
|
||||
* Crafting cube baked model that adds a full-bright light texture on top of a
|
||||
@@ -38,16 +37,15 @@ class LightBakedModel extends CraftingCubeBakedModel {
|
||||
|
||||
private final Sprite lightTexture;
|
||||
|
||||
LightBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer,
|
||||
Sprite baseTexture, Sprite lightTexture) {
|
||||
LightBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer, Sprite baseTexture, Sprite lightTexture) {
|
||||
super(ringCorner, ringHor, ringVer);
|
||||
this.baseTexture = baseTexture;
|
||||
this.lightTexture = lightTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder, float x1,
|
||||
float y1, float z1, float x2, float y2, float z2) {
|
||||
protected void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData,
|
||||
CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2) {
|
||||
builder.setTexture(this.baseTexture);
|
||||
builder.addCube(x1, y1, z1, x2, y2, z2);
|
||||
|
||||
|
||||
@@ -18,15 +18,14 @@
|
||||
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
import appeng.tile.crafting.CraftingCubeModelData;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.block.crafting.CraftingMonitorBlock;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.tile.crafting.CraftingCubeModelData;
|
||||
import appeng.tile.crafting.CraftingMonitorModelData;
|
||||
|
||||
/**
|
||||
@@ -48,9 +47,8 @@ public class MonitorBakedModel extends CraftingCubeBakedModel {
|
||||
|
||||
private final Sprite lightBrightTexture;
|
||||
|
||||
MonitorBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer,
|
||||
Sprite chassisTexture, Sprite baseTexture, Sprite lightDarkTexture,
|
||||
Sprite lightMediumTexture, Sprite lightBrightTexture) {
|
||||
MonitorBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer, Sprite chassisTexture, Sprite baseTexture,
|
||||
Sprite lightDarkTexture, Sprite lightMediumTexture, Sprite lightBrightTexture) {
|
||||
super(ringCorner, ringHor, ringVer);
|
||||
this.chassisTexture = chassisTexture;
|
||||
this.baseTexture = baseTexture;
|
||||
@@ -60,8 +58,8 @@ public class MonitorBakedModel extends CraftingCubeBakedModel {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addInnerCube(Direction side, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder, float x1,
|
||||
float y1, float z1, float x2, float y2, float z2) {
|
||||
protected void addInnerCube(Direction side, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder,
|
||||
float x1, float y1, float z1, float x2, float y2, float z2) {
|
||||
Direction forward = modelData.getForward();
|
||||
|
||||
// For sides other than the front, use the chassis texture
|
||||
|
||||
@@ -18,13 +18,12 @@
|
||||
|
||||
package appeng.client.render.crafting;
|
||||
|
||||
import appeng.tile.crafting.CraftingCubeModelData;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import appeng.tile.crafting.CraftingCubeModelData;
|
||||
|
||||
/**
|
||||
* A simple crafting unit model that uses an un-lit texture for the inner block.
|
||||
@@ -33,15 +32,14 @@ class UnitBakedModel extends CraftingCubeBakedModel {
|
||||
|
||||
private final Sprite unitTexture;
|
||||
|
||||
UnitBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer,
|
||||
Sprite unitTexture) {
|
||||
UnitBakedModel(Sprite ringCorner, Sprite ringHor, Sprite ringVer, Sprite unitTexture) {
|
||||
super(ringCorner, ringHor, ringVer);
|
||||
this.unitTexture = unitTexture;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData, CubeBuilder builder, float x1,
|
||||
float y1, float z1, float x2, float y2, float z2) {
|
||||
protected void addInnerCube(Direction facing, BlockState state, CraftingCubeModelData modelData,
|
||||
CubeBuilder builder, float x1, float y1, float z1, float x2, float y2, float z2) {
|
||||
builder.setTexture(this.unitTexture);
|
||||
builder.addCube(x1, y1, z1, x2, y2, z2);
|
||||
}
|
||||
|
||||
@@ -18,15 +18,15 @@
|
||||
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.particle.ParticleFactory;
|
||||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleFactory;
|
||||
import net.minecraft.client.particle.RedDustParticle;
|
||||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.particle.DustParticleEffect;
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class ChargedOreFX extends RedDustParticle {
|
||||
@@ -59,7 +59,7 @@ public class ChargedOreFX extends RedDustParticle {
|
||||
|
||||
@Override
|
||||
public Particle createParticle(DefaultParticleType effect, ClientWorld world, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new ChargedOreFX(world, x, y, z, xSpeed, ySpeed, zSpeed, this.spriteSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,18 +18,17 @@
|
||||
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class CraftingFx extends SpriteBillboardParticle {
|
||||
@@ -40,8 +39,7 @@ public class CraftingFx extends SpriteBillboardParticle {
|
||||
private final float offsetY;
|
||||
private final float offsetZ;
|
||||
|
||||
public CraftingFx(ClientWorld world, final double x, final double y, final double z,
|
||||
final SpriteProvider sprite) {
|
||||
public CraftingFx(ClientWorld world, final double x, final double y, final double z, final SpriteProvider sprite) {
|
||||
super(world, x, y, z);
|
||||
|
||||
// Pick a random normal, offset it by 0.35 and use that as the particle origin
|
||||
@@ -61,8 +59,6 @@ public class CraftingFx extends SpriteBillboardParticle {
|
||||
this.collidesWithWorld = false; // we're INSIDE the block anyway
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void buildGeometry(VertexConsumer buffer, Camera camera, float partialTicks) {
|
||||
|
||||
@@ -133,8 +129,8 @@ public class CraftingFx extends SpriteBillboardParticle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(DefaultParticleType effect, ClientWorld world, double x, double y, double z, double xSpeed,
|
||||
double ySpeed, double zSpeed) {
|
||||
public Particle createParticle(DefaultParticleType effect, ClientWorld world, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new CraftingFx(world, x, y, z, spriteSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,11 @@
|
||||
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
@@ -106,7 +105,7 @@ public class EnergyFx extends SpriteBillboardParticle {
|
||||
|
||||
@Override
|
||||
public Particle createParticle(EnergyParticleData effect, ClientWorld world, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
EnergyFx result = new EnergyFx(world, x, y, z, spriteSet);
|
||||
result.setVelocityX((float) xSpeed);
|
||||
result.setVelocityY((float) ySpeed);
|
||||
|
||||
@@ -20,14 +20,14 @@ package appeng.client.render.effects;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.particle.ParticleFactory;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.particle.ParticleFactory;
|
||||
import net.minecraft.client.particle.SpriteBillboardParticle;
|
||||
import net.minecraft.client.particle.SpriteProvider;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.world.World;
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class LightningArcFX extends LightningFX {
|
||||
@@ -77,7 +77,7 @@ public class LightningArcFX extends LightningFX {
|
||||
|
||||
@Override
|
||||
public Particle createParticle(LightningArcParticleData effect, ClientWorld world, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
SpriteBillboardParticle lightningFX = new LightningArcFX(world, x, y, z, effect.target.x, effect.target.y,
|
||||
effect.target.z, 0, 0, 0);
|
||||
lightningFX.setSprite(this.spriteSet);
|
||||
|
||||
@@ -24,8 +24,8 @@ public class LightningArcParticleData implements ParticleEffect {
|
||||
|
||||
public static final Factory<LightningArcParticleData> DESERIALIZER = new Factory<LightningArcParticleData>() {
|
||||
@Override
|
||||
public LightningArcParticleData read(ParticleType<LightningArcParticleData> particleTypeIn,
|
||||
StringReader reader) throws CommandSyntaxException {
|
||||
public LightningArcParticleData read(ParticleType<LightningArcParticleData> particleTypeIn, StringReader reader)
|
||||
throws CommandSyntaxException {
|
||||
reader.expect(' ');
|
||||
float x = reader.readFloat();
|
||||
reader.expect(' ');
|
||||
|
||||
@@ -20,14 +20,13 @@ package appeng.client.render.effects;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.particle.ParticleTextureSheet;
|
||||
import net.minecraft.client.render.Camera;
|
||||
import net.minecraft.client.render.VertexConsumer;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
@@ -46,14 +45,14 @@ public class LightningFX extends SpriteBillboardParticle {
|
||||
private final double[] verticesWithUV = new double[3];
|
||||
private boolean hasData = false;
|
||||
|
||||
private LightningFX(ClientWorld world, final double x, final double y, final double z, final double r, final double g,
|
||||
final double b) {
|
||||
private LightningFX(ClientWorld world, final double x, final double y, final double z, final double r,
|
||||
final double g, final double b) {
|
||||
this(world, x, y, z, r, g, b, 6);
|
||||
this.regen();
|
||||
}
|
||||
|
||||
protected LightningFX(ClientWorld world, final double x, final double y, final double z, final double r, final double g,
|
||||
final double b, final int maxAge) {
|
||||
protected LightningFX(ClientWorld world, final double x, final double y, final double z, final double r,
|
||||
final double g, final double b, final int maxAge) {
|
||||
super(world, x, y, z, r, g, b);
|
||||
this.precomputedSteps = new double[LightningFX.STEPS][3];
|
||||
this.velocityX = 0;
|
||||
@@ -219,7 +218,7 @@ public class LightningFX extends SpriteBillboardParticle {
|
||||
}
|
||||
|
||||
private void draw(float red, float green, float blue, final VertexConsumer tess, final double[] a, final double[] b,
|
||||
final float u, final float v) {
|
||||
final float u, final float v) {
|
||||
if (this.hasData) {
|
||||
tess.vertex(a[0], a[1], a[2]).texture(u, v).color(red, green, blue, this.colorAlpha)
|
||||
.light(BRIGHTNESS, BRIGHTNESS).next();
|
||||
@@ -251,7 +250,7 @@ public class LightningFX extends SpriteBillboardParticle {
|
||||
|
||||
@Override
|
||||
public Particle createParticle(DefaultParticleType type, ClientWorld world, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
LightningFX lightningFX = new LightningFX(world, x, y, z, xSpeed, ySpeed, zSpeed);
|
||||
lightningFX.setSprite(this.spriteSet);
|
||||
return lightningFX;
|
||||
|
||||
@@ -19,17 +19,16 @@
|
||||
package appeng.client.render.effects;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.particle.*;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import appeng.api.util.AEPartLocation;
|
||||
|
||||
public class MatterCannonFX extends SpriteBillboardParticle {
|
||||
|
||||
public MatterCannonFX(ClientWorld world, final double x, final double y, final double z,
|
||||
SpriteProvider sprite) {
|
||||
public MatterCannonFX(ClientWorld world, final double x, final double y, final double z, SpriteProvider sprite) {
|
||||
super(world, x, y, z);
|
||||
this.gravityStrength = 0;
|
||||
this.colorBlue = 1;
|
||||
@@ -81,8 +80,8 @@ public class MatterCannonFX extends SpriteBillboardParticle {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Particle createParticle(DefaultParticleType effect, ClientWorld world, double x, double y, double z, double xSpeed,
|
||||
double ySpeed, double zSpeed) {
|
||||
public Particle createParticle(DefaultParticleType effect, ClientWorld world, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new MatterCannonFX(world, x, y, z, spriteSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.particle.ParticleManager;
|
||||
import net.minecraft.particle.DefaultParticleType;
|
||||
import net.minecraft.particle.ParticleType;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
import appeng.core.AppEng;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
public final class ParticleTypes {
|
||||
|
||||
@@ -30,5 +30,4 @@ public final class ParticleTypes {
|
||||
public static void registerClient() {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ public class VibrantFX extends SpriteBillboardParticle {
|
||||
|
||||
@Override
|
||||
public Particle createParticle(DefaultParticleType effect, ClientWorld world, double x, double y, double z,
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
double xSpeed, double ySpeed, double zSpeed) {
|
||||
return new VibrantFX(world, x, y, z, xSpeed, ySpeed, zSpeed, spriteSet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.client.render.cablebus.QuadRotator;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
@@ -13,8 +15,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.client.render.cablebus.QuadRotator;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class AutoRotatingBakedModel extends ForwardingBakedModel implements FabricBakedModel {
|
||||
@@ -33,7 +34,8 @@ public class AutoRotatingBakedModel extends ForwardingBakedModel implements Fabr
|
||||
}
|
||||
|
||||
@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) {
|
||||
RenderContext.QuadTransform transform = getTransform(blockView, pos);
|
||||
|
||||
if (transform != null) {
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
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;
|
||||
@@ -18,10 +22,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.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.implementations.items.IBiometricCard;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
|
||||
class BiometricCardBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
@@ -40,7 +43,8 @@ class BiometricCardBakedModel 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) {
|
||||
// Not intended as a block
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -10,11 +15,8 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
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.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* Model wrapper for the biometric card item model, which combines a base card
|
||||
@@ -38,7 +40,8 @@ public class BiometricCardModel 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) {
|
||||
Sprite texture = textureGetter.apply(TEXTURE);
|
||||
|
||||
BakedModel baseModel = loader.bake(MODEL_BASE, rotationContainer);
|
||||
|
||||
@@ -7,22 +7,23 @@ import java.util.Random;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import appeng.mixins.BakedQuadAccessor;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.BakedQuad;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.util.math.Direction;
|
||||
|
||||
import appeng.mixins.BakedQuadAccessor;
|
||||
|
||||
/**
|
||||
* This baked model will take the generated item model for the colored color applicator,
|
||||
* and associate tint indices with the added layers that correspond to the light/medium/dark
|
||||
* variants of the {@link appeng.api.util.AEColor}.
|
||||
* This baked model will take the generated item model for the colored color
|
||||
* applicator, and associate tint indices with the added layers that correspond
|
||||
* to the light/medium/dark variants of the {@link appeng.api.util.AEColor}.
|
||||
* <p>
|
||||
* Using the color provider registered in {@link appeng.items.tools.powered.ColorApplicatorItemRendering},
|
||||
* this results in the right color being multiplied with the corresponding layer.
|
||||
* Using the color provider registered in
|
||||
* {@link appeng.items.tools.powered.ColorApplicatorItemRendering}, this results
|
||||
* in the right color being multiplied with the corresponding layer.
|
||||
*/
|
||||
class ColorApplicatorBakedModel extends ForwardingBakedModel {
|
||||
|
||||
@@ -30,8 +31,7 @@ class ColorApplicatorBakedModel extends ForwardingBakedModel {
|
||||
|
||||
private final List<BakedQuad> generalQuads;
|
||||
|
||||
ColorApplicatorBakedModel(BakedModel baseModel, Sprite texDark,
|
||||
Sprite texMedium, Sprite texBright) {
|
||||
ColorApplicatorBakedModel(BakedModel baseModel, Sprite texDark, Sprite texMedium, Sprite texBright) {
|
||||
this.wrapped = baseModel;
|
||||
|
||||
// Put the tint indices in... Since this is an item model, we are ignoring rand
|
||||
@@ -46,8 +46,7 @@ class ColorApplicatorBakedModel extends ForwardingBakedModel {
|
||||
return ((BakedQuadAccessor) quad).getSprite();
|
||||
}
|
||||
|
||||
private List<BakedQuad> fixQuadTint(Direction facing, Sprite texDark, Sprite texMedium,
|
||||
Sprite texBright) {
|
||||
private List<BakedQuad> fixQuadTint(Direction facing, Sprite texDark, Sprite texMedium, Sprite texBright) {
|
||||
List<BakedQuad> quads = this.wrapped.getQuads(null, facing, new Random(0));
|
||||
List<BakedQuad> result = new ArrayList<>(quads.size());
|
||||
for (BakedQuad quad : quads) {
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -10,11 +15,8 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
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.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* A color applicator uses the base model, and extends it with additional layers
|
||||
@@ -22,8 +24,7 @@ import java.util.stream.Stream;
|
||||
*/
|
||||
public class ColorApplicatorModel implements BasicUnbakedModel {
|
||||
|
||||
private static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID,
|
||||
"item/color_applicator_colored");
|
||||
private static final Identifier MODEL_BASE = new Identifier(AppEng.MOD_ID, "item/color_applicator_colored");
|
||||
|
||||
private static final SpriteIdentifier TEXTURE_DARK = new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX,
|
||||
new Identifier(AppEng.MOD_ID, "item/color_applicator_tip_dark"));
|
||||
@@ -44,7 +45,8 @@ public class ColorApplicatorModel 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 baseModel = loader.bake(MODEL_BASE, rotationContainer);
|
||||
|
||||
Sprite texDark = textureGetter.apply(TEXTURE_DARK);
|
||||
|
||||
@@ -18,7 +18,12 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.block.storage.DriveSlotsState;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.Renderer;
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
|
||||
@@ -40,11 +45,7 @@ import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.block.storage.DriveSlotsState;
|
||||
|
||||
public class DriveBakedModel extends ForwardingBakedModel implements FabricBakedModel {
|
||||
private final Map<Item, BakedModel> cellModels;
|
||||
@@ -77,7 +78,8 @@ public class DriveBakedModel extends ForwardingBakedModel implements FabricBaked
|
||||
}
|
||||
|
||||
@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) {
|
||||
|
||||
super.emitBlockQuads(blockView, state, pos, randomSupplier, context);
|
||||
|
||||
@@ -150,7 +152,8 @@ public class DriveBakedModel extends ForwardingBakedModel implements FabricBaked
|
||||
Vector3f translation = new Vector3f();
|
||||
getSlotOrigin(row, col, translation);
|
||||
|
||||
result[getSlotIndex(row, col)] = new QuadTranslator(translation.getX(), translation.getY(), translation.getZ());
|
||||
result[getSlotIndex(row, col)] = new QuadTranslator(translation.getX(), translation.getY(),
|
||||
translation.getZ());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,16 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.api.client.ICellModelRegistry;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.api.client.ApiCellModelRegistry;
|
||||
import java.util.Collection;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
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;
|
||||
@@ -32,23 +37,21 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
import appeng.api.client.ICellModelRegistry;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.Api;
|
||||
import appeng.core.api.client.ApiCellModelRegistry;
|
||||
|
||||
public class DriveModel implements BasicUnbakedModel {
|
||||
|
||||
private static final Identifier MODEL_BASE = new Identifier(
|
||||
"appliedenergistics2:block/drive/drive_base");
|
||||
private static final Identifier MODEL_BASE = new Identifier("appliedenergistics2:block/drive/drive_base");
|
||||
private static final Identifier MODEL_CELL_EMPTY = new Identifier(
|
||||
"appliedenergistics2:block/drive/drive_cell_empty");
|
||||
|
||||
@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) {
|
||||
final ICellModelRegistry cellRegistry = Api.instance().client().cells();
|
||||
final Map<Item, BakedModel> cellModels = new IdentityHashMap<>();
|
||||
|
||||
@@ -68,11 +71,8 @@ public class DriveModel implements BasicUnbakedModel {
|
||||
@Override
|
||||
public Collection<Identifier> getModelDependencies() {
|
||||
ICellModelRegistry cells = Api.instance().client().cells();
|
||||
return ImmutableSet.<Identifier>builder()
|
||||
.add(cells.getDefaultModel())
|
||||
.addAll(ApiCellModelRegistry.getModels())
|
||||
.addAll(cells.models().values())
|
||||
.build();
|
||||
return ImmutableSet.<Identifier>builder().add(cells.getDefaultModel()).addAll(ApiCellModelRegistry.getModels())
|
||||
.addAll(cells.models().values()).build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,19 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.decorative.solid.GlassState;
|
||||
import appeng.decorative.solid.QuartzGlassBlock;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.RendererAccess;
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
||||
import net.fabricmc.fabric.api.renderer.v1.material.RenderMaterial;
|
||||
@@ -44,15 +54,8 @@ import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.BlockRenderView;
|
||||
import net.minecraft.world.BlockView;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.IntStream;
|
||||
import appeng.decorative.solid.GlassState;
|
||||
import appeng.decorative.solid.QuartzGlassBlock;
|
||||
|
||||
class GlassBakedModel implements BakedModel, FabricBakedModel {
|
||||
|
||||
@@ -71,17 +74,15 @@ class GlassBakedModel implements BakedModel, FabricBakedModel {
|
||||
// Frame texture
|
||||
static final SpriteIdentifier[] TEXTURES_FRAME = generateTexturesFrame();
|
||||
private final RenderMaterial material = RendererAccess.INSTANCE.getRenderer().materialFinder()
|
||||
.disableDiffuse(0, true)
|
||||
.disableAo(0, true)
|
||||
.disableColorIndex(0, true)
|
||||
.blendMode(0, BlendMode.TRANSLUCENT)
|
||||
.disableDiffuse(0, true).disableAo(0, true).disableColorIndex(0, true).blendMode(0, BlendMode.TRANSLUCENT)
|
||||
.find();
|
||||
|
||||
// Generates the required textures for the frame
|
||||
private static SpriteIdentifier[] generateTexturesFrame() {
|
||||
return IntStream.range(1, 16).mapToObj(Integer::toBinaryString).map(s -> Strings.padStart(s, 4, '0'))
|
||||
.map(s -> new Identifier("appliedenergistics2:block/glass/quartz_glass_frame" + s))
|
||||
.map(rl -> new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, rl)).toArray(SpriteIdentifier[]::new);
|
||||
.map(rl -> new SpriteIdentifier(SpriteAtlasTexture.BLOCK_ATLAS_TEX, rl))
|
||||
.toArray(SpriteIdentifier[]::new);
|
||||
}
|
||||
|
||||
private final Sprite[] glassTextures;
|
||||
@@ -89,9 +90,8 @@ class GlassBakedModel implements BakedModel, FabricBakedModel {
|
||||
private final Sprite[] frameTextures;
|
||||
|
||||
public GlassBakedModel(Function<SpriteIdentifier, Sprite> bakedTextureGetter) {
|
||||
this.glassTextures = new Sprite[] { bakedTextureGetter.apply(TEXTURE_A),
|
||||
bakedTextureGetter.apply(TEXTURE_B), bakedTextureGetter.apply(TEXTURE_C),
|
||||
bakedTextureGetter.apply(TEXTURE_D) };
|
||||
this.glassTextures = new Sprite[] { bakedTextureGetter.apply(TEXTURE_A), bakedTextureGetter.apply(TEXTURE_B),
|
||||
bakedTextureGetter.apply(TEXTURE_C), bakedTextureGetter.apply(TEXTURE_D) };
|
||||
|
||||
// The first frame texture would be empty, so we simply leave it set to null
|
||||
// here
|
||||
@@ -107,7 +107,8 @@ class GlassBakedModel 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) {
|
||||
final GlassState glassState = getGlassState(blockView, pos);
|
||||
|
||||
// TODO: This could just use the Random instance we're given...
|
||||
@@ -217,13 +218,13 @@ class GlassBakedModel implements BakedModel, FabricBakedModel {
|
||||
}
|
||||
|
||||
private void emitQuad(QuadEmitter emitter, Direction side, List<Vector3f> corners, Sprite sprite, float uOffset,
|
||||
float vOffset) {
|
||||
float vOffset) {
|
||||
this.emitQuad(emitter, side, corners.get(0), corners.get(1), corners.get(2), corners.get(3), sprite, uOffset,
|
||||
vOffset);
|
||||
}
|
||||
|
||||
private void emitQuad(QuadEmitter emitter, Direction side, Vector3f c1, Vector3f c2, Vector3f c3, Vector3f c4, Sprite sprite,
|
||||
float uOffset, float vOffset) {
|
||||
private void emitQuad(QuadEmitter emitter, Direction side, Vector3f c1, Vector3f c2, Vector3f c3, Vector3f c4,
|
||||
Sprite sprite, float uOffset, float vOffset) {
|
||||
|
||||
// Apply the u,v shift.
|
||||
// This mirrors the logic from OffsetIcon from 1.7
|
||||
|
||||
@@ -18,8 +18,13 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
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;
|
||||
@@ -27,9 +32,7 @@ import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.client.util.SpriteIdentifier;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
|
||||
/**
|
||||
* Model class for the connected texture glass model.
|
||||
@@ -38,7 +41,8 @@ public class GlassModel 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) {
|
||||
return new GlassBakedModel(textureGetter);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.ForwardingBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
@@ -10,8 +10,9 @@ import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.texture.Sprite;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
import appeng.api.implementations.items.IMemoryCard;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.client.render.cablebus.CubeBuilder;
|
||||
|
||||
class MemoryCardBakedModel extends ForwardingBakedModel implements FabricBakedModel {
|
||||
private static final AEColor[] DEFAULT_COLOR_CODE = new AEColor[] { AEColor.TRANSPARENT, AEColor.TRANSPARENT,
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.render.model.BakedModel;
|
||||
import net.minecraft.client.render.model.ModelBakeSettings;
|
||||
import net.minecraft.client.render.model.ModelLoader;
|
||||
@@ -10,11 +15,8 @@ import net.minecraft.client.texture.SpriteAtlasTexture;
|
||||
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.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
import appeng.client.render.BasicUnbakedModel;
|
||||
import appeng.core.AppEng;
|
||||
|
||||
/**
|
||||
* Model wrapper for the memory card item model, which combines a base card
|
||||
@@ -33,7 +35,8 @@ public class MemoryCardModel 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) {
|
||||
Sprite texture = textureGetter.apply(TEXTURE);
|
||||
|
||||
BakedModel baseModel = loader.bake(MODEL_BASE, rotationContainer);
|
||||
|
||||
@@ -18,8 +18,13 @@
|
||||
|
||||
package appeng.client.render.model;
|
||||
|
||||
import appeng.hooks.CompassManager;
|
||||
import appeng.hooks.CompassResult;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.fabricmc.fabric.api.renderer.v1.model.FabricBakedModel;
|
||||
import net.fabricmc.fabric.api.renderer.v1.render.RenderContext;
|
||||
import net.minecraft.block.BlockState;
|
||||
@@ -39,11 +44,8 @@ import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.Quaternion;
|
||||
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.Supplier;
|
||||
import appeng.hooks.CompassManager;
|
||||
import appeng.hooks.CompassResult;
|
||||
|
||||
/**
|
||||
* This baked model combines the quads of a compass base and the quads of a
|
||||
@@ -79,7 +81,8 @@ public class SkyCompassBakedModel 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) {
|
||||
// Pre-compute the quad count to avoid list resizes
|
||||
context.fallbackConsumer().accept(this.base);
|
||||
}
|
||||
@@ -88,7 +91,8 @@ public class SkyCompassBakedModel implements BakedModel, FabricBakedModel {
|
||||
public void emitItemQuads(ItemStack stack, Supplier<Random> randomSupplier, RenderContext context) {
|
||||
context.fallbackConsumer().accept(base);
|
||||
|
||||
// This is used to render a compass pointing in a specific direction when being held in hand
|
||||
// This is used to render a compass pointing in a specific direction when being
|
||||
// held in hand
|
||||
// Set up the rotation around the Y-axis for the pointer
|
||||
context.pushTransform(quad -> {
|
||||
Quaternion quaternion = new Quaternion(0, this.fallbackRotation, 0, false);
|
||||
@@ -151,7 +155,7 @@ public class SkyCompassBakedModel implements BakedModel, FabricBakedModel {
|
||||
return new ModelOverrideList(null, null, null, Collections.emptyList()) {
|
||||
@Override
|
||||
public BakedModel apply(BakedModel originalModel, ItemStack stack, @Nullable ClientWorld world,
|
||||
@Nullable LivingEntity entity) {
|
||||
@Nullable LivingEntity entity) {
|
||||
// FIXME: This check prevents compasses being held by OTHERS from getting the
|
||||
// rotation, BUT do we actually still need this???
|
||||
if (world != null && entity instanceof ClientPlayerEntity) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user