Disable psi support for now
This commit is contained in:
parent
e4588c6b52
commit
5e423da58c
2 changed files with 46 additions and 74 deletions
|
@ -46,7 +46,7 @@ public class CompatManager
|
||||||
registerCompact(StandalonePartCompact.class, "!mcmultipart");
|
registerCompact(StandalonePartCompact.class, "!mcmultipart");
|
||||||
registerCompact(WailaMcMultiPartCompact.class, "mcmultipart", "Waila", "!IC2");
|
registerCompact(WailaMcMultiPartCompact.class, "mcmultipart", "Waila", "!IC2");
|
||||||
registerCompact(CompatModuleWaila.class, "Waila");
|
registerCompact(CompatModuleWaila.class, "Waila");
|
||||||
registerCompact(CompatModulePsi.class, "Psi");
|
//registerCompact(CompatModulePsi.class, "Psi");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerCompact(Class<? extends ICompatModule> moduleClass, Object... objs)
|
public void registerCompact(Class<? extends ICompatModule> moduleClass, Object... objs)
|
||||||
|
|
|
@ -2,18 +2,10 @@ package techreborn.compat.psi.spell.trick.block;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.block.BlockLiquid;
|
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.item.EntityItem;
|
import net.minecraft.entity.item.EntityItem;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.EnumFacing;
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.util.EnumHand;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
|
||||||
import net.minecraftforge.event.world.BlockEvent.BreakEvent;
|
|
||||||
import techreborn.blocks.BlockRubberLog;
|
import techreborn.blocks.BlockRubberLog;
|
||||||
import techreborn.items.ItemParts;
|
import techreborn.items.ItemParts;
|
||||||
import vazkii.psi.api.internal.Vector3;
|
import vazkii.psi.api.internal.Vector3;
|
||||||
|
@ -26,11 +18,11 @@ import vazkii.psi.api.spell.SpellParam;
|
||||||
import vazkii.psi.api.spell.SpellRuntimeException;
|
import vazkii.psi.api.spell.SpellRuntimeException;
|
||||||
import vazkii.psi.api.spell.param.ParamVector;
|
import vazkii.psi.api.spell.param.ParamVector;
|
||||||
import vazkii.psi.api.spell.piece.PieceTrick;
|
import vazkii.psi.api.spell.piece.PieceTrick;
|
||||||
import vazkii.psi.common.core.handler.ConfigHandler;
|
|
||||||
|
|
||||||
public class PieceTrickBlockTap extends PieceTrick {
|
public class PieceTrickBlockTap extends PieceTrick {
|
||||||
|
|
||||||
SpellParam position;
|
SpellParam position;
|
||||||
|
SpellParam side;
|
||||||
|
|
||||||
public PieceTrickBlockTap(Spell spell) {
|
public PieceTrickBlockTap(Spell spell) {
|
||||||
super(spell);
|
super(spell);
|
||||||
|
@ -39,6 +31,7 @@ public class PieceTrickBlockTap extends PieceTrick {
|
||||||
@Override
|
@Override
|
||||||
public void initParams() {
|
public void initParams() {
|
||||||
addParam(position = new ParamVector(SpellParam.GENERIC_NAME_POSITION, SpellParam.BLUE, false, false));
|
addParam(position = new ParamVector(SpellParam.GENERIC_NAME_POSITION, SpellParam.BLUE, false, false));
|
||||||
|
addParam(side = new ParamVector("Side", SpellParam.GREEN, false, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -55,76 +48,55 @@ public class PieceTrickBlockTap extends PieceTrick {
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Vector3 positionVal = this.<Vector3> getParamValue(context, position);
|
Vector3 positionVal = this.<Vector3> getParamValue(context, position);
|
||||||
|
Vector3 sideVal = this.<Vector3> getParamValue(context, side);
|
||||||
|
|
||||||
if (positionVal == null)
|
if (positionVal == null)
|
||||||
throw new SpellRuntimeException(SpellRuntimeException.NULL_VECTOR);
|
throw new SpellRuntimeException(SpellRuntimeException.NULL_VECTOR);
|
||||||
if (!context.isInRadius(positionVal))
|
if (!context.isInRadius(positionVal))
|
||||||
throw new SpellRuntimeException(SpellRuntimeException.OUTSIDE_RADIUS);
|
throw new SpellRuntimeException(SpellRuntimeException.OUTSIDE_RADIUS);
|
||||||
|
|
||||||
|
if (sideVal == null)
|
||||||
|
throw new SpellRuntimeException(SpellRuntimeException.NULL_VECTOR);
|
||||||
|
if (!context.isInRadius(sideVal))
|
||||||
|
throw new SpellRuntimeException(SpellRuntimeException.OUTSIDE_RADIUS);
|
||||||
|
|
||||||
|
if(!sideVal.isAxial()){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
BlockPos pos = new BlockPos(positionVal.x, positionVal.y, positionVal.z);
|
BlockPos pos = new BlockPos(positionVal.x, positionVal.y, positionVal.z);
|
||||||
IBlockState state = context.caster.worldObj.getBlockState(pos);
|
IBlockState state = context.caster.worldObj.getBlockState(pos);
|
||||||
if(state instanceof BlockRubberLog){
|
if (state.getBlock() instanceof BlockRubberLog) {
|
||||||
if (state.getValue(BlockRubberLog.HAS_SAP))
|
System.out.println("Is rubber log");
|
||||||
{
|
if (state.getValue(BlockRubberLog.HAS_SAP)) {
|
||||||
if (state.getValue(BlockRubberLog.SAP_SIDE) == context.positionBroken.sideHit)
|
System.out.println("Has sap");
|
||||||
{
|
if (state.getValue(BlockRubberLog.SAP_SIDE) == null) {
|
||||||
context.caster.worldObj.setBlockState(pos,
|
System.out.println("got this far");
|
||||||
state.withProperty(BlockRubberLog.HAS_SAP, false).withProperty(BlockRubberLog.SAP_SIDE, EnumFacing.getHorizontal(0)));
|
context.caster.worldObj.setBlockState(pos, state.withProperty(BlockRubberLog.HAS_SAP, false)
|
||||||
|
.withProperty(BlockRubberLog.SAP_SIDE, EnumFacing.getHorizontal(0)));
|
||||||
// TODO 1.9 sounds
|
// TODO 1.9 sounds
|
||||||
// worldIn.playSoundAtEntity(playerIn,
|
// worldIn.playSoundAtEntity(playerIn,
|
||||||
// "techreborn:sap_extract", 0.8F, 1F);
|
// "techreborn:sap_extract", 0.8F, 1F);
|
||||||
if (!context.caster.worldObj.isRemote)
|
if (!context.caster.worldObj.isRemote) {
|
||||||
{
|
System.out.println("doing stuff");
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
BlockPos itemPos = pos.offset(context.positionBroken.sideHit);
|
BlockPos itemPos = pos.offset(context.positionBroken.sideHit);
|
||||||
EntityItem item = new EntityItem(context.caster.worldObj, itemPos.getX(), itemPos.getY(), itemPos.getZ(),
|
EntityItem item = new EntityItem(context.caster.worldObj, itemPos.getX(), itemPos.getY(),
|
||||||
ItemParts.getPartByName("rubberSap").copy());
|
itemPos.getZ(), ItemParts.getPartByName("rubberSap").copy());
|
||||||
float factor = 0.05F;
|
float factor = 0.05F;
|
||||||
item.motionX = rand.nextGaussian() * factor;
|
item.motionX = rand.nextGaussian() * factor;
|
||||||
item.motionY = rand.nextGaussian() * factor + 0.2F;
|
item.motionY = rand.nextGaussian() * factor + 0.2F;
|
||||||
item.motionZ = rand.nextGaussian() * factor;
|
item.motionZ = rand.nextGaussian() * factor;
|
||||||
context.caster.worldObj.spawnEntityInWorld(item);
|
context.caster.worldObj.spawnEntityInWorld(item);
|
||||||
}
|
}
|
||||||
return true;
|
} else {
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
removeBlockWithDrops(context, context.caster, context.caster.worldObj, context.tool, pos, true);
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
public static void removeBlockWithDrops(SpellContext context, EntityPlayer player, World world, ItemStack tool,
|
return null;
|
||||||
BlockPos pos, boolean particles) {
|
|
||||||
if (!world.isBlockLoaded(pos)
|
|
||||||
|| context.positionBroken != null && pos.equals(context.positionBroken.getBlockPos()))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int harvestLevel = ConfigHandler.cadHarvestLevel;
|
|
||||||
IBlockState state = world.getBlockState(pos);
|
|
||||||
Block block = state.getBlock();
|
|
||||||
if (!world.isRemote && block != null && !block.isAir(state, world, pos) && !(block instanceof BlockLiquid)
|
|
||||||
&& block.getPlayerRelativeBlockHardness(state, player, world, pos) > 0) {
|
|
||||||
int neededHarvestLevel = block.getHarvestLevel(state);
|
|
||||||
if (neededHarvestLevel > harvestLevel && (tool != null && !tool.canHarvestBlock(state)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
BreakEvent event = new BreakEvent(world, pos, state, player);
|
|
||||||
MinecraftForge.EVENT_BUS.post(event);
|
|
||||||
if (!event.isCanceled()) {
|
|
||||||
if (!player.capabilities.isCreativeMode) {
|
|
||||||
block.onBlockHarvested(world, pos, state, player);
|
|
||||||
|
|
||||||
if (block.removedByPlayer(state, world, pos, player, true)) {
|
|
||||||
block.onBlockDestroyedByPlayer(world, pos, state);
|
|
||||||
block.harvestBlock(world, player, pos, state, world.getTileEntity(pos), tool);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
world.setBlockToAir(pos);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (particles)
|
|
||||||
world.playAuxSFX(2001, pos, Block.getStateId(state));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue