Fix Block Cable Painting Support.
This commit is contained in:
@@ -57,10 +57,15 @@ public class BlockCableBus extends AEBaseBlock
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour)
|
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour)
|
||||||
|
{
|
||||||
|
return recolourBlock( world, x, y, z, side, colour, null );
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour, EntityPlayer who)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return cb( world, x, y, z ).recolourBlock( side, colour );
|
return cb( world, x, y, z ).recolourBlock( side, colour, who );
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch (Throwable t)
|
||||||
{
|
{
|
||||||
|
|||||||
Vendored
+1
-1
@@ -56,7 +56,7 @@ public class SecurityCache implements IGridCache, ISecurityGrid
|
|||||||
@Override
|
@Override
|
||||||
public boolean hasPermission(EntityPlayer player, SecurityPermissions perm)
|
public boolean hasPermission(EntityPlayer player, SecurityPermissions perm)
|
||||||
{
|
{
|
||||||
return hasPermission( WorldSettings.getInstance().getPlayerID( player.getCommandSenderName() ), perm );
|
return hasPermission( player == null ? -1 : WorldSettings.getInstance().getPlayerID( player.getCommandSenderName() ), perm );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -782,7 +782,8 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
return light;
|
return light;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean recolourBlock(ForgeDirection side, int colour)
|
@Override
|
||||||
|
public boolean recolourBlock(ForgeDirection side, int colour, EntityPlayer who)
|
||||||
{
|
{
|
||||||
IPart cable = getPart( ForgeDirection.UNKNOWN );
|
IPart cable = getPart( ForgeDirection.UNKNOWN );
|
||||||
if ( cable != null )
|
if ( cable != null )
|
||||||
@@ -791,7 +792,7 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
|
|||||||
|
|
||||||
AEColor colors[] = AEColor.values();
|
AEColor colors[] = AEColor.values();
|
||||||
if ( colors.length > colour )
|
if ( colors.length > colour )
|
||||||
return pc.changeColor( colors[colour] );
|
return pc.changeColor( colors[colour], who );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ public interface ICableBusContainer
|
|||||||
|
|
||||||
SelectedPart selectPart(Vec3 v3);
|
SelectedPart selectPart(Vec3 v3);
|
||||||
|
|
||||||
boolean recolourBlock(ForgeDirection side, int colour);
|
boolean recolourBlock(ForgeDirection side, int colour, EntityPlayer who);
|
||||||
|
|
||||||
boolean isLadder(EntityLivingBase entity);
|
boolean isLadder(EntityLivingBase entity);
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class NullCableBusContainer implements ICableBusContainer
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean recolourBlock(ForgeDirection side, int colour)
|
public boolean recolourBlock(ForgeDirection side, int colour, EntityPlayer who)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.util.EnumSet;
|
|||||||
|
|
||||||
import net.minecraft.client.renderer.RenderBlocks;
|
import net.minecraft.client.renderer.RenderBlocks;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.IIcon;
|
import net.minecraft.util.IIcon;
|
||||||
@@ -15,6 +16,7 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
import org.lwjgl.opengl.GL11;
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.implementations.parts.IPartCable;
|
import appeng.api.implementations.parts.IPartCable;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
import appeng.api.networking.IGridConnection;
|
import appeng.api.networking.IGridConnection;
|
||||||
@@ -879,13 +881,41 @@ public class PartCable extends AEBasePart implements IPartCable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean changeColor(AEColor newColor)
|
public boolean changeColor(AEColor newColor, EntityPlayer who)
|
||||||
{
|
{
|
||||||
if ( getCableColor() != newColor )
|
if ( getCableColor() != newColor )
|
||||||
{
|
{
|
||||||
is.setItemDamage( newColor.ordinal() );
|
ItemStack newPart = null;
|
||||||
markForUpdate();
|
|
||||||
return true;
|
if ( getCableConnectionType() == AECableType.GLASS )
|
||||||
|
newPart = AEApi.instance().parts().partCableGlass.stack( newColor, 1 );
|
||||||
|
else if ( getCableConnectionType() == AECableType.COVERED )
|
||||||
|
newPart = AEApi.instance().parts().partCableCovered.stack( newColor, 1 );
|
||||||
|
else if ( getCableConnectionType() == AECableType.SMART )
|
||||||
|
newPart = AEApi.instance().parts().partCableSmart.stack( newColor, 1 );
|
||||||
|
else if ( getCableConnectionType() == AECableType.DENSE )
|
||||||
|
newPart = AEApi.instance().parts().partCableDense.stack( newColor, 1 );
|
||||||
|
|
||||||
|
boolean hasPermission = true;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
hasPermission = proxy.getSecurity().hasPermission( who, SecurityPermissions.BUILD );
|
||||||
|
}
|
||||||
|
catch (GridAccessException e)
|
||||||
|
{
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( newPart != null && hasPermission )
|
||||||
|
{
|
||||||
|
if ( Platform.isClient() )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
getHost().removePart( ForgeDirection.UNKNOWN, false );
|
||||||
|
getHost().addPart( newPart, ForgeDirection.UNKNOWN, who );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user