Improvements to tools
* Fix dimensional door and trapdoor arm swing * Make trapdoor animation render above the ground rather than below * Allow rift signatures to replace any replaceable source block * Send message when rift signature fails because the block at the stored location is no longer replaceable
This commit is contained in:
parent
cb0cadce5b
commit
a2e7689935
8 changed files with 36 additions and 34 deletions
src/main
java/org/dimdev/dimdoors
client
shared
resources/assets/dimdoors/lang
|
@ -37,16 +37,4 @@ public class ParticleRiftEffect extends ParticleSimpleAnimated { // TODO: colors
|
|||
setRBGColorF(oldRed, oldGreen, oldBlue);
|
||||
setAlphaF(oldAlpha);
|
||||
}
|
||||
|
||||
public static class Rift extends ParticleRiftEffect {
|
||||
public Rift(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
||||
super(world, x, y, z, motionX, motionY, motionZ, 0.0f, 0.7f, 0.55f, 2000, 2000);
|
||||
}
|
||||
}
|
||||
|
||||
public static class ClosingRiftEffect extends ParticleRiftEffect {
|
||||
public ClosingRiftEffect(World world, double x, double y, double z, double motionX, double motionY, double motionZ) {
|
||||
super(world, x, y, z, motionX, motionY, motionZ, 0.8f, 0.4f, 0.55f, 38, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package org.dimdev.dimdoors.shared.blocks;
|
||||
|
||||
import net.minecraft.block.material.EnumPushReaction;
|
||||
import org.dimdev.dimdoors.DimDoors;
|
||||
import org.dimdev.dimdoors.shared.tileentities.TileEntityEntranceRift;
|
||||
import net.minecraft.block.*;
|
||||
import net.minecraft.block.material.Material;
|
||||
|
@ -60,6 +61,10 @@ public abstract class BlockDimensionalTrapdoor extends BlockTrapDoor implements
|
|||
public TileEntityEntranceRift createNewTileEntity(World world, int meta) {
|
||||
TileEntityEntranceRift rift = new TileEntityEntranceRift();
|
||||
rift.orientation = EnumFacing.UP;
|
||||
if (DimDoors.proxy.isClient()) {
|
||||
// Trapdoor is on the ground
|
||||
rift.pushIn = -0.01;
|
||||
}
|
||||
return rift;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,17 +88,21 @@ public class BlockFloatingRift extends BlockSpecialAir implements ITileEntityPro
|
|||
if (!(tileEntity instanceof TileEntityFloatingRift)) return;
|
||||
TileEntityFloatingRift rift = (TileEntityFloatingRift) tileEntity;
|
||||
|
||||
// TODO: direction of particles should be rift orientation, speed should depend on size
|
||||
double speed = 0.1d; // rift.size / 1400f;
|
||||
|
||||
if (rift.closing) { // Renders an opposite color effect if it is being closed by the rift remover
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect.ClosingRiftEffect(
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect(
|
||||
world,
|
||||
pos.getX() + .5, pos.getY() + 1.5, pos.getZ() + .5,
|
||||
rand.nextGaussian() * 0.1D, rand.nextGaussian() * 0.1D, rand.nextGaussian() * 0.1D));
|
||||
rand.nextGaussian() * speed, rand.nextGaussian() * speed, rand.nextGaussian() * speed,
|
||||
0.8f, 0.4f, 0.55f, 2000, 2000));
|
||||
}
|
||||
|
||||
// TODO: depend on size, stabilization status, direction of particles should be rift orientation
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect.Rift(
|
||||
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ParticleRiftEffect(
|
||||
world,
|
||||
pos.getX() + .5, pos.getY() + 1.5, pos.getZ() + .5,
|
||||
rand.nextGaussian() * 0.1D, rand.nextGaussian() * 0.1D, rand.nextGaussian() * 0.1D));
|
||||
rand.nextGaussian() * speed, rand.nextGaussian() * speed, rand.nextGaussian() * speed,
|
||||
0.0f, 0.7f, 0.55f, rift.stabilized ? 750 : 2000, rift.stabilized ? 750 : 2000));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,9 @@ public abstract class ItemDimensionalDoor extends ItemDoor {
|
|||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (world.isRemote) return EnumActionResult.FAIL;
|
||||
|
||||
if (world.isRemote) {
|
||||
return super.onItemUse(player, world, originalPos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
// Store the rift entity if there's a rift block there that may be broken
|
||||
TileEntityFloatingRift rift = null;
|
||||
|
|
|
@ -30,7 +30,7 @@ public abstract class ItemDimensionalTrapdoor extends ItemBlock {
|
|||
@Override
|
||||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.FAIL;
|
||||
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
boolean replaceable = world.getBlockState(pos).getBlock().isReplaceable(world, pos); // Check this before calling super, since that changes the block
|
||||
|
|
|
@ -44,14 +44,14 @@ public class ItemRiftSignature extends Item {
|
|||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
pos = world.getBlockState(pos).getBlock().isReplaceable(world, pos) ? pos : pos.offset(side);
|
||||
// Return false on the client side to pass this request to the server
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
// Fail if the player can't place a block there TODO: spawn protection, other plugin support
|
||||
if (!player.canPlayerEdit(pos, side.getOpposite(), stack)) {
|
||||
return EnumActionResult.PASS;
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
RotatedLocation target = getSource(stack);
|
||||
|
@ -64,8 +64,10 @@ public class ItemRiftSignature extends Item {
|
|||
} else {
|
||||
// Place a rift at the saved point TODO: check that the player still has permission
|
||||
if (!target.getLocation().getBlockState().getBlock().equals(ModBlocks.RIFT)) {
|
||||
if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) {
|
||||
return EnumActionResult.FAIL; // TODO: send a message
|
||||
if (!target.getLocation().getBlockState().getBlock().isReplaceable(world, target.getLocation().getPos())) {
|
||||
DimDoors.sendTranslatedMessage(player, "tools.target_became_block");
|
||||
clearSource(stack); // TODO: But is this fair? It's a rather hidden way of unbinding your signature!
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
World sourceWorld = target.getLocation().getWorld();
|
||||
sourceWorld.setBlockState(target.getLocation().getPos(), ModBlocks.RIFT.getDefaultState());
|
||||
|
|
|
@ -44,16 +44,15 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
|
|||
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
ItemStack stack = player.getHeldItem(hand);
|
||||
pos = world.getBlockState(pos).getBlock().isReplaceable(world, pos) ? pos : pos.offset(side);
|
||||
// Return false on the client side to pass this request to the server
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
// Fail if the player can't place a block there TODO: spawn protection, other plugin support
|
||||
if (!player.canPlayerEdit(pos, side.getOpposite(), stack)) {
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
if (world.isRemote) {
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
|
||||
RotatedLocation target = getTarget(stack);
|
||||
|
||||
if (target == null) {
|
||||
|
@ -64,8 +63,10 @@ public class ItemStabilizedRiftSignature extends Item { // TODO: common supercla
|
|||
} else {
|
||||
// Place a rift at the target point
|
||||
if (!target.getLocation().getBlockState().getBlock().equals(ModBlocks.RIFT)) {
|
||||
if (!target.getLocation().getBlockState().getBlock().equals(Blocks.AIR)) {
|
||||
return EnumActionResult.FAIL; // TODO: send a message
|
||||
if (!target.getLocation().getBlockState().getBlock().isReplaceable(world, target.getLocation().getPos())) {
|
||||
DimDoors.sendTranslatedMessage(player, "tools.target_became_block");
|
||||
// Don't clear source, stabilized signatures always stay bound
|
||||
return EnumActionResult.FAIL;
|
||||
}
|
||||
World targetWorld = target.getLocation().getWorld();
|
||||
targetWorld.setBlockState(target.getLocation().getPos(), ModBlocks.RIFT.getDefaultState());
|
||||
|
|
|
@ -127,6 +127,7 @@ rifts.entrances.rift_too_close=Placing a door this close to a tear in the world
|
|||
rifts.entrances.cannot_be_placed_on_rift=This type of door can't be placed on a rift.
|
||||
|
||||
tools.rift_miss=You can only use this item on a rift's core
|
||||
tools.target_became_block=Failed, there is now a block at the stored location
|
||||
|
||||
dimdoors.general=General Settings
|
||||
dimdoors.general.tooltip=General configuration settings for the mod
|
||||
|
|
Loading…
Add table
Reference in a new issue