feat: add back entropy tools
This commit is contained in:
parent
42fdd831ff
commit
fbe3e1deb0
|
@ -8,7 +8,7 @@ aebasename=appliedenergistics2
|
|||
# Versions #
|
||||
#########################################################
|
||||
minecraft_version=1.7.10
|
||||
forge_version=10.13.4.1448-1.7.10
|
||||
forge_version=10.13.4.1614-1.7.10
|
||||
|
||||
#########################################################
|
||||
# Installable #
|
||||
|
|
|
@ -65,6 +65,8 @@ public final class ApiItems implements IItems
|
|||
private final IItemDefinition netherQuartzKnife;
|
||||
|
||||
private final IItemDefinition entropyManipulator;
|
||||
private final IItemDefinition vibrationCatalyst;
|
||||
private final IItemDefinition entropyAccelerator;
|
||||
private final IItemDefinition wirelessTerminal;
|
||||
private final IItemDefinition biometricCard;
|
||||
private final IItemDefinition chargedStaff;
|
||||
|
@ -121,6 +123,9 @@ public final class ApiItems implements IItems
|
|||
this.netherQuartzKnife = constructor.registerItemDefinition( new ToolQuartzCuttingKnife( AEFeature.NetherQuartzTools ) );
|
||||
|
||||
this.entropyManipulator = constructor.registerItemDefinition( new ToolEntropyManipulator() );
|
||||
this.vibrationCatalyst = constructor.registerItemDefinition( new ToolVibrationCatalyst() );
|
||||
this.entropyAccelerator = constructor.registerItemDefinition( new ToolEntropyAccelerator() );
|
||||
|
||||
this.wirelessTerminal = constructor.registerItemDefinition( new ToolWirelessTerminal() );
|
||||
this.biometricCard = constructor.registerItemDefinition( new ToolBiometricCard() );
|
||||
this.chargedStaff = constructor.registerItemDefinition( new ToolChargedStaff() );
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package appeng.items.tools.powered;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
public class ToolEntropyAccelerator extends ToolEntropyManipulator {
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(final ItemStack item, final EntityPlayer p, final World w, int x, int y, int z,
|
||||
final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (this.getAECurrentPower(item) > 1600) {
|
||||
if (!p.canPlayerEdit(x, y, z, side, item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Block blockID = w.getBlock(x, y, z);
|
||||
final int metadata = w.getBlockMetadata(x, y, z);
|
||||
|
||||
if (blockID == null || ForgeEventFactory.onPlayerInteract(p,
|
||||
blockID.isAir(w, x, y, z) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR
|
||||
: PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
|
||||
x, y, z, side, w).isCanceled())
|
||||
return false;
|
||||
|
||||
if (this.canCool(blockID, metadata)) {
|
||||
if (this.cool(blockID, p, metadata, w, x, y, z)) {
|
||||
this.extractAEPower(item, 1600);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -84,7 +84,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||
this.heatUp.put( new InWorldToolOperationIngredient( Blocks.snow, OreDictionary.WILDCARD_VALUE ), new InWorldToolOperationResult( new ItemStack( Blocks.flowing_water ) ) );
|
||||
}
|
||||
|
||||
private static final boolean breakBlockWithCheck( final World w, final EntityPlayer p, final int x, final int y, final int z )
|
||||
protected static final boolean breakBlockWithCheck( final World w, final EntityPlayer p, final int x, final int y, final int z )
|
||||
{
|
||||
BlockEvent.BreakEvent event = new BlockEvent.BreakEvent( x, y, z, w, w.getBlock( x, y, z ), w.getBlockMetadata( x, y, z ), p );
|
||||
MinecraftForge.EVENT_BUS.post( event );
|
||||
|
@ -98,7 +98,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||
BlockDispenser.dispenseBehaviorRegistry.putObject( this, new DispenserBlockTool() );
|
||||
}
|
||||
|
||||
private boolean heat( final Block blockID, final EntityPlayer p, final int metadata, final World w, final int x, final int y, final int z )
|
||||
protected boolean heat( final Block blockID, final EntityPlayer p, final int metadata, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
if( !breakBlockWithCheck( w, p, x, y, z ) )
|
||||
return false;
|
||||
|
@ -124,7 +124,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean canHeat( final Block blockID, final int metadata )
|
||||
protected boolean canHeat( final Block blockID, final int metadata )
|
||||
{
|
||||
InWorldToolOperationResult r = this.heatUp.get( new InWorldToolOperationIngredient( blockID, metadata ) );
|
||||
|
||||
|
@ -136,7 +136,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||
return r != null;
|
||||
}
|
||||
|
||||
private boolean cool( final Block blockID, final EntityPlayer p, final int metadata, final World w, final int x, final int y, final int z )
|
||||
protected boolean cool( final Block blockID, final EntityPlayer p, final int metadata, final World w, final int x, final int y, final int z )
|
||||
{
|
||||
if( !breakBlockWithCheck( w, p, x, y, z ) )
|
||||
return false;
|
||||
|
@ -161,7 +161,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
|||
return true;
|
||||
}
|
||||
|
||||
private boolean canCool( final Block blockID, final int metadata )
|
||||
protected boolean canCool( final Block blockID, final int metadata )
|
||||
{
|
||||
InWorldToolOperationResult r = this.coolDown.get( new InWorldToolOperationIngredient( blockID, metadata ) );
|
||||
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
package appeng.items.tools.powered;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import appeng.block.misc.BlockTinyTNT;
|
||||
import appeng.util.InWorldToolOperationResult;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockTNT;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
|
||||
public class ToolVibrationCatalyst extends ToolEntropyManipulator {
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(final ItemStack item, final EntityPlayer p, final World w, int x, int y, int z,
|
||||
final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (this.getAECurrentPower(item) > 1600) {
|
||||
if (!p.canPlayerEdit(x, y, z, side, item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final Block blockID = w.getBlock(x, y, z);
|
||||
final int metadata = w.getBlockMetadata(x, y, z);
|
||||
|
||||
if (blockID == null || ForgeEventFactory.onPlayerInteract(p,
|
||||
blockID.isAir(w, x, y, z) ? PlayerInteractEvent.Action.RIGHT_CLICK_AIR
|
||||
: PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK,
|
||||
x, y, z, side, w).isCanceled())
|
||||
return false;
|
||||
|
||||
if (blockID instanceof BlockTNT) {
|
||||
if (!breakBlockWithCheck(w, p, x, y, z))
|
||||
return false;
|
||||
((BlockTNT) blockID).func_150114_a(w, x, y, z, 1, p);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (blockID instanceof BlockTinyTNT) {
|
||||
if (!breakBlockWithCheck(w, p, x, y, z))
|
||||
return false;
|
||||
((BlockTinyTNT) blockID).startFuse(w, x, y, z, p);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.canHeat(blockID, metadata)) {
|
||||
if (this.heat(blockID, p, metadata, w, x, y, z)) {
|
||||
this.extractAEPower(item, 1600);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
final ItemStack[] stack = Platform.getBlockDrops(w, x, y, z);
|
||||
final List<ItemStack> out = new ArrayList<ItemStack>();
|
||||
boolean hasFurnaceable = false;
|
||||
boolean canFurnaceable = true;
|
||||
|
||||
for (final ItemStack i : stack) {
|
||||
final ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(i);
|
||||
|
||||
if (result != null) {
|
||||
if (result.getItem() instanceof ItemBlock) {
|
||||
if (Block.getBlockFromItem(result.getItem()) == blockID
|
||||
&& result.getItem().getDamage(result) == metadata) {
|
||||
canFurnaceable = false;
|
||||
}
|
||||
}
|
||||
hasFurnaceable = true;
|
||||
out.add(result);
|
||||
} else {
|
||||
canFurnaceable = false;
|
||||
out.add(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasFurnaceable && canFurnaceable) {
|
||||
if (!breakBlockWithCheck(w, p, x, y, z))
|
||||
return false;
|
||||
|
||||
this.extractAEPower(item, 1600);
|
||||
final InWorldToolOperationResult or = InWorldToolOperationResult
|
||||
.getBlockOperationResult(out.toArray(new ItemStack[out.size()]));
|
||||
w.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F,
|
||||
itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
|
||||
if (or.getBlockItem() != null) {
|
||||
w.setBlock(x, y, z, Block.getBlockFromItem(or.getBlockItem().getItem()),
|
||||
or.getBlockItem().getItemDamage(), 3);
|
||||
}
|
||||
|
||||
if (or.getDrops() != null) {
|
||||
Platform.spawnDrops(w, x, y, z, or.getDrops());
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
final ForgeDirection dir = ForgeDirection.getOrientation(side);
|
||||
x += dir.offsetX;
|
||||
y += dir.offsetY;
|
||||
z += dir.offsetZ;
|
||||
|
||||
if (!p.canPlayerEdit(x, y, z, side, item)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (w.isAirBlock(x, y, z)) {
|
||||
this.extractAEPower(item, 1600);
|
||||
w.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F,
|
||||
itemRand.nextFloat() * 0.4F + 0.8F);
|
||||
w.setBlock(x, y, z, Blocks.fire);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -500,6 +500,8 @@ item.appliedenergistics2.ToolPortableCell.name=Portable Cell
|
|||
item.appliedenergistics2.ToolNetworkTool.name=Network Tool
|
||||
item.appliedenergistics2.ToolChargedStaff.name=Charged Staff
|
||||
item.appliedenergistics2.ToolEntropyManipulator.name=Entropy Manipulator
|
||||
item.appliedenergistics2.ToolEntropyAccelerator.name=Entropy Accelerator
|
||||
item.appliedenergistics2.ToolVibrationCatalyst.name=Vibration Catalyst
|
||||
item.appliedenergistics2.ToolMassCannon.name=Matter Cannon
|
||||
item.appliedenergistics2.ToolMemoryCard.name=Memory Card
|
||||
item.appliedenergistics2.ToolColorApplicator.name=Color Applicator
|
||||
|
|
|
@ -9,3 +9,15 @@ shaped=
|
|||
ae2:ItemMaterial.EngProcessor oredictionary:ingotIron _,
|
||||
_ _ oredictionary:ingotIron
|
||||
-> ae2:ToolEntropyManipulator
|
||||
|
||||
shaped=
|
||||
ae2:ItemMaterial.ConversionMatrix minecraft:ice _,
|
||||
_ ae2:BlockEnergyCell _,
|
||||
_ _ oredictionary:ingotIron
|
||||
-> ae2:ToolEntropyAccelerator
|
||||
|
||||
shaped=
|
||||
ae2:ItemMaterial.ConversionMatrix minecraft:lava_bucket _,
|
||||
_ ae2:BlockEnergyCell _,
|
||||
_ _ oredictionary:ingotIron
|
||||
-> ae2:ToolVibrationCatalyst
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 398 B |
Binary file not shown.
After Width: | Height: | Size: 401 B |
Loading…
Reference in New Issue