Merge branch 'rv1' of https://bitbucket.org/AlgorithmX2/appliedenergistics2 into rv2
This commit is contained in:
@@ -38,7 +38,6 @@ import appeng.client.render.BlockRenderInfo;
|
||||
import appeng.client.render.WorldRender;
|
||||
import appeng.client.texture.FlipableIcon;
|
||||
import appeng.client.texture.MissingIcon;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.features.AEFeatureHandler;
|
||||
import appeng.core.features.IAEFeature;
|
||||
|
||||
@@ -49,6 +49,7 @@ import appeng.tile.networking.TileCableBusTESR;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
import appeng.transformer.annotations.integration.Method;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -402,6 +403,7 @@ public class BlockCableBus extends AEBaseBlock implements IRedNetConnection
|
||||
if ( Platform.isClient() )
|
||||
{
|
||||
tesrTile = Api.instance.partHelper.getCombinedInstance( TileCableBusTESR.class.getName() );
|
||||
GameRegistry.registerTileEntity( tesrTile, "ClientOnly_TESR_CableBus" );
|
||||
CommonHelper.proxy.bindTileEntitySpecialRenderer( tesrTile, this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,9 @@ public class ClientHelper extends ServerHelper
|
||||
public void triggerUpdates()
|
||||
{
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
if ( mc == null || mc.thePlayer == null || mc.theWorld == null )
|
||||
return;
|
||||
|
||||
EntityPlayer player = mc.thePlayer;
|
||||
|
||||
if ( player == null )
|
||||
@@ -137,7 +140,7 @@ public class ClientHelper extends ServerHelper
|
||||
GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F );
|
||||
// GL11.glDisable( GL11.GL_CULL_FACE );
|
||||
|
||||
if ( itemstack.isItemEnchanted() )
|
||||
if ( itemstack.isItemEnchanted() || itemstack.getItem().requiresMultipleRenderPasses() )
|
||||
{
|
||||
GL11.glTranslatef( 0.0f, -0.05f, -0.25f );
|
||||
GL11.glScalef( 1.0f / 1.5f, 1.0f / 1.5f, 1.0f / 1.5f );
|
||||
|
||||
@@ -73,10 +73,10 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
{
|
||||
try
|
||||
{
|
||||
DecimalFormat df = new DecimalFormat("+#;-#");
|
||||
DecimalFormat df = new DecimalFormat( "+#;-#" );
|
||||
return df.parse( btn.displayString ).intValue();
|
||||
}
|
||||
catch(ParseException e )
|
||||
catch (ParseException e)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -597,6 +597,7 @@ public abstract class AEBaseGui extends GuiContainer
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
GL11.glEnable( GL11.GL_LIGHTING );
|
||||
GL11.glEnable( GL12.GL_RESCALE_NORMAL );
|
||||
GL11.glEnable( GL11.GL_DEPTH_TEST );
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
itemRender.renderItemAndEffectIntoGUI( this.fontRendererObj, this.mc.renderEngine, is, x, y );
|
||||
GL11.glPopAttrib();
|
||||
|
||||
@@ -44,6 +44,7 @@ public class ItemRepo
|
||||
public int rowSize = 9;
|
||||
|
||||
public String searchString = "";
|
||||
private String innerSearch = "";
|
||||
|
||||
public ItemRepo(IScrollSource src, ISortSource sortSrc) {
|
||||
this.src = src;
|
||||
@@ -172,7 +173,7 @@ public class ItemRepo
|
||||
Method b = searchField.getClass().getMethod( "onTextChange", String.class );
|
||||
|
||||
NEIWord = filter;
|
||||
a.invoke( searchField, filter );
|
||||
a.invoke( searchField, new String( filter ) );
|
||||
b.invoke( searchField, "" );
|
||||
}
|
||||
}
|
||||
@@ -195,26 +196,27 @@ public class ItemRepo
|
||||
if ( mode == SearchBoxMode.NEI_AUTOSEARCH || mode == SearchBoxMode.NEI_MANUAL_SEARCH )
|
||||
updateNEI( searchString );
|
||||
|
||||
innerSearch = searchString;
|
||||
boolean terminalSearchToolTips = AEConfig.instance.settings.getSetting( Settings.SEARCH_TOOLTIPS ) != YesNo.NO;
|
||||
// boolean terminalSearchMods = Configuration.instance.settings.getSetting( Settings.SEARCH_MODS ) != YesNo.NO;
|
||||
|
||||
boolean searchMod = false;
|
||||
if ( searchString.startsWith( "@" ) )
|
||||
if ( innerSearch.startsWith( "@" ) )
|
||||
{
|
||||
searchMod = true;
|
||||
searchString = searchString.substring( 1 );
|
||||
innerSearch = innerSearch.substring( 1 );
|
||||
}
|
||||
|
||||
Pattern m = null;
|
||||
try
|
||||
{
|
||||
m = Pattern.compile( searchString.toLowerCase(), Pattern.CASE_INSENSITIVE );
|
||||
m = Pattern.compile( innerSearch.toLowerCase(), Pattern.CASE_INSENSITIVE );
|
||||
}
|
||||
catch (Throwable _)
|
||||
{
|
||||
try
|
||||
{
|
||||
m = Pattern.compile( Pattern.quote( searchString.toLowerCase() ), Pattern.CASE_INSENSITIVE );
|
||||
m = Pattern.compile( Pattern.quote( innerSearch.toLowerCase() ), Pattern.CASE_INSENSITIVE );
|
||||
}
|
||||
catch (Throwable __)
|
||||
{
|
||||
|
||||
@@ -669,6 +669,14 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer, int offset_x, int offset_y)
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
if ( locked.contains( i ) )
|
||||
addSlotToContainer( new SlotDisabled( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
else
|
||||
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 9; j++)
|
||||
@@ -679,14 +687,6 @@ public abstract class AEBaseContainer extends Container
|
||||
addSlotToContainer( new SlotPlayerInv( inventoryPlayer, j + i * 9 + 9, 8 + j * 18 + offset_x, offset_y + i * 18 ) );
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
if ( locked.contains( i ) )
|
||||
addSlotToContainer( new SlotDisabled( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
else
|
||||
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack shiftStoreItem(ItemStack input)
|
||||
|
||||
+23
-5
@@ -1,7 +1,9 @@
|
||||
package appeng.core;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
@@ -22,6 +24,7 @@ import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.client.event.ConfigChangedEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.ModContainer;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class AEConfig extends Configuration implements IConfigureableObject, IConfigManagerHost
|
||||
@@ -91,8 +94,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
return prop;
|
||||
}
|
||||
|
||||
public double spatialPowerScaler = 1.5;
|
||||
public double spatialPowerMultiplier = 1500.0;
|
||||
public double spatialPowerScaler = 1.35;
|
||||
public double spatialPowerMultiplier = 1250.0;
|
||||
|
||||
public String grinderOres[] = {
|
||||
// Vanilla Items
|
||||
@@ -102,7 +105,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
// AE
|
||||
"CertusQuartz", "Wheat", "Fluix",
|
||||
// Other Mod Ores
|
||||
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum" };
|
||||
"Brass", "Platinum", "Nickel", "Invar", "Aluminium", "Electrum", "Osmium" };
|
||||
|
||||
public double oreDoublePercentage = 90.0;
|
||||
|
||||
@@ -127,6 +130,8 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
public double metoriteClusterChance = 0.1;
|
||||
public double metoriteSpawnChance = 0.3;
|
||||
|
||||
public int craftingCalculationTimePerTick = 5;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent eventArgs)
|
||||
{
|
||||
@@ -268,8 +273,13 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
featureFlags.add( feature );
|
||||
}
|
||||
|
||||
if ( cpw.mods.fml.common.Loader.isModLoaded( "ImmibisMicroblocks" ) )
|
||||
featureFlags.remove( AEFeature.AlphaPass );
|
||||
ModContainer imb = cpw.mods.fml.common.Loader.instance().getIndexedModList().get( "ImmibisCore" );
|
||||
if ( imb != null )
|
||||
{
|
||||
List<String> version = Arrays.asList( new String[] { "59.0.0", "59.0.1", "59.0.2" } );
|
||||
if ( version.contains( imb.getVersion() ) )
|
||||
featureFlags.remove( AEFeature.AlphaPass );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
@@ -289,6 +299,14 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||
{
|
||||
storageBiomeID = get( "spatialio", "storageBiomeID", storageBiomeID ).getInt( storageBiomeID );
|
||||
storageProviderID = get( "spatialio", "storageProviderID", storageProviderID ).getInt( storageProviderID );
|
||||
spatialPowerMultiplier = get( "spatialio", "spatialPowerMultiplier", spatialPowerMultiplier ).getDouble( spatialPowerMultiplier );
|
||||
spatialPowerScaler = get( "spatialio", "spatialPowerScaler", spatialPowerScaler ).getDouble( spatialPowerScaler );
|
||||
}
|
||||
|
||||
if ( isFeatureEnabled( AEFeature.CraftingCPU ) )
|
||||
{
|
||||
craftingCalculationTimePerTick = get( "craftingcpu", "craftingCalculationTimePerTick", craftingCalculationTimePerTick ).getInt(
|
||||
craftingCalculationTimePerTick );
|
||||
}
|
||||
|
||||
if ( isFeatureEnabled( AEFeature.VersionChecker ) )
|
||||
|
||||
+19
-11
@@ -1,5 +1,7 @@
|
||||
package appeng.core;
|
||||
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -14,6 +16,7 @@ import java.util.WeakHashMap;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.nbt.CompressedStreamTools;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraftforge.common.DimensionManager;
|
||||
import net.minecraftforge.common.config.ConfigCategory;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
@@ -280,22 +283,27 @@ public class WorldSettings extends Configuration
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void sendToPlayer(EntityPlayerMP player)
|
||||
public void sendToPlayer(NetworkManager manager, EntityPlayerMP player)
|
||||
{
|
||||
for (int newDim : get( "DimensionManager", "StorageCells", new int[0] ).getIntList())
|
||||
if ( manager != null )
|
||||
{
|
||||
try
|
||||
for (int newDim : get( "DimensionManager", "StorageCells", new int[0] ).getIntList())
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketNewStorageDimension( newDim ), player );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
try
|
||||
{
|
||||
manager.scheduleOutboundPacket( (new PacketNewStorageDimension( newDim )).getProxy(), new GenericFutureListener[0] );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (PlayerColor pc : TickHandler.instance.getPlayerColors().values())
|
||||
NetworkHandler.instance.sendToAll( pc.getPacket() );
|
||||
else
|
||||
{
|
||||
for (PlayerColor pc : TickHandler.instance.getPlayerColors().values())
|
||||
NetworkHandler.instance.sendToAll( pc.getPacket() );
|
||||
}
|
||||
}
|
||||
|
||||
public void init()
|
||||
|
||||
@@ -28,6 +28,7 @@ import appeng.api.networking.security.ISecurityGrid;
|
||||
import appeng.api.parts.IPart;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.storage.ITerminalHost;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.gui.GuiNull;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerNull;
|
||||
@@ -75,7 +76,6 @@ import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.parts.reporting.PartCraftingTerminal;
|
||||
import appeng.parts.reporting.PartMonitor;
|
||||
import appeng.parts.reporting.PartPatternTerminal;
|
||||
import appeng.server.AccessType;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
@@ -395,7 +395,7 @@ public enum GuiBridge implements IGuiHandler
|
||||
{
|
||||
World w = player.getEntityWorld();
|
||||
|
||||
if ( Platform.hasPermissions( x, y, z, player, AccessType.BLOCK_ACCESS ) )
|
||||
if ( Platform.hasPermissions( te != null ? new DimensionalCoord( te ) : new DimensionalCoord( player.worldObj, x, y, z ), player ) )
|
||||
{
|
||||
if ( type.isItem() )
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||
import cpw.mods.fml.common.network.FMLEventChannel;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ClientCustomPacketEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerConnectionFromClientEvent;
|
||||
import cpw.mods.fml.common.network.FMLNetworkEvent.ServerCustomPacketEvent;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
|
||||
@@ -56,11 +57,17 @@ public class NetworkHandler
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void newConection(ServerConnectionFromClientEvent ev)
|
||||
{
|
||||
WorldSettings.getInstance().sendToPlayer( ev.manager, null );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void newConection(PlayerLoggedInEvent loginEvent)
|
||||
{
|
||||
if ( loginEvent.player instanceof EntityPlayerMP )
|
||||
WorldSettings.getInstance().sendToPlayer( (EntityPlayerMP) loginEvent.player );
|
||||
WorldSettings.getInstance().sendToPlayer( null, (EntityPlayerMP) loginEvent.player );
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
|
||||
@@ -2,7 +2,6 @@ package appeng.debug;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
+11
-5
@@ -16,6 +16,7 @@ import appeng.api.AEApi;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.parts.CableRenderMode;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.CommonHelper;
|
||||
import appeng.core.sync.packets.PacketPaintedEntity;
|
||||
@@ -210,12 +211,17 @@ public class TickHandler
|
||||
WorldTickEvent wte = (WorldTickEvent) ev;
|
||||
synchronized (craftingJobs)
|
||||
{
|
||||
Iterator<CraftingJob> i = craftingJobs.get( wte.world ).iterator();
|
||||
while (i.hasNext())
|
||||
Collection<CraftingJob> jobSet = craftingJobs.get( wte.world );
|
||||
if ( !jobSet.isEmpty() )
|
||||
{
|
||||
CraftingJob cj = i.next();
|
||||
if ( !cj.simulateFor( 5 ) )
|
||||
i.remove();
|
||||
int simTime = Math.max( 1, AEConfig.instance.craftingCalculationTimePerTick / jobSet.size() );
|
||||
Iterator<CraftingJob> i = jobSet.iterator();
|
||||
while (i.hasNext())
|
||||
{
|
||||
CraftingJob cj = i.next();
|
||||
if ( !cj.simulateFor( simTime ) )
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package appeng.integration.modules;
|
||||
|
||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
||||
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.integration.IIntegrationModule;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
||||
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.config.Actionable;
|
||||
@@ -34,7 +34,7 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
return null;
|
||||
|
||||
ItemStack failed = cs.insertItems( side, input.getItemStack() );
|
||||
ItemStack failed = cs.insertItems( input.getItemStack() );
|
||||
if ( failed == null )
|
||||
return null;
|
||||
input.setStackSize( failed.stackSize );
|
||||
@@ -46,18 +46,18 @@ public class BSCrate implements IMEInventory<IAEItemStack>
|
||||
{
|
||||
if ( mode == Actionable.SIMULATE )
|
||||
{
|
||||
int howMany = cs.getItemCount( side, request.getItemStack() );
|
||||
int howMany = cs.getItemCount( request.getItemStack() );
|
||||
return howMany > request.getStackSize() ? request : request.copy().setStackSize( howMany );
|
||||
}
|
||||
|
||||
ItemStack Obtained = cs.extractItems( side, request.getItemStack() );
|
||||
ItemStack Obtained = cs.extractItems( request.getItemStack(), (int) request.getStackSize() );
|
||||
return AEItemStack.create( Obtained );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemList getAvailableItems(IItemList out)
|
||||
{
|
||||
for (ItemStack is : cs.getContents( side ))
|
||||
for (ItemStack is : cs.getContents())
|
||||
{
|
||||
out.add( AEItemStack.create( is ) );
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package appeng.integration.modules.helpers;
|
||||
|
||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
||||
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
|
||||
@@ -2,7 +2,7 @@ package appeng.integration.modules.helpers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.mcft.copy.betterstorage.api.ICrateStorage;
|
||||
import net.mcft.copy.betterstorage.api.crate.ICrateStorage;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
@@ -28,7 +28,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : cs.getContents( side ))
|
||||
for (ItemStack is : cs.getContents())
|
||||
{
|
||||
if ( is != null )
|
||||
{
|
||||
@@ -47,7 +47,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
ItemStack f = Platform.cloneItemStack( target );
|
||||
f.stackSize = how_many;
|
||||
return cs.extractItems( side, f );
|
||||
return cs.extractItems( f, how_many );
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -58,7 +58,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : cs.getContents( side ))
|
||||
for (ItemStack is : cs.getContents())
|
||||
{
|
||||
if ( is != null )
|
||||
{
|
||||
@@ -75,7 +75,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
|
||||
if ( target != null )
|
||||
{
|
||||
int cnt = cs.getItemCount( side, target );
|
||||
int cnt = cs.getItemCount( target );
|
||||
if ( cnt == 0 )
|
||||
return null;
|
||||
if ( cnt > how_many )
|
||||
@@ -93,7 +93,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : cs.getContents( side ))
|
||||
for (ItemStack is : cs.getContents())
|
||||
{
|
||||
if ( is != null )
|
||||
{
|
||||
@@ -112,7 +112,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
ItemStack f = Platform.cloneItemStack( target );
|
||||
f.stackSize = amount;
|
||||
return cs.extractItems( side, f );
|
||||
return cs.extractItems( f, amount );
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -123,7 +123,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
{
|
||||
ItemStack target = null;
|
||||
|
||||
for (ItemStack is : cs.getContents( side ))
|
||||
for (ItemStack is : cs.getContents())
|
||||
{
|
||||
if ( is != null )
|
||||
{
|
||||
@@ -140,7 +140,7 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
|
||||
if ( target != null )
|
||||
{
|
||||
int cnt = cs.getItemCount( side, target );
|
||||
int cnt = cs.getItemCount( target );
|
||||
if ( cnt == 0 )
|
||||
return null;
|
||||
if ( cnt > how_many )
|
||||
@@ -156,13 +156,13 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
@Override
|
||||
public ItemStack addItems(ItemStack A)
|
||||
{
|
||||
return cs.insertItems( side, A );
|
||||
return cs.insertItems( A );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack simulateAdd(ItemStack A)
|
||||
{
|
||||
int items = cs.spaceForItem( side, A );
|
||||
int items = cs.getSpaceForItem( A );
|
||||
ItemStack B = Platform.cloneItemStack( A );
|
||||
if ( A.stackSize <= items )
|
||||
return null;
|
||||
@@ -173,13 +173,13 @@ public class BSCrateStorageAdaptor extends InventoryAdaptor
|
||||
@Override
|
||||
public boolean containsItems()
|
||||
{
|
||||
return cs.getContents( side ).size() > 0;
|
||||
return cs.getUniqueItems() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<ItemSlot> iterator()
|
||||
{
|
||||
return new StackToSlotIterator( cs.getContents( side ).iterator() );
|
||||
return new StackToSlotIterator( cs.getContents().iterator() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.INetworkToolAgent;
|
||||
import appeng.client.ClientHelper;
|
||||
import appeng.container.AEBaseContainer;
|
||||
@@ -110,6 +111,9 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench,
|
||||
{
|
||||
if ( side >= 0 )
|
||||
{
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
return false;
|
||||
|
||||
Block b = w.getBlock( x, y, z );
|
||||
if ( b != null && !p.isSneaking() )
|
||||
{
|
||||
|
||||
@@ -35,6 +35,7 @@ import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.misc.BlockPaint;
|
||||
import appeng.block.networking.BlockCableBus;
|
||||
import appeng.client.render.items.ToolColorApplicatorRender;
|
||||
@@ -226,6 +227,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
||||
else
|
||||
paintBall = null;
|
||||
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
return false;
|
||||
|
||||
if ( paintBall != null && paintBall.getItem() instanceof ItemSnowball )
|
||||
{
|
||||
ForgeDirection oside = ForgeDirection.getOrientation( side );
|
||||
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.util.MovingObjectPosition.MovingObjectType;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.features.AEFeature;
|
||||
@@ -193,7 +194,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
|
||||
if ( w.getBlock( x, y, z ).getMaterial() == Material.lava || w.getBlock( x, y, z ).getMaterial() == Material.water )
|
||||
{
|
||||
if ( w.canMineBlock( p, x, y, z ) )
|
||||
if ( Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
{
|
||||
onItemUse( item, p, w, x, y, z, 0, 0.0F, 0.0F, 0.0F );
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IAEStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.CommonHelper;
|
||||
@@ -265,6 +266,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
int y = pos.blockY + side.offsetY;
|
||||
int z = pos.blockZ + side.offsetZ;
|
||||
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( w, x, y, z ), p ) )
|
||||
return;
|
||||
|
||||
Block whatsThere = w.getBlock( x, y, z );
|
||||
if ( whatsThere == AEApi.instance().blocks().blockPaint.block() )
|
||||
{
|
||||
@@ -398,7 +402,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
float hardness = b.getBlockHardness( w, pos.blockX, pos.blockY, pos.blockZ ) * 9.0f;
|
||||
if ( hardness >= 0.0 )
|
||||
{
|
||||
if ( penitration > hardness )
|
||||
if ( penitration > hardness && Platform.hasPermissions( new DimensionalCoord( w, pos.blockX, pos.blockY, pos.blockZ ), p ) )
|
||||
{
|
||||
hasDestroyedSomething = true;
|
||||
penitration -= hardness;
|
||||
|
||||
@@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.transformer.annotations.integration.Interface;
|
||||
@@ -28,8 +29,11 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWren
|
||||
public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
Block b = world.getBlock( x, y, z );
|
||||
if ( b != null && !player.isSneaking() )
|
||||
if ( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
ForgeDirection mySide = ForgeDirection.getOrientation( side );
|
||||
if ( b.rotateBlock( world, x, y, z, mySide ) )
|
||||
{
|
||||
|
||||
Vendored
+4
-3
@@ -157,14 +157,15 @@ public class SpatialPylonCache implements IGridCache, ISpatialCache
|
||||
reqX = captureMax.x - captureMin.x;
|
||||
reqY = captureMax.y - captureMin.y;
|
||||
reqZ = captureMax.z - captureMin.z;
|
||||
requirePylongBlocks = ((reqX * reqZ + reqX * reqY + reqY * reqZ) * 3) / 5;
|
||||
|
||||
requirePylongBlocks = Math.max( 6, ((reqX * reqZ + reqX * reqY + reqY * reqZ) * 3) / 8 );
|
||||
|
||||
effiency = (double) pylonBlocks / (double) requirePylongBlocks;
|
||||
|
||||
if ( effiency > 1.0 )
|
||||
effiency = 1.0;
|
||||
if ( effiency < 0.0 )
|
||||
effiency = 0.0;
|
||||
|
||||
|
||||
minPower = (double) reqX * (double) reqY * reqZ * AEConfig.instance.spatialPowerMultiplier;
|
||||
maxPower = Math.pow( minPower, AEConfig.instance.spatialPowerScaler );
|
||||
}
|
||||
|
||||
@@ -491,7 +491,6 @@ public class CableBusContainer extends CableBusStorage implements AEMultiTile, I
|
||||
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
TileEntity te = getTile();
|
||||
hasRedstone = YesNo.UNDECIDED;
|
||||
|
||||
for (ForgeDirection s : ForgeDirection.values())
|
||||
|
||||
@@ -25,6 +25,7 @@ import appeng.api.parts.IPartHost;
|
||||
import appeng.api.parts.IPartItem;
|
||||
import appeng.api.parts.PartItemStack;
|
||||
import appeng.api.parts.SelectedPart;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
import appeng.core.CommonHelper;
|
||||
@@ -123,6 +124,9 @@ public class PartPlacement
|
||||
|
||||
if ( held != null && Platform.isWrench( player, held, x, y, z ) && player.isSneaking() )
|
||||
{
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( world, x, y, z ), player ) )
|
||||
return false;
|
||||
|
||||
Block block = world.getBlock( x, y, z );
|
||||
TileEntity tile = world.getTileEntity( x, y, z );
|
||||
IPartHost host = null;
|
||||
@@ -134,7 +138,7 @@ public class PartPlacement
|
||||
{
|
||||
if ( !world.isRemote )
|
||||
{
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset(player) );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
|
||||
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
|
||||
if ( mop != null )
|
||||
{
|
||||
@@ -247,7 +251,7 @@ public class PartPlacement
|
||||
Block block = world.getBlock( x, y, z );
|
||||
if ( host != null && player.isSneaking() && block != null )
|
||||
{
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset(player) );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
|
||||
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
|
||||
if ( mop != null )
|
||||
{
|
||||
@@ -306,6 +310,9 @@ public class PartPlacement
|
||||
if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.FMP ) )
|
||||
host = ((IFMP) AppEng.instance.getIntegration( IntegrationType.FMP )).getOrCreateHost( tile );
|
||||
|
||||
if ( host == null && tile != null && AppEng.instance.isIntegrationEnabled( IntegrationType.ImmibisMicroblocks ) )
|
||||
host = ((IImmibisMicroblocks) AppEng.instance.getIntegration( IntegrationType.ImmibisMicroblocks )).getOrCreateHost( player, face, tile );
|
||||
|
||||
if ( host == null && AEApi.instance().blocks().blockMultiPart.block().canPlaceBlockAt( world, te_x, te_y, te_z )
|
||||
&& ib.placeBlockAt( is, player, world, te_x, te_y, te_z, side.ordinal(), 0.5f, 0.5f, 0.5f, 0 ) )
|
||||
{
|
||||
@@ -365,7 +372,7 @@ public class PartPlacement
|
||||
if ( !world.isRemote )
|
||||
{
|
||||
Block block = world.getBlock( x, y, z );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset(player) );
|
||||
LookDirection dir = Platform.getPlayerRay( player, getEyeOffset( player ) );
|
||||
MovingObjectPosition mop = block.collisionRayTrace( world, x, y, z, dir.a, dir.b );
|
||||
if ( mop != null )
|
||||
{
|
||||
@@ -378,6 +385,10 @@ public class PartPlacement
|
||||
}
|
||||
}
|
||||
|
||||
DimensionalCoord dc = host.getLocation();
|
||||
if ( !Platform.hasPermissions( dc, player ) )
|
||||
return false;
|
||||
|
||||
ForgeDirection mySide = host.addPart( held, side, player );
|
||||
if ( mySide != null )
|
||||
{
|
||||
@@ -413,11 +424,12 @@ public class PartPlacement
|
||||
}
|
||||
|
||||
public static float eyeHeight = 0.0f;
|
||||
private static float getEyeOffset( EntityPlayer p )
|
||||
|
||||
private static float getEyeOffset(EntityPlayer p)
|
||||
{
|
||||
if ( p.worldObj.isRemote )
|
||||
return Platform.getEyeOffset( p );
|
||||
|
||||
|
||||
return eyeHeight;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ public class PartConversionMonitor extends PartStorageMonitor
|
||||
if ( !proxy.isActive() )
|
||||
return false;
|
||||
|
||||
if ( !Platform.hasPermissions( getLocation(), player ) )
|
||||
return false;
|
||||
|
||||
boolean ModeB = false;
|
||||
|
||||
ItemStack item = player.getCurrentEquippedItem();
|
||||
|
||||
@@ -111,6 +111,9 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
if ( !proxy.isActive() )
|
||||
return false;
|
||||
|
||||
if ( !Platform.hasPermissions( getLocation(), player ) )
|
||||
return false;
|
||||
|
||||
TileEntity te = this.tile;
|
||||
ItemStack eq = player.getCurrentEquippedItem();
|
||||
if ( Platform.isWrench( player, eq, te.xCoord, te.yCoord, te.zCoord ) )
|
||||
@@ -207,7 +210,7 @@ public class PartStorageMonitor extends PartMonitor implements IPartStorageMonit
|
||||
{
|
||||
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||
ForgeDirection d = side;
|
||||
GL11.glTranslated( d.offsetX * 0.76, d.offsetY * 0.76, d.offsetZ * 0.76 );
|
||||
GL11.glTranslated( d.offsetX * 0.77, d.offsetY * 0.77, d.offsetZ * 0.77 );
|
||||
|
||||
if ( d == ForgeDirection.UP )
|
||||
{
|
||||
|
||||
@@ -19,8 +19,8 @@ import appeng.api.implementations.items.IAEItemPowerStorage;
|
||||
import appeng.api.implementations.tiles.ICrankable;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.server.AccessType;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkPowerTile;
|
||||
@@ -214,7 +214,7 @@ public class TileCharger extends AENetworkPowerTile implements ICrankable
|
||||
|
||||
public void activate(EntityPlayer player)
|
||||
{
|
||||
if ( !Platform.hasPermissions( xCoord, yCoord, zCoord, player, AccessType.BLOCK_ACCESS ) )
|
||||
if ( !Platform.hasPermissions( new DimensionalCoord( this ), player ) )
|
||||
return;
|
||||
|
||||
ItemStack myItem = getStackInSlot( 0 );
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
|
||||
|
||||
if ( te instanceof EntityPlayer )
|
||||
{
|
||||
return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory ) );
|
||||
return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory, false ) );
|
||||
}
|
||||
else if ( te instanceof ArrayList )
|
||||
{
|
||||
|
||||
+5
-5
@@ -87,6 +87,7 @@ import appeng.api.storage.data.IAETagCompound;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.AEItemDefinition;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.AppEng;
|
||||
@@ -98,7 +99,6 @@ import appeng.integration.IntegrationType;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.me.GridNode;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.server.AccessType;
|
||||
import appeng.util.item.AEItemStack;
|
||||
import appeng.util.item.AESharedNBT;
|
||||
import appeng.util.item.OreHelper;
|
||||
@@ -315,9 +315,9 @@ public class Platform
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean hasPermissions(int x, int y, int z, EntityPlayer player, AccessType blockAccess)
|
||||
public static boolean hasPermissions(DimensionalCoord dc, EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
return dc.getWorld().canMineBlock( player, dc.x, dc.y, dc.z );
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1208,7 +1208,7 @@ public class Platform
|
||||
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f;
|
||||
double d1 = eyeoffset;
|
||||
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f;
|
||||
|
||||
|
||||
Vec3 vec3 = Vec3.createVectorHelper( d0, d1, d2 );
|
||||
float f3 = MathHelper.cos( -f2 * 0.017453292F - (float) Math.PI );
|
||||
float f4 = MathHelper.sin( -f2 * 0.017453292F - (float) Math.PI );
|
||||
@@ -1795,6 +1795,6 @@ public class Platform
|
||||
public static float getEyeOffset(EntityPlayer player)
|
||||
{
|
||||
assert player.worldObj.isRemote : "Valid only on client";
|
||||
return (float) (player.posY +player.getEyeHeight() - player.getDefaultEyeHeight());
|
||||
return (float) (player.posY + player.getEyeHeight() - player.getDefaultEyeHeight());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
package appeng.util.inv;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class AdaptorPlayerInventory implements IInventory
|
||||
{
|
||||
|
||||
private InventoryPlayer src;
|
||||
private int min;
|
||||
private int size;
|
||||
private final IInventory src;
|
||||
private final int min=0;
|
||||
private final int size=36;
|
||||
|
||||
public AdaptorPlayerInventory(InventoryPlayer a) {
|
||||
src = a;
|
||||
min = 0; // a.getStartInventorySide( d );
|
||||
size = 36; // a.getSizeInventorySide( d );
|
||||
public AdaptorPlayerInventory(IInventory playerInv, boolean swap)
|
||||
{
|
||||
|
||||
if ( swap )
|
||||
src = new WrapperChainedInventory( new WrapperInventoryRange( playerInv, 9, size-9, false ), new WrapperInventoryRange( playerInv, 0, 9, false ) );
|
||||
else
|
||||
src = playerInv;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -24,7 +26,7 @@ public class WrapperChainedInventory implements IInventory
|
||||
private List<IInventory> l;
|
||||
private HashMap<Integer, InvOffset> offsets;
|
||||
|
||||
public WrapperChainedInventory(IInventory ilist) {
|
||||
public WrapperChainedInventory(IInventory... ilist) {
|
||||
setInventory( ilist );
|
||||
}
|
||||
|
||||
@@ -67,10 +69,9 @@ public class WrapperChainedInventory implements IInventory
|
||||
fullSize = offset;
|
||||
}
|
||||
|
||||
public void setInventory(IInventory a)
|
||||
public void setInventory(IInventory... a)
|
||||
{
|
||||
l = new ArrayList();
|
||||
l.add( a );
|
||||
l = ImmutableList.copyOf( a );
|
||||
calculateSizes();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user