Auto indented all code

No actual functionality was changed
This commit is contained in:
Mathijs Riezebos 2017-01-13 03:13:49 +01:00
parent c741d5cd35
commit b61aff025c
48 changed files with 1267 additions and 1121 deletions

View file

@ -9,6 +9,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.oredict.ShapedOreRecipe;
public class CraftingManager {
public static void registerRecipes() {
GameRegistry.addRecipe(new ItemStack(ModItems.itemStableFabric, 1),
"yxy", 'x', Items.ENDER_PEARL, 'y', ModItems.itemWorldThread);

View file

@ -46,9 +46,9 @@ public abstract class DDProxyCommon implements IDDProxy {
if (tile instanceof TileEntityDimDoor) {
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
IBlockState state = world.getBlockState(pos.down());
dimTile.orientation = state.getBlock() instanceof BlockDimDoorBase ?
state.getValue(BlockDoor.FACING).rotateY() :
ModBlocks.blockDimDoor.getDefaultState().getValue(BlockDoor.FACING);
dimTile.orientation = state.getBlock() instanceof BlockDimDoorBase
? state.getValue(BlockDoor.FACING).rotateY()
: ModBlocks.blockDimDoor.getDefaultState().getValue(BlockDoor.FACING);
dimTile.openOrClosed = door.isDoorOnRift(world, pos) && door.isUpperDoorBlock(world.getBlockState(pos));
dimTile.lockStatus = 0;
}

View file

@ -15,6 +15,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@Mod(modid = DimDoors.MODID, name = "Dimensional Doors", version = DimDoors.VERSION)
public class DimDoors {
public static final String VERSION = "3.0.0-a1";
public static final String MODID = "dimdoors";
@ -28,7 +29,9 @@ public class DimDoors {
public static CreativeTabs dimDoorsCreativeTab = new CreativeTabs("dimDoorsCreativeTab") {
@Override
@SideOnly(Side.CLIENT)
public Item getTabIconItem() {return ModItems.itemDimDoor;}
public Item getTabIconItem() {
return ModItems.itemDimDoor;
}
};
@Mod.EventHandler

View file

@ -7,14 +7,16 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
public class EventHookContainer {
@SubscribeEvent
public void onPlayerEvent(PlayerInteractEvent event) {
// Handle all door placement here
World world = event.getEntity().world;
ItemStack stack = event.getEntityPlayer().inventory.getCurrentItem();
if (stack != null && ItemDoorBase.tryToPlaceDoor(stack, event.getEntityPlayer(), world, event.getPos(), event.getFace()))
// Cancel the event so that we don't get two doors from vanilla doors
if (stack != null && ItemDoorBase.tryToPlaceDoor(stack, event.getEntityPlayer(), world, event.getPos(), event.getFace())) // Cancel the event so that we don't get two doors from vanilla doors
{
event.setCanceled(true);
}
}
}

View file

@ -3,6 +3,8 @@ package com.zixiken.dimdoors;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
public interface IChunkLoader {
boolean isInitialized();
void initialize(Ticket ticket);
}

View file

@ -14,10 +14,12 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
*
* @author Robijnvogel
*/
public interface IDDProxy
{
public interface IDDProxy {
public boolean isClient();
public void onPreInitialization(FMLPreInitializationEvent event);
public void onInitialization(FMLInitializationEvent event);
public EntityPlayer getLocalPlayer();

View file

@ -15,6 +15,7 @@ import static net.minecraft.item.Item.getItemFromBlock;
@SuppressWarnings({"MethodCallSideOnly", "NewExpressionSideOnly"})
public class ModelManager {
public static void registerModels() {
//ItemBlock registration
register(getItemFromBlock(ModBlocks.blockDimWall));

View file

@ -7,6 +7,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockDimDoor extends BlockDimDoorBase {
public static final String ID = "blockDimDoor";
public BlockDimDoor() {
@ -22,5 +23,7 @@ public class BlockDimDoor extends BlockDimDoorBase {
}
@Override
public Item getItemDoor() {return ModItems.itemDimDoor;}
public Item getItemDoor() {
return ModItems.itemDimDoor;
}
}

View file

@ -28,7 +28,9 @@ import javax.annotation.Nullable;
public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, ITileEntityProvider {
public BlockDimDoorBase(Material material) {super(material);}
public BlockDimDoorBase(Material material) {
super(material);
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
@ -37,15 +39,18 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
if(!checkCanOpen(world, pos, player)) {return false;}
if (!checkCanOpen(world, pos, player)) {
return false;
}
if (state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) {
pos = pos.down();
state = world.getBlockState(pos);
}
if(state.getBlock() != this) return false;
else {
if (state.getBlock() != this) {
return false;
} else {
state = state.cycleProperty(BlockDoor.OPEN);
world.setBlockState(pos, state, 2);
world.markBlockRangeForRenderUpdate(pos, pos.up());
@ -54,7 +59,9 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
}
@Override
public boolean hasTileEntity(IBlockState state) {return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;}
public boolean hasTileEntity(IBlockState state) {
return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;
}
@Override
public void onBlockAdded(World world, BlockPos pos, IBlockState state) {
@ -71,7 +78,9 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
return this;
}
public boolean isDoorOnRift(World world, BlockPos pos) {return true;}
public boolean isDoorOnRift(World world, BlockPos pos) {
return true;
}
@Override
public void updateTick(World par1World, BlockPos pos, IBlockState state, Random rand) {
@ -79,7 +88,8 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
}
/**
* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative)
* only called by clickMiddleMouseButton , and passed to
* inventory.setCurrentItem (along with isCreative)
*/
@Override
@SideOnly(Side.CLIENT)
@ -97,10 +107,14 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
@Override
@SideOnly(Side.CLIENT)
public ItemStack getItem(World world, BlockPos pos, IBlockState state) { return new ItemStack(this.getItemDoor(), 1, 0); }
public ItemStack getItem(World world, BlockPos pos, IBlockState state) {
return new ItemStack(this.getItemDoor(), 1, 0);
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {return new TileEntityDimDoor();}
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityDimDoor(world);
}
@Override
public void enterDimDoor(World world, BlockPos pos, Entity entity) {
@ -114,17 +128,20 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
}
} else {
BlockPos up = pos.up();
if (world.getBlockState(up).getBlock() == this) enterDimDoor(world, up, entity);
if (world.getBlockState(up).getBlock() == this) {
enterDimDoor(world, up, entity);
}
}
}
public boolean isUpperDoorBlock(IBlockState state) {return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;}
public boolean isUpperDoorBlock(IBlockState state) {
return state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER;
}
public boolean checkCanOpen(World world, BlockPos pos, EntityPlayer player) {
return true;
}
protected static boolean isEntityFacingDoor(IBlockState state, EntityLivingBase entity) {
// Although any entity has the proper fields for this check,
// we should only apply it to living entities since things
@ -136,7 +153,9 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT
public void breakBlock(World world, BlockPos pos, IBlockState state) {
// This function runs on the server side after a block is replaced
// We MUST call super.breakBlock() since it involves removing tile entities
if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.LOWER) world.setBlockToAir(pos.up());
if (state.getValue(BlockDoor.HALF) == EnumDoorHalf.LOWER) {
world.setBlockToAir(pos.up());
}
super.breakBlock(world, pos, state);
}
}

View file

@ -10,6 +10,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockDimDoorGold extends BlockDimDoorBase {
public static final String ID = "blockDimDoorGold";
public BlockDimDoorGold() {
@ -24,9 +25,13 @@ public class BlockDimDoorGold extends BlockDimDoorBase {
}
@Override
public Item getItemDoor() {return ModItems.itemDimDoorGold;}
public Item getItemDoor() {
return ModItems.itemDimDoorGold;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {return new TileEntityDimDoorGold(world);}
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityDimDoorGold(world);
}
}

View file

@ -7,6 +7,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockDimDoorPersonal extends BlockDimDoorBase {
public static final String ID = "blockDimDoorPersonal";
public BlockDimDoorPersonal() {
@ -21,6 +22,8 @@ public class BlockDimDoorPersonal extends BlockDimDoorBase {
}
@Override
public Item getItemDoor() {return ModItems.itemDimDoorPersonal;}
public Item getItemDoor() {
return ModItems.itemDimDoorPersonal;
}
}

View file

@ -11,6 +11,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockDimDoorTransient extends BlockDimDoorBase {
public static final String ID = "blockDimDoorTransient";
public BlockDimDoorTransient() {
@ -33,7 +34,9 @@ public class BlockDimDoorTransient extends BlockDimDoorBase {
}
} else {
BlockPos up = pos.up();
if (world.getBlockState(up).getBlock() == this) enterDimDoor(world, up, entity);
if (world.getBlockState(up).getBlock() == this) {
enterDimDoor(world, up, entity);
}
}
}
@ -42,8 +45,12 @@ public class BlockDimDoorTransient extends BlockDimDoorBase {
}
@Override
public Item getItemDoor() {return null;}
public Item getItemDoor() {
return null;
}
@Override
public boolean isCollidable() {return false;}
public boolean isCollidable() {
return false;
}
}

View file

@ -11,6 +11,7 @@ import net.minecraft.world.World;
import java.util.Random;
public class BlockDimDoorUnstable extends BlockDimDoorBase {
public static final String ID = "blockDimDoorChaos";
public BlockDimDoorUnstable() {
@ -26,8 +27,12 @@ public class BlockDimDoorUnstable extends BlockDimDoorBase {
}
@Override
public Item getItemDoor() {return ModItems.itemDimDoorChaos;}
public Item getItemDoor() {
return ModItems.itemDimDoorChaos;
}
@Override
public Item getItemDropped(IBlockState state, Random random, int fortune) {return Items.IRON_DOOR;}
public Item getItemDropped(IBlockState state, Random random, int fortune) {
return Items.IRON_DOOR;
}
}

View file

@ -7,6 +7,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockDimDoorWarp extends BlockDimDoorBase {
public static final String ID = "blockDimDoorWarp";
public BlockDimDoorWarp() {
@ -21,5 +22,7 @@ public class BlockDimDoorWarp extends BlockDimDoorBase {
}
@Override
public Item getItemDoor() {return ModItems.itemDimDoorWarp;}
public Item getItemDoor() {
return ModItems.itemDimDoorWarp;
}
}

View file

@ -31,6 +31,7 @@ import javax.annotation.Nullable;
@SuppressWarnings("deprecation")
public class BlockDimWall extends Block {
public static final String ID = "blockDimWall";
public static final PropertyInteger TYPE = PropertyInteger.create("type", 0, 2);
@ -50,33 +51,47 @@ public class BlockDimWall extends Block {
@Override
public IBlockState getStateFromMeta(int meta) {
if(meta >= 0 && meta <= 2) return getDefaultState().withProperty(TYPE, meta);
else return getDefaultState();
if (meta >= 0 && meta <= 2) {
return getDefaultState().withProperty(TYPE, meta);
} else {
return getDefaultState();
}
}
@Override
public boolean isReplaceable(IBlockAccess world, BlockPos pos) {
if(world.getBlockState(pos).getValue(TYPE) == 1) return false;
if (world.getBlockState(pos).getValue(TYPE) == 1) {
return false;
}
return true;
}
@Override
public int getMetaFromState(IBlockState state) {return state.getValue(TYPE);}
public int getMetaFromState(IBlockState state) {
return state.getValue(TYPE);
}
@Override
protected BlockStateContainer createBlockState() {return new BlockStateContainer(this, TYPE);}
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, TYPE);
}
@Override
public float getBlockHardness(IBlockState state, World world, BlockPos pos) {
if (state.getValue(TYPE) != 1) return this.blockHardness;
else return SUPER_HIGH_HARDNESS;
if (state.getValue(TYPE) != 1) {
return this.blockHardness;
} else {
return SUPER_HIGH_HARDNESS;
}
}
@Override
public float getExplosionResistance(World world, BlockPos pos, Entity exploder, Explosion explosion) {
if(world.getBlockState(pos).getValue(TYPE) != 1)
if (world.getBlockState(pos).getValue(TYPE) != 1) {
return super.getExplosionResistance(world, pos, exploder, explosion);
else return SUPER_EXPLOSION_RESISTANCE;
} else {
return SUPER_EXPLOSION_RESISTANCE;
}
}
@Override
@ -89,13 +104,13 @@ public class BlockDimWall extends Block {
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(Item itemIn, CreativeTabs tab, List<ItemStack> subItems) {
for (int ix = 0; ix < 3; ix++)
for (int ix = 0; ix < 3; ix++) {
subItems.add(new ItemStack(itemIn, 1, ix));
}
}
@Override
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player)
{
public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) {
return true;
}
@ -105,8 +120,7 @@ public class BlockDimWall extends Block {
}
@Override
public int quantityDropped(Random par1Random)
{
public int quantityDropped(Random par1Random) {
return 0;
}
}

View file

@ -14,6 +14,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockDoorGold extends BlockDoor {
public static final String ID = "blockDoorGold";
public BlockDoorGold() {

View file

@ -14,6 +14,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockDoorQuartz extends BlockDoor {
public static final String ID = "blockDoorQuartz";
public BlockDoorQuartz() {

View file

@ -32,6 +32,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SuppressWarnings("deprecation")
public class BlockRift extends Block implements ITileEntityProvider {
private static final float MIN_IMMUNE_RESISTANCE = 5000.0F;
public static final String ID = "blockRift";
@ -67,10 +68,14 @@ public class BlockRift extends Block implements ITileEntityProvider {
}
@Override
public boolean isCollidable() {return false;}
public boolean isCollidable() {
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state) {return false;}
public boolean isOpaqueCube(IBlockState state) {
return false;
}
@Override
public AxisAlignedBB getCollisionBoundingBox(IBlockState state, World world, BlockPos pos) {
@ -78,21 +83,21 @@ public class BlockRift extends Block implements ITileEntityProvider {
}
/**
* Returns whether this block is collideable based on the arguments passed in Args: blockMetaData, unknownFlag
* Returns whether this block is collideable based on the arguments passed
* in Args: blockMetaData, unknownFlag
*/
@Override
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid)
{
public boolean canCollideCheck(IBlockState state, boolean hitIfLiquid) {
return hitIfLiquid;
}
/**
* Returns Returns true if the given side of this block type should be rendered (if it's solid or not), if the
* adjacent block is at the given coordinates. Args: blockAccess, x, y, z, side
* Returns Returns true if the given side of this block type should be
* rendered (if it's solid or not), if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
@Override
public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
public boolean isBlockSolid(IBlockAccess worldIn, BlockPos pos, EnumFacing side) {
return true;
}
@ -119,8 +124,9 @@ public class BlockRift extends Block implements ITileEntityProvider {
}
/**
* regulates the render effect, especially when multiple rifts start to link up.
* Has 3 main parts- Grows toward and away from nearest rift, bends toward it, and a randomization function
* regulates the render effect, especially when multiple rifts start to link
* up. Has 3 main parts- Grows toward and away from nearest rift, bends
* toward it, and a randomization function
*/
@Override
@SideOnly(Side.CLIENT)
@ -137,13 +143,14 @@ public class BlockRift extends Block implements ITileEntityProvider {
x + .5, y + .5, z + .5,
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
if(tile.shouldClose)
//renders an opposite color effect if it is being closed by the rift remover
if (tile.shouldClose) //renders an opposite color effect if it is being closed by the rift remover
{
FMLClientHandler.instance().getClient().effectRenderer.addEffect(new ClosingRiftFX(
worldIn,
x + .5, y + .5, z + .5,
rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D, rand.nextGaussian() * 0.01D));
}
}
public boolean tryPlacingRift(World world, BlockPos pos) {
return world != null && !isBlockImmune(world, pos) && world.setBlockState(pos, getDefaultState());
@ -156,10 +163,10 @@ public class BlockRift extends Block implements ITileEntityProvider {
// may have low hardness to make them easier to build with. However, block.getExplosionResistance()
// is designed to receive an entity, the source of the blast. We have no entity so
// I've set this to access blockResistance directly. Might need changing later.
return block != null /*&&
(block >= MIN_IMMUNE_RESISTANCE*/ ||
modBlocksImmuneToRift.contains(block) ||
blocksImmuneToRift.contains(block);
return block != null
/*&&
(block >= MIN_IMMUNE_RESISTANCE*/ || modBlocksImmuneToRift.contains(block)
|| blocksImmuneToRift.contains(block);
}
public boolean isModBlockImmune(World world, BlockPos pos) {
@ -175,11 +182,12 @@ public class BlockRift extends Block implements ITileEntityProvider {
}
@Override
public Item getItemDropped(IBlockState state, Random rand, int fortune) {return null;}
public Item getItemDropped(IBlockState state, Random rand, int fortune) {
return null;
}
@Override
public TileEntity createNewTileEntity(World world, int metadata)
{
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityRift(world);
}

View file

@ -25,6 +25,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class BlockTransTrapdoor extends BlockTrapDoor implements IDimDoor, ITileEntityProvider {
public static final String ID = "blockDimHatch";
public BlockTransTrapdoor() {
@ -42,19 +43,25 @@ public class BlockTransTrapdoor extends BlockTrapDoor implements IDimDoor, ITile
enterDimDoor(world, pos, entity);
}
public boolean checkCanOpen(World world, BlockPos pos) {return this.checkCanOpen(world, pos, null);}
public boolean checkCanOpen(World world, BlockPos pos) {
return this.checkCanOpen(world, pos, null);
}
public boolean checkCanOpen(World world, BlockPos pos, EntityPlayer player) {return true;}
public boolean checkCanOpen(World world, BlockPos pos, EntityPlayer player) {
return true;
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
return checkCanOpen(worldIn, pos, playerIn) &&
super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
return checkCanOpen(worldIn, pos, playerIn)
&& super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
}
@Override
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block neighborBlock) {
if(checkCanOpen(worldIn, pos)) super.neighborChanged(state, worldIn, pos, neighborBlock);
if (checkCanOpen(worldIn, pos)) {
super.neighborChanged(state, worldIn, pos, neighborBlock);
}
}
@Override
@ -75,7 +82,9 @@ public class BlockTransTrapdoor extends BlockTrapDoor implements IDimDoor, ITile
}
@Override
public TileEntity createNewTileEntity(World world, int metadata) {return new TileEntityTransTrapdoor(world);}
public TileEntity createNewTileEntity(World world, int metadata) {
return new TileEntityTransTrapdoor(world);
}
@Override
public void placeLink(World world, BlockPos pos) {
@ -93,14 +102,18 @@ public class BlockTransTrapdoor extends BlockTrapDoor implements IDimDoor, ITile
}
@Override
public Item getItemDoor() {return Item.getItemFromBlock(ModBlocks.blockDimHatch);}
public Item getItemDoor() {
return Item.getItemFromBlock(ModBlocks.blockDimHatch);
}
public static boolean isTrapdoorSetLow(IBlockState state) {
return state.getValue(BlockTrapDoor.HALF) == DoorHalf.BOTTOM;
}
@Override
public boolean isDoorOnRift(World world, BlockPos pos) {return true;}
public boolean isDoorOnRift(World world, BlockPos pos) {
return true;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {

View file

@ -6,10 +6,12 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public interface IDimDoor
{
public interface IDimDoor {
/**
* A function to enter a dim door and traverse its link, called when a player collides with an open door
* A function to enter a dim door and traverse its link, called when a
* player collides with an open door
*
* @param world
* @param x
* @param y
@ -20,6 +22,7 @@ public interface IDimDoor
/**
* called when a door is placed to determine how it will place a link
*
* @param world
* @param x
* @param y
@ -31,6 +34,7 @@ public interface IDimDoor
/**
* checks if any of this doors blocks are overlapping with a rift
*
* @param world
* @param x
* @param y

View file

@ -3,6 +3,7 @@ package com.zixiken.dimdoors.blocks;
import net.minecraftforge.fml.common.registry.GameRegistry;
public class ModBlocks {
public static BlockDoorQuartz blockDoorQuartz;
public static BlockDoorGold blockDoorGold;
public static BlockDimDoorPersonal blockDimDoorPersonal;

View file

@ -10,8 +10,8 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClosingRiftFX extends Particle
{
public class ClosingRiftFX extends Particle {
private int baseTextureIndex = 160;
private boolean trail;
private boolean twinkle;
@ -35,10 +35,11 @@ public class ClosingRiftFX extends Particle
float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_) {
if (!this.twinkle
|| this.particleAge < this.particleMaxAge / 3
|| (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
|| (this.particleAge + this.particleMaxAge) / 3 % 2 == 0) {
this.doRenderParticle(worldRenderer, partialTicks, p_180434_4_,
p_180434_5_, p_180434_6_, p_180434_7_, p_180434_8_);
}
}
public void doRenderParticle(VertexBuffer worldRenderer, float par2, float par3, float par4,
float par5, float par6, float par7) {
@ -81,7 +82,8 @@ public class ClosingRiftFX extends Particle
if (this.particleAge++ >= this.particleMaxAge) {
this.setExpired();
} if (this.particleAge > this.particleMaxAge / 2) {
}
if (this.particleAge > this.particleMaxAge / 2) {
this.setAlphaF(1.0F - ((float) this.particleAge - (float) (this.particleMaxAge / 2)) / this.particleMaxAge);
if (this.hasFadeColour) {

View file

@ -10,7 +10,6 @@ import net.minecraft.world.World;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
public class DDProxyClient extends DDProxyCommon {
@Override

View file

@ -8,6 +8,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GoggleRiftFX extends ParticleCloud {
public GoggleRiftFX(World par1World, double par2, double par4, double par6,
double par8, double par10, double par12) {
super(par1World, par2, par4, par6, par12, par12, par12);

View file

@ -26,6 +26,7 @@ import static org.lwjgl.opengl.GL11.*;
@SideOnly(Side.CLIENT)
public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor> {
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
private ResourceLocation warpPath = new ResourceLocation(DimDoors.MODID + ":textures/other/WARP.png");
private ResourceLocation keyPath = new ResourceLocation(DimDoors.MODID + ":textures/other/keyhole.png");
@ -226,7 +227,6 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
GL11.glDisable(GL_LIGHTING);
GL11.glEnable(GL11.GL_BLEND);
if (i == 1) {
@ -260,7 +260,6 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
GlStateManager.popMatrix();
}
@Override
public void renderTileEntityAt(TileEntityDimDoor te, double x, double y, double z, float partialTicks, int destroyStage) {
World world = te.getWorld();
@ -268,8 +267,11 @@ public class RenderDimDoor extends TileEntitySpecialRenderer<TileEntityDimDoor>
((BlockDimDoorBase) world.getBlockState(pos).getBlock()).updateAttachedTile(world, pos);
if (te.openOrClosed) {
renderDimDoorTileEntity(te, x, y, z);
if(te.lockStatus >= 1)
for(int i = 0; i < 1+te.lockStatus; i++ ) this.renderKeyHole(te, x, y, z, i);
if (te.lockStatus >= 1) {
for (int i = 0; i < 1 + te.lockStatus; i++) {
this.renderKeyHole(te, x, y, z, i);
}
}
}
}

View file

@ -23,6 +23,7 @@ import org.lwjgl.opengl.GL11;
@SideOnly(Side.CLIENT)
public class RenderTransTrapdoor extends TileEntitySpecialRenderer<TileEntityTransTrapdoor> {
private FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16);
private ResourceLocation riftPath = new ResourceLocation(DimDoors.MODID + ":textures/other/RIFT.png");
private ResourceLocation warpPath = new ResourceLocation(DimDoors.MODID + ":textures/other/WARP.png");

View file

@ -8,6 +8,7 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
public class ItemBlockDimWall extends ItemBlock {
private final static String[] subNames = {"", "Ancient", "Altered"};
public ItemBlockDimWall() {
@ -19,8 +20,7 @@ public class ItemBlockDimWall extends ItemBlock {
}
@Override
public int getMetadata (int damageValue)
{
public int getMetadata(int damageValue) {
return damageValue;
}

View file

@ -10,6 +10,7 @@ import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
public class ItemDimDoor extends ItemDoorBase {
public static final String ID = "itemDimDoor";
public ItemDimDoor() {
@ -24,5 +25,7 @@ public class ItemDimDoor extends ItemDoorBase {
}
@Override
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoor;}
protected BlockDimDoorBase getDoorBlock() {
return ModBlocks.blockDimDoor;
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class ItemDimDoorGold extends ItemDoorBase {
public static final String ID = "itemDimDoorGold";
public ItemDimDoorGold() {
@ -15,11 +16,14 @@ public class ItemDimDoorGold extends ItemDoorBase {
setUnlocalizedName(ID);
setRegistryName(ID);
}
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
translateAndAdd("info.goldDimDoor", tooltip);
}
@Override
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorGold;}
protected BlockDimDoorBase getDoorBlock() {
return ModBlocks.blockDimDoorGold;
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class ItemDimDoorPersonal extends ItemDoorBase {
public static final String ID = "itemDimDoorQuartz";
public ItemDimDoorPersonal() {
@ -22,5 +23,7 @@ public class ItemDimDoorPersonal extends ItemDoorBase {
}
@Override
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorPersonal;}
protected BlockDimDoorBase getDoorBlock() {
return ModBlocks.blockDimDoorPersonal;
}
}

View file

@ -8,6 +8,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
public class ItemDimDoorUnstable extends ItemDoorBase {
public static final String ID = "itemDimDoorChaos";
public ItemDimDoorUnstable() {
@ -22,5 +23,7 @@ public class ItemDimDoorUnstable extends ItemDoorBase {
}
@Override
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorChaos;}
protected BlockDimDoorBase getDoorBlock() {
return ModBlocks.blockDimDoorChaos;
}
}

View file

@ -11,6 +11,7 @@ import net.minecraft.item.ItemDoor;
import net.minecraft.item.ItemStack;
public class ItemDimDoorWarp extends ItemDoorBase {
public static final String ID = "itemDimDoorWarp";
public ItemDimDoorWarp() {
@ -25,5 +26,7 @@ public class ItemDimDoorWarp extends ItemDoorBase {
}
@Override
protected BlockDimDoorBase getDoorBlock() {return ModBlocks.blockDimDoorWarp;}
protected BlockDimDoorBase getDoorBlock() {
return ModBlocks.blockDimDoorWarp;
}
}

View file

@ -24,10 +24,13 @@ import com.zixiken.dimdoors.tileentities.TileEntityDimDoor;
public abstract class ItemDoorBase extends ItemDoor {
// Maps non-dimensional door items to their corresponding dimensional door item
// Also maps dimensional door items to themselves for simplicity
private static HashMap<ItemDoor, ItemDoorBase> doorItemMapping = new HashMap<ItemDoor, ItemDoorBase>();
/**
* door represents the non-dimensional door this item is associated with. Leave null for none.
* door represents the non-dimensional door this item is associated with.
* Leave null for none.
*
* @param vanillaDoor
*/
public ItemDoorBase(Block block, ItemDoor vanillaDoor) {
@ -36,9 +39,10 @@ public abstract class ItemDoorBase extends ItemDoor {
this.setCreativeTab(DimDoors.dimDoorsCreativeTab);
doorItemMapping.put(this, this);
if (vanillaDoor != null)
if (vanillaDoor != null) {
doorItemMapping.put(vanillaDoor, this);
}
}
@Override
public abstract void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced);
@ -56,7 +60,9 @@ public abstract class ItemDoorBase extends ItemDoor {
* dimensional doors, we handle this in the EventHookContainer
*/
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {return EnumActionResult.FAIL;}
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) {
return EnumActionResult.FAIL;
}
/**
* Tries to place a door as a dimensional door
@ -68,20 +74,25 @@ public abstract class ItemDoorBase extends ItemDoor {
* @return
*/
public static boolean tryToPlaceDoor(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side) {
if (world.isRemote) return false;
if (world.isRemote) {
return false;
}
// Retrieve the actual door type that we want to use here.
// It's okay if stack isn't an ItemDoor. In that case, the lookup will
// return null, just as if the item was an unrecognized door type.
ItemDoorBase mappedItem = doorItemMapping.get(stack.getItem());
if (mappedItem == null) return false;
if (mappedItem == null) {
return false;
}
BlockDimDoorBase doorBlock = mappedItem.getDoorBlock();
return ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side) ||
ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack);
return ItemDoorBase.placeDoorOnBlock(doorBlock, stack, player, world, pos, side)
|| ItemDoorBase.placeDoorOnRift(doorBlock, world, player, stack);
}
/**
* try to place a door block on a block
*
* @param doorBlock
* @param stack
* @param player
@ -92,20 +103,26 @@ public abstract class ItemDoorBase extends ItemDoor {
*/
public static boolean placeDoorOnBlock(Block doorBlock, ItemStack stack, EntityPlayer player,
World world, BlockPos pos, EnumFacing side) {
if (world.isRemote) return false;
if (world.isRemote) {
return false;
}
// Only place doors on top of blocks - check if we're targeting the top
// side
if (side == EnumFacing.UP) {
Block block = world.getBlockState(pos).getBlock();
if (!world.getBlockState(pos).equals(Blocks.AIR) && !block.isReplaceable(world, pos)) pos = pos.up();
if (!world.getBlockState(pos).equals(Blocks.AIR) && !block.isReplaceable(world, pos)) {
pos = pos.up();
}
BlockPos upPos = pos.up();
if (canPlace(world, pos) && canPlace(world, upPos) && player.canPlayerEdit(pos, side, stack)
&& player.canPlayerEdit(upPos, side, stack) && stack.stackSize > 0
&& stack.getItem() instanceof ItemDoorBase) {
placeDoor(world, pos, EnumFacing.fromAngle(player.rotationYaw), doorBlock, true);
if (!player.capabilities.isCreativeMode) stack.stackSize--;
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
}
return true;
}
}
@ -122,20 +139,25 @@ public abstract class ItemDoorBase extends ItemDoor {
* @return
*/
public static boolean placeDoorOnRift(Block doorBlock, World world, EntityPlayer player, ItemStack stack) {
if (world.isRemote) return false;
if (world.isRemote) {
return false;
}
RayTraceResult hit = ItemDoorBase.doRayTrace(world, player, true);
if (hit != null) {
BlockPos pos = hit.getBlockPos();
if (world.getBlockState(pos).getBlock() == ModBlocks.blockRift) {
BlockPos downPos = pos.down();
if (player.canPlayerEdit(pos, hit.sideHit, stack) &&
player.canPlayerEdit(downPos, hit.sideHit, stack) &&
canPlace(world, pos) && canPlace(world, downPos)) {
if (player.canPlayerEdit(pos, hit.sideHit, stack)
&& player.canPlayerEdit(downPos, hit.sideHit, stack)
&& canPlace(world, pos) && canPlace(world, downPos)) {
placeDoor(world, downPos, EnumFacing.fromAngle(player.rotationYaw), doorBlock, true);
if (!(stack.getItem() instanceof ItemDoorBase))
if (!(stack.getItem() instanceof ItemDoorBase)) {
((TileEntityDimDoor) world.getTileEntity(pos)).hasGennedPair = true;
if (!player.capabilities.isCreativeMode) stack.stackSize--;
}
if (!player.capabilities.isCreativeMode) {
stack.stackSize--;
}
return true;
}
}
@ -150,8 +172,7 @@ public abstract class ItemDoorBase extends ItemDoor {
}
/**
* Copied from minecraft Item.class
* TODO we probably can improve this
* Copied from minecraft Item.class TODO we probably can improve this
*
* @param world
* @param player
@ -172,8 +193,9 @@ public abstract class ItemDoorBase extends ItemDoor {
float f6 = f3 * f4;
float f7 = f2 * f4;
double d3 = 5.0D;
if (player instanceof EntityPlayerMP)
if (player instanceof EntityPlayerMP) {
d3 = ((EntityPlayerMP) player).interactionManager.getBlockReachDistance();
}
Vec3d vec31 = vec3.addVector((double) f6 * d3, (double) f5 * d3, (double) f7 * d3);
return world.rayTraceBlocks(vec3, vec31, useLiquids, !useLiquids, false);
}

View file

@ -4,6 +4,7 @@ import com.zixiken.dimdoors.blocks.ModBlocks;
import net.minecraft.item.ItemDoor;
public class ItemDoorGold extends ItemDoor {
public static final String ID = "itemDoorGold";
public ItemDoorGold() {

View file

@ -4,6 +4,7 @@ import com.zixiken.dimdoors.blocks.ModBlocks;
import net.minecraft.item.ItemDoor;
public class ItemDoorQuartz extends ItemDoor {
public static final String ID = "itemDoorQuartz";
public ItemDoorQuartz() {

View file

@ -4,6 +4,7 @@ import com.zixiken.dimdoors.DimDoors;
import net.minecraft.item.Item;
public class ItemStableFabric extends Item {
public static final String ID = "itemStableFabric";
public ItemStableFabric() {

View file

@ -4,6 +4,7 @@ import com.zixiken.dimdoors.DimDoors;
import net.minecraft.item.Item;
public class ItemWorldThread extends Item {
public static final String ID = "itemWorldThread";
public ItemWorldThread() {

View file

@ -5,6 +5,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry;
import com.zixiken.dimdoors.blocks.ModBlocks;
public class ModItems {
public static ItemDimDoorGold itemDimDoorGold;
public static ItemDoorGold itemDoorGold;
public static ItemWorldThread itemWorldThread;

View file

@ -48,7 +48,6 @@ class Pocket {
NBTTagCompound pocketNBT = new NBTTagCompound();
//@todo implement shit;
return pocketNBT;
}

View file

@ -8,8 +8,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public abstract class DDTileEntityBase extends TileEntity
{
public abstract class DDTileEntityBase extends TileEntity {
public boolean isPaired = false;
public int riftID;
public int pairedRiftID;
@ -35,8 +35,7 @@ public abstract class DDTileEntityBase extends TileEntity
if (isPaired) {
if (otherRiftID == pairedRiftID) {
return;
}
else {
} else {
RiftRegistry.Instance.unpair(pairedRiftID);
}
}
@ -49,8 +48,7 @@ public abstract class DDTileEntityBase extends TileEntity
public void unpair() {
if (!isPaired) {
return;
}
else {
} else {
isPaired = false;
RiftRegistry.Instance.unpair(pairedRiftID);
}
@ -69,7 +67,8 @@ public abstract class DDTileEntityBase extends TileEntity
this.isPaired = nbt.getBoolean("isPaired");
this.riftID = nbt.getInteger("riftID");
this.pairedRiftID = nbt.getInteger("pairedRiftID");
} catch (Exception e) {}
} catch (Exception e) {
}
}
@Override

View file

@ -6,9 +6,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
public class TileEntityDimDoor extends DDTileEntityBase {
public class TileEntityDimDoor extends DDTileEntityBase
{
public boolean openOrClosed;
public EnumFacing orientation;
public boolean hasExit;
@ -30,7 +29,8 @@ public class TileEntityDimDoor extends DDTileEntityBase
this.hasExit = nbt.getBoolean("hasExit");
this.isDungeonChainLink = nbt.getBoolean("isDungeonChainLink");
this.hasGennedPair = nbt.getBoolean("hasGennedPair");
} catch (Exception e) {}
} catch (Exception e) {
}
}
@Override

View file

@ -6,6 +6,7 @@ import net.minecraftforge.common.ForgeChunkManager;
import net.minecraftforge.common.ForgeChunkManager.Ticket;
public class TileEntityDimDoorGold extends TileEntityDimDoor implements IChunkLoader {
private Ticket chunkTicket;
private boolean initialized = false;

View file

@ -4,6 +4,7 @@ import net.minecraft.world.DimensionType;
import net.minecraft.world.WorldProvider;
public class PocketProvider extends WorldProvider {
/*@Override
public String getDimensionName() {
return "Pocket Dimension";