Compare commits

...

44 Commits

Author SHA1 Message Date
serenibyss 2054c2afe3 fix 2024-01-03 23:48:58 -06:00
serenibyss 69650e2bef power cost improvements from eff + unbreaking 2024-01-03 23:46:41 -06:00
serenibyss 1a576705fe annihilation plane performance improvement 2024-01-03 23:26:50 -06:00
serenibyss 27a3f70f0b fortune enchantable 2024-01-03 23:21:32 -06:00
tier940 b252d1c891 Update ja_jp.lang (#351) 2024-01-02 09:35:24 -06:00
Stone a31de25257 Fix 2 cable rendering bugs (#350) 2024-01-02 09:35:00 -06:00
Serenibyss 01f56ae633 Fix Wireless Access Point displaying energy incorrectly (#346) 2023-12-30 14:41:16 +11:00
Serenibyss 669aa3188e Fix P2P Tunnels dropping ME Tunnels regardless of type (#347) 2023-12-30 14:39:21 +11:00
Neeve 219de337be Update mod metadata (#344) 2023-12-27 23:46:53 -06:00
Stone 7747899e90 Fix ME Level Emitter buttons config and ME IO Port not respecting its redstone mode (#345) 2023-12-28 14:53:46 +11:00
Neeve 82751e761e Add crafting job toasts (#342) 2023-12-25 20:53:51 -06:00
Neeve c4c0585fd3 Allow shift-clicking Patterns into Interface Terminals (#343) 2023-12-25 20:39:35 -06:00
Serenibyss 496e159010 Fix missed ME Interface retextures (#341) 2023-12-25 14:35:02 +11:00
Serenibyss 754ee1ba83 Retexture AE2 machines (#338) 2023-12-25 14:08:19 +11:00
Serenibyss ffe1a52456 Retexture AE2 multiparts (#336) 2023-12-25 13:49:01 +11:00
Serenibyss 28696bd531 Fix and improve cable models (#335) 2023-12-25 13:23:01 +11:00
Serenibyss 29098372af Add blue light for fully empty Cells (#334) 2023-12-25 12:46:13 +11:00
mczph 9dbcf21fa9 Add missing entries and color codes for zh_cn.lang (#339) 2023-12-25 12:36:32 +11:00
Serenibyss a5a1f79102 Change meteor compass to target chest (#332) 2023-12-20 20:01:21 -06:00
Neeve 8fb12119ef Fix oversized slot weirdness (#331) 2023-12-20 13:52:07 +11:00
PrototypeTrousers 7f83c73a28 fix interface dropping stacks over the stack limit. fix potential dupes
fixes #328
2023-12-16 16:30:17 -03:00
Neeve 80a473a93b Fix data loss in BasicCellInventory (#327) 2023-12-15 13:26:43 -03:00
Li adac94555b Remove redundant (#324)
https://github.com/PrototypeTrousers/Applied-Energistics-2/issues/323
2023-11-08 10:37:11 -03:00
PrototypeTrousers 2f11054132 bump version 2023-11-07 18:26:13 -03:00
PrototypeTrousers 1314ee4588 fix wireless pattern terminal not toggling substitution 2023-11-07 18:25:52 -03:00
zeng-git 4484863452 Update mappings to stable_39-1.12 (#322) 2023-11-07 18:21:59 -03:00
PrototypeTrousers ba9b790a02 attempt fix FE p2p when 2023-10-22 23:34:54 -03:00
PrototypeTrousers e4d862dbfd bump version 2023-10-13 03:53:29 -03:00
PrototypeTrousers 812e8c5990 fix #315 2023-10-13 03:50:47 -03:00
PrototypeTrousers e3eeee7784 forgot about fluid configuring terminal 2023-10-13 02:35:14 -03:00
PrototypeTrousers 467bb91628 switch MouseTweaks disabling method 2023-10-12 17:40:56 -03:00
PrototypeTrousers 10a12a9b97 small tweak to pattern terminal search 2023-10-12 16:59:57 -03:00
PrototypeTrousers e5f345d49c remove player inventory from oredict storage bus container 2023-10-12 16:49:59 -03:00
PrototypeTrousers 95ce9694aa slabs -> slab 2023-10-12 02:51:44 -03:00
PrototypeTrousers d1ec1a88ee fix magnet not working before turning it off and on again 2023-10-11 17:20:53 -03:00
PrototypeTrousers bfe82cdc0a fix CT recipe actions not running on crafting terminal crafts 2023-10-11 17:08:23 -03:00
PrototypeTrousers 4fe0d5e767 remove itemstages blocking item crafting 2023-10-11 16:28:06 -03:00
PrototypeTrousers b38148e095 attempt to fix something with terminals again 2023-10-11 14:29:34 -03:00
Neeve d528d9f205 Fix Matter Condenser's math & remove Player's maven (#316)
* Remove Player's maven

* Fix Matter Condenser's math

Fixes outputs getting geometrically compounded
2023-10-11 14:27:35 -03:00
PrototypeTrousers 60211cccdd bump version 2023-09-28 16:44:11 -03:00
Pansmith c3a331c13f Texture Replacements (#312) 2023-09-27 20:46:16 -03:00
tier940 add866443d Update ja_jp.lang (#309)
* Follow the latest

* fix
2023-09-27 20:46:07 -03:00
James Chung bf83de08b2 Add fix for leaking client TEs (#298)
* Add fix for leaking client TEs

* Remove client-side markDirty() call
2023-09-27 20:45:55 -03:00
PrototypeTrousers 6f822af262 bump version 2023-08-27 08:36:13 -03:00
360 changed files with 1780 additions and 1893 deletions
+15 -7
View File
@@ -1,19 +1,25 @@
This is a fork of AE2 i made for trying to solve issues for the [Omnifactory](https://www.curseforge.com/minecraft/modpacks/omnifactory) modpack. # Applied Energistics 2 Unofficial Extended Life
See [AE2-Omnifactory](https://github.com/PrototypeTrousers/Applied-Energistics-2/tree/AE2-Omnifactory) branch for commits and [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars. [![Downloads](http://cf.way2muchnoise.eu/570458.svg)](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [![MCVersion](http://cf.way2muchnoise.eu/versions/570458.svg)](https://www.curseforge.com/minecraft/mc-mods/ae2-extended-life) [![GitHub issues](https://img.shields.io/github/issues/AE2-UEL/Applied-Energistics-2.svg)](https://github.com/AE2-UEL/Applied-Energistics-2/issues) [![GitHub pull requests](https://img.shields.io/github/issues-pr/AE2-UEL/Applied-Energistics-2.svg)](https://github.com/AE2-UEL/Applied-Energistics-2/pulls)
# Applied Energistics 2 (PrototypeTrousers fork for Omnifactory) ---
## About ## About
A Mod about Matter, Energy and using them to conquer the world.
A maintained fork of a Mod about Matter, Energy and using them to conquer the world.
This project started as a fork of [Applied Energistics 2](https://github.com/AppliedEnergistics/Applied-Energistics-2) by [PrototypeTrousers](https://github.com/PrototypeTrousers), initially addressing issues related to the [Nomifactory](https://www.curseforge.com/minecraft/modpacks/nomifactory) modpack. It is now being maintained by the [AE2 Unofficial Extended Life Team](https://github.com/AE2-UEL).
See [Releases](https://github.com/PrototypeTrousers/Applied-Energistics-2/releases) for the compiled jars.
## RecipeStages ## RecipeStages
You need to add the following into a CraftTweaker script: You need to add the following into a CraftTweaker script:
``` ```
mods.recipestages.Recipes.setPackageStage("appeng", allStages); mods.recipestages.Recipes.setPackageStage("appeng", allStages);
``` ```
The second argument allows you to customize which stages exactly you want to be craftable with AE2. Idk why would you like to restrict any, but you can. The second argument allows you to customize which stages exactly you want to be craftable with AE2. Not sure why you would do that, but we support that nonetheless!
## License ## License
* Applied Energistics 2 API * Applied Energistics 2 API
@@ -29,8 +35,10 @@ The second argument allows you to customize which stages exactly you want to be
- [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/) - [![License](https://img.shields.io/badge/License-No%20Restriction-green.svg?style=flat-square)](https://creativecommons.org/publicdomain/zero/1.0/)
## Credits ## Credits
Thanks to
Special thanks to:
* PrototypeTrousers for the initial fork
* Notch et al for Minecraft * Notch et al for Minecraft
* Lex et al for MinecraftForge * Lex et al for MinecraftForge
* AlgorithmX2 for AppliedEnergistics2 * AlgorithmX2 for AppliedEnergistics2
+2 -2
View File
@@ -195,8 +195,8 @@ minecraft {
username = developmentEnvironmentUserName.toString() username = developmentEnvironmentUserName.toString()
useDependencyAccessTransformers = true useDependencyAccessTransformers = true
setMcpMappingChannel("snapshot") setMcpMappingChannel("stable")
setMcpMappingVersion("20171003") setMcpMappingVersion("39")
// Automatic token injection with RetroFuturaGradle // Automatic token injection with RetroFuturaGradle
if (gradleTokenModId) { if (gradleTokenModId) {
+2 -2
View File
@@ -33,13 +33,13 @@ mapping_version=20171003
# Run Configurations # Run Configurations
minecraft_username=Developer minecraft_username=Developer
extra_jvm_args= extra_jvm_args=
modName=Applied Energistics 2 modName=AE2 Unofficial Extended Life
# This is a case-sensitive string to identify your mod. Convention is to use lower case. # This is a case-sensitive string to identify your mod. Convention is to use lower case.
modId=appliedenergistics2 modId=appliedenergistics2
modGroup=appeng modGroup=appeng
# Version of your mod. # Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead. # This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion=rv6-stable-7-extended_life-v0.55.21 modVersion=rv6-stable-7-extended_life-v0.55.29
# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version) # Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar=false includeMCVersionJar=false
# The name of your jar when you produce builds, not including any versioning info # The name of your jar when you produce builds, not including any versioning info
+3 -7
View File
@@ -43,11 +43,6 @@ repositories {
url "https://maven.ellpeck.de" url "https://maven.ellpeck.de"
} }
maven {
name = "IC2 repo"
url = "http://maven.ic2.player.to"
}
maven { maven {
name = "CoFH Maven" name = "CoFH Maven"
url = "http://maven.covers1624.net" url = "http://maven.covers1624.net"
@@ -102,7 +97,8 @@ dependencies {
compileOnly "curse.maven:item-stages-280316:2696769" compileOnly "curse.maven:item-stages-280316:2696769"
compileOnly "curse.maven:game-stages-268655:2951844" compileOnly "curse.maven:game-stages-268655:2951844"
compileOnly "net.darkhax.tesla:Tesla-1.12.2:${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"
implementation rfg.deobf("curse.maven:industrial-craft-242638:2547175")
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api" compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "curse.maven:CoFHCore-69162:2920433" compileOnly "curse.maven:CoFHCore-69162:2920433"
compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}" compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}"
@@ -110,7 +106,7 @@ dependencies {
compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738" compileOnly "curse.maven:inventory-bogo-sorter-632327:4399738"
compileOnly "team.chisel.ctm:CTM:${ctm_version}" compileOnly "team.chisel.ctm:CTM:${ctm_version}"
compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api" compileOnly "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12.2-r152.16:api"
implementation rfg.deobf("net.sengir.forestry:forestry_${minecraft_version}:$forestry_version") implementation rfg.deobf("curse.maven:forestry-59751:2684780")
// at runtime, use the full JEI jar // at runtime, use the full JEI jar
runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}" runtimeOnly "mezz.jei:jei_${minecraft_version}:${jei_version}"
@@ -40,11 +40,13 @@ public interface IChestOrDrive extends ICellContainer, IGridHost, IOrientable
/** /**
* 0 - cell is missing. * 0 - cell is missing.
* *
* 1 - green, * 1 - green, the cell is present and partially empty
* *
* 2 - orange, * 2 - orange, the cell is present and full on types
* *
* 3 - red * 3 - red, the cell is present and full on bytes
*
* 4 - blue, the cell is present but totally empty
* *
* @param slot slot index * @param slot slot index
* *
@@ -123,6 +123,8 @@ public interface ICellInventory<T extends IAEStack<T>> extends IMEInventory<T>
* *
* 3 - red, ( usually means the cell is 100% full ) * 3 - red, ( usually means the cell is 100% full )
* *
* 4 - blue, ( usually means the cell is available and completely empty. )
*
* @return get the status of the cell based on its contents. * @return get the status of the cell based on its contents.
*/ */
int getStatusForCell(); int getStatusForCell();
@@ -1,87 +0,0 @@
package yalter.mousetweaks.api;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
/**
* This is the interface you want to implement in your GuiScreen to make it compatible with Mouse Tweaks.
* If this interface is not enough (for example, you need a custom slot click function, or if you use a custom Container
* which happens to be incompatible), check IMTModGuiContainer2Ex instead.
* If you just need to disable Mouse Tweaks or the wheel tweak, see the MouseTweaksIgnore
* or the MouseTweaksDisableWheelTweak annotations.
*/
public interface IMTModGuiContainer2 {
/**
* If you want to disable Mouse Tweaks in your GuiScreen, return true from this method.
*
* @return True if Mouse Tweaks should be disabled, false otherwise.
*/
boolean MT_isMouseTweaksDisabled();
/**
* If you want to disable the Wheel Tweak in your GuiScreen, return true from this method.
*
* @return True if the Wheel Tweak should be disabled, false otherwise.
*/
boolean MT_isWheelTweakDisabled();
/**
* Returns the Container.
*
* @return Container that is currently in use.
*/
Container MT_getContainer();
/**
* Returns the Slot that is currently selected by the player, or null if no Slot is selected.
*
* @return Slot that is located under the mouse, or null if no Slot it currently under the mouse.
*/
Slot MT_getSlotUnderMouse();
/**
* Return true if the given Slot behaves like the vanilla crafting output slots (inside the crafting table,
* or the furnace output slot, or the anvil output slot, etc.). These slots are handled differently by Mouse Tweaks.
*
* @param slot the slot to check
* @return True if slot is a crafting output slot.
*/
boolean MT_isCraftingOutput(Slot slot);
/**
* Return true if the given Slot should be ignored by Mouse Tweaks. Examples of ignored slots are the item select
* slots and the Destroy Item slot in the vanilla creative inventory.
*
* @param slot the slot to check
* @return Tru if slot should be ignored by Mouse Tweaks.
*/
boolean MT_isIgnored(Slot slot);
/**
* If your container has an RMB dragging functionality (like vanilla containers), disable it inside this method.
* This method is called every frame (render tick), which is after all mouseClicked / mouseClickMove / mouseReleased
* events are handled (although note these events are handled every game tick, which is far less frequent than every
* render tick).<br><br>
*
* If true is returned from this method, Mouse Tweaks (after checking other conditions like isIgnored) will click
* the slot on which the right mouse button was initially pressed (in most cases this is the slot currently under
* mouse). This is needed because the vanilla RMB dragging functionality prevents the initial slot click.<br><br>
*
* For vanilla containers this method looks like this:
* <pre>
* this.ignoreMouseUp = true;
*
* if (this.dragSplitting) {
* if (this.dragSplittingButton == 1) {
* this.dragSplitting = false;
* return true;
* }
* }
*
* return false;
* </pre>
*
* @return True if Mouse Tweaks should click the slot on which the RMB was pressed.
*/
boolean MT_disableRMBDraggingFunctionality();
}
@@ -0,0 +1,14 @@
package yalter.mousetweaks.api;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Put this on your GuiScreen to disable Mouse Tweaks.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface MouseTweaksIgnore {
}
+7 -7
View File
@@ -307,13 +307,13 @@ public abstract class AEBaseBlock extends Block {
return dir; return dir;
} }
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY(); final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ(); final int west_y = forward.getZOffset() * up.getYOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX(); final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
EnumFacing west = null; EnumFacing west = null;
for (final EnumFacing dx : EnumFacing.VALUES) { for (final EnumFacing dx : EnumFacing.VALUES) {
if (dx.getFrontOffsetX() == west_x && dx.getFrontOffsetY() == west_y && dx.getFrontOffsetZ() == west_z) { if (dx.getXOffset() == west_x && dx.getYOffset() == west_y && dx.getZOffset() == west_z) {
west = dx; west = dx;
} }
} }
@@ -348,12 +348,12 @@ public abstract class AEBaseBlock extends Block {
@Override @Override
public String toString() { public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered"; String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]"; return this.getClass().getSimpleName() + "[" + regName + "]";
} }
protected String getUnlocalizedName(final ItemStack is) { protected String getTranslationKey(final ItemStack is) {
return this.getUnlocalizedName(); return this.getTranslationKey();
} }
protected boolean hasCustomRotation() { protected boolean hasCustomRotation() {
@@ -38,6 +38,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
import java.util.List; import java.util.List;
@@ -77,8 +78,9 @@ public class AEBaseItemBlock extends ItemBlock {
} }
@Override @Override
public String getUnlocalizedName(final ItemStack is) { @NotNull
return this.blockType.getUnlocalizedName(is); public String getTranslationKey(final ItemStack is) {
return this.blockType.getTranslationKey(is);
} }
@Override @Override
@@ -137,7 +139,7 @@ public class AEBaseItemBlock extends ItemBlock {
ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos); ori = ((IOrientableBlock) this.blockType).getOrientable(w, pos);
up = side; up = side;
forward = EnumFacing.SOUTH; forward = EnumFacing.SOUTH;
if (up.getFrontOffsetY() == 0) { if (up.getYOffset() == 0) {
forward = EnumFacing.UP; forward = EnumFacing.UP;
} }
} }
@@ -36,16 +36,16 @@ public abstract class AEBaseStairBlock extends BlockStairs {
super(block.getDefaultState()); super(block.getDefaultState());
Preconditions.checkNotNull(block); Preconditions.checkNotNull(block);
Preconditions.checkNotNull(block.getUnlocalizedName()); Preconditions.checkNotNull(block.getTranslationKey());
Preconditions.checkArgument(block.getUnlocalizedName().length() > 0); Preconditions.checkArgument(block.getTranslationKey().length() > 0);
this.setUnlocalizedName("stair." + type); this.setTranslationKey("stair." + type);
this.setLightOpacity(0); this.setLightOpacity(0);
} }
@Override @Override
public String toString() { public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered"; String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]"; return this.getClass().getSimpleName() + "[" + regName + "]";
} }
@@ -288,7 +288,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
return false; return false;
} }
final String name = this.getUnlocalizedName(); final String name = this.getTranslationKey();
if (player.isSneaking()) { if (player.isSneaking()) {
final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD); final NBTTagCompound data = tileEntity.downloadSettings(SettingsFrom.MEMORY_CARD);
@@ -300,7 +300,7 @@ public abstract class AEBaseTileBlock extends AEBaseBlock implements ITileEntity
final String savedName = memoryCard.getSettingsName(heldItem); final String savedName = memoryCard.getSettingsName(heldItem);
final NBTTagCompound data = memoryCard.getData(heldItem); final NBTTagCompound data = memoryCard.getData(heldItem);
if (this.getUnlocalizedName().equals(savedName)) { if (this.getTranslationKey().equals(savedName)) {
tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player); tileEntity.uploadSettings(SettingsFrom.MEMORY_CARD, data, player);
memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED); memoryCard.notifyUser(player, MemoryCardMessages.SETTINGS_LOADED);
} else { } else {
@@ -43,6 +43,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import java.util.EnumSet; import java.util.EnumSet;
@@ -111,7 +112,7 @@ public class BlockCraftingUnit extends AEBaseTileBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -38,6 +38,8 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
public class BlockMolecularAssembler extends AEBaseTileBlock { public class BlockMolecularAssembler extends AEBaseTileBlock {
@@ -72,7 +74,7 @@ public class BlockMolecularAssembler extends AEBaseTileBlock {
*/ */
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -121,15 +121,15 @@ public class BlockCharger extends AEBaseTileBlock implements ICustomCollision {
final EnumFacing forward = tile.getForward(); final EnumFacing forward = tile.getForward();
final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels); final AEAxisAlignedBB bb = new AEAxisAlignedBB(twoPixels, twoPixels, twoPixels, 1.0 - twoPixels, 1.0 - twoPixels, 1.0 - twoPixels);
if (up.getFrontOffsetX() != 0) { if (up.getXOffset() != 0) {
bb.minX = 0; bb.minX = 0;
bb.maxX = 1; bb.maxX = 1;
} }
if (up.getFrontOffsetY() != 0) { if (up.getYOffset() != 0) {
bb.minY = 0; bb.minY = 0;
bb.maxY = 1; bb.maxY = 1;
} }
if (up.getFrontOffsetZ() != 0) { if (up.getZOffset() != 0) {
bb.minZ = 0; bb.minZ = 0;
bb.maxZ = 1; bb.maxZ = 1;
} }
@@ -68,7 +68,7 @@ public class BlockInscriber extends AEBaseTileBlock {
} }
@Override @Override
public String getUnlocalizedName(final ItemStack is) { public String getTranslationKey(final ItemStack is) {
return super.getUnlocalizedName(is); return super.getTranslationKey(is);
} }
} }
@@ -41,6 +41,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -115,9 +116,9 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override @Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) { public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity thePlayer, final boolean b) {
final EnumFacing up = this.getOrientable(w, pos).getUp(); final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getFrontOffsetX(); final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getFrontOffsetY(); final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getFrontOffsetZ(); final double zOff = -0.3 * up.getZOffset();
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7)); return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
} }
@@ -167,7 +168,7 @@ public class BlockLightDetector extends AEBaseTileBlock implements IOrientableBl
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -44,6 +44,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
@@ -107,9 +108,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
@Override @Override
public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity e, final boolean isVisual) { public Iterable<AxisAlignedBB> getSelectedBoundingBoxesFromPool(final World w, final BlockPos pos, final Entity e, final boolean isVisual) {
final EnumFacing up = this.getOrientable(w, pos).getUp(); final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getFrontOffsetX(); final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getFrontOffsetY(); final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getFrontOffsetZ(); final double zOff = -0.3 * up.getZOffset();
return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7)); return Collections.singletonList(new AxisAlignedBB(xOff + 0.3, yOff + 0.3, zOff + 0.3, xOff + 0.7, yOff + 0.7, zOff + 0.7));
} }
@@ -134,9 +135,9 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
} }
final EnumFacing up = this.getOrientable(w, pos).getUp(); final EnumFacing up = this.getOrientable(w, pos).getUp();
final double xOff = -0.3 * up.getFrontOffsetX(); final double xOff = -0.3 * up.getXOffset();
final double yOff = -0.3 * up.getFrontOffsetY(); final double yOff = -0.3 * up.getYOffset();
final double zOff = -0.3 * up.getFrontOffsetZ(); final double zOff = -0.3 * up.getZOffset();
for (int bolts = 0; bolts < 3; bolts++) { for (int bolts = 0; bolts < 3; bolts++) {
if (AppEng.proxy.shouldAddParticles(r)) { if (AppEng.proxy.shouldAddParticles(r)) {
final LightningFX fx = new LightningFX(w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D); final LightningFX fx = new LightningFX(w, xOff + 0.5 + pos.getX(), yOff + 0.5 + pos.getY(), zOff + 0.5 + pos.getZ(), 0.0D, 0.0D, 0.0D);
@@ -192,7 +193,7 @@ public class BlockQuartzFixture extends AEBaseBlock implements IOrientableBlock,
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -87,9 +87,9 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
double ry = 0.5 + pos.getY(); double ry = 0.5 + pos.getY();
double rz = 0.5 + pos.getZ(); double rz = 0.5 + pos.getZ();
rx += up.getFrontOffsetX() * d0; rx += up.getXOffset() * d0;
ry += up.getFrontOffsetY() * d0; ry += up.getYOffset() * d0;
rz += up.getFrontOffsetZ() * d0; rz += up.getZOffset() * d0;
final int x = pos.getX(); final int x = pos.getX();
final int y = pos.getY(); final int y = pos.getY();
@@ -103,25 +103,25 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
case 0: case 0:
dx = 0.6; dx = 0.6;
dz = d1; dz = d1;
pt = new BlockPos(x + west.getFrontOffsetX(), y + west.getFrontOffsetY(), z + west.getFrontOffsetZ()); pt = new BlockPos(x + west.getXOffset(), y + west.getYOffset(), z + west.getZOffset());
break; break;
case 1: case 1:
dx = d1; dx = d1;
dz += 0.6; dz += 0.6;
pt = new BlockPos(x + forward.getFrontOffsetX(), y + forward.getFrontOffsetY(), z + forward.getFrontOffsetZ()); pt = new BlockPos(x + forward.getXOffset(), y + forward.getYOffset(), z + forward.getZOffset());
break; break;
case 2: case 2:
dx = d1; dx = d1;
dz = -0.6; dz = -0.6;
pt = new BlockPos(x - forward.getFrontOffsetX(), y - forward.getFrontOffsetY(), z - forward.getFrontOffsetZ()); pt = new BlockPos(x - forward.getXOffset(), y - forward.getYOffset(), z - forward.getZOffset());
break; break;
case 3: case 3:
dx = -0.6; dx = -0.6;
dz = d1; dz = d1;
pt = new BlockPos(x - west.getFrontOffsetX(), y - west.getFrontOffsetY(), z - west.getFrontOffsetZ()); pt = new BlockPos(x - west.getXOffset(), y - west.getYOffset(), z - west.getZOffset());
break; break;
} }
@@ -130,13 +130,13 @@ public class BlockQuartzGrowthAccelerator extends AEBaseTileBlock implements IOr
return; return;
} }
rx += dx * west.getFrontOffsetX(); rx += dx * west.getXOffset();
ry += dx * west.getFrontOffsetY(); ry += dx * west.getYOffset();
rz += dx * west.getFrontOffsetZ(); rz += dx * west.getZOffset();
rx += dz * forward.getFrontOffsetX(); rx += dz * forward.getXOffset();
ry += dz * forward.getFrontOffsetY(); ry += dz * forward.getYOffset();
rz += dz * forward.getFrontOffsetZ(); rz += dz * forward.getZOffset();
final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D); final LightningFX fx = new LightningFX(w, rx, ry, rz, 0.0D, 0.0D, 0.0D);
Minecraft.getMinecraft().effectRenderer.addEffect(fx); Minecraft.getMinecraft().effectRenderer.addEffect(fx);
@@ -37,6 +37,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -56,7 +57,7 @@ public class BlockSecurityStation extends AEBaseTileBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -89,7 +89,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
@Override @Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) { public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
if (world.isBlockIndirectlyGettingPowered(pos) > 0) { if (world.getRedstonePowerFromNeighbors(pos) > 0) {
this.startFuse(world, pos, null); this.startFuse(world, pos, null);
world.setBlockToAir(pos); world.setBlockToAir(pos);
} }
@@ -99,7 +99,7 @@ public class BlockTinyTNT extends AEBaseBlock implements ICustomCollision {
public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) { public void onBlockAdded(final World w, final BlockPos pos, final IBlockState state) {
super.onBlockAdded(w, pos, state); super.onBlockAdded(w, pos, state);
if (w.isBlockIndirectlyGettingPowered(pos) > 0) { if (w.getRedstonePowerFromNeighbors(pos) > 0) {
this.startFuse(w, pos, null); this.startFuse(w, pos, null);
w.setBlockToAir(pos); w.setBlockToAir(pos);
} }
@@ -102,20 +102,20 @@ public final class BlockVibrationChamber extends AEBaseTileBlock {
final EnumFacing forward = tc.getForward(); final EnumFacing forward = tc.getForward();
final EnumFacing up = tc.getUp(); final EnumFacing up = tc.getUp();
final int west_x = forward.getFrontOffsetY() * up.getFrontOffsetZ() - forward.getFrontOffsetZ() * up.getFrontOffsetY(); final int west_x = forward.getYOffset() * up.getZOffset() - forward.getZOffset() * up.getYOffset();
final int west_y = forward.getFrontOffsetZ() * up.getFrontOffsetX() - forward.getFrontOffsetX() * up.getFrontOffsetZ(); final int west_y = forward.getZOffset() * up.getXOffset() - forward.getXOffset() * up.getZOffset();
final int west_z = forward.getFrontOffsetX() * up.getFrontOffsetY() - forward.getFrontOffsetY() * up.getFrontOffsetX(); final int west_z = forward.getXOffset() * up.getYOffset() - forward.getYOffset() * up.getXOffset();
f1 += forward.getFrontOffsetX() * 0.6; f1 += forward.getXOffset() * 0.6;
f2 += forward.getFrontOffsetY() * 0.6; f2 += forward.getYOffset() * 0.6;
f3 += forward.getFrontOffsetZ() * 0.6; f3 += forward.getZOffset() * 0.6;
final float ox = r.nextFloat(); final float ox = r.nextFloat();
final float oy = r.nextFloat() * 0.2f; final float oy = r.nextFloat() * 0.2f;
f1 += up.getFrontOffsetX() * (-0.3 + oy); f1 += up.getXOffset() * (-0.3 + oy);
f2 += up.getFrontOffsetY() * (-0.3 + oy); f2 += up.getYOffset() * (-0.3 + oy);
f3 += up.getFrontOffsetZ() * (-0.3 + oy); f3 += up.getZOffset() * (-0.3 + oy);
f1 += west_x * (0.3 * ox - 0.15); f1 += west_x * (0.3 * ox - 0.15);
f2 += west_y * (0.3 * ox - 0.15); f2 += west_y * (0.3 * ox - 0.15);
@@ -152,7 +152,7 @@ public class BlockCableBus extends AEBaseTileBlock implements IAEFacade {
} }
@Override @Override
public void onEntityCollidedWithBlock(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) { public void onEntityCollision(final World w, final BlockPos pos, final IBlockState state, final Entity entityIn) {
this.cb(w, pos).onEntityCollision(entityIn); this.cb(w, pos).onEntityCollision(entityIn);
} }
@@ -33,6 +33,8 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
public class BlockController extends AEBaseTileBlock { public class BlockController extends AEBaseTileBlock {
@@ -144,7 +146,7 @@ public class BlockController extends AEBaseTileBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -40,6 +40,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
@@ -68,7 +69,7 @@ public class BlockWireless extends AEBaseTileBlock implements ICustomCollision {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -44,6 +44,7 @@ import net.minecraftforge.common.property.IUnlistedProperty;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import java.util.Collection; import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Random; import java.util.Random;
@@ -81,7 +82,7 @@ public class BlockPaint extends AEBaseTileBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -37,6 +37,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision { public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICustomCollision {
@@ -86,7 +88,7 @@ public abstract class BlockQuantumBase extends AEBaseTileBlock implements ICusto
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -105,9 +105,9 @@ class QnbFormedBakedModel implements IBakedModel {
for (EnumFacing facing : EnumFacing.values()) { for (EnumFacing facing : EnumFacing.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture // Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting) // (avoids z-fighting)
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f); float xOffset = Math.abs(facing.getXOffset() * 0.01f);
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f); float yOffset = Math.abs(facing.getYOffset() * 0.01f);
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f); float zOffset = Math.abs(facing.getZOffset() * 0.01f);
builder.setDrawFaces(EnumSet.of(facing)); builder.setDrawFaces(EnumSet.of(facing));
builder.addCube( builder.addCube(
@@ -130,9 +130,9 @@ class QnbFormedBakedModel implements IBakedModel {
for (EnumFacing facing : EnumFacing.values()) { for (EnumFacing facing : EnumFacing.values()) {
// Offset the face by a slight amount so that it is drawn over the already drawn ring texture // Offset the face by a slight amount so that it is drawn over the already drawn ring texture
// (avoids z-fighting) // (avoids z-fighting)
float xOffset = Math.abs(facing.getFrontOffsetX() * 0.01f); float xOffset = Math.abs(facing.getXOffset() * 0.01f);
float yOffset = Math.abs(facing.getFrontOffsetY() * 0.01f); float yOffset = Math.abs(facing.getYOffset() * 0.01f);
float zOffset = Math.abs(facing.getFrontOffsetZ() * 0.01f); float zOffset = Math.abs(facing.getZOffset() * 0.01f);
builder.setDrawFaces(EnumSet.of(facing)); builder.setDrawFaces(EnumSet.of(facing));
builder.addCube( builder.addCube(
@@ -26,12 +26,15 @@ import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform; import appeng.util.Platform;
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.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
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.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -39,8 +42,11 @@ import javax.annotation.Nullable;
public class BlockSpatialIOPort extends AEBaseTileBlock { public class BlockSpatialIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockSpatialIOPort() { public BlockSpatialIOPort() {
super(Material.IRON); super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
} }
@Override @Override
@@ -51,6 +57,19 @@ public class BlockSpatialIOPort extends AEBaseTileBlock {
} }
} }
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileSpatialIOPort te = this.getTileEntity(worldIn, pos);
boolean powered = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powered);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
}
@Override @Override
public boolean onActivated(final World w, final BlockPos pos, final EntityPlayer p, 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 p, final EnumHand hand, final @Nullable ItemStack heldItem, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
if (p.isSneaking()) { if (p.isSneaking()) {
@@ -34,6 +34,8 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
public class BlockSpatialPylon extends AEBaseTileBlock { public class BlockSpatialPylon extends AEBaseTileBlock {
@@ -83,7 +85,7 @@ public class BlockSpatialPylon extends AEBaseTileBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -38,6 +38,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -56,7 +57,7 @@ public class BlockChest extends AEBaseTileBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -40,6 +40,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -52,7 +53,7 @@ public class BlockDrive extends AEBaseTileBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -19,6 +19,7 @@
package appeng.block.storage; package appeng.block.storage;
import appeng.api.config.Upgrades;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;
import appeng.block.AEBaseTileBlock; import appeng.block.AEBaseTileBlock;
import appeng.core.sync.GuiBridge; import appeng.core.sync.GuiBridge;
@@ -26,12 +27,15 @@ import appeng.tile.storage.TileIOPort;
import appeng.util.Platform; import appeng.util.Platform;
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.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
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.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nullable; import javax.annotation.Nullable;
@@ -39,15 +43,34 @@ import javax.annotation.Nullable;
public class BlockIOPort extends AEBaseTileBlock { public class BlockIOPort extends AEBaseTileBlock {
public static final PropertyBool POWERED = PropertyBool.create("powered");
public BlockIOPort() { public BlockIOPort() {
super(Material.IRON); super(Material.IRON);
setDefaultState(getDefaultState().withProperty(POWERED, false));
}
@Override
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) {
TileIOPort te = this.getTileEntity(worldIn, pos);
boolean powred = te != null && te.isActive();
return super.getActualState(state, worldIn, pos)
.withProperty(POWERED, powred);
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{POWERED};
} }
@Override @Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) { public void neighborChanged(IBlockState state, World world, BlockPos pos, Block blockIn, BlockPos fromPos) {
final TileIOPort te = this.getTileEntity(world, pos); final TileIOPort te = this.getTileEntity(world, pos);
if (te != null) { if (te != null) {
te.updateRedstoneState(); if (te.getInstalledUpgrades(Upgrades.REDSTONE) != 0) {
te.updateRedstoneState();
}
} }
} }
@@ -26,6 +26,8 @@ import appeng.helpers.ICustomCollision;
import appeng.tile.storage.TileSkyChest; import appeng.tile.storage.TileSkyChest;
import appeng.util.Platform; import appeng.util.Platform;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@@ -48,6 +50,8 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
private static final double AABB_OFFSET_SIDES = 0.06; private static final double AABB_OFFSET_SIDES = 0.06;
private static final double AABB_OFFSET_TOP = 0.125; private static final double AABB_OFFSET_TOP = 0.125;
public static final PropertyBool NATURAL = PropertyBool.create("natural");
public enum SkyChestType { public enum SkyChestType {
STONE, BLOCK STONE, BLOCK
} }
@@ -61,6 +65,22 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
this.setHardness(50); this.setHardness(50);
this.blockResistance = 150.0f; this.blockResistance = 150.0f;
this.type = type; this.type = type;
setDefaultState(getDefaultState().withProperty(NATURAL, true));
}
@Override
protected IProperty[] getAEStates() {
return new IProperty[]{NATURAL};
}
@Override
public int getMetaFromState(IBlockState state) {
return state.getValue(NATURAL) ? 1 : 0;
}
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(NATURAL, meta == 1);
} }
@Override @Override
@@ -99,18 +119,18 @@ public class BlockSkyChest extends AEBaseTileBlock implements ICustomCollision {
o = sk.getUp(); o = sk.getUp();
} }
final double offsetX = o.getFrontOffsetX() == 0 ? AABB_OFFSET_SIDES : 0.0; final double offsetX = o.getXOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetY = o.getFrontOffsetY() == 0 ? AABB_OFFSET_SIDES : 0.0; final double offsetY = o.getYOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
final double offsetZ = o.getFrontOffsetZ() == 0 ? AABB_OFFSET_SIDES : 0.0; final double offsetZ = o.getZOffset() == 0 ? AABB_OFFSET_SIDES : 0.0;
// for x/z top and bottom is swapped // for x/z top and bottom is swapped
final double minX = Math.max(0.0, offsetX + (o.getFrontOffsetX() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetX() * AABB_OFFSET_TOP))); final double minX = Math.max(0.0, offsetX + (o.getXOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getXOffset() * AABB_OFFSET_TOP)));
final double minY = Math.max(0.0, offsetY + (o.getFrontOffsetY() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetY() * AABB_OFFSET_BOTTOM))); final double minY = Math.max(0.0, offsetY + (o.getYOffset() < 0 ? AABB_OFFSET_TOP : (o.getYOffset() * AABB_OFFSET_BOTTOM)));
final double minZ = Math.max(0.0, offsetZ + (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetZ() * AABB_OFFSET_TOP))); final double minZ = Math.max(0.0, offsetZ + (o.getZOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getZOffset() * 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 maxX = Math.min(1.0, 1.0 - offsetX - (o.getXOffset() < 0 ? AABB_OFFSET_TOP : (o.getXOffset() * AABB_OFFSET_BOTTOM)));
final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getFrontOffsetY() < 0 ? AABB_OFFSET_BOTTOM : (o.getFrontOffsetY() * AABB_OFFSET_TOP))); final double maxY = Math.min(1.0, 1.0 - offsetY - (o.getYOffset() < 0 ? AABB_OFFSET_BOTTOM : (o.getYOffset() * AABB_OFFSET_TOP)));
final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getFrontOffsetZ() < 0 ? AABB_OFFSET_TOP : (o.getFrontOffsetZ() * AABB_OFFSET_BOTTOM))); final double maxZ = Math.min(1.0, 1.0 - offsetZ - (o.getZOffset() < 0 ? AABB_OFFSET_TOP : (o.getZOffset() * AABB_OFFSET_BOTTOM)));
return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ); return new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
} }
@@ -40,7 +40,10 @@ public enum DriveSlotState implements IStringSerializable {
TYPES_FULL("types_full"), TYPES_FULL("types_full"),
// Completely full // Completely full
FULL("full"); FULL("full"),
// Online and completely empty
NO_CONTENTS("no_contents");
private final String name; private final String name;
@@ -64,6 +67,8 @@ public enum DriveSlotState implements IStringSerializable {
return DriveSlotState.TYPES_FULL; return DriveSlotState.TYPES_FULL;
case 3: case 3:
return DriveSlotState.FULL; return DriveSlotState.FULL;
case 4:
return DriveSlotState.NO_CONTENTS;
} }
} }
@@ -164,7 +164,7 @@ class BlockDefinitionBuilder implements IBlockBuilder {
// Create block and matching item, and set factory name of both // Create block and matching item, and set factory name of both
Block block = this.blockSupplier.get(); Block block = this.blockSupplier.get();
block.setRegistryName(AppEng.MOD_ID, this.registryName); block.setRegistryName(AppEng.MOD_ID, this.registryName);
block.setUnlocalizedName("appliedenergistics2." + this.registryName); block.setTranslationKey("appliedenergistics2." + this.registryName);
ItemBlock item = this.constructItemFromBlock(block); ItemBlock item = this.constructItemFromBlock(block);
if (item != null) { if (item != null) {
@@ -116,11 +116,11 @@ class BlockRendering implements IBlockRendering, ISelectiveResourceReloadListene
} }
if (this.modelCustomizer != null) { if (this.modelCustomizer != null) {
factory.addModelOverride(block.getRegistryName().getResourcePath(), this.modelCustomizer); factory.addModelOverride(block.getRegistryName().getPath(), this.modelCustomizer);
} else if (block instanceof AEBaseTileBlock) { } else if (block instanceof AEBaseTileBlock) {
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as // This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
// extended props // extended props
factory.addModelOverride(block.getRegistryName().getResourcePath(), (l, m) -> { factory.addModelOverride(block.getRegistryName().getPath(), (l, m) -> {
AutoRotatingModel model = new AutoRotatingModel(m); AutoRotatingModel model = new AutoRotatingModel(m);
BlockRendering.this.reloads.add(model); BlockRendering.this.reloads.add(model);
return model; return model;
@@ -126,7 +126,7 @@ class ItemDefinitionBuilder implements IItemBuilder {
ItemDefinition definition = new ItemDefinition(this.registryName, item); ItemDefinition definition = new ItemDefinition(this.registryName, item);
item.setUnlocalizedName("appliedenergistics2." + this.registryName); item.setTranslationKey("appliedenergistics2." + this.registryName);
item.setCreativeTab(this.creativeTab); item.setCreativeTab(this.creativeTab);
// Register all extra handlers // Register all extra handlers
@@ -61,7 +61,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
IModel missingModel = ModelLoaderRegistry.getMissingModel(); IModel missingModel = ModelLoaderRegistry.getMissingModel();
for (ModelResourceLocation location : keys) { for (ModelResourceLocation location : keys) {
if (!location.getResourceDomain().equals(AppEng.MOD_ID)) { if (!location.getNamespace().equals(AppEng.MOD_ID)) {
continue; continue;
} }
@@ -72,7 +72,7 @@ public class ModelOverrideComponent implements IPreInitComponent {
continue; continue;
} }
BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getResourcePath()); BiFunction<ModelResourceLocation, IBakedModel, IBakedModel> customizer = this.customizer.get(location.getPath());
if (customizer != null) { if (customizer != null) {
IBakedModel newModel = customizer.apply(location, orgModel); IBakedModel newModel = customizer.apply(location, orgModel);
+10 -51
View File
@@ -69,13 +69,11 @@ import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidUtil; import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.items.SlotItemHandler;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import yalter.mousetweaks.api.IMTModGuiContainer2; import yalter.mousetweaks.api.MouseTweaksIgnore;
import javax.annotation.Nonnull;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.text.DecimalFormat; import java.text.DecimalFormat;
@@ -88,8 +86,8 @@ import static appeng.integration.modules.jei.JEIPlugin.aeGuiHandler;
import static appeng.integration.modules.jei.JEIPlugin.runtime; import static appeng.integration.modules.jei.JEIPlugin.runtime;
@Optional.Interface(iface = "yalter.mousetweaks.api.IMTModGuiContainer2", modid = "mousetweaks") @MouseTweaksIgnore
public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContainer2 { public abstract class AEBaseGui extends GuiContainer {
private final List<InternalSlotME> meSlots = new ArrayList<>(); 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<>();
@@ -570,9 +568,9 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
stack = ((SlotME) slot).getAEStack(); stack = ((SlotME) slot).getAEStack();
if (stack != null if (stack != null
&& action == InventoryAction.PICKUP_OR_SET_DOWN && action == InventoryAction.PICKUP_OR_SET_DOWN
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown()) && (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
&& player.inventory.getItemStack().isEmpty()) { && player.inventory.getItemStack().isEmpty()) {
action = InventoryAction.AUTO_CRAFT; action = InventoryAction.AUTO_CRAFT;
} }
@@ -935,6 +933,10 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
} }
} else if (s instanceof AppEngSlot) { } else if (s instanceof AppEngSlot) {
AppEngSlot appEngSlot = ((AppEngSlot) s); AppEngSlot appEngSlot = ((AppEngSlot) s);
if (s.getStack().isEmpty()) {
super.drawSlot(s);
return;
}
appEngSlot.setDisplay(true); appEngSlot.setDisplay(true);
appEngSlot.setReturnAsSingleStack(true); appEngSlot.setReturnAsSingleStack(true);
@@ -986,47 +988,4 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
protected List<InternalSlotME> getMeSlots() { protected List<InternalSlotME> getMeSlots() {
return this.meSlots; return this.meSlots;
} }
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isMouseTweaksDisabled() {
return false;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isWheelTweakDisabled() {
return true;
}
@Override
@Optional.Method(modid = "mousetweaks")
public Container MT_getContainer() {
return this.inventorySlots;
}
@Override
@Optional.Method(modid = "mousetweaks")
public Slot MT_getSlotUnderMouse() {
return getSlotUnderMouse();
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isCraftingOutput(Slot slot) {
return slot instanceof SlotOutput || slot instanceof AppEngCraftingSlot;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_isIgnored(Slot slot) {
return false;
}
@Override
@Optional.Method(modid = "mousetweaks")
public boolean MT_disableRMBDraggingFunctionality() {
return false;
}
} }
@@ -394,7 +394,7 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
return false; return false;
} }
boolean foundMatchingItemStack = false; boolean foundMatchingFluidStack = false;
final String displayName = Platform.getFluidDisplayName(iaeFluidStack).toLowerCase(); final String displayName = Platform.getFluidDisplayName(iaeFluidStack).toLowerCase();
@@ -405,10 +405,12 @@ public class GuiFluidInterfaceConfigurationTerminal extends AEBaseGui implements
return false; return false;
} }
} else if (displayName.contains(term)) { } else if (displayName.contains(term)) {
foundMatchingItemStack = true; foundMatchingFluidStack = true;
} else {
return false;
} }
} }
return foundMatchingItemStack; return foundMatchingFluidStack;
} }
/** /**
@@ -409,6 +409,8 @@ public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEI
} }
} else if (displayName.contains(term)) { } else if (displayName.contains(term)) {
foundMatchingItemStack = true; foundMatchingItemStack = true;
} else {
return false;
} }
} }
return foundMatchingItemStack; return foundMatchingItemStack;
@@ -592,6 +592,8 @@ public class GuiInterfaceTerminal extends AEBaseGui {
} }
} else if (displayName.contains(term)) { } else if (displayName.contains(term)) {
foundMatchingItemStack = true; foundMatchingItemStack = true;
} else {
return false;
} }
} }
} }
@@ -0,0 +1,52 @@
package appeng.client.gui.toasts;
import appeng.core.localization.GuiText;
import net.minecraft.client.gui.toasts.GuiToast;
import net.minecraft.client.gui.toasts.IToast;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.jetbrains.annotations.NotNull;
@SideOnly(Side.CLIENT)
public class CraftingStatusToast implements IToast {
private final ItemStack itemStack;
private final boolean cancelled;
private long firstDrawTime;
private boolean newDisplay;
public CraftingStatusToast(@NotNull ItemStack itemStack, boolean cancelled) {
this.itemStack = itemStack;
this.cancelled = cancelled;
}
@NotNull
public Visibility draw(@NotNull GuiToast toastGui, long delta)
{
if (this.newDisplay)
{
this.firstDrawTime = delta;
this.newDisplay = false;
}
var minecraft = toastGui.getMinecraft();
var fontRenderer = minecraft.fontRenderer;
// Texture
minecraft.getTextureManager().bindTexture(TEXTURE_TOASTS);
GlStateManager.color(1.0F, 1.0F, 1.0F);
toastGui.drawTexturedModalRect(0, 0, 0, 32, 160, 32);
// Text
var statusText = cancelled ? GuiText.CraftingToastCancelled : GuiText.CraftingToastDone;
fontRenderer.drawString(statusText.getLocal(), 30, 7, -11534256);
fontRenderer.drawString(itemStack.getDisplayName(), 30, 18, -16777216);
// Item
RenderHelper.enableGUIStandardItemLighting();
minecraft.getRenderItem().renderItemAndEffectIntoGUI(null, itemStack, 8, 8);
return delta - this.firstDrawTime < 5000L ? Visibility.SHOW : Visibility.HIDE;
}
}
@@ -47,7 +47,7 @@ public class TesrRenderHelper {
* at the center of a block. * at the center of a block.
*/ */
public static void moveToFace(EnumFacing face) { public static void moveToFace(EnumFacing face) {
GlStateManager.translate(face.getFrontOffsetX() * 0.50, face.getFrontOffsetY() * 0.50, face.getFrontOffsetZ() * 0.50); GlStateManager.translate(face.getXOffset() * 0.50, face.getYOffset() * 0.50, face.getZOffset() * 0.50);
} }
/** /**
@@ -331,6 +331,10 @@ class CableBuilder {
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8))); TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8))); TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels((int) (channels / (AEConfig.instance().getNormalChannelCapacity() / 8)));
// Thin part of connector, here to prevent the color of the channels
// from leaking into it
addCoveredCableSizedCube(facing, cubeBuilder);
// For to-machine connections, use a thicker end-cap for the connection // For to-machine connections, use a thicker end-cap for the connection
if (connectionType != AECableType.GLASS && !cableBusAdjacent) { if (connectionType != AECableType.GLASS && !cableBusAdjacent) {
this.addBigCoveredCableSizedCube(facing, cubeBuilder); this.addBigCoveredCableSizedCube(facing, cubeBuilder);
@@ -351,7 +355,6 @@ class CableBuilder {
cubeBuilder.setTexture(texture); cubeBuilder.setTexture(texture);
} }
addCoveredCableSizedCube(facing, cubeBuilder);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setRenderFullBright(true);
@@ -467,8 +470,8 @@ class CableBuilder {
// Dense cables show used channels in groups of 4, rounded up // Dense cables show used channels in groups of 4, rounded up
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32); channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels); TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels); TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setRenderFullBright(true);
@@ -493,7 +496,7 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_COVERED).get(cableColor); TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_COVERED).get(cableColor);
cubeBuilder.setTexture(texture); cubeBuilder.setTexture(texture);
setStraightCableUVs(cubeBuilder, facing, 5, 11); setStraightCableUVs(cubeBuilder, facing, 3, 13);
addStraightDenseCableSizedCube(facing, cubeBuilder); addStraightDenseCableSizedCube(facing, cubeBuilder);
} }
@@ -504,15 +507,15 @@ class CableBuilder {
TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor); TextureAtlasSprite texture = this.connectionTextures.get(AECableType.DENSE_SMART).get(cableColor);
cubeBuilder.setTexture(texture); cubeBuilder.setTexture(texture);
setStraightCableUVs(cubeBuilder, facing, 5, 11); setStraightCableUVs(cubeBuilder, facing, 3, 13);
addStraightDenseCableSizedCube(facing, cubeBuilder); addStraightDenseCableSizedCube(facing, cubeBuilder);
// Dense cables show used channels in groups of 4, rounded up // Dense cables show used channels in groups of 4, rounded up
channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32); channels = (int) ((channels + 3) / 4) / (AEConfig.instance().getDenseChannelCapacity() / 32);
TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForChannels(channels); TextureAtlasSprite oddChannel = this.smartCableTextures.getOddTextureForDenseChannels(channels);
TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForChannels(channels); TextureAtlasSprite evenChannel = this.smartCableTextures.getEvenTextureForDenseChannels(channels);
// Render the channel indicators brightly lit at night // Render the channel indicators brightly lit at night
cubeBuilder.setRenderFullBright(true); cubeBuilder.setRenderFullBright(true);
@@ -556,14 +559,14 @@ class CableBuilder {
case DOWN: case DOWN:
case UP: case UP:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3); cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.addCube(3, 0, 3, 13, 16, 13); cubeBuilder.addCube(3, -0.01f, 3, 13, 16.01f, 13);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0); cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
break; break;
case EAST: case EAST:
case WEST: case WEST:
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3); cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3); cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
cubeBuilder.addCube(0, 3, 3, 16, 13, 13); cubeBuilder.addCube(-0.01f, 3, 3, 16.01f, 13, 13);
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0); cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0); cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
break; break;
@@ -571,7 +574,7 @@ class CableBuilder {
case SOUTH: case SOUTH:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3); cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.setUvRotation(EnumFacing.WEST, 3); cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
cubeBuilder.addCube(3, 3, 0, 13, 13, 16); cubeBuilder.addCube(3, 3, -0.01f, 13, 13, 16.01f);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0); cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
cubeBuilder.setUvRotation(EnumFacing.WEST, 0); cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
break; break;
@@ -611,14 +614,14 @@ class CableBuilder {
case DOWN: case DOWN:
case UP: case UP:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3); cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.addCube(5, 0, 5, 11, 16, 11); cubeBuilder.addCube(5, -0.01f, 5, 11, 16.01f, 11);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0); cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
break; break;
case EAST: case EAST:
case WEST: case WEST:
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3); cubeBuilder.setUvRotation(EnumFacing.SOUTH, 3);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 3); cubeBuilder.setUvRotation(EnumFacing.NORTH, 3);
cubeBuilder.addCube(0, 5, 5, 16, 11, 11); cubeBuilder.addCube(-0.01f, 5, 5, 16.01f, 11, 11);
cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0); cubeBuilder.setUvRotation(EnumFacing.SOUTH, 0);
cubeBuilder.setUvRotation(EnumFacing.NORTH, 0); cubeBuilder.setUvRotation(EnumFacing.NORTH, 0);
break; break;
@@ -626,7 +629,7 @@ class CableBuilder {
case SOUTH: case SOUTH:
cubeBuilder.setUvRotation(EnumFacing.EAST, 3); cubeBuilder.setUvRotation(EnumFacing.EAST, 3);
cubeBuilder.setUvRotation(EnumFacing.WEST, 3); cubeBuilder.setUvRotation(EnumFacing.WEST, 3);
cubeBuilder.addCube(5, 5, 0, 11, 11, 16); cubeBuilder.addCube(5, 5, -0.01f, 11, 11, 16.01f);
cubeBuilder.setUvRotation(EnumFacing.EAST, 0); cubeBuilder.setUvRotation(EnumFacing.EAST, 0);
cubeBuilder.setUvRotation(EnumFacing.WEST, 0); cubeBuilder.setUvRotation(EnumFacing.WEST, 0);
break; break;
@@ -702,6 +705,7 @@ class CableBuilder {
} }
Collections.addAll(locations, SmartCableTextures.SMART_CHANNELS_TEXTURES); Collections.addAll(locations, SmartCableTextures.SMART_CHANNELS_TEXTURES);
Collections.addAll(locations, SmartCableTextures.DENSE_SMART_CHANNELS_TEXTURES);
return locations; return locations;
} }
@@ -398,7 +398,7 @@ public class CubeBuilder {
builder.put(i, x, y, z); builder.put(i, x, y, z);
break; break;
case NORMAL: case NORMAL:
builder.put(i, face.getFrontOffsetX(), face.getFrontOffsetY(), face.getFrontOffsetZ()); builder.put(i, face.getXOffset(), face.getYOffset(), face.getZOffset());
break; break;
case COLOR: case COLOR:
// Color format is RGBA // Color format is RGBA
@@ -72,7 +72,7 @@ public class QuadRotator {
// Figure out where the position is in the array // Figure out where the position is in the array
VertexFormat format = quad.getFormat(); VertexFormat format = quad.getFormat();
int posIdx = this.findPositionOffset(format) / 4; int posIdx = this.findPositionOffset(format) / 4;
int stride = format.getNextOffset() / 4; int stride = format.getSize() / 4;
int normalIdx = format.getNormalOffset(); int normalIdx = format.getNormalOffset();
VertexFormatElement.EnumType normalType = null; VertexFormatElement.EnumType normalType = null;
// Figure out the type of the normals // Figure out the type of the normals
@@ -32,20 +32,43 @@ import java.util.function.Function;
*/ */
public class SmartCableTextures { public class SmartCableTextures {
public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"), public static final ResourceLocation[] SMART_CHANNELS_TEXTURES = {
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_01"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"), new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_03"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14") new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_10"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_12"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/smart/channels_14"),
}; };
// Textures used to display channels on smart cables. There's two sets of 5 textures each, and // Textures used to display channels on smart cables. There's two sets of 5 textures each, and
// one of each set are composed together to get even/odd colored channels // one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] textures; private final TextureAtlasSprite[] textures;
public static final ResourceLocation[] DENSE_SMART_CHANNELS_TEXTURES = {
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_00"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_01"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_02"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_03"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_04"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_10"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_11"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_12"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_13"),
new ResourceLocation(AppEng.MOD_ID, "parts/cable/dense_smart/channels_14"),
};
// Textures used to display channels on dense smart cables. There's two sets of 5 textures each, and
// one of each set are composed together to get even/odd colored channels
private final TextureAtlasSprite[] denseTextures;
public SmartCableTextures(Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) { public SmartCableTextures(Function<ResourceLocation, TextureAtlasSprite> bakedTextureGetter) {
this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new); this.textures = Arrays.stream(SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
this.denseTextures = Arrays.stream(DENSE_SMART_CHANNELS_TEXTURES).map(bakedTextureGetter::apply).toArray(TextureAtlasSprite[]::new);
} }
/** /**
@@ -61,8 +84,18 @@ public class SmartCableTextures {
} }
} }
public TextureAtlasSprite getOddTextureForDenseChannels(int channels) {
if (channels < 0) {
return this.denseTextures[0];
} else if (channels <= 4) {
return this.denseTextures[channels];
} else {
return this.denseTextures[4];
}
}
/** /**
* The odd variant is used for displaying channels 5-8 as in use. * The even variant is used for displaying channels 5-8 as in use.
*/ */
public TextureAtlasSprite getEvenTextureForChannels(int channels) { public TextureAtlasSprite getEvenTextureForChannels(int channels) {
if (channels < 5) { if (channels < 5) {
@@ -73,4 +106,14 @@ public class SmartCableTextures {
return this.textures[9]; return this.textures[9];
} }
} }
public TextureAtlasSprite getEvenTextureForDenseChannels(int channels) {
if (channels < 5) {
return this.denseTextures[5];
} else if (channels <= 8) {
return this.denseTextures[1 + channels];
} else {
return this.denseTextures[9];
}
}
} }
@@ -43,16 +43,16 @@ public class BuiltInModelLoader implements ICustomModelLoader {
@Override @Override
public boolean accepts(ResourceLocation modelLocation) { public boolean accepts(ResourceLocation modelLocation) {
if (!modelLocation.getResourceDomain().equals(AppEng.MOD_ID)) { if (!modelLocation.getNamespace().equals(AppEng.MOD_ID)) {
return false; return false;
} }
return this.builtInModels.containsKey(modelLocation.getResourcePath()); return this.builtInModels.containsKey(modelLocation.getPath());
} }
@Override @Override
public IModel loadModel(ResourceLocation modelLocation) throws Exception { public IModel loadModel(ResourceLocation modelLocation) throws Exception {
return this.builtInModels.get(modelLocation.getResourcePath()); return this.builtInModels.get(modelLocation.getPath());
} }
@Override @Override
@@ -42,12 +42,14 @@ public class DriveModel implements IModel {
private static final ResourceLocation MODEL_BASE = new ResourceLocation("appliedenergistics2:block/drive_base"); private static final ResourceLocation MODEL_BASE = new ResourceLocation("appliedenergistics2:block/drive_base");
private static final Map<DriveSlotState, ResourceLocation> MODELS_CELLS = ImmutableMap.of( private static final Map<DriveSlotState, ResourceLocation> MODELS_CELLS = ImmutableMap.<DriveSlotState, ResourceLocation>builder()
DriveSlotState.EMPTY, new ResourceLocation("appliedenergistics2:block/drive_cell_empty"), .put(DriveSlotState.EMPTY, new ResourceLocation("appliedenergistics2:block/drive_cell_empty"))
DriveSlotState.OFFLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_off"), .put(DriveSlotState.OFFLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_off"))
DriveSlotState.ONLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_on"), .put(DriveSlotState.ONLINE, new ResourceLocation("appliedenergistics2:block/drive_cell_on"))
DriveSlotState.TYPES_FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_types_full"), .put(DriveSlotState.TYPES_FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_types_full"))
DriveSlotState.FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_full")); .put(DriveSlotState.FULL, new ResourceLocation("appliedenergistics2:block/drive_cell_full"))
.put(DriveSlotState.NO_CONTENTS, new ResourceLocation("appliedenergistics2:block/drive_cell_no_contents"))
.build();
@Override @Override
public Collection<ResourceLocation> getDependencies() { public Collection<ResourceLocation> getDependencies() {
@@ -137,14 +137,14 @@ public enum UVLModelLoader implements ICustomModelLoader {
@Override @Override
public boolean accepts(ResourceLocation modelLocation) { public boolean accepts(ResourceLocation modelLocation) {
String modelPath = modelLocation.getResourcePath(); String modelPath = modelLocation.getPath();
if (modelLocation.getResourcePath().startsWith("models/")) { if (modelLocation.getPath().startsWith("models/")) {
modelPath = modelPath.substring("models/".length()); modelPath = modelPath.substring("models/".length());
} }
try (InputStreamReader io = new InputStreamReader(Minecraft.getMinecraft() try (InputStreamReader io = new InputStreamReader(Minecraft.getMinecraft()
.getResourceManager() .getResourceManager()
.getResource(new ResourceLocation(modelLocation.getResourceDomain(), "models/" + modelPath + ".json")) .getResource(new ResourceLocation(modelLocation.getNamespace(), "models/" + modelPath + ".json"))
.getInputStream())) { .getInputStream())) {
return gson.fromJson(io, UVLMarker.class).ae2_uvl_marker; return gson.fromJson(io, UVLMarker.class).ae2_uvl_marker;
} catch (Exception e) { } catch (Exception e) {
@@ -174,11 +174,11 @@ public enum UVLModelLoader implements ICustomModelLoader {
private final IModel parent; private final IModel parent;
public UVLModelWrapper(ResourceLocation modelLocation) { public UVLModelWrapper(ResourceLocation modelLocation) {
String modelPath = modelLocation.getResourcePath(); String modelPath = modelLocation.getPath();
if (modelLocation.getResourcePath().startsWith("models/")) { if (modelLocation.getPath().startsWith("models/")) {
modelPath = modelPath.substring("models/".length()); modelPath = modelPath.substring("models/".length());
} }
ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getResourceDomain(), "armatures/" + modelPath + ".json"); ResourceLocation armatureLocation = new ResourceLocation(modelLocation.getNamespace(), "armatures/" + modelPath + ".json");
ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(UVLModelLoader.this.resourceManager, armatureLocation); ModelBlockAnimation animation = ModelBlockAnimation.loadVanillaAnimation(UVLModelLoader.this.resourceManager, armatureLocation);
ModelBlock model; ModelBlock model;
{ {
@@ -187,12 +187,12 @@ public enum UVLModelLoader implements ICustomModelLoader {
ModelBlock lvt_5_1_ = null; ModelBlock lvt_5_1_ = null;
try { try {
String s = modelLocation.getResourcePath(); String s = modelLocation.getPath();
iresource = Minecraft.getMinecraft() iresource = Minecraft.getMinecraft()
.getResourceManager() .getResourceManager()
.getResource( .getResource(
new ResourceLocation(modelLocation.getResourceDomain(), "models/" + modelPath + ".json")); new ResourceLocation(modelLocation.getNamespace(), "models/" + modelPath + ".json"));
reader = new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8); reader = new InputStreamReader(iresource.getInputStream(), Charsets.UTF_8);
lvt_5_1_ = JsonUtils.gsonDeserialize(this.UVLSERIALIZER, reader, ModelBlock.class, false); lvt_5_1_ = JsonUtils.gsonDeserialize(this.UVLSERIALIZER, reader, ModelBlock.class, false);
@@ -41,7 +41,7 @@ public class SpatialPylonRendering extends BlockRenderingCustomizer {
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void customize(IBlockRendering rendering, IItemRendering itemRendering) { public void customize(IBlockRendering rendering, IItemRendering itemRendering) {
rendering.builtInModel(MODEL_ID.getResourcePath(), new SpatialPylonModel()); rendering.builtInModel(MODEL_ID.getPath(), new SpatialPylonModel());
rendering.stateMapper(this::mapState); rendering.stateMapper(this::mapState);
} }
@@ -39,15 +39,7 @@ 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;
import appeng.container.implementations.ContainerInterface; import appeng.container.implementations.ContainerInterface;
import appeng.container.slot.AppEngSlot; import appeng.container.slot.*;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled;
import appeng.container.slot.SlotFake;
import appeng.container.slot.SlotInaccessible;
import appeng.container.slot.SlotPlayerHotBar;
import appeng.container.slot.SlotPlayerInv;
import appeng.container.slot.SlotRestrictedInput;
import appeng.container.slot.SlotRestrictedInput.PlacableItemType; import appeng.container.slot.SlotRestrictedInput.PlacableItemType;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.network.NetworkHandler;
@@ -65,14 +57,12 @@ import appeng.util.item.AEItemStack;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.*;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
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;
import org.jetbrains.annotations.NotNull;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Field; import java.lang.reflect.Field;
@@ -409,10 +399,7 @@ public abstract class AEBaseContainer extends Container {
return ItemStack.EMPTY; // don't insert duplicate encoded patterns to interfaces return ItemStack.EMPTY; // don't insert duplicate encoded patterns to interfaces
} }
int maxSize = t.getMaxStackSize(); int maxSize = Math.max(tis.getMaxStackSize(), d.getSlotStackLimit());
if (maxSize > d.getSlotStackLimit()) {
maxSize = d.getSlotStackLimit();
}
int placeAble = maxSize - t.getCount(); int placeAble = maxSize - t.getCount();
@@ -448,10 +435,7 @@ public abstract class AEBaseContainer extends Container {
if (d.isItemValid(tis)) { if (d.isItemValid(tis)) {
if (!d.getHasStack()) { if (!d.getHasStack()) {
int maxSize = tis.getMaxStackSize(); int maxSize = Math.max(tis.getMaxStackSize(), d.getSlotStackLimit());
if (maxSize > d.getSlotStackLimit()) {
maxSize = d.getSlotStackLimit();
}
final ItemStack tmp = tis.copy(); final ItemStack tmp = tis.copy();
if (tmp.getCount() > maxSize) { if (tmp.getCount() > maxSize) {
@@ -967,6 +951,47 @@ public abstract class AEBaseContainer extends Container {
b.putStack(testB); b.putStack(testB);
} }
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, @NotNull EntityPlayer player) {
if (slotId >= 0 && clickTypeIn == ClickType.PICKUP) {
final var slot = this.getSlot(slotId);
if (slot instanceof AppEngSlot appEngSlot) {
var slotStack = slot.getStack();
var draggedStack = this.invPlayer.getItemStack();
// The default vanilla behavior assumes that slots can't hold more items than the default stack size.
// Thus, it's possible to underflow the vanilla code when clicking non-empty slots with an item stack.
if (!draggedStack.isEmpty()) {
if (appEngSlot.isItemValid(draggedStack)) {
if (slotStack.getItem() == draggedStack.getItem() && slotStack.getMetadata() == draggedStack.getMetadata() && ItemStack.areItemStackTagsEqual(slotStack, draggedStack)) {
var maxSize = Math.max(appEngSlot.getSlotStackLimit(), draggedStack.getMaxStackSize());
var maxInsertable = Math.min(draggedStack.getCount(), maxSize - appEngSlot.getStack().getCount());
var toInsert = Math.min(maxInsertable, dragType == 0 ? maxInsertable : 1);
draggedStack.shrink(toInsert);
slotStack.grow(toInsert);
slot.onSlotChanged();
return ItemStack.EMPTY;
}
}
}
// Fixes taking and halving issues from oversized slots.
else if (dragType == 0 || dragType == 1) {
if (slot.canTakeStack(player) && !slotStack.isEmpty()) {
var toTake = Math.min(slotStack.getCount(), slotStack.getMaxStackSize());
this.invPlayer.setItemStack(slot.decrStackSize(dragType == 0 ? toTake : (toTake + 1) / 2));
slot.onTake(player, invPlayer.getItemStack());
return ItemStack.EMPTY;
}
}
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
public void onUpdate(final String field, final Object oldValue, final Object newValue) { public void onUpdate(final String field, final Object oldValue, final Object newValue) {
} }
@@ -163,7 +163,7 @@ public final class ContainerFluidInterfaceConfigurationTerminal extends AEBaseCo
} }
} }
if (!this.data.hasNoTags()) { if (!this.data.isEmpty()) {
try { try {
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player); NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException e) { } catch (final IOException e) {
@@ -251,7 +251,7 @@ public final class ContainerFluidInterfaceConfigurationTerminal extends AEBaseCo
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX); final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
final NBTTagCompound tag = data.getCompoundTag(name); final NBTTagCompound tag = data.getCompoundTag(name);
if (tag.hasNoTags()) { if (tag.isEmpty()) {
tag.setLong("sortBy", inv.sortBy); tag.setLong("sortBy", inv.sortBy);
tag.setString("un", inv.unlocalizedName); tag.setString("un", inv.unlocalizedName);
tag.setTag("pos", NBTUtil.createPosTag(inv.pos)); tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
@@ -28,13 +28,8 @@ import appeng.container.guisync.GuiSync;
import appeng.container.slot.*; import appeng.container.slot.*;
import appeng.helpers.DualityInterface; import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost; import appeng.helpers.IInterfaceHost;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.AppEngInternalOversizedInventory;
import appeng.util.Platform; import appeng.util.Platform;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.item.ItemStack;
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost { public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
@@ -71,19 +66,6 @@ public class ContainerInterface extends ContainerUpgradeable implements IOptiona
} }
} }
@Override
public ItemStack slotClick(int slotId, int dragType, ClickType clickTypeIn, EntityPlayer player) {
if (slotId >= 0 && slotId < this.inventorySlots.size()) {
if (this.inventorySlots.get(slotId) instanceof SlotOversized) {
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(true);
ItemStack ret = super.slotClick(slotId, dragType, clickTypeIn, player);
((AppEngInternalOversizedInventory) ((SlotOversized) this.inventorySlots.get(slotId)).getItemHandler()).limitExtraction(false);
return ret;
}
}
return super.slotClick(slotId, dragType, clickTypeIn, player);
}
@Override @Override
protected int getHeight() { protected int getHeight() {
return 256; return 256;
@@ -153,7 +153,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
} }
} }
if (!this.data.hasNoTags()) { if (!this.data.isEmpty()) {
try { try {
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player); NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException e) { } catch (final IOException e) {
@@ -296,7 +296,7 @@ public final class ContainerInterfaceConfigurationTerminal extends AEBaseContain
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX); final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
final NBTTagCompound tag = data.getCompoundTag(name); final NBTTagCompound tag = data.getCompoundTag(name);
if (tag.hasNoTags()) { if (tag.isEmpty()) {
tag.setLong("sortBy", inv.sortBy); tag.setLong("sortBy", inv.sortBy);
tag.setString("un", inv.unlocalizedName); tag.setString("un", inv.unlocalizedName);
tag.setTag("pos", NBTUtil.createPosTag(inv.pos)); tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
@@ -25,9 +25,12 @@ import appeng.api.config.YesNo;
import appeng.api.networking.IGrid; import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
import appeng.api.networking.security.IActionHost; import appeng.api.networking.security.IActionHost;
import appeng.client.me.SlotDisconnected;
import appeng.container.AEBaseContainer; import appeng.container.AEBaseContainer;
import appeng.container.slot.AppEngSlot;
import appeng.core.sync.network.NetworkHandler; import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketCompressedNBT; import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.helpers.DualityInterface; import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost; import appeng.helpers.IInterfaceHost;
import appeng.helpers.InventoryAction; import appeng.helpers.InventoryAction;
@@ -44,6 +47,7 @@ import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.inv.WrapperFilteredItemHandler; import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.WrapperRangeItemHandler; import appeng.util.inv.WrapperRangeItemHandler;
import appeng.util.inv.filter.IAEItemFilter; import appeng.util.inv.filter.IAEItemFilter;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -51,6 +55,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTUtil; import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemHandlerHelper;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
@@ -160,7 +165,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
} }
} }
if (!this.data.hasNoTags()) { if (!this.data.isEmpty()) {
try { try {
NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player); NetworkHandler.instance().sendTo(new PacketCompressedNBT(this.data), (EntityPlayerMP) this.getPlayerInv().player);
} catch (final IOException e) { } catch (final IOException e) {
@@ -175,6 +180,26 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) { public void doAction(final EntityPlayerMP player, final InventoryAction action, final int slot, final long id) {
final InvTracker inv = this.byId.get(id); final InvTracker inv = this.byId.get(id);
if (inv != null) { if (inv != null) {
// The code below this block assumes "slot" is an interface slot id. Not in this case.
if (action == InventoryAction.PLACE_SINGLE) {
final AppEngSlot playerSlot;
try {
playerSlot = (AppEngSlot) this.inventorySlots.get(slot);
} catch (IndexOutOfBoundsException ignored) { return; }
if (!playerSlot.isPlayerSide() || !playerSlot.getHasStack()) return;
var itemStack = playerSlot.getStack();
if (!itemStack.isEmpty()) {
var handler = new WrapperFilteredItemHandler(
new WrapperRangeItemHandler(inv.server, 0, 9 * (inv.numUpgrades + 1)), new PatternSlotFilter());
playerSlot.putStack(ItemHandlerHelper.insertItem(handler, itemStack, false));
detectAndSendChanges();
}
return;
}
final ItemStack is = inv.server.getStackInSlot(slot); final ItemStack is = inv.server.getStackInSlot(slot);
final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty(); final boolean hasItemInHand = !player.inventory.getItemStack().isEmpty();
@@ -271,8 +296,6 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
} }
break; break;
default:
return;
} }
this.updateHeld(player); this.updateHeld(player);
@@ -330,7 +353,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX); final String name = '=' + Long.toString(inv.which, Character.MAX_RADIX);
final NBTTagCompound tag = data.getCompoundTag(name); final NBTTagCompound tag = data.getCompoundTag(name);
if (tag.hasNoTags()) { if (tag.isEmpty()) {
tag.setLong("sortBy", inv.sortBy); tag.setLong("sortBy", inv.sortBy);
tag.setString("un", inv.unlocalizedName); tag.setString("un", inv.unlocalizedName);
tag.setTag("pos", NBTUtil.createPosTag(inv.pos)); tag.setTag("pos", NBTUtil.createPosTag(inv.pos));
@@ -356,6 +379,27 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer {
data.setTag(name, tag); data.setTag(name, tag);
} }
@Override
public ItemStack transferStackInSlot(EntityPlayer p, int idx) {
if (Platform.isClient()) {
var playerSlot = this.inventorySlots.get(idx);
if (playerSlot instanceof AppEngSlot playerAppEngSlot && playerAppEngSlot.isPlayerSide()) {
for (var slot : this.inventorySlots) {
if (slot instanceof SlotDisconnected slotDisconnected && !slot.getHasStack()) {
// Signal the server to move the pattern.
var packet = new PacketInventoryAction(InventoryAction.PLACE_SINGLE,
playerAppEngSlot.slotNumber, slotDisconnected.getSlot().getId());
NetworkHandler.instance().sendToServer(packet);
return ItemStack.EMPTY;
}
}
}
}
return super.transferStackInSlot(p, idx);
}
private static class InvTracker { private static class InvTracker {
private final long sortBy; private final long sortBy;
@@ -38,8 +38,6 @@ public class ContainerOreDictStorageBus extends AEBaseContainer {
public ContainerOreDictStorageBus(final InventoryPlayer ip, final PartOreDicStorageBus anchor) { public ContainerOreDictStorageBus(final InventoryPlayer ip, final PartOreDicStorageBus anchor) {
super(ip, anchor); super(ip, anchor);
this.part = anchor; this.part = anchor;
this.bindPlayerInventory(ip, 14, 256 - /* height of player inventory */82);
} }
@Override @Override
@@ -19,6 +19,7 @@
package appeng.container.implementations; package appeng.container.implementations;
import appeng.api.config.PowerMultiplier;
import appeng.container.AEBaseContainer; import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync; import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput; import appeng.container.slot.SlotRestrictedInput;
@@ -51,7 +52,7 @@ public class ContainerWireless extends AEBaseContainer {
final int boosters = this.boosterSlot.getStack().isEmpty() ? 0 : this.boosterSlot.getStack().getCount(); final int boosters = this.boosterSlot.getStack().isEmpty() ? 0 : this.boosterSlot.getStack().getCount();
this.setRange((long) (10 * AEConfig.instance().wireless_getMaxRange(boosters))); this.setRange((long) (10 * AEConfig.instance().wireless_getMaxRange(boosters)));
this.setDrain((long) (100 * AEConfig.instance().wireless_getPowerDrain(boosters))); this.setDrain((long) (100 * PowerMultiplier.CONFIG.multiply(AEConfig.instance().wireless_getPowerDrain(boosters))));
super.detectAndSendChanges(); super.detectAndSendChanges();
} }
@@ -63,8 +63,6 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEPortableTermin
this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this
.getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this)); .getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this));
this.bindPlayerInventory(ip, 0, 0);
this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting)); this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting));
} }
@@ -133,15 +133,18 @@ public class AppEngCraftingSlot extends AppEngSlot {
@Override @Override
public ItemStack onTake(final EntityPlayer playerIn, final ItemStack stack) { public ItemStack onTake(final EntityPlayer playerIn, final ItemStack stack) {
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, new WrapperInvItemHandler(this.craftMatrix));
this.onCrafting(stack); this.onCrafting(stack);
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn); stack.getItem().onCreated(stack, playerIn.world, playerIn);
final InventoryCrafting ic = new InventoryCrafting(this.getContainer(), 3, 3); final InventoryCrafting ic = new InventoryCrafting(this.getContainer(), 3, 3);
for (int x = 0; x < this.craftMatrix.getSlots(); x++) { for (int x = 0; x < this.craftMatrix.getSlots(); x++) {
ic.setInventorySlotContents(x, this.craftMatrix.getStackInSlot(x)); ic.setInventorySlotContents(x, this.craftMatrix.getStackInSlot(x));
} }
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, ic);
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
final NonNullList<ItemStack> aitemstack = this.getRemainingItems(ic, playerIn.world); final NonNullList<ItemStack> aitemstack = this.getRemainingItems(ic, playerIn.world);
ItemHandlerUtil.copy(ic, this.craftMatrix, false); ItemHandlerUtil.copy(ic, this.craftMatrix, false);
@@ -158,6 +158,24 @@ public class AppEngSlot extends Slot {
@Override @Override
public boolean canTakeStack(final EntityPlayer par1EntityPlayer) { public boolean canTakeStack(final EntityPlayer par1EntityPlayer) {
if (this.isSlotEnabled()) {
var draggedStack = par1EntityPlayer.inventory.getItemStack();
ItemStack slotStack = this.getStack();
if (!draggedStack.isEmpty()) {
if (draggedStack.isItemEqual(slotStack)) {
if (draggedStack.getCount() >= draggedStack.getMaxStackSize()) {
// Prevent over-pulling.
return false;
}
} else if (slotStack.getCount() > slotStack.getMaxStackSize()) {
// Prevent swapping when clicking slots that hold more items than the max stack size.
return false;
}
}
}
if (this.isSlotEnabled()) { if (this.isSlotEnabled()) {
return !this.itemHandler.extractItem(this.index, Integer.MAX_VALUE, true).isEmpty(); return !this.itemHandler.extractItem(this.index, Integer.MAX_VALUE, true).isEmpty();
} }
@@ -97,26 +97,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
return is; return is;
} }
// Don't render the item client-side if the item stage for it is not unlocked yet
@Override @Override
public ItemStack getStack() { public boolean shouldDisplay() {
if (Platform.isClient() && Loader.isModLoaded("itemstages")) { return !getStack().isEmpty();
return itemstageStack();
}
return super.getStack();
}
@SideOnly(Side.CLIENT)
ItemStack itemstageStack() {
final ItemStack item = super.getStack();
final String itemsStage = ItemStages.getStage(item);
final String enchantStage = ItemStages.getEnchantStage(item);
final EntityPlayer player = Minecraft.getMinecraft().player;
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
return ItemStack.EMPTY;
return super.getStack();
} }
public void doClick(final InventoryAction action, final EntityPlayer who) { public void doClick(final InventoryAction action, final EntityPlayer who) {
@@ -196,15 +179,6 @@ public class SlotCraftingTerm extends AppEngCraftingSlot {
} }
} }
if (Loader.isModLoaded("itemstages")) {
final String itemsStage = ItemStages.getStage(recipe.getRecipeOutput());
final String enchantStage = ItemStages.getEnchantStage(recipe.getRecipeOutput());
if ((itemsStage != null && !GameStageHelper.hasStage(player, itemsStage))
|| (enchantStage != null && !GameStageHelper.hasStage(player, enchantStage)))
return null;
}
return recipe; return recipe;
} }
+1 -1
View File
@@ -268,7 +268,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.craftByStacks[btnNum] = Math.abs(cmb.getInt(this.craftByStacks[btnNum])); this.craftByStacks[btnNum] = Math.abs(cmb.getInt(this.craftByStacks[btnNum]));
this.priorityByStacks[btnNum] = Math.abs(pmb.getInt(this.priorityByStacks[btnNum])); this.priorityByStacks[btnNum] = Math.abs(pmb.getInt(this.priorityByStacks[btnNum]));
this.levelByStacks[btnNum] = Math.abs(pmb.getInt(this.levelByStacks[btnNum])); this.levelByStacks[btnNum] = Math.abs(lmb.getInt(this.levelByStacks[btnNum]));
cmb.setComment("Controls buttons on Crafting Screen : Capped at " + buttonCap); cmb.setComment("Controls buttons on Crafting Screen : Capped at " + buttonCap);
pmb.setComment("Controls buttons on Priority Screen : Capped at " + buttonCap); pmb.setComment("Controls buttons on Priority Screen : Capped at " + buttonCap);
+3 -3
View File
@@ -40,12 +40,12 @@ public final class CreativeTab extends CreativeTabs {
} }
@Override @Override
public ItemStack getTabIconItem() { public ItemStack getIcon() {
return this.getIconItemStack(); return this.createIcon();
} }
@Override @Override
public ItemStack getIconItemStack() { public ItemStack createIcon() {
final IDefinitions definitions = AEApi.instance().definitions(); final IDefinitions definitions = AEApi.instance().definitions();
final IBlocks blocks = definitions.blocks(); final IBlocks blocks = definitions.blocks();
final IItems items = definitions.items(); final IItems items = definitions.items();
@@ -42,12 +42,12 @@ public final class CreativeTabFacade extends CreativeTabs {
} }
@Override @Override
public ItemStack getTabIconItem() { public ItemStack getIcon() {
return this.getIconItemStack(); return this.createIcon();
} }
@Override @Override
public ItemStack getIconItemStack() { public ItemStack createIcon() {
final Optional<Item> maybeFacade = AEApi.instance().definitions().items().facade().maybeItem(); final Optional<Item> maybeFacade = AEApi.instance().definitions().items().facade().maybeItem();
if (maybeFacade.isPresent()) { if (maybeFacade.isPresent()) {
return ((ItemFacade) maybeFacade.get()).getCreativeTabIcon(); return ((ItemFacade) maybeFacade.get()).getCreativeTabIcon();
@@ -561,6 +561,10 @@ public final class ApiBlocks implements IBlocks {
}) })
.build(); .build();
if (!stairs.maybeBlock().isPresent()) {
return new BlockDefinition(registryName, null, null);
}
Verify.verify(stairs.maybeBlock().isPresent()); Verify.verify(stairs.maybeBlock().isPresent());
return stairs; return stairs;
@@ -166,6 +166,7 @@ public enum AEFeature {
MOLECULAR_ASSEMBLER("MolecularAssembler", Constants.CATEGORY_CRAFTING_FEATURES), MOLECULAR_ASSEMBLER("MolecularAssembler", Constants.CATEGORY_CRAFTING_FEATURES),
PATTERNS("Patterns", Constants.CATEGORY_CRAFTING_FEATURES), PATTERNS("Patterns", Constants.CATEGORY_CRAFTING_FEATURES),
CRAFTING_CPU("CraftingCPU", Constants.CATEGORY_CRAFTING_FEATURES), CRAFTING_CPU("CraftingCPU", Constants.CATEGORY_CRAFTING_FEATURES),
CRAFTING_TOASTS("CraftingToasts", Constants.CATEGORY_CRAFTING_FEATURES),
BASIC_CARDS("BasicCards", Constants.CATEGORY_UPGRADES), BASIC_CARDS("BasicCards", Constants.CATEGORY_UPGRADES),
ADVANCED_CARDS("AdvancedCards", Constants.CATEGORY_UPGRADES), ADVANCED_CARDS("AdvancedCards", Constants.CATEGORY_UPGRADES),
@@ -252,7 +252,7 @@ public final class P2PTunnelRegistry implements IP2PTunnelRegistry {
// Use the mod id as last option. // Use the mod id as last option.
for (final Entry<String, TunnelType> entry : this.modIdTunnels.entrySet()) { for (final Entry<String, TunnelType> entry : this.modIdTunnels.entrySet()) {
if (trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getResourceDomain().equals(entry.getKey())) { if (trigger.getItem().getRegistryName() != null && trigger.getItem().getRegistryName().getNamespace().equals(entry.getKey())) {
return entry.getValue(); return entry.getValue();
} }
} }
@@ -122,7 +122,7 @@ public final class GrinderRecipeManager implements IGrinderRegistry, IOreListene
return null; return null;
} }
this.log("Recipe for '%1$s' found '%2$s'", input.getUnlocalizedName(), Platform.getItemDisplayName(recipe.getOutput())); this.log("Recipe for '%1$s' found '%2$s'", input.getTranslationKey(), Platform.getItemDisplayName(recipe.getOutput()));
return recipe; return recipe;
} }
@@ -201,7 +201,11 @@ public enum GuiText {
LargeFontCraft, LargeFontCraft,
// Used in a ME Interface when no appropriate TileEntity was detected near it // Used in a ME Interface when no appropriate TileEntity was detected near it
Nothing; Nothing,
// Used in Crafting Toasts
CraftingToastDone,
CraftingToastCancelled;
private final String root; private final String root;
@@ -86,7 +86,9 @@ public class AppEngPacketHandlerBase {
PACKET_CRAFTING_CPUS_UPDATE(PacketCraftingCPUsUpdate.class), PACKET_CRAFTING_CPUS_UPDATE(PacketCraftingCPUsUpdate.class),
PACKET_TERMINAL_KEYBIND(PacketTerminalUse.class); PACKET_TERMINAL_KEYBIND(PacketTerminalUse.class),
PACKET_CRAFTING_TOAST(PacketCraftingToast.class);
private final Class<? extends AppEngPacket> packetClass; private final Class<? extends AppEngPacket> packetClass;
@@ -0,0 +1,49 @@
package appeng.core.sync.packets;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.toasts.CraftingStatusToast;
import appeng.core.AEConfig;
import appeng.core.features.AEFeature;
import appeng.core.sync.AppEngPacket;
import appeng.core.sync.network.INetworkInfo;
import appeng.util.item.AEItemStack;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import java.io.IOException;
public class PacketCraftingToast extends AppEngPacket {
private final IAEItemStack stack;
private final boolean cancelled;
public PacketCraftingToast(final ByteBuf stream) {
this.stack = AEItemStack.fromPacket(stream);
this.cancelled = stream.readBoolean();
}
public PacketCraftingToast(IAEItemStack stack, boolean cancelled) throws IOException {
this.stack = stack;
this.cancelled = cancelled;
final ByteBuf data = Unpooled.buffer();
data.writeInt(this.getPacketID());
stack.writeToPacket(data);
data.writeBoolean(cancelled);
this.configureWrite(data);
}
@Override
public void clientPacketData(INetworkInfo network, AppEngPacket packet, EntityPlayer player) {
if (AEConfig.instance().isFeatureEnabled(AEFeature.CRAFTING_TOASTS)) {
Minecraft.getMinecraft()
.getToastGui().add(new CraftingStatusToast(stack.asItemStackRepresentation(), cancelled));
}
}
@Override
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {}
}
@@ -157,7 +157,7 @@ public class PacketValueConfig extends AppEngPacket {
} else if (this.Name.equals("PatternTerminal.MaximizeCount")) { } else if (this.Name.equals("PatternTerminal.MaximizeCount")) {
cpt.maximizeCount(); cpt.maximizeCount();
} else if (this.Name.equals("PatternTerminal.Substitute")) { } else if (this.Name.equals("PatternTerminal.Substitute")) {
cpt.getPart().setSubstitution(this.Value.equals("1")); cpt.setSubstitute(this.Value.equals("1"));
} }
} }
} else if (this.Name.startsWith("StorageBus.")) { } else if (this.Name.startsWith("StorageBus.")) {
@@ -29,7 +29,7 @@ public class CraftBranchFailure extends Exception {
private final IAEItemStack missing; private final IAEItemStack missing;
public CraftBranchFailure(final IAEItemStack what, final long howMany) { public CraftBranchFailure(final IAEItemStack what, final long howMany) {
super("Failed: " + what.getItem().getUnlocalizedName() + " x " + howMany); super("Failed: " + what.getItem().getTranslationKey() + " x " + howMany);
this.missing = what.copy(); this.missing = what.copy();
this.missing.setStackSize(howMany); this.missing.setStackSize(howMany);
} }
@@ -89,9 +89,9 @@ public class ToolReplicatorCard extends AEBaseItem {
final DimensionalCoord min = sc.getMin(); final DimensionalCoord min = sc.getMin();
final DimensionalCoord max = sc.getMax(); final DimensionalCoord max = sc.getMax();
x += currentSideOff.getFrontOffsetX(); x += currentSideOff.getXOffset();
y += currentSideOff.getFrontOffsetY(); y += currentSideOff.getYOffset();
z += currentSideOff.getFrontOffsetZ(); z += currentSideOff.getZOffset();
final int min_x = min.x; final int min_x = min.x;
final int min_y = min.y; final int min_y = min.y;
@@ -86,8 +86,8 @@ public abstract class BlockSlabCommon extends BlockSlab {
} }
@Override @Override
public String getUnlocalizedName(int meta) { public String getTranslationKey(int meta) {
return this.getUnlocalizedName(); return this.getTranslationKey();
} }
@Override @Override
@@ -33,6 +33,7 @@ import net.minecraftforge.common.property.ExtendedBlockState;
import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState;
import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.common.property.IUnlistedProperty;
import javax.annotation.Nonnull;
import java.util.EnumSet; import java.util.EnumSet;
@@ -77,7 +78,7 @@ public class BlockQuartzGlass extends AEBaseBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -31,6 +31,7 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.util.Random; import java.util.Random;
@@ -42,7 +43,7 @@ public class BlockQuartzOre extends AEBaseBlock {
} }
@Override @Override
public BlockRenderLayer getBlockLayer() { public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
@@ -275,8 +275,8 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
try { try {
Vec3d from = new Vec3d(hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5); Vec3d from = new Vec3d(hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5);
from = from.addVector(direction.getFrontOffsetX() * 0.501, direction.getFrontOffsetY() * 0.501, direction.getFrontOffsetZ() * 0.501); from = from.add(direction.getXOffset() * 0.501, direction.getYOffset() * 0.501, direction.getZOffset() * 0.501);
final Vec3d to = from.addVector(direction.getFrontOffsetX(), direction.getFrontOffsetY(), direction.getFrontOffsetZ()); final Vec3d to = from.add(direction.getXOffset(), direction.getYOffset(), direction.getZOffset());
final RayTraceResult mop = hostWorld.rayTraceBlocks(from, to, true); final RayTraceResult mop = hostWorld.rayTraceBlocks(from, to, true);
if (mop != null && !BAD_BLOCKS.contains(directedBlock)) { if (mop != null && !BAD_BLOCKS.contains(directedBlock)) {
if (mop.getBlockPos().equals(directedTile.getPos())) { if (mop.getBlockPos().equals(directedTile.getPos())) {
@@ -296,7 +296,7 @@ public class DualityFluidInterface implements IGridTickable, IStorageMonitorable
final Item item = Item.getItemFromBlock(directedBlock); final Item item = Item.getItemFromBlock(directedBlock);
if (item == Items.AIR) { if (item == Items.AIR) {
return directedBlock.getUnlocalizedName(); return directedBlock.getTranslationKey();
} }
} }
} }
@@ -119,7 +119,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
private final ConfigManager cm = new ConfigManager(this); private final ConfigManager cm = new ConfigManager(this);
private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS, 512); private final AppEngInternalAEInventory config = new AppEngInternalAEInventory(this, NUMBER_OF_CONFIG_SLOTS, 512);
private final AppEngInternalInventory storage = new AppEngInternalOversizedInventory(this, NUMBER_OF_STORAGE_SLOTS, 512); private final AppEngInternalInventory storage = new AppEngInternalOversizedInventory(this, NUMBER_OF_STORAGE_SLOTS, 512);
private final AppEngInternalInventory patterns = new AppEngInternalInventory(this, NUMBER_OF_PATTERN_SLOTS); private final AppEngInternalInventory patterns = new AppEngInternalInventory(this, NUMBER_OF_PATTERN_SLOTS, 1);
private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>(new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class)); private final MEMonitorPassThrough<IAEItemStack> items = new MEMonitorPassThrough<>(new NullInventory<IAEItemStack>(), AEApi.instance().storage().getStorageChannel(IItemStorageChannel.class));
private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>(new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class)); private final MEMonitorPassThrough<IAEFluidStack> fluids = new MEMonitorPassThrough<>(new NullInventory<IAEFluidStack>(), AEApi.instance().storage().getStorageChannel(IFluidStorageChannel.class));
private final UpgradeInventory upgrades; private final UpgradeInventory upgrades;
@@ -256,7 +256,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
final NBTTagCompound c = w.getCompoundTagAt(x); final NBTTagCompound c = w.getCompoundTagAt(x);
if (c != null) { if (c != null) {
final ItemStack is = stackFromNBT(c); final ItemStack is = stackFromNBT(c);
this.addToSendListFacing(is, EnumFacing.getFront(s.getIndex())); this.addToSendListFacing(is, EnumFacing.byIndex(s.getIndex()));
} }
} }
} }
@@ -1025,14 +1025,14 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
phantomTE = ((IPhantomTile) te); phantomTE = ((IPhantomTile) te);
if (phantomTE.hasBoundPosition()) { if (phantomTE.hasBoundPosition()) {
TileEntity phantom = w.getTileEntity(phantomTE.getBoundPosition()); TileEntity phantom = w.getTileEntity(phantomTE.getBoundPosition());
if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(phantomTE.getBoundPosition()).getBlock().getRegistryName().getResourceDomain())) { if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(phantomTE.getBoundPosition()).getBlock().getRegistryName().getNamespace())) {
if (isCustomInvBlocking(phantom, s)) { if (isCustomInvBlocking(phantom, s)) {
visitedFaces.remove(s); visitedFaces.remove(s);
continue; continue;
} }
} }
} }
} else if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(tile.getPos().offset(s)).getBlock().getRegistryName().getResourceDomain())) { } else if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(tile.getPos().offset(s)).getBlock().getRegistryName().getNamespace())) {
if (isCustomInvBlocking(te, s)) { if (isCustomInvBlocking(te, s)) {
visitedFaces.remove(s); visitedFaces.remove(s);
continue; continue;
@@ -1113,14 +1113,14 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
IPhantomTile phantomTE = ((IPhantomTile) te); IPhantomTile phantomTE = ((IPhantomTile) te);
if (phantomTE.hasBoundPosition()) { if (phantomTE.hasBoundPosition()) {
TileEntity phantom = w.getTileEntity(phantomTE.getBoundPosition()); TileEntity phantom = w.getTileEntity(phantomTE.getBoundPosition());
if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(phantomTE.getBoundPosition()).getBlock().getRegistryName().getResourceDomain())) { if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(phantomTE.getBoundPosition()).getBlock().getRegistryName().getNamespace())) {
if (!isCustomInvBlocking(phantom, s)) { if (!isCustomInvBlocking(phantom, s)) {
allAreBusy = false; allAreBusy = false;
break; break;
} }
} }
} }
} else if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(tile.getPos().offset(s)).getBlock().getRegistryName().getResourceDomain())) { } else if (NonBlockingItems.INSTANCE.getMap().containsKey(w.getBlockState(tile.getPos().offset(s)).getBlock().getRegistryName().getNamespace())) {
if (!isCustomInvBlocking(te, s)) { if (!isCustomInvBlocking(te, s)) {
allAreBusy = false; allAreBusy = false;
break; break;
@@ -1203,6 +1203,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
for (final ItemStack is : this.storage) { for (final ItemStack is : this.storage) {
if (!is.isEmpty()) { if (!is.isEmpty()) {
int maxStackSize = is.getMaxStackSize();
while (is.getCount() > maxStackSize) {
ItemStack portionedStack = is.copy();
portionedStack.setCount(maxStackSize);
is.shrink(maxStackSize);
drops.add(portionedStack);
}
drops.add(is); drops.add(is);
} }
} }
@@ -1300,8 +1307,8 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
try { try {
Vec3d from = new Vec3d(hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5); Vec3d from = new Vec3d(hostTile.getPos().getX() + 0.5, hostTile.getPos().getY() + 0.5, hostTile.getPos().getZ() + 0.5);
from = from.addVector(direction.getFrontOffsetX() * 0.501, direction.getFrontOffsetY() * 0.501, direction.getFrontOffsetZ() * 0.501); from = from.add(direction.getXOffset() * 0.501, direction.getYOffset() * 0.501, direction.getZOffset() * 0.501);
final Vec3d to = from.addVector(direction.getFrontOffsetX(), direction.getFrontOffsetY(), direction.getFrontOffsetZ()); final Vec3d to = from.add(direction.getXOffset(), direction.getYOffset(), direction.getZOffset());
final RayTraceResult mop = hostWorld.rayTraceBlocks(from, to, true); final RayTraceResult mop = hostWorld.rayTraceBlocks(from, to, true);
if (mop != null && !BAD_BLOCKS.contains(directedBlock)) { if (mop != null && !BAD_BLOCKS.contains(directedBlock)) {
if (mop.getBlockPos().equals(directedTile.getPos())) { if (mop.getBlockPos().equals(directedTile.getPos())) {
@@ -1321,7 +1328,7 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
final Item item = Item.getItemFromBlock(directedBlock); final Item item = Item.getItemFromBlock(directedBlock);
if (item == Items.AIR) { if (item == Items.AIR) {
return directedBlock.getUnlocalizedName(); return directedBlock.getTranslationKey();
} }
} }
} }
@@ -59,7 +59,7 @@ public class InvalidPatternHelper {
NBTTagCompound in = inTag.getCompoundTagAt(i); NBTTagCompound in = inTag.getCompoundTagAt(i);
// skip empty slots in the crafting grid // skip empty slots in the crafting grid
if (in.hasNoTags()) { if (in.isEmpty()) {
continue; continue;
} }
@@ -45,7 +45,7 @@ public class LocationRotation implements IOrientable {
@Override @Override
public EnumFacing getForward() { public EnumFacing getForward() {
if (this.getUp().getFrontOffsetY() == 0) { if (this.getUp().getYOffset() == 0) {
return EnumFacing.UP; return EnumFacing.UP;
} }
return EnumFacing.SOUTH; return EnumFacing.SOUTH;
@@ -49,7 +49,7 @@ public class MetaRotation implements IOrientable {
@Override @Override
public EnumFacing getForward() { public EnumFacing getForward() {
if (this.getUp().getFrontOffsetY() == 0) { if (this.getUp().getYOffset() == 0) {
return EnumFacing.UP; return EnumFacing.UP;
} }
return EnumFacing.SOUTH; return EnumFacing.SOUTH;
@@ -54,7 +54,7 @@ public class MultiCraftingTracker {
for (int x = 0; x < this.size; x++) { for (int x = 0; x < this.size; x++) {
final NBTTagCompound link = extra.getCompoundTag("links-" + x); final NBTTagCompound link = extra.getCompoundTag("links-" + x);
if (link != null && !link.hasNoTags()) { if (link != null && !link.isEmpty()) {
this.setLink(x, AEApi.instance().storage().loadCraftingLink(link, this.owner)); this.setLink(x, AEApi.instance().storage().loadCraftingLink(link, this.owner));
} }
} }
@@ -95,7 +95,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
NBTTagCompound ingredient = inTag.getCompoundTagAt(x); NBTTagCompound ingredient = inTag.getCompoundTagAt(x);
final ItemStack gs = stackFromNBT(ingredient); final ItemStack gs = stackFromNBT(ingredient);
if (!ingredient.hasNoTags() && gs.isEmpty()) { if (!ingredient.isEmpty() && gs.isEmpty()) {
throw new IllegalArgumentException("No pattern here!"); throw new IllegalArgumentException("No pattern here!");
} }
@@ -126,7 +126,7 @@ public class PatternHelper implements ICraftingPatternDetails, Comparable<Patter
NBTTagCompound resultItemTag = outTag.getCompoundTagAt(x); NBTTagCompound resultItemTag = outTag.getCompoundTagAt(x);
final ItemStack gs = stackFromNBT(resultItemTag); final ItemStack gs = stackFromNBT(resultItemTag);
if (!resultItemTag.hasNoTags() && gs.isEmpty()) { if (!resultItemTag.isEmpty() && gs.isEmpty()) {
throw new IllegalArgumentException("No pattern here!"); throw new IllegalArgumentException("No pattern here!");
} }
@@ -0,0 +1,28 @@
package appeng.helpers;
import appeng.util.Platform;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.fml.server.FMLServerHandler;
import org.jetbrains.annotations.Nullable;
import java.util.UUID;
public class PlayerHelper {
@Nullable
public static EntityPlayerMP getPlayerByUUID(UUID uuid) {
final MinecraftServer server;
if (Platform.isClientInstall()) {
server = Minecraft.getMinecraft().getIntegratedServer();
} else {
server = FMLServerHandler.instance().getServer();
}
if (server == null) {
return null;
}
return server.getPlayerList().getPlayerByUUID(uuid);
}
}
@@ -34,9 +34,9 @@ public final class DispenserBehaviorTinyTNT extends BehaviorDefaultDispenseItem
protected ItemStack dispenseStack(final IBlockSource dispenser, final ItemStack dispensedItem) { protected ItemStack dispenseStack(final IBlockSource dispenser, final ItemStack dispensedItem) {
final EnumFacing enumfacing = dispenser.getBlockState().getValue(BlockDispenser.FACING); final EnumFacing enumfacing = dispenser.getBlockState().getValue(BlockDispenser.FACING);
final World world = dispenser.getWorld(); final World world = dispenser.getWorld();
final int i = dispenser.getBlockPos().getX() + enumfacing.getFrontOffsetX(); final int i = dispenser.getBlockPos().getX() + enumfacing.getXOffset();
final int j = dispenser.getBlockPos().getY() + enumfacing.getFrontOffsetY(); final int j = dispenser.getBlockPos().getY() + enumfacing.getYOffset();
final int k = dispenser.getBlockPos().getZ() + enumfacing.getFrontOffsetZ(); final int k = dispenser.getBlockPos().getZ() + enumfacing.getZOffset();
final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed(world, i + 0.5F, j + 0.5F, k + 0.5F, null); final EntityTinyTNTPrimed primedTinyTNTEntity = new EntityTinyTNTPrimed(world, i + 0.5F, j + 0.5F, k + 0.5F, null);
world.spawnEntity(primedTinyTNTEntity); world.spawnEntity(primedTinyTNTEntity);
dispensedItem.setCount(dispensedItem.getCount() - 1); dispensedItem.setCount(dispensedItem.getCount() - 1);
@@ -42,7 +42,7 @@ public final class DispenserMatterCannon extends BehaviorDefaultDispenseItem {
final EnumFacing enumfacing = dispenser.getBlockState().getValue(BlockDispenser.FACING); final EnumFacing enumfacing = dispenser.getBlockState().getValue(BlockDispenser.FACING);
AEPartLocation dir = AEPartLocation.INTERNAL; AEPartLocation dir = AEPartLocation.INTERNAL;
for (final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS) { for (final AEPartLocation d : AEPartLocation.SIDE_LOCATIONS) {
if (enumfacing.getFrontOffsetX() == d.xOffset && enumfacing.getFrontOffsetY() == d.yOffset && enumfacing.getFrontOffsetZ() == d.zOffset) { if (enumfacing.getXOffset() == d.xOffset && enumfacing.getYOffset() == d.yOffset && enumfacing.getZOffset() == d.zOffset) {
dir = d; dir = d;
} }
} }
@@ -32,6 +32,7 @@ import appeng.me.Grid;
import appeng.tile.AEBaseTile; import appeng.tile.AEBaseTile;
import appeng.util.IWorldCallable; import appeng.util.IWorldCallable;
import appeng.util.Platform; import appeng.util.Platform;
import com.google.common.base.Preconditions;
import com.google.common.base.Stopwatch; import com.google.common.base.Stopwatch;
import com.google.common.collect.LinkedListMultimap; import com.google.common.collect.LinkedListMultimap;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
@@ -66,7 +67,20 @@ public class TickHandler {
return this.cliPlayerColors; return this.cliPlayerColors;
} }
/**
* Add a server or world callback which gets called the next time the queue is ticked.
* <p>
* Callbacks on the client are not support.
* <p>
* Using null as world will queue it into the global {@link TickEvent.ServerTickEvent}, otherwise it will be ticked with the
* corresponding {@link TickEvent.WorldTickEvent}.
*
* @param w null or the specific {@link World}
* @param c the callback
*/
public void addCallable(final World w, final IWorldCallable<?> c) { public void addCallable(final World w, final IWorldCallable<?> c) {
Preconditions.checkArgument(w == null || !w.isRemote, "Can only register serverside callbacks");
if (w == null) { if (w == null) {
this.serverQueue.add(c); this.serverQueue.add(c);
} else { } else {
@@ -35,7 +35,7 @@ public final class PartAccessor {
public Optional<IPart> getMaybePart(final TileEntity te, final IProbeHitData data) { public Optional<IPart> getMaybePart(final TileEntity te, final IProbeHitData data) {
if (te instanceof IPartHost) { if (te instanceof IPartHost) {
BlockPos pos = data.getPos(); BlockPos pos = data.getPos();
final Vec3d position = data.getHitVec().addVector(-pos.getX(), -pos.getY(), -pos.getZ()); final Vec3d position = data.getHitVec().add(-pos.getX(), -pos.getY(), -pos.getZ());
final IPartHost host = (IPartHost) te; final IPartHost host = (IPartHost) te;
final SelectedPart sp = host.selectPart(position); final SelectedPart sp = host.selectPart(position);
@@ -51,7 +51,7 @@ public final class PartAccessor {
public Optional<IPart> getMaybePart(final TileEntity te, final RayTraceResult mop) { public Optional<IPart> getMaybePart(final TileEntity te, final RayTraceResult mop) {
if (te instanceof IPartHost) { if (te instanceof IPartHost) {
BlockPos pos = mop.getBlockPos(); BlockPos pos = mop.getBlockPos();
final Vec3d position = mop.hitVec.addVector(-pos.getX(), -pos.getY(), -pos.getZ()); final Vec3d position = mop.hitVec.add(-pos.getX(), -pos.getY(), -pos.getZ());
final IPartHost host = (IPartHost) te; final IPartHost host = (IPartHost) te;
final SelectedPart sp = host.selectPart(position); final SelectedPart sp = host.selectPart(position);
@@ -51,7 +51,7 @@ public final class Tracer {
final Vec3d headVec = this.getCorrectedHeadVec(player); final Vec3d headVec = this.getCorrectedHeadVec(player);
final Vec3d lookVec = player.getLook(1.0F); final Vec3d lookVec = player.getLook(1.0F);
final double reach = this.getBlockReachDistance_server(player); final double reach = this.getBlockReachDistance_server(player);
final Vec3d endVec = headVec.addVector(lookVec.x * reach, lookVec.y * reach, lookVec.z * reach); final Vec3d endVec = headVec.add(lookVec.x * reach, lookVec.y * reach, lookVec.z * reach);
return blockState.collisionRayTrace(world, pos, headVec, endVec); return blockState.collisionRayTrace(world, pos, headVec, endVec);
} }
+1 -1
View File
@@ -39,7 +39,7 @@ public abstract class AEBaseItem extends Item {
@Override @Override
public String toString() { public String toString() {
String regName = this.getRegistryName() != null ? this.getRegistryName().getResourcePath() : "unregistered"; String regName = this.getRegistryName() != null ? this.getRegistryName().getPath() : "unregistered";
return this.getClass().getSimpleName() + "[" + regName + "]"; return this.getClass().getSimpleName() + "[" + regName + "]";
} }
@@ -63,6 +63,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import javax.annotation.Nonnull;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@@ -209,7 +210,8 @@ public final class ItemMaterial extends AEBaseItem implements IStorageComponent,
} }
@Override @Override
public String getUnlocalizedName(final ItemStack is) { @Nonnull
public String getTranslationKey(final ItemStack is) {
return "item.appliedenergistics2.material." + this.nameOf(is).toLowerCase(); return "item.appliedenergistics2.material." + this.nameOf(is).toLowerCase();
} }
@@ -39,6 +39,7 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
@@ -70,7 +71,7 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal {
{ {
crystalSeedStack.setItemDamage(certus2); crystalSeedStack.setItemDamage(certus2);
crystalSeedStack = newStyle(crystalSeedStack); crystalSeedStack = newStyle(crystalSeedStack);
String itemName = crystalSeedStack.getItem().getRegistryName().getResourcePath(); String itemName = crystalSeedStack.getItem().getRegistryName().getPath();
return new ResolverResult(itemName, crystalSeedStack.getItemDamage(), crystalSeedStack.getTagCompound()); return new ResolverResult(itemName, crystalSeedStack.getItemDamage(), crystalSeedStack.getTagCompound());
}) })
.orElse(null); .orElse(null);
@@ -154,22 +155,23 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal {
} }
@Override @Override
public String getUnlocalizedName(final ItemStack is) { @Nonnull
public String getTranslationKey(final ItemStack is) {
final int damage = getProgress(is); final int damage = getProgress(is);
if (damage < CERTUS + SINGLE_OFFSET) { if (damage < CERTUS + SINGLE_OFFSET) {
return this.getUnlocalizedName() + ".certus"; return this.getTranslationKey() + ".certus";
} }
if (damage < NETHER + SINGLE_OFFSET) { if (damage < NETHER + SINGLE_OFFSET) {
return this.getUnlocalizedName() + ".nether"; return this.getTranslationKey() + ".nether";
} }
if (damage < FLUIX + SINGLE_OFFSET) { if (damage < FLUIX + SINGLE_OFFSET) {
return this.getUnlocalizedName() + ".fluix"; return this.getTranslationKey() + ".fluix";
} }
return this.getUnlocalizedName(); return this.getTranslationKey();
} }
@Override @Override
@@ -94,7 +94,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
} }
final NonNullList<ItemStack> tmpList = NonNullList.create(); final NonNullList<ItemStack> tmpList = NonNullList.create();
b.getSubBlocks(b.getCreativeTabToDisplayOn(), tmpList); b.getSubBlocks(b.getCreativeTab(), tmpList);
for (final ItemStack l : tmpList) { for (final ItemStack l : tmpList) {
final ItemStack facade = this.createFacadeForItem(l, false); final ItemStack facade = this.createFacadeForItem(l, false);
if (!facade.isEmpty()) { if (!facade.isEmpty()) {
+23 -1
View File
@@ -141,7 +141,29 @@ public final class ItemPart extends AEBaseItem implements IPartItem, IItemGroup
} }
@Override @Override
public String getUnlocalizedName(final ItemStack is) { public boolean isBookEnchantable(ItemStack itemstack1, ItemStack itemstack2) {
return true;
}
@Override
public boolean isEnchantable(ItemStack stack) {
if (getTypeByStack(stack) == PartType.IDENTITY_ANNIHILATION_PLANE) {
return true;
}
return super.isEnchantable(stack);
}
@Override
public int getItemEnchantability(ItemStack stack) {
if (getTypeByStack(stack) == PartType.IDENTITY_ANNIHILATION_PLANE) {
return 10;
}
return super.getItemEnchantability(stack);
}
@Override
@Nonnull
public String getTranslationKey(final ItemStack is) {
Preconditions.checkNotNull(is); Preconditions.checkNotNull(is);
return "item.appliedenergistics2.multi_part." + this.getTypeByStack(is).getUnlocalizedName().toLowerCase(); return "item.appliedenergistics2.multi_part." + this.getTypeByStack(is).getUnlocalizedName().toLowerCase();
} }
@@ -80,7 +80,7 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
static { static {
for (final AEColor color : AEColor.VALID_COLORS) { for (final AEColor color : AEColor.VALID_COLORS) {
final String dyeName = color.dye.getUnlocalizedName(); final String dyeName = color.dye.getTranslationKey();
final String oreDictName = "dye" + WordUtils.capitalize(dyeName); final String oreDictName = "dye" + WordUtils.capitalize(dyeName);
final int oreDictId = OreDictionary.getOreID(oreDictName); final int oreDictId = OreDictionary.getOreID(oreDictName);

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