Compare commits
117 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d5372a5ff6 | |||
| c8eb792d38 | |||
| f4ef7edf86 | |||
| 67c733b418 | |||
| fe4db2eb98 | |||
| 2891014cf6 | |||
| e809c688df | |||
| 71a9bb2532 | |||
| 3363acb7db | |||
| 8f6f35b9cf | |||
| ff75f34333 | |||
| e2c0129037 | |||
| 7fe7f4b1c2 | |||
| 693487504c | |||
| 883d9ba49b | |||
| fe8d824526 | |||
| d2250b115f | |||
| e5ab9df086 | |||
| 96af371882 | |||
| bde76d1fb1 | |||
| eb4caaa688 | |||
| 3ba04b3831 | |||
| 7cd8b72bb7 | |||
| 2182b6e37c | |||
| 5d26b98ab8 | |||
| 979531afb7 | |||
| dcf7de9000 | |||
| 87999dbf27 | |||
| c2d18ce013 | |||
| 046a27bf4c | |||
| 841bc6e356 | |||
| e72b5b369c | |||
| d635a87f01 | |||
| 51481d3e30 | |||
| 77e11c7a24 | |||
| 3056bb6ffb | |||
| edc0cef2bb | |||
| 4bd2797f5e | |||
| f37dfd0a24 | |||
| 937ea00e9d | |||
| b431d5d681 | |||
| 0ef854ca4b | |||
| 2c6e50d48a | |||
| dcd94b1cfa | |||
| 89de98f71e | |||
| d16677224a | |||
| 89bebc4385 | |||
| 987ea8d39d | |||
| f4212a86c3 | |||
| 3c4a0cae11 | |||
| 2894a7caa0 | |||
| 044e639827 | |||
| d7b97fa7b8 | |||
| 62435a65f1 | |||
| bf4818cf97 | |||
| 3e09c49e03 | |||
| 9481c9a7d7 | |||
| ccefb47581 | |||
| 59af05aeb1 | |||
| b32834e2b3 | |||
| 6c7cbb7ee1 | |||
| 84c065ff28 | |||
| c9b92a81a3 | |||
| eed4776c6f | |||
| 22807bc619 | |||
| ae352c093e | |||
| 36d6681eac | |||
| 6cffe93970 | |||
| b1472c58d0 | |||
| 96450a76c7 | |||
| ac209053b9 | |||
| dce1aa37eb | |||
| 0b6831e4d7 | |||
| da6d8ba9a8 | |||
| f0e45c7a3c | |||
| cbfc88c87f | |||
| 8c5842aca9 | |||
| 483049f555 | |||
| a7a65ae39d | |||
| 45878df17d | |||
| 98142d8ade | |||
| 7956872d1d | |||
| e243c8e9a2 | |||
| 641d0d40cc | |||
| 50fad685b6 | |||
| 1ad49edd76 | |||
| 7ceaa4cc3e | |||
| b70c86542b | |||
| c1197c0084 | |||
| f0d807f0a2 | |||
| 5fa2c0ab27 | |||
| 3063bd887c | |||
| fac4a8f9dc | |||
| 9d8226da19 | |||
| 33754d289d | |||
| 959672dae3 | |||
| 90c17c09a8 | |||
| e0bf7223e0 | |||
| ba9af94228 | |||
| 122b6163dc | |||
| fab42ccc75 | |||
| f5dd2c8b0a | |||
| a126112a2d | |||
| 99cda5f5a3 | |||
| 56a5363528 | |||
| be65edbd5b | |||
| fe5d9251eb | |||
| 3cf48b2291 | |||
| cc4599b5fc | |||
| c1fa77df51 | |||
| 725fa491e6 | |||
| e2a6cd1d57 | |||
| 6ddf60fab8 | |||
| 2c07acfe81 | |||
| 3749742231 | |||
| 74b9610b45 | |||
| a725779ff6 |
@@ -14,6 +14,7 @@
|
|||||||
* [Building](#building)
|
* [Building](#building)
|
||||||
* [Contribution](#contribution)
|
* [Contribution](#contribution)
|
||||||
* [API](#applied-energistics-2-api)
|
* [API](#applied-energistics-2-api)
|
||||||
|
* [CraftTweaker](#applied-energistics-2-crafttweaker)
|
||||||
* [Localization](#applied-energistics-2-localization)
|
* [Localization](#applied-energistics-2-localization)
|
||||||
* [Credits](#credits)
|
* [Credits](#credits)
|
||||||
|
|
||||||
@@ -26,17 +27,18 @@ A Mod about Matter, Energy and using them to conquer the world..
|
|||||||
* [Website](http://ae-mod.info/)
|
* [Website](http://ae-mod.info/)
|
||||||
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
|
* [IRC #appliedenergistics on esper.net](http://webchat.esper.net/?channels=appliedenergistics&prompt=1)
|
||||||
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
|
* [GitHub](https://github.com/AppliedEnergistics/Applied-Energistics-2)
|
||||||
|
* [Discord](https://discord.gg/GygKjjm)
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
* Applied Energistics 2 API
|
* Applied Energistics 2 API
|
||||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](http://opensource.org/licenses/MIT)
|
- [](http://opensource.org/licenses/MIT)
|
||||||
* Applied Energistics 2
|
* Applied Energistics 2
|
||||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE)
|
- [](https://raw.githubusercontent.com/AppliedEnergistics/Applied-Energistics-2/rv2/LICENSE)
|
||||||
* Textures and Models
|
* Textures and Models
|
||||||
- (c) 2013 - 2017 AlgorithmX2 et al
|
- (c) 2013 - 2018 AlgorithmX2 et al
|
||||||
- [](https://creativecommons.org/licenses/by-nc-sa/3.0/)
|
- [](https://creativecommons.org/licenses/by-nc-sa/3.0/)
|
||||||
* Text and Translations
|
* Text and Translations
|
||||||
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
- [](https://creativecommons.org/publicdomain/zero/1.0/)
|
||||||
@@ -145,14 +147,65 @@ Universal builds obtained [Here](http://ae2.ae-mod.info/Downloads/) should work
|
|||||||
When compiling against the AE2 API you can use gradle dependencies, just add
|
When compiling against the AE2 API you can use gradle dependencies, just add
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile "appeng:appliedenergistics2:rv_-_____-__:dev"
|
compile "appeng:appliedenergistics2:rv_-_____-__:api"
|
||||||
}
|
}
|
||||||
|
|
||||||
or add the compile line to your existing dependencies task to your build.gradle
|
or add the compile line to your existing dependencies task to your build.gradle
|
||||||
|
|
||||||
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
|
Where the __ are filled in with the correct version criteria; AE2 is available from the default forge maven so no additional repositories are necessary.
|
||||||
|
|
||||||
An example string would be `appeng:appliedenergistics2:rv2-alpha-30:dev`
|
An example string would be `appeng:appliedenergistics2:rv5-stable-1:api` for the API only or `appeng:appliedenergistics2:rv5-stable-1` for the whole mod.
|
||||||
|
|
||||||
|
## Applied Energistics 2 CraftTweaker
|
||||||
|
|
||||||
|
### Inscriber
|
||||||
|
Add a recipe. When `inscribe` is true the bottom and top inputs are not consumed.
|
||||||
|
|
||||||
|
mods.appliedenergistics2.Inscriber.addRecipe(ItemStack output, ItemStack input, boolean inscribe,
|
||||||
|
@Optional ItemStack topInput, @Optional ItemStack bottomInput );
|
||||||
|
|
||||||
|
Remove all recipes for this output stack.
|
||||||
|
|
||||||
|
mods.appliedenergistics2.Inscriber.removeRecipe(ItemStack output);
|
||||||
|
|
||||||
|
### Grindstone
|
||||||
|
Add a recipe.
|
||||||
|
|
||||||
|
mods.appliedenergistics2.Grinder.addRecipe( ItemStack output, ItemStack input, int turns,
|
||||||
|
@Optional ItemStack secondary1Output, @Optional float secondary1Chance,
|
||||||
|
@Optional ItemStack secondary2Output, @Optional float secondary2Chance);
|
||||||
|
|
||||||
|
Remove recipes for this input.
|
||||||
|
|
||||||
|
mods.appliedenergistics2.Grinder.removeRecipe(ItemStack input);
|
||||||
|
|
||||||
|
### Spatial
|
||||||
|
Whitelist a TileEntity class for Spatial IO.
|
||||||
|
|
||||||
|
mods.appliedenergistics2.Spatial.whitelistEntity( String fullEntityClassName );
|
||||||
|
|
||||||
|
### Attunement
|
||||||
|
Attune a ItemStack or ModID to a specific P2P-Tunnel type. ModID's are used as fallback when no ItemStack was found.
|
||||||
|
|
||||||
|
mods.appliedenergistics2.Attunement.attuneME( ItemStack itemStack );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneME( String modID );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneItem( ItemStack itemStack );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneItem( String modID );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneFluid( ItemStack itemStack );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneFluid( String modID );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneRedstone( ItemStack itemStack );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneRedstone( String modID );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneRF( ItemStack itemStack );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneRF( String modID );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneIC2( ItemStack itemStack );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneIC2( String modID );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneLight( ItemStack itemStack );
|
||||||
|
mods.appliedenergistics2.Attunement.attuneLight( String modID );
|
||||||
|
|
||||||
|
### Cannon
|
||||||
|
Add ammo types for the matter cannon.
|
||||||
|
|
||||||
|
mods.appliedenergistics2.Cannon.registerAmmo( ItemStack itemStack, double weight );
|
||||||
|
|
||||||
## Applied Energistics 2 Localization
|
## Applied Energistics 2 Localization
|
||||||
|
|
||||||
|
|||||||
+9
-7
@@ -9,21 +9,23 @@ aebasename=appliedenergistics2
|
|||||||
#########################################################
|
#########################################################
|
||||||
minecraft_version=1.12.2
|
minecraft_version=1.12.2
|
||||||
mcp_mappings=snapshot_20171003
|
mcp_mappings=snapshot_20171003
|
||||||
forge_version=14.23.0.2491
|
forge_version=14.23.3.2655
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Installable #
|
# Installable #
|
||||||
#########################################################
|
#########################################################
|
||||||
hwyla_version=1.8.20-B35_1.12
|
hwyla_version=1.8.26-B41_1.12.2
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Provided APIs #
|
# Provided APIs #
|
||||||
#########################################################
|
#########################################################
|
||||||
jei_version=4.8.0.105
|
jei_version=4.10.0.198
|
||||||
tesla_version=1.0.61
|
tesla_version=1.0.63
|
||||||
ic2_version=2.8.19-ex112
|
ic2_version=2.8.73-ex112
|
||||||
top_version=1.12-1.4.18-10
|
top_version=1.12-1.4.23-16
|
||||||
cofhcore_version=1.12-4.+
|
cofhcore_version=1.12.2-4.5.2.19
|
||||||
|
crafttweaker_version=4.1.8.9
|
||||||
|
inventorytweaks_version=1.63
|
||||||
|
|
||||||
#########################################################
|
#########################################################
|
||||||
# Deployment #
|
# Deployment #
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ repositories {
|
|||||||
|
|
||||||
maven {
|
maven {
|
||||||
name = "Tesla repo"
|
name = "Tesla repo"
|
||||||
url "http://maven.epoxide.xyz"
|
url "http://maven.mcmoddev.com"
|
||||||
}
|
}
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
@@ -48,7 +48,7 @@ repositories {
|
|||||||
name 'tterrag maven'
|
name 'tterrag maven'
|
||||||
url "http://maven.tterrag.com/"
|
url "http://maven.tterrag.com/"
|
||||||
}
|
}
|
||||||
|
|
||||||
maven { // McJtyLib
|
maven { // McJtyLib
|
||||||
name 'mcjty'
|
name 'mcjty'
|
||||||
url "http://maven.k-4u.nl/"
|
url "http://maven.k-4u.nl/"
|
||||||
@@ -58,6 +58,21 @@ repositories {
|
|||||||
name 'tehnut'
|
name 'tehnut'
|
||||||
url "http://tehnut.info/maven"
|
url "http://tehnut.info/maven"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maven { // CraftTweaker
|
||||||
|
name 'jared maven'
|
||||||
|
url "http://maven.blamejared.com/"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven { // modmaven, maven proxy
|
||||||
|
name 'modmaven'
|
||||||
|
url "https://modmaven.k-4u.nl/"
|
||||||
|
}
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name = "CurseForge"
|
||||||
|
url = "https://minecraft.curseforge.com/api/maven/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -73,11 +88,13 @@ dependencies {
|
|||||||
// compile against provided APIs
|
// compile against provided APIs
|
||||||
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api"
|
||||||
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}"
|
||||||
compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
|
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}"
|
||||||
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
|
||||||
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
|
||||||
|
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
|
||||||
|
compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api"
|
||||||
|
|
||||||
// at runtime, use the full JEI jar
|
// at runtime, use the full JEI jar
|
||||||
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,8 @@ public interface IBlocks
|
|||||||
|
|
||||||
ITileDefinition iface();
|
ITileDefinition iface();
|
||||||
|
|
||||||
|
ITileDefinition fluidIface();
|
||||||
|
|
||||||
ITileDefinition cellWorkbench();
|
ITileDefinition cellWorkbench();
|
||||||
|
|
||||||
ITileDefinition iOPort();
|
ITileDefinition iOPort();
|
||||||
|
|||||||
@@ -88,6 +88,14 @@ public interface IItems
|
|||||||
|
|
||||||
IItemDefinition cell64k();
|
IItemDefinition cell64k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell1k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell4k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell16k();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell64k();
|
||||||
|
|
||||||
IItemDefinition spatialCell2();
|
IItemDefinition spatialCell2();
|
||||||
|
|
||||||
IItemDefinition spatialCell16();
|
IItemDefinition spatialCell16();
|
||||||
|
|||||||
@@ -134,4 +134,12 @@ public interface IMaterials
|
|||||||
IItemDefinition qESingularity();
|
IItemDefinition qESingularity();
|
||||||
|
|
||||||
IItemDefinition blankPattern();
|
IItemDefinition blankPattern();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell1kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell4kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell16kPart();
|
||||||
|
|
||||||
|
IItemDefinition fluidCell64kPart();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public interface IParts
|
|||||||
AEColoredItemDefinition cableGlass();
|
AEColoredItemDefinition cableGlass();
|
||||||
|
|
||||||
AEColoredItemDefinition cableDenseCovered();
|
AEColoredItemDefinition cableDenseCovered();
|
||||||
|
|
||||||
AEColoredItemDefinition cableDenseSmart();
|
AEColoredItemDefinition cableDenseSmart();
|
||||||
|
|
||||||
AEColoredItemDefinition lumenCableSmart();
|
AEColoredItemDefinition lumenCableSmart();
|
||||||
@@ -64,6 +64,8 @@ public interface IParts
|
|||||||
|
|
||||||
IItemDefinition iface();
|
IItemDefinition iface();
|
||||||
|
|
||||||
|
IItemDefinition fluidIface();
|
||||||
|
|
||||||
IItemDefinition levelEmitter();
|
IItemDefinition levelEmitter();
|
||||||
|
|
||||||
IItemDefinition annihilationPlane();
|
IItemDefinition annihilationPlane();
|
||||||
@@ -107,4 +109,18 @@ public interface IParts
|
|||||||
IItemDefinition storageMonitor();
|
IItemDefinition storageMonitor();
|
||||||
|
|
||||||
IItemDefinition conversionMonitor();
|
IItemDefinition conversionMonitor();
|
||||||
|
|
||||||
|
IItemDefinition fluidTerminal();
|
||||||
|
|
||||||
|
IItemDefinition fluidImportBus();
|
||||||
|
|
||||||
|
IItemDefinition fluidExportBus();
|
||||||
|
|
||||||
|
IItemDefinition fluidStorageBus();
|
||||||
|
|
||||||
|
IItemDefinition fluidLevelEmitter();
|
||||||
|
|
||||||
|
IItemDefinition fluidAnnihilationPlane();
|
||||||
|
|
||||||
|
IItemDefinition fluidFormationnPlane();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import javax.annotation.Nonnull;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.capabilities.Capability;
|
||||||
|
|
||||||
import appeng.api.config.TunnelType;
|
import appeng.api.config.TunnelType;
|
||||||
|
|
||||||
@@ -47,6 +48,7 @@ public interface IP2PTunnelRegistry
|
|||||||
*/
|
*/
|
||||||
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
|
void addNewAttunement( @Nonnull ItemStack trigger, @Nullable TunnelType type );
|
||||||
void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type );
|
void addNewAttunement( @Nonnull String ModId, @Nullable TunnelType type );
|
||||||
|
void addNewAttunement( @Nonnull Capability<?> cap, @Nullable TunnelType type );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns null if no attunement can be found.
|
* returns null if no attunement can be found.
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public interface IRecipeHandlerRegistry
|
|||||||
* @param name name of crafthandler
|
* @param name name of crafthandler
|
||||||
* @param handler class of crafthandler
|
* @param handler class of crafthandler
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
void addNewCraftHandler( String name, Class<? extends ICraftHandler> handler );
|
void addNewCraftHandler( String name, Class<? extends ICraftHandler> handler );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,11 +66,13 @@ public interface IRecipeHandlerRegistry
|
|||||||
* @return A recipe handler by name, returns null on failure.
|
* @return A recipe handler by name, returns null on failure.
|
||||||
*/
|
*/
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@Deprecated
|
||||||
ICraftHandler getCraftHandlerFor( String name );
|
ICraftHandler getCraftHandlerFor( String name );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a new recipe handler, which can be used to parse, and read recipe files.
|
* @return a new recipe handler, which can be used to parse, and read recipe files.
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
IRecipeHandler createNewRecipehandler();
|
IRecipeHandler createNewRecipehandler();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ import net.minecraft.entity.player.EntityPlayer;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Memory Card API
|
* Memory Card API
|
||||||
@@ -41,13 +43,18 @@ public interface IMemoryCard
|
|||||||
* Configures the data stored on the memory card, the SettingsName, will be
|
* Configures the data stored on the memory card, the SettingsName, will be
|
||||||
* localized when displayed.
|
* localized when displayed.
|
||||||
*
|
*
|
||||||
|
* The data can contain an optional string with the key "tooltip", which will be used as
|
||||||
|
* unlocalized string to display it after the settings name.
|
||||||
|
*
|
||||||
|
* The data can contain an optional intArray using "colorCode" to be displayed on the model itself.
|
||||||
|
* It needs to have exactly 8 elements representing the ordinal of the matching {@link AEColor}.
|
||||||
|
* The first 4 values represent the top row, left to right. The second 4 the bottom row.
|
||||||
|
*
|
||||||
* @param is item
|
* @param is item
|
||||||
* @param SettingsName unlocalized string that represents the tile entity.
|
* @param settingsName unlocalized string that represents the tile entity.
|
||||||
* @param data may contain a String called "tooltip" which is is a
|
* @param data the NBT tag, refer to the normal comment for special keys.
|
||||||
* unlocalized string displayed after the settings name, optional
|
|
||||||
* but can be used to add details to the card for later.
|
|
||||||
*/
|
*/
|
||||||
void setMemoryCardContents( ItemStack is, String SettingsName, NBTTagCompound data );
|
void setMemoryCardContents( ItemStack is, String settingsName, NBTTagCompound data );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns the settings name provided by a previous call to
|
* returns the settings name provided by a previous call to
|
||||||
@@ -68,6 +75,17 @@ public interface IMemoryCard
|
|||||||
*/
|
*/
|
||||||
NBTTagCompound getData( ItemStack is );
|
NBTTagCompound getData( ItemStack is );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This represent as 4x2 grid of {@link AEColor} without transparent/fluix color.
|
||||||
|
*
|
||||||
|
* First 4 colors are used for the top row, second for the bottom one.
|
||||||
|
*
|
||||||
|
* @param is item
|
||||||
|
*
|
||||||
|
* @return a hash representation of the memory card content
|
||||||
|
*/
|
||||||
|
AEColor[] getColorCode( ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* notify the user of a outcome related to the memory card.
|
* notify the user of a outcome related to the memory card.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ package appeng.api.implementations.items;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.storage.ICellWorkbenchItem;
|
import appeng.api.storage.ICellWorkbenchItem;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.IStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,7 +41,7 @@ import appeng.api.storage.data.IAEItemStack;
|
|||||||
*
|
*
|
||||||
* The standard AE implementation only provides 1-63 Types
|
* The standard AE implementation only provides 1-63 Types
|
||||||
*/
|
*/
|
||||||
public interface IStorageCell extends ICellWorkbenchItem
|
public interface IStorageCell<T extends IAEStack<T>> extends ICellWorkbenchItem
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -82,7 +83,7 @@ public interface IStorageCell extends ICellWorkbenchItem
|
|||||||
*
|
*
|
||||||
* @return true to preventAdditionOfItem
|
* @return true to preventAdditionOfItem
|
||||||
*/
|
*/
|
||||||
boolean isBlackListed( ItemStack cellItem, IAEItemStack requestedAddition );
|
boolean isBlackListed( ItemStack cellItem, T requestedAddition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to specify if this storage cell can be stored inside other
|
* Allows you to specify if this storage cell can be stored inside other
|
||||||
@@ -109,4 +110,9 @@ public interface IStorageCell extends ICellWorkbenchItem
|
|||||||
* @return drain in ae/t this storage cell will use.
|
* @return drain in ae/t this storage cell will use.
|
||||||
*/
|
*/
|
||||||
double getIdleDrain();
|
double getIdleDrain();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the type of channel your cell should be part of
|
||||||
|
*/
|
||||||
|
IStorageChannel<T> getChannel();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.events.MENetworkEvent;
|
import appeng.api.networking.events.MENetworkEvent;
|
||||||
import appeng.api.util.IReadOnlyCollection;
|
import appeng.api.util.IReadOnlyCollection;
|
||||||
|
|
||||||
@@ -43,7 +45,8 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return the IGridCache you requested.
|
* @return the IGridCache you requested.
|
||||||
*/
|
*/
|
||||||
<C extends IGridCache> C getCache( Class<? extends IGridCache> iface );
|
@Nonnull
|
||||||
|
<C extends IGridCache> C getCache( @Nonnull Class<? extends IGridCache> iface );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post an event into the network event bus.
|
* Post an event into the network event bus.
|
||||||
@@ -52,7 +55,8 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return returns ev back to original poster
|
* @return returns ev back to original poster
|
||||||
*/
|
*/
|
||||||
MENetworkEvent postEvent( MENetworkEvent ev );
|
@Nonnull
|
||||||
|
MENetworkEvent postEvent( @Nonnull MENetworkEvent ev );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post an event into the network event bus, but direct it at a single node.
|
* Post an event into the network event bus, but direct it at a single node.
|
||||||
@@ -61,7 +65,8 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return returns ev back to original poster
|
* @return returns ev back to original poster
|
||||||
*/
|
*/
|
||||||
MENetworkEvent postEventTo( IGridNode node, MENetworkEvent ev );
|
@Nonnull
|
||||||
|
MENetworkEvent postEventTo( @Nonnull IGridNode node, @Nonnull MENetworkEvent ev );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get a list of the diversity of classes, you can use this to better detect which machines your interested in,
|
* get a list of the diversity of classes, you can use this to better detect which machines your interested in,
|
||||||
@@ -69,6 +74,7 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
|
* @return IReadOnlyCollection of all available host types (Of Type IGridHost).
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
|
IReadOnlyCollection<Class<? extends IGridHost>> getMachinesClasses();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,11 +84,13 @@ public interface IGrid
|
|||||||
*
|
*
|
||||||
* @return IMachineSet of all nodes belonging to hosts of specified class.
|
* @return IMachineSet of all nodes belonging to hosts of specified class.
|
||||||
*/
|
*/
|
||||||
IMachineSet getMachines( Class<? extends IGridHost> gridHostClass );
|
@Nonnull
|
||||||
|
IMachineSet getMachines( @Nonnull Class<? extends IGridHost> gridHostClass );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
|
* @return IReadOnlyCollection for all nodes on the network, node visitors are preferred.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IReadOnlyCollection<IGridNode> getNodes();
|
IReadOnlyCollection<IGridNode> getNodes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,5 +101,6 @@ public interface IGrid
|
|||||||
/**
|
/**
|
||||||
* @return the node considered the pivot point of the grid.
|
* @return the node considered the pivot point of the grid.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode getPivot();
|
IGridNode getPivot();
|
||||||
}
|
}
|
||||||
@@ -26,6 +26,10 @@ package appeng.api.networking;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
@@ -49,6 +53,7 @@ public interface IGridBlock
|
|||||||
*
|
*
|
||||||
* @return ae/t to use.
|
* @return ae/t to use.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getIdlePowerUsage();
|
double getIdlePowerUsage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,10 +61,11 @@ public interface IGridBlock
|
|||||||
*
|
*
|
||||||
* @return Set of flags for this IGridBlock
|
* @return Set of flags for this IGridBlock
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
EnumSet<GridFlags> getFlags();
|
EnumSet<GridFlags> getFlags();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* generally speaking you will return true for this, the one exception is buses, or worm holes where the node
|
* Generally speaking you will return true for this, the one exception is buses, or worm holes where the node
|
||||||
* represents something that isn't a real connection in the world, but rather one represented internally to the
|
* represents something that isn't a real connection in the world, but rather one represented internally to the
|
||||||
* block.
|
* block.
|
||||||
*
|
*
|
||||||
@@ -68,37 +74,46 @@ public interface IGridBlock
|
|||||||
boolean isWorldAccessible();
|
boolean isWorldAccessible();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Must not return when {@link #isWorldAccessible()} is true.
|
||||||
|
* Otherwise the behavior is unspecified.
|
||||||
|
*
|
||||||
* @return current location of this node
|
* @return current location of this node
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
DimensionalCoord getLocation();
|
DimensionalCoord getLocation();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
|
* @return Transparent, or a valid color, NULL IS NOT A VALID RETURN
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
AEColor getGridColor();
|
AEColor getGridColor();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notifies your IGridBlock that changes were made to your connections
|
* Notifies your IGridBlock that changes were made to your connections
|
||||||
*/
|
*/
|
||||||
void onGridNotification( GridNotification notification );
|
void onGridNotification( @Nonnull GridNotification notification );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update Blocks network/connection/booting status. grid,
|
* Update Blocks network/connection/booting status. grid,
|
||||||
*
|
*
|
||||||
* @param grid grid
|
* @param grid grid
|
||||||
* @param channelsInUse used channels
|
* @param channelsInUse used channels
|
||||||
|
* @deprecated to be removed in rv7
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
void setNetworkStatus( IGrid grid, int channelsInUse );
|
void setNetworkStatus( IGrid grid, int channelsInUse );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
|
* Determine which sides of the block can be connected too, only used when isWorldAccessible returns true, not used
|
||||||
* for {@link IPart} implementations.
|
* for {@link IPart} implementations.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
EnumSet<EnumFacing> getConnectableSides();
|
EnumSet<EnumFacing> getConnectableSides();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
|
* @return the IGridHost for the node, this will be an IGridPart or a TileEntity generally speaking.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridHost getMachine();
|
IGridHost getMachine();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -111,5 +126,6 @@ public interface IGridBlock
|
|||||||
*
|
*
|
||||||
* @return the render item stack to use to render this node, null is valid, and will not show this node.
|
* @return the render item stack to use to render this node, null is valid, and will not show this node.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
ItemStack getMachineRepresentation();
|
ItemStack getMachineRepresentation();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows you to create a network wise service, AE2 uses these for providing
|
* Allows you to create a network wise service, AE2 uses these for providing
|
||||||
* item, spatial, and tunnel services.
|
* item, spatial, and tunnel services.
|
||||||
@@ -50,7 +53,7 @@ public interface IGridCache
|
|||||||
* @param gridNode removed from that grid
|
* @param gridNode removed from that grid
|
||||||
* @param machine to be removed machine
|
* @param machine to be removed machine
|
||||||
*/
|
*/
|
||||||
void removeNode( IGridNode gridNode, IGridHost machine );
|
void removeNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* informs you cache that a machine was added to the grid.
|
* informs you cache that a machine was added to the grid.
|
||||||
@@ -62,7 +65,7 @@ public interface IGridCache
|
|||||||
* @param gridNode added to grid node
|
* @param gridNode added to grid node
|
||||||
* @param machine to be added machine
|
* @param machine to be added machine
|
||||||
*/
|
*/
|
||||||
void addNode( IGridNode gridNode, IGridHost machine );
|
void addNode( @Nonnull IGridNode gridNode, @Nonnull IGridHost machine );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a grid splits into two grids, AE will call a split as it
|
* Called when a grid splits into two grids, AE will call a split as it
|
||||||
@@ -71,7 +74,7 @@ public interface IGridCache
|
|||||||
*
|
*
|
||||||
* @param destinationStorage storage which receives half of old grid
|
* @param destinationStorage storage which receives half of old grid
|
||||||
*/
|
*/
|
||||||
void onSplit( IGridStorage destinationStorage );
|
void onSplit( @Nonnull IGridStorage destinationStorage );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when two grids merge into one, AE will call a join as it
|
* Called when two grids merge into one, AE will call a join as it
|
||||||
@@ -80,12 +83,12 @@ public interface IGridCache
|
|||||||
*
|
*
|
||||||
* @param sourceStorage old storage
|
* @param sourceStorage old storage
|
||||||
*/
|
*/
|
||||||
void onJoin( IGridStorage sourceStorage );
|
void onJoin( @Nonnull IGridStorage sourceStorage );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when saving changes,
|
* Called when saving changes,
|
||||||
*
|
*
|
||||||
* @param destinationStorage storage
|
* @param destinationStorage storage
|
||||||
*/
|
*/
|
||||||
void populateGridStorage( IGridStorage destinationStorage );
|
void populateGridStorage( @Nonnull IGridStorage destinationStorage );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -38,14 +40,14 @@ public interface IGridCacheRegistry
|
|||||||
*
|
*
|
||||||
* @param iface grid cache class
|
* @param iface grid cache class
|
||||||
*/
|
*/
|
||||||
void registerGridCache( Class<? extends IGridCache> iface, Class<? extends IGridCache> implementation );
|
void registerGridCache( @Nonnull Class<? extends IGridCache> iface, @Nonnull Class<? extends IGridCache> implementation );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* requests a new INSTANCE of a grid cache for use, used internally
|
* requests a new INSTANCE of a grid cache for use, used internally
|
||||||
*
|
*
|
||||||
* @param grid grid
|
* @param grid grid
|
||||||
*
|
*
|
||||||
* @return a new HashMap of IGridCaches from the registry, called from IGrid when constructing a new grid.
|
* @return a new Map of IGridCaches from the registry, called from IGrid when constructing a new grid.
|
||||||
*/
|
*/
|
||||||
HashMap<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
|
Map<Class<? extends IGridCache>, IGridCache> createCacheInstance( IGrid grid );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.util.AEPartLocation;
|
import appeng.api.util.AEPartLocation;
|
||||||
|
|
||||||
|
|
||||||
@@ -45,6 +47,7 @@ public interface IGridConnection
|
|||||||
*
|
*
|
||||||
* @return the IGridNode which represents the opposite side of the connection.
|
* @return the IGridNode which represents the opposite side of the connection.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode getOtherSide( IGridNode gridNode );
|
IGridNode getOtherSide( IGridNode gridNode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,6 +57,7 @@ public interface IGridConnection
|
|||||||
*
|
*
|
||||||
* @return the direction of the connection, only valid for in world connections.
|
* @return the direction of the connection, only valid for in world connections.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
AEPartLocation getDirection( IGridNode gridNode );
|
AEPartLocation getDirection( IGridNode gridNode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,11 +69,13 @@ public interface IGridConnection
|
|||||||
/**
|
/**
|
||||||
* @return node A
|
* @return node A
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode a();
|
IGridNode a();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return node B
|
* @return node B
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode b();
|
IGridNode b();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public interface IGridConnectionVisitor extends IGridVisitor
|
public interface IGridConnectionVisitor extends IGridVisitor
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -32,5 +35,5 @@ public interface IGridConnectionVisitor extends IGridVisitor
|
|||||||
*
|
*
|
||||||
* @param n the connection.
|
* @param n the connection.
|
||||||
*/
|
*/
|
||||||
void visitConnection( IGridConnection n );
|
void visitConnection( @Nonnull IGridConnection n );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,12 +24,14 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.exceptions.FailedConnectionException;
|
import appeng.api.exceptions.FailedConnectionException;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
|
* A helper responsible for creating new {@link IGridNode}, {@link IGridConnection} or potentially similar tasks.
|
||||||
*
|
*
|
||||||
* @author yueh
|
* @author yueh
|
||||||
* @version rv5
|
* @version rv5
|
||||||
* @since rv5
|
* @since rv5
|
||||||
@@ -39,7 +41,7 @@ public interface IGridHelper
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a grid node for your {@link IGridHost}
|
* Create a grid node for your {@link IGridHost}
|
||||||
*
|
*
|
||||||
* The passed {@link IGridBlock} represents the definition for properties like connectable sides.
|
* The passed {@link IGridBlock} represents the definition for properties like connectable sides.
|
||||||
* Refer to its documentation for further details.
|
* Refer to its documentation for further details.
|
||||||
*
|
*
|
||||||
@@ -47,18 +49,20 @@ public interface IGridHelper
|
|||||||
*
|
*
|
||||||
* @return grid node of block
|
* @return grid node of block
|
||||||
*/
|
*/
|
||||||
IGridNode createGridNode( IGridBlock block );
|
@Nonnull
|
||||||
|
IGridNode createGridNode( @Nonnull IGridBlock block );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a direct connection between two {@link IGridNode}.
|
* Create a direct connection between two {@link IGridNode}.
|
||||||
*
|
*
|
||||||
* This will be considered as having a distance of 1, regardless of the location of both nodes.
|
* This will be considered as having a distance of 1, regardless of the location of both nodes.
|
||||||
*
|
*
|
||||||
* @param a to be connected gridnode
|
* @param a to be connected gridnode
|
||||||
* @param b to be connected gridnode
|
* @param b to be connected gridnode
|
||||||
*
|
*
|
||||||
* @throws appeng.api.exceptions.FailedConnectionException
|
* @throws appeng.api.exceptions.FailedConnectionException
|
||||||
*/
|
*/
|
||||||
IGridConnection createGridConnection( IGridNode a, IGridNode b ) throws FailedConnectionException;
|
@Nonnull
|
||||||
|
IGridConnection createGridConnection( @Nonnull IGridNode a, @Nonnull IGridNode b ) throws FailedConnectionException;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
|
||||||
import appeng.api.parts.IPart;
|
import appeng.api.parts.IPart;
|
||||||
@@ -49,7 +52,8 @@ public interface IGridHost
|
|||||||
* @return a new IGridNode, create these with
|
* @return a new IGridNode, create these with
|
||||||
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
|
* AEApi.INSTANCE().createGridNode( MyIGridBlock )
|
||||||
*/
|
*/
|
||||||
IGridNode getGridNode( AEPartLocation dir );
|
@Nullable
|
||||||
|
IGridNode getGridNode( @Nonnull AEPartLocation dir );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines how cables render when they connect to this block. Priority is
|
* Determines how cables render when they connect to this block. Priority is
|
||||||
@@ -57,7 +61,8 @@ public interface IGridHost
|
|||||||
*
|
*
|
||||||
* @param dir direction
|
* @param dir direction
|
||||||
*/
|
*/
|
||||||
AECableType getCableConnectionType( AEPartLocation dir );
|
@Nonnull
|
||||||
|
AECableType getCableConnectionType( @Nonnull AEPartLocation dir );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* break this host, its violating security rules, just break your block, or part.
|
* break this host, its violating security rules, just break your block, or part.
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package appeng.api.networking;
|
|||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it
|
* An extension of IGridBlock, only means something when your getFlags() contains REQUIRE_CHANNEL, when done properly it
|
||||||
@@ -40,5 +42,6 @@ public interface IGridMultiblock extends IGridBlock
|
|||||||
*
|
*
|
||||||
* @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. )
|
* @return an iterator that will iterate all the nodes for the multiblock. ( read-only iterator expected. )
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
Iterator<IGridNode> getMultiblockNodes();
|
Iterator<IGridNode> getMultiblockNodes();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package appeng.api.networking;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@@ -50,7 +52,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @param visitor visitor
|
* @param visitor visitor
|
||||||
*/
|
*/
|
||||||
void beginVisit( IGridVisitor visitor );
|
void beginVisit( @Nonnull IGridVisitor visitor );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* inform the node that your IGridBlock has changed its internal state, and force the node to update.
|
* inform the node that your IGridBlock has changed its internal state, and force the node to update.
|
||||||
@@ -68,6 +70,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return grid host
|
* @return grid host
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridHost getMachine();
|
IGridHost getMachine();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,6 +78,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return grid
|
* @return grid
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGrid getGrid();
|
IGrid getGrid();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,11 +90,13 @@ public interface IGridNode
|
|||||||
/**
|
/**
|
||||||
* @return the world the node is located in
|
* @return the world the node is located in
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
World getWorld();
|
World getWorld();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return a set of the connected sides, INTERNAL represents an invisible connection
|
* @return a set of the connected sides, INTERNAL represents an invisible connection
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
EnumSet<AEPartLocation> getConnectedSides();
|
EnumSet<AEPartLocation> getConnectedSides();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -98,11 +104,13 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return grid connections
|
* @return grid connections
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IReadOnlyCollection<IGridConnection> getConnections();
|
IReadOnlyCollection<IGridConnection> getConnections();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the IGridBlock for this node
|
* @return the IGridBlock for this node
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridBlock getGridBlock();
|
IGridBlock getGridBlock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +130,7 @@ public interface IGridNode
|
|||||||
* @param name nbt name
|
* @param name nbt name
|
||||||
* @param nodeData to be loaded data
|
* @param nodeData to be loaded data
|
||||||
*/
|
*/
|
||||||
void loadFromNBT( String name, NBTTagCompound nodeData );
|
void loadFromNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this should be called for each node you maintain, you can save all your nodes to the same tag with different
|
* this should be called for each node you maintain, you can save all your nodes to the same tag with different
|
||||||
@@ -131,7 +139,7 @@ public interface IGridNode
|
|||||||
* @param name nbt name
|
* @param name nbt name
|
||||||
* @param nodeData to be saved data
|
* @param nodeData to be saved data
|
||||||
*/
|
*/
|
||||||
void saveToNBT( String name, NBTTagCompound nodeData );
|
void saveToNBT( @Nonnull String name, @Nonnull NBTTagCompound nodeData );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
|
* @return if the node's channel requirements are currently met, use this for display purposes, use isActive for
|
||||||
@@ -146,7 +154,7 @@ public interface IGridNode
|
|||||||
*
|
*
|
||||||
* @return true if has flag
|
* @return true if has flag
|
||||||
*/
|
*/
|
||||||
boolean hasFlag( GridFlags flag );
|
boolean hasFlag( @Nonnull GridFlags flag );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the ownerID this represents the person who placed the node.
|
* @return the ownerID this represents the person who placed the node.
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ public interface IGridStorage
|
|||||||
/**
|
/**
|
||||||
* @return an NBTTagCompound that can be read, and written too.
|
* @return an NBTTagCompound that can be read, and written too.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
NBTTagCompound dataObject();
|
NBTTagCompound dataObject();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple Visitor pattern access to network nodes.
|
* Simple Visitor pattern access to network nodes.
|
||||||
*/
|
*/
|
||||||
@@ -39,5 +42,5 @@ public interface IGridVisitor
|
|||||||
*
|
*
|
||||||
* @return true to continue visiting nodes beyond this node.
|
* @return true to continue visiting nodes beyond this node.
|
||||||
*/
|
*/
|
||||||
boolean visitNode( IGridNode n );
|
boolean visitNode( @Nonnull IGridNode n );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking;
|
package appeng.api.networking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.util.IReadOnlyCollection;
|
import appeng.api.util.IReadOnlyCollection;
|
||||||
|
|
||||||
|
|
||||||
@@ -33,5 +35,6 @@ public interface IMachineSet extends IReadOnlyCollection<IGridNode>
|
|||||||
/**
|
/**
|
||||||
* @return the machine class for this set.
|
* @return the machine class for this set.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
Class<? extends IGridHost> getMachineClass();
|
Class<? extends IGridHost> getMachineClass();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.crafting;
|
package appeng.api.networking.crafting;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public interface ICraftingCallback
|
public interface ICraftingCallback
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -32,5 +35,5 @@ public interface ICraftingCallback
|
|||||||
*
|
*
|
||||||
* @param job - final job
|
* @param job - final job
|
||||||
*/
|
*/
|
||||||
void calculationComplete( ICraftingJob job );
|
void calculationComplete( @Nonnull ICraftingJob job );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.AccessRestriction;
|
import appeng.api.config.AccessRestriction;
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ public interface IAEPowerStorage extends IEnergySource
|
|||||||
*
|
*
|
||||||
* @return amount of power which was unable to be stored
|
* @return amount of power which was unable to be stored
|
||||||
*/
|
*/
|
||||||
double injectAEPower( double amt, Actionable mode );
|
double injectAEPower( double amt, @Nonnull Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the current maximum power ( this can change :P )
|
* @return the current maximum power ( this can change :P )
|
||||||
@@ -67,5 +69,6 @@ public interface IAEPowerStorage extends IEnergySource
|
|||||||
*
|
*
|
||||||
* @return access restriction what the network can do
|
* @return access restriction what the network can do
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
AccessRestriction getPowerFlow();
|
AccessRestriction getPowerFlow();
|
||||||
}
|
}
|
||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
import appeng.api.networking.events.MENetworkPowerStatusChange;
|
||||||
@@ -38,17 +41,20 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
/**
|
/**
|
||||||
* @return the current calculated idle energy drain each tick, is used internally to drain power for each tick.
|
* @return the current calculated idle energy drain each tick, is used internally to drain power for each tick.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getIdlePowerUsage();
|
double getIdlePowerUsage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
|
* @return the average power drain over the past 10 ticks, includes idle usage during this time, and all use of
|
||||||
* extractPower.
|
* extractPower.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getAvgPowerUsage();
|
double getAvgPowerUsage();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the average energy injected into the system per tick, for the last 10 ticks.
|
* @return the average energy injected into the system per tick, for the last 10 ticks.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getAvgPowerInjection();
|
double getAvgPowerInjection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,13 +85,15 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
*
|
*
|
||||||
* @return the amount of power that the network has OVER the limit.
|
* @return the amount of power that the network has OVER the limit.
|
||||||
*/
|
*/
|
||||||
double injectPower( double amt, Actionable mode );
|
@Nonnegative
|
||||||
|
double injectPower( @Nonnegative double amt, @Nonnull Actionable mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this is should be considered an estimate, and not relied upon for real calculations.
|
* this is should be considered an estimate, and not relied upon for real calculations.
|
||||||
*
|
*
|
||||||
* @return estimated available power.
|
* @return estimated available power.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getStoredPower();
|
double getStoredPower();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -93,6 +101,7 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
*
|
*
|
||||||
* @return estimated available power.
|
* @return estimated available power.
|
||||||
*/
|
*/
|
||||||
|
@Nonnegative
|
||||||
double getMaxStoredPower();
|
double getMaxStoredPower();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -101,5 +110,6 @@ public interface IEnergyGrid extends IGridCache, IEnergySource, IEnergyGridProvi
|
|||||||
*
|
*
|
||||||
* @return Amount of power required to charge the grid, in AE.
|
* @return Amount of power required to charge the grid, in AE.
|
||||||
*/
|
*/
|
||||||
double getEnergyDemand( double maxRequired );
|
@Nonnegative
|
||||||
|
double getEnergyDemand( @Nonnegative double maxRequired );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.Actionable;
|
import appeng.api.config.Actionable;
|
||||||
import appeng.api.config.PowerMultiplier;
|
import appeng.api.config.PowerMultiplier;
|
||||||
|
|
||||||
@@ -39,5 +42,6 @@ public interface IEnergySource
|
|||||||
*
|
*
|
||||||
* @return returns extracted power.
|
* @return returns extracted power.
|
||||||
*/
|
*/
|
||||||
double extractAEPower( double amt, Actionable mode, PowerMultiplier usePowerMultiplier );
|
@Nonnegative
|
||||||
|
double extractAEPower( @Nonnegative double amt, @Nonnull Actionable mode, @Nonnull PowerMultiplier usePowerMultiplier );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DO NOT IMPLEMENT.
|
* DO NOT IMPLEMENT.
|
||||||
*
|
*
|
||||||
@@ -39,7 +42,7 @@ public interface IEnergyWatcher
|
|||||||
* @param amount
|
* @param amount
|
||||||
* @return true, if successfully added.
|
* @return true, if successfully added.
|
||||||
*/
|
*/
|
||||||
boolean add( double amount );
|
boolean add( @Nonnegative double amount );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a specific threshold from the watcher.
|
* Remove a specific threshold from the watcher.
|
||||||
@@ -47,7 +50,7 @@ public interface IEnergyWatcher
|
|||||||
* @param amount
|
* @param amount
|
||||||
* @return true, if successfully removed.
|
* @return true, if successfully removed.
|
||||||
*/
|
*/
|
||||||
boolean remove( double amount );
|
boolean remove( @Nonnegative double amount );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all thresholds and resets the watcher to a clean state.
|
* Removes all thresholds and resets the watcher to a clean state.
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.energy;
|
package appeng.api.networking.energy;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
|
||||||
public interface IEnergyWatcherHost
|
public interface IEnergyWatcherHost
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -33,12 +36,12 @@ public interface IEnergyWatcherHost
|
|||||||
*
|
*
|
||||||
* @param newWatcher new watcher
|
* @param newWatcher new watcher
|
||||||
*/
|
*/
|
||||||
void updateWatcher( IEnergyWatcher newWatcher );
|
void updateWatcher( @Nonnull IEnergyWatcher newWatcher );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when a threshold is crossed.
|
* Called when a threshold is crossed.
|
||||||
*
|
*
|
||||||
* @param energyGrid grid
|
* @param energyGrid grid
|
||||||
*/
|
*/
|
||||||
void onThresholdPass( IEnergyGrid energyGrid );
|
void onThresholdPass( @Nonnull IEnergyGrid energyGrid );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.pathing;
|
package appeng.api.networking.pathing;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
|
|
||||||
|
|
||||||
@@ -39,6 +41,7 @@ public interface IPathingGrid extends IGridCache
|
|||||||
* @return the controller state of the network, useful if you want to
|
* @return the controller state of the network, useful if you want to
|
||||||
* require a controller for a feature.
|
* require a controller for a feature.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
ControllerState getControllerState();
|
ControllerState getControllerState();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.security;
|
package appeng.api.networking.security;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
|
||||||
|
|
||||||
@@ -38,5 +40,6 @@ public interface IActionHost
|
|||||||
* @return the the gridnode that actions from this IGridHost are preformed
|
* @return the the gridnode that actions from this IGridHost are preformed
|
||||||
* by.
|
* by.
|
||||||
*/
|
*/
|
||||||
|
@Nonnull
|
||||||
IGridNode getActionableNode();
|
IGridNode getActionableNode();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,9 @@
|
|||||||
package appeng.api.networking.security;
|
package appeng.api.networking.security;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnegative;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
@@ -46,7 +49,7 @@ public interface ISecurityGrid extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return true if the player has permissions.
|
* @return true if the player has permissions.
|
||||||
*/
|
*/
|
||||||
boolean hasPermission( EntityPlayer player, SecurityPermissions perm );
|
boolean hasPermission( @Nonnull EntityPlayer player, @Nonnull SecurityPermissions perm );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if a player has permissions.
|
* Check if a player has permissions.
|
||||||
@@ -56,7 +59,7 @@ public interface ISecurityGrid extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return true if the player has permissions.
|
* @return true if the player has permissions.
|
||||||
*/
|
*/
|
||||||
boolean hasPermission( int playerID, SecurityPermissions perm );
|
boolean hasPermission( @Nonnegative int playerID, @Nonnull SecurityPermissions perm );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return PlayerID of the admin, or owner, this is the person who placed the security block.
|
* @return PlayerID of the admin, or owner, this is the person who placed the security block.
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ package appeng.api.networking.security;
|
|||||||
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.HashMap;
|
import java.util.Map;
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public interface ISecurityProvider
|
|||||||
*
|
*
|
||||||
* @param playerPerms player permissions
|
* @param playerPerms player permissions
|
||||||
*/
|
*/
|
||||||
void readPermissions( HashMap<Integer, EnumSet<SecurityPermissions>> playerPerms );
|
void readPermissions( Map<Integer, EnumSet<SecurityPermissions>> playerPerms );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return is security on or off?
|
* @return is security on or off?
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ package appeng.api.networking.security;
|
|||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
|
||||||
|
|
||||||
@@ -41,5 +43,5 @@ public interface ISecurityRegistry
|
|||||||
* @param playerID player id
|
* @param playerID player id
|
||||||
* @param permissions permissions of player
|
* @param permissions permissions of player
|
||||||
*/
|
*/
|
||||||
void addPlayer( int playerID, EnumSet<SecurityPermissions> permissions );
|
void addPlayer( int playerID, @Nonnull EnumSet<SecurityPermissions> permissions );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.ticking;
|
package appeng.api.networking.ticking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
|
||||||
|
|
||||||
@@ -45,18 +47,18 @@ public interface IGridTickable
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* You can return null, if you wish to tick using MC's ticking mechanism, or
|
* Return a valid TickingRequest to tell AE a guide for which type of
|
||||||
* you can return a valid TickingRequest to tell AE a guide for which type
|
* responsiveness your device wants.
|
||||||
* of responsiveness your device wants.
|
|
||||||
*
|
*
|
||||||
* this will be called for your tile any time your tile changes grids, this
|
* This will be called for your tile any time your tile changes grids, this
|
||||||
* can happen at any time, so if your using the sleep feature you may wish
|
* can happen at any time, so if your using the sleep feature you may wish
|
||||||
* to preserve your sleep, in the result of this method. or you can simply
|
* to preserve your sleep, in the result of this method. or you can simply
|
||||||
* reset it.
|
* reset it.
|
||||||
*
|
*
|
||||||
* @return null or a valid new TickingRequest
|
* @return a valid new TickingRequest
|
||||||
*/
|
*/
|
||||||
TickingRequest getTickingRequest( IGridNode node );
|
@Nonnull
|
||||||
|
TickingRequest getTickingRequest( @Nonnull IGridNode node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AE lets you adjust your tick rate based on the results of your tick, if
|
* AE lets you adjust your tick rate based on the results of your tick, if
|
||||||
@@ -67,11 +69,12 @@ public interface IGridTickable
|
|||||||
*
|
*
|
||||||
* Note: this is never called if you return null from getTickingRequest.
|
* Note: this is never called if you return null from getTickingRequest.
|
||||||
*
|
*
|
||||||
* @param TicksSinceLastCall the number of world ticks that were skipped since your last
|
* @param ticksSinceLastCall the number of world ticks that were skipped since your last
|
||||||
* tick, you can use this to adjust speed of processing or adjust
|
* tick, you can use this to adjust speed of processing or adjust
|
||||||
* your tick rate.
|
* your tick rate.
|
||||||
*
|
*
|
||||||
* @return tick rate adjustment.
|
* @return tick rate adjustment.
|
||||||
*/
|
*/
|
||||||
TickRateModulation tickingRequest( IGridNode node, int TicksSinceLastCall );
|
@Nonnull
|
||||||
|
TickRateModulation tickingRequest( @Nonnull IGridNode node, int ticksSinceLastCall );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
package appeng.api.networking.ticking;
|
package appeng.api.networking.ticking;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
import appeng.api.networking.IGridCache;
|
import appeng.api.networking.IGridCache;
|
||||||
import appeng.api.networking.IGridNode;
|
import appeng.api.networking.IGridNode;
|
||||||
|
|
||||||
@@ -42,7 +44,7 @@ public interface ITickManager extends IGridCache
|
|||||||
*
|
*
|
||||||
* @param node gridnode
|
* @param node gridnode
|
||||||
*/
|
*/
|
||||||
boolean alertDevice( IGridNode node );
|
boolean alertDevice( @Nonnull IGridNode node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* disables ticking for your device.
|
* disables ticking for your device.
|
||||||
@@ -51,7 +53,7 @@ public interface ITickManager extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return if the call was successful.
|
* @return if the call was successful.
|
||||||
*/
|
*/
|
||||||
boolean sleepDevice( IGridNode node );
|
boolean sleepDevice( @Nonnull IGridNode node );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enables ticking for your device, undoes a sleepDevice call.
|
* enables ticking for your device, undoes a sleepDevice call.
|
||||||
@@ -60,5 +62,5 @@ public interface ITickManager extends IGridCache
|
|||||||
*
|
*
|
||||||
* @return if the call was successful.
|
* @return if the call was successful.
|
||||||
*/
|
*/
|
||||||
boolean wakeDevice( IGridNode node );
|
boolean wakeDevice( @Nonnull IGridNode node );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
|||||||
* Called when you right click the part, very similar to Block.onActivateBlock
|
* Called when you right click the part, very similar to Block.onActivateBlock
|
||||||
*
|
*
|
||||||
* @param player right clicking player
|
* @param player right clicking player
|
||||||
|
* @param hand hand used
|
||||||
* @param pos position of block
|
* @param pos position of block
|
||||||
*
|
*
|
||||||
* @return if your activate method performed something.
|
* @return if your activate method performed something.
|
||||||
@@ -219,12 +220,41 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
|||||||
* Called when you right click the part, very similar to Block.onActivateBlock
|
* Called when you right click the part, very similar to Block.onActivateBlock
|
||||||
*
|
*
|
||||||
* @param player shift right clicking player
|
* @param player shift right clicking player
|
||||||
|
* @param hand hand used
|
||||||
* @param pos position of block
|
* @param pos position of block
|
||||||
*
|
*
|
||||||
* @return if your activate method performed something, you should use false unless you really need it.
|
* @return if your activate method performed something, you should use false unless you really need it.
|
||||||
*/
|
*/
|
||||||
boolean onShiftActivate( EntityPlayer player, EnumHand hand, Vec3d pos );
|
boolean onShiftActivate( EntityPlayer player, EnumHand hand, Vec3d pos );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when you left click the part, very similar to Block.onBlockClicked
|
||||||
|
*
|
||||||
|
* @param player left clicking player
|
||||||
|
* @param hand hand used
|
||||||
|
* @param pos position of block
|
||||||
|
*
|
||||||
|
* @return if your activate method performed something, you should use false unless you really need it.
|
||||||
|
*/
|
||||||
|
default boolean onClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when you shift-left click the part, very similar to Block.onBlockClicked
|
||||||
|
*
|
||||||
|
* @param player shift-left clicking player
|
||||||
|
* @param hand hand used
|
||||||
|
* @param pos position of block
|
||||||
|
*
|
||||||
|
* @return if your activate method performed something, you should use false unless you really need it.
|
||||||
|
*/
|
||||||
|
default boolean onShiftClicked( EntityPlayer player, EnumHand hand, Vec3d pos )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add drops to the items being dropped into the world, if your item stores its contents when wrenched use the
|
* Add drops to the items being dropped into the world, if your item stores its contents when wrenched use the
|
||||||
* wrenched boolean to control what data is saved vs dropped when it is broken.
|
* wrenched boolean to control what data is saved vs dropped when it is broken.
|
||||||
@@ -325,4 +355,14 @@ public interface IPart extends IBoxProvider, ICustomCableConnection
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Flag to be passed to the renderer.
|
||||||
|
*
|
||||||
|
* @return flag or null
|
||||||
|
*/
|
||||||
|
default Long getRenderFlag()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
|
||||||
|
package appeng.api.parts;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
|
||||||
|
|
||||||
|
public interface IPartBakedModel
|
||||||
|
{
|
||||||
|
List<BakedQuad> getPartQuads( @Nullable Long partFlags, long rand );
|
||||||
|
}
|
||||||
@@ -30,7 +30,7 @@ import appeng.api.exceptions.MissingIngredientException;
|
|||||||
import appeng.api.exceptions.RecipeException;
|
import appeng.api.exceptions.RecipeException;
|
||||||
import appeng.api.exceptions.RegistrationException;
|
import appeng.api.exceptions.RegistrationException;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface ICraftHandler
|
public interface ICraftHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import net.minecraft.item.ItemStack;
|
|||||||
import appeng.api.exceptions.MissingIngredientException;
|
import appeng.api.exceptions.MissingIngredientException;
|
||||||
import appeng.api.exceptions.RegistrationException;
|
import appeng.api.exceptions.RegistrationException;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface IIngredient
|
public interface IIngredient
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package appeng.api.recipes;
|
|||||||
/**
|
/**
|
||||||
* Represents the AE2 Recipe Loading/Reading Class
|
* Represents the AE2 Recipe Loading/Reading Class
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public interface IRecipeHandler
|
public interface IRecipeHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import java.io.BufferedReader;
|
|||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public interface IRecipeLoader
|
public interface IRecipeLoader
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ public interface ICellHandler
|
|||||||
*
|
*
|
||||||
* @param is a storage cell item.
|
* @param is a storage cell item.
|
||||||
* @param host anytime the contents of your storage cell changes it should use this to request a save, please
|
* @param host anytime the contents of your storage cell changes it should use this to request a save, please
|
||||||
* note, this value can be null.
|
* note, this value can be null. If provided, the host is responsible for persisting the cell content.
|
||||||
* @param channel the storage channel requested.
|
* @param channel the storage channel requested.
|
||||||
*
|
*
|
||||||
* @return a new IMEHandler for the provided item
|
* @return a new IMEHandler for the provided item
|
||||||
*/
|
*/
|
||||||
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
|
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> channel );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
|
* Called when the storage cell is planed in an ME Chest and the user tries to open the terminal side, if your item
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
public interface ICellInventory extends IMEInventory<IAEItemStack>
|
public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,4 +118,9 @@ public interface ICellInventory extends IMEInventory<IAEItemStack>
|
|||||||
* @return the status number for this drive.
|
* @return the status number for this drive.
|
||||||
*/
|
*/
|
||||||
int getStatusForCell();
|
int getStatusForCell();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells the cell to persist to NBT
|
||||||
|
*/
|
||||||
|
void persist();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,16 +25,16 @@ package appeng.api.storage;
|
|||||||
|
|
||||||
|
|
||||||
import appeng.api.config.IncludeExclude;
|
import appeng.api.config.IncludeExclude;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
|
|
||||||
|
|
||||||
public interface ICellInventoryHandler extends IMEInventoryHandler<IAEItemStack>
|
public interface ICellInventoryHandler<T extends IAEStack<T>> extends IMEInventoryHandler<T>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return get access to the Cell Inventory.
|
* @return get access to the Cell Inventory.
|
||||||
*/
|
*/
|
||||||
ICellInventory getCellInv();
|
ICellInventory<T> getCellInv();
|
||||||
|
|
||||||
boolean isPreformatted();
|
boolean isPreformatted();
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,11 @@
|
|||||||
package appeng.api.storage;
|
package appeng.api.storage;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
|
||||||
import appeng.api.IAppEngApi;
|
import appeng.api.IAppEngApi;
|
||||||
import appeng.api.storage.data.IAEStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
@@ -42,9 +46,12 @@ public interface ICellRegistry
|
|||||||
/**
|
/**
|
||||||
* Register a new handler.
|
* Register a new handler.
|
||||||
*
|
*
|
||||||
|
* Never be call before {@link FMLInitializationEvent} was handled by AE2.
|
||||||
|
* Will throw an exception otherwise.
|
||||||
|
*
|
||||||
* @param handler cell handler
|
* @param handler cell handler
|
||||||
*/
|
*/
|
||||||
void addCellHandler( ICellHandler handler );
|
void addCellHandler( @Nonnull ICellHandler handler );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return true, if you can get a InventoryHandler for the item passed.
|
* return true, if you can get a InventoryHandler for the item passed.
|
||||||
@@ -63,16 +70,18 @@ public interface ICellRegistry
|
|||||||
*
|
*
|
||||||
* @return the handler registered for this item type.
|
* @return the handler registered for this item type.
|
||||||
*/
|
*/
|
||||||
|
@Nullable
|
||||||
ICellHandler getHandler( ItemStack is );
|
ICellHandler getHandler( ItemStack is );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* returns an IMEInventoryHandler for the provided item.
|
* returns an IMEInventoryHandler for the provided item.
|
||||||
*
|
*
|
||||||
* @param is item with inventory handler
|
* @param is item with inventory handler
|
||||||
* @param host can be null, or the hosting tile / part.
|
* @param host can be null. If provided, the host is responsible for persisting the cell content.
|
||||||
* @param chan the storage channel to request the handler for.
|
* @param chan the storage channel to request the handler for.
|
||||||
*
|
*
|
||||||
* @return new IMEInventoryHandler, or null if there isn't one.
|
* @return new IMEInventoryHandler, or null if there isn't one.
|
||||||
*/
|
*/
|
||||||
<T extends IAEStack<T>> IMEInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
|
@Nullable
|
||||||
|
<T extends IAEStack<T>> ICellInventoryHandler<T> getCellInventory( ItemStack is, ISaveProvider host, IStorageChannel<T> chan );
|
||||||
}
|
}
|
||||||
@@ -24,8 +24,11 @@
|
|||||||
package appeng.api.storage;
|
package appeng.api.storage;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tells the cell provider that changes have been made an the cell must be persisted
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface ISaveProvider
|
public interface ISaveProvider
|
||||||
{
|
{
|
||||||
|
void saveChanges( ICellInventory<?> cellInventory );
|
||||||
void saveChanges( IMEInventory<?> cellInventory );
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,6 +43,19 @@ import appeng.api.storage.data.IItemList;
|
|||||||
public interface IStorageChannel<T extends IAEStack<T>>
|
public interface IStorageChannel<T extends IAEStack<T>>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can be used as factor for transferring stacks of a channel.
|
||||||
|
*
|
||||||
|
* E.g. used by IO Ports to transfer 1000 mB, not 1 mB to match the
|
||||||
|
* item channel transferring a full bucket per operation.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default int transferFactor()
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link IItemList} of the specific type.
|
* Create a new {@link IItemList} of the specific type.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -149,16 +149,14 @@ public interface IAEStack<T extends IAEStack<T>>
|
|||||||
boolean equals( Object obj );
|
boolean equals( Object obj );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* compare stacks using fuzzy logic
|
* Compare the same subtype of {@link IAEStack} with another using a fuzzy comparison.
|
||||||
*
|
*
|
||||||
* a IAEItemStack to another AEItemStack or a ItemStack.
|
* @param other The stack to compare.
|
||||||
*
|
* @param mode Which {@link FuzzyMode} should be used.
|
||||||
* @param st stacks
|
|
||||||
* @param mode used fuzzy mode
|
|
||||||
*
|
*
|
||||||
* @return true if two stacks are equal based on AE Fuzzy Comparison.
|
* @return true if two stacks are equal based on AE Fuzzy Comparison.
|
||||||
*/
|
*/
|
||||||
boolean fuzzyComparison( Object st, FuzzyMode mode );
|
boolean fuzzyComparison( T other, FuzzyMode mode );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slower for disk saving, but smaller/more efficient for packets.
|
* Slower for disk saving, but smaller/more efficient for packets.
|
||||||
@@ -200,7 +198,7 @@ public interface IAEStack<T extends IAEStack<T>>
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns itemstack for display and similar purposes. Always has a count of 1.
|
* Returns itemstack for display and similar purposes. Always has a count of 1.
|
||||||
*
|
*
|
||||||
* @return itemstack
|
* @return itemstack
|
||||||
*/
|
*/
|
||||||
ItemStack asItemStackRepresentation();
|
ItemStack asItemStackRepresentation();
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 AlgorithmX2
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.api.util;
|
||||||
|
|
||||||
|
|
||||||
|
public enum AECableSize
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
NORMAL,
|
||||||
|
DENSE;
|
||||||
|
|
||||||
|
public static AECableSize min( AECableSize a, AECableSize b )
|
||||||
|
{
|
||||||
|
return a.compareTo( b ) < 0 ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AECableSize max( AECableSize a, AECableSize b )
|
||||||
|
{
|
||||||
|
return a.compareTo( b ) > 0 ? a : b;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,32 +29,32 @@ public enum AECableType
|
|||||||
/**
|
/**
|
||||||
* No Cable present.
|
* No Cable present.
|
||||||
*/
|
*/
|
||||||
NONE,
|
NONE( AECableVariant.NONE, AECableSize.NONE ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connections to this block should render as glass.
|
* Connections to this block should render as glass.
|
||||||
*/
|
*/
|
||||||
GLASS,
|
GLASS( AECableVariant.GLASS, AECableSize.NORMAL ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connections to this block should render as covered.
|
* Connections to this block should render as covered.
|
||||||
*/
|
*/
|
||||||
COVERED,
|
COVERED( AECableVariant.COVERED, AECableSize.NORMAL ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connections to this block should render as smart.
|
* Connections to this block should render as smart.
|
||||||
*/
|
*/
|
||||||
SMART,
|
SMART( AECableVariant.SMART, AECableSize.NORMAL ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
*/
|
*/
|
||||||
DENSE_COVERED,
|
DENSE_COVERED( AECableVariant.COVERED, AECableSize.DENSE ),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
* Smart Dense Cable, represents a tier 2 block that can carry 32 channels.
|
||||||
*/
|
*/
|
||||||
DENSE_SMART;
|
DENSE_SMART( AECableVariant.SMART, AECableSize.DENSE );
|
||||||
|
|
||||||
public static final AECableType[] VALIDCABLES = {
|
public static final AECableType[] VALIDCABLES = {
|
||||||
GLASS,
|
GLASS,
|
||||||
@@ -64,4 +64,97 @@ public enum AECableType
|
|||||||
DENSE_SMART
|
DENSE_SMART
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private final AECableVariant variant;
|
||||||
|
private final AECableSize size;
|
||||||
|
|
||||||
|
private AECableType( AECableVariant variant, AECableSize size )
|
||||||
|
{
|
||||||
|
this.variant = variant;
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AECableSize size()
|
||||||
|
{
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AECableVariant variant()
|
||||||
|
{
|
||||||
|
return variant;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isValid()
|
||||||
|
{
|
||||||
|
return this.variant != AECableVariant.NONE && this.size != AECableSize.NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isDense()
|
||||||
|
{
|
||||||
|
return this.size == AECableSize.DENSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSmart()
|
||||||
|
{
|
||||||
|
return this.variant == AECableVariant.SMART;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AECableType min( AECableType a, AECableType b )
|
||||||
|
{
|
||||||
|
final AECableVariant v = AECableVariant.min( a.variant(), b.variant() );
|
||||||
|
final AECableSize s = AECableSize.min( a.size(), b.size() );
|
||||||
|
|
||||||
|
return AECableType.from( v, s );
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AECableType max( AECableType a, AECableType b )
|
||||||
|
{
|
||||||
|
final AECableVariant v = AECableVariant.max( a.variant(), b.variant() );
|
||||||
|
final AECableSize s = AECableSize.max( a.size(), b.size() );
|
||||||
|
|
||||||
|
return AECableType.from( v, s );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AECableType from( AECableVariant variant, AECableSize size )
|
||||||
|
{
|
||||||
|
switch( variant )
|
||||||
|
{
|
||||||
|
case GLASS:
|
||||||
|
switch( size )
|
||||||
|
{
|
||||||
|
case NORMAL:
|
||||||
|
return GLASS;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case COVERED:
|
||||||
|
switch( size )
|
||||||
|
{
|
||||||
|
case NORMAL:
|
||||||
|
return COVERED;
|
||||||
|
case DENSE:
|
||||||
|
return DENSE_COVERED;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case SMART:
|
||||||
|
switch( size )
|
||||||
|
{
|
||||||
|
case NORMAL:
|
||||||
|
return SMART;
|
||||||
|
case DENSE:
|
||||||
|
return DENSE_SMART;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NONE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* The MIT License (MIT)
|
||||||
|
*
|
||||||
|
* Copyright (c) 2013 AlgorithmX2
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
|
* this software and associated documentation files (the "Software"), to deal in
|
||||||
|
* the Software without restriction, including without limitation the rights to
|
||||||
|
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||||
|
* the Software, and to permit persons to whom the Software is furnished to do so,
|
||||||
|
* subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in all
|
||||||
|
* copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||||
|
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.api.util;
|
||||||
|
|
||||||
|
|
||||||
|
public enum AECableVariant
|
||||||
|
{
|
||||||
|
NONE,
|
||||||
|
GLASS,
|
||||||
|
COVERED,
|
||||||
|
SMART;
|
||||||
|
|
||||||
|
public static AECableVariant min( AECableVariant a, AECableVariant b )
|
||||||
|
{
|
||||||
|
return a.compareTo( b ) < 0 ? a : b;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AECableVariant max( AECableVariant a, AECableVariant b )
|
||||||
|
{
|
||||||
|
return a.compareTo( b ) > 0 ? a : b;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -32,6 +33,7 @@ import net.minecraft.util.EnumBlockRenderType;
|
|||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.FakePlayer;
|
import net.minecraftforge.common.util.FakePlayer;
|
||||||
|
|
||||||
@@ -164,4 +166,16 @@ public class BlockCrank extends AEBaseTileBlock
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canPlaceTorchOnTop( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockFaceShape getBlockFaceShape( IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face )
|
||||||
|
{
|
||||||
|
return BlockFaceShape.UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,17 +37,13 @@ import net.minecraft.init.SoundEvents;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
import net.minecraft.util.SoundCategory;
|
import net.minecraft.util.SoundCategory;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.Explosion;
|
import net.minecraft.world.Explosion;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
|
||||||
|
|
||||||
import appeng.block.AEBaseBlock;
|
import appeng.block.AEBaseBlock;
|
||||||
import appeng.core.AppEng;
|
|
||||||
import appeng.entity.EntityIds;
|
|
||||||
import appeng.entity.EntityTinyTNTPrimed;
|
import appeng.entity.EntityTinyTNTPrimed;
|
||||||
import appeng.helpers.ICustomCollision;
|
import appeng.helpers.ICustomCollision;
|
||||||
|
|
||||||
@@ -67,9 +63,6 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision
|
|||||||
|
|
||||||
this.setSoundType( SoundType.GROUND );
|
this.setSoundType( SoundType.GROUND );
|
||||||
this.setHardness( 0F );
|
this.setHardness( 0F );
|
||||||
|
|
||||||
EntityRegistry.registerModEntity( new ResourceLocation( AppEng.MOD_ID, EntityTinyTNTPrimed.class.getName() ), EntityTinyTNTPrimed.class,
|
|
||||||
"EntityTinyTNTPrimed", EntityIds.get( EntityTinyTNTPrimed.class ), AppEng.instance(), 16, 4, true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import net.minecraft.util.EnumHand;
|
|||||||
import net.minecraft.util.NonNullList;
|
import net.minecraft.util.NonNullList;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
|
import net.minecraft.util.math.RayTraceResult.Type;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@@ -70,6 +71,8 @@ import appeng.client.render.cablebus.CableBusBakedModel;
|
|||||||
import appeng.client.render.cablebus.CableBusRenderState;
|
import appeng.client.render.cablebus.CableBusRenderState;
|
||||||
import appeng.core.Api;
|
import appeng.core.Api;
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketClick;
|
||||||
import appeng.helpers.AEGlassMaterial;
|
import appeng.helpers.AEGlassMaterial;
|
||||||
import appeng.parts.ICableBusContainer;
|
import appeng.parts.ICableBusContainer;
|
||||||
import appeng.parts.NullCableBusContainer;
|
import appeng.parts.NullCableBusContainer;
|
||||||
@@ -101,7 +104,6 @@ public class BlockCableBus extends AEBaseTileBlock
|
|||||||
// this will actually be overwritten later through setupTile and the
|
// this will actually be overwritten later through setupTile and the
|
||||||
// combined layers
|
// combined layers
|
||||||
this.setTileEntity( TileCableBus.class );
|
this.setTileEntity( TileCableBus.class );
|
||||||
this.useNeighborBrightness = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -354,6 +356,31 @@ public class BlockCableBus extends AEBaseTileBlock
|
|||||||
return out == null ? NULL_CABLE_BUS : out;
|
return out == null ? NULL_CABLE_BUS : out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockClicked( World worldIn, BlockPos pos, EntityPlayer playerIn )
|
||||||
|
{
|
||||||
|
if( Platform.isClient() )
|
||||||
|
{
|
||||||
|
final RayTraceResult rtr = Minecraft.getMinecraft().objectMouseOver;
|
||||||
|
if( rtr != null && rtr.typeOfHit == Type.BLOCK && pos.equals( rtr.getBlockPos() ) )
|
||||||
|
{
|
||||||
|
final Vec3d hitVec = rtr.hitVec.subtract( new Vec3d( pos ) );
|
||||||
|
|
||||||
|
if( this.cb( worldIn, pos ).clicked( playerIn, EnumHand.MAIN_HAND, hitVec ) )
|
||||||
|
{
|
||||||
|
NetworkHandler.instance()
|
||||||
|
.sendToServer(
|
||||||
|
new PacketClick( pos, rtr.sideHit, (float) hitVec.x, (float) hitVec.y, (float) hitVec.z, EnumHand.MAIN_HAND, true ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onBlockClickPacket( World worldIn, BlockPos pos, EntityPlayer playerIn, EnumHand hand, Vec3d hitVec )
|
||||||
|
{
|
||||||
|
this.cb( worldIn, pos ).clicked( playerIn, hand, hitVec );
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
public boolean onActivated( final World w, final BlockPos pos, final EntityPlayer player, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -74,13 +74,8 @@ public class BlockDrive extends AEBaseTileBlock
|
|||||||
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
public IBlockState getExtendedState( IBlockState state, IBlockAccess world, BlockPos pos )
|
||||||
{
|
{
|
||||||
TileDrive te = this.getTileEntity( world, pos );
|
TileDrive te = this.getTileEntity( world, pos );
|
||||||
if( te == null )
|
|
||||||
{
|
|
||||||
return super.getExtendedState( state, world, pos );
|
|
||||||
}
|
|
||||||
|
|
||||||
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
IExtendedBlockState extState = (IExtendedBlockState) super.getExtendedState( state, world, pos );
|
||||||
return extState.withProperty( SLOTS_STATE, DriveSlotsState.fromChestOrDrive( te ) );
|
return extState.withProperty( SLOTS_STATE, te == null ? DriveSlotsState.createEmpty( 10 ) : DriveSlotsState.fromChestOrDrive( te ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ import appeng.util.Platform;
|
|||||||
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final double AABB_OFFSET_BOTTOM = .0625d;
|
private static final double AABB_OFFSET_BOTTOM = 0.00;
|
||||||
private static final double AABB_OFFSET_SIDES = 0;
|
private static final double AABB_OFFSET_SIDES = 0.06;
|
||||||
private static final double AABB_OFFSET_TOP = .125d;
|
private static final double AABB_OFFSET_TOP = 0.125;
|
||||||
|
|
||||||
public enum SkyChestType
|
public enum SkyChestType
|
||||||
{
|
{
|
||||||
@@ -111,18 +111,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision
|
|||||||
o = sk.getUp();
|
o = sk.getUp();
|
||||||
}
|
}
|
||||||
|
|
||||||
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
|
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||||
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
|
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||||
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_BOTTOM : AABB_OFFSET_SIDES;
|
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_SIDES : 0.0;
|
||||||
|
|
||||||
// x/z needs to be multiplied by -1, thus we simply add not substract.
|
// for x/z top and bottom is swapped
|
||||||
final double minX = Math.max( 0.0, offsetX + o.getFrontOffsetX() * AABB_OFFSET_TOP );
|
final double minX = Math.max( 0.0, offsetX + ( o.getFrontOffsetX() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetX() * AABB_OFFSET_TOP ) ) );
|
||||||
final double minY = Math.max( 0.0, offsetY - o.getFrontOffsetY() * AABB_OFFSET_TOP );
|
final double minY = Math.max( 0.0, offsetY + ( o.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetY() * AABB_OFFSET_BOTTOM ) ) );
|
||||||
final double minZ = Math.max( 0.0, offsetZ + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
|
final double minZ = Math.max( 0.0, offsetZ + ( o.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetZ() * AABB_OFFSET_TOP ) ) );
|
||||||
|
|
||||||
final double maxX = Math.min( 1.0, ( 1.0 - offsetX ) + o.getFrontOffsetX() * AABB_OFFSET_TOP );
|
final double maxX = Math.min( 1.0, 1.0 - offsetX - ( o.getFrontOffsetX() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetX() * AABB_OFFSET_BOTTOM ) ) );
|
||||||
final double maxY = Math.min( 1.0, ( 1.0 - offsetY ) - o.getFrontOffsetY() * AABB_OFFSET_TOP );
|
final double maxY = Math.min( 1.0, 1.0 - offsetY - ( o.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : ( o.getFrontOffsetY() * AABB_OFFSET_TOP ) ) );
|
||||||
final double maxZ = Math.min( 1.0, ( 1.0 - offsetZ ) + o.getFrontOffsetZ() * AABB_OFFSET_TOP );
|
final double maxZ = Math.min( 1.0, 1.0 - offsetZ - ( o.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : ( o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM ) ) );
|
||||||
|
|
||||||
return new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
|
return new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,4 +75,14 @@ public class DriveSlotsState
|
|||||||
}
|
}
|
||||||
return new DriveSlotsState( slots );
|
return new DriveSlotsState( slots );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DriveSlotsState createEmpty( int slotCount )
|
||||||
|
{
|
||||||
|
DriveSlotState[] slots = new DriveSlotState[slotCount];
|
||||||
|
for( int i = 0; i < slotCount; i++ )
|
||||||
|
{
|
||||||
|
slots[i] = DriveSlotState.EMPTY;
|
||||||
|
}
|
||||||
|
return new DriveSlotsState( slots );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class ItemDefinitionBuilder implements IItemBuilder
|
|||||||
item.setCreativeTab( this.creativeTab );
|
item.setCreativeTab( this.creativeTab );
|
||||||
|
|
||||||
// Register all extra handlers
|
// Register all extra handlers
|
||||||
this.boostrapComponents.forEach( component -> component.apply( item ) );
|
this.boostrapComponents.forEach( component -> this.factory.addBootstrapComponent( component.apply( item ) ) );
|
||||||
|
|
||||||
// Register custom dispenser behavior if requested
|
// Register custom dispenser behavior if requested
|
||||||
if( this.dispenserBehaviorSupplier != null )
|
if( this.dispenserBehaviorSupplier != null )
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package appeng.bootstrap.components;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.common.registry.EntityEntry;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
import appeng.bootstrap.IBootstrapComponent;
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface IEntityRegistrationComponent extends IBootstrapComponent
|
||||||
|
{
|
||||||
|
void entityRegistration( IForgeRegistry<EntityEntry> entityRegistry );
|
||||||
|
}
|
||||||
@@ -26,10 +26,8 @@ import java.util.Random;
|
|||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.EnumHand;
|
import net.minecraft.util.EnumHand;
|
||||||
import net.minecraft.util.math.RayTraceResult;
|
import net.minecraft.util.math.RayTraceResult;
|
||||||
@@ -42,6 +40,7 @@ import net.minecraftforge.client.model.ModelLoaderRegistry;
|
|||||||
import net.minecraftforge.common.ForgeModContainer;
|
import net.minecraftforge.common.ForgeModContainer;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.client.FMLClientHandler;
|
import net.minecraftforge.fml.client.FMLClientHandler;
|
||||||
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
|
||||||
import appeng.api.parts.CableRenderMode;
|
import appeng.api.parts.CableRenderMode;
|
||||||
@@ -85,30 +84,14 @@ public class ClientHelper extends ServerHelper
|
|||||||
{
|
{
|
||||||
ModelLoaderRegistry.registerLoader( UVLModelLoader.INSTANCE );
|
ModelLoaderRegistry.registerLoader( UVLModelLoader.INSTANCE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler( EntityTinyTNTPrimed.class, manager -> new RenderTinyTNTPrimed( manager ) );
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler( EntityFloatingItem.class, manager -> new RenderFloatingItem( manager ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init()
|
public void init()
|
||||||
{
|
{
|
||||||
// final Block fluixBlock = GameRegistry.findBlock( "appliedenergistics2", "fluix" );
|
|
||||||
// Item fluixItem = Item.getItemFromBlock( fluixBlock );
|
|
||||||
// ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation( "appliedenergistics2:fluix",
|
|
||||||
// "inventory" );
|
|
||||||
// final int DEFAULT_ITEM_SUBTYPE = 0;
|
|
||||||
// final ItemModelMesher mesher = Minecraft.getMinecraft().getRenderItem().getItemModelMesher();
|
|
||||||
// // mesher.register( fluixItem, DEFAULT_ITEM_SUBTYPE, itemModelResourceLocation );
|
|
||||||
//
|
|
||||||
// final ResourceLocation resource = new ResourceLocation( "appliedenergistics2", "stair.fluix" );
|
|
||||||
// final ModelResourceLocation fluixStairModel = new ModelResourceLocation( resource, "inventory" );
|
|
||||||
// AELog.info( "FluixStairModel: " + fluixStairModel );
|
|
||||||
//
|
|
||||||
// final Set<Item> items = AEApi.instance().definitions().blocks().fluixStairs().maybeItem().asSet();
|
|
||||||
// for( Item item : items )
|
|
||||||
// {
|
|
||||||
// AELog.info( "Registering with %s with unlocalized %s", item, item.getUnlocalizedName() );
|
|
||||||
// mesher.register( item, DEFAULT_ITEM_SUBTYPE, fluixStairModel );
|
|
||||||
// }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -199,11 +182,6 @@ public class ClientHelper extends ServerHelper
|
|||||||
@Override
|
@Override
|
||||||
public void postInit()
|
public void postInit()
|
||||||
{
|
{
|
||||||
// RenderingRegistry.registerBlockHandler( WorldRender.INSTANCE );
|
|
||||||
final RenderManager inst = Minecraft.getMinecraft().getRenderManager();
|
|
||||||
|
|
||||||
inst.entityRenderMap.put( EntityTinyTNTPrimed.class, new RenderTinyTNTPrimed( inst ) );
|
|
||||||
inst.entityRenderMap.put( EntityFloatingItem.class, new RenderFloatingItem( inst ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -330,29 +308,20 @@ public class ClientHelper extends ServerHelper
|
|||||||
final EntityPlayer player = mc.player;
|
final EntityPlayer player = mc.player;
|
||||||
if( player.isSneaking() )
|
if( player.isSneaking() )
|
||||||
{
|
{
|
||||||
final EnumHand hand;
|
final boolean mainHand = player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem;
|
||||||
if( !player.getHeldItem( EnumHand.MAIN_HAND ).isEmpty() && player.getHeldItem( EnumHand.MAIN_HAND ).getItem() instanceof IMouseWheelItem )
|
final boolean offHand = player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem;
|
||||||
{
|
|
||||||
hand = EnumHand.MAIN_HAND;
|
|
||||||
}
|
|
||||||
else if( !player.getHeldItem( EnumHand.OFF_HAND ).isEmpty() && player.getHeldItem( EnumHand.OFF_HAND ).getItem() instanceof IMouseWheelItem )
|
|
||||||
{
|
|
||||||
hand = EnumHand.OFF_HAND;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final ItemStack is = player.getHeldItem( hand );
|
if( mainHand || offHand )
|
||||||
try
|
|
||||||
{
|
{
|
||||||
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getDwheel() > 0 ? "WheelUp" : "WheelDown" ) );
|
try
|
||||||
me.setCanceled( true );
|
{
|
||||||
}
|
NetworkHandler.instance().sendToServer( new PacketValueConfig( "Item", me.getDwheel() > 0 ? "WheelUp" : "WheelDown" ) );
|
||||||
catch( final IOException e )
|
me.setCanceled( true );
|
||||||
{
|
}
|
||||||
AELog.debug( e );
|
catch( final IOException e )
|
||||||
|
{
|
||||||
|
AELog.debug( e );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,11 +22,11 @@ package appeng.client.gui;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -46,6 +46,8 @@ import net.minecraft.client.renderer.BufferBuilder;
|
|||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ClickType;
|
import net.minecraft.inventory.ClickType;
|
||||||
@@ -54,8 +56,11 @@ import net.minecraft.inventory.Slot;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraft.util.text.TextFormatting;
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.client.gui.widgets.GuiCustomSlot;
|
||||||
import appeng.client.gui.widgets.GuiScrollbar;
|
import appeng.client.gui.widgets.GuiScrollbar;
|
||||||
import appeng.client.gui.widgets.ITooltip;
|
import appeng.client.gui.widgets.ITooltip;
|
||||||
import appeng.client.me.InternalSlotME;
|
import appeng.client.me.InternalSlotME;
|
||||||
@@ -66,7 +71,7 @@ import appeng.container.AEBaseContainer;
|
|||||||
import appeng.container.slot.AppEngCraftingSlot;
|
import appeng.container.slot.AppEngCraftingSlot;
|
||||||
import appeng.container.slot.AppEngSlot;
|
import appeng.container.slot.AppEngSlot;
|
||||||
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
|
import appeng.container.slot.AppEngSlot.hasCalculatedValidness;
|
||||||
import appeng.container.slot.OptionalSlotFake;
|
import appeng.container.slot.IOptionalSlot;
|
||||||
import appeng.container.slot.SlotCraftingTerm;
|
import appeng.container.slot.SlotCraftingTerm;
|
||||||
import appeng.container.slot.SlotDisabled;
|
import appeng.container.slot.SlotDisabled;
|
||||||
import appeng.container.slot.SlotFake;
|
import appeng.container.slot.SlotFake;
|
||||||
@@ -79,20 +84,24 @@ import appeng.core.AppEng;
|
|||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketInventoryAction;
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
import appeng.core.sync.packets.PacketSwapSlots;
|
import appeng.core.sync.packets.PacketSwapSlots;
|
||||||
|
import appeng.fluids.client.render.FluidStackSizeRenderer;
|
||||||
|
import appeng.fluids.container.slots.IMEFluidSlot;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
|
|
||||||
|
|
||||||
public abstract class AEBaseGui extends GuiContainer
|
public abstract class AEBaseGui extends GuiContainer
|
||||||
{
|
{
|
||||||
private final List<InternalSlotME> meSlots = new LinkedList<>();
|
private final List<InternalSlotME> meSlots = new ArrayList<>();
|
||||||
// drag y
|
// drag y
|
||||||
private final Set<Slot> drag_click = new HashSet<>();
|
private final Set<Slot> drag_click = new HashSet<>();
|
||||||
private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer();
|
private final StackSizeRenderer stackSizeRenderer = new StackSizeRenderer();
|
||||||
|
private final FluidStackSizeRenderer fluidStackSizeRenderer = new FluidStackSizeRenderer();
|
||||||
private GuiScrollbar myScrollBar = null;
|
private GuiScrollbar myScrollBar = null;
|
||||||
private boolean disableShiftClick = false;
|
private boolean disableShiftClick = false;
|
||||||
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
private Stopwatch dbl_clickTimer = Stopwatch.createStarted();
|
||||||
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
private ItemStack dbl_whichItem = ItemStack.EMPTY;
|
||||||
private Slot bl_clicked;
|
private Slot bl_clicked;
|
||||||
|
protected final List<GuiCustomSlot> guiSlots = new ArrayList<>();
|
||||||
|
|
||||||
public AEBaseGui( final Container container )
|
public AEBaseGui( final Container container )
|
||||||
{
|
{
|
||||||
@@ -146,35 +155,76 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen( final int mouseX, final int mouseY, final float btn )
|
public void drawScreen( final int mouseX, final int mouseY, final float partialTicks )
|
||||||
{
|
{
|
||||||
super.drawDefaultBackground();
|
super.drawDefaultBackground();
|
||||||
super.drawScreen( mouseX, mouseY, btn );
|
super.drawScreen( mouseX, mouseY, partialTicks );
|
||||||
|
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate( (float) this.guiLeft, (float) this.guiTop, 0.0F );
|
||||||
|
GlStateManager.enableDepth();
|
||||||
|
for( final GuiCustomSlot c : this.guiSlots )
|
||||||
|
{
|
||||||
|
drawGuiSlot( c, mouseX, mouseY, partialTicks );
|
||||||
|
}
|
||||||
|
GlStateManager.disableDepth();
|
||||||
|
for( final GuiCustomSlot c : this.guiSlots )
|
||||||
|
{
|
||||||
|
drawTooltip( c, mouseX - this.guiLeft, mouseY - this.guiTop );
|
||||||
|
}
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
this.renderHoveredToolTip( mouseX, mouseY );
|
this.renderHoveredToolTip( mouseX, mouseY );
|
||||||
|
|
||||||
for( final Object c : this.buttonList )
|
for( final Object c : this.buttonList )
|
||||||
{
|
{
|
||||||
if( c instanceof ITooltip )
|
if( c instanceof ITooltip )
|
||||||
{
|
{
|
||||||
final ITooltip tooltip = (ITooltip) c;
|
drawTooltip( (ITooltip) c, mouseX, mouseY );
|
||||||
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
|
}
|
||||||
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
|
protected void drawGuiSlot( GuiCustomSlot slot, int mouseX, int mouseY, float partialTicks )
|
||||||
|
{
|
||||||
|
if( slot.isSlotEnabled() )
|
||||||
|
{
|
||||||
|
final int left = slot.xPos();
|
||||||
|
final int top = slot.yPos();
|
||||||
|
final int right = left + slot.getWidth();
|
||||||
|
final int bottom = top + slot.getHeight();
|
||||||
|
|
||||||
|
slot.drawContent( this.mc, mouseX, mouseY, partialTicks );
|
||||||
|
|
||||||
|
if( this.isPointInRegion( left, top, slot.getWidth(), slot.getHeight(), mouseX, mouseY ) && slot.canClick( this.mc.player ) )
|
||||||
|
{
|
||||||
|
GlStateManager.disableLighting();
|
||||||
|
GlStateManager.colorMask( true, true, true, false );
|
||||||
|
this.drawGradientRect( left, top, right, bottom, -2130706433, -2130706433 );
|
||||||
|
GlStateManager.colorMask( true, true, true, true );
|
||||||
|
GlStateManager.enableLighting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void drawTooltip( ITooltip tooltip, int mouseX, int mouseY )
|
||||||
|
{
|
||||||
|
final int x = tooltip.xPos(); // ((GuiImgButton) c).x;
|
||||||
|
int y = tooltip.yPos(); // ((GuiImgButton) c).y;
|
||||||
|
|
||||||
|
if( x < mouseX && x + tooltip.getWidth() > mouseX && tooltip.isVisible() )
|
||||||
|
{
|
||||||
|
if( y < mouseY && y + tooltip.getHeight() > mouseY )
|
||||||
|
{
|
||||||
|
if( y < 15 )
|
||||||
{
|
{
|
||||||
if( y < mouseY && y + tooltip.getHeight() > mouseY )
|
y = 15;
|
||||||
{
|
}
|
||||||
if( y < 15 )
|
|
||||||
{
|
|
||||||
y = 15;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String msg = tooltip.getMessage();
|
final String msg = tooltip.getMessage();
|
||||||
if( msg != null )
|
if( msg != null )
|
||||||
{
|
{
|
||||||
this.drawTooltip( x + 11, y + 4, msg );
|
this.drawTooltip( x + 11, y + 4, msg );
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -236,27 +286,36 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
final List<Slot> slots = this.getInventorySlots();
|
final List<Slot> slots = this.getInventorySlots();
|
||||||
for( final Slot slot : slots )
|
for( final Slot slot : slots )
|
||||||
{
|
{
|
||||||
if( slot instanceof OptionalSlotFake )
|
if( slot instanceof IOptionalSlot )
|
||||||
{
|
{
|
||||||
final OptionalSlotFake fs = (OptionalSlotFake) slot;
|
final IOptionalSlot optionalSlot = (IOptionalSlot) slot;
|
||||||
if( fs.renderDisabled() )
|
if( optionalSlot.isRenderDisabled() )
|
||||||
{
|
{
|
||||||
if( fs.isSlotEnabled() )
|
final AppEngSlot aeSlot = (AppEngSlot) slot;
|
||||||
|
if( aeSlot.isSlotEnabled() )
|
||||||
{
|
{
|
||||||
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
|
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
|
||||||
|
18,
|
||||||
18 );
|
18 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
|
GlStateManager.color( 1.0F, 1.0F, 1.0F, 0.4F );
|
||||||
GlStateManager.enableBlend();
|
GlStateManager.enableBlend();
|
||||||
this.drawTexturedModalRect( ox + fs.xPos - 1, oy + fs.yPos - 1, fs.getSourceX() - 1, fs.getSourceY() - 1, 18,
|
this.drawTexturedModalRect( ox + aeSlot.xPos - 1, oy + aeSlot.yPos - 1, optionalSlot.getSourceX() - 1, optionalSlot.getSourceY() - 1,
|
||||||
|
18,
|
||||||
18 );
|
18 );
|
||||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( final GuiCustomSlot slot : this.guiSlots )
|
||||||
|
{
|
||||||
|
slot.drawBackground( ox, oy );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -277,6 +336,14 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for( GuiCustomSlot slot : this.guiSlots )
|
||||||
|
{
|
||||||
|
if( this.isPointInRegion( slot.xPos(), slot.yPos(), slot.getWidth(), slot.getHeight(), xCoord, yCoord ) && slot.canClick( this.mc.player ) )
|
||||||
|
{
|
||||||
|
slot.slotClicked( this.mc.player.inventory.getItemStack(), btn );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if( this.getScrollBar() != null )
|
if( this.getScrollBar() != null )
|
||||||
{
|
{
|
||||||
this.getScrollBar().click( this, xCoord - this.guiLeft, yCoord - this.guiTop );
|
this.getScrollBar().click( this, xCoord - this.guiLeft, yCoord - this.guiTop );
|
||||||
@@ -488,11 +555,11 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !this.disableShiftClick && isShiftKeyDown() )
|
if( !this.disableShiftClick && isShiftKeyDown() && mouseButton == 0 )
|
||||||
{
|
{
|
||||||
this.disableShiftClick = true;
|
this.disableShiftClick = true;
|
||||||
|
|
||||||
if( this.dbl_whichItem.isEmpty() || this.bl_clicked != slot || this.dbl_clickTimer.elapsed( TimeUnit.MILLISECONDS ) > 150 )
|
if( this.dbl_whichItem.isEmpty() || this.bl_clicked != slot || this.dbl_clickTimer.elapsed( TimeUnit.MILLISECONDS ) > 250 )
|
||||||
{
|
{
|
||||||
// some simple double click logic.
|
// some simple double click logic.
|
||||||
this.bl_clicked = slot;
|
this.bl_clicked = slot;
|
||||||
@@ -514,12 +581,13 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
for( final Slot inventorySlot : slots )
|
for( final Slot inventorySlot : slots )
|
||||||
{
|
{
|
||||||
if( inventorySlot != null && inventorySlot.canTakeStack(
|
if( inventorySlot != null && inventorySlot.canTakeStack(
|
||||||
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.inventory == slot.inventory && Container.canAddItemToSlot(
|
this.mc.player ) && inventorySlot.getHasStack() && inventorySlot.isSameInventory( slot ) && Container.canAddItemToSlot(
|
||||||
inventorySlot, this.dbl_whichItem, true ) )
|
inventorySlot, this.dbl_whichItem, true ) )
|
||||||
{
|
{
|
||||||
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 1, clickType );
|
this.handleMouseClick( inventorySlot, inventorySlot.slotNumber, 0, ClickType.QUICK_MOVE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
this.dbl_whichItem = ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.disableShiftClick = false;
|
this.disableShiftClick = false;
|
||||||
@@ -715,6 +783,39 @@ public abstract class AEBaseGui extends GuiContainer
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if( s instanceof IMEFluidSlot && ( (IMEFluidSlot) s ).shouldRenderAsFluid() )
|
||||||
|
{
|
||||||
|
final IMEFluidSlot slot = (IMEFluidSlot) s;
|
||||||
|
final IAEFluidStack fs = slot.getAEFluidStack();
|
||||||
|
|
||||||
|
if( fs != null && this.isPowered() )
|
||||||
|
{
|
||||||
|
GlStateManager.disableLighting();
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
final Fluid fluid = fs.getFluid();
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture( TextureMap.LOCATION_BLOCKS_TEXTURE );
|
||||||
|
final TextureAtlasSprite sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite( fluid.getStill().toString() );
|
||||||
|
|
||||||
|
// Set color for dynamic fluids
|
||||||
|
// Convert int color to RGB
|
||||||
|
float red = ( fluid.getColor() >> 16 & 255 ) / 255.0F;
|
||||||
|
float green = ( fluid.getColor() >> 8 & 255 ) / 255.0F;
|
||||||
|
float blue = ( fluid.getColor() & 255 ) / 255.0F;
|
||||||
|
GlStateManager.color( red, green, blue );
|
||||||
|
|
||||||
|
this.drawTexturedModalRect( s.xPos, s.yPos, sprite, 16, 16 );
|
||||||
|
GlStateManager.enableLighting();
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
|
||||||
|
this.fluidStackSizeRenderer.renderStackSize( this.fontRenderer, fs, s.xPos, s.yPos );
|
||||||
|
}
|
||||||
|
else if( !this.isPowered() )
|
||||||
|
{
|
||||||
|
drawRect( s.xPos, s.yPos, 16 + s.xPos, 16 + s.yPos, 0x66111111 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import java.text.NumberFormat;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
import net.minecraft.client.util.ITooltipFlag;
|
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -43,70 +42,17 @@ public abstract class AEBaseMEGui extends AEBaseGui
|
|||||||
super( container );
|
super( container );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> handleItemTooltip( final ItemStack stack, final int mouseX, final int mouseY, final List<String> currentToolTip )
|
|
||||||
{
|
|
||||||
if( !stack.isEmpty() )
|
|
||||||
{
|
|
||||||
final Slot s = this.getSlot( mouseX, mouseY );
|
|
||||||
if( s instanceof SlotME )
|
|
||||||
{
|
|
||||||
final int BigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
|
||||||
|
|
||||||
IAEItemStack myStack = null;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final SlotME theSlotField = (SlotME) s;
|
|
||||||
myStack = theSlotField.getAEStack();
|
|
||||||
}
|
|
||||||
catch( final Throwable ignore )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
if( myStack != null )
|
|
||||||
{
|
|
||||||
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
|
|
||||||
{
|
|
||||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
|
||||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() );
|
|
||||||
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() );
|
|
||||||
final String format = String.format( local, formattedAmount );
|
|
||||||
|
|
||||||
currentToolTip.add( TextFormatting.GRAY + format );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if( stack.getCount() > BigNumber || ( stack.getCount() > 1 && stack.isItemDamaged() ) )
|
|
||||||
{
|
|
||||||
final String local = ButtonToolTips.ItemsStored.getLocal();
|
|
||||||
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() );
|
|
||||||
final String format = String.format( local, formattedAmount );
|
|
||||||
|
|
||||||
currentToolTip.add( TextFormatting.GRAY + format );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return currentToolTip;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vanilla version...
|
|
||||||
// protected void drawItemStackTooltip(ItemStack stack, int x, int y)
|
|
||||||
@Override
|
@Override
|
||||||
protected void renderToolTip( 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 );
|
final Slot s = this.getSlot( x, y );
|
||||||
|
|
||||||
if( s instanceof SlotME && !stack.isEmpty() )
|
if( s instanceof SlotME && !stack.isEmpty() )
|
||||||
{
|
{
|
||||||
final int BigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
final int bigNumber = AEConfig.instance().useTerminalUseLargeFont() ? 999 : 9999;
|
||||||
|
|
||||||
IAEItemStack myStack = null;
|
IAEItemStack myStack = null;
|
||||||
|
final List<String> currentToolTip = this.getItemToolTip( stack );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -117,33 +63,44 @@ public abstract class AEBaseMEGui extends AEBaseGui
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
ITooltipFlag.TooltipFlags tooltipFlag = this.mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL;
|
|
||||||
if( myStack != null )
|
if( myStack != null )
|
||||||
{
|
{
|
||||||
final List<String> currentToolTip = stack.getTooltip( this.mc.player, tooltipFlag );
|
if( myStack.getStackSize() > bigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
|
||||||
|
|
||||||
if( myStack.getStackSize() > BigNumber || ( myStack.getStackSize() > 1 && stack.isItemDamaged() ) )
|
|
||||||
{
|
{
|
||||||
currentToolTip.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() ) );
|
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||||
|
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( myStack.getStackSize() );
|
||||||
|
final String format = String.format( local, formattedAmount );
|
||||||
|
|
||||||
|
currentToolTip.add( TextFormatting.GRAY + format );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( myStack.getCountRequestable() > 0 )
|
if( myStack.getCountRequestable() > 0 )
|
||||||
{
|
{
|
||||||
currentToolTip.add( "Items Requestable: " + NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() ) );
|
final String local = ButtonToolTips.ItemsRequestable.getLocal();
|
||||||
|
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( myStack.getCountRequestable() );
|
||||||
|
final String format = String.format( local, formattedAmount );
|
||||||
|
|
||||||
|
currentToolTip.add( format );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.drawTooltip( x, y, currentToolTip );
|
this.drawHoveringText( currentToolTip, x, y, this.fontRenderer );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if( stack.getCount() > BigNumber )
|
else if( stack.getCount() > bigNumber )
|
||||||
{
|
{
|
||||||
List<String> var4 = stack.getTooltip( this.mc.player, tooltipFlag );
|
final String local = ButtonToolTips.ItemsStored.getLocal();
|
||||||
var4.add( "Items Stored: " + NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() ) );
|
final String formattedAmount = NumberFormat.getNumberInstance( Locale.US ).format( stack.getCount() );
|
||||||
this.drawTooltip( x, y, var4 );
|
final String format = String.format( local, formattedAmount );
|
||||||
|
|
||||||
|
currentToolTip.add( TextFormatting.GRAY + format );
|
||||||
|
|
||||||
|
this.drawHoveringText( currentToolTip, x, y, this.fontRenderer );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.renderToolTip( stack, x, y );
|
super.renderToolTip( stack, x, y );
|
||||||
// super.drawItemStackTooltip( stack, x, y );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -23,7 +23,6 @@ import java.io.IOException;
|
|||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
import com.google.common.base.Joiner;
|
||||||
@@ -238,7 +237,7 @@ public class GuiCraftConfirm extends AEBaseGui
|
|||||||
final int viewEnd = viewStart + 3 * this.rows;
|
final int viewEnd = viewStart + 3 * this.rows;
|
||||||
|
|
||||||
String dspToolTip = "";
|
String dspToolTip = "";
|
||||||
final List<String> lineList = new LinkedList<>();
|
final List<String> lineList = new ArrayList<>();
|
||||||
int toolPosX = 0;
|
int toolPosX = 0;
|
||||||
int toolPosY = 0;
|
int toolPosY = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,6 @@ package appeng.client.gui.implementations;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
@@ -212,7 +211,7 @@ public class GuiCraftingCPU extends AEBaseGui implements ISortSource
|
|||||||
final int viewEnd = viewStart + 3 * 6;
|
final int viewEnd = viewStart + 3 * 6;
|
||||||
|
|
||||||
String dspToolTip = "";
|
String dspToolTip = "";
|
||||||
final List<String> lineList = new LinkedList<>();
|
final List<String> lineList = new ArrayList<>();
|
||||||
int toolPosX = 0;
|
int toolPosX = 0;
|
||||||
int toolPosY = 0;
|
int toolPosY = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -82,8 +82,8 @@ public class GuiInterface extends GuiUpgradeable
|
|||||||
|
|
||||||
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
|
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.Interface.getLocal() ), 8, 6, 4210752 );
|
||||||
|
|
||||||
this.fontRenderer.drawString( GuiText.Config.getLocal(), 18, 6 + 11 + 7, 4210752 );
|
this.fontRenderer.drawString( GuiText.Config.getLocal(), 8, 6 + 11 + 7, 4210752 );
|
||||||
this.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 18, 6 + 60 + 7, 4210752 );
|
this.fontRenderer.drawString( GuiText.StoredItems.getLocal(), 8, 6 + 60 + 7, 4210752 );
|
||||||
this.fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
|
this.fontRenderer.drawString( GuiText.Patterns.getLocal(), 8, 6 + 73 + 7, 4210752 );
|
||||||
|
|
||||||
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
private GuiImgButton SortDirBox;
|
private GuiImgButton SortDirBox;
|
||||||
private GuiImgButton searchBoxSettings;
|
private GuiImgButton searchBoxSettings;
|
||||||
private GuiImgButton terminalStyleBox;
|
private GuiImgButton terminalStyleBox;
|
||||||
|
private boolean isAutoFocus = false;
|
||||||
|
private int currentMouseX = 0;
|
||||||
|
private int currentMouseY = 0;
|
||||||
|
|
||||||
public GuiMEMonitorable( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
public GuiMEMonitorable( final InventoryPlayer inventoryPlayer, final ITerminalHost te )
|
||||||
{
|
{
|
||||||
@@ -224,8 +227,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
Keyboard.enableRepeatEvents( true );
|
Keyboard.enableRepeatEvents( true );
|
||||||
|
|
||||||
this.maxRows = this.getMaxRows();
|
this.maxRows = this.getMaxRows();
|
||||||
this.perRow = AEConfig.instance().getConfigManager().getSetting(
|
this.perRow = AEConfig.instance()
|
||||||
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
.getConfigManager()
|
||||||
|
.getSetting(
|
||||||
|
Settings.TERMINAL_STYLE ) != TerminalStyle.FULL ? 9 : 9 + ( ( this.width - this.standardSize ) / 18 );
|
||||||
|
|
||||||
final int magicNumber = 114 + 1;
|
final int magicNumber = 114 + 1;
|
||||||
final int extraSpace = this.height - magicNumber - this.reservedSpace;
|
final int extraSpace = this.height - magicNumber - this.reservedSpace;
|
||||||
@@ -290,8 +295,10 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
offset += 20;
|
offset += 20;
|
||||||
|
|
||||||
this.buttonList.add(
|
this.buttonList.add(
|
||||||
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance().getConfigManager().getSetting(
|
this.searchBoxSettings = new GuiImgButton( this.guiLeft - 18, offset, Settings.SEARCH_MODE, AEConfig.instance()
|
||||||
Settings.SEARCH_MODE ) ) );
|
.getConfigManager()
|
||||||
|
.getSetting(
|
||||||
|
Settings.SEARCH_MODE ) ) );
|
||||||
|
|
||||||
offset += 20;
|
offset += 20;
|
||||||
|
|
||||||
@@ -306,7 +313,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
this.searchField.setEnableBackgroundDrawing( false );
|
this.searchField.setEnableBackgroundDrawing( false );
|
||||||
this.searchField.setMaxStringLength( 25 );
|
this.searchField.setMaxStringLength( 25 );
|
||||||
this.searchField.setTextColor( 0xFFFFFF );
|
this.searchField.setTextColor( 0xFFFFFF );
|
||||||
this.searchField.setSelectionColor( 0xFF99FF99 );
|
this.searchField.setSelectionColor( 0xFF008000 );
|
||||||
this.searchField.setVisible( true );
|
this.searchField.setVisible( true );
|
||||||
|
|
||||||
if( this.viewCell || this instanceof GuiWirelessTerm )
|
if( this.viewCell || this instanceof GuiWirelessTerm )
|
||||||
@@ -318,13 +325,11 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
|
|
||||||
final Enum searchModeSetting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
final Enum searchModeSetting = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||||
|
|
||||||
final boolean isAutoFocus = SearchBoxMode.AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting;
|
this.isAutoFocus = SearchBoxMode.AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting;
|
||||||
final boolean isManualFocus = SearchBoxMode.MANUAL_SEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
|
|
||||||
final boolean isKeepFilter = SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
|
final boolean isKeepFilter = SearchBoxMode.AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_AUTOSEARCH_KEEP == searchModeSetting || SearchBoxMode.MANUAL_SEARCH_KEEP == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH_KEEP == searchModeSetting;
|
||||||
final boolean isJEIEnabled = SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting;
|
final boolean isJEIEnabled = SearchBoxMode.JEI_AUTOSEARCH == searchModeSetting || SearchBoxMode.JEI_MANUAL_SEARCH == searchModeSetting;
|
||||||
|
|
||||||
this.searchField.setFocused( isAutoFocus );
|
this.searchField.setFocused( this.isAutoFocus );
|
||||||
this.searchField.setCanLoseFocus( isManualFocus );
|
|
||||||
|
|
||||||
if( isJEIEnabled )
|
if( isJEIEnabled )
|
||||||
{
|
{
|
||||||
@@ -374,6 +379,9 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
{
|
{
|
||||||
this.fontRenderer.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
|
this.fontRenderer.drawString( this.getGuiDisplayName( this.myName.getLocal() ), 8, 6, 4210752 );
|
||||||
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
this.fontRenderer.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||||
|
|
||||||
|
this.currentMouseX = mouseX;
|
||||||
|
this.currentMouseY = mouseY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -470,18 +478,40 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
|
|||||||
@Override
|
@Override
|
||||||
protected void keyTyped( final char character, final int key ) throws IOException
|
protected void keyTyped( final char character, final int key ) throws IOException
|
||||||
{
|
{
|
||||||
|
|
||||||
if( !this.checkHotbarKeys( key ) )
|
if( !this.checkHotbarKeys( key ) )
|
||||||
{
|
{
|
||||||
|
if( key == Keyboard.KEY_TAB )
|
||||||
|
{
|
||||||
|
this.searchField.setFocused( !this.searchField.isFocused() );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( this.searchField.isFocused() && key == Keyboard.KEY_RETURN )
|
||||||
|
{
|
||||||
|
this.searchField.setFocused( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if( character == ' ' && this.searchField.getText().isEmpty() )
|
if( character == ' ' && this.searchField.getText().isEmpty() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final boolean mouseInGui = this.isPointInRegion( 0, 0, this.xSize, this.ySize, this.currentMouseX, this.currentMouseY );
|
||||||
|
|
||||||
|
if( this.isAutoFocus && !this.searchField.isFocused() && mouseInGui )
|
||||||
|
{
|
||||||
|
this.searchField.setFocused( true );
|
||||||
|
}
|
||||||
|
|
||||||
if( this.searchField.textboxKeyTyped( character, key ) )
|
if( this.searchField.textboxKeyTyped( character, key ) )
|
||||||
{
|
{
|
||||||
this.repo.setSearchString( this.searchField.getText() );
|
this.repo.setSearchString( this.searchField.getText() );
|
||||||
this.repo.updateView();
|
this.repo.updateView();
|
||||||
this.setScrollBar();
|
this.setScrollBar();
|
||||||
|
// tell forge the key event is handled and should not be sent out
|
||||||
|
this.keyHandled = mouseInGui;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -237,10 +237,11 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
|||||||
this.getScrollBar().setRange( 0, ( size + 4 ) / 5 - this.rows, 1 );
|
this.getScrollBar().setRange( 0, ( size + 4 ) / 5 - this.rows, 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vanilla version...
|
@Override
|
||||||
protected void drawItemStackTooltip( 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 );
|
final Slot s = this.getSlot( x, y );
|
||||||
|
|
||||||
if( s instanceof SlotME && stack != null )
|
if( s instanceof SlotME && stack != null )
|
||||||
{
|
{
|
||||||
IAEItemStack myStack = null;
|
IAEItemStack myStack = null;
|
||||||
@@ -270,7 +271,8 @@ public class GuiNetworkStatus extends AEBaseGui implements ISortSource
|
|||||||
this.drawTooltip( x, y, currentToolTip );
|
this.drawTooltip( x, y, currentToolTip );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// super.drawItemStackTooltip( stack, x, y );
|
|
||||||
|
super.renderToolTip( stack, x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -25,14 +25,9 @@ import net.minecraft.client.gui.GuiButton;
|
|||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
|
||||||
import appeng.api.definitions.IBlocks;
|
|
||||||
import appeng.api.definitions.IDefinitions;
|
|
||||||
import appeng.api.definitions.IParts;
|
|
||||||
import appeng.client.gui.AEBaseGui;
|
import appeng.client.gui.AEBaseGui;
|
||||||
import appeng.client.gui.widgets.GuiNumberBox;
|
import appeng.client.gui.widgets.GuiNumberBox;
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
import appeng.container.AEBaseContainer;
|
|
||||||
import appeng.container.implementations.ContainerPriority;
|
import appeng.container.implementations.ContainerPriority;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
@@ -42,12 +37,6 @@ import appeng.core.sync.network.NetworkHandler;
|
|||||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.helpers.IPriorityHost;
|
import appeng.helpers.IPriorityHost;
|
||||||
import appeng.parts.automation.PartFormationPlane;
|
|
||||||
import appeng.parts.misc.PartInterface;
|
|
||||||
import appeng.parts.misc.PartStorageBus;
|
|
||||||
import appeng.tile.misc.TileInterface;
|
|
||||||
import appeng.tile.storage.TileChest;
|
|
||||||
import appeng.tile.storage.TileDrive;
|
|
||||||
|
|
||||||
|
|
||||||
public class GuiPriority extends AEBaseGui
|
public class GuiPriority extends AEBaseGui
|
||||||
@@ -92,49 +81,11 @@ public class GuiPriority extends AEBaseGui
|
|||||||
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
|
this.buttonList.add( this.minus100 = new GuiButton( 0, this.guiLeft + 82, this.guiTop + 69, 32, 20, "-" + c ) );
|
||||||
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
|
this.buttonList.add( this.minus1000 = new GuiButton( 0, this.guiLeft + 120, this.guiTop + 69, 38, 20, "-" + d ) );
|
||||||
|
|
||||||
ItemStack myIcon = null;
|
final ContainerPriority con = ( (ContainerPriority) this.inventorySlots );
|
||||||
final Object target = ( (AEBaseContainer) this.inventorySlots ).getTarget();
|
final ItemStack myIcon = con.getPriorityHost().getItemStackRepresentation();
|
||||||
final IDefinitions definitions = AEApi.instance().definitions();
|
this.OriginalGui = con.getPriorityHost().getGuiBridge();
|
||||||
final IParts parts = definitions.parts();
|
|
||||||
final IBlocks blocks = definitions.blocks();
|
|
||||||
|
|
||||||
if( target instanceof PartStorageBus )
|
if( this.OriginalGui != null && !myIcon.isEmpty() )
|
||||||
{
|
|
||||||
myIcon = parts.storageBus().maybeStack( 1 ).orElse( myIcon );
|
|
||||||
this.OriginalGui = GuiBridge.GUI_STORAGEBUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( target instanceof PartFormationPlane )
|
|
||||||
{
|
|
||||||
myIcon = parts.formationPlane().maybeStack( 1 ).orElse( myIcon );
|
|
||||||
this.OriginalGui = GuiBridge.GUI_FORMATION_PLANE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( target instanceof TileDrive )
|
|
||||||
{
|
|
||||||
myIcon = blocks.drive().maybeStack( 1 ).orElse( myIcon );
|
|
||||||
this.OriginalGui = GuiBridge.GUI_DRIVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( target instanceof TileChest )
|
|
||||||
{
|
|
||||||
myIcon = blocks.chest().maybeStack( 1 ).orElse( myIcon );
|
|
||||||
this.OriginalGui = GuiBridge.GUI_CHEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( target instanceof TileInterface )
|
|
||||||
{
|
|
||||||
myIcon = blocks.iface().maybeStack( 1 ).orElse( myIcon );
|
|
||||||
this.OriginalGui = GuiBridge.GUI_INTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( target instanceof PartInterface )
|
|
||||||
{
|
|
||||||
myIcon = parts.iface().maybeStack( 1 ).orElse( myIcon );
|
|
||||||
this.OriginalGui = GuiBridge.GUI_INTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( this.OriginalGui != null && myIcon != null )
|
|
||||||
{
|
{
|
||||||
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
|
this.buttonList.add( this.originalGuiBtn = new GuiTabButton( this.guiLeft + 154, this.guiTop, myIcon, myIcon.getDisplayName(), this.itemRender ) );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ public class GuiSpatialIOPort extends AEBaseGui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSSInvalid.getLocal(), 13, 93, 4210752 );
|
this.fontRenderer.drawString( GuiText.SCSSize.getLocal() + ": " + GuiText.SCSInvalid.getLocal(), 13, 93, 4210752 );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
|
||||||
|
package appeng.client.gui.widgets;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.Gui;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class GuiCustomSlot extends Gui implements ITooltip
|
||||||
|
{
|
||||||
|
private final int x;
|
||||||
|
private final int y;
|
||||||
|
private final int id;
|
||||||
|
|
||||||
|
public GuiCustomSlot( final int id, final int x, final int y )
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean canClick( final EntityPlayer player )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void slotClicked( final ItemStack clickStack, final int mouseButton )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void drawContent( final Minecraft mc, final int mouseX, final int mouseY, final float partialTicks );
|
||||||
|
|
||||||
|
public void drawBackground( int guileft, int guitop )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getMessage()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int xPos()
|
||||||
|
{
|
||||||
|
return this.x;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int yPos()
|
||||||
|
{
|
||||||
|
return this.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getWidth()
|
||||||
|
{
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getHeight()
|
||||||
|
{
|
||||||
|
return 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisible()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSlotEnabled()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -43,6 +43,7 @@ public class MEGuiTextField extends GuiTextField
|
|||||||
private final int _yPos;
|
private final int _yPos;
|
||||||
private final int _width;
|
private final int _width;
|
||||||
private final int _height;
|
private final int _height;
|
||||||
|
private final int _fontPad;
|
||||||
private int selectionColor = 0xFF00FF00;
|
private int selectionColor = 0xFF00FF00;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,6 +60,7 @@ public class MEGuiTextField extends GuiTextField
|
|||||||
{
|
{
|
||||||
super( 0, fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth( '_' ), height - 2 * PADDING );
|
super( 0, fontRenderer, xPos + PADDING, yPos + PADDING, width - 2 * PADDING - fontRenderer.getCharWidth( '_' ), height - 2 * PADDING );
|
||||||
|
|
||||||
|
this._fontPad = fontRenderer.getCharWidth( '_' );
|
||||||
this._xPos = xPos;
|
this._xPos = xPos;
|
||||||
this._yPos = yPos;
|
this._yPos = yPos;
|
||||||
this._width = width;
|
this._width = width;
|
||||||
@@ -106,9 +108,31 @@ public class MEGuiTextField extends GuiTextField
|
|||||||
this.selectionColor = color;
|
this.selectionColor = color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawTextBox()
|
||||||
|
{
|
||||||
|
if( this.getVisible() )
|
||||||
|
{
|
||||||
|
if( this.isFocused() )
|
||||||
|
{
|
||||||
|
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
|
||||||
|
0xFF606060 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
drawRect( this.x - PADDING + 1, this.y - PADDING + 1, this.x + this.width + this._fontPad + PADDING - 1, this.y + this.height + PADDING - 1,
|
||||||
|
0xFFA8A8A8 );
|
||||||
|
}
|
||||||
|
super.drawTextBox();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawSelectionBox( int startX, int startY, int endX, int endY )
|
public void drawSelectionBox( int startX, int startY, int endX, int endY )
|
||||||
{
|
{
|
||||||
|
if( !this.isFocused() )
|
||||||
|
return;
|
||||||
|
|
||||||
if( startX < endX )
|
if( startX < endX )
|
||||||
{
|
{
|
||||||
int i = startX;
|
int i = startX;
|
||||||
@@ -159,4 +183,5 @@ public class MEGuiTextField extends GuiTextField
|
|||||||
GlStateManager.disableColorLogic();
|
GlStateManager.disableColorLogic();
|
||||||
GlStateManager.enableTexture2D();
|
GlStateManager.enableTexture2D();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import javax.annotation.Nonnull;
|
|||||||
import net.minecraft.util.text.translation.I18n;
|
import net.minecraft.util.text.translation.I18n;
|
||||||
|
|
||||||
import appeng.tile.inventory.AppEngInternalInventory;
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
import appeng.util.ItemSorters;
|
|
||||||
|
|
||||||
|
|
||||||
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
||||||
@@ -57,7 +56,7 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
|||||||
@Override
|
@Override
|
||||||
public int compareTo( @Nonnull final ClientDCInternalInv o )
|
public int compareTo( @Nonnull final ClientDCInternalInv o )
|
||||||
{
|
{
|
||||||
return ItemSorters.compareLong( this.sortBy, o.sortBy );
|
return Long.compare( this.sortBy, o.sortBy );
|
||||||
}
|
}
|
||||||
|
|
||||||
public AppEngInternalInventory getInventory()
|
public AppEngInternalInventory getInventory()
|
||||||
@@ -69,4 +68,4 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
|
|||||||
{
|
{
|
||||||
return this.id;
|
return this.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,243 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.me;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.SortOrder;
|
||||||
|
import appeng.api.config.ViewItems;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
|
import appeng.api.storage.channels.IFluidStorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.client.gui.widgets.IScrollSource;
|
||||||
|
import appeng.client.gui.widgets.ISortSource;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
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 = AEApi.instance().storage().getStorageChannel( IFluidStorageChannel.class ).createList();
|
||||||
|
private final ArrayList<IAEFluidStack> view = new ArrayList<>();
|
||||||
|
private final IScrollSource src;
|
||||||
|
private final ISortSource sortSrc;
|
||||||
|
|
||||||
|
private int rowSize = 9;
|
||||||
|
|
||||||
|
private String searchString = "";
|
||||||
|
private IPartitionList<IAEFluidStack> myPartitionList;
|
||||||
|
private boolean hasPower;
|
||||||
|
|
||||||
|
public FluidRepo( final IScrollSource src, final ISortSource sortSrc )
|
||||||
|
{
|
||||||
|
this.src = src;
|
||||||
|
this.sortSrc = sortSrc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateView()
|
||||||
|
{
|
||||||
|
this.view.clear();
|
||||||
|
|
||||||
|
this.view.ensureCapacity( this.list.size() );
|
||||||
|
|
||||||
|
String innerSearch = this.searchString;
|
||||||
|
|
||||||
|
boolean searchMod = false;
|
||||||
|
if( innerSearch.startsWith( "@" ) )
|
||||||
|
{
|
||||||
|
searchMod = true;
|
||||||
|
innerSearch = innerSearch.substring( 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
Pattern m;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m = Pattern.compile( innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE );
|
||||||
|
}
|
||||||
|
catch( final Exception ignore1 )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
m = Pattern.compile( Pattern.quote( innerSearch.toLowerCase() ), Pattern.CASE_INSENSITIVE );
|
||||||
|
}
|
||||||
|
catch( final Exception ignore2 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||||
|
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
||||||
|
final boolean terminalSearchToolTips = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
||||||
|
|
||||||
|
boolean notDone = false;
|
||||||
|
for( IAEFluidStack fs : this.list )
|
||||||
|
{
|
||||||
|
if( this.myPartitionList != null && !this.myPartitionList.isListed( fs ) )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( viewMode == ViewItems.CRAFTABLE && !fs.isCraftable() )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( viewMode == ViewItems.STORED && fs.getStackSize() == 0 )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
final String dspName = searchMod ? Platform.getModId( fs ) : Platform.getFluidDisplayName( fs );
|
||||||
|
boolean foundMatchingFluidStack = false;
|
||||||
|
notDone = true;
|
||||||
|
|
||||||
|
if( m.matcher( dspName.toLowerCase() ).find() )
|
||||||
|
{
|
||||||
|
notDone = false;
|
||||||
|
foundMatchingFluidStack = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( terminalSearchToolTips && notDone && !searchMod )
|
||||||
|
{
|
||||||
|
final List<String> tooltip = Platform.getTooltip( fs );
|
||||||
|
|
||||||
|
for( final String line : tooltip )
|
||||||
|
{
|
||||||
|
if( m.matcher( line ).find() )
|
||||||
|
{
|
||||||
|
foundMatchingFluidStack = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( foundMatchingFluidStack )
|
||||||
|
{
|
||||||
|
if( needsZeroCopy )
|
||||||
|
{
|
||||||
|
fs = fs.copy();
|
||||||
|
fs.setStackSize( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.view.add( fs );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final Enum sortBy = this.sortSrc.getSortBy();
|
||||||
|
final Enum sortDir = this.sortSrc.getSortDir();
|
||||||
|
|
||||||
|
FluidSorters.setDirection( (appeng.api.config.SortDir) sortDir );
|
||||||
|
|
||||||
|
if( sortBy == SortOrder.MOD )
|
||||||
|
{
|
||||||
|
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_MOD );
|
||||||
|
}
|
||||||
|
else if( sortBy == SortOrder.AMOUNT )
|
||||||
|
{
|
||||||
|
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_SIZE );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Collections.sort( this.view, FluidSorters.CONFIG_BASED_SORT_BY_NAME );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postUpdate( final IAEFluidStack is )
|
||||||
|
{
|
||||||
|
final IAEFluidStack st = this.list.findPrecise( is );
|
||||||
|
|
||||||
|
if( st != null )
|
||||||
|
{
|
||||||
|
st.reset();
|
||||||
|
st.add( is );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.list.add( is );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public IAEFluidStack getReferenceFluid( int idx )
|
||||||
|
{
|
||||||
|
idx += this.src.getCurrentScroll() * this.rowSize;
|
||||||
|
|
||||||
|
if( idx >= this.view.size() )
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return this.view.get( idx );
|
||||||
|
}
|
||||||
|
|
||||||
|
public int size()
|
||||||
|
{
|
||||||
|
return this.view.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
this.list.resetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasPower()
|
||||||
|
{
|
||||||
|
return this.hasPower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPower( final boolean hasPower )
|
||||||
|
{
|
||||||
|
this.hasPower = hasPower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRowSize()
|
||||||
|
{
|
||||||
|
return this.rowSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRowSize( final int rowSize )
|
||||||
|
{
|
||||||
|
this.rowSize = rowSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSearchString()
|
||||||
|
{
|
||||||
|
return this.searchString;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSearchString( @Nonnull final String searchString )
|
||||||
|
{
|
||||||
|
this.searchString = searchString;
|
||||||
|
}
|
||||||
|
}
|
||||||
+34
-19
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of Applied Energistics 2.
|
* This file is part of Applied Energistics 2.
|
||||||
* Copyright (c) 2013 - 2015, AlgorithmX2, All rights reserved.
|
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||||
*
|
*
|
||||||
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Lesser General Public License as published by
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
@@ -16,35 +16,50 @@
|
|||||||
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package appeng.recipes;
|
package appeng.client.me;
|
||||||
|
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import appeng.api.storage.data.IAEFluidStack;
|
||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
|
||||||
|
|
||||||
import net.minecraftforge.common.config.Configuration;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author thatsIch
|
* @author BrockWS
|
||||||
* @version rv3 - 23.08.2015
|
* @version rv6 - 22/05/2018
|
||||||
* @since rv3 23.08.2015
|
* @since rv6 22/05/2018
|
||||||
*/
|
*/
|
||||||
public class CustomRecipeForgeConfiguration implements CustomRecipeConfig
|
public class InternalFluidSlotME
|
||||||
{
|
{
|
||||||
private final boolean isEnabled;
|
|
||||||
|
|
||||||
public CustomRecipeForgeConfiguration( @Nonnull final Configuration config )
|
private final int offset;
|
||||||
|
private final int xPos;
|
||||||
|
private final int yPos;
|
||||||
|
private final FluidRepo repo;
|
||||||
|
|
||||||
|
public InternalFluidSlotME( final FluidRepo def, final int offset, final int displayX, final int displayY )
|
||||||
{
|
{
|
||||||
Preconditions.checkNotNull( config );
|
this.repo = def;
|
||||||
|
this.offset = offset;
|
||||||
this.isEnabled = config.getBoolean( "enabled", "general", true, "If true, the custom recipes are enabled. Acts as a master switch." );
|
this.xPos = displayX;
|
||||||
|
this.yPos = displayY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
IAEFluidStack getAEStack()
|
||||||
public final boolean isEnabled()
|
|
||||||
{
|
{
|
||||||
return this.isEnabled;
|
return this.repo.getReferenceFluid( this.offset );
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean hasPower()
|
||||||
|
{
|
||||||
|
return this.repo.hasPower();
|
||||||
|
}
|
||||||
|
|
||||||
|
int getxPosition()
|
||||||
|
{
|
||||||
|
return this.xPos;
|
||||||
|
}
|
||||||
|
|
||||||
|
int getyPosition()
|
||||||
|
{
|
||||||
|
return this.yPos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,6 +21,7 @@ package appeng.client.me;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.annotation.Nonnull;
|
import javax.annotation.Nonnull;
|
||||||
@@ -112,6 +113,8 @@ public class ItemRepo
|
|||||||
|
|
||||||
final Enum viewMode = this.sortSrc.getSortDisplay();
|
final Enum viewMode = this.sortSrc.getSortDisplay();
|
||||||
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
final Enum searchMode = AEConfig.instance().getConfigManager().getSetting( Settings.SEARCH_MODE );
|
||||||
|
final boolean needsZeroCopy = viewMode == ViewItems.CRAFTABLE;
|
||||||
|
|
||||||
if( searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP )
|
if( searchMode == SearchBoxMode.JEI_AUTOSEARCH || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH || searchMode == SearchBoxMode.JEI_AUTOSEARCH_KEEP || searchMode == SearchBoxMode.JEI_MANUAL_SEARCH_KEEP )
|
||||||
{
|
{
|
||||||
this.updateJEI( this.searchString );
|
this.updateJEI( this.searchString );
|
||||||
@@ -160,43 +163,46 @@ public class ItemRepo
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( viewMode == ViewItems.CRAFTABLE )
|
|
||||||
{
|
|
||||||
is = is.copy();
|
|
||||||
is.setStackSize( 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
|
if( viewMode == ViewItems.STORED && is.getStackSize() == 0 )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
final String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is );
|
final String dspName = searchMod ? Platform.getModId( is ) : Platform.getItemDisplayName( is );
|
||||||
|
boolean foundMatchingItemStack = false;
|
||||||
notDone = true;
|
notDone = true;
|
||||||
|
|
||||||
if( m.matcher( dspName.toLowerCase() ).find() )
|
if( m.matcher( dspName.toLowerCase() ).find() )
|
||||||
{
|
{
|
||||||
this.view.add( is );
|
|
||||||
notDone = false;
|
notDone = false;
|
||||||
|
foundMatchingItemStack = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( terminalSearchToolTips && notDone && !searchMod )
|
if( terminalSearchToolTips && notDone && !searchMod )
|
||||||
{
|
{
|
||||||
for( final Object lp : Platform.getTooltip( is ) )
|
final List<String> tooltip = Platform.getTooltip( is );
|
||||||
|
|
||||||
|
for( final String line : tooltip )
|
||||||
{
|
{
|
||||||
if( lp instanceof String && m.matcher( (CharSequence) lp ).find() )
|
if( m.matcher( line ).find() )
|
||||||
{
|
{
|
||||||
this.view.add( is );
|
foundMatchingItemStack = true;
|
||||||
notDone = false;
|
notDone = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
if( foundMatchingItemStack )
|
||||||
* if ( terminalSearchMods && notDone ) { if ( m.matcher( Platform.getMod( is.getItemStack() ) ).find() ) {
|
{
|
||||||
* view.add( is ); notDone = false; } }
|
if( needsZeroCopy )
|
||||||
*/
|
{
|
||||||
|
is = is.copy();
|
||||||
|
is.setStackSize( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
this.view.add( is );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final Enum SortBy = this.sortSrc.getSortBy();
|
final Enum SortBy = this.sortSrc.getSortBy();
|
||||||
|
|||||||
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.me;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
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
|
||||||
|
{
|
||||||
|
|
||||||
|
private InternalFluidSlotME slot;
|
||||||
|
|
||||||
|
public SlotFluidME( InternalFluidSlotME slot )
|
||||||
|
{
|
||||||
|
super( null, 0, slot.getxPosition(), slot.getyPosition() );
|
||||||
|
this.slot = slot;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IAEFluidStack getAEFluidStack()
|
||||||
|
{
|
||||||
|
if( this.slot.hasPower() )
|
||||||
|
{
|
||||||
|
return this.slot.getAEStack();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValid( final ItemStack par1ItemStack )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public ItemStack getStack()
|
||||||
|
{
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean getHasStack()
|
||||||
|
{
|
||||||
|
if( this.slot.hasPower() )
|
||||||
|
{
|
||||||
|
return this.getAEFluidStack() != null;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putStack( final ItemStack par1ItemStack )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getSlotStackLimit()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize( final int par1 )
|
||||||
|
{
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isHere( final IInventory inv, final int slotIn )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2017, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.render;
|
||||||
|
|
||||||
|
|
||||||
|
import javax.vecmath.Matrix4f;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
|
||||||
|
|
||||||
|
public abstract class DelegateBakedModel implements IBakedModel
|
||||||
|
{
|
||||||
|
private IBakedModel baseModel;
|
||||||
|
|
||||||
|
protected DelegateBakedModel( IBakedModel base )
|
||||||
|
{
|
||||||
|
this.baseModel = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Pair<? extends IBakedModel, Matrix4f> handlePerspective( ItemCameraTransforms.TransformType type )
|
||||||
|
{
|
||||||
|
Pair<? extends IBakedModel, Matrix4f> pair = this.baseModel.handlePerspective( type );
|
||||||
|
return Pair.of( this, pair.getValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureAtlasSprite getParticleTexture()
|
||||||
|
{
|
||||||
|
return this.baseModel.getParticleTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemCameraTransforms getItemCameraTransforms()
|
||||||
|
{
|
||||||
|
return this.baseModel.getItemCameraTransforms();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAmbientOcclusion()
|
||||||
|
{
|
||||||
|
return this.baseModel.isAmbientOcclusion();
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBakedModel getBaseModel()
|
||||||
|
{
|
||||||
|
return this.baseModel;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2018, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.render;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author DrummerMC
|
||||||
|
* @version rv6 - 2018-01-22
|
||||||
|
* @since rv6 2018-01-22
|
||||||
|
*/
|
||||||
|
public class DummyFluidBakedModel implements IBakedModel
|
||||||
|
{
|
||||||
|
private final ImmutableList<BakedQuad> quads;
|
||||||
|
public DummyFluidBakedModel( ImmutableList<BakedQuad> quads )
|
||||||
|
{
|
||||||
|
this.quads = quads;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
|
||||||
|
{
|
||||||
|
return quads;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAmbientOcclusion()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGui3d()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuiltInRenderer()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureAtlasSprite getParticleTexture()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides()
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.render;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.client.model.ItemLayerModel;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import appeng.fluids.items.FluidDummyItem;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This baked model class is used as a dispatcher to redirect the renderer to the *real* model that should be used based
|
||||||
|
* on the item stack.
|
||||||
|
* A custom Item Override List is used to accomplish this.
|
||||||
|
*/
|
||||||
|
public class DummyFluidDispatcherBakedModel extends DelegateBakedModel
|
||||||
|
{
|
||||||
|
private final VertexFormat format;
|
||||||
|
private final Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter;
|
||||||
|
|
||||||
|
public DummyFluidDispatcherBakedModel( IBakedModel baseModel, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
|
{
|
||||||
|
super( baseModel );
|
||||||
|
this.format = format;
|
||||||
|
this.bakedTextureGetter = bakedTextureGetter;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is never used. See the item override list below.
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGui3d()
|
||||||
|
{
|
||||||
|
return this.getBaseModel().isGui3d();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuiltInRenderer()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides()
|
||||||
|
{
|
||||||
|
return new ItemOverrideList( Collections.emptyList() )
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity )
|
||||||
|
{
|
||||||
|
if( !( stack.getItem() instanceof FluidDummyItem ) )
|
||||||
|
{
|
||||||
|
return originalModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
FluidDummyItem itemFacade = (FluidDummyItem) stack.getItem();
|
||||||
|
|
||||||
|
FluidStack fluidStack = itemFacade.getFluidStack( stack );
|
||||||
|
if( fluidStack == null )
|
||||||
|
{
|
||||||
|
fluidStack = new FluidStack( FluidRegistry.WATER, Fluid.BUCKET_VOLUME );
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureAtlasSprite sprite = bakedTextureGetter.apply( fluidStack.getFluid().getStill( fluidStack ) );
|
||||||
|
if( sprite == null )
|
||||||
|
{
|
||||||
|
return new DummyFluidBakedModel( ImmutableList.of() );
|
||||||
|
}
|
||||||
|
|
||||||
|
return new DummyFluidBakedModel( ItemLayerModel.getQuadsForSprite( 0, sprite, format, Optional.empty() ) );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of Applied Energistics 2.
|
||||||
|
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Applied Energistics 2 is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package appeng.client.render;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.model.IModel;
|
||||||
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
|
import net.minecraftforge.common.model.IModelState;
|
||||||
|
|
||||||
|
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 DummyFluidItemModel implements IModel
|
||||||
|
{
|
||||||
|
// 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/dummy_fluid_item_base" );
|
||||||
|
|
||||||
|
private IModel baseModel = null;
|
||||||
|
|
||||||
|
private IModel getBaseModel()
|
||||||
|
{
|
||||||
|
if( this.baseModel == null )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
baseModel = ModelLoaderRegistry.getModel( MODEL_BASE );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.baseModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ResourceLocation> getDependencies()
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ResourceLocation> getTextures()
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
|
{
|
||||||
|
IBakedModel bakedBaseModel = this.getBaseModel().bake( state, format, bakedTextureGetter );
|
||||||
|
|
||||||
|
return new DummyFluidDispatcherBakedModel( bakedBaseModel, format, bakedTextureGetter );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IModelState getDefaultState()
|
||||||
|
{
|
||||||
|
return getBaseModel().getDefaultState();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -27,9 +27,7 @@ import javax.annotation.Nullable;
|
|||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.entity.EntityLivingBase;
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -44,16 +42,13 @@ import appeng.items.parts.ItemFacade;
|
|||||||
* on the item stack.
|
* on the item stack.
|
||||||
* A custom Item Override List is used to accomplish this.
|
* A custom Item Override List is used to accomplish this.
|
||||||
*/
|
*/
|
||||||
public class FacadeDispatcherBakedModel implements IBakedModel
|
public class FacadeDispatcherBakedModel extends DelegateBakedModel
|
||||||
{
|
{
|
||||||
|
|
||||||
private final IBakedModel baseModel;
|
|
||||||
|
|
||||||
private final VertexFormat format;
|
private final VertexFormat format;
|
||||||
|
|
||||||
public FacadeDispatcherBakedModel( IBakedModel baseModel, VertexFormat format )
|
public FacadeDispatcherBakedModel( IBakedModel baseModel, VertexFormat format )
|
||||||
{
|
{
|
||||||
this.baseModel = baseModel;
|
super( baseModel );
|
||||||
this.format = format;
|
this.format = format;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,16 +59,10 @@ public class FacadeDispatcherBakedModel implements IBakedModel
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAmbientOcclusion()
|
|
||||||
{
|
|
||||||
return this.baseModel.isAmbientOcclusion();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isGui3d()
|
public boolean isGui3d()
|
||||||
{
|
{
|
||||||
return this.baseModel.isGui3d();
|
return this.getBaseModel().isGui3d();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -82,18 +71,6 @@ public class FacadeDispatcherBakedModel implements IBakedModel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureAtlasSprite getParticleTexture()
|
|
||||||
{
|
|
||||||
return this.baseModel.getParticleTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemCameraTransforms getItemCameraTransforms()
|
|
||||||
{
|
|
||||||
return this.baseModel.getItemCameraTransforms();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides()
|
public ItemOverrideList getOverrides()
|
||||||
{
|
{
|
||||||
@@ -112,7 +89,8 @@ public class FacadeDispatcherBakedModel implements IBakedModel
|
|||||||
IBlockState state = itemFacade.getTextureBlockState( stack );
|
IBlockState state = itemFacade.getTextureBlockState( stack );
|
||||||
ItemStack textureItem = itemFacade.getTextureItem( stack );
|
ItemStack textureItem = itemFacade.getTextureItem( stack );
|
||||||
|
|
||||||
return new FacadeWithBlockBakedModel( FacadeDispatcherBakedModel.this.baseModel, state, textureItem, FacadeDispatcherBakedModel.this.format );
|
return new FacadeWithBlockBakedModel( FacadeDispatcherBakedModel.this
|
||||||
|
.getBaseModel(), state, textureItem, FacadeDispatcherBakedModel.this.format );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraftforge.client.model.IModel;
|
import net.minecraftforge.client.model.IModel;
|
||||||
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
import net.minecraftforge.common.model.IModelState;
|
import net.minecraftforge.common.model.IModelState;
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
|
||||||
|
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
|
|
||||||
@@ -41,10 +40,21 @@ import appeng.core.AppEng;
|
|||||||
*/
|
*/
|
||||||
public class FacadeItemModel implements IModel
|
public class FacadeItemModel implements IModel
|
||||||
{
|
{
|
||||||
|
|
||||||
// We use this to get the default item transforms and make our lives easier
|
// 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" );
|
private static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "item/facade_base" );
|
||||||
|
|
||||||
|
private IModel getBaseModel()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ModelLoaderRegistry.getModel( MODEL_BASE );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Collection<ResourceLocation> getDependencies()
|
public Collection<ResourceLocation> getDependencies()
|
||||||
{
|
{
|
||||||
@@ -60,17 +70,7 @@ public class FacadeItemModel implements IModel
|
|||||||
@Override
|
@Override
|
||||||
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
{
|
{
|
||||||
IModel baseModel;
|
IBakedModel bakedBaseModel = this.getBaseModel().bake( state, format, bakedTextureGetter );
|
||||||
try
|
|
||||||
{
|
|
||||||
baseModel = ModelLoaderRegistry.getModel( MODEL_BASE );
|
|
||||||
}
|
|
||||||
catch( Exception e )
|
|
||||||
{
|
|
||||||
throw new RuntimeException( e );
|
|
||||||
}
|
|
||||||
|
|
||||||
IBakedModel bakedBaseModel = baseModel.bake( state, format, bakedTextureGetter );
|
|
||||||
|
|
||||||
return new FacadeDispatcherBakedModel( bakedBaseModel, format );
|
return new FacadeDispatcherBakedModel( bakedBaseModel, format );
|
||||||
}
|
}
|
||||||
@@ -78,6 +78,6 @@ public class FacadeItemModel implements IModel
|
|||||||
@Override
|
@Override
|
||||||
public IModelState getDefaultState()
|
public IModelState getDefaultState()
|
||||||
{
|
{
|
||||||
return TRSRTransformation.identity();
|
return this.getBaseModel().getDefaultState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,9 +29,7 @@ import net.minecraft.block.state.IBlockState;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
|
||||||
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|
||||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
@@ -44,11 +42,8 @@ import appeng.client.render.cablebus.FacadeBuilder;
|
|||||||
* This is the actual baked model that will combine the north face of a given block state
|
* This is the actual baked model that will combine the north face of a given block state
|
||||||
* with the base facade item model to achieve what is then actually rendered on screen.
|
* with the base facade item model to achieve what is then actually rendered on screen.
|
||||||
*/
|
*/
|
||||||
public class FacadeWithBlockBakedModel implements IBakedModel
|
public class FacadeWithBlockBakedModel extends DelegateBakedModel
|
||||||
{
|
{
|
||||||
|
|
||||||
private final IBakedModel baseModel;
|
|
||||||
|
|
||||||
private final IBlockState blockState;
|
private final IBlockState blockState;
|
||||||
|
|
||||||
private final IBakedModel textureModel;
|
private final IBakedModel textureModel;
|
||||||
@@ -59,7 +54,7 @@ public class FacadeWithBlockBakedModel implements IBakedModel
|
|||||||
|
|
||||||
public FacadeWithBlockBakedModel( IBakedModel baseModel, IBlockState blockState, ItemStack textureItem, VertexFormat format )
|
public FacadeWithBlockBakedModel( IBakedModel baseModel, IBlockState blockState, ItemStack textureItem, VertexFormat format )
|
||||||
{
|
{
|
||||||
this.baseModel = baseModel;
|
super( baseModel );
|
||||||
this.blockState = blockState;
|
this.blockState = blockState;
|
||||||
this.textureItem = textureItem;
|
this.textureItem = textureItem;
|
||||||
this.textureModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( blockState );
|
this.textureModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState( blockState );
|
||||||
@@ -88,13 +83,7 @@ public class FacadeWithBlockBakedModel implements IBakedModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.baseModel.getQuads( state, side, rand );
|
return this.getBaseModel().getQuads( state, side, rand );
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isAmbientOcclusion()
|
|
||||||
{
|
|
||||||
return this.baseModel.isAmbientOcclusion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,18 +98,6 @@ public class FacadeWithBlockBakedModel implements IBakedModel
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public TextureAtlasSprite getParticleTexture()
|
|
||||||
{
|
|
||||||
return this.baseModel.getParticleTexture();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemCameraTransforms getItemCameraTransforms()
|
|
||||||
{
|
|
||||||
return this.baseModel.getItemCameraTransforms();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemOverrideList getOverrides()
|
public ItemOverrideList getOverrides()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class CableBuilder
|
|||||||
break;
|
break;
|
||||||
case DENSE_COVERED:
|
case DENSE_COVERED:
|
||||||
case DENSE_SMART:
|
case DENSE_SMART:
|
||||||
this.addCableCore( CableCoreType.DENSE_SMART, color, quadsOut );
|
this.addCableCore( CableCoreType.DENSE, color, quadsOut );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ class CableBuilder
|
|||||||
case COVERED:
|
case COVERED:
|
||||||
cubeBuilder.addCube( 5, 5, 5, 11, 11, 11 );
|
cubeBuilder.addCube( 5, 5, 5, 11, 11, 11 );
|
||||||
break;
|
break;
|
||||||
case DENSE_SMART:
|
case DENSE:
|
||||||
cubeBuilder.addCube( 3, 3, 3, 13, 13, 13 );
|
cubeBuilder.addCube( 3, 3, 3, 13, 13, 13 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -329,7 +329,6 @@ class CableBuilder
|
|||||||
|
|
||||||
public void addConstrainedCoveredConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
|
public void addConstrainedCoveredConnection( EnumFacing facing, AEColor cableColor, int distanceFromEdge, List<BakedQuad> quadsOut )
|
||||||
{
|
{
|
||||||
|
|
||||||
// The core of a covered cable reaches up to 5 voxels from the block edge, so
|
// The core of a covered cable reaches up to 5 voxels from the block edge, so
|
||||||
// drawing a connection can only occur from there onwards
|
// drawing a connection can only occur from there onwards
|
||||||
if( distanceFromEdge >= 5 )
|
if( distanceFromEdge >= 5 )
|
||||||
@@ -348,6 +347,11 @@ class CableBuilder
|
|||||||
|
|
||||||
public void addSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
|
public void addSmartConnection( EnumFacing facing, AEColor cableColor, AECableType connectionType, boolean cableBusAdjacent, int channels, List<BakedQuad> quadsOut )
|
||||||
{
|
{
|
||||||
|
if( connectionType == AECableType.COVERED || connectionType == AECableType.GLASS )
|
||||||
|
{
|
||||||
|
this.addCoveredConnection( facing, cableColor, connectionType, cableBusAdjacent, quadsOut );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
CubeBuilder cubeBuilder = new CubeBuilder( this.format, quadsOut );
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ package appeng.client.render.cablebus;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -43,6 +44,7 @@ import net.minecraft.util.ResourceLocation;
|
|||||||
import net.minecraftforge.client.MinecraftForgeClient;
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
import net.minecraftforge.common.property.IExtendedBlockState;
|
import net.minecraftforge.common.property.IExtendedBlockState;
|
||||||
|
|
||||||
|
import appeng.api.parts.IPartBakedModel;
|
||||||
import appeng.api.parts.IPartModel;
|
import appeng.api.parts.IPartModel;
|
||||||
import appeng.api.util.AECableType;
|
import appeng.api.util.AECableType;
|
||||||
import appeng.api.util.AEColor;
|
import appeng.api.util.AEColor;
|
||||||
@@ -52,6 +54,8 @@ import appeng.block.networking.BlockCableBus;
|
|||||||
public class CableBusBakedModel implements IBakedModel
|
public class CableBusBakedModel implements IBakedModel
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final Map<CableBusRenderState, List<BakedQuad>> CABLE_MODEL_CACHE = new HashMap<>();
|
||||||
|
|
||||||
private final CableBuilder cableBuilder;
|
private final CableBuilder cableBuilder;
|
||||||
|
|
||||||
private final FacadeBuilder facadeBuilder;
|
private final FacadeBuilder facadeBuilder;
|
||||||
@@ -88,8 +92,15 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
// translucent facades further down below.
|
// translucent facades further down below.
|
||||||
if( layer == BlockRenderLayer.CUTOUT )
|
if( layer == BlockRenderLayer.CUTOUT )
|
||||||
{
|
{
|
||||||
|
|
||||||
// First, handle the cable at the center of the cable bus
|
// First, handle the cable at the center of the cable bus
|
||||||
this.addCableQuads( renderState, quads );
|
final List<BakedQuad> cableModel = CABLE_MODEL_CACHE.computeIfAbsent( renderState, k ->
|
||||||
|
{
|
||||||
|
final List<BakedQuad> model = new ArrayList<>();
|
||||||
|
this.addCableQuads( renderState, model );
|
||||||
|
return model;
|
||||||
|
} );
|
||||||
|
quads.addAll( cableModel );
|
||||||
|
|
||||||
// Then handle attachments
|
// Then handle attachments
|
||||||
for( EnumFacing facing : EnumFacing.values() )
|
for( EnumFacing facing : EnumFacing.values() )
|
||||||
@@ -109,7 +120,15 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
throw new IllegalStateException( "Trying to use an unregistered part model: " + model );
|
throw new IllegalStateException( "Trying to use an unregistered part model: " + model );
|
||||||
}
|
}
|
||||||
|
|
||||||
List<BakedQuad> partQuads = bakedModel.getQuads( state, null, rand );
|
List<BakedQuad> partQuads;
|
||||||
|
if( bakedModel instanceof IPartBakedModel )
|
||||||
|
{
|
||||||
|
partQuads = ( (IPartBakedModel) bakedModel ).getPartQuads( renderState.getPartFlags().get( facing ), rand );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
partQuads = bakedModel.getQuads( state, null, rand );
|
||||||
|
}
|
||||||
|
|
||||||
// Rotate quads accordingly
|
// Rotate quads accordingly
|
||||||
QuadRotator rotator = new QuadRotator();
|
QuadRotator rotator = new QuadRotator();
|
||||||
@@ -159,20 +178,7 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
|
|
||||||
final AECableType secondType = sides.get( firstSide.getOpposite() );
|
final AECableType secondType = sides.get( firstSide.getOpposite() );
|
||||||
|
|
||||||
// Certain cable types have restrictions on when they're rendered as a straight connection
|
return firstType == secondType;
|
||||||
switch( cableType )
|
|
||||||
{
|
|
||||||
case GLASS:
|
|
||||||
return firstType == AECableType.GLASS && secondType == AECableType.GLASS;
|
|
||||||
case DENSE_COVERED:
|
|
||||||
return firstType == AECableType.DENSE_COVERED && secondType == AECableType.DENSE_COVERED;
|
|
||||||
case DENSE_SMART:
|
|
||||||
return firstType == AECableType.DENSE_SMART && secondType == AECableType.DENSE_SMART;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCableQuads( CableBusRenderState renderState, List<BakedQuad> quadsOut )
|
private void addCableQuads( CableBusRenderState renderState, List<BakedQuad> quadsOut )
|
||||||
@@ -308,10 +314,8 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
|
|
||||||
TextureAtlasSprite particleTexture = bakedModel.getParticleTexture();
|
TextureAtlasSprite particleTexture = bakedModel.getParticleTexture();
|
||||||
|
|
||||||
// If a part sub-model has no particle texture (indicated by it being the missing texture), don't
|
// If a part sub-model has no particle texture (indicated by it being the missing texture),
|
||||||
// add
|
// don't add it, so we don't get ugly missing texture break particles.
|
||||||
// it,
|
|
||||||
// so we don't get ugly missing texture break particles.
|
|
||||||
if( this.textureMap.getMissingSprite() != particleTexture )
|
if( this.textureMap.getMissingSprite() != particleTexture )
|
||||||
{
|
{
|
||||||
result.add( particleTexture );
|
result.add( particleTexture );
|
||||||
@@ -336,7 +340,7 @@ public class CableBusBakedModel implements IBakedModel
|
|||||||
@Override
|
@Override
|
||||||
public boolean isAmbientOcclusion()
|
public boolean isAmbientOcclusion()
|
||||||
{
|
{
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.math.AxisAlignedBB;
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
@@ -73,6 +74,8 @@ public class CableBusRenderState
|
|||||||
// facades on this cable bus
|
// facades on this cable bus
|
||||||
private List<AxisAlignedBB> boundingBoxes = new ArrayList<>();
|
private List<AxisAlignedBB> boundingBoxes = new ArrayList<>();
|
||||||
|
|
||||||
|
private EnumMap<EnumFacing, Long> partFlags = new EnumMap<>( EnumFacing.class );
|
||||||
|
|
||||||
public CableCoreType getCoreType()
|
public CableCoreType getCoreType()
|
||||||
{
|
{
|
||||||
return this.coreType;
|
return this.coreType;
|
||||||
@@ -153,4 +156,49 @@ public class CableBusRenderState
|
|||||||
return this.boundingBoxes;
|
return this.boundingBoxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public EnumMap<EnumFacing, Long> getPartFlags()
|
||||||
|
{
|
||||||
|
return this.partFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ( ( this.attachmentConnections == null ) ? 0 : this.attachmentConnections.hashCode() );
|
||||||
|
result = prime * result + ( ( this.cableBusAdjacent == null ) ? 0 : this.cableBusAdjacent.hashCode() );
|
||||||
|
result = prime * result + ( ( this.cableColor == null ) ? 0 : this.cableColor.hashCode() );
|
||||||
|
result = prime * result + ( ( this.cableType == null ) ? 0 : this.cableType.hashCode() );
|
||||||
|
result = prime * result + ( ( this.channelsOnSide == null ) ? 0 : this.channelsOnSide.hashCode() );
|
||||||
|
result = prime * result + ( ( this.connectionTypes == null ) ? 0 : this.connectionTypes.hashCode() );
|
||||||
|
result = prime * result + ( ( this.coreType == null ) ? 0 : this.coreType.hashCode() );
|
||||||
|
result = prime * result + ( ( this.partFlags == null ) ? 0 : this.partFlags.hashCode() );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals( Object obj )
|
||||||
|
{
|
||||||
|
if( this == obj )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( obj == null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if( getClass() != obj.getClass() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
final CableBusRenderState other = (CableBusRenderState) obj;
|
||||||
|
|
||||||
|
return this.cableColor == other.cableColor && this.cableType == other.cableType && this.coreType == other.coreType && Objects
|
||||||
|
.equals( this.attachmentConnections, other.attachmentConnections ) && Objects.equals( this.cableBusAdjacent,
|
||||||
|
other.cableBusAdjacent ) && Objects.equals( this.channelsOnSide, other.channelsOnSide ) && Objects.equals( this.connectionTypes,
|
||||||
|
other.connectionTypes ) && Objects.equals( this.partFlags, other.partFlags );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ import appeng.core.AppEng;
|
|||||||
*/
|
*/
|
||||||
public enum CableCoreType
|
public enum CableCoreType
|
||||||
{
|
{
|
||||||
GLASS( "parts/cable/core/glass" ), COVERED( "parts/cable/core/covered" ), DENSE_SMART( "parts/cable/core/dense_smart" );
|
GLASS( "parts/cable/core/glass" ), COVERED( "parts/cable/core/covered" ), DENSE( "parts/cable/core/dense_smart" );
|
||||||
|
|
||||||
private static final Map<AECableType, CableCoreType> cableMapping = generateCableMapping();
|
private static final Map<AECableType, CableCoreType> cableMapping = generateCableMapping();
|
||||||
|
|
||||||
@@ -55,8 +55,8 @@ public enum CableCoreType
|
|||||||
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
result.put( AECableType.GLASS, CableCoreType.GLASS );
|
||||||
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
result.put( AECableType.COVERED, CableCoreType.COVERED );
|
||||||
result.put( AECableType.SMART, CableCoreType.COVERED );
|
result.put( AECableType.SMART, CableCoreType.COVERED );
|
||||||
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE_SMART );
|
result.put( AECableType.DENSE_COVERED, CableCoreType.DENSE );
|
||||||
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE_SMART );
|
result.put( AECableType.DENSE_SMART, CableCoreType.DENSE );
|
||||||
|
|
||||||
return ImmutableMap.copyOf( result );
|
return ImmutableMap.copyOf( result );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ public class CubeBuilder
|
|||||||
|
|
||||||
private int color = 0xFFFFFFFF;
|
private int color = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
private boolean useStandardUV = false;
|
||||||
|
|
||||||
private boolean renderFullBright;
|
private boolean renderFullBright;
|
||||||
|
|
||||||
public CubeBuilder( VertexFormat format, List<BakedQuad> output )
|
public CubeBuilder( VertexFormat format, List<BakedQuad> output )
|
||||||
@@ -142,6 +144,8 @@ public class CubeBuilder
|
|||||||
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( this.format );
|
UnpackedBakedQuad.Builder builder = new UnpackedBakedQuad.Builder( this.format );
|
||||||
builder.setTexture( texture );
|
builder.setTexture( texture );
|
||||||
builder.setQuadOrientation( face );
|
builder.setQuadOrientation( face );
|
||||||
|
builder.setQuadTint( -1 );
|
||||||
|
builder.setApplyDiffuseLighting( true );
|
||||||
|
|
||||||
UvVector uv = new UvVector();
|
UvVector uv = new UvVector();
|
||||||
|
|
||||||
@@ -154,6 +158,10 @@ public class CubeBuilder
|
|||||||
uv.u2 = texture.getInterpolatedU( customUv.z );
|
uv.u2 = texture.getInterpolatedU( customUv.z );
|
||||||
uv.v2 = texture.getInterpolatedV( customUv.w );
|
uv.v2 = texture.getInterpolatedV( customUv.w );
|
||||||
}
|
}
|
||||||
|
else if( this.useStandardUV )
|
||||||
|
{
|
||||||
|
uv = this.getStandardUv( face, texture, x1, y1, z1, x2, y2, z2 );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uv = this.getDefaultUv( face, texture, x1, y1, z1, x2, y2, z2 );
|
uv = this.getDefaultUv( face, texture, x1, y1, z1, x2, y2, z2 );
|
||||||
@@ -199,8 +207,7 @@ public class CubeBuilder
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
int[] vertexData = builder.build().getVertexData();
|
this.output.add( builder.build() );
|
||||||
this.output.add( new BakedQuad( vertexData, -1, face, texture, true, this.format ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private UvVector getDefaultUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
|
private UvVector getDefaultUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
|
||||||
@@ -251,6 +258,51 @@ public class CubeBuilder
|
|||||||
return uv;
|
return uv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private UvVector getStandardUv( EnumFacing face, TextureAtlasSprite texture, float x1, float y1, float z1, float x2, float y2, float z2 )
|
||||||
|
{
|
||||||
|
UvVector uv = new UvVector();
|
||||||
|
switch( face )
|
||||||
|
{
|
||||||
|
case DOWN:
|
||||||
|
uv.u1 = texture.getInterpolatedU( x1 * 16 );
|
||||||
|
uv.v1 = texture.getInterpolatedV( 16 - z1 * 16 );
|
||||||
|
uv.u2 = texture.getInterpolatedU( x2 * 16 );
|
||||||
|
uv.v2 = texture.getInterpolatedV( 16 - z2 * 16 );
|
||||||
|
break;
|
||||||
|
case UP:
|
||||||
|
uv.u1 = texture.getInterpolatedU( x1 * 16 );
|
||||||
|
uv.v1 = texture.getInterpolatedV( z1 * 16 );
|
||||||
|
uv.u2 = texture.getInterpolatedU( x2 * 16 );
|
||||||
|
uv.v2 = texture.getInterpolatedV( z2 * 16 );
|
||||||
|
break;
|
||||||
|
case NORTH:
|
||||||
|
uv.u1 = texture.getInterpolatedU( 16 - x1 * 16 );
|
||||||
|
uv.v1 = texture.getInterpolatedV( 16 - y1 * 16 );
|
||||||
|
uv.u2 = texture.getInterpolatedU( 16 - x2 * 16 );
|
||||||
|
uv.v2 = texture.getInterpolatedV( 16 - y2 * 16 );
|
||||||
|
break;
|
||||||
|
case SOUTH:
|
||||||
|
uv.u1 = texture.getInterpolatedU( x1 * 16 );
|
||||||
|
uv.v1 = texture.getInterpolatedV( 16 - y1 * 16 );
|
||||||
|
uv.u2 = texture.getInterpolatedU( x2 * 16 );
|
||||||
|
uv.v2 = texture.getInterpolatedV( 16 - y2 * 16 );
|
||||||
|
break;
|
||||||
|
case WEST:
|
||||||
|
uv.u1 = texture.getInterpolatedU( z1 * 16 );
|
||||||
|
uv.v1 = texture.getInterpolatedV( 16 - y1 * 16 );
|
||||||
|
uv.u2 = texture.getInterpolatedU( z2 * 16 );
|
||||||
|
uv.v2 = texture.getInterpolatedV( 16 - y2 * 16 );
|
||||||
|
break;
|
||||||
|
case EAST:
|
||||||
|
uv.u1 = texture.getInterpolatedU( 16 - z2 * 16 );
|
||||||
|
uv.v1 = texture.getInterpolatedV( 16 - y1 * 16 );
|
||||||
|
uv.u2 = texture.getInterpolatedU( 16 - z1 * 16 );
|
||||||
|
uv.v2 = texture.getInterpolatedV( 16 - y2 * 16 );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return uv;
|
||||||
|
}
|
||||||
|
|
||||||
// uv.u1, uv.v1
|
// uv.u1, uv.v1
|
||||||
private void putVertexTL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
|
private void putVertexTL( UnpackedBakedQuad.Builder builder, EnumFacing face, float x, float y, float z, UvVector uv )
|
||||||
{
|
{
|
||||||
@@ -484,6 +536,15 @@ public class CubeBuilder
|
|||||||
this.uvRotations[facing.ordinal()] = (byte) rotation;
|
this.uvRotations[facing.ordinal()] = (byte) rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CubeBuilder uses UV optimized for cables by default.
|
||||||
|
* This switches to standard UV coordinates.
|
||||||
|
*/
|
||||||
|
public void useStandardUV()
|
||||||
|
{
|
||||||
|
this.useStandardUV = true;
|
||||||
|
}
|
||||||
|
|
||||||
public List<BakedQuad> getOutput()
|
public List<BakedQuad> getOutput()
|
||||||
{
|
{
|
||||||
return this.output;
|
return this.output;
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ public class FacadeBuilder
|
|||||||
|
|
||||||
// Reset to no color multiplicator
|
// Reset to no color multiplicator
|
||||||
builder.setColorRGB( 0xFFFFFF );
|
builder.setColorRGB( 0xFFFFFF );
|
||||||
|
builder.useStandardUV();
|
||||||
|
|
||||||
// We only render the stilt if we don't intersect with any part directly, and if there's no part on our side
|
// We only render the stilt if we don't intersect with any part directly, and if there's no part on our side
|
||||||
if( renderStilt && busBounds == null && layer == BlockRenderLayer.CUTOUT )
|
if( renderStilt && busBounds == null && layer == BlockRenderLayer.CUTOUT )
|
||||||
@@ -438,22 +439,22 @@ public class FacadeBuilder
|
|||||||
|
|
||||||
private static AxisAlignedBB getFacadeBox( EnumFacing side, boolean thinFacades )
|
private static AxisAlignedBB getFacadeBox( EnumFacing side, boolean thinFacades )
|
||||||
{
|
{
|
||||||
int thickness = thinFacades ? 1 : 2;
|
double thickness = ( thinFacades ? 1 : 2 ) / 16.0;
|
||||||
|
|
||||||
switch( side )
|
switch( side )
|
||||||
{
|
{
|
||||||
case DOWN:
|
case DOWN:
|
||||||
return new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, ( thickness ) / 16.0, 1.0 );
|
return new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, thickness, 1.0 );
|
||||||
case EAST:
|
case EAST:
|
||||||
return new AxisAlignedBB( ( 16.0 - thickness ) / 16.0, 0.0, 0.0, 1.0, 1.0, 1.0 );
|
return new AxisAlignedBB( 1.0 - thickness, 0.0, 0.0, 1.0, 1.0, 1.0 );
|
||||||
case NORTH:
|
case NORTH:
|
||||||
return new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, ( thickness ) / 16.0 );
|
return new AxisAlignedBB( 0.0, 0.0, 0.0, 1.0, 1.0, thickness );
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
return new AxisAlignedBB( 0.0, 0.0, ( 16.0 - thickness ) / 16.0, 1.0, 1.0, 1.0 );
|
return new AxisAlignedBB( 0.0, 0.0, 1.0 - thickness, 1.0, 1.0, 1.0 );
|
||||||
case UP:
|
case UP:
|
||||||
return new AxisAlignedBB( 0.0, ( 16.0 - thickness ) / 16.0, 0.0, 1.0, 1.0, 1.0 );
|
return new AxisAlignedBB( 0.0, 1.0 - thickness, 0.0, 1.0, 1.0, 1.0 );
|
||||||
case WEST:
|
case WEST:
|
||||||
return new AxisAlignedBB( 0.0, 0.0, 0.0, ( thickness ) / 16.0, 1.0, 1.0 );
|
return new AxisAlignedBB( 0.0, 0.0, 0.0, thickness, 1.0, 1.0 );
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException( "Unsupported face: " + side );
|
throw new IllegalArgumentException( "Unsupported face: " + side );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,142 @@
|
|||||||
|
|
||||||
|
package appeng.client.render.cablebus;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
import com.google.common.cache.Cache;
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
|
||||||
|
import appeng.api.parts.IPartBakedModel;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
|
public class P2PTunnelFrequencyBakedModel implements IBakedModel, IPartBakedModel
|
||||||
|
{
|
||||||
|
private final VertexFormat format;
|
||||||
|
private final TextureAtlasSprite texture;
|
||||||
|
|
||||||
|
private final static Cache<Long, List<BakedQuad>> modelCache = CacheBuilder.newBuilder().maximumSize( 100 ).build();
|
||||||
|
|
||||||
|
private static final int[][] QUAD_OFFSETS = new int[][] {
|
||||||
|
{ 4, 10, 2 },
|
||||||
|
{ 10, 10, 2 },
|
||||||
|
{ 4, 4, 2 },
|
||||||
|
{ 10, 4, 2 }
|
||||||
|
};
|
||||||
|
|
||||||
|
public P2PTunnelFrequencyBakedModel( final VertexFormat format, final TextureAtlasSprite texture )
|
||||||
|
{
|
||||||
|
this.format = format;
|
||||||
|
this.texture = texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> getPartQuads( Long partFlags, long rand )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return modelCache.get( partFlags, () ->
|
||||||
|
{
|
||||||
|
short frequency = 0;
|
||||||
|
boolean active = false;
|
||||||
|
if( partFlags != null )
|
||||||
|
{
|
||||||
|
frequency = (short) ( partFlags.longValue() & 0xffffL );
|
||||||
|
active = ( partFlags.longValue() & 0x10000L ) != 0;
|
||||||
|
}
|
||||||
|
return getQuadsForFrequency( frequency, active );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
catch( ExecutionException e )
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> getQuads( IBlockState state, EnumFacing side, long rand )
|
||||||
|
{
|
||||||
|
if( side != null )
|
||||||
|
{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return getPartQuads( null, rand );
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<BakedQuad> getQuadsForFrequency( final short frequency, final boolean active )
|
||||||
|
{
|
||||||
|
final AEColor[] colors = Platform.p2p().toColors( frequency );
|
||||||
|
final CubeBuilder cb = new CubeBuilder( this.format );
|
||||||
|
|
||||||
|
cb.setTexture( this.texture );
|
||||||
|
cb.useStandardUV();
|
||||||
|
cb.setRenderFullBright( active );
|
||||||
|
|
||||||
|
for( int i = 0; i < 4; ++i )
|
||||||
|
{
|
||||||
|
final int[] offs = QUAD_OFFSETS[i];
|
||||||
|
for( int j = 0; j < 4; ++j )
|
||||||
|
{
|
||||||
|
final AEColor c = colors[j];
|
||||||
|
if( active )
|
||||||
|
{
|
||||||
|
cb.setColorRGB( c.dye.getColorValue() );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
final float cv[] = c.dye.getColorComponentValues();
|
||||||
|
cb.setColorRGB( cv[0] * 0.5f, cv[1] * 0.5f, cv[2] * 0.5f );
|
||||||
|
}
|
||||||
|
|
||||||
|
final int startx = j % 2;
|
||||||
|
final int starty = 1 - j / 2;
|
||||||
|
|
||||||
|
cb.addCube( offs[0] + startx, offs[1] + starty, offs[2], offs[0] + startx + 1, offs[1] + starty + 1, offs[2] + 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return cb.getOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAmbientOcclusion()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGui3d()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuiltInRenderer()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureAtlasSprite getParticleTexture()
|
||||||
|
{
|
||||||
|
return this.texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides()
|
||||||
|
{
|
||||||
|
return ItemOverrideList.NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
|
||||||
|
package appeng.client.render.cablebus;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.model.IModel;
|
||||||
|
import net.minecraftforge.common.model.IModelState;
|
||||||
|
|
||||||
|
import appeng.core.AppEng;
|
||||||
|
|
||||||
|
|
||||||
|
public class P2PTunnelFrequencyModel implements IModel
|
||||||
|
{
|
||||||
|
private static final ResourceLocation TEXTURE = new ResourceLocation( AppEng.MOD_ID, "parts/p2p_tunnel_frequency" );
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ResourceLocation> getTextures()
|
||||||
|
{
|
||||||
|
return Collections.singletonList( TEXTURE );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final TextureAtlasSprite texture = bakedTextureGetter.apply( TEXTURE );
|
||||||
|
return new P2PTunnelFrequencyBakedModel( format, texture );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,7 +28,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.client.model.IModel;
|
|
||||||
import net.minecraftforge.common.model.TRSRTransformation;
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
|
||||||
import appeng.api.implementations.items.IBiometricCard;
|
import appeng.api.implementations.items.IBiometricCard;
|
||||||
@@ -216,9 +215,9 @@ class BiometricCardBakedModel implements IBakedModel
|
|||||||
public Pair<? extends IBakedModel, Matrix4f> handlePerspective( ItemCameraTransforms.TransformType type )
|
public Pair<? extends IBakedModel, Matrix4f> handlePerspective( ItemCameraTransforms.TransformType type )
|
||||||
{
|
{
|
||||||
// Delegate to the base model if possible
|
// Delegate to the base model if possible
|
||||||
if( this.baseModel instanceof IModel )
|
if( this.baseModel instanceof IBakedModel )
|
||||||
{
|
{
|
||||||
IBakedModel pam = (IBakedModel) this.baseModel;
|
IBakedModel pam = this.baseModel;
|
||||||
Pair<? extends IBakedModel, Matrix4f> pair = pam.handlePerspective( type );
|
Pair<? extends IBakedModel, Matrix4f> pair = pam.handlePerspective( type );
|
||||||
return Pair.of( this, pair.getValue() );
|
return Pair.of( this, pair.getValue() );
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,228 @@
|
|||||||
|
|
||||||
|
package appeng.client.render.model;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import javax.vecmath.Matrix4f;
|
||||||
|
|
||||||
|
import com.google.common.cache.Cache;
|
||||||
|
import com.google.common.cache.CacheBuilder;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemOverrideList;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
|
||||||
|
import appeng.api.implementations.items.IMemoryCard;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.client.render.cablebus.CubeBuilder;
|
||||||
|
import appeng.core.AELog;
|
||||||
|
|
||||||
|
|
||||||
|
class MemoryCardBakedModel implements IBakedModel
|
||||||
|
{
|
||||||
|
private static final AEColor[] DEFAULT_COLOR_CODE = new AEColor[] {
|
||||||
|
AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT,
|
||||||
|
AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT, AEColor.TRANSPARENT,
|
||||||
|
};
|
||||||
|
|
||||||
|
private final VertexFormat format;
|
||||||
|
|
||||||
|
private final IBakedModel baseModel;
|
||||||
|
|
||||||
|
private final TextureAtlasSprite texture;
|
||||||
|
|
||||||
|
private final AEColor[] colorCode;
|
||||||
|
|
||||||
|
private final Cache<CacheKey, MemoryCardBakedModel> modelCache;
|
||||||
|
|
||||||
|
private final ImmutableList<BakedQuad> generalQuads;
|
||||||
|
|
||||||
|
MemoryCardBakedModel( VertexFormat format, IBakedModel baseModel, TextureAtlasSprite texture )
|
||||||
|
{
|
||||||
|
this( format, baseModel, texture, DEFAULT_COLOR_CODE, createCache() );
|
||||||
|
}
|
||||||
|
|
||||||
|
private MemoryCardBakedModel( VertexFormat format, IBakedModel baseModel, TextureAtlasSprite texture, AEColor[] hash, Cache<CacheKey, MemoryCardBakedModel> modelCache )
|
||||||
|
{
|
||||||
|
this.format = format;
|
||||||
|
this.baseModel = baseModel;
|
||||||
|
this.texture = texture;
|
||||||
|
this.colorCode = hash;
|
||||||
|
this.generalQuads = ImmutableList.copyOf( this.buildGeneralQuads() );
|
||||||
|
this.modelCache = modelCache;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Cache<CacheKey, MemoryCardBakedModel> createCache()
|
||||||
|
{
|
||||||
|
return CacheBuilder.newBuilder()
|
||||||
|
.maximumSize( 100 )
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BakedQuad> getQuads( @Nullable IBlockState state, @Nullable EnumFacing side, long rand )
|
||||||
|
{
|
||||||
|
|
||||||
|
List<BakedQuad> quads = this.baseModel.getQuads( state, side, rand );
|
||||||
|
|
||||||
|
if( side != null )
|
||||||
|
{
|
||||||
|
return quads;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<BakedQuad> result = new ArrayList<>( quads.size() + this.generalQuads.size() );
|
||||||
|
result.addAll( quads );
|
||||||
|
result.addAll( this.generalQuads );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<BakedQuad> buildGeneralQuads()
|
||||||
|
{
|
||||||
|
CubeBuilder builder = new CubeBuilder( this.format );
|
||||||
|
|
||||||
|
builder.setTexture( this.texture );
|
||||||
|
|
||||||
|
for( int x = 0; x < 4; x++ )
|
||||||
|
{
|
||||||
|
for( int y = 0; y < 2; y++ )
|
||||||
|
{
|
||||||
|
final AEColor color = this.colorCode[x + y * 4];
|
||||||
|
|
||||||
|
builder.setColorRGB( color.mediumVariant );
|
||||||
|
builder.addCube( 7 + x, 8 + ( 1 - y ), 7.5f, 7 + x + 1, 8 + ( 1 - y ) + 1, 8.5f );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return builder.getOutput();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isAmbientOcclusion()
|
||||||
|
{
|
||||||
|
return this.baseModel.isAmbientOcclusion();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isGui3d()
|
||||||
|
{
|
||||||
|
return this.baseModel.isGui3d();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBuiltInRenderer()
|
||||||
|
{
|
||||||
|
return this.baseModel.isBuiltInRenderer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TextureAtlasSprite getParticleTexture()
|
||||||
|
{
|
||||||
|
return this.baseModel.getParticleTexture();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemCameraTransforms getItemCameraTransforms()
|
||||||
|
{
|
||||||
|
return this.baseModel.getItemCameraTransforms();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemOverrideList getOverrides()
|
||||||
|
{
|
||||||
|
return new ItemOverrideList( Collections.emptyList() )
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public IBakedModel handleItemState( IBakedModel originalModel, ItemStack stack, World world, EntityLivingBase entity )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if( stack.getItem() instanceof IMemoryCard )
|
||||||
|
{
|
||||||
|
final IMemoryCard memoryCard = (IMemoryCard) stack.getItem();
|
||||||
|
final AEColor[] colors = memoryCard.getColorCode( stack );
|
||||||
|
|
||||||
|
return MemoryCardBakedModel.this.modelCache.get( new CacheKey( colors ),
|
||||||
|
() -> new MemoryCardBakedModel( MemoryCardBakedModel.this.format, MemoryCardBakedModel.this.baseModel, MemoryCardBakedModel.this.texture, colors, MemoryCardBakedModel.this.modelCache ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( ExecutionException e )
|
||||||
|
{
|
||||||
|
AELog.error( e );
|
||||||
|
}
|
||||||
|
|
||||||
|
return MemoryCardBakedModel.this;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Pair<? extends IBakedModel, Matrix4f> handlePerspective( ItemCameraTransforms.TransformType type )
|
||||||
|
{
|
||||||
|
// Delegate to the base model if possible
|
||||||
|
if( this.baseModel instanceof IBakedModel )
|
||||||
|
{
|
||||||
|
IBakedModel pam = this.baseModel;
|
||||||
|
Pair<? extends IBakedModel, Matrix4f> pair = pam.handlePerspective( type );
|
||||||
|
return Pair.of( this, pair.getValue() );
|
||||||
|
}
|
||||||
|
return Pair.of( this, TRSRTransformation.identity().getMatrix() );
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class CacheKey
|
||||||
|
{
|
||||||
|
private final AEColor[] key;
|
||||||
|
|
||||||
|
CacheKey( AEColor[] key )
|
||||||
|
{
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + Arrays.hashCode( this.key );
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals( Object obj )
|
||||||
|
{
|
||||||
|
if( this == obj )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if( obj == null )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if( this.getClass() != obj.getClass() )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CacheKey other = (CacheKey) obj;
|
||||||
|
return Arrays.equals( this.key, other.key );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
|
||||||
|
package appeng.client.render.model;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||||
|
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.model.IModel;
|
||||||
|
import net.minecraftforge.client.model.ModelLoaderRegistry;
|
||||||
|
import net.minecraftforge.common.model.IModelState;
|
||||||
|
import net.minecraftforge.common.model.TRSRTransformation;
|
||||||
|
|
||||||
|
import appeng.core.AppEng;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model wrapper for the memory card item model, which combines a base card layer with a "visual hash" of the part/tile.
|
||||||
|
*/
|
||||||
|
public class MemoryCardModel implements IModel
|
||||||
|
{
|
||||||
|
|
||||||
|
private static final ResourceLocation MODEL_BASE = new ResourceLocation( AppEng.MOD_ID, "item/memory_card" );
|
||||||
|
private static final ResourceLocation TEXTURE = new ResourceLocation( AppEng.MOD_ID, "items/memory_card_hash" );
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ResourceLocation> getDependencies()
|
||||||
|
{
|
||||||
|
return Collections.singletonList( MODEL_BASE );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Collection<ResourceLocation> getTextures()
|
||||||
|
{
|
||||||
|
return Collections.singletonList( TEXTURE );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBakedModel bake( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
|
{
|
||||||
|
TextureAtlasSprite texture = bakedTextureGetter.apply( TEXTURE );
|
||||||
|
|
||||||
|
IBakedModel baseModel = this.getBaseModel( state, format, bakedTextureGetter );
|
||||||
|
|
||||||
|
return new MemoryCardBakedModel( format, baseModel, texture );
|
||||||
|
}
|
||||||
|
|
||||||
|
private IBakedModel getBaseModel( IModelState state, VertexFormat format, Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter )
|
||||||
|
{
|
||||||
|
// Load the base model
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return ModelLoaderRegistry.getModel( MODEL_BASE ).bake( state, format, bakedTextureGetter );
|
||||||
|
}
|
||||||
|
catch( Exception e )
|
||||||
|
{
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IModelState getDefaultState()
|
||||||
|
{
|
||||||
|
return TRSRTransformation.identity().toItemTransform();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ package appeng.client.render.tesr;
|
|||||||
|
|
||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
@@ -15,7 +14,7 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
|||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.item.ItemBlock;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
@@ -23,7 +22,6 @@ import net.minecraftforge.items.IItemHandler;
|
|||||||
|
|
||||||
import appeng.api.features.IInscriberRecipe;
|
import appeng.api.features.IInscriberRecipe;
|
||||||
import appeng.client.render.FacingToRotation;
|
import appeng.client.render.FacingToRotation;
|
||||||
import appeng.core.AELog;
|
|
||||||
import appeng.core.AppEng;
|
import appeng.core.AppEng;
|
||||||
import appeng.tile.AEBaseTile;
|
import appeng.tile.AEBaseTile;
|
||||||
import appeng.tile.misc.TileInscriber;
|
import appeng.tile.misc.TileInscriber;
|
||||||
@@ -32,7 +30,7 @@ import appeng.tile.misc.TileInscriber;
|
|||||||
/**
|
/**
|
||||||
* Renders the dynamic parts of an inscriber (the presses, the animation and the item being smashed)
|
* Renders the dynamic parts of an inscriber (the presses, the animation and the item being smashed)
|
||||||
*/
|
*/
|
||||||
public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
public final class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final float ITEM_RENDER_SCALE = 1.0f / 1.2f;
|
private static final float ITEM_RENDER_SCALE = 1.0f / 1.2f;
|
||||||
@@ -42,7 +40,7 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
|||||||
private static TextureAtlasSprite textureInside;
|
private static TextureAtlasSprite textureInside;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render( TileInscriber tile, double x, double y, double z, float partialTicks, int destroyStage, float p_render_10_ )
|
public void render( final TileInscriber tile, final double x, final double y, final double z, final float partialTicks, final int destroyStage, final float p_render_10_ )
|
||||||
{
|
{
|
||||||
// render inscriber
|
// render inscriber
|
||||||
|
|
||||||
@@ -90,7 +88,7 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
|||||||
float press = 0.2f;
|
float press = 0.2f;
|
||||||
press -= progress / 5.0f;
|
press -= progress / 5.0f;
|
||||||
|
|
||||||
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
final BufferBuilder buffer = Tessellator.getInstance().getBuffer();
|
||||||
buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX );
|
buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX );
|
||||||
|
|
||||||
float middle = 0.5f;
|
float middle = 0.5f;
|
||||||
@@ -129,8 +127,6 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
|||||||
|
|
||||||
Tessellator.getInstance().draw();
|
Tessellator.getInstance().draw();
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
|
||||||
|
|
||||||
// render items.
|
// render items.
|
||||||
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
GlStateManager.color( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||||
|
|
||||||
@@ -150,8 +146,6 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
|||||||
items++;
|
items++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// buffer.begin( GL11.GL_QUADS, DefaultVertexFormats.ITEM );
|
|
||||||
|
|
||||||
if( relativeProgress > 1.0f || items == 0 )
|
if( relativeProgress > 1.0f || items == 0 )
|
||||||
{
|
{
|
||||||
ItemStack is = tileInv.getStackInSlot( 3 );
|
ItemStack is = tileInv.getStackInSlot( 3 );
|
||||||
@@ -165,65 +159,40 @@ public class InscriberTESR extends TileEntitySpecialRenderer<TileInscriber>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.renderItem( is, 0.0f, tile, buffer, x, y, z );
|
this.renderItem( is, 0.0f, tile, x, y, z );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.renderItem( tileInv.getStackInSlot( 0 ), press, tile, buffer, x, y, z );
|
this.renderItem( tileInv.getStackInSlot( 0 ), press, tile, x, y, z );
|
||||||
this.renderItem( tileInv.getStackInSlot( 1 ), -press, tile, buffer, x, y, z );
|
this.renderItem( tileInv.getStackInSlot( 1 ), -press, tile, x, y, z );
|
||||||
this.renderItem( tileInv.getStackInSlot( 2 ), 0.0f, tile, buffer, x, y, z );
|
this.renderItem( tileInv.getStackInSlot( 2 ), 0.0f, tile, x, y, z );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tessellator.getInstance().draw();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
GlStateManager.enableLighting();
|
GlStateManager.enableLighting();
|
||||||
GlStateManager.enableRescaleNormal();
|
GlStateManager.enableRescaleNormal();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderItem( ItemStack sis, final float o, final AEBaseTile tile, final BufferBuilder tess, final double x, final double y, final double z )
|
private void renderItem( final ItemStack stack, final float o, final AEBaseTile tile, final double x, final double y, final double z )
|
||||||
{
|
{
|
||||||
if( !sis.isEmpty() )
|
if( !stack.isEmpty() )
|
||||||
{
|
{
|
||||||
sis = sis.copy();
|
final ItemStack sis = stack.copy();
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
|
// move to center
|
||||||
|
GlStateManager.translate( 0.5f, 0.5f + o, 0.5f );
|
||||||
|
GlStateManager.rotate( 90, 1, 0, 0 );
|
||||||
|
// set scale
|
||||||
|
GlStateManager.scale( ITEM_RENDER_SCALE, ITEM_RENDER_SCALE, ITEM_RENDER_SCALE );
|
||||||
|
|
||||||
GlStateManager.translate( x, y, z );
|
// heuristic to scale items down much further than blocks
|
||||||
GlStateManager.translate( 0.5F, 0.5F, 0.5F );
|
if( !( sis.getItem() instanceof ItemBlock ) )
|
||||||
FacingToRotation.get( tile.getForward(), tile.getUp() ).glRotateCurrentMat();
|
|
||||||
GlStateManager.translate( -0.5F, -0.5F, -0.5F );
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
// move to center
|
GlStateManager.scale( 0.5, 0.5, 0.5 );
|
||||||
GlStateManager.translate( 0.5f, 0.5f + o, 0.5f );
|
|
||||||
|
|
||||||
GlStateManager.rotate( 90, 1, 0, 0 );
|
|
||||||
|
|
||||||
// set scale
|
|
||||||
GlStateManager.scale( ITEM_RENDER_SCALE, ITEM_RENDER_SCALE, ITEM_RENDER_SCALE );
|
|
||||||
|
|
||||||
// heuristic to scale items down much further than blocks
|
|
||||||
final Block blk = Block.getBlockFromItem( sis.getItem() );
|
|
||||||
if( blk == Blocks.AIR )
|
|
||||||
{
|
|
||||||
GlStateManager.scale( 0.5, 0.5, 0.5 );
|
|
||||||
}
|
|
||||||
|
|
||||||
// << 20 | light << 4;
|
|
||||||
final int br = tile.getWorld().getCombinedLight( tile.getPos(), 0 );
|
|
||||||
final int var11 = br % 65536;
|
|
||||||
final int var12 = br / 65536;
|
|
||||||
|
|
||||||
OpenGlHelper.setLightmapTextureCoords( OpenGlHelper.lightmapTexUnit, var11, var12 );
|
|
||||||
|
|
||||||
Minecraft.getMinecraft().getRenderItem().renderItem( sis, ItemCameraTransforms.TransformType.FIXED );
|
|
||||||
}
|
|
||||||
catch( final Exception err )
|
|
||||||
{
|
|
||||||
AELog.debug( err );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().getRenderItem().renderItem( sis, ItemCameraTransforms.TransformType.FIXED );
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,11 @@
|
|||||||
package appeng.container;
|
package appeng.container;
|
||||||
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@@ -37,8 +34,6 @@ import net.minecraft.inventory.IContainerListener;
|
|||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.Slot;
|
import net.minecraft.inventory.Slot;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompressedStreamTools;
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.items.IItemHandler;
|
import net.minecraftforge.items.IItemHandler;
|
||||||
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
|
||||||
@@ -58,7 +53,6 @@ import appeng.api.parts.IPart;
|
|||||||
import appeng.api.storage.IMEInventoryHandler;
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
import appeng.client.me.InternalSlotME;
|
|
||||||
import appeng.client.me.SlotME;
|
import appeng.client.me.SlotME;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.guisync.SyncData;
|
import appeng.container.guisync.SyncData;
|
||||||
@@ -73,7 +67,7 @@ import appeng.container.slot.SlotPlayerInv;
|
|||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
import appeng.core.sync.packets.PacketInventoryAction;
|
import appeng.core.sync.packets.PacketInventoryAction;
|
||||||
import appeng.core.sync.packets.PacketPartialItem;
|
import appeng.core.sync.packets.PacketTargetItemStack;
|
||||||
import appeng.core.sync.packets.PacketValueConfig;
|
import appeng.core.sync.packets.PacketValueConfig;
|
||||||
import appeng.helpers.ICustomNameObject;
|
import appeng.helpers.ICustomNameObject;
|
||||||
import appeng.helpers.InventoryAction;
|
import appeng.helpers.InventoryAction;
|
||||||
@@ -93,7 +87,6 @@ public abstract class AEBaseContainer extends Container
|
|||||||
private final TileEntity tileEntity;
|
private final TileEntity tileEntity;
|
||||||
private final IPart part;
|
private final IPart part;
|
||||||
private final IGuiItemObject obj;
|
private final IGuiItemObject obj;
|
||||||
private final List<PacketPartialItem> dataChunks = new LinkedList<>();
|
|
||||||
private final HashMap<Integer, SyncData> syncData = new HashMap<>();
|
private final HashMap<Integer, SyncData> syncData = new HashMap<>();
|
||||||
private boolean isContainerValid = true;
|
private boolean isContainerValid = true;
|
||||||
private String customName;
|
private String customName;
|
||||||
@@ -175,47 +168,6 @@ public abstract class AEBaseContainer extends Container
|
|||||||
this.prepareSync();
|
this.prepareSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void postPartial( final PacketPartialItem packetPartialItem )
|
|
||||||
{
|
|
||||||
this.dataChunks.add( packetPartialItem );
|
|
||||||
if( packetPartialItem.getPageCount() == this.dataChunks.size() )
|
|
||||||
{
|
|
||||||
this.parsePartials();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parsePartials()
|
|
||||||
{
|
|
||||||
int total = 0;
|
|
||||||
for( final PacketPartialItem ppi : this.dataChunks )
|
|
||||||
{
|
|
||||||
total += ppi.getSize();
|
|
||||||
}
|
|
||||||
|
|
||||||
final byte[] buffer = new byte[total];
|
|
||||||
int cursor = 0;
|
|
||||||
|
|
||||||
for( final PacketPartialItem ppi : this.dataChunks )
|
|
||||||
{
|
|
||||||
cursor = ppi.write( buffer, cursor );
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final NBTTagCompound data = CompressedStreamTools.readCompressed( new ByteArrayInputStream( buffer ) );
|
|
||||||
if( data != null )
|
|
||||||
{
|
|
||||||
this.setTargetStack( AEItemStack.fromNBT( data ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( final IOException e )
|
|
||||||
{
|
|
||||||
AELog.debug( e );
|
|
||||||
}
|
|
||||||
|
|
||||||
this.dataChunks.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IAEItemStack getTargetStack()
|
public IAEItemStack getTargetStack()
|
||||||
{
|
{
|
||||||
return this.clientRequestedTargetItem;
|
return this.clientRequestedTargetItem;
|
||||||
@@ -235,47 +187,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
|
NetworkHandler.instance().sendToServer( new PacketTargetItemStack( (AEItemStack) stack ) );
|
||||||
final NBTTagCompound item = new NBTTagCompound();
|
|
||||||
|
|
||||||
if( stack != null )
|
|
||||||
{
|
|
||||||
stack.writeToNBT( item );
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CompressedStreamTools.writeCompressed( item, stream );
|
|
||||||
|
|
||||||
final int maxChunkSize = 30000;
|
|
||||||
final List<byte[]> miniPackets = new LinkedList<>();
|
|
||||||
|
|
||||||
final byte[] data = stream.toByteArray();
|
|
||||||
|
|
||||||
final ByteArrayInputStream bis = new ByteArrayInputStream( data, 0, stream.size() );
|
|
||||||
while( bis.available() > 0 )
|
|
||||||
{
|
|
||||||
final int nextBLock = bis.available() > maxChunkSize ? maxChunkSize : bis.available();
|
|
||||||
final byte[] nextSegment = new byte[nextBLock];
|
|
||||||
bis.read( nextSegment );
|
|
||||||
miniPackets.add( nextSegment );
|
|
||||||
}
|
|
||||||
bis.close();
|
|
||||||
stream.close();
|
|
||||||
|
|
||||||
int page = 0;
|
|
||||||
for( final byte[] packet : miniPackets )
|
|
||||||
{
|
|
||||||
final PacketPartialItem ppi = new PacketPartialItem( page, miniPackets.size(), packet );
|
|
||||||
page++;
|
|
||||||
NetworkHandler.instance().sendToServer( ppi );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch( final IOException e )
|
|
||||||
{
|
|
||||||
AELog.debug( e );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
|
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
|
||||||
@@ -443,6 +355,11 @@ public abstract class AEBaseContainer extends Container
|
|||||||
|
|
||||||
if( Platform.isServer() )
|
if( Platform.isServer() )
|
||||||
{
|
{
|
||||||
|
if( this.tileEntity != null && this.tileEntity.getWorld().getTileEntity( this.tileEntity.getPos() ) != this.tileEntity )
|
||||||
|
{
|
||||||
|
this.setValidContainer( false );
|
||||||
|
}
|
||||||
|
|
||||||
for( final IContainerListener listener : this.listeners )
|
for( final IContainerListener listener : this.listeners )
|
||||||
{
|
{
|
||||||
for( final SyncData sd : this.syncData.values() )
|
for( final SyncData sd : this.syncData.values() )
|
||||||
@@ -463,21 +380,6 @@ public abstract class AEBaseContainer extends Container
|
|||||||
return ItemStack.EMPTY;
|
return ItemStack.EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean hasMETiles = false;
|
|
||||||
for( final Object is : this.inventorySlots )
|
|
||||||
{
|
|
||||||
if( is instanceof InternalSlotME )
|
|
||||||
{
|
|
||||||
hasMETiles = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( hasMETiles && Platform.isClient() )
|
|
||||||
{
|
|
||||||
return ItemStack.EMPTY;
|
|
||||||
}
|
|
||||||
|
|
||||||
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get( idx ); // require AE SLots!
|
final AppEngSlot clickSlot = (AppEngSlot) this.inventorySlots.get( idx ); // require AE SLots!
|
||||||
|
|
||||||
if( clickSlot instanceof SlotDisabled || clickSlot instanceof SlotInaccessible )
|
if( clickSlot instanceof SlotDisabled || clickSlot instanceof SlotInaccessible )
|
||||||
@@ -500,24 +402,29 @@ public abstract class AEBaseContainer extends Container
|
|||||||
*/
|
*/
|
||||||
if( clickSlot.isPlayerSide() )
|
if( clickSlot.isPlayerSide() )
|
||||||
{
|
{
|
||||||
tis = this.shiftStoreItem( tis );
|
tis = this.transferStackToContainer( tis );
|
||||||
|
|
||||||
// target slots in the container...
|
if( !tis.isEmpty() )
|
||||||
for( final Object inventorySlot : this.inventorySlots )
|
|
||||||
{
|
{
|
||||||
final AppEngSlot cs = (AppEngSlot) inventorySlot;
|
// target slots in the container...
|
||||||
|
for( final Object inventorySlot : this.inventorySlots )
|
||||||
if( !( cs.isPlayerSide() ) && !( cs instanceof SlotFake ) && !( cs instanceof SlotCraftingMatrix ) )
|
|
||||||
{
|
{
|
||||||
if( cs.isItemValid( tis ) )
|
final AppEngSlot cs = (AppEngSlot) inventorySlot;
|
||||||
|
|
||||||
|
if( !( cs.isPlayerSide() ) && !( cs instanceof SlotFake ) && !( cs instanceof SlotCraftingMatrix ) )
|
||||||
{
|
{
|
||||||
selectedSlots.add( cs );
|
if( cs.isItemValid( tis ) )
|
||||||
|
{
|
||||||
|
selectedSlots.add( cs );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
tis = tis.copy();
|
||||||
|
|
||||||
// target slots in the container...
|
// target slots in the container...
|
||||||
for( final Object inventorySlot : this.inventorySlots )
|
for( final Object inventorySlot : this.inventorySlots )
|
||||||
{
|
{
|
||||||
@@ -578,7 +485,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
if( d.getHasStack() )
|
if( d.getHasStack() )
|
||||||
{
|
{
|
||||||
final ItemStack t = d.getStack();
|
final ItemStack t = d.getStack().copy();
|
||||||
|
|
||||||
if( Platform.itemComparisons().isSameItem( tis, t ) ) // t.isItemEqual(tis))
|
if( Platform.itemComparisons().isSameItem( tis, t ) ) // t.isItemEqual(tis))
|
||||||
{
|
{
|
||||||
@@ -598,6 +505,8 @@ public abstract class AEBaseContainer extends Container
|
|||||||
t.setCount( t.getCount() + placeAble );
|
t.setCount( t.getCount() + placeAble );
|
||||||
tis.setCount( tis.getCount() - placeAble );
|
tis.setCount( tis.getCount() - placeAble );
|
||||||
|
|
||||||
|
d.putStack( t );
|
||||||
|
|
||||||
if( tis.getCount() <= 0 )
|
if( tis.getCount() <= 0 )
|
||||||
{
|
{
|
||||||
clickSlot.putStack( ItemStack.EMPTY );
|
clickSlot.putStack( ItemStack.EMPTY );
|
||||||
@@ -630,7 +539,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
if( d.getHasStack() )
|
if( d.getHasStack() )
|
||||||
{
|
{
|
||||||
final ItemStack t = d.getStack();
|
final ItemStack t = d.getStack().copy();
|
||||||
|
|
||||||
if( Platform.itemComparisons().isSameItem( t, tis ) )
|
if( Platform.itemComparisons().isSameItem( t, tis ) )
|
||||||
{
|
{
|
||||||
@@ -650,6 +559,8 @@ public abstract class AEBaseContainer extends Container
|
|||||||
t.setCount( t.getCount() + placeAble );
|
t.setCount( t.getCount() + placeAble );
|
||||||
tis.setCount( tis.getCount() - placeAble );
|
tis.setCount( tis.getCount() - placeAble );
|
||||||
|
|
||||||
|
d.putStack( t );
|
||||||
|
|
||||||
if( tis.getCount() <= 0 )
|
if( tis.getCount() <= 0 )
|
||||||
{
|
{
|
||||||
clickSlot.putStack( ItemStack.EMPTY );
|
clickSlot.putStack( ItemStack.EMPTY );
|
||||||
@@ -708,7 +619,7 @@ public abstract class AEBaseContainer extends Container
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clickSlot.putStack( !tis.isEmpty() ? tis.copy() : ItemStack.EMPTY );
|
clickSlot.putStack( !tis.isEmpty() ? tis : ItemStack.EMPTY );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateSlot( clickSlot );
|
this.updateSlot( clickSlot );
|
||||||
@@ -1108,9 +1019,10 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NetworkHandler.instance().sendTo(
|
NetworkHandler.instance()
|
||||||
new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.fromItemStack( p.inventory.getItemStack() ) ),
|
.sendTo(
|
||||||
p );
|
new PacketInventoryAction( InventoryAction.UPDATE_HAND, 0, AEItemStack.fromItemStack( p.inventory.getItemStack() ) ),
|
||||||
|
p );
|
||||||
}
|
}
|
||||||
catch( final IOException e )
|
catch( final IOException e )
|
||||||
{
|
{
|
||||||
@@ -1119,6 +1031,11 @@ public abstract class AEBaseContainer extends Container
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected ItemStack transferStackToContainer( final ItemStack input )
|
||||||
|
{
|
||||||
|
return shiftStoreItem( input );
|
||||||
|
}
|
||||||
|
|
||||||
private ItemStack shiftStoreItem( final ItemStack input )
|
private ItemStack shiftStoreItem( final ItemStack input )
|
||||||
{
|
{
|
||||||
if( this.getPowerSource() == null || this.getCellInventory() == null )
|
if( this.getPowerSource() == null || this.getCellInventory() == null )
|
||||||
@@ -1181,8 +1098,9 @@ public abstract class AEBaseContainer extends Container
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NetworkHandler.instance().sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ),
|
NetworkHandler.instance()
|
||||||
(EntityPlayerMP) this.getInventoryPlayer().player );
|
.sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ),
|
||||||
|
(EntityPlayerMP) this.getInventoryPlayer().player );
|
||||||
}
|
}
|
||||||
catch( final IOException e )
|
catch( final IOException e )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -33,10 +33,12 @@ import appeng.api.AEApi;
|
|||||||
import appeng.api.config.CopyMode;
|
import appeng.api.config.CopyMode;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.implementations.items.IStorageCell;
|
||||||
import appeng.api.storage.ICellWorkbenchItem;
|
import appeng.api.storage.ICellWorkbenchItem;
|
||||||
import appeng.api.storage.IMEInventory;
|
import appeng.api.storage.IMEInventory;
|
||||||
|
import appeng.api.storage.IStorageChannel;
|
||||||
import appeng.api.storage.channels.IItemStorageChannel;
|
import appeng.api.storage.channels.IItemStorageChannel;
|
||||||
import appeng.api.storage.data.IAEItemStack;
|
import appeng.api.storage.data.IAEStack;
|
||||||
import appeng.api.storage.data.IItemList;
|
import appeng.api.storage.data.IItemList;
|
||||||
import appeng.container.guisync.GuiSync;
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.slot.OptionalSlotRestrictedInput;
|
import appeng.container.slot.OptionalSlotRestrictedInput;
|
||||||
@@ -148,11 +150,6 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
final ItemStack is = this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
final ItemStack is = this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||||
if( Platform.isServer() )
|
if( Platform.isServer() )
|
||||||
{
|
{
|
||||||
if( this.workBench.getWorld().getTileEntity( this.workBench.getPos() ) != this.workBench )
|
|
||||||
{
|
|
||||||
this.setValidContainer( false );
|
|
||||||
}
|
|
||||||
|
|
||||||
for( final IContainerListener listener : this.listeners )
|
for( final IContainerListener listener : this.listeners )
|
||||||
{
|
{
|
||||||
if( this.prevStack != is )
|
if( this.prevStack != is )
|
||||||
@@ -224,17 +221,20 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
|
|
||||||
public void partition()
|
public void partition()
|
||||||
{
|
{
|
||||||
|
|
||||||
final IItemHandler inv = this.getUpgradeable().getInventoryByName( "config" );
|
final IItemHandler inv = this.getUpgradeable().getInventoryByName( "config" );
|
||||||
|
|
||||||
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory(
|
final ItemStack is = this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||||
this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null,
|
final IStorageChannel channel = is.getItem() instanceof IStorageCell ? ( (IStorageCell) is.getItem() ).getChannel() : AEApi.instance()
|
||||||
AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) );
|
.storage()
|
||||||
|
.getStorageChannel( IItemStorageChannel.class );
|
||||||
|
|
||||||
Iterator<IAEItemStack> i = new NullIterator<>();
|
final IMEInventory cellInv = AEApi.instance().registries().cell().getCellInventory( is, null, channel );
|
||||||
|
|
||||||
|
Iterator<IAEStack> i = new NullIterator<>();
|
||||||
if( cellInv != null )
|
if( cellInv != null )
|
||||||
{
|
{
|
||||||
final IItemList<IAEItemStack> list = cellInv
|
final IItemList list = cellInv.getAvailableItems( channel.createList() );
|
||||||
.getAvailableItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createList() );
|
|
||||||
i = list.iterator();
|
i = list.iterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,28 +120,23 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
|||||||
|
|
||||||
if( s == this.middle )
|
if( s == this.middle )
|
||||||
{
|
{
|
||||||
for( final ItemStack optional : AEApi.instance().registries().inscriber().getOptionals() )
|
IItemDefinition press = AEApi.instance().definitions().materials().namePress();
|
||||||
|
if( press.isSameAs( top ) || press.isSameAs( bot ) )
|
||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isSameItem( optional, is ) )
|
return !press.isSameAs( is );
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean matches = false;
|
boolean matches = false;
|
||||||
boolean found = false;
|
|
||||||
|
|
||||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||||
{
|
{
|
||||||
final boolean matchA = ( top.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
final boolean matchA = !top
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
.isEmpty() && ( Platform.itemComparisons().isSameItem( top, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) || Platform
|
||||||
( ( bot.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
.itemComparisons()
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
.isSameItem( top, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||||
|
final boolean matchB = !bot
|
||||||
final boolean matchB = ( bot.isEmpty() && !recipe.getTopOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( bot,
|
.isEmpty() && ( Platform.itemComparisons().isSameItem( bot, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) || Platform
|
||||||
recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) ) && // and...
|
.itemComparisons()
|
||||||
( ( top.isEmpty() && !recipe.getBottomOptional().isPresent() ) || ( Platform.itemComparisons().isSameItem( top,
|
.isSameItem( bot, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) );
|
||||||
recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) ) );
|
|
||||||
|
|
||||||
if( matchA || matchB )
|
if( matchA || matchB )
|
||||||
{
|
{
|
||||||
@@ -150,21 +145,19 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
|||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isSameItem( is, option ) )
|
if( Platform.itemComparisons().isSameItem( is, option ) )
|
||||||
{
|
{
|
||||||
found = true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( matches )
|
||||||
if( matches && !found )
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if( ( s == this.top && !bot.isEmpty() ) || ( s == this.bottom && !top.isEmpty() ) )
|
||||||
if( ( s == this.top && !bot.isEmpty() ) || ( s == this.bottom && !top.isEmpty() ) )
|
|
||||||
{
|
{
|
||||||
ItemStack otherSlot = ItemStack.EMPTY;
|
ItemStack otherSlot;
|
||||||
if( s == this.top )
|
if( s == this.top )
|
||||||
{
|
{
|
||||||
otherSlot = this.bottom.getStack();
|
otherSlot = this.bottom.getStack();
|
||||||
@@ -182,28 +175,24 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
|||||||
}
|
}
|
||||||
|
|
||||||
// everything else
|
// everything else
|
||||||
boolean isValid = false;
|
|
||||||
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
for( final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes() )
|
||||||
{
|
{
|
||||||
if( Platform.itemComparisons().isSameItem( recipe.getTopOptional().orElse( ItemStack.EMPTY ), otherSlot ) )
|
boolean isValid = false;
|
||||||
|
if( Platform.itemComparisons().isSameItem( otherSlot, recipe.getTopOptional().orElse( ItemStack.EMPTY ) ) )
|
||||||
{
|
{
|
||||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) );
|
isValid = Platform.itemComparisons().isSameItem( is, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) );
|
||||||
}
|
}
|
||||||
else if( Platform.itemComparisons().isSameItem( recipe.getBottomOptional().orElse( ItemStack.EMPTY ), otherSlot ) )
|
else if( Platform.itemComparisons().isSameItem( otherSlot, recipe.getBottomOptional().orElse( ItemStack.EMPTY ) ) )
|
||||||
{
|
{
|
||||||
isValid = Platform.itemComparisons().isSameItem( is, recipe.getTopOptional().orElse( ItemStack.EMPTY ) );
|
isValid = Platform.itemComparisons().isSameItem( is, recipe.getTopOptional().orElse( ItemStack.EMPTY ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isValid )
|
if( isValid )
|
||||||
{
|
{
|
||||||
break;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
if( !isValid )
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user