Check volatiles. Fixed Portable Grid losing enchantments when placing and breaking.
This commit is contained in:
		@@ -1,5 +1,8 @@
 | 
			
		||||
# Refined Storage Changelog
 | 
			
		||||
 | 
			
		||||
### 1.9.6
 | 
			
		||||
- Fixed Portable Grid losing enchantments when placing and breaking (raoulvdberge)
 | 
			
		||||
 | 
			
		||||
### 1.9.5
 | 
			
		||||
- Re-added the `/refinedstorage disk create <player> <id>` command (raoulvdberge)
 | 
			
		||||
- Added the `/refinedstorage disk list` command (raoulvdberge)
 | 
			
		||||
 
 | 
			
		||||
@@ -146,17 +146,14 @@ public class ConstructorNetworkNode extends NetworkNode implements IComparable,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // @Volatile: From BlockDispenser#getDispensePosition
 | 
			
		||||
    private double getDispensePositionX() {
 | 
			
		||||
        return (double) pos.getX() + 0.5D + 0.8D * (double) getDirection().getXOffset();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // @Volatile: From BlockDispenser#getDispensePosition
 | 
			
		||||
    private double getDispensePositionY() {
 | 
			
		||||
        return (double) pos.getY() + (getDirection() == Direction.DOWN ? 0.45D : 0.5D) + 0.8D * (double) getDirection().getYOffset();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // @Volatile: From BlockDispenser#getDispensePosition
 | 
			
		||||
    private double getDispensePositionZ() {
 | 
			
		||||
        return (double) pos.getZ() + 0.5D + 0.8D * (double) getDirection().getZOffset();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -162,7 +162,6 @@ public abstract class BaseContainer extends Container {
 | 
			
		||||
 | 
			
		||||
    private boolean isTileStillThere() {
 | 
			
		||||
        if (tile != null) {
 | 
			
		||||
            // @Volatile: Logic from LockableLootTileEntity#isUsableByPlayer
 | 
			
		||||
            return tile.getWorld().getTileEntity(tile.getPos()) == tile;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -53,8 +53,9 @@ public class UpgradeWithEnchantedBookRecipe extends ShapedRecipe {
 | 
			
		||||
            for (int i = 0; i < enchantments.size(); ++i) {
 | 
			
		||||
                CompoundNBT enchantmentNbt = enchantments.getCompound(i);
 | 
			
		||||
 | 
			
		||||
                // @Volatile: NBT tags from ItemEnchantedBook
 | 
			
		||||
                if (ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(enchantmentNbt.getString("id"))) == enchant.enchantment && enchantmentNbt.getShort("lvl") == enchant.enchantmentLevel) {
 | 
			
		||||
                // @Volatile: NBT tags from EnchantedBookItem
 | 
			
		||||
                if (ForgeRegistries.ENCHANTMENTS.getValue(new ResourceLocation(enchantmentNbt.getString("id"))) == enchant.enchantment &&
 | 
			
		||||
                    enchantmentNbt.getShort("lvl") == enchant.enchantmentLevel) {
 | 
			
		||||
                    return true;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -117,7 +117,8 @@ public class PortableGridTile extends BaseTile implements IGrid, IPortableGrid,
 | 
			
		||||
    private static final String NBT_FLUID_STORAGE_TRACKER = "FluidStorageTracker";
 | 
			
		||||
    private static final String NBT_TYPE = "Type";
 | 
			
		||||
    private static final String NBT_ENERGY = "Energy";
 | 
			
		||||
    private static final String NBT_ENCHANTMENTS = "ench"; // @Volatile: minecraft specific nbt key
 | 
			
		||||
    private static final String NBT_ENCHANTMENTS = "Enchantments"; // @Volatile: Minecraft specific nbt key, see EnchantmentHelper
 | 
			
		||||
 | 
			
		||||
    private EnergyStorage energyStorage = createEnergyStorage(0);
 | 
			
		||||
    private final LazyOptional<EnergyStorage> energyStorageCap = LazyOptional.of(() -> energyStorage);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user