2015-12-27 19:38:12 -05:00
|
|
|
package WayofTime.bloodmagic.block;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
|
|
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
|
|
|
import WayofTime.bloodmagic.tile.TilePhantomBlock;
|
2017-01-01 21:43:34 -08:00
|
|
|
import net.minecraft.block.Block;
|
2019-09-22 12:55:43 -07:00
|
|
|
import net.minecraft.block.BlockState;
|
2015-12-27 19:38:12 -05:00
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.BlockRenderLayer;
|
2019-09-22 12:55:43 -07:00
|
|
|
import net.minecraft.block.BlockRenderType;
|
|
|
|
import net.minecraft.util.Direction;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
2015-12-27 19:38:12 -05:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
|
2017-01-01 21:43:34 -08:00
|
|
|
import javax.annotation.Nullable;
|
2017-08-15 21:30:48 -07:00
|
|
|
import java.util.Random;
|
2017-01-01 21:43:34 -08:00
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public class BlockPhantom extends Block implements IVariantProvider {
|
|
|
|
public BlockPhantom() {
|
2016-04-24 10:06:28 -07:00
|
|
|
super(Material.CLOTH);
|
2015-12-27 19:38:12 -05:00
|
|
|
|
2019-01-31 19:10:37 -08:00
|
|
|
setTranslationKey(BloodMagic.MODID + ".phantom");
|
2017-08-14 20:53:42 -07:00
|
|
|
setCreativeTab(BloodMagic.TAB_BM);
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-09-22 12:55:43 -07:00
|
|
|
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
|
2015-12-27 19:38:12 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-05-11 17:26:38 -07:00
|
|
|
@Override
|
2019-09-22 12:55:43 -07:00
|
|
|
public boolean isOpaqueCube(BlockState state) {
|
2016-05-11 17:26:38 -07:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-27 19:38:12 -05:00
|
|
|
@Override
|
2019-09-22 12:55:43 -07:00
|
|
|
public boolean isFullCube(BlockState state) {
|
2015-12-27 19:38:12 -05:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2015-12-28 19:09:51 -05:00
|
|
|
@Override
|
2019-09-22 12:55:43 -07:00
|
|
|
public boolean causesSuffocation(BlockState state) {
|
2016-03-18 13:16:38 -04:00
|
|
|
return false;
|
2015-12-28 19:09:51 -05:00
|
|
|
}
|
|
|
|
|
2016-01-11 13:36:07 -08:00
|
|
|
@Override
|
2019-09-22 12:55:43 -07:00
|
|
|
public BlockRenderType getRenderType(BlockState state) {
|
|
|
|
return BlockRenderType.MODEL;
|
2016-01-11 13:36:07 -08:00
|
|
|
}
|
|
|
|
|
2015-12-27 19:38:12 -05:00
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
2019-01-31 19:10:37 -08:00
|
|
|
public BlockRenderLayer getRenderLayer() {
|
2016-03-18 13:16:38 -04:00
|
|
|
return BlockRenderLayer.TRANSLUCENT;
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
2019-09-22 12:55:43 -07:00
|
|
|
public boolean shouldSideBeRendered(BlockState state, IBlockAccess world, BlockPos pos, Direction side) {
|
2016-05-11 17:26:38 -07:00
|
|
|
return world.getBlockState(pos.offset(side)) != state || state.getBlock() != this && super.shouldSideBeRendered(state, world, pos, side);
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
public int quantityDropped(Random par1Random) {
|
2015-12-27 19:38:12 -05:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2019-09-22 12:55:43 -07:00
|
|
|
public boolean hasTileEntity(BlockState state) {
|
2017-01-01 21:43:34 -08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Nullable
|
|
|
|
@Override
|
2019-09-22 12:55:43 -07:00
|
|
|
public TileEntity createTileEntity(World world, BlockState state) {
|
Phantom bridge (#1397)
* Rework. Desyncs for no apparent reason.
Apart from that, it works.
Desyncing started after I implemented the "diagTemplate" methods.
Can definitely be optimised, some advice for that would be good (lots of duplicated code for the "templates").
* Code cleanup.
Reverted stuff that I didn't want to commit.
* Some fine tuning for speed.
playerVel is not very accurate still but this should work out for most stuff.
Might need a lot of testing.
Might still not work properly on servers.
Diagonal templates are inconsistent, need variables switched.
Will deal with that later (maybe).
In any case, this works just fine unless you're speeding diagonally.
* The occasional stuff that should not be pushed.
Meaningless whitespaces or code reformatting.
* The occasional stuff that should not be pushed.
Meaningless whitespaces or code reformatting.
Take 2.
* MERGE ME I'M AWESOME
* removed unused import
* Refactoring, adding braces, renaming constants etc etc.
done.
* take 2
* take 2
* Removed one-liners
they grew organically because I initially created every "bridge" with a unique for loop before I removed duplicate code by passing variables/ranges
they were helpful until I found good names for the variables, now they've outlived their usefulness
* tiny bit of fine tuning
* various fluff / small fixes
more fine tuning, code reformatting, meaningful variables, for loop fix (variable mismatch), shrinking a redundant method to a call to an advanced method
2018-08-18 03:14:41 +02:00
|
|
|
return new TilePhantomBlock(20);
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|
|
|
|
}
|