Compare commits

..

24 Commits

Author SHA1 Message Date
shartte 73ffbc5e70 Fixes #4704: QNB is not finding a registered QNB because it believes the chunk to be unloaded. (#4709)
Also adds debug logging to the locatable registry to better debug this issues in the future.
2020-09-09 15:07:00 +02:00
shartte c8e24a4052 Fixes #4661: Do not update a tile entity when it's in an unloaded chunk (i.e. during chunk unloading) (#4708) (#4710) 2020-09-09 14:59:25 +02:00
shartte d6cbfe2e31 Fixes #4683: Hopefully LazyOptional works as advertised (#4684) (#4695)
Co-authored-by: yueh <yueh@users.noreply.github.com>
2020-09-05 18:02:05 +02:00
shartte 3b61d126a7 Moving the model-loader registration also moved API initialization, which in turn means the creative tab needs to be initialized earlier. (#4682) 2020-09-05 15:58:55 +02:00
shartte 28c458fb61 Backport fixes for #4675 and #4665 to 1.15 (#4676)
* Serialize the complete NBT data to avoid mismatches (#4665)

This might increase the network traffic a bit, but the amount of mods actually using the share tag seems to be very limited.
For now it is worth the risk as it solves the problem. In case we run into actual issues, there might still be other solutions, which will be way more complex and can potentially introduce additional problems.

(cherry picked from commit e90dd2f9c6)
(cherry picked from commit ab393b0ed1)

* Fixes #4669: Take NBT into account for comparing. (#4675)

This only covers combining different items together.
Fuzzy filtering is still a bit too fuzzy for corner cases.

Co-authored-by: yueh <yueh@users.noreply.github.com>
2020-09-01 22:48:07 +02:00
shartte a212448a4e Avoid CMEs when two chunks render concurrently and (#4668)
access the same map.
2020-09-01 17:35:33 +02:00
shartte c204e9d9f7 Fix facades not updating cached bounds (#4667)
* Move model loader registration to the mod constructor because forge runs the model registry event concurrently, apparently.

* Do not register the loaders during data generation.

* Fixes removal of facades not invalidating the cached server-side collision boxes. (#4663)

(cherry picked from commit 957bc4c5cc)
2020-09-01 17:27:16 +02:00
shartte 2dcf045e73 Another ModelLoader registration fix (#4660)
* Move model loader registration to the mod constructor because forge runs the model registry event concurrently, apparently.

* Do not register the loaders during data generation.
2020-08-31 23:10:11 +02:00
shartte 0632925653 Remove the use of SlotItemHandler since we are only faking an inventory-backed slot, (#4654)
we might as well use what we had used pre-2017, which is simply extending a normal Slot.
This should also fix #4652.
2020-08-29 21:50:06 +02:00
shartte 98b758e6f9 Fixes #4648: Inverted logic for the annihilation plane dropping no items. (#4649) 2020-08-28 16:28:34 +02:00
shartte faa00cd894 Backport Model Registration Changes (#4647)
* Fix Special Model Registration (#4577)

* Fixes #4575 by updating Forge (ModelRegistryEvent is a modbus event but was misflagged as not being one). And update Forge because their breaking change breaks our mod.

* Update gradle.properties

Co-authored-by: yueh <yueh@users.noreply.github.com>

* Update src/main/resources/META-INF/mods.toml

Co-authored-by: yueh <yueh@users.noreply.github.com>

Co-authored-by: yueh <yueh@users.noreply.github.com>

(cherry picked from commit 8733c2c11f)

* Strip pom.xml dependencies.

(cherry picked from commit 00d4c20d9f)
2020-08-28 15:57:47 +02:00
shartte 544491064d Fixes #4635: Actually remove requesters when removing requesters. (#4637) 2020-08-24 19:23:48 +02:00
shartte e533ae5f3f Added step to publish to modmaven (#4607) (#4630)
(cherry picked from commit 7e1bfdb5ac)

Co-authored-by: yueh <yueh@users.noreply.github.com>
2020-08-23 22:30:34 +02:00
shartte 98733844a6 Fixes #4602: Prevent encoding invalid patterns and handle corrupted patterns a little more gracefully. (#4608) (#4629)
(cherry picked from commit 1f9707e256)
2020-08-21 19:24:47 +02:00
shartte ef97381e5f Fixes #4574 by referencing only non-pure fluix crystals in the fluix dust grinder recipe. (#4579) 2020-08-09 12:28:43 +02:00
shartte 27b8c5f3ac Plane Connection Refactor (#4556) (#4565)
* Refactors all plane parts to use a common helper for
calculating connections to adjacent planes.
Also fixes problems with updating these connections on neighbor updates.

* Fix conflicting GuiSync ID.

* Slightly refactor PlaneConnectionHelper, and fix an issue where the bounding box was calculated incorrectly by using the wrong up-direction.

(cherry picked from commit 8617dc8340)
2020-08-05 22:39:04 +02:00
shartte 3043887915 Makes formation planes a bit more consistent and less violent. (#4553) (#4564)
* Makes formation planes a bit more consistent and less violent.

Items will now have a slower speed when spawning as well as a narrower area to avoid having them glitch into a wall and be teleported around

* Removed debug output, added clarifying parenthesis and extracted method.

* Fixes various other issues with the formation plane

Also removed now useless code

(cherry picked from commit 12e3fa9127)
2020-08-05 22:25:48 +02:00
yueh e0abe9b9a9 Fixes #4559: Use visual bounding box for overlay (#4562) 2020-08-05 22:08:48 +02:00
shartte e19991f1f9 Fixes #4547: Name clash between ITooltip#getWidth, ITooltip#getHeight and Vanilla Widget methods leads to missing methods at runtime, since the implementing methods will be remapped to SRG names, while referees of the interface will try to call the renamed methods by their name in the interface, leading to an AbstractMethodError. (#4558) 2020-08-05 18:21:13 +02:00
shartte 3d97b1e3ec Fixes #4551: Bounding box of annihilation planes is too small. (#4552) 2020-08-05 17:45:53 +02:00
yueh 6b1bccffb9 Apply the FE tunnel behaviour to the fluid tunnel (#4550) (#4555) 2020-08-04 23:37:15 +02:00
yueh 6fab7b91b7 Fixes 4529: Updated IPart to match new ICapabilityProvider (#4534) (#4536) 2020-08-01 21:57:26 +02:00
shartte 7b6bab4967 Fix #4521: Register RecipeTypes. (#4523) (#4525) 2020-07-31 20:34:44 +02:00
yueh 04766e5325 Limit gradle to 1 worker for 1.15 (#4526) 2020-07-31 18:51:41 +02:00
347 changed files with 2720 additions and 2922 deletions
+3 -1
View File
@@ -26,7 +26,9 @@ jobs:
- name: Validate no assets
run: test ! -d ./src/generated
- name: Generate assets
run: ./gradlew runData --no-daemon --max-workers 1
uses: GabrielBB/xvfb-action@v1.2
with:
run: ./gradlew runData --no-daemon --max-workers 1
- name: Validate assets
run: test -d ./src/generated -a -f ./src/generated/resources/.cache/cache
- name: Build with Gradle
+3 -1
View File
@@ -26,7 +26,9 @@ jobs:
- name: Validate no assets
run: test ! -d ./src/generated
- name: Generate assets
run: ./gradlew runData --no-daemon --max-workers 1
uses: GabrielBB/xvfb-action@v1.2
with:
run: ./gradlew runData --no-daemon --max-workers 1
- name: Validate assets
run: test -d ./src/generated -a -f ./src/generated/resources/.cache/cache
- name: Build with Gradle
+3 -1
View File
@@ -26,7 +26,9 @@ jobs:
- name: Validate no assets
run: test ! -d ./src/generated
- name: Generate assets
run: ./gradlew runData --no-daemon --max-workers 1
uses: GabrielBB/xvfb-action@v1.2
with:
run: ./gradlew runData --no-daemon --max-workers 1
- name: Validate assets
run: test -d ./src/generated -a -f ./src/generated/resources/.cache/cache
- name: Build with Gradle
+12 -2
View File
@@ -31,7 +31,9 @@ jobs:
- name: Validate no assets
run: test ! -d ./src/generated
- name: Generate assets
run: ./gradlew runData --no-daemon --max-workers 1
uses: GabrielBB/xvfb-action@v1.2
with:
run: ./gradlew runData --no-daemon --max-workers 1
- name: Validate assets
run: test -d ./src/generated -a -f ./src/generated/resources/.cache/cache
- name: Build with Gradle
@@ -55,7 +57,15 @@ jobs:
KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }}
KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publish --no-daemon --max-workers 1
run: ./gradlew publishMavenPublicationToGitHubPackagesRepository --no-daemon --max-workers 1
- name: Publish to modmaven
env:
KEY_STORE_PASS: ${{ secrets.KEY_STORE_PASS }}
KEY_STORE_ALIAS: ${{ secrets.KEY_STORE_ALIAS }}
KEY_STORE_KEY_PASS: ${{ secrets.KEY_STORE_KEY_PASS }}
MODMAVEN_USER: ${{ secrets.MODMAVEN_USER }}
MODMAVEN_PASSWORD: ${{ secrets.MODMAVEN_PASSWORD }}
run: ./gradlew publishMavenPublicationToModmavenRepository --no-daemon --max-workers 1
- name: Prepare artifact metadata
id: prepare_artifact_metadata
run: |
+15 -16
View File
@@ -19,13 +19,11 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://repo.spongepowered.org/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
@@ -38,7 +36,6 @@ plugins {
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'org.spongepowered.mixin'
apply plugin: "eclipse"
repositories {
@@ -115,7 +112,6 @@ minecraft {
client {
property 'forge.logging.console.level', 'debug'
workingDirectory project.file('run')
property "mixin.debug.export", "true"
mods {
appliedenergistics2 {
source sourceSets.main
@@ -147,18 +143,6 @@ minecraft {
}
}
mixin {
add sourceSets.main, "appliedenergistics2.mixins.refmap.json"
}
jar {
manifest {
attributes([
"MixinConfigs": "appliedenergistics2.mixins.json"
])
}
}
def signProps = [:]
if (System.getenv("KEY_STORE_FILE")) {
signProps['keyStore'] = System.getenv("KEY_STORE_FILE")
@@ -190,6 +174,13 @@ publishing {
groupId = project.group
artifactId = project.archivesBaseName
version = project.version
// ForgeGradle will generate wild dependency definitions, see https://github.com/MinecraftForge/ForgeGradle/issues/584
// Since we don't actually depend on anything, just remove the entire node.
pom.withXml {
asNode().remove(asNode().dependencies)
}
from components.java
artifact sourcesJar
artifact javadocJar
@@ -205,5 +196,13 @@ publishing {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/AppliedEnergistics/Applied-Energistics-2"
}
maven {
credentials {
username System.getenv("MODMAVEN_USER")
password System.getenv("MODMAVEN_PASSWORD")
}
name = "modmaven"
url = "https://modmaven.k-4u.nl/artifactory/local-releases/"
}
}
}
+8 -8
View File
@@ -8,24 +8,24 @@ artifact_basename=appliedenergistics2
#########################################################
# Minecraft Versions #
#########################################################
minecraft_release=1.16
minecraft_version=1.16.1
mcp_mappings=20200723-1.16.1
forge_version=32.0.93
minecraft_release=1.15
minecraft_version=1.15.2
mcp_mappings=20200715-1.15.1
forge_version=31.2.31
#########################################################
# Provided APIs #
#########################################################
jei_version=7.0.0.6
top_version=3.0.1-beta-4
jei_version=6.0.2.12
top_version=2.0.4-5
hwyla_version=1.10.8-B72_1.15.2
ctm_version=MC1.15.2-1.1.0.9
#########################################################
# Deployment #
#########################################################
website_version=1.16.1
curse_versions=1.16.1
website_version=1.15.2
curse_versions=1.15.2
curseforge_project=223794
#########################################################
+1 -1
View File
@@ -35,7 +35,7 @@ dependencies {
// Runtime, Mods
runtimeOnly fg.deobf("mezz.jei:jei-${minecraft_version}:${jei_version}")
runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}")
//runtimeOnly fg.deobf("team.chisel.ctm:CTM:${ctm_version}")
runtimeOnly fg.deobf("team.chisel.ctm:CTM:${ctm_version}")
// unit test dependencies
testCompile "junit:junit:4.13"
+1 -1
View File
@@ -119,7 +119,7 @@ public enum Upgrades {
if (namesAdded.add(name)) {
// append the supported count only if its > 1
if (supported.maxCount > 1) {
name = name.deepCopy().appendString(" (" + supported.maxCount + ")");
name = name.deepCopy().appendText(" (" + supported.maxCount + ")");
}
supportedTooltipLines.add(name);
}
@@ -53,6 +53,8 @@ public interface ICraftingHelper {
* @param stack If null, a new item will be created to hold the encoded pattern.
* Otherwise the given item must already contains an encoded
* pattern that will be overwritten.
* @throws IllegalArgumentException If either in or out contain only empty
* ItemStacks.
* @return A new encoded pattern, or the given stack with the pattern encoded in
* it.
*/
@@ -73,6 +75,8 @@ public interface ICraftingHelper {
* operation by the ME system.
* @param allowSubstitutes Controls whether the ME system will allow the use of
* equivalent items to craft this recipe.
* @throws IllegalArgumentException If either in or out contain only empty
* ItemStacks.
*/
ItemStack encodeCraftingPattern(@Nullable ItemStack stack, ICraftingRecipe recipe, ItemStack[] in, ItemStack out,
boolean allowSubstitutes);
@@ -24,15 +24,18 @@
package appeng.api.features;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.IWorld;
import net.minecraft.world.dimension.Dimension;
public interface IWorldGen {
void disableWorldGenForProviderID(WorldGenType type, Class<? extends Dimension> provider);
void enableWorldGenForDimension(WorldGenType type, ResourceLocation dimID);
void disableWorldGenForDimension(WorldGenType type, ResourceLocation dimID);
boolean isWorldGenEnabled(WorldGenType type, ServerWorld w);
boolean isWorldGenEnabled(WorldGenType type, IWorld w);
enum WorldGenType {
CERTUS_QUARTZ, CHARGED_CERTUS_QUARTZ, METEORITES
@@ -25,9 +25,8 @@ package appeng.api.implementations.items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.RegistryKey;
import net.minecraft.world.World;
import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.dimension.DimensionType;
import appeng.api.implementations.TransitionResult;
import appeng.api.util.WorldCoord;
@@ -58,7 +57,7 @@ public interface ISpatialStorageCell {
*
* @return dimension id or -1
*/
RegistryKey<World> getStoredDimension(ItemStack is);
DimensionType getStoredDimension(ItemStack is);
/**
* Perform a spatial swap with the contents of the cell, and the world.
@@ -71,5 +70,5 @@ public interface ISpatialStorageCell {
*
* @return result of transition
*/
TransitionResult doSpatialTransition(ItemStack is, ServerWorld w, WorldCoord min, WorldCoord max, int playerId);
TransitionResult doSpatialTransition(ItemStack is, World w, WorldCoord min, WorldCoord max, int playerId);
}
+5 -5
View File
@@ -42,7 +42,7 @@ import net.minecraft.network.PacketBuffer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -222,7 +222,7 @@ public interface IPart extends ICustomCableConnection {
*
* @return if your activate method performed something.
*/
boolean onActivate(PlayerEntity player, Hand hand, Vector3d pos);
boolean onActivate(PlayerEntity player, Hand hand, Vec3d pos);
/**
* Called when you right click the part, very similar to Block.onActivateBlock
@@ -234,7 +234,7 @@ public interface IPart extends ICustomCableConnection {
* @return if your activate method performed something, you should use false
* unless you really need it.
*/
boolean onShiftActivate(PlayerEntity player, Hand hand, Vector3d pos);
boolean onShiftActivate(PlayerEntity player, Hand hand, Vec3d pos);
/**
* Called when you left click the part, very similar to Block.onBlockClicked
@@ -246,7 +246,7 @@ public interface IPart extends ICustomCableConnection {
* @return if your activate method performed something, you should use false
* unless you really need it.
*/
default boolean onClicked(PlayerEntity player, Hand hand, Vector3d pos) {
default boolean onClicked(PlayerEntity player, Hand hand, Vec3d pos) {
return false;
}
@@ -261,7 +261,7 @@ public interface IPart extends ICustomCableConnection {
* @return if your activate method performed something, you should use false
* unless you really need it.
*/
default boolean onShiftClicked(PlayerEntity player, Hand hand, Vector3d pos) {
default boolean onShiftClicked(PlayerEntity player, Hand hand, Vec3d pos) {
return false;
}
+2 -2
View File
@@ -30,7 +30,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.Vec3d;
import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation;
@@ -146,7 +146,7 @@ public interface IPartHost extends ICustomCableConnection {
*
* @return a new SelectedPart, this is never null.
*/
SelectedPart selectPart(Vector3d pos);
SelectedPart selectPart(Vec3d pos);
/**
* can be used by parts to trigger the tile or part to save.
@@ -22,30 +22,29 @@ import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.util.RegistryKey;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.World;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.world.server.ServerWorld;
public interface ISpatialDimension {
ServerWorld getWorld(RegistryKey<World> cellDim);
ServerWorld getWorld(DimensionType cellDim);
@Nullable
RegistryKey<World> createNewCellDimension(BlockPos capacity);
DimensionType createNewCellDimension(BlockPos capacity);
void deleteCellDimension(RegistryKey<World> cellDim);
void deleteCellDimension(DimensionType cellDim);
boolean isCellDimension(RegistryKey<World> cellDim);
boolean isCellDimension(DimensionType cellDim);
BlockPos getCellDimensionOrigin(RegistryKey<World> cellDim);
BlockPos getCellDimensionOrigin(DimensionType cellDim);
BlockPos getCellDimensionSize(RegistryKey<World> cellDim);
BlockPos getCellDimensionSize(DimensionType cellDim);
/**
* Adds a user-facing tooltip that describes this dimension so that a player can
* keep storage cells apart.
*/
void addCellDimensionTooltip(RegistryKey<World> cellDim, List<ITextComponent> lines);
void addCellDimensionTooltip(DimensionType cellDim, List<ITextComponent> lines);
}
@@ -25,8 +25,8 @@ package appeng.api.util;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DimensionType;
import net.minecraft.world.IWorld;
import net.minecraft.world.dimension.Dimension;
/**
* Represents a location in the Minecraft Universe
@@ -34,7 +34,7 @@ import net.minecraft.world.IWorld;
public class DimensionalCoord extends WorldCoord {
private final IWorld world;
private final DimensionType dimension;
private final Dimension dimension;
public DimensionalCoord(final DimensionalCoord coordinate) {
super(coordinate.x, coordinate.y, coordinate.z);
@@ -45,19 +45,19 @@ public class DimensionalCoord extends WorldCoord {
public DimensionalCoord(final TileEntity tileEntity) {
super(tileEntity);
this.world = tileEntity.getWorld();
this.dimension = this.world.func_230315_m_();
this.dimension = this.world.getDimension();
}
public DimensionalCoord(final IWorld world, final int x, final int y, final int z) {
super(x, y, z);
this.world = world;
this.dimension = world.func_230315_m_();
this.dimension = world.getDimension();
}
public DimensionalCoord(final IWorld world, final BlockPos pos) {
super(pos);
this.world = world;
this.dimension = world.func_230315_m_();
this.dimension = world.getDimension();
}
@Override
@@ -23,7 +23,6 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.ResourceLocation;
@@ -45,6 +44,13 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
public AEBaseBlockItemChargeable(Block id, Properties props) {
super(id, props);
addPropertyOverride(new ResourceLocation("appliedenergistics2:fill_level"), (is, world, entity) -> {
double curPower = getAECurrentPower(is);
double maxPower = getAEMaxPower(is);
return (int) Math.round(100 * curPower / maxPower);
});
}
@Override
@@ -62,10 +68,10 @@ public class AEBaseBlockItemChargeable extends AEBaseBlockItem implements IAEIte
final double percent = internalCurrentPower / internalMaxPower;
lines.add(GuiText.StoredEnergy.text().deepCopy()
.appendString(':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower))
.append(new TranslationTextComponent(PowerUnits.AE.unlocalizedName))
.appendString(" - " + MessageFormat.format("{0,number,#.##%}", percent)));
lines.add(GuiText.StoredEnergy.textComponent()
.appendText(':' + MessageFormat.format(" {0,number,#} ", internalCurrentPower))
.appendSibling(new TranslationTextComponent(PowerUnits.AE.unlocalizedName))
.appendText(" - " + MessageFormat.format("{0,number,#.##%}", percent)));
}
}
@@ -31,21 +31,26 @@ import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.items.ItemHandlerHelper;
import appeng.api.implementations.items.IMemoryCard;
import appeng.api.implementations.items.MemoryCardMessages;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.util.AEColor;
import appeng.api.util.IOrientable;
import appeng.block.networking.CableBusBlock;
import appeng.tile.AEBaseInvTileEntity;
@@ -139,6 +144,26 @@ public abstract class AEBaseTileBlock<T extends AEBaseTileEntity> extends AEBase
super.onReplaced(state, w, pos, newState, isMoving);
}
@Override
public boolean recolorBlock(BlockState state, final IWorld world, final BlockPos pos, final Direction side,
final DyeColor color) {
final TileEntity te = this.getTileEntity(world, pos);
if (te instanceof IColorableTile) {
final IColorableTile ct = (IColorableTile) te;
final AEColor c = ct.getColor();
final AEColor newColor = AEColor.values()[color.ordinal()];
if (c != newColor) {
ct.recolourBlock(side, newColor, null);
return true;
}
return false;
}
return super.recolorBlock(state, world, pos, side, color);
}
@Override
public int getComparatorInputOverride(BlockState state, final World w, final BlockPos pos) {
final TileEntity te = this.getTileEntity(w, pos);
@@ -1,33 +0,0 @@
package appeng.block.crafting;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.bootstrap.BlockRenderingCustomizer;
import appeng.bootstrap.IBlockRendering;
import appeng.bootstrap.IItemRendering;
import appeng.client.render.crafting.MonitorBakedModel;
import appeng.client.render.model.AutoRotatingBakedModel;
public class CraftingMonitorBlockRendering extends BlockRenderingCustomizer {
@Override
@OnlyIn(Dist.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.renderType(RenderType.getCutout());
rendering.modelCustomizer(CraftingMonitorBlockRendering::customizeModel);
}
@OnlyIn(Dist.CLIENT)
private static IBakedModel customizeModel(ResourceLocation path, IBakedModel model) {
// The formed model handles rotations itself, the unformed one does not
if (model instanceof MonitorBakedModel) {
return model;
}
return new AutoRotatingBakedModel(model);
}
}
@@ -19,12 +19,20 @@
package appeng.block.misc;
import java.util.Random;
import java.util.function.Function;
import javax.annotation.Nullable;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResultType;
@@ -44,6 +52,8 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.util.AEAxisAlignedBB;
import appeng.block.AEBaseTileBlock;
import appeng.client.render.effects.ParticleTypes;
import appeng.client.render.renderable.ItemRenderable;
import appeng.client.render.tesr.ModularTESR;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.AppEng;
@@ -165,4 +175,15 @@ public class ChargerBlock extends AEBaseTileBlock<ChargerTileEntity> {
return VoxelShapes.create(new AxisAlignedBB(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
}
@OnlyIn(Dist.CLIENT)
public static Function<TileEntityRendererDispatcher, TileEntityRenderer<ChargerTileEntity>> createTesr() {
return dispatcher -> new ModularTESR<>(dispatcher, new ItemRenderable<>(ChargerBlock::getRenderedItem));
}
@OnlyIn(Dist.CLIENT)
private static Pair<ItemStack, TransformationMatrix> getRenderedItem(ChargerTileEntity tile) {
TransformationMatrix transform = new TransformationMatrix(new Vector3f(0.5f, 0.375f, 0.5f), null, null, null);
return new ImmutablePair<>(tile.getInternalInventory().getStackInSlot(0), transform);
}
}
@@ -80,8 +80,8 @@ public class QuartzFixtureBlock extends AEBaseBlock implements IOrientableBlock
public static final BooleanProperty ODD = BooleanProperty.create("odd");
public QuartzFixtureBlock() {
super(defaultProps(Material.MISCELLANEOUS).doesNotBlockMovement().hardnessAndResistance(0)
.setLightLevel((b) -> 14).sound(SoundType.GLASS).notSolid());
super(defaultProps(Material.MISCELLANEOUS).doesNotBlockMovement().hardnessAndResistance(0).lightValue(14)
.sound(SoundType.GLASS).notSolid());
this.setDefaultState(getDefaultState().with(FACING, Direction.UP).with(ODD, false));
}
@@ -118,10 +118,12 @@ public class TinyTNTBlock extends AEBaseBlock {
LivingEntity igniter = null;
// Check if the shooter still exists
if (w instanceof ServerWorld) {
Entity shooter = entityarrow.func_234616_v_();
ServerWorld serverWorld = (ServerWorld) w;
Entity shooter = serverWorld.getEntityByUuid(entityarrow.shootingEntity);
if (shooter instanceof LivingEntity) {
igniter = (LivingEntity) shooter;
}
}
this.startFuse(w, pos, igniter);
w.removeBlock(pos, false);
@@ -30,11 +30,10 @@ import net.minecraft.client.particle.Particle;
import net.minecraft.client.particle.ParticleManager;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.IFluidState;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.DyeColor;
import net.minecraft.item.ItemGroup;
@@ -48,11 +47,12 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
@@ -146,7 +146,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
@Override
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player,
boolean willHarvest, FluidState fluid) {
boolean willHarvest, IFluidState fluid) {
if (player.abilities.isCreativeMode) {
final AEBaseTileEntity tile = this.getTileEntity(world, pos);
if (tile != null) {
@@ -171,7 +171,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
@Override
public ItemStack getPickBlock(BlockState state, RayTraceResult target, IBlockReader world, BlockPos pos,
PlayerEntity player) {
final Vector3d v3 = target.getHitVec().subtract(pos.getX(), pos.getY(), pos.getZ());
final Vec3d v3 = target.getHitVec().subtract(pos.getX(), pos.getY(), pos.getZ());
final SelectedPart sp = this.cb(world, pos).selectPart(v3);
if (sp.part != null) {
@@ -222,8 +222,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
double z = target.getHitVec().z;
// FIXME: Check how this looks, probably like shit, maybe provide parts the
// ability to supply particle textures???
effectRenderer.addEffect(
new CableBusBreakingParticle((ClientWorld) world, x, y, z, texture).multiplyParticleScaleBy(0.8F));
effectRenderer
.addEffect(new CableBusBreakingParticle(world, x, y, z, texture).multiplyParticleScaleBy(0.8F));
}
return true;
@@ -264,8 +264,8 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
// FIXME: Check how this looks, probably like shit, maybe provide parts the
// ability to supply particle textures???
Particle effect = new CableBusBreakingParticle((ClientWorld) world, x, y, z,
x - pos.getX() - 0.5D, y - pos.getY() - 0.5D, z - pos.getZ() - 0.5D, texture);
Particle effect = new CableBusBreakingParticle(world, x, y, z, x - pos.getX() - 0.5D,
y - pos.getY() - 0.5D, z - pos.getZ() - 0.5D, texture);
effectRenderer.addEffect(effect);
}
}
@@ -313,7 +313,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
if (rtr instanceof BlockRayTraceResult) {
BlockRayTraceResult brtr = (BlockRayTraceResult) rtr;
if (brtr.getPos().equals(pos)) {
final Vector3d hitVec = rtr.getHitVec().subtract(new Vector3d(pos.getX(), pos.getY(), pos.getZ()));
final Vec3d hitVec = rtr.getHitVec().subtract(new Vec3d(pos));
if (this.cb(worldIn, pos).clicked(player, Hand.MAIN_HAND, hitVec)) {
NetworkHandler.instance().sendToServer(new ClickPacket(pos, brtr.getFace(), (float) hitVec.x,
@@ -324,7 +324,7 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
}
}
public void onBlockClickPacket(World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Vector3d hitVec) {
public void onBlockClickPacket(World worldIn, BlockPos pos, PlayerEntity playerIn, Hand hand, Vec3d hitVec) {
this.cb(worldIn, pos).clicked(playerIn, hand, hitVec);
}
@@ -332,11 +332,16 @@ public class CableBusBlock extends AEBaseTileBlock<CableBusTileEntity> implement
public ActionResultType onActivated(final World w, final BlockPos pos, final PlayerEntity player, final Hand hand,
final @Nullable ItemStack heldItem, final BlockRayTraceResult hit) {
// Transform from world into block space
Vector3d hitVec = hit.getHitVec();
Vector3d hitInBlock = new Vector3d(hitVec.x - pos.getX(), hitVec.y - pos.getY(), hitVec.z - pos.getZ());
Vec3d hitVec = hit.getHitVec();
Vec3d hitInBlock = new Vec3d(hitVec.x - pos.getX(), hitVec.y - pos.getY(), hitVec.z - pos.getZ());
return this.cb(w, pos).activate(player, hand, hitInBlock) ? ActionResultType.SUCCESS : ActionResultType.PASS;
}
@Override
public boolean recolorBlock(BlockState state, IWorld world, BlockPos pos, Direction side, DyeColor color) {
return recolorBlock(world, pos, side, color, null);
}
public boolean recolorBlock(final IBlockReader world, final BlockPos pos, final Direction side,
final DyeColor color, final PlayerEntity who) {
try {
@@ -24,7 +24,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.ILightReader;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -40,7 +40,7 @@ import appeng.tile.networking.CableBusTileEntity;
public class CableBusColor implements IBlockColor {
@Override
public int getColor(BlockState state, @Nullable IBlockDisplayReader worldIn, @Nullable BlockPos pos, int color) {
public int getColor(BlockState state, @Nullable ILightReader worldIn, @Nullable BlockPos pos, int color) {
AEColor busColor = AEColor.TRANSPARENT;
@@ -38,7 +38,7 @@ public class ControllerBlock extends AEBaseTileBlock<ControllerTileEntity> {
offline, online, conflicted;
@Override
public String getString() {
public String getName() {
return this.name();
}
@@ -54,7 +54,7 @@ public class ControllerBlock extends AEBaseTileBlock<ControllerTileEntity> {
block, column_x, column_y, column_z, inside_a, inside_b;
@Override
public String getString() {
public String getName() {
return this.name();
}
@@ -50,7 +50,7 @@ public class WirelessBlock extends AEBaseTileBlock<WirelessTileEntity> {
OFF, ON, HAS_CHANNEL;
@Override
public String getString() {
public String getName() {
return this.name().toLowerCase();
}
}
@@ -15,7 +15,7 @@ import com.google.common.collect.ImmutableList;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
@@ -35,16 +35,16 @@ import appeng.tile.misc.PaintSplotchesTileEntity;
*/
class PaintSplotchesBakedModel implements IDynamicBakedModel {
private static final RenderMaterial TEXTURE_PAINT1 = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_PAINT1 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "block/paint1"));
private static final RenderMaterial TEXTURE_PAINT2 = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_PAINT2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "block/paint2"));
private static final RenderMaterial TEXTURE_PAINT3 = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_PAINT3 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "block/paint3"));
private final TextureAtlasSprite[] textures;
PaintSplotchesBakedModel(Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter) {
PaintSplotchesBakedModel(Function<Material, TextureAtlasSprite> bakedTextureGetter) {
this.textures = new TextureAtlasSprite[] { bakedTextureGetter.apply(TEXTURE_PAINT1),
bakedTextureGetter.apply(TEXTURE_PAINT2), bakedTextureGetter.apply(TEXTURE_PAINT3) };
}
@@ -171,7 +171,7 @@ class PaintSplotchesBakedModel implements IDynamicBakedModel {
return false;
}
static List<RenderMaterial> getRequiredTextures() {
static List<Material> getRequiredTextures() {
return ImmutableList.of(TEXTURE_PAINT1, TEXTURE_PAINT2, TEXTURE_PAINT3);
}
}
@@ -11,8 +11,8 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
@@ -22,13 +22,13 @@ public class PaintSplotchesModel implements IModelGeometry<PaintSplotchesModel>
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery,
Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
ItemOverrideList overrides, ResourceLocation modelLocation) {
return new PaintSplotchesBakedModel(spriteGetter);
}
@Override
public Collection<RenderMaterial> getTextures(IModelConfiguration owner,
public Collection<Material> getTextures(IModelConfiguration owner,
Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return PaintSplotchesBakedModel.getRequiredTextures();
}
@@ -17,7 +17,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
@@ -32,18 +32,17 @@ import appeng.tile.qnb.QuantumBridgeTileEntity;
class QnbFormedBakedModel implements IDynamicBakedModel {
private static final RenderMaterial TEXTURE_LINK = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_LINK = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "block/quantum_link"));
private static final RenderMaterial TEXTURE_RING = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_RING = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "block/quantum_ring"));
private static final RenderMaterial TEXTURE_RING_LIGHT = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_RING_LIGHT = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "block/quantum_ring_light"));
private static final RenderMaterial TEXTURE_RING_LIGHT_CORNER = new RenderMaterial(
AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_RING_LIGHT_CORNER = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "block/quantum_ring_light_corner"));
private static final RenderMaterial TEXTURE_CABLE_GLASS = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_CABLE_GLASS = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "part/cable/glass/transparent"));
private static final RenderMaterial TEXTURE_COVERED_CABLE = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
private static final Material TEXTURE_COVERED_CABLE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, "part/cable/covered/transparent"));
private static final float DEFAULT_RENDER_MIN = 2.0f;
@@ -66,7 +65,7 @@ class QnbFormedBakedModel implements IDynamicBakedModel {
private final TextureAtlasSprite lightTexture;
private final TextureAtlasSprite lightCornerTexture;
public QnbFormedBakedModel(IBakedModel baseModel, Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter) {
public QnbFormedBakedModel(IBakedModel baseModel, Function<Material, TextureAtlasSprite> bakedTextureGetter) {
this.baseModel = baseModel;
this.linkTexture = bakedTextureGetter.apply(TEXTURE_LINK);
this.ringTexture = bakedTextureGetter.apply(TEXTURE_RING);
@@ -221,7 +220,7 @@ class QnbFormedBakedModel implements IDynamicBakedModel {
return this.baseModel.getOverrides();
}
public static List<RenderMaterial> getRequiredTextures() {
public static List<Material> getRequiredTextures() {
return ImmutableList.of(TEXTURE_LINK, TEXTURE_RING, TEXTURE_CABLE_GLASS, TEXTURE_COVERED_CABLE,
TEXTURE_RING_LIGHT, TEXTURE_RING_LIGHT_CORNER);
}
@@ -1,43 +1,41 @@
package appeng.block.qnb;
import java.util.Collection;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Stream;
import com.google.common.collect.ImmutableSet;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import appeng.client.render.BasicUnbakedModel;
import appeng.core.AppEng;
public class QnbFormedModel implements BasicUnbakedModel<QnbFormedModel> {
public class QnbFormedModel implements IModelGeometry<QnbFormedModel> {
private static final ResourceLocation MODEL_RING = new ResourceLocation(AppEng.MOD_ID, "block/qnb/ring");
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery,
Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
ItemOverrideList overrides, ResourceLocation modelLocation) {
IBakedModel ringModel = bakery.getBakedModel(MODEL_RING, modelTransform, spriteGetter);
return new QnbFormedBakedModel(ringModel, spriteGetter);
}
@Override
public Collection<ResourceLocation> getModelDependencies() {
return ImmutableSet.of(MODEL_RING);
}
@Override
public Stream<RenderMaterial> getAdditionalTextures() {
return QnbFormedBakedModel.getRequiredTextures().stream();
public Collection<Material> getTextures(IModelConfiguration owner,
Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return QnbFormedBakedModel.getRequiredTextures();
}
}
@@ -47,7 +47,7 @@ import appeng.block.AEBaseBlock;
public class MatrixFrameBlock extends AEBaseBlock {
private static final Material MATERIAL = new Material(MaterialColor.AIR, false, true, true, false, false, false,
PushReaction.PUSH_ONLY);
false, PushReaction.PUSH_ONLY);
public MatrixFrameBlock() {
super(Properties.create(MATERIAL).hardnessAndResistance(-1.0F, 6000000.0F).notSolid().noDrops());
@@ -29,7 +29,6 @@ import net.minecraft.state.BooleanProperty;
import net.minecraft.state.StateContainer;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.Util;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.World;
@@ -82,7 +81,7 @@ public class ChestBlock extends AEBaseTileBlock<ChestTileEntity> {
if (hit.getFace() == tg.getUp()) {
if (!tg.openGui(p)) {
p.sendMessage(PlayerMessages.ChestCannotReadStorageCell.get(), Util.DUMMY_UUID);
p.sendMessage(PlayerMessages.ChestCannotReadStorageCell.get());
}
} else {
ContainerOpener.openContainer(ChestContainer.TYPE, p,
@@ -53,7 +53,7 @@ public enum DriveSlotState implements IStringSerializable {
}
@Override
public String getString() {
public String getName() {
return this.name;
}
@@ -18,9 +18,6 @@
package appeng.block.storage;
import java.util.EnumMap;
import java.util.Map;
import javax.annotation.Nullable;
import net.minecraft.block.BlockRenderType;
@@ -50,18 +47,7 @@ public class SkyChestBlock extends AEBaseTileBlock<SkyChestTileEntity> {
private static final double AABB_OFFSET_BOTTOM = 0.00;
private static final double AABB_OFFSET_SIDES = 0.06;
private static final double AABB_OFFSET_TOP = 0.0625;
// Precomputed bounding boxes of the chest, sorted into the map by the UP
// direction
private static final Map<Direction, VoxelShape> SHAPES = new EnumMap<>(Direction.class);
static {
for (Direction up : Direction.values()) {
AxisAlignedBB aabb = computeAABB(up);
SHAPES.put(up, VoxelShapes.create(aabb));
}
}
private static final double AABB_OFFSET_TOP = 0.125;
public enum SkyChestType {
STONE, BLOCK
@@ -101,30 +87,37 @@ public class SkyChestBlock extends AEBaseTileBlock<SkyChestTileEntity> {
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
final SkyChestTileEntity sk = this.getTileEntity(worldIn, pos);
Direction up = sk != null ? sk.getUp() : Direction.UP;
return SHAPES.get(up);
// TODO Cache this! It can't be that hard!
AxisAlignedBB aabb = computeAABB(worldIn, pos);
return VoxelShapes.create(aabb);
}
private static AxisAlignedBB computeAABB(Direction up) {
final double offsetX = up.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = up.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = up.getZOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
private AxisAlignedBB computeAABB(final IBlockReader w, final BlockPos pos) {
final SkyChestTileEntity sk = this.getTileEntity(w, pos);
Direction o = Direction.UP;
if (sk != null) {
o = sk.getUp();
}
final double offsetX = o.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getZOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
// for x/z top and bottom is swapped
final double minX = Math.max(0.0,
offsetX + (up.getXOffset() < 0 ? AABB_OFFSET_BOTTOM : (up.getXOffset() * AABB_OFFSET_TOP)));
offsetX + (o.getXOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getXOffset() * AABB_OFFSET_TOP)));
final double minY = Math.max(0.0,
offsetY + (up.getYOffset() < 0 ? AABB_OFFSET_TOP : (up.getYOffset() * AABB_OFFSET_BOTTOM)));
offsetY + (o.getYOffset() < 0 ? AABB_OFFSET_TOP : (o.getYOffset() * AABB_OFFSET_BOTTOM)));
final double minZ = Math.max(0.0,
offsetZ + (up.getZOffset() < 0 ? AABB_OFFSET_BOTTOM : (up.getZOffset() * AABB_OFFSET_TOP)));
offsetZ + (o.getZOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getZOffset() * AABB_OFFSET_TOP)));
final double maxX = Math.min(1.0,
1.0 - offsetX - (up.getXOffset() < 0 ? AABB_OFFSET_TOP : (up.getXOffset() * AABB_OFFSET_BOTTOM)));
1.0 - offsetX - (o.getXOffset() < 0 ? AABB_OFFSET_TOP : (o.getXOffset() * AABB_OFFSET_BOTTOM)));
final double maxY = Math.min(1.0,
1.0 - offsetY - (up.getYOffset() < 0 ? AABB_OFFSET_BOTTOM : (up.getYOffset() * AABB_OFFSET_TOP)));
1.0 - offsetY - (o.getYOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getYOffset() * AABB_OFFSET_TOP)));
final double maxZ = Math.min(1.0,
1.0 - offsetZ - (up.getZOffset() < 0 ? AABB_OFFSET_TOP : (up.getZOffset() * AABB_OFFSET_BOTTOM)));
1.0 - offsetZ - (o.getZOffset() < 0 ? AABB_OFFSET_TOP : (o.getZOffset() * AABB_OFFSET_BOTTOM)));
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
}
@@ -31,8 +31,6 @@ import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -40,10 +38,8 @@ import appeng.api.definitions.IBlockDefinition;
import appeng.api.features.AEFeature;
import appeng.block.AEBaseBlock;
import appeng.block.AEBaseBlockItem;
import appeng.block.AEBaseBlockItemChargeable;
import appeng.block.AEBaseTileBlock;
import appeng.bootstrap.components.IBlockRegistrationComponent;
import appeng.bootstrap.components.IClientSetupComponent;
import appeng.bootstrap.components.IItemRegistrationComponent;
import appeng.bootstrap.definitions.TileEntityDefinition;
import appeng.core.AEItemGroup;
@@ -153,24 +149,6 @@ class BlockDefinitionBuilder implements IBlockBuilder {
item.setRegistryName(AppEng.MOD_ID, this.registryName);
}
// Register the client-only item model property for chargeable items
if (item instanceof AEBaseBlockItemChargeable) {
AEBaseBlockItemChargeable chargeable = (AEBaseBlockItemChargeable) item;
this.factory.addBootstrapComponent(new IClientSetupComponent() {
@Override
@OnlyIn(Dist.CLIENT)
public void setup() {
ItemModelsProperties.func_239418_a_(item, new ResourceLocation("appliedenergistics2:fill_level"),
(is, world, entity) -> {
double curPower = chargeable.getAECurrentPower(is);
double maxPower = chargeable.getAEMaxPower(is);
return (int) Math.round(100 * curPower / maxPower);
});
}
});
}
// Register the item and block with the game
this.factory.addBootstrapComponent((IBlockRegistrationComponent) (side, registry) -> registry.register(block));
if (item != null) {
@@ -30,14 +30,10 @@ import net.minecraft.block.DispenserBlock;
import net.minecraft.dispenser.IDispenseItemBehavior;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemModelsProperties;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import appeng.api.features.AEFeature;
import appeng.block.AEBaseBlockItemChargeable;
import appeng.bootstrap.components.IClientSetupComponent;
import appeng.bootstrap.components.IInitComponent;
import appeng.bootstrap.components.IItemRegistrationComponent;
import appeng.core.AEItemGroup;
+73 -9
View File
@@ -22,33 +22,58 @@ import java.util.Collections;
import java.util.EnumMap;
import java.util.List;
import java.util.Random;
import java.util.function.Supplier;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.client.util.InputMappings;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.vector.Vector3d;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.client.event.RenderLivingEvent;
import net.minecraftforge.client.model.ModelLoaderRegistry;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import appeng.api.parts.CableRenderMode;
import appeng.block.AEBaseBlock;
import appeng.block.paint.PaintSplotchesModel;
import appeng.block.qnb.QnbFormedModel;
import appeng.client.render.DummyFluidItemModel;
import appeng.client.render.FacadeItemModel;
import appeng.client.render.SimpleModelLoader;
import appeng.client.render.cablebus.CableBusModelLoader;
import appeng.client.render.cablebus.P2PTunnelFrequencyModel;
import appeng.client.render.crafting.CraftingCubeModelLoader;
import appeng.client.render.crafting.EncodedPatternModelLoader;
import appeng.client.render.effects.EnergyParticleData;
import appeng.client.render.effects.LightningArcFX;
import appeng.client.render.effects.LightningFX;
import appeng.client.render.effects.ParticleTypes;
import appeng.client.render.model.BiometricCardModel;
import appeng.client.render.model.ColorApplicatorModel;
import appeng.client.render.model.DriveModel;
import appeng.client.render.model.GlassModel;
import appeng.client.render.model.MemoryCardModel;
import appeng.client.render.model.SkyCompassModel;
import appeng.client.render.model.UVLModelLoader;
import appeng.client.render.spatial.SpatialPylonModel;
import appeng.core.AEConfig;
import appeng.core.Api;
import appeng.core.AppEng;
import appeng.core.features.registries.PartModels;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.ConfigValuePacket;
import appeng.helpers.IMouseWheelItem;
import appeng.parts.automation.PlaneModelLoader;
import appeng.server.ServerHelper;
import appeng.util.Platform;
@@ -57,6 +82,45 @@ public class ClientHelper extends ServerHelper {
private final EnumMap<ActionKey, KeyBinding> bindings = new EnumMap<>(ActionKey.class);
public ClientHelper() {
if (Minecraft.getInstance() != null) {
registerModelLoaders();
}
}
// In later forge versions, this runs before resource loads, in 1.15 the
// ModelRegistryEvent runs concurrently
// with resource reloading, which makes these non-deterministic
private void registerModelLoaders() {
addBuiltInModel("glass", GlassModel::new);
addBuiltInModel("sky_compass", SkyCompassModel::new);
addBuiltInModel("dummy_fluid_item", DummyFluidItemModel::new);
addBuiltInModel("memory_card", MemoryCardModel::new);
addBuiltInModel("biometric_card", BiometricCardModel::new);
addBuiltInModel("drive", DriveModel::new);
addBuiltInModel("color_applicator", ColorApplicatorModel::new);
addBuiltInModel("spatial_pylon", SpatialPylonModel::new);
addBuiltInModel("paint_splotches", PaintSplotchesModel::new);
addBuiltInModel("quantum_bridge_formed", QnbFormedModel::new);
addBuiltInModel("p2p_tunnel_frequency", P2PTunnelFrequencyModel::new);
addBuiltInModel("facade", FacadeItemModel::new);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "encoded_pattern"),
EncodedPatternModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "part_plane"),
PlaneModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "crafting_cube"),
CraftingCubeModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "uvlightmap"), UVLModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "cable_bus"),
new CableBusModelLoader((PartModels) Api.INSTANCE.registries().partModels()));
}
@OnlyIn(Dist.CLIENT)
private static <T extends IModelGeometry<T>> void addBuiltInModel(String id, Supplier<T> modelFactory) {
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, id),
new SimpleModelLoader<>(modelFactory));
}
public void clientInit() {
MinecraftForge.EVENT_BUS.addListener(this::postPlayerRender);
MinecraftForge.EVENT_BUS.addListener(this::wheelEvent);
@@ -108,7 +172,7 @@ public class ClientHelper extends ServerHelper {
this.spawnLightning(world, posX, posY, posZ);
return;
case LightningArc:
this.spawnLightningArc(world, posX, posY, posZ, (Vector3d) o);
this.spawnLightningArc(world, posX, posY, posZ, (Vec3d) o);
return;
default:
}
@@ -138,15 +202,15 @@ public class ClientHelper extends ServerHelper {
}
@Override
public CableRenderMode getCableRenderMode() {
public CableRenderMode getRenderMode() {
if (Platform.isServer()) {
return super.getCableRenderMode();
return super.getRenderMode();
}
final Minecraft mc = Minecraft.getInstance();
final PlayerEntity player = mc.player;
return this.getCableRenderModeForPlayer(player);
return this.renderModeForPlayer(player);
}
@Override
@@ -207,9 +271,9 @@ public class ClientHelper extends ServerHelper {
}
private void spawnLightningArc(final World world, final double posX, final double posY, final double posZ,
final Vector3d second) {
final LightningFX fx = new LightningArcFX((ClientWorld) world, posX, posY, posZ, second.x, second.y, second.z,
0.0f, 0.0f, 0.0f);
final Vec3d second) {
final LightningFX fx = new LightningArcFX(world, posX, posY, posZ, second.x, second.y, second.z, 0.0f, 0.0f,
0.0f);
Minecraft.getInstance().particles.addEffect(fx);
}
@@ -22,8 +22,6 @@ import java.text.NumberFormat;
import java.util.List;
import java.util.Locale;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
@@ -43,14 +41,14 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
}
@Override
protected void renderTooltip(MatrixStack matrixStack, final ItemStack stack, final int x, final int y) {
protected void renderTooltip(final ItemStack stack, final int x, final int y) {
final Slot s = this.getSlot(x, y);
if (s instanceof SlotME && !stack.isEmpty()) {
final int bigNumber = AEConfig.instance().isUseLargeFonts() ? 999 : 9999;
IAEItemStack myStack = null;
final List<ITextComponent> currentToolTip = this.getTooltipFromItem(stack);
final List<String> currentToolTip = this.getTooltipFromItem(stack);
try {
final SlotME theSlotField = (SlotME) s;
@@ -60,31 +58,38 @@ public abstract class AEBaseMEScreen<T extends AEBaseContainer> extends AEBaseSc
if (myStack != null) {
if (myStack.getStackSize() > bigNumber || (myStack.getStackSize() > 1 && stack.isDamaged())) {
final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
.format(myStack.getStackSize());
currentToolTip
.add(ButtonToolTips.ItemsStored.text(formattedAmount).mergeStyle(TextFormatting.GRAY));
final String format = String.format(local, formattedAmount);
currentToolTip.add(TextFormatting.GRAY + format);
}
if (myStack.getCountRequestable() > 0) {
final String local = ButtonToolTips.ItemsRequestable.getLocal();
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US)
.format(myStack.getCountRequestable());
currentToolTip.add(ButtonToolTips.ItemsRequestable.text(formattedAmount));
}
final String format = String.format(local, formattedAmount);
this.renderToolTip(matrixStack, currentToolTip, x, y, this.font);
currentToolTip.add(format);
}
this.renderTooltip(currentToolTip, x, y, this.font);
return;
} else if (stack.getCount() > bigNumber) {
final String local = ButtonToolTips.ItemsStored.getLocal();
final String formattedAmount = NumberFormat.getNumberInstance(Locale.US).format(stack.getCount());
currentToolTip.add(ButtonToolTips.ItemsStored.text(formattedAmount).mergeStyle(TextFormatting.GRAY));
final String format = String.format(local, formattedAmount);
this.renderToolTip(matrixStack, currentToolTip, x, y, this.font);
currentToolTip.add(TextFormatting.GRAY + format);
this.renderTooltip(currentToolTip, x, y, this.font);
return;
}
}
super.renderTooltip(matrixStack, stack, x, y);
super.renderTooltip(stack, x, y);
}
}
@@ -24,11 +24,10 @@ 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.matrix.MatrixStack;
import com.google.common.collect.Lists;
import com.mojang.blaze3d.systems.RenderSystem;
import org.lwjgl.glfw.GLFW;
@@ -55,8 +54,6 @@ import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -129,52 +126,51 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
}
@Override
public void render(MatrixStack matrixStack, final int mouseX, final int mouseY, final float partialTicks) {
super.renderBackground(matrixStack);
super.render(matrixStack, mouseX, mouseY, partialTicks);
public void render(final int mouseX, final int mouseY, final float partialTicks) {
super.renderBackground();
super.render(mouseX, mouseY, partialTicks);
RenderSystem.pushMatrix();
RenderSystem.translatef(this.guiLeft, this.guiTop, 0.0F);
RenderSystem.enableDepthTest();
for (final CustomSlotWidget c : this.guiSlots) {
this.drawGuiSlot(matrixStack, c, mouseX, mouseY, partialTicks);
this.drawGuiSlot(c, mouseX, mouseY, partialTicks);
}
RenderSystem.disableDepthTest();
for (final CustomSlotWidget c : this.guiSlots) {
this.drawTooltip(matrixStack, c, mouseX - this.guiLeft, mouseY - this.guiTop);
this.drawTooltip(c, mouseX - this.guiLeft, mouseY - this.guiTop);
}
RenderSystem.popMatrix();
RenderSystem.enableDepthTest();
this.func_230459_a_(matrixStack, mouseX, mouseY);
this.renderHoveredToolTip(mouseX, mouseY);
for (final Object c : this.buttons) {
if (c instanceof ITooltip) {
this.drawTooltip(matrixStack, (ITooltip) c, mouseX, mouseY);
this.drawTooltip((ITooltip) c, mouseX, mouseY);
}
}
}
protected void drawGuiSlot(MatrixStack matrixStack, CustomSlotWidget slot, int mouseX, int mouseY,
float partialTicks) {
protected void drawGuiSlot(CustomSlotWidget slot, int mouseX, int mouseY, float partialTicks) {
if (slot.isSlotEnabled()) {
final int left = slot.getTooltipAreaX();
final int top = slot.getTooltipAreaY();
final int right = left + slot.getTooltipAreaWidth();
final int bottom = top + slot.getTooltipAreaHeight();
slot.drawContent(matrixStack, getMinecraft(), mouseX, mouseY, partialTicks);
slot.drawContent(getMinecraft(), mouseX, mouseY, partialTicks);
if (this.isPointInRegion(left, top, slot.getTooltipAreaWidth(), slot.getTooltipAreaHeight(), mouseX, mouseY)
&& slot.canClick(getPlayer())) {
RenderSystem.colorMask(true, true, true, false);
this.fillGradient(matrixStack, left, top, right, bottom, -2130706433, -2130706433);
this.fillGradient(left, top, right, bottom, -2130706433, -2130706433);
RenderSystem.colorMask(true, true, true, true);
}
}
}
private void drawTooltip(MatrixStack matrixStack, ITooltip tooltip, int mouseX, int mouseY) {
private void drawTooltip(ITooltip tooltip, int mouseX, int mouseY) {
final int x = tooltip.getTooltipAreaX();
int y = tooltip.getTooltipAreaY();
@@ -184,46 +180,41 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
y = 15;
}
final ITextComponent msg = tooltip.getTooltipMessage();
this.drawTooltip(matrixStack, x + 11, y + 4, msg);
final String msg = tooltip.getTooltipMessage();
if (msg != null && !msg.isEmpty()) {
this.drawTooltip(x + 11, y + 4, msg);
}
}
}
}
protected void drawTooltip(MatrixStack matrices, int x, int y, ITextComponent message) {
String tooltipText = message.getString();
if (!tooltipText.isEmpty()) {
String[] lines = tooltipText.split("\n"); // FIXME FABRIC
List<ITextComponent> textLines = Arrays.stream(lines).map(StringTextComponent::new)
.collect(Collectors.toList());
this.drawTooltip(matrices, x, y, textLines);
}
protected void drawTooltip(int x, int y, String message) {
String[] lines = message.split("\n");
this.drawTooltip(x, y, Arrays.asList(lines));
}
// FIXME FABRIC: move out to json (?)
private static final Style TOOLTIP_HEADER = Style.EMPTY.applyFormatting(TextFormatting.WHITE);
private static final Style TOOLTIP_BODY = Style.EMPTY.applyFormatting(TextFormatting.GRAY);
protected void drawTooltip(MatrixStack matrices, int x, int y, List<ITextComponent> lines) {
protected void drawTooltip(int x, int y, List<String> lines) {
if (lines.isEmpty()) {
return;
}
// For an explanation of the formatting codes, see
// http://minecraft.gamepedia.com/Formatting_codes
lines = Lists.newArrayList(lines); // Make a copy
// Make the first line white
lines.set(0, TextFormatting.WHITE + lines.get(0));
// All lines after the first are colored gray
List<ITextComponent> styledLines = new ArrayList<>(lines.size());
for (int i = 0; i < lines.size(); i++) {
Style style = (i == 0) ? TOOLTIP_HEADER : TOOLTIP_BODY;
styledLines.add(lines.get(i).deepCopy().modifyStyle(s -> style));
for (int i = 1; i < lines.size(); i++) {
lines.set(i, TextFormatting.GRAY + lines.get(i));
}
this.renderTooltip(matrices, styledLines, x, y);
this.renderTooltip(lines, x, y, this.font);
}
@Override
protected final void drawGuiContainerForegroundLayer(MatrixStack matrixStack, final int x, final int y) {
protected final void drawGuiContainerForegroundLayer(final int x, final int y) {
final int ox = this.guiLeft; // (width - xSize) / 2;
final int oy = this.guiTop; // (height - ySize) / 2;
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
@@ -232,18 +223,17 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
this.getScrollBar().draw(this);
}
this.drawFG(matrixStack, ox, oy, x, y);
this.drawFG(ox, oy, x, y);
}
public abstract void drawFG(MatrixStack matrixStack, int offsetX, int offsetY, int mouseX, int mouseY);
public abstract void drawFG(int offsetX, int offsetY, int mouseX, int mouseY);
@Override
protected final void drawGuiContainerBackgroundLayer(MatrixStack matrixStack, final float f, final int x,
final int y) {
protected final void drawGuiContainerBackgroundLayer(final float f, final int x, final int y) {
final int ox = this.guiLeft; // (width - xSize) / 2;
final int oy = this.guiTop; // (height - ySize) / 2;
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
this.drawBG(matrixStack, ox, oy, x, y, f);
this.drawBG(ox, oy, x, y, f);
final List<Slot> slots = this.getInventorySlots();
for (final Slot slot : slots) {
@@ -549,6 +539,11 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
return false;
}
@Override
public void removed() {
super.removed();
}
protected Slot getSlot(final int mouseX, final int mouseY) {
final List<Slot> slots = this.getInventorySlots();
for (final Slot slot : slots) {
@@ -561,8 +556,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
return null;
}
public abstract void drawBG(MatrixStack matrixStack, int offsetX, int offsetY, int mouseX, int mouseY,
float partialTicks);
public abstract void drawBG(int offsetX, int offsetY, int mouseX, int mouseY, float partialTicks);
@Override
public boolean mouseScrolled(double x, double y, double wheelDelta) {
@@ -613,8 +607,8 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
this.itemRenderer.zLevel = 0.0F;
}
protected ITextComponent getGuiDisplayName(final ITextComponent in) {
return this.hasCustomInventoryName() ? new StringTextComponent(this.getInventoryName()) : in;
protected String getGuiDisplayName(final String in) {
return this.hasCustomInventoryName() ? this.getInventoryName() : in;
}
private boolean hasCustomInventoryName() {
@@ -630,16 +624,16 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
* hackery...
*/
@Override
public void moveItems(MatrixStack matrices, Slot s) {
public void drawSlot(Slot s) {
if (s instanceof SlotME) {
try {
if (!this.isPowered()) {
fill(matrices, s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
fill(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
}
// Annoying but easier than trying to splice into render item
super.moveItems(matrices, new Size1Slot((SlotME) s));
super.drawSlot(new Size1Slot((SlotME) s));
this.stackSizeRenderer.renderStackSize(this.font, ((SlotME) s).getAEStack(), s.xPos, s.yPos);
@@ -668,13 +662,12 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
float blue = (fluidAttributes.getColor() & 255) / 255.0F;
RenderSystem.color3f(red, green, blue);
blit(matrices, s.xPos, s.yPos, 0 /* FIXME: Validate this was previous the controls zindex */, 16, 16,
sprite);
blit(s.xPos, s.yPos, 0 /* FIXME: Validate this was previous the controls zindex */, 16, 16, sprite);
RenderSystem.enableBlend();
this.fluidStackSizeRenderer.renderStackSize(this.font, fs, s.xPos, s.yPos);
} else if (!this.isPowered()) {
fill(matrices, s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
fill(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111);
}
return;
@@ -746,7 +739,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
setBlitOffset(100);
this.itemRenderer.zLevel = 100.0F;
fill(matrices, s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666);
fill(s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66ff6666);
setBlitOffset(0);
this.itemRenderer.zLevel = 0.0F;
@@ -755,9 +748,9 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
if (s instanceof AppEngSlot) {
((AppEngSlot) s).setDisplay(true);
super.moveItems(matrices, s);
super.drawSlot(s);
} else {
super.moveItems(matrices, s);
super.drawSlot(s);
}
return;
@@ -766,7 +759,7 @@ public abstract class AEBaseScreen<T extends AEBaseContainer> extends ContainerS
}
}
// do the usual for non-ME Slots.
super.moveItems(matrices, s);
super.drawSlot(s);
}
protected boolean isPowered() {
@@ -8,19 +8,18 @@ import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.SlotItemHandler;
/**
* 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
* rendering.
*/
class Size1Slot extends SlotItemHandler {
class Size1Slot extends Slot {
private final SlotItemHandler delegate;
private final Slot delegate;
public Size1Slot(SlotItemHandler delegate) {
super(delegate.getItemHandler(), delegate.getSlotIndex(), delegate.xPos, delegate.yPos);
public Size1Slot(Slot delegate) {
super(delegate.inventory, delegate.getSlotIndex(), delegate.xPos, delegate.yPos);
this.delegate = delegate;
}
@@ -7,7 +7,6 @@ import javax.annotation.Nullable;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import appeng.api.definitions.IDefinitions;
import appeng.api.definitions.IParts;
@@ -93,11 +92,10 @@ final class AESubScreen {
return addBackButton(buttonAdder, x, y, null);
}
public final TabButton addBackButton(Consumer<TabButton> buttonAdder, int x, int y,
@Nullable ITextComponent label) {
public final TabButton addBackButton(Consumer<TabButton> buttonAdder, int x, int y, @Nullable String label) {
if (this.previousContainerType != null && !previousContainerIcon.isEmpty()) {
if (label == null) {
label = previousContainerIcon.getDisplayName();
label = previousContainerIcon.getDisplayName().getString();
}
ItemRenderer itemRenderer = gui.getMinecraft().getItemRenderer();
TabButton button = new TabButton(gui.getGuiLeft() + x, gui.getGuiTop() + y, previousContainerIcon, label,
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
@@ -62,8 +60,7 @@ public class CellWorkbenchScreen extends UpgradeableScreen<CellWorkbenchContaine
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.handleButtonVisibility();
this.bindTexture(this.getBackground());
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -43,7 +41,7 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
public void init() {
super.init();
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.text(),
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriority()));
}
@@ -52,15 +50,13 @@ public class ChestScreen extends AEBaseScreen<ChestContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.Chest.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.text().getString(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Chest.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/chest.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -51,23 +49,21 @@ public class CondenserScreen extends AEBaseScreen<CondenserContainer> {
this.container.getOutput());
this.addButton(new ProgressBar(this.container, "guis/condenser.png", 120 + this.guiLeft, 25 + this.guiTop, 178,
25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.text()));
25, 6, 18, Direction.VERTICAL, GuiText.StoredEnergy.getLocal()));
this.addButton(this.mode);
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.Condenser.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.text().getString(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Condenser.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.mode.set(this.container.getOutput());
this.mode.setFillVar(String.valueOf(this.container.getOutput().requiredPower));
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/condenser.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -56,7 +54,7 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
this.amountToCraft.addButtons(children::add, this::addButton);
this.next = this.addButton(
new Button(this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.text(), this::confirm));
new Button(this.guiLeft + 128, this.guiTop + 51, 38, 20, GuiText.Next.getLocal(), this::confirm));
subGui.addBackButton(this::addButton, 154, 0);
}
@@ -67,22 +65,20 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, GuiText.SelectAmount.text().getString(), 8, 6, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.SelectAmount.getLocal(), 8, 6, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
this.next.setMessage(hasShiftDown() ? GuiText.Start.text() : GuiText.Next.text());
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.next.setMessage(hasShiftDown() ? GuiText.Start.getLocal() : GuiText.Next.getLocal());
this.bindTexture("guis/craft_amt.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
this.next.active = this.amountToCraft.getValue() > 0;
this.amountToCraft.render(matrixStack, offsetX, offsetY, partialTicks);
this.amountToCraft.render(offsetX, offsetY, partialTicks);
}
@Override
@@ -24,7 +24,6 @@ import java.util.Iterator;
import java.util.List;
import com.google.common.base.Joiner;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.widget.button.Button;
@@ -32,7 +31,6 @@ import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.storage.channels.IItemStorageChannel;
@@ -84,23 +82,22 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
public void init() {
super.init();
this.start = new Button(this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.text(),
this.start = new Button(this.guiLeft + 162, this.guiTop + this.ySize - 25, 50, 20, GuiText.Start.getLocal(),
btn -> start());
this.start.active = false;
this.addButton(this.start);
this.selectCPU = new Button(this.guiLeft + (219 - 180) / 2, this.guiTop + this.ySize - 68, 180, 20,
new StringTextComponent(GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic),
btn -> selectNextCpu());
GuiText.CraftingCPU.getLocal() + ": " + GuiText.Automatic, btn -> selectNextCpu());
this.selectCPU.active = false;
this.addButton(this.selectCPU);
addButton(new Button(this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.text(),
addButton(new Button(this.guiLeft + 6, this.guiTop + this.ySize - 25, 50, 20, GuiText.Cancel.getLocal(),
btn -> subGui.goBack()));
}
@Override
public void render(MatrixStack matrixStack, final int mouseX, final int mouseY, final float btn) {
public void render(final int mouseX, final int mouseY, final float btn) {
this.updateCPUButtonText();
this.start.active = !(this.container.hasNoCPU() || this.isSimulation());
@@ -133,7 +130,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
}
}
super.render(matrixStack, mouseX, mouseY, btn);
super.render(mouseX, mouseY, btn);
}
private void updateCPUButtonText() {
@@ -152,7 +149,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
btnTextText = GuiText.NoCraftingCPUs.getLocal();
}
this.selectCPU.setMessage(new StringTextComponent(btnTextText));
this.selectCPU.setMessage(btnTextText);
}
private boolean isSimulation() {
@@ -160,13 +157,12 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
final long BytesUsed = this.container.getUsedBytes();
final String byteUsed = NumberFormat.getInstance().format(BytesUsed);
final String Add = BytesUsed > 0 ? (byteUsed + ' ' + GuiText.BytesUsed.getLocal())
: GuiText.CalculatingWait.getLocal();
this.font.drawString(matrixStack, GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752);
this.font.drawString(GuiText.CraftingPlan.getLocal() + " - " + Add, 8, 7, 4210752);
String dsp = null;
@@ -180,7 +176,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
}
final int offset = (219 - this.font.getStringWidth(dsp)) / 2;
this.font.drawString(matrixStack, dsp, offset, 165, 4210752);
this.font.drawString(dsp, offset, 165, 4210752);
final int sectionLength = 67;
@@ -234,7 +230,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
str = GuiText.FromStorage.getLocal() + ": " + str;
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(matrixStack, str,
this.font.drawString(str,
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * offY + yo + 6 - negY + downY) * 2, 4210752);
@@ -255,9 +251,9 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
str = Long.toString(missingStack.getStackSize() / 1000000) + 'm';
}
str = GuiText.Missing.text().getString() + ": " + str;
str = GuiText.Missing.getLocal() + ": " + str;
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(matrixStack, str,
this.font.drawString(str,
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * offY + yo + 6 - negY + downY) * 2, 4210752);
@@ -280,7 +276,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
str = GuiText.ToCraft.getLocal() + ": " + str;
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(matrixStack, str,
this.font.drawString(str,
(int) ((x * (1 + sectionLength) + xo + sectionLength - 19 - (w * 0.5)) * 2),
(y * offY + yo + 6 - negY + downY) * 2, 4210752);
@@ -296,7 +292,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
final ItemStack is = refStack.asItemStackRepresentation();
if (this.tooltip == z - viewStart) {
dspToolTip = Platform.getItemDisplayName(refStack).getString();
dspToolTip = Platform.getItemDisplayName(refStack).getFormattedText();
if (lineList.size() > 0) {
dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
@@ -311,7 +307,7 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
if (red) {
final int startX = x * (1 + sectionLength) + xo;
final int startY = posY - 4;
fill(matrixStack, startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000);
fill(startX, startY, startX + sectionLength, startY + offY, 0x1AFF0000);
}
x++;
@@ -324,13 +320,12 @@ public class CraftConfirmScreen extends AEBaseScreen<CraftConfirmContainer> {
}
if (this.tooltip >= 0 && !dspToolTip.isEmpty()) {
this.drawTooltip(matrixStack, toolPosX, toolPosY + 10, new StringTextComponent(dspToolTip));
this.drawTooltip(toolPosX, toolPosY + 10, dspToolTip);
}
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.setScrollBar();
this.bindTexture("guis/craftingreport.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import com.google.common.base.Joiner;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import org.apache.commons.lang3.time.DurationFormatUtils;
@@ -33,7 +32,6 @@ import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.config.SortDir;
@@ -117,7 +115,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
super.init();
this.setScrollBar();
this.cancel = new Button(this.guiLeft + CANCEL_LEFT_OFFSET, this.guiTop + this.ySize - CANCEL_TOP_OFFSET,
CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel.text(), btn -> cancel());
CANCEL_WIDTH, CANCEL_HEIGHT, GuiText.Cancel.getLocal(), btn -> cancel());
this.addButton(this.cancel);
}
@@ -129,7 +127,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
}
@Override
public void render(MatrixStack matrixStack, final int mouseX, final int mouseY, final float btn) {
public void render(final int mouseX, final int mouseY, final float btn) {
this.cancel.active = !this.visual.isEmpty();
final int gx = (this.width - this.xSize) / 2;
@@ -159,13 +157,12 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
}
}
super.render(matrixStack, mouseX, mouseY, btn);
super.render(mouseX, mouseY, btn);
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
String title = this.getGuiDisplayName(GuiText.CraftingStatus.text()).getString();
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
String title = this.getGuiDisplayName(GuiText.CraftingStatus.getLocal());
if (this.container.getEstimatedTime() > 0 && !this.visual.isEmpty()) {
final long etaInMilliseconds = TimeUnit.MILLISECONDS.convert(this.container.getEstimatedTime(),
@@ -175,7 +172,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
title += " - " + etaTimeText;
}
this.font.drawString(matrixStack, title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR);
this.font.drawString(title, TITLE_LEFT_OFFSET, TITLE_TOP_OFFSET, TEXT_COLOR);
int x = 0;
int y = 0;
@@ -221,7 +218,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
| BACKGROUND_ALPHA;
final int startX = (x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET) * 2;
final int startY = ((y * offY + ITEMSTACK_TOP_OFFSET) - 3) * 2;
fill(matrixStack, startX, startY, startX + (SECTION_LENGTH * 2), startY + (offY * 2) - 2, bgColor);
fill(startX, startY, startX + (SECTION_LENGTH * 2), startY + (offY * 2) - 2, bgColor);
}
final int negY = ((lines - 1) * 5) / 2;
@@ -231,7 +228,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
final String str = GuiText.Stored.getLocal() + ": "
+ converter.toWideReadableForm(stored.getStackSize());
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(matrixStack, str,
this.font.drawString(str,
(int) ((x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - (w * 0.5))
* 2),
(y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY) * 2, TEXT_COLOR);
@@ -248,7 +245,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
+ converter.toWideReadableForm(activeStack.getStackSize());
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(matrixStack, str,
this.font.drawString(str,
(int) ((x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - (w * 0.5))
* 2),
(y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY) * 2, TEXT_COLOR);
@@ -265,7 +262,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
+ converter.toWideReadableForm(pendingStack.getStackSize());
final int w = 4 + this.font.getStringWidth(str);
this.font.drawString(matrixStack, str,
this.font.drawString(str,
(int) ((x * (1 + SECTION_LENGTH) + ITEMSTACK_LEFT_OFFSET + SECTION_LENGTH - 19 - (w * 0.5))
* 2),
(y * offY + ITEMSTACK_TOP_OFFSET + 6 - negY + downY) * 2, TEXT_COLOR);
@@ -282,7 +279,7 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
final ItemStack is = refStack.asItemStackRepresentation();
if (this.tooltip == z - viewStart) {
dspToolTip = Platform.getItemDisplayName(refStack).getString();
dspToolTip = Platform.getItemDisplayName(refStack).getFormattedText();
if (lineList.size() > 0) {
dspToolTip = dspToolTip + '\n' + Joiner.on("\n").join(lineList);
@@ -304,13 +301,12 @@ public class CraftingCPUScreen<T extends CraftingCPUContainer> extends AEBaseScr
}
if (this.tooltip >= 0 && !dspToolTip.isEmpty()) {
this.drawTooltip(matrixStack, toolPosX, toolPosY + 10, new StringTextComponent(dspToolTip));
this.drawTooltip(toolPosX, toolPosY + 10, dspToolTip);
}
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/craftingcpu.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -22,12 +22,9 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import appeng.container.implementations.CraftingStatusContainer;
import appeng.core.localization.GuiText;
@@ -51,8 +48,7 @@ public class CraftingStatusScreen extends CraftingCPUScreen<CraftingStatusContai
super.init();
this.selectCPU = new Button(this.guiLeft + 8, this.guiTop + this.ySize - 25, 150, 20,
new StringTextComponent(GuiText.CraftingCPU.getLocal() + ": " + GuiText.NoCraftingCPUs),
btn -> selectNextCpu());
GuiText.CraftingCPU.getLocal() + ": " + GuiText.NoCraftingCPUs, btn -> selectNextCpu());
this.addButton(this.selectCPU);
subGui.addBackButton(btn -> {
@@ -62,9 +58,9 @@ public class CraftingStatusScreen extends CraftingCPUScreen<CraftingStatusContai
}
@Override
public void render(MatrixStack matrixStack, final int mouseX, final int mouseY, final float btn) {
public void render(final int mouseX, final int mouseY, final float btn) {
this.updateCPUButtonText();
super.render(matrixStack, mouseX, mouseY, btn);
super.render(mouseX, mouseY, btn);
}
private void updateCPUButtonText() {
@@ -84,11 +80,11 @@ public class CraftingStatusScreen extends CraftingCPUScreen<CraftingStatusContai
btnTextText = GuiText.NoCraftingJobs.getLocal();
}
this.selectCPU.setMessage(new StringTextComponent(btnTextText));
this.selectCPU.setMessage(btnTextText);
}
@Override
protected ITextComponent getGuiDisplayName(final ITextComponent in) {
protected String getGuiDisplayName(final String in) {
return in; // the cup name is on the button
}
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.util.text.ITextComponent;
@@ -63,11 +61,10 @@ public class CraftingTermScreen extends MEMonitorableScreen<CraftingTermContaine
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
super.drawFG(matrixStack, offsetX, offsetY, mouseX, mouseY);
this.font.drawString(matrixStack, GuiText.CraftingTerminal.getLocal(), 8,
this.ySize - 96 + 1 - this.getReservedSpace(), 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.font.drawString(GuiText.CraftingTerminal.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(),
4210752);
}
@Override
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -43,7 +41,7 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
public void init() {
super.init();
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.text(),
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
}
@@ -52,15 +50,13 @@ public class DriveScreen extends AEBaseScreen<DriveContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.Drive.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.text().getString(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Drive.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/drive.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -52,7 +50,7 @@ public class FormationPlaneScreen extends UpgradeableScreen<FormationPlaneContai
this.fuzzyMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.text(),
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(this.placeMode);
@@ -60,11 +58,9 @@ public class FormationPlaneScreen extends UpgradeableScreen<FormationPlaneContai
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.FormationPlane.text()).getString(), 8, 6,
4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.FormationPlane.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -36,15 +34,13 @@ public class GrinderScreen extends AEBaseScreen<GrinderContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.GrindStone.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.text().getString(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.GrindStone.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/grinder.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -59,10 +57,9 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.IOPort.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.IOPort.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode());
@@ -78,9 +75,8 @@ public class IOPortScreen extends UpgradeableScreen<IOPortContainer> {
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
super.drawBG(matrixStack, offsetX, offsetY, mouseX, mouseY, partialTicks);
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
super.drawBG(offsetX, offsetY, mouseX, mouseY, partialTicks);
final IDefinitions definitions = Api.instance().definitions();
@@ -18,11 +18,8 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
@@ -54,18 +51,15 @@ public class InscriberScreen extends AEBaseScreen<InscriberContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.pb.setFullMsg(new StringTextComponent(
this.container.getCurrentProgress() * 100 / this.container.getMaxProgress() + "%"));
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.pb.setFullMsg(this.container.getCurrentProgress() * 100 / this.container.getMaxProgress() + "%");
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.Inscriber.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.text().getString(), 8, this.ySize - 96 + 3, 4210752);
this.font.drawString(this.getGuiDisplayName(GuiText.Inscriber.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/inscriber.png");
this.pb.x = 135 + this.guiLeft;
this.pb.y = 39 + this.guiTop;
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -48,7 +46,7 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
@Override
protected void addButtons() {
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.text(),
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
this.blockMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 8, Settings.BLOCK, YesNo.NO);
@@ -61,8 +59,7 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
if (this.blockMode != null) {
this.blockMode.set(((InterfaceContainer) this.cvb).getBlockingMode());
}
@@ -71,13 +68,13 @@ public class InterfaceScreen extends UpgradeableScreen<InterfaceContainer> {
this.interfaceMode.setState(((InterfaceContainer) this.cvb).getInterfaceTerminalMode() == YesNo.YES);
}
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.Interface.text()).getString(), 8, 6, 4210752);
this.font.drawString(this.getGuiDisplayName(GuiText.Interface.getLocal()), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752);
this.font.drawString(matrixStack, GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752);
this.font.drawString(matrixStack, GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752);
this.font.drawString(GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752);
this.font.drawString(GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752);
this.font.drawString(GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
@@ -28,7 +28,6 @@ import java.util.Set;
import java.util.WeakHashMap;
import com.google.common.collect.HashMultimap;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import org.lwjgl.glfw.GLFW;
@@ -94,11 +93,9 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.InterfaceTerminal.text()).getString(), 8, 6,
4210752);
this.font.drawString(matrixStack, GuiText.inventory.text().getString(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.InterfaceTerminal.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
final int ex = this.getScrollBar().getCurrentScroll();
@@ -123,7 +120,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
name = name.substring(0, name.length() - 1);
}
this.font.drawString(matrixStack, name, 10, 6 + offset, 4210752);
this.font.drawString(name, 10, 6 + offset, 4210752);
}
offset += 18;
}
@@ -143,8 +140,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/interfaceterminal.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
@@ -164,7 +160,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
}
if (this.searchField != null) {
this.searchField.render(matrixStack, mouseX, mouseY, partialTicks);
this.searchField.render(mouseX, mouseY, partialTicks);
}
}
@@ -221,7 +217,7 @@ public class InterfaceTerminalScreen extends AEBaseScreen<InterfaceTerminalConta
try {
final long id = Long.parseLong(key.substring(1), Character.MAX_RADIX);
final CompoundNBT invData = in.getCompound(key);
ITextComponent un = ITextComponent.Serializer.func_240643_a_(invData.getString("un"));
ITextComponent un = ITextComponent.Serializer.fromJson(invData.getString("un"));
final ClientDCInternalInv current = this.getById(id, invData.getLong("sortBy"), un);
for (int x = 0; x < current.getInventory().getSlots(); x++) {
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -79,8 +77,7 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
final boolean notCraftingMode = this.bc.getInstalledUpgrades(Upgrades.CRAFTING) == 0;
// configure enabled status...
@@ -88,7 +85,7 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
this.levelMode.active = notCraftingMode;
this.redstoneMode.active = notCraftingMode;
super.drawFG(matrixStack, offsetX, offsetY, mouseX, mouseY);
super.drawFG(offsetX, offsetY, mouseX, mouseY);
if (this.craftingMode != null) {
this.craftingMode.set(this.cvb.getCraftingMode());
@@ -100,18 +97,16 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
if (notCraftingMode) {
if (currentLevelMode == LevelType.ENERGY_LEVEL) {
this.font.drawString(matrixStack, PowerUnits.AE.textComponent().getString(), 110, 44,
COLOR_DARK_GRAY);
this.font.drawString(PowerUnits.AE.textComponent().getString(), 110, 44, COLOR_DARK_GRAY);
}
}
}
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
super.drawBG(matrixStack, offsetX, offsetY, mouseX, mouseY, partialTicks);
this.level.render(matrixStack, mouseX, mouseY, partialTicks);
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
super.drawBG(offsetX, offsetY, mouseX, mouseY, partialTicks);
this.level.render(mouseX, mouseY, partialTicks);
}
@Override
@@ -20,8 +20,6 @@ package appeng.client.gui.implementations;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.util.InputMappings;
@@ -236,7 +234,7 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
if (this.viewCell || this instanceof WirelessTermScreen) {
this.craftingStatusBtn = this.addButton(new TabButton(this.guiLeft + 170, this.guiTop - 4, 2 + 11 * 16,
GuiText.CraftingStatus.text(), this.itemRenderer, btn -> showCraftingStatus()));
GuiText.CraftingStatus.getLocal(), this.itemRenderer, btn -> showCraftingStatus()));
this.craftingStatusBtn.setHideEdge(13);
}
@@ -286,10 +284,9 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(this.myName.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.text().getString(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(this.myName.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
@@ -314,29 +311,28 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
}
@Override
public void onClose() {
super.onClose();
public void removed() {
super.removed();
getMinecraft().keyboardListener.enableRepeatEvents(false);
memoryText = this.searchField.getText();
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture(this.getBackground());
final int x_width = 197;
blit(matrixStack, offsetX, offsetY, 0, 0, x_width, 18);
blit(offsetX, offsetY, 0, 0, x_width, 18);
if (this.viewCell || (this instanceof SecurityStationScreen)) {
blit(matrixStack, offsetX + x_width, offsetY, x_width, 0, 46, 128);
blit(offsetX + x_width, offsetY, x_width, 0, 46, 128);
}
for (int x = 0; x < this.rows; x++) {
blit(matrixStack, offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
blit(offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18);
}
blit(matrixStack, offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width,
blit(offsetX, offsetY + 16 + this.rows * 18 + this.lowerTextureOffset, 0, 106 - 18 - 18, x_width,
99 + this.reservedSpace - this.lowerTextureOffset);
if (this.viewCell) {
@@ -355,7 +351,7 @@ public class MEMonitorableScreen<T extends MEMonitorableContainer> extends AEBas
}
if (this.searchField != null) {
this.searchField.render(matrixStack, mouseX, mouseY, partialTicks);
this.searchField.render(mouseX, mouseY, partialTicks);
}
}
@@ -18,11 +18,8 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import appeng.api.config.RedstoneMode;
import appeng.api.config.Settings;
@@ -59,18 +56,16 @@ public class MolecularAssemblerScreen extends UpgradeableScreen<MolecularAssembl
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.pb.setFullMsg(new StringTextComponent(this.container.getCurrentProgress() + "%"));
super.drawFG(matrixStack, offsetX, offsetY, mouseX, mouseY);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.pb.setFullMsg(this.container.getCurrentProgress() + "%");
super.drawFG(offsetX, offsetY, mouseX, mouseY);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.pb.x = 148 + this.guiLeft;
this.pb.y = 48 + this.guiTop;
super.drawBG(matrixStack, offsetX, offsetY, mouseX, mouseY, partialTicks);
super.drawBG(offsetX, offsetY, mouseX, mouseY, partialTicks);
}
@Override
@@ -20,14 +20,12 @@ package appeng.client.gui.implementations;
import java.util.List;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.api.config.SortDir;
@@ -70,7 +68,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
@Override
public void render(MatrixStack matrixStack, final int mouseX, final int mouseY, final float btn) {
public void render(final int mouseX, final int mouseY, final float btn) {
final int gx = (this.width - this.xSize) / 2;
final int gy = (this.height - this.ySize) / 2;
@@ -98,24 +96,23 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
}
super.render(matrixStack, mouseX, mouseY, btn);
super.render(mouseX, mouseY, btn);
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, GuiText.NetworkDetails.getLocal(), 8, 6, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.NetworkDetails.getLocal(), 8, 6, 4210752);
this.font.drawString(matrixStack,
this.font.drawString(
GuiText.StoredPower.getLocal() + ": " + Platform.formatPowerLong(container.getCurrentPower(), false),
13, 16, 4210752);
this.font.drawString(matrixStack,
this.font.drawString(
GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong(container.getMaxPower(), false), 13, 26,
4210752);
this.font.drawString(matrixStack, GuiText.PowerInputRate.getLocal() + ": "
this.font.drawString(GuiText.PowerInputRate.getLocal() + ": "
+ Platform.formatPowerLong(container.getAverageAddition(), true), 13, 143 - 10, 4210752);
this.font.drawString(matrixStack,
this.font.drawString(
GuiText.PowerUsageRate.getLocal() + ": " + Platform.formatPowerLong(container.getPowerUsage(), true),
13, 143 - 20, 4210752);
@@ -144,16 +141,15 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
final int w = this.font.getStringWidth(str);
this.font.drawString(matrixStack, str,
(int) ((x * sectionLength + xo + sectionLength - 19 - (w * 0.5)) * 2), (y * 18 + yo + 6) * 2,
4210752);
this.font.drawString(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;
final int posY = y * 18 + yo;
if (this.tooltip == z - viewStart) {
toolTip = Platform.getItemDisplayName(refStack).getString();
toolTip = Platform.getItemDisplayName(refStack).getFormattedText();
toolTip += ('\n' + GuiText.Installed.getLocal() + ": " + (refStack.getStackSize()));
if (refStack.getCountRequestable() > 0) {
@@ -177,13 +173,12 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
if (this.tooltip >= 0 && toolTip.length() > 0) {
this.drawTooltip(matrixStack, toolPosX, toolPosY + 10, new StringTextComponent(toolTip));
this.drawTooltip(toolPosX, toolPosY + 10, toolTip);
}
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/networkstatus.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -206,7 +201,7 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
@Override
protected void renderTooltip(MatrixStack matrixStack, final ItemStack stack, final int x, final int y) {
protected void renderTooltip(final ItemStack stack, final int x, final int y) {
final Slot s = this.getSlot(x, y);
if (s instanceof SlotME && !stack.isEmpty()) {
@@ -219,21 +214,21 @@ public class NetworkStatusScreen extends AEBaseScreen<NetworkStatusContainer> im
}
if (myStack != null) {
List<ITextComponent> currentToolTip = getTooltipFromItem(stack);
List<String> currentToolTip = getTooltipFromItem(stack);
while (currentToolTip.size() > 1) {
currentToolTip.remove(1);
}
currentToolTip.add(GuiText.Installed.withSuffix(": " + (myStack.getStackSize())));
currentToolTip.add(GuiText.EnergyDrain
.withSuffix(": " + Platform.formatPowerLong(myStack.getCountRequestable(), true)));
currentToolTip.add(GuiText.Installed.getLocal() + ": " + (myStack.getStackSize()));
currentToolTip.add(GuiText.EnergyDrain.getLocal() + ": "
+ Platform.formatPowerLong(myStack.getCountRequestable(), true));
this.drawTooltip(matrixStack, x, y, currentToolTip);
this.drawTooltip(x, y, currentToolTip);
}
}
super.renderTooltip(matrixStack, stack, x, y);
super.renderTooltip(stack, x, y);
}
@Override
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -56,20 +54,17 @@ public class NetworkToolScreen extends AEBaseScreen<NetworkToolContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
if (this.tFacades != null) {
this.tFacades.setState(container.isFacadeMode());
}
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.NetworkTool.text()).getString(), 8, 6,
4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.font.drawString(this.getGuiDisplayName(GuiText.NetworkTool.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/toolbox.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -3,13 +3,9 @@ package appeng.client.gui.implementations;
import java.util.function.Consumer;
import java.util.function.LongConsumer;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.IGuiEventListener;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import appeng.client.gui.AEBaseScreen;
import appeng.client.gui.NumberEntryType;
@@ -23,9 +19,6 @@ import appeng.core.AEConfig;
*/
public class NumberEntryWidget implements ITickingWidget {
private static final ITextComponent PLUS = new StringTextComponent("+");
private static final ITextComponent MINUS = new StringTextComponent("+");
private final AEBaseScreen<?> parent;
private final int x;
@@ -93,18 +86,18 @@ public class NumberEntryWidget implements ITickingWidget {
int left = parent.getGuiLeft() + x;
int top = parent.getGuiTop() + y;
addButton.accept(this.plus1 = new Button(left, top, 22, 20, PLUS /* + a */, btn -> addQty(a)));
addButton.accept(this.plus10 = new Button(left + 28, top, 28, 20, PLUS /* + b */, btn -> addQty(b)));
addButton.accept(this.plus100 = new Button(left + 62, top, 32, 20, PLUS /* + c */, btn -> addQty(c)));
addButton.accept(this.plus1000 = new Button(left + 100, top, 38, 20, PLUS/* + d */, btn -> addQty(d)));
addButton.accept(this.plus1 = new Button(left, top, 22, 20, "+" + a, btn -> addQty(a)));
addButton.accept(this.plus10 = new Button(left + 28, top, 28, 20, "+" + b, btn -> addQty(b)));
addButton.accept(this.plus100 = new Button(left + 62, top, 32, 20, "+" + c, btn -> addQty(c)));
addButton.accept(this.plus1000 = new Button(left + 100, top, 38, 20, "+" + d, btn -> addQty(d)));
// Placing this here will give a sensible tab order
addChildren.accept(this.level);
addButton.accept(this.minus1 = new Button(left, top + 42, 22, 20, MINUS /* + a */, btn -> addQty(-a)));
addButton.accept(this.minus10 = new Button(left + 28, top + 42, 28, 20, MINUS /* + b */, btn -> addQty(-b)));
addButton.accept(this.minus100 = new Button(left + 62, top + 42, 32, 20, MINUS /* + c */, btn -> addQty(-c)));
addButton.accept(this.minus1000 = new Button(left + 100, top + 42, 38, 20, MINUS /* + d */, btn -> addQty(-d)));
addButton.accept(this.minus1 = new Button(left, top + 42, 22, 20, "-" + a, btn -> addQty(-a)));
addButton.accept(this.minus10 = new Button(left + 28, top + 42, 28, 20, "-" + b, btn -> addQty(-b)));
addButton.accept(this.minus100 = new Button(left + 62, top + 42, 32, 20, "-" + c, btn -> addQty(-c)));
addButton.accept(this.minus1000 = new Button(left + 100, top + 42, 38, 20, "-" + d, btn -> addQty(-d)));
}
private void addQty(final long i) {
@@ -113,8 +106,8 @@ public class NumberEntryWidget implements ITickingWidget {
this.level.setText(String.valueOf(Math.max(minValue, currentValue + i)));
}
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
this.level.render(matrixStack, mouseX, mouseY, partialTicks);
public void render(int mouseX, int mouseY, float partialTicks) {
this.level.render(mouseX, mouseY, partialTicks);
}
public void setValue(long value, boolean skipNotify) {
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.block.Blocks;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.ItemStack;
@@ -60,12 +58,12 @@ public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer>
super.init();
this.tabCraftButton = new TabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177,
new ItemStack(Blocks.CRAFTING_TABLE), GuiText.CraftingPattern.text(), this.itemRenderer,
new ItemStack(Blocks.CRAFTING_TABLE), GuiText.CraftingPattern.getLocal(), this.itemRenderer,
btn -> toggleCraftMode(CRAFTMODE_PROCESSING));
this.addButton(this.tabCraftButton);
this.tabProcessButton = new TabButton(this.guiLeft + 173, this.guiTop + this.ySize - 177,
new ItemStack(Blocks.FURNACE), GuiText.ProcessingPattern.text(), this.itemRenderer,
new ItemStack(Blocks.FURNACE), GuiText.ProcessingPattern.getLocal(), this.itemRenderer,
btn -> toggleCraftMode(CRAFTMODE_CRFTING));
this.addButton(this.tabProcessButton);
@@ -106,8 +104,7 @@ public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer>
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
if (this.container.isCraftingMode()) {
this.tabCraftButton.visible = true;
this.tabProcessButton.visible = false;
@@ -126,9 +123,9 @@ public class PatternTermScreen extends MEMonitorableScreen<PatternTermContainer>
this.substitutionsDisabledBtn.visible = false;
}
super.drawFG(matrixStack, offsetX, offsetY, mouseX, mouseY);
this.font.drawString(matrixStack, GuiText.PatternTerminal.getLocal(), 8,
this.ySize - 96 + 2 - this.getReservedSpace(), 4210752);
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.font.drawString(GuiText.PatternTerminal.getLocal(), 8, this.ySize - 96 + 2 - this.getReservedSpace(),
4210752);
}
@Override
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -60,18 +58,16 @@ public class PriorityScreen extends AEBaseScreen<PriorityContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, GuiText.Priority.getLocal(), 8, 6, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.Priority.getLocal(), 8, 6, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture(getBackground());
blit(matrixStack, offsetX, offsetY, 0, 0, this.xSize, this.ySize);
blit(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
this.priority.render(matrixStack, mouseX, mouseY, partialTicks);
this.priority.render(mouseX, mouseY, partialTicks);
}
protected String getBackground() {
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -36,16 +34,13 @@ public class QNBScreen extends AEBaseScreen<QNBContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.QuantumLinkChamber.text()).getString(), 8, 6,
4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.QuantumLinkChamber.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/chest.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -18,15 +18,12 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.util.InputMappings;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.ActionKey;
@@ -50,8 +47,7 @@ public class QuartzKnifeScreen extends AEBaseScreen<QuartzKnifeContainer> {
public void init() {
super.init();
this.name = new TextFieldWidget(this.font, this.guiLeft + 24, this.guiTop + 32, 79, this.font.FONT_HEIGHT,
StringTextComponent.EMPTY);
this.name = new TextFieldWidget(this.font, this.guiLeft + 24, this.guiTop + 32, 79, this.font.FONT_HEIGHT, "");
this.name.setEnableBackgroundDrawing(false);
this.name.setMaxStringLength(32);
this.name.setTextColor(0xFFFFFF);
@@ -60,19 +56,16 @@ public class QuartzKnifeScreen extends AEBaseScreen<QuartzKnifeContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.QuartzCuttingKnife.text()).getString(), 8, 6,
4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.QuartzCuttingKnife.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/quartzknife.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
this.name.render(matrixStack, mouseX, mouseY, partialTicks);
this.name.render(mouseX, mouseY, partialTicks);
}
@Override
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -82,11 +80,10 @@ public class SecurityStationScreen extends MEMonitorableScreen<SecurityStationCo
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
super.drawFG(matrixStack, offsetX, offsetY, mouseX, mouseY);
this.font.drawString(matrixStack, GuiText.SecurityCardEditor.getLocal(), 8,
this.ySize - 96 + 1 - this.getReservedSpace(), 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
super.drawFG(offsetX, offsetY, mouseX, mouseY);
this.font.drawString(GuiText.SecurityCardEditor.getLocal(), 8, this.ySize - 96 + 1 - this.getReservedSpace(),
4210752);
}
@Override
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
@@ -40,15 +38,13 @@ public class SkyChestScreen extends AEBaseScreen<SkyChestContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.SkyChest.text()).getString(), 8, 8, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.SkyChest.getLocal()), 8, 8, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 4210752);
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
bindTexture(TEXTURE);
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, 0);
}
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -45,37 +43,33 @@ public class SpatialIOPortScreen extends AEBaseScreen<SpatialIOPortContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, GuiText.StoredPower.getLocal() + ": "
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(GuiText.StoredPower.getLocal() + ": "
+ Platform.formatPowerLong(this.container.getCurrentPower(), false), 13, 21, 4210752);
this.font.drawString(matrixStack,
this.font.drawString(
GuiText.MaxPower.getLocal() + ": " + Platform.formatPowerLong(this.container.getMaxPower(), false), 13,
31, 4210752);
this.font.drawString(matrixStack, GuiText.RequiredPower.getLocal() + ": "
this.font.drawString(GuiText.RequiredPower.getLocal() + ": "
+ Platform.formatPowerLong(this.container.getRequiredPower(), false), 13, 73, 4210752);
this.font.drawString(matrixStack,
this.font.drawString(
GuiText.Efficiency.getLocal() + ": " + (((float) this.container.getEfficency()) / 100) + '%', 13, 83,
4210752);
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.SpatialIOPort.text()).getString(), 8, 6,
4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752);
this.font.drawString(this.getGuiDisplayName(GuiText.SpatialIOPort.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96, 4210752);
if (this.container.xSize != 0 && this.container.ySize != 0 && this.container.zSize != 0) {
final String text = GuiText.SCSSize.getLocal() + ": " + this.container.xSize + "x" + this.container.ySize
+ "x" + this.container.zSize;
this.font.drawString(matrixStack, text, 13, 93, 4210752);
this.font.drawString(text, 13, 93, 4210752);
} else {
this.font.drawString(matrixStack, GuiText.SCSSize.getLocal() + ": " + GuiText.SCSInvalid.getLocal(), 13, 93,
4210752);
this.font.drawString(GuiText.SCSSize.getLocal() + ": " + GuiText.SCSInvalid.getLocal(), 13, 93, 4210752);
}
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/spatialio.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
@@ -60,7 +58,7 @@ public class StorageBusScreen extends UpgradeableScreen<StorageBusContainer> {
this.fuzzyMode = new ServerSettingToggleButton<>(this.guiLeft - 18, this.guiTop + 88, Settings.FUZZY_MODE,
FuzzyMode.IGNORE_ALL);
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.text(),
this.addButton(new TabButton(this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(),
this.itemRenderer, btn -> openPriorityGui()));
this.addButton(this.storageFilter);
@@ -69,10 +67,9 @@ public class StorageBusScreen extends UpgradeableScreen<StorageBusContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.StorageBus.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.StorageBus.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.fuzzyMode != null) {
this.fuzzyMode.set(this.cvb.getFuzzyMode());
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -84,10 +82,9 @@ public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScr
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(this.getName().text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(this.getName().getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (this.redstoneMode != null) {
this.redstoneMode.set(this.cvb.getRedStoneMode());
@@ -107,8 +104,7 @@ public class UpgradeableScreen<T extends UpgradeableContainer> extends AEBaseScr
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.handleButtonVisibility();
this.bindTexture(this.getBackground());
@@ -18,12 +18,10 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.client.gui.AEBaseScreen;
@@ -52,14 +50,12 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.VibrationChamber.text()).getString(), 8, 6,
4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.VibrationChamber.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
this.pb.setFullMsg(new StringTextComponent(VibrationChamberTileEntity.POWER_PER_TICK
* this.container.getCurrentProgress() / VibrationChamberTileEntity.DILATION_SCALING + " AE/t"));
this.pb.setFullMsg(VibrationChamberTileEntity.POWER_PER_TICK * this.container.getCurrentProgress()
/ VibrationChamberTileEntity.DILATION_SCALING + " AE/t");
if (this.container.getRemainingBurnTime() > 0) {
final int i1 = this.container.getRemainingBurnTime() * 12 / 100;
@@ -72,8 +68,7 @@ public class VibrationChamberScreen extends AEBaseScreen<VibrationChamberContain
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/vibchamber.png");
this.pb.x = 99 + this.guiLeft;
this.pb.y = 36 + this.guiTop;
@@ -18,8 +18,6 @@
package appeng.client.gui.implementations;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.text.ITextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
@@ -45,10 +43,9 @@ public class WirelessScreen extends AEBaseScreen<WirelessContainer> {
}
@Override
public void drawFG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY) {
this.font.drawString(matrixStack, this.getGuiDisplayName(GuiText.Wireless.text()).getString(), 8, 6, 4210752);
this.font.drawString(matrixStack, GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
this.font.drawString(this.getGuiDisplayName(GuiText.Wireless.getLocal()), 8, 6, 4210752);
this.font.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752);
if (container.getRange() > 0) {
final String firstMessage = GuiText.Range.getLocal() + ": " + (container.getRange() / 10.0) + " m";
@@ -58,14 +55,13 @@ public class WirelessScreen extends AEBaseScreen<WirelessContainer> {
final int strWidth = Math.max(this.font.getStringWidth(firstMessage),
this.font.getStringWidth(secondMessage));
final int cOffset = (this.xSize / 2) - (strWidth / 2);
this.font.drawString(matrixStack, firstMessage, cOffset, 20, 4210752);
this.font.drawString(matrixStack, secondMessage, cOffset, 20 + 12, 4210752);
this.font.drawString(firstMessage, cOffset, 20, 4210752);
this.font.drawString(secondMessage, cOffset, 20 + 12, 4210752);
}
}
@Override
public void drawBG(MatrixStack matrixStack, final int offsetX, final int offsetY, final int mouseX,
final int mouseY, float partialTicks) {
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY, float partialTicks) {
this.bindTexture("guis/wireless.png");
GuiUtils.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize, getBlitOffset());
}
@@ -18,7 +18,6 @@
package appeng.client.gui.widgets;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
@@ -27,7 +26,6 @@ import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.text.StringTextComponent;
/**
* A modified version of the Minecraft text field. You can initialize it over
@@ -54,11 +52,10 @@ public class AETextField extends TextFieldWidget {
*/
public AETextField(final FontRenderer fontRenderer, final int xPos, final int yPos, final int width,
final int height) {
super(fontRenderer, xPos + PADDING, yPos + PADDING,
width - 2 * PADDING - (int) fontRenderer.getStringWidth("_"), height - 2 * PADDING,
StringTextComponent.EMPTY);
super(fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - (int) fontRenderer.getCharWidth('_'),
height - 2 * PADDING, "");
this._fontPad = (int) fontRenderer.getStringWidth("_");
this._fontPad = (int) fontRenderer.getCharWidth('_');
}
public void selectAll() {
@@ -71,18 +68,16 @@ public class AETextField extends TextFieldWidget {
}
@Override
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partial) {
public void renderButton(int mouseX, int mouseY, float partial) {
if (this.getVisible()) {
if (this.isFocused()) {
fill(matrixStack, this.x - PADDING + 1, this.y - PADDING + 1,
this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFF606060);
fill(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(matrixStack, this.x - PADDING + 1, this.y - PADDING + 1,
this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
0xFFA8A8A8);
fill(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(matrixStack, mouseX, mouseY, partial);
super.renderButton(mouseX, mouseY, partial);
}
}
@@ -21,9 +21,6 @@ package appeng.client.gui.widgets;
import java.util.function.Consumer;
import java.util.regex.Pattern;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import appeng.api.config.ActionItems;
import appeng.core.localization.ButtonToolTips;
@@ -79,9 +76,9 @@ public class ActionButton extends IconButton {
return iconIndex;
}
private ITextComponent buildMessage(ButtonToolTips displayName, ButtonToolTips displayValue) {
String name = displayName.text().getString();
String value = displayValue.text().getString();
private String buildMessage(ButtonToolTips displayName, ButtonToolTips displayValue) {
String name = displayName.getTranslationKey().getString();
String value = displayValue.getTranslationKey().getString();
value = PATTERN_NEW_LINE.matcher(value).replaceAll("\n");
final StringBuilder sb = new StringBuilder(value);
@@ -94,7 +91,7 @@ public class ActionButton extends IconButton {
sb.replace(i, i + 1, "\n");
}
return new StringTextComponent(name + '\n' + sb);
return name + '\n' + sb;
}
}
@@ -1,14 +1,10 @@
package appeng.client.gui.widgets;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.AbstractGui;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
public abstract class CustomSlotWidget extends AbstractGui implements ITooltip {
private final int x;
@@ -32,15 +28,14 @@ public abstract class CustomSlotWidget extends AbstractGui implements ITooltip {
public void slotClicked(final ItemStack clickStack, final int mouseButton) {
}
public abstract void drawContent(MatrixStack matrixStack, final Minecraft mc, final int mouseX, final int mouseY,
final float partialTicks);
public abstract void drawContent(final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks);
public void drawBackground(int guileft, int guitop, int currentZIndex) {
}
@Override
public ITextComponent getTooltipMessage() {
return StringTextComponent.EMPTY;
public String getTooltipMessage() {
return null;
}
@Override
@@ -18,25 +18,17 @@
package appeng.client.gui.widgets;
import javax.annotation.Nonnull;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
/**
* AEBaseGui controlled Tooltip Interface.
*/
public interface ITooltip {
/**
* Returns the tooltip message.
*
* Should use {@link StringTextComponent#EMPTY} for no tooltip
* returns the tooltip message.
*
* @return tooltip message
*/
@Nonnull
ITextComponent getTooltipMessage();
String getTooltipMessage();
/**
* x Location for the object that triggers the tooltip.
@@ -18,15 +18,12 @@
package appeng.client.gui.widgets;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
public abstract class IconButton extends Button implements ITooltip {
@@ -36,7 +33,7 @@ public abstract class IconButton extends Button implements ITooltip {
private boolean halfSize = false;
public IconButton(final int x, final int y, IPressable onPress) {
super(x, y, 16, 16, StringTextComponent.EMPTY, onPress);
super(x, y, 16, 16, "", onPress);
}
public void setVisibility(final boolean vis) {
@@ -45,7 +42,7 @@ public abstract class IconButton extends Button implements ITooltip {
}
@Override
public void renderButton(MatrixStack matrixStack, final int mouseX, final int mouseY, float partial) {
public void renderButton(final int mouseX, final int mouseY, float partial) {
Minecraft minecraft = Minecraft.getInstance();
@@ -98,7 +95,7 @@ public abstract class IconButton extends Button implements ITooltip {
protected abstract int getIconIndex();
@Override
public ITextComponent getTooltipMessage() {
public String getTooltipMessage() {
return getMessage();
}
@@ -22,7 +22,6 @@ import java.util.function.LongConsumer;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.util.text.StringTextComponent;
public class NumberBox extends TextFieldWidget {
@@ -36,7 +35,7 @@ public class NumberBox extends TextFieldWidget {
public NumberBox(final FontRenderer fontRenderer, final int x, final int y, final int width, final int height,
final Class<?> type, LongConsumer changeListener) {
super(fontRenderer, x, y, width, height, new StringTextComponent("0"));
super(fontRenderer, x, y, width, height, "0");
this.setText("0");
setResponder(this::handleTextChanged);
this.lastValue = 0;
@@ -18,13 +18,9 @@
package appeng.client.gui.widgets;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.Widget;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
import appeng.container.interfaces.IProgressProvider;
@@ -37,8 +33,8 @@ public class ProgressBar extends Widget implements ITooltip {
private final int fill_u;
private final int fill_v;
private final Direction layout;
private final ITextComponent titleName;
private ITextComponent fullMsg;
private final String titleName;
private String fullMsg;
public ProgressBar(final IProgressProvider source, final String texture, final int posX, final int posY,
final int u, final int y, final int width, final int height, final Direction dir) {
@@ -46,9 +42,8 @@ public class ProgressBar extends Widget implements ITooltip {
}
public ProgressBar(final IProgressProvider source, final String texture, final int posX, final int posY,
final int u, final int y, final int width, final int height, final Direction dir,
final ITextComponent title) {
super(posX, posY, width, height, StringTextComponent.EMPTY);
final int u, final int y, final int width, final int height, final Direction dir, final String title) {
super(posX, posY, width, height, "");
this.source = source;
this.texture = new ResourceLocation("appliedenergistics2", "textures/" + texture);
this.fill_u = u;
@@ -58,7 +53,7 @@ public class ProgressBar extends Widget implements ITooltip {
}
@Override
public void renderButton(MatrixStack matrixStack, final int par2, final int par3, final float partial) {
public void renderButton(final int par2, final int par3, final float partial) {
if (this.visible) {
Minecraft.getInstance().getTextureManager().bindTexture(this.texture);
final int max = this.source.getMaxProgress();
@@ -76,19 +71,18 @@ public class ProgressBar extends Widget implements ITooltip {
}
}
public void setFullMsg(final ITextComponent msg) {
public void setFullMsg(final String msg) {
this.fullMsg = msg;
}
@Override
public ITextComponent getTooltipMessage() {
public String getTooltipMessage() {
if (this.fullMsg != null) {
return this.fullMsg;
}
ITextComponent result = this.titleName != null ? this.titleName : StringTextComponent.EMPTY;
return result.deepCopy().appendString("\n").appendString(this.source.getCurrentProgress() + " ")
.append(GuiText.Of.text().deepCopy().appendString(" " + this.source.getMaxProgress()));
return (this.titleName != null ? this.titleName : "") + '\n' + this.source.getCurrentProgress() + ' '
+ GuiText.Of.getLocal() + ' ' + this.source.getMaxProgress();
}
@Override
@@ -27,7 +27,6 @@ import java.util.regex.Pattern;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import appeng.api.config.AccessRestriction;
import appeng.api.config.CondenserOutput;
@@ -237,7 +236,7 @@ public class SettingToggleButton<T extends Enum<T>> extends IconButton {
private static void registerApp(final int iconIndex, final Settings setting, final Enum<?> val,
final ButtonToolTips title, final ITextComponent hint) {
final ButtonAppearance a = new ButtonAppearance();
a.displayName = title.text();
a.displayName = title.getTranslationKey();
a.displayValue = hint;
a.index = iconIndex;
appearances.put(new EnumPair(setting, val), a);
@@ -245,7 +244,7 @@ public class SettingToggleButton<T extends Enum<T>> extends IconButton {
private static void registerApp(final int iconIndex, final Settings setting, final Enum<?> val,
final ButtonToolTips title, final ButtonToolTips hint) {
registerApp(iconIndex, setting, val, title, hint.text());
registerApp(iconIndex, setting, val, title, hint.getTranslationKey());
}
@Override
@@ -279,7 +278,7 @@ public class SettingToggleButton<T extends Enum<T>> extends IconButton {
}
@Override
public ITextComponent getTooltipMessage() {
public String getTooltipMessage() {
ITextComponent displayName = null;
ITextComponent displayValue = null;
@@ -287,7 +286,7 @@ public class SettingToggleButton<T extends Enum<T>> extends IconButton {
final ButtonAppearance buttonAppearance = appearances
.get(new EnumPair(this.buttonSetting, this.currentValue));
if (buttonAppearance == null) {
return new StringTextComponent("No Such Message");
return "No Such Message";
}
displayName = buttonAppearance.displayName;
@@ -313,9 +312,9 @@ public class SettingToggleButton<T extends Enum<T>> extends IconButton {
sb.replace(i, i + 1, "\n");
}
return new StringTextComponent(name + '\n' + sb);
return name + '\n' + sb;
}
return StringTextComponent.EMPTY;
return "";
}
public String getFillVar() {
@@ -18,7 +18,6 @@
package appeng.client.gui.widgets;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
@@ -27,7 +26,6 @@ import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
public class TabButton extends Button implements ITooltip {
public static final ResourceLocation TEXTURE_STATES = new ResourceLocation("appliedenergistics2",
@@ -37,7 +35,7 @@ public class TabButton extends Button implements ITooltip {
private int myIcon = -1;
private ItemStack myItem;
public TabButton(final int x, final int y, final int ico, final ITextComponent message, final ItemRenderer ir,
public TabButton(final int x, final int y, final int ico, final String message, final ItemRenderer ir,
IPressable onPress) {
super(x, y, 22, 22, message, onPress);
@@ -54,7 +52,7 @@ public class TabButton extends Button implements ITooltip {
* @param message mouse over message
* @param ir renderer
*/
public TabButton(final int x, final int y, final ItemStack ico, final ITextComponent message, final ItemRenderer ir,
public TabButton(final int x, final int y, final ItemStack ico, final String message, final ItemRenderer ir,
IPressable onPress) {
super(x, y, 22, 22, message, onPress);
this.myItem = ico;
@@ -62,7 +60,7 @@ public class TabButton extends Button implements ITooltip {
}
@Override
public void renderButton(MatrixStack matrixStack, final int x, final int y, float partial) {
public void renderButton(final int x, final int y, float partial) {
final Minecraft minecraft = Minecraft.getInstance();
if (this.visible) {
@@ -75,13 +73,13 @@ public class TabButton extends Button implements ITooltip {
final int offsetX = this.hideEdge > 0 ? 1 : 0;
blit(matrixStack, this.x, this.y, uv_x * 16, 0, 25, 22);
blit(this.x, this.y, uv_x * 16, 0, 25, 22);
if (this.myIcon >= 0) {
final int uv_y = this.myIcon / 16;
uv_x = this.myIcon - uv_y * 16;
blit(matrixStack, offsetX + this.x + 3, this.y + 3, uv_x * 16, uv_y * 16, 16, 16);
blit(offsetX + this.x + 3, this.y + 3, uv_x * 16, uv_y * 16, 16, 16);
}
RenderSystem.disableAlphaTest();
@@ -99,7 +97,7 @@ public class TabButton extends Button implements ITooltip {
}
@Override
public ITextComponent getTooltipMessage() {
public String getTooltipMessage() {
return getMessage();
}
@@ -20,15 +20,12 @@ package appeng.client.gui.widgets;
import java.util.regex.Pattern;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.widget.button.Button;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.fml.client.gui.GuiUtils;
public class ToggleButton extends Button implements ITooltip {
@@ -45,7 +42,7 @@ public class ToggleButton extends Button implements ITooltip {
public ToggleButton(final int x, final int y, final int on, final int off, final String displayName,
final String displayHint, IPressable onPress) {
super(x, y, 16, 16, StringTextComponent.EMPTY, onPress);
super(x, y, 16, 16, "", onPress);
this.iconIdxOn = on;
this.iconIdxOff = off;
this.displayName = displayName;
@@ -57,7 +54,7 @@ public class ToggleButton extends Button implements ITooltip {
}
@Override
public void renderButton(MatrixStack matrixStack, final int mouseX, final int mouseY, final float partial) {
public void renderButton(final int mouseX, final int mouseY, final float partial) {
if (this.visible) {
final int iconIndex = this.getIconIndex();
@@ -77,7 +74,7 @@ public class ToggleButton extends Button implements ITooltip {
}
@Override
public ITextComponent getTooltipMessage() {
public String getTooltipMessage() {
if (this.displayName != null) {
String name = I18n.format(this.displayName);
String value = I18n.format(this.displayHint);
@@ -100,9 +97,9 @@ public class ToggleButton extends Button implements ITooltip {
sb.replace(i, i + 1, "\n");
}
return new StringTextComponent(name + '\n' + sb);
return name + '\n' + sb;
}
return StringTextComponent.EMPTY;
return "";
}
@Override
@@ -36,7 +36,7 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv> {
public ClientDCInternalInv(final int size, final long id, final long sortBy, final ITextComponent name) {
this.inventory = new AppEngInternalInventory(null, size);
this.searchName = name.getString().toLowerCase();
this.formattedName = name.getString(); // FIXME FABRIC no longer formatted!
this.formattedName = name.getFormattedText();
this.id = id;
this.sortBy = sortBy;
}
@@ -41,11 +41,6 @@ import appeng.fluids.util.FluidSorters;
import appeng.util.Platform;
import appeng.util.prioritylist.IPartitionList;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class FluidRepo {
private final IItemList<IAEFluidStack> list = Api.instance().storage().getStorageChannel(IFluidStorageChannel.class)
.createList();
@@ -29,13 +29,13 @@ public class SlotDisconnected extends AppEngSlot {
private final ClientDCInternalInv mySlot;
public SlotDisconnected(final ClientDCInternalInv me, final int invSlot, final int x, final int y) {
super(me.getInventory(), invSlot, x, y);
public SlotDisconnected(final ClientDCInternalInv me, final int which, final int x, final int y) {
super(me.getInventory(), which, x, y);
this.mySlot = me;
}
@Override
public boolean isItemValid(final ItemStack stack) {
public boolean isItemValid(final ItemStack par1ItemStack) {
return false;
}
@@ -45,7 +45,7 @@ public class SlotDisconnected extends AppEngSlot {
}
@Override
public boolean canTakeStack(final PlayerEntity player) {
public boolean canTakeStack(final PlayerEntity par1PlayerEntity) {
return false;
}
+11 -12
View File
@@ -21,23 +21,22 @@ package appeng.client.me;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import appeng.api.storage.data.IAEFluidStack;
import appeng.fluids.container.slots.IMEFluidSlot;
/**
* @author BrockWS
* @version rv6 - 22/05/2018
* @since rv6 22/05/2018
*/
public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
public class SlotFluidME extends Slot implements IMEFluidSlot {
private InternalFluidSlotME slot;
private static final IInventory EMPTY_INVENTORY = new Inventory(0);
private final InternalFluidSlotME slot;
public SlotFluidME(InternalFluidSlotME slot) {
super(null, 0, slot.getxPosition(), slot.getyPosition());
super(EMPTY_INVENTORY, 0, slot.getxPosition(), slot.getyPosition());
this.slot = slot;
}
@@ -50,7 +49,7 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
}
@Override
public boolean isItemValid(final ItemStack par1ItemStack) {
public boolean isItemValid(final ItemStack stack) {
return false;
}
@@ -69,7 +68,7 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
}
@Override
public void putStack(final ItemStack par1ItemStack) {
public void putStack(final ItemStack stack) {
}
@@ -85,7 +84,7 @@ public class SlotFluidME extends SlotItemHandler implements IMEFluidSlot {
}
@Override
public boolean canTakeStack(final PlayerEntity par1PlayerEntity) {
public boolean canTakeStack(final PlayerEntity player) {
return false;
}
}
+15 -11
View File
@@ -19,23 +19,27 @@
package appeng.client.me;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.SlotItemHandler;
import appeng.api.storage.data.IAEItemStack;
public class SlotME extends SlotItemHandler {
public class SlotME extends Slot {
private final InternalSlotME mySlot;
private static final IInventory EMPTY_INVENTORY = new Inventory(0);
public SlotME(final InternalSlotME me) {
super(null, 0, me.getxPosition(), me.getyPosition());
this.mySlot = me;
private final InternalSlotME slot;
public SlotME(final InternalSlotME slot) {
super(EMPTY_INVENTORY, 0, slot.getxPosition(), slot.getyPosition());
this.slot = slot;
}
public IAEItemStack getAEStack() {
if (this.mySlot.hasPower()) {
return this.mySlot.getAEStack();
if (this.slot.hasPower()) {
return this.slot.getAEStack();
}
return null;
}
@@ -47,15 +51,15 @@ public class SlotME extends SlotItemHandler {
@Override
public ItemStack getStack() {
if (this.mySlot.hasPower()) {
return this.mySlot.getStack();
if (this.slot.hasPower()) {
return this.slot.getStack();
}
return ItemStack.EMPTY;
}
@Override
public boolean getHasStack() {
if (this.mySlot.hasPower()) {
if (this.slot.hasPower()) {
return !this.getStack().isEmpty();
}
return false;
@@ -1,31 +0,0 @@
package appeng.client.render;
import net.minecraft.client.renderer.model.IBakedModel;
/**
* Helper to get a specific baked model class out of a chain of delegating baked
* models.
*/
public final class BakedModelUnwrapper {
private BakedModelUnwrapper() {
}
public static <T> T unwrap(IBakedModel model, Class<T> targetClass) {
if (targetClass.isInstance(model)) {
return targetClass.cast(model);
}
if (model instanceof DelegateBakedModel) {
model = ((DelegateBakedModel) model).getBaseModel();
if (targetClass.isInstance(model)) {
return targetClass.cast(model);
} else {
return unwrap(model, targetClass);
}
}
return null;
}
}
@@ -1,42 +0,0 @@
package appeng.client.render;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
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.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
import net.minecraftforge.client.model.geometry.IModelGeometry;
/**
* An unbaked model that has standard models as a dependency and produces a
* custom baked model as a result.
*/
public interface BasicUnbakedModel<T extends IModelGeometry<T>> extends IModelGeometry<T> {
default Collection<ResourceLocation> getModelDependencies() {
return Collections.emptyList();
}
default Stream<RenderMaterial> getAdditionalTextures() {
return Stream.empty();
}
@Override
default Collection<RenderMaterial> getTextures(IModelConfiguration owner,
Function<ResourceLocation, IUnbakedModel> unbakedModelGetter,
Set<Pair<String, String>> unresolvedTextureReferences) {
return Stream.concat(
getModelDependencies().stream().map(unbakedModelGetter)
.flatMap(ubm -> ubm.getTextures(unbakedModelGetter, unresolvedTextureReferences).stream()),
getAdditionalTextures()).collect(Collectors.toList());
}
}
@@ -24,7 +24,7 @@ import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.ILightReader;
import appeng.api.implementations.tiles.IColorableTile;
import appeng.api.util.AEColor;
@@ -37,8 +37,7 @@ public class ColorableTileBlockColor implements IBlockColor {
public static final ColorableTileBlockColor INSTANCE = new ColorableTileBlockColor();
@Override
public int getColor(BlockState state, @Nullable IBlockDisplayReader worldIn, @Nullable BlockPos pos,
int tintIndex) {
public int getColor(BlockState state, @Nullable ILightReader worldIn, @Nullable BlockPos pos, int tintIndex) {
AEColor color = AEColor.TRANSPARENT; // Default to a neutral color
if (worldIn != null && pos != null) {
@@ -28,19 +28,19 @@ import javax.annotation.Nullable;
import com.google.common.collect.ImmutableList;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ItemLayerModel;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
@@ -53,10 +53,10 @@ import appeng.fluids.items.FluidDummyItem;
* Override List is used to accomplish this.
*/
public class DummyFluidDispatcherBakedModel extends DelegateBakedModel {
private final Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter;
private final Function<Material, TextureAtlasSprite> bakedTextureGetter;
public DummyFluidDispatcherBakedModel(IBakedModel baseModel,
Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter) {
Function<Material, TextureAtlasSprite> bakedTextureGetter) {
super(baseModel);
this.bakedTextureGetter = bakedTextureGetter;
}
@@ -86,7 +86,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel {
public ItemOverrideList getOverrides() {
return new ItemOverrideList() {
@Override
public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, ClientWorld world,
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, World world,
LivingEntity entity) {
if (!(stack.getItem() instanceof FluidDummyItem)) {
return originalModel;
@@ -101,7 +101,7 @@ public class DummyFluidDispatcherBakedModel extends DelegateBakedModel {
FluidAttributes attributes = fluidStack.getFluid().getAttributes();
ResourceLocation stillTexture = attributes.getStillTexture(fluidStack);
RenderMaterial stillMaterial = new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE, stillTexture);
Material stillMaterial = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, stillTexture);
TextureAtlasSprite sprite = DummyFluidDispatcherBakedModel.this.bakedTextureGetter.apply(stillMaterial);
if (sprite == null) {
return new DummyFluidBakedModel(ImmutableList.of());
@@ -29,8 +29,8 @@ import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
@@ -49,7 +49,7 @@ public class DummyFluidItemModel implements IModelGeometry<DummyFluidItemModel>
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery,
Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
ItemOverrideList overrides, ResourceLocation modelLocation) {
IBakedModel bakedBaseModel = bakery.getBakedModel(MODEL_BASE, modelTransform, spriteGetter);
@@ -57,7 +57,7 @@ public class DummyFluidItemModel implements IModelGeometry<DummyFluidItemModel>
}
@Override
public Collection<RenderMaterial> getTextures(IModelConfiguration owner,
public Collection<Material> getTextures(IModelConfiguration owner,
Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return Collections.emptyList();
}
@@ -22,9 +22,9 @@ import java.util.Objects;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
@@ -50,7 +50,7 @@ public class FacadeDispatcherBakedModel extends DelegateBakedModel {
public ItemOverrideList getOverrides() {
return new ItemOverrideList() {
@Override
public IBakedModel func_239290_a_(IBakedModel originalModel, ItemStack stack, ClientWorld world,
public IBakedModel getModelWithOverrides(IBakedModel originalModel, ItemStack stack, World world,
LivingEntity entity) {
if (!(stack.getItem() instanceof FacadeItem)) {
return originalModel;
@@ -19,17 +19,21 @@
package appeng.client.render;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import java.util.function.Function;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.IModelTransform;
import net.minecraft.client.renderer.model.IUnbakedModel;
import net.minecraft.client.renderer.model.ItemOverrideList;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import appeng.client.render.cablebus.FacadeBuilder;
import appeng.core.AppEng;
@@ -38,14 +42,14 @@ import appeng.core.AppEng;
* The model class for facades. Since facades wrap existing models, they don't
* declare any dependencies here other than the cable anchor.
*/
public class FacadeItemModel implements BasicUnbakedModel<FacadeItemModel> {
public class FacadeItemModel implements IModelGeometry<FacadeItemModel> {
// We use this to get the default item transforms and make our lives easier
private static final ResourceLocation MODEL_BASE = new ResourceLocation(AppEng.MOD_ID, "item/facade_base");
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery,
Function<RenderMaterial, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform,
ItemOverrideList overrides, ResourceLocation modelLocation) {
IBakedModel bakedBaseModel = bakery.getBakedModel(MODEL_BASE, modelTransform, spriteGetter);
FacadeBuilder facadeBuilder = new FacadeBuilder();
@@ -54,7 +58,9 @@ public class FacadeItemModel implements BasicUnbakedModel<FacadeItemModel> {
}
@Override
public Collection<ResourceLocation> getModelDependencies() {
return Collections.singleton(MODEL_BASE);
public Collection<Material> getTextures(IModelConfiguration owner,
Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return modelGetter.apply(MODEL_BASE).getTextures(modelGetter, missingTextureErrors);
}
}
@@ -20,13 +20,13 @@ package appeng.client.render;
import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.renderer.Matrix4f;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.Vector4f;
import net.minecraft.util.Direction;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.util.math.vector.Vector3i;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.math.Vec3i;
/**
* TODO: Removed useless stuff.
@@ -90,7 +90,7 @@ public enum FacingToRotation implements IStringSerializable {
}
public Direction rotate(Direction facing) {
Vector3i dir = facing.getDirectionVec();
Vec3i dir = facing.getDirectionVec();
Vector4f vec = new Vector4f(dir.getX(), dir.getY(), dir.getZ(), 1);
vec.transform(mat);
return Direction.getFacingFromVector(vec.getX(), vec.getY(), vec.getZ());
@@ -110,7 +110,7 @@ public enum FacingToRotation implements IStringSerializable {
}
@Override
public String getString() {
public String getName() {
return name().toLowerCase();
}
}
@@ -25,13 +25,18 @@ import com.mojang.blaze3d.systems.RenderSystem;
import org.lwjgl.opengl.GL11;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.Quaternion;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.math.vector.Quaternion;
import net.minecraft.client.world.ClientWorld;
import net.minecraftforge.client.IRenderHandler;
import net.minecraftforge.client.SkyRenderHandler;
public class SpatialSkyRender {
//TODO https://github.com/MinecraftForge/MinecraftForge/pull/6537
public class SpatialSkyRender implements SkyRenderHandler {
private static final SpatialSkyRender INSTANCE = new SpatialSkyRender();
@@ -43,7 +48,7 @@ public class SpatialSkyRender {
this.dspList = GL11.glGenLists(1);
}
public static SpatialSkyRender getInstance() {
public static IRenderHandler getInstance() {
return INSTANCE;
}
@@ -51,7 +56,8 @@ public class SpatialSkyRender {
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) {
@Override
public void render(int ticks, float partialTicks, MatrixStack matrixStack, ClientWorld world, Minecraft mc) {
final long now = System.currentTimeMillis();
if (now - this.cycle > 2000) {
this.cycle = now;
@@ -23,8 +23,8 @@ import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.math.vector.TransformationMatrix;
import net.minecraft.util.math.vector.Vector3f;
import net.minecraft.client.renderer.TransformationMatrix;
import net.minecraft.client.renderer.Vector3f;
import appeng.api.storage.data.IAEItemStack;
import appeng.core.AEConfig;
@@ -23,7 +23,7 @@ import javax.annotation.Nullable;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockDisplayReader;
import net.minecraft.world.ILightReader;
import appeng.api.util.AEColor;
@@ -39,8 +39,7 @@ public class StaticBlockColor implements IBlockColor {
}
@Override
public int getColor(BlockState state, @Nullable IBlockDisplayReader worldIn, @Nullable BlockPos pos,
int tintIndex) {
public int getColor(BlockState state, @Nullable ILightReader worldIn, @Nullable BlockPos pos, int tintIndex) {
return this.color.getVariantByTintIndex(tintIndex);
}
@@ -23,11 +23,11 @@ import com.mojang.blaze3d.matrix.MatrixStack;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.IRenderTypeBuffer;
import net.minecraft.client.renderer.Vector3f;
import net.minecraft.client.renderer.model.ItemCameraTransforms;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.Vector3f;
import appeng.api.storage.data.IAEItemStack;
import appeng.util.IWideReadableNumberConverter;
@@ -26,7 +26,7 @@ import java.util.List;
import java.util.function.Function;
import net.minecraft.client.renderer.model.BakedQuad;
import net.minecraft.client.renderer.model.RenderMaterial;
import net.minecraft.client.renderer.model.Material;
import net.minecraft.client.renderer.texture.AtlasTexture;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.Direction;
@@ -49,7 +49,7 @@ class CableBuilder {
private final SmartCableTextures smartCableTextures;
CableBuilder(Function<RenderMaterial, TextureAtlasSprite> bakedTextureGetter) {
CableBuilder(Function<Material, TextureAtlasSprite> bakedTextureGetter) {
this.coreTextures = new EnumMap<>(CableCoreType.class);
for (CableCoreType type : CableCoreType.values()) {
@@ -77,7 +77,7 @@ class CableBuilder {
this.smartCableTextures = new SmartCableTextures(bakedTextureGetter);
}
static RenderMaterial getConnectionTexture(AECableType cableType, AEColor color) {
static Material getConnectionTexture(AECableType cableType, AEColor color) {
String textureFolder;
switch (cableType) {
case GLASS:
@@ -99,7 +99,7 @@ class CableBuilder {
throw new IllegalStateException("Cable type " + cableType + " does not support connections.");
}
return new RenderMaterial(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE,
new ResourceLocation(AppEng.MOD_ID, textureFolder + color.name().toLowerCase()));
}
@@ -701,8 +701,8 @@ class CableBuilder {
}
// Get all textures needed for building the actual cable quads
public static List<RenderMaterial> getTextures() {
List<RenderMaterial> locations = new ArrayList<>();
public static List<Material> getTextures() {
List<Material> locations = new ArrayList<>();
for (CableCoreType coreType : CableCoreType.values()) {
for (AEColor color : AEColor.values()) {

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