mirror of
https://github.com/GTNewHorizons/Gadomancy.git
synced 2026-11-26 14:53:21 +00:00
- Added ExtendedNodeTypes
- GrowingNode Behavior updated. - ExplosionHandler Added
This commit is contained in:
1 parent
f0a01374e0
commit
924d305c56
14 files changed
+475
-163
No files matched your search
@@ -115,118 +115,11 @@ public class EventHandlerWorld {
|
||||
if (e.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
ItemStack i = e.entityPlayer.getHeldItem();
|
||||
if (i != null && (i.getItem() instanceof ItemWandCasting)) {
|
||||
Block target = e.world.getBlock(e.x, e.y, e.z);
|
||||
if (target.equals(Blocks.glass)) {
|
||||
if (ResearchManager.isResearchComplete(e.entityPlayer.getCommandSenderName(), "NODEJAR")) {
|
||||
tryTCJarNodeCreation(i, e.entityPlayer, e.world, e.x, e.y, e.z);
|
||||
}
|
||||
} else if (target.equals(ConfigBlocks.blockWarded)) {
|
||||
if (RegisteredIntegrations.automagy.isPresent() &&
|
||||
ResearchManager.isResearchComplete(e.entityPlayer.getCommandSenderName(), "ADVNODEJAR")) {
|
||||
tryAutomagyJarNodeCreation(i, e.entityPlayer, e.world, e.x, e.y, e.z);
|
||||
}
|
||||
}
|
||||
JarMultiblockHandler.handleWandInteract(e.world, e.x, e.y, e.z, e.entityPlayer, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tryTCJarNodeCreation(ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) {
|
||||
JarMultiblockHandler.JarPieceEvaluationRunnable slabRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() {
|
||||
@Override
|
||||
public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) {
|
||||
Block block = world.getBlock(absX, absY, absZ);
|
||||
int md = world.getBlockMetadata(absX, absY, absZ);
|
||||
return containsMatch(false, OreDictionary.getOres("slabWood"), new ItemStack(block, 1, md));
|
||||
}
|
||||
};
|
||||
JarMultiblockHandler.JarPieceEvaluationRunnable glassRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() {
|
||||
@Override
|
||||
public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) {
|
||||
return world.getBlock(absX, absY, absZ) == Blocks.glass;
|
||||
}
|
||||
};
|
||||
JarMultiblockHandler.JarPieceEvaluationRunnable nodeRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() {
|
||||
@Override
|
||||
public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) {
|
||||
TileEntity tile = world.getTileEntity(absX, absY, absZ);
|
||||
if ((tile == null) || (!(tile instanceof INode)) || ((tile instanceof TileJarNode))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
int[] result = JarMultiblockHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, slabRunnable, glassRunnable, nodeRunnable);
|
||||
|
||||
if (result == null){
|
||||
return;
|
||||
}
|
||||
|
||||
if(!ThaumcraftApiHelper.consumeVisFromWandCrafting(wandStack, player, new AspectList().add(Aspect.FIRE, 70).add(Aspect.EARTH, 70).add(Aspect.ORDER, 70).add(Aspect.AIR, 70).add(Aspect.ENTROPY, 70).add(Aspect.WATER, 70), true))
|
||||
return;
|
||||
|
||||
if(world.isRemote) return;
|
||||
JarMultiblockHandler.replaceTCJar(world, result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
private void tryAutomagyJarNodeCreation(ItemStack wandStack, EntityPlayer player, World world, int x, int y, int z) {
|
||||
JarMultiblockHandler.JarPieceEvaluationRunnable silverWoodRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() {
|
||||
@Override
|
||||
public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) {
|
||||
TileEntity te = world.getTileEntity(absX, absY, absZ);
|
||||
if ((te instanceof TileWarded)) {
|
||||
TileWarded warded = (TileWarded) te;
|
||||
if ((warded.block == ConfigBlocks.blockMagicalLog) && (BlockMagicalLog.limitToValidMetadata(warded.blockMd) == 1)) {
|
||||
return player.getCommandSenderName().hashCode() == warded.owner;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
JarMultiblockHandler.JarPieceEvaluationRunnable glassRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() {
|
||||
@Override
|
||||
public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) {
|
||||
if ((world.getBlock(absX, absY, absZ) == ConfigBlocks.blockCosmeticOpaque) && (world.getBlockMetadata(absX, absY, absZ) == 2)) {
|
||||
TileEntity te = world.getTileEntity(absX, absY, absZ);
|
||||
if ((te instanceof TileOwned)) {
|
||||
return player.getCommandSenderName().equals(((TileOwned) te).owner);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
JarMultiblockHandler.JarPieceEvaluationRunnable nodeRunnable = new JarMultiblockHandler.JarPieceEvaluationRunnable() {
|
||||
@Override
|
||||
public boolean isValidPieceAt(World world, int absX, int absY, int absZ, EntityPlayer player) {
|
||||
TileEntity tile = world.getTileEntity(absX, absY, absZ);
|
||||
if ((tile == null) || (!(tile instanceof INode)) || ((tile instanceof TileJarNode))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
int[] result = JarMultiblockHandler.evaluateIfValidJarIsPresent(world, x, y, z, player, silverWoodRunnable, glassRunnable, nodeRunnable);
|
||||
|
||||
if (result == null){
|
||||
return;
|
||||
}
|
||||
|
||||
if(!RegisteredIntegrations.automagy.handleNodeJarVisCost(wandStack, player)) return;
|
||||
|
||||
if(world.isRemote) return;
|
||||
JarMultiblockHandler.replaceAutomagyJar(world, result[0], result[1], result[2]);
|
||||
}
|
||||
|
||||
private boolean containsMatch(boolean strict, List<ItemStack> inputs, ItemStack... targets) {
|
||||
for (ItemStack input : inputs) {
|
||||
for (ItemStack target : targets) {
|
||||
if (OreDictionary.itemMatches(input, target, strict)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isStickyJar(ItemStack stack) {
|
||||
return stack != null && RegisteredItems.isStickyableJar(stack)
|
||||
&& stack.hasTagCompound() && stack.stackTagCompound.getBoolean("isStickyJar");
|
||||
|
||||
Reference in new issue
Block a user