Added Paint Balls.
Added Color Applicator.
This commit is contained in:
parent
82ac1eb2e7
commit
161f88e42c
14 changed files with 694 additions and 27 deletions
99
client/render/items/PaintBallRender.java
Normal file
99
client/render/items/PaintBallRender.java
Normal file
|
@ -0,0 +1,99 @@
|
||||||
|
package appeng.client.render.items;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraftforge.client.IItemRenderer;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.client.texture.ExtraItemTextures;
|
||||||
|
import appeng.items.misc.ItemPaintBall;
|
||||||
|
|
||||||
|
public class PaintBallRender implements IItemRenderer
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||||
|
{
|
||||||
|
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||||
|
{
|
||||||
|
IIcon par2Icon = item.getIconIndex();
|
||||||
|
if ( item.getItemDamage() >= 20 )
|
||||||
|
par2Icon = ExtraItemTextures.ItemPaintBallShimmer.getIcon();
|
||||||
|
|
||||||
|
float f4 = ((IIcon) par2Icon).getMinU();
|
||||||
|
float f5 = ((IIcon) par2Icon).getMaxU();
|
||||||
|
float f6 = ((IIcon) par2Icon).getMinV();
|
||||||
|
float f7 = ((IIcon) par2Icon).getMaxV();
|
||||||
|
float f12 = 0.0625F;
|
||||||
|
|
||||||
|
ItemPaintBall ipb = (ItemPaintBall) item.getItem();
|
||||||
|
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||||
|
|
||||||
|
AEColor col = ipb.getColor( item );
|
||||||
|
|
||||||
|
int colorValue = item.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
|
||||||
|
int r = (colorValue >> 16) & 0xff;
|
||||||
|
int g = (colorValue >> 8) & 0xff;
|
||||||
|
int b = (colorValue >> 0) & 0xff;
|
||||||
|
|
||||||
|
int full = (int) (255 * 0.3);
|
||||||
|
float fail = 0.7f;
|
||||||
|
|
||||||
|
if ( item.getItemDamage() >= 20 )
|
||||||
|
GL11.glColor4ub( (byte) (full + r * fail), (byte) (full + g * fail), (byte) (full + b * fail), (byte) 255 );
|
||||||
|
else
|
||||||
|
GL11.glColor4ub( (byte) r, (byte) g, (byte) b, (byte) 255 );
|
||||||
|
|
||||||
|
if ( type == ItemRenderType.INVENTORY )
|
||||||
|
{
|
||||||
|
GL11.glScalef( 16F, 16F, 10F );
|
||||||
|
GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||||
|
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||||
|
GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||||
|
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||||
|
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||||
|
tessellator.addVertexWithUV( 1, 0, 0, (double) f5, (double) f7 );
|
||||||
|
tessellator.addVertexWithUV( 1, 1, 0, (double) f5, (double) f6 );
|
||||||
|
tessellator.addVertexWithUV( 0, 1, 0, (double) f4, (double) f6 );
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||||
|
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||||
|
else
|
||||||
|
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||||
|
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12 );
|
||||||
|
|
||||||
|
GL11.glDisable( GL11.GL_CULL_FACE );
|
||||||
|
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||||
|
GL11.glScalef( 1F, 1.1F, 1F );
|
||||||
|
GL11.glTranslatef( 0.0F, 1.07F, f12 / -2.0f );
|
||||||
|
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||||
|
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
138
client/render/items/ToolColorApplicatorRender.java
Normal file
138
client/render/items/ToolColorApplicatorRender.java
Normal file
|
@ -0,0 +1,138 @@
|
||||||
|
package appeng.client.render.items;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.IIcon;
|
||||||
|
import net.minecraftforge.client.IItemRenderer;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.client.texture.ExtraItemTextures;
|
||||||
|
import appeng.items.misc.ItemPaintBall;
|
||||||
|
import appeng.items.tools.powered.ToolColorApplicator;
|
||||||
|
|
||||||
|
public class ToolColorApplicatorRender implements IItemRenderer
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||||
|
{
|
||||||
|
return helper == ItemRendererHelper.ENTITY_BOBBING || helper == ItemRendererHelper.ENTITY_ROTATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
||||||
|
{
|
||||||
|
IIcon par2Icon = item.getIconIndex();
|
||||||
|
|
||||||
|
float f4 = ((IIcon) par2Icon).getMinU();
|
||||||
|
float f5 = ((IIcon) par2Icon).getMaxU();
|
||||||
|
float f6 = ((IIcon) par2Icon).getMinV();
|
||||||
|
float f7 = ((IIcon) par2Icon).getMaxV();
|
||||||
|
float f12 = 0.0625F;
|
||||||
|
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
||||||
|
|
||||||
|
int direction = 1;
|
||||||
|
if ( type == ItemRenderType.INVENTORY )
|
||||||
|
{
|
||||||
|
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||||
|
GL11.glScalef( 16F, 16F, 10F );
|
||||||
|
GL11.glTranslatef( 0.0F, 1.0F, 0.0F );
|
||||||
|
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||||
|
GL11.glEnable( GL11.GL_ALPHA_TEST );
|
||||||
|
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setNormal( 0.0F, 1.0F, 0.0F );
|
||||||
|
tessellator.addVertexWithUV( 0, 0, 0, (double) f4, (double) f7 );
|
||||||
|
tessellator.addVertexWithUV( 1, 0, 0, (double) f5, (double) f7 );
|
||||||
|
tessellator.addVertexWithUV( 1, 1, 0, (double) f5, (double) f6 );
|
||||||
|
tessellator.addVertexWithUV( 0, 1, 0, (double) f4, (double) f6 );
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( type == ItemRenderType.EQUIPPED_FIRST_PERSON )
|
||||||
|
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||||
|
else if ( type == ItemRenderType.EQUIPPED )
|
||||||
|
GL11.glTranslatef( 0.0F, 0.0F, 0.0F );
|
||||||
|
else
|
||||||
|
GL11.glTranslatef( -0.5F, -0.3F, 0.01F );
|
||||||
|
ItemRenderer.renderItemIn2D( tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12 );
|
||||||
|
|
||||||
|
GL11.glDisable( GL11.GL_CULL_FACE );
|
||||||
|
GL11.glColor4f( 1, 1, 1, 1.0F );
|
||||||
|
GL11.glScalef( -1F, -1F, 1F );
|
||||||
|
GL11.glTranslatef( -1.125F, 0.0f, f12 / -2.0f );
|
||||||
|
GL11.glRotatef( 180F, 1.0F, 0.0F, 0.0F );
|
||||||
|
}
|
||||||
|
|
||||||
|
float u = ExtraItemTextures.White.getIcon().getInterpolatedU( 8.1 );
|
||||||
|
float v = ExtraItemTextures.White.getIcon().getInterpolatedV( 8.1 );
|
||||||
|
|
||||||
|
GL11.glScalef( 1F / 16F, 1F / 16F, 1F );
|
||||||
|
GL11.glTranslatef( 4, 6, 0 );
|
||||||
|
GL11.glDisable( GL11.GL_LIGHTING );
|
||||||
|
|
||||||
|
ItemStack is = ((ToolColorApplicator) item.getItem()).getColor( item );
|
||||||
|
if ( is != null && is.getItem() instanceof ItemPaintBall )
|
||||||
|
{
|
||||||
|
ItemPaintBall ipb = (ItemPaintBall) is.getItem();
|
||||||
|
|
||||||
|
AEColor col = ipb.getColor( is );
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
float z = 0;
|
||||||
|
|
||||||
|
for (int g = 0; g < 7; g++)// 8
|
||||||
|
{
|
||||||
|
int x = g - 3 * direction;
|
||||||
|
int y = g + 3 * direction;
|
||||||
|
|
||||||
|
if ( type != ItemRenderType.INVENTORY )
|
||||||
|
{
|
||||||
|
x += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( g < 6 )
|
||||||
|
{
|
||||||
|
tessellator.setColorOpaque_I( col.whiteVariant );
|
||||||
|
tessellator.addVertexWithUV( x, y, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x + 1, y, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x + 1, y + 1, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x, y + 1, z, (double) u, (double) v );
|
||||||
|
}
|
||||||
|
|
||||||
|
y -= direction;
|
||||||
|
tessellator.setColorOpaque_I( col.mediumVariant );
|
||||||
|
tessellator.addVertexWithUV( x, y, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x + 1, y, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x + 1, y + 1, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x, y + 1, z, (double) u, (double) v );
|
||||||
|
|
||||||
|
x += direction;
|
||||||
|
if ( g < 6 )
|
||||||
|
{
|
||||||
|
tessellator.setColorOpaque_I( col.blackVariant );
|
||||||
|
tessellator.addVertexWithUV( x, y, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x + 1, y, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x + 1, y + 1, z, (double) u, (double) v );
|
||||||
|
tessellator.addVertexWithUV( x, y + 1, z, (double) u, (double) v );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
|
@ -94,6 +94,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||||
public int manipulator_battery = 200000;
|
public int manipulator_battery = 200000;
|
||||||
public int mattercannon_battery = 200000;
|
public int mattercannon_battery = 200000;
|
||||||
public int portablecell_battery = 20000;
|
public int portablecell_battery = 20000;
|
||||||
|
public int colorapplicator_battery = 20000;
|
||||||
public int staff_battery = 8000;
|
public int staff_battery = 8000;
|
||||||
|
|
||||||
public AEConfig(String path) {
|
public AEConfig(String path) {
|
||||||
|
@ -134,7 +135,9 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||||
|
|
||||||
minMeteoriteDistanceSq = minMeteoriteDistance * minMeteoriteDistance;
|
minMeteoriteDistanceSq = minMeteoriteDistance * minMeteoriteDistance;
|
||||||
|
|
||||||
addCustomCategoryComment("wireless", "Range= WirelessBaseRange + WirelessBoosterRangeMultiplier * Math.pow( boosters, WirelessBoosterExp )\nPowerDrain= WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / WirelessHighWirelessCount )" );
|
addCustomCategoryComment(
|
||||||
|
"wireless",
|
||||||
|
"Range= WirelessBaseRange + WirelessBoosterRangeMultiplier * Math.pow( boosters, WirelessBoosterExp )\nPowerDrain= WirelessBaseCost + WirelessCostMultiplier * Math.pow( boosters, 1 + boosters / WirelessHighWirelessCount )" );
|
||||||
|
|
||||||
WirelessBaseCost = get( "wireless", "WirelessBaseCost", WirelessBaseCost ).getDouble( WirelessBaseCost );
|
WirelessBaseCost = get( "wireless", "WirelessBaseCost", WirelessBaseCost ).getDouble( WirelessBaseCost );
|
||||||
WirelessCostMultiplier = get( "wireless", "WirelessCostMultiplier", WirelessCostMultiplier ).getDouble( WirelessCostMultiplier );
|
WirelessCostMultiplier = get( "wireless", "WirelessCostMultiplier", WirelessCostMultiplier ).getDouble( WirelessCostMultiplier );
|
||||||
|
@ -149,6 +152,7 @@ public class AEConfig extends Configuration implements IConfigureableObject, ICo
|
||||||
staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery );
|
staff_battery = get( "battery", "staff", staff_battery ).getInt( staff_battery );
|
||||||
manipulator_battery = get( "battery", "manipulator", manipulator_battery ).getInt( manipulator_battery );
|
manipulator_battery = get( "battery", "manipulator", manipulator_battery ).getInt( manipulator_battery );
|
||||||
portablecell_battery = get( "battery", "portablecell", portablecell_battery ).getInt( portablecell_battery );
|
portablecell_battery = get( "battery", "portablecell", portablecell_battery ).getInt( portablecell_battery );
|
||||||
|
colorapplicator_battery = get( "battery", "colorapplicator", colorapplicator_battery ).getInt( colorapplicator_battery );
|
||||||
mattercannon_battery = get( "battery", "mattercannon", mattercannon_battery ).getInt( mattercannon_battery );
|
mattercannon_battery = get( "battery", "mattercannon", mattercannon_battery ).getInt( mattercannon_battery );
|
||||||
|
|
||||||
for (AEFeature feature : AEFeature.values())
|
for (AEFeature feature : AEFeature.values())
|
||||||
|
|
|
@ -41,6 +41,7 @@ import appeng.block.misc.BlockCharger;
|
||||||
import appeng.block.misc.BlockCondenser;
|
import appeng.block.misc.BlockCondenser;
|
||||||
import appeng.block.misc.BlockInscriber;
|
import appeng.block.misc.BlockInscriber;
|
||||||
import appeng.block.misc.BlockInterface;
|
import appeng.block.misc.BlockInterface;
|
||||||
|
import appeng.block.misc.BlockPaint;
|
||||||
import appeng.block.misc.BlockQuartzGrowthAccelerator;
|
import appeng.block.misc.BlockQuartzGrowthAccelerator;
|
||||||
import appeng.block.misc.BlockQuartzTorch;
|
import appeng.block.misc.BlockQuartzTorch;
|
||||||
import appeng.block.misc.BlockSecurity;
|
import appeng.block.misc.BlockSecurity;
|
||||||
|
@ -99,6 +100,7 @@ import appeng.items.materials.ItemMultiMaterial;
|
||||||
import appeng.items.materials.MaterialType;
|
import appeng.items.materials.MaterialType;
|
||||||
import appeng.items.misc.ItemCrystalSeed;
|
import appeng.items.misc.ItemCrystalSeed;
|
||||||
import appeng.items.misc.ItemEncodedPattern;
|
import appeng.items.misc.ItemEncodedPattern;
|
||||||
|
import appeng.items.misc.ItemPaintBall;
|
||||||
import appeng.items.parts.ItemFacade;
|
import appeng.items.parts.ItemFacade;
|
||||||
import appeng.items.parts.ItemMultiPart;
|
import appeng.items.parts.ItemMultiPart;
|
||||||
import appeng.items.parts.PartType;
|
import appeng.items.parts.PartType;
|
||||||
|
@ -110,6 +112,7 @@ import appeng.items.tools.ToolBiometricCard;
|
||||||
import appeng.items.tools.ToolMemoryCard;
|
import appeng.items.tools.ToolMemoryCard;
|
||||||
import appeng.items.tools.ToolNetworkTool;
|
import appeng.items.tools.ToolNetworkTool;
|
||||||
import appeng.items.tools.powered.ToolChargedStaff;
|
import appeng.items.tools.powered.ToolChargedStaff;
|
||||||
|
import appeng.items.tools.powered.ToolColorApplicator;
|
||||||
import appeng.items.tools.powered.ToolEntropyManipulator;
|
import appeng.items.tools.powered.ToolEntropyManipulator;
|
||||||
import appeng.items.tools.powered.ToolMassCannon;
|
import appeng.items.tools.powered.ToolMassCannon;
|
||||||
import appeng.items.tools.powered.ToolPortableCell;
|
import appeng.items.tools.powered.ToolPortableCell;
|
||||||
|
@ -286,6 +289,7 @@ public class Registration
|
||||||
blocks.blockQuartzOre = addFeature( OreQuartz.class );
|
blocks.blockQuartzOre = addFeature( OreQuartz.class );
|
||||||
blocks.blockQuartzOreCharged = addFeature( OreQuartzCharged.class );
|
blocks.blockQuartzOreCharged = addFeature( OreQuartzCharged.class );
|
||||||
blocks.blockMatrixFrame = addFeature( BlockMatrixFrame.class );
|
blocks.blockMatrixFrame = addFeature( BlockMatrixFrame.class );
|
||||||
|
blocks.blockPaint = addFeature( BlockPaint.class );
|
||||||
blocks.blockQuartz = addFeature( BlockQuartz.class );
|
blocks.blockQuartz = addFeature( BlockQuartz.class );
|
||||||
blocks.blockFluix = addFeature( BlockFluix.class );
|
blocks.blockFluix = addFeature( BlockFluix.class );
|
||||||
blocks.blockSkyStone = addFeature( BlockSkyStone.class );
|
blocks.blockSkyStone = addFeature( BlockSkyStone.class );
|
||||||
|
@ -361,6 +365,8 @@ public class Registration
|
||||||
items.itemMemoryCard = addFeature( ToolMemoryCard.class );
|
items.itemMemoryCard = addFeature( ToolMemoryCard.class );
|
||||||
items.itemChargedStaff = addFeature( ToolChargedStaff.class );
|
items.itemChargedStaff = addFeature( ToolChargedStaff.class );
|
||||||
items.itemEntropyManipulator = addFeature( ToolEntropyManipulator.class );
|
items.itemEntropyManipulator = addFeature( ToolEntropyManipulator.class );
|
||||||
|
items.itemColorApplicator = addFeature( ToolColorApplicator.class );
|
||||||
|
|
||||||
items.itemWirelessTerminal = addFeature( ToolWirelessTerminal.class );
|
items.itemWirelessTerminal = addFeature( ToolWirelessTerminal.class );
|
||||||
items.itemNetworkTool = addFeature( ToolNetworkTool.class );
|
items.itemNetworkTool = addFeature( ToolNetworkTool.class );
|
||||||
items.itemPortableCell = addFeature( ToolPortableCell.class );
|
items.itemPortableCell = addFeature( ToolPortableCell.class );
|
||||||
|
@ -368,6 +374,7 @@ public class Registration
|
||||||
|
|
||||||
items.itemFacade = addFeature( ItemFacade.class );
|
items.itemFacade = addFeature( ItemFacade.class );
|
||||||
items.itemCrystalSeed = addFeature( ItemCrystalSeed.class );
|
items.itemCrystalSeed = addFeature( ItemCrystalSeed.class );
|
||||||
|
items.itemPaintBall = addFeature( ItemPaintBall.class );
|
||||||
|
|
||||||
addFeature( ToolEraser.class );
|
addFeature( ToolEraser.class );
|
||||||
addFeature( ToolMeteoritePlacer.class );
|
addFeature( ToolMeteoritePlacer.class );
|
||||||
|
|
|
@ -24,7 +24,7 @@ public enum AEFeature
|
||||||
|
|
||||||
QuartzHoe("Tools"), QuartzSpade("Tools"), QuartzSword("Tools"), QuartzPickaxe("Tools"), QuartzAxe("Tools"), QuartzKnife("Tools"), QuartzWrench("Tools"),
|
QuartzHoe("Tools"), QuartzSpade("Tools"), QuartzSword("Tools"), QuartzPickaxe("Tools"), QuartzAxe("Tools"), QuartzKnife("Tools"), QuartzWrench("Tools"),
|
||||||
|
|
||||||
ChargedStaff("Tools"), EntropyManipulator("Tools"), MatterCannon("Tools"), WirelessAccessTerminal("Tools"),
|
ChargedStaff("Tools"), EntropyManipulator("Tools"), MatterCannon("Tools"), WirelessAccessTerminal("Tools"), ColorApplicator("Tools"),
|
||||||
|
|
||||||
Crafting("NetworkFeatures"), PowerGen("NetworkFeatures"), Security("NetworkFeatures"),
|
Crafting("NetworkFeatures"), PowerGen("NetworkFeatures"), Security("NetworkFeatures"),
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ public enum AEFeature
|
||||||
|
|
||||||
enableFacadeCrafting("Crafting"), inWorldSingularity("Crafting"), inWorldFluix("Crafting"), inWorldPurification("Crafting"), UpdateLogging("Misc", false),
|
enableFacadeCrafting("Crafting"), inWorldSingularity("Crafting"), inWorldFluix("Crafting"), inWorldPurification("Crafting"), UpdateLogging("Misc", false),
|
||||||
|
|
||||||
AlphaPass("Rendering");
|
AlphaPass("Rendering"), PaintBalls("Tools");
|
||||||
|
|
||||||
String Category;
|
String Category;
|
||||||
boolean visible = true;
|
boolean visible = true;
|
||||||
|
|
|
@ -30,7 +30,7 @@ public enum GuiText
|
||||||
|
|
||||||
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurification, inWorldSingularity,
|
StoredPower, MaxPower, RequiredPower, Efficiency, InWorldCrafting, inWorldFluix, inWorldPurification, inWorldSingularity,
|
||||||
|
|
||||||
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount;
|
OfSecondOutput, NoSecondOutput, RFTunnel, Stores, Next, SelectAmount, Lumen, Empty;
|
||||||
|
|
||||||
String root;
|
String root;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import appeng.api.implementations.items.MemoryCardMessages;
|
||||||
import appeng.core.sync.AppEngPacket;
|
import appeng.core.sync.AppEngPacket;
|
||||||
import appeng.core.sync.network.INetworkInfo;
|
import appeng.core.sync.network.INetworkInfo;
|
||||||
import appeng.items.tools.ToolNetworkTool;
|
import appeng.items.tools.ToolNetworkTool;
|
||||||
|
import appeng.items.tools.powered.ToolColorApplicator;
|
||||||
|
|
||||||
public class PacketClick extends AppEngPacket
|
public class PacketClick extends AppEngPacket
|
||||||
{
|
{
|
||||||
|
@ -46,6 +47,11 @@ public class PacketClick extends AppEngPacket
|
||||||
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
mem.notifyUser( player, MemoryCardMessages.SETTINGS_CLEARED );
|
||||||
is.setTagCompound( null );
|
is.setTagCompound( null );
|
||||||
}
|
}
|
||||||
|
else if ( is != null && AEApi.instance().items().itemColorApplicator.sameAsStack( is ) )
|
||||||
|
{
|
||||||
|
ToolColorApplicator mem = (ToolColorApplicator) is.getItem();
|
||||||
|
mem.cycleColors( is, mem.getColor( is ), 1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// api
|
// api
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.io.IOException;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.util.IConfigManager;
|
import appeng.api.util.IConfigManager;
|
||||||
import appeng.api.util.IConfigureableObject;
|
import appeng.api.util.IConfigureableObject;
|
||||||
|
@ -24,6 +25,7 @@ import appeng.container.implementations.ContainerSecurity;
|
||||||
import appeng.container.implementations.ContainerStorageBus;
|
import appeng.container.implementations.ContainerStorageBus;
|
||||||
import appeng.core.sync.AppEngPacket;
|
import appeng.core.sync.AppEngPacket;
|
||||||
import appeng.core.sync.network.INetworkInfo;
|
import appeng.core.sync.network.INetworkInfo;
|
||||||
|
import appeng.helpers.IMouseWheelItem;
|
||||||
|
|
||||||
public class PacketValueConfig extends AppEngPacket
|
public class PacketValueConfig extends AppEngPacket
|
||||||
{
|
{
|
||||||
|
@ -44,7 +46,14 @@ public class PacketValueConfig extends AppEngPacket
|
||||||
{
|
{
|
||||||
Container c = player.openContainer;
|
Container c = player.openContainer;
|
||||||
|
|
||||||
if ( Name.equals( "QuartzKnife.Name" ) && c instanceof ContainerQuartzKnife )
|
if ( Name.equals( "Item" ) && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IMouseWheelItem )
|
||||||
|
{
|
||||||
|
ItemStack is = player.getHeldItem();
|
||||||
|
IMouseWheelItem si = (IMouseWheelItem) is.getItem();
|
||||||
|
si.onWheel( is, Value.equals( "WheelUp" ) );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if ( Name.equals( "QuartzKnife.Name" ) && c instanceof ContainerQuartzKnife )
|
||||||
{
|
{
|
||||||
ContainerQuartzKnife qk = (ContainerQuartzKnife) c;
|
ContainerQuartzKnife qk = (ContainerQuartzKnife) c;
|
||||||
qk.setName( Value );
|
qk.setName( Value );
|
||||||
|
|
|
@ -8,20 +8,19 @@ import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
import net.minecraft.world.WorldServer;
|
||||||
import appeng.items.tools.powered.ToolEntropyManipulator;
|
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
final public class DispenserEntropyManipulator extends BehaviorDefaultDispenseItem
|
final public class DispenserBlockTool extends BehaviorDefaultDispenseItem
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected ItemStack dispenseStack(IBlockSource dispenser, ItemStack dispensedItem)
|
protected ItemStack dispenseStack(IBlockSource dispenser, ItemStack dispensedItem)
|
||||||
{
|
{
|
||||||
Item i = dispensedItem.getItem();
|
Item i = dispensedItem.getItem();
|
||||||
if ( i instanceof ToolEntropyManipulator )
|
if ( i instanceof IBlockTool )
|
||||||
{
|
{
|
||||||
EnumFacing enumfacing = BlockDispenser.func_149937_b( dispenser.getBlockMetadata() );
|
EnumFacing enumfacing = BlockDispenser.func_149937_b( dispenser.getBlockMetadata() );
|
||||||
ToolEntropyManipulator tm = (ToolEntropyManipulator) i;
|
IBlockTool tm = (IBlockTool) i;
|
||||||
|
|
||||||
World w = dispenser.getWorld();
|
World w = dispenser.getWorld();
|
||||||
if ( w instanceof WorldServer )
|
if ( w instanceof WorldServer )
|
12
hooks/IBlockTool.java
Normal file
12
hooks/IBlockTool.java
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package appeng.hooks;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public interface IBlockTool
|
||||||
|
{
|
||||||
|
|
||||||
|
boolean onItemUse(ItemStack dispensedItem, EntityPlayer player, World w, int x, int y, int z, int ordinal, float hitx, float hity, float hitz);
|
||||||
|
|
||||||
|
}
|
63
items/misc/ItemPaintBall.java
Normal file
63
items/misc/ItemPaintBall.java
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
package appeng.items.misc;
|
||||||
|
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.client.render.items.PaintBallRender;
|
||||||
|
import appeng.core.features.AEFeature;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.items.AEBaseItem;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
public class ItemPaintBall extends AEBaseItem
|
||||||
|
{
|
||||||
|
|
||||||
|
public ItemPaintBall() {
|
||||||
|
super( ItemPaintBall.class );
|
||||||
|
setfeature( EnumSet.of( AEFeature.PaintBalls ) );
|
||||||
|
hasSubtypes = true;
|
||||||
|
if ( Platform.isClient() )
|
||||||
|
MinecraftForgeClient.registerItemRenderer( this, new PaintBallRender() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemStackDisplayName(ItemStack is)
|
||||||
|
{
|
||||||
|
return super.getItemStackDisplayName( is ) + " - " + getExtraName( is );
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getExtraName(ItemStack is)
|
||||||
|
{
|
||||||
|
return (is.getItemDamage() >= 20 ? GuiText.Lumen + " " : "") + getColor( is );
|
||||||
|
}
|
||||||
|
|
||||||
|
public AEColor getColor(ItemStack is)
|
||||||
|
{
|
||||||
|
int dmg = is.getItemDamage();
|
||||||
|
if ( dmg >= 20 )
|
||||||
|
dmg -= 20;
|
||||||
|
|
||||||
|
if ( dmg >= AEColor.values().length )
|
||||||
|
return AEColor.Transparent;
|
||||||
|
|
||||||
|
return AEColor.values()[dmg];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void getSubItems(Item i, CreativeTabs ct, List l)
|
||||||
|
{
|
||||||
|
for (AEColor c : AEColor.values())
|
||||||
|
if ( c != AEColor.Transparent )
|
||||||
|
l.add( new ItemStack( this, 1, c.ordinal() ) );
|
||||||
|
|
||||||
|
for (AEColor c : AEColor.values())
|
||||||
|
if ( c != AEColor.Transparent )
|
||||||
|
l.add( new ItemStack( this, 1, 20 + c.ordinal() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
328
items/tools/powered/ToolColorApplicator.java
Normal file
328
items/tools/powered/ToolColorApplicator.java
Normal file
|
@ -0,0 +1,328 @@
|
||||||
|
package appeng.items.tools.powered;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockDispenser;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.client.MinecraftForgeClient;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.config.Actionable;
|
||||||
|
import appeng.api.config.FuzzyMode;
|
||||||
|
import appeng.api.config.SortDir;
|
||||||
|
import appeng.api.implementations.items.IItemGroup;
|
||||||
|
import appeng.api.implementations.items.IStorageCell;
|
||||||
|
import appeng.api.networking.security.BaseActionSource;
|
||||||
|
import appeng.api.storage.ICellInventory;
|
||||||
|
import appeng.api.storage.ICellInventoryHandler;
|
||||||
|
import appeng.api.storage.IMEInventory;
|
||||||
|
import appeng.api.storage.StorageChannel;
|
||||||
|
import appeng.api.storage.data.IAEItemStack;
|
||||||
|
import appeng.api.storage.data.IItemList;
|
||||||
|
import appeng.api.util.AEColor;
|
||||||
|
import appeng.client.render.items.ToolColorApplicatorRender;
|
||||||
|
import appeng.core.AEConfig;
|
||||||
|
import appeng.core.features.AEFeature;
|
||||||
|
import appeng.core.localization.GuiText;
|
||||||
|
import appeng.helpers.IMouseWheelItem;
|
||||||
|
import appeng.hooks.DispenserBlockTool;
|
||||||
|
import appeng.hooks.IBlockTool;
|
||||||
|
import appeng.items.contents.CellConfig;
|
||||||
|
import appeng.items.contents.CellUpgrades;
|
||||||
|
import appeng.items.misc.ItemPaintBall;
|
||||||
|
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||||
|
import appeng.me.storage.CellInventoryHandler;
|
||||||
|
import appeng.util.ItemSorters;
|
||||||
|
import appeng.util.Platform;
|
||||||
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
|
public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCell, IItemGroup, IBlockTool, IMouseWheelItem
|
||||||
|
{
|
||||||
|
|
||||||
|
public ToolColorApplicator() {
|
||||||
|
super( ToolColorApplicator.class, null );
|
||||||
|
setfeature( EnumSet.of( AEFeature.ColorApplicator, AEFeature.StorageCells, AEFeature.PoweredTools ) );
|
||||||
|
maxStoredPower = AEConfig.instance.colorapplicator_battery;
|
||||||
|
if ( Platform.isClient() )
|
||||||
|
MinecraftForgeClient.registerItemRenderer( this, new ToolColorApplicatorRender() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postInit()
|
||||||
|
{
|
||||||
|
super.postInit();
|
||||||
|
BlockDispenser.dispenseBehaviorRegistry.putObject( this, new DispenserBlockTool() );
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getColor(ItemStack is)
|
||||||
|
{
|
||||||
|
NBTTagCompound c = is.getTagCompound();
|
||||||
|
if ( c != null && c.hasKey( "color" ) )
|
||||||
|
{
|
||||||
|
NBTTagCompound color = c.getCompoundTag( "color" );
|
||||||
|
ItemStack oldColor = ItemStack.loadItemStackFromNBT( color );
|
||||||
|
if ( oldColor != null )
|
||||||
|
return oldColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
return findNextColor( is, null, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack findNextColor(ItemStack is, ItemStack anchor, int scrollOffset)
|
||||||
|
{
|
||||||
|
ItemStack newColor = null;
|
||||||
|
|
||||||
|
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, StorageChannel.ITEMS );
|
||||||
|
if ( inv != null )
|
||||||
|
{
|
||||||
|
IItemList<IAEItemStack> itemList = inv.getAvailableItems( AEApi.instance().storage().createItemList() );
|
||||||
|
if ( anchor == null )
|
||||||
|
{
|
||||||
|
IAEItemStack firstItem = itemList.getFirstItem();
|
||||||
|
if ( firstItem != null )
|
||||||
|
newColor = firstItem.getItemStack();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LinkedList<IAEItemStack> list = new LinkedList<IAEItemStack>();
|
||||||
|
|
||||||
|
for (IAEItemStack i : itemList)
|
||||||
|
list.add( i );
|
||||||
|
|
||||||
|
ItemSorters.Direction = SortDir.ASCENDING;
|
||||||
|
ItemSorters.init();
|
||||||
|
Collections.sort( list, ItemSorters.ConfigBased_SortByName );
|
||||||
|
|
||||||
|
if ( list.size() <= 0 )
|
||||||
|
return null;
|
||||||
|
|
||||||
|
IAEItemStack where = list.getFirst();
|
||||||
|
int cycles = 1 + list.size();
|
||||||
|
|
||||||
|
while (cycles > 0 && !where.equals( anchor ))
|
||||||
|
{
|
||||||
|
list.addLast( list.removeFirst() );
|
||||||
|
cycles--;
|
||||||
|
where = list.getFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( scrollOffset > 0 )
|
||||||
|
list.addLast( list.removeFirst() );
|
||||||
|
|
||||||
|
if ( scrollOffset < 0 )
|
||||||
|
list.addFirst( list.removeLast() );
|
||||||
|
|
||||||
|
return list.get( 0 ).getItemStack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( newColor != null )
|
||||||
|
setColor( is, newColor );
|
||||||
|
|
||||||
|
return newColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(ItemStack is, ItemStack newColor)
|
||||||
|
{
|
||||||
|
NBTTagCompound data = Platform.openNbtData( is );
|
||||||
|
if ( newColor == null )
|
||||||
|
data.removeTag( "color" );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NBTTagCompound color = new NBTTagCompound();
|
||||||
|
newColor.writeToNBT( color );
|
||||||
|
data.setTag( "color", color );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onItemUse(ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float hitx, float hity, float hitz)
|
||||||
|
{
|
||||||
|
Block blk = w.getBlock( x, y, z );
|
||||||
|
double powerPerUse = 100;
|
||||||
|
|
||||||
|
ItemStack paintBall = getColor( is );
|
||||||
|
|
||||||
|
IMEInventory<IAEItemStack> inv = AEApi.instance().registries().cell().getCellInventory( is, StorageChannel.ITEMS );
|
||||||
|
if ( inv != null )
|
||||||
|
{
|
||||||
|
IAEItemStack option = inv.extractItems( AEItemStack.create( paintBall ), Actionable.SIMULATE, new BaseActionSource() );
|
||||||
|
|
||||||
|
if ( option != null )
|
||||||
|
{
|
||||||
|
paintBall = option.getItemStack();
|
||||||
|
paintBall.stackSize = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
paintBall = null;
|
||||||
|
|
||||||
|
if ( paintBall != null && paintBall.getItem() instanceof ItemPaintBall )
|
||||||
|
{
|
||||||
|
ItemPaintBall ipb = (ItemPaintBall) paintBall.getItem();
|
||||||
|
AEColor color = ipb.getColor( paintBall );
|
||||||
|
|
||||||
|
if ( getAECurrentPower( is ) > powerPerUse )
|
||||||
|
{
|
||||||
|
if ( color != AEColor.Transparent && blk.recolourBlock( w, x, y, z, ForgeDirection.getOrientation( side ), color.ordinal() ) )
|
||||||
|
{
|
||||||
|
inv.extractItems( AEItemStack.create( paintBall ), Actionable.MODULATE, new BaseActionSource() );
|
||||||
|
extractAEPower( is, powerPerUse );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( p.isSneaking() )
|
||||||
|
{
|
||||||
|
cycleColors( is, paintBall, 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void cycleColors(ItemStack is, ItemStack paintBall, int i)
|
||||||
|
{
|
||||||
|
if ( paintBall == null )
|
||||||
|
{
|
||||||
|
setColor( is, getColor( is ) );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setColor( is, findNextColor( is, paintBall, i ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getItemStackDisplayName(ItemStack par1ItemStack)
|
||||||
|
{
|
||||||
|
String extra = GuiText.Empty.getLocal();
|
||||||
|
|
||||||
|
ItemStack selected = getColor( par1ItemStack );
|
||||||
|
|
||||||
|
if ( selected != null && selected.getItem() instanceof ItemPaintBall )
|
||||||
|
extra = ((ItemPaintBall) selected.getItem()).getExtraName( selected );
|
||||||
|
|
||||||
|
return super.getItemStackDisplayName( par1ItemStack ) + " - " + extra;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack is, EntityPlayer player, List lines, boolean advancedItemTooltips)
|
||||||
|
{
|
||||||
|
super.addInformation( is, player, lines, advancedItemTooltips );
|
||||||
|
|
||||||
|
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( is, StorageChannel.ITEMS );
|
||||||
|
|
||||||
|
if ( cdi instanceof CellInventoryHandler )
|
||||||
|
{
|
||||||
|
ICellInventory cd = ((ICellInventoryHandler) cdi).getCellInv();
|
||||||
|
if ( cd != null )
|
||||||
|
{
|
||||||
|
lines.add( cd.getUsedBytes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalBytes() + " " + GuiText.BytesUsed.getLocal() );
|
||||||
|
lines.add( cd.getStoredItemTypes() + " " + GuiText.Of.getLocal() + " " + cd.getTotalItemTypes() + " " + GuiText.Types.getLocal() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBytes(ItemStack cellItem)
|
||||||
|
{
|
||||||
|
return 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int BytePerType(ItemStack iscellItem)
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTotalTypes(ItemStack cellItem)
|
||||||
|
{
|
||||||
|
return 27;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isBlackListed(ItemStack cellItem, IAEItemStack requsetedAddition)
|
||||||
|
{
|
||||||
|
return requsetedAddition == null || !(requsetedAddition.getItem() instanceof ItemPaintBall);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean storableInStorageCell()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isStorageCell(ItemStack i)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IInventory getUpgradesInventory(ItemStack is)
|
||||||
|
{
|
||||||
|
return new CellUpgrades( is, 2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IInventory getConfigInventory(ItemStack is)
|
||||||
|
{
|
||||||
|
return new CellConfig( is );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FuzzyMode getFuzzyMode(ItemStack is)
|
||||||
|
{
|
||||||
|
String fz = Platform.openNbtData( is ).getString( "FuzzyMode" );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return FuzzyMode.valueOf( fz );
|
||||||
|
}
|
||||||
|
catch (Throwable t)
|
||||||
|
{
|
||||||
|
return FuzzyMode.IGNORE_ALL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getUnlocalizedGroupName(ItemStack is)
|
||||||
|
{
|
||||||
|
return GuiText.StorageCells.getUnlocalized();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFuzzyMode(ItemStack is, FuzzyMode fzMode)
|
||||||
|
{
|
||||||
|
Platform.openNbtData( is ).setString( "FuzzyMode", fzMode.name() );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEditable(ItemStack is)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public double getIdleDrain()
|
||||||
|
{
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onWheel(ItemStack is, boolean up)
|
||||||
|
{
|
||||||
|
cycleColors( is, getColor( is ), up ? 1 : -1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -24,12 +24,13 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||||
import appeng.block.misc.BlockTinyTNT;
|
import appeng.block.misc.BlockTinyTNT;
|
||||||
import appeng.core.AEConfig;
|
import appeng.core.AEConfig;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.hooks.DispenserEntropyManipulator;
|
import appeng.hooks.DispenserBlockTool;
|
||||||
|
import appeng.hooks.IBlockTool;
|
||||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||||
import appeng.util.InWorldToolOperationResult;
|
import appeng.util.InWorldToolOperationResult;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ToolEntropyManipulator extends AEBasePoweredItem
|
public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockTool
|
||||||
{
|
{
|
||||||
|
|
||||||
static class Combo
|
static class Combo
|
||||||
|
@ -160,8 +161,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem
|
||||||
public void postInit()
|
public void postInit()
|
||||||
{
|
{
|
||||||
super.postInit();
|
super.postInit();
|
||||||
|
BlockDispenser.dispenseBehaviorRegistry.putObject( this, new DispenserBlockTool() );
|
||||||
BlockDispenser.dispenseBehaviorRegistry.putObject( this, new DispenserEntropyManipulator() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -65,7 +65,9 @@ public class PartPlacement
|
||||||
else if ( event.entityPlayer != null )
|
else if ( event.entityPlayer != null )
|
||||||
{
|
{
|
||||||
ItemStack held = event.entityPlayer.getHeldItem();
|
ItemStack held = event.entityPlayer.getHeldItem();
|
||||||
if ( event.entityPlayer.isSneaking() && held != null && AEApi.instance().items().itemMemoryCard.sameAsStack( held ) )
|
boolean supportedItem = AEApi.instance().items().itemMemoryCard.sameAsStack( held )
|
||||||
|
|| AEApi.instance().items().itemColorApplicator.sameAsStack( held );
|
||||||
|
if ( event.entityPlayer.isSneaking() && held != null && supportedItem )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue