Skip to content

Commit

Permalink
Merge pull request #1 from micdoodle8/master
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
ETStarLight authored Mar 4, 2018
2 parents 9a70fcb + 8f78a6f commit 0e4592e
Show file tree
Hide file tree
Showing 29 changed files with 1,477 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public void onUpdate()
this.riddenByEntity.fallDistance = 0.0F;
}

if (this.posY > (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200))
if (this.posY > (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200) && this.launchPhase != EnumLaunchPhase.LANDING.ordinal())
{
this.onReachAtmosphere();
// if (this.worldObj.isRemote)
Expand All @@ -259,7 +259,7 @@ public void onUpdate()
this.setDead();
}
else
if (this.posY > (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200) + 100)
if (this.posY > (this.worldObj.provider instanceof IExitHeight ? ((IExitHeight) this.worldObj.provider).getYCoordinateToTeleport() : 1200) + (this.launchPhase == EnumLaunchPhase.LANDING.ordinal() ? 355 : 100))
{
if (this.riddenByEntity instanceof EntityPlayerMP)
{
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/micdoodle8/mods/galacticraft/core/GCBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public class GCBlocks
public static Block concealedRepeater_Unpowered;
public static Block concealedDetector;
public static Block platform;
public static Block emergencyBox;

public static final Material machine = new Material(MapColor.ironColor);

Expand Down Expand Up @@ -172,6 +173,7 @@ public static void initBlocks()
GCBlocks.concealedRepeater_Unpowered = new BlockConcealedRepeater("concealed_repeater", false);
GCBlocks.concealedDetector = new BlockConcealedDetector("concealed_detector");
GCBlocks.platform = new BlockPlatform("platform");
GCBlocks.emergencyBox = new BlockEmergencyBox("emergency_box");

// Hide certain items from NEI
GCBlocks.hiddenBlocks.add(GCBlocks.airLockSeal);
Expand Down Expand Up @@ -430,6 +432,7 @@ public static void registerBlocks()
registerBlock(GCBlocks.concealedRepeater_Unpowered, ItemBlockGC.class);
registerBlock(GCBlocks.concealedDetector, ItemBlockCreativeGC.class);
registerBlock(GCBlocks.platform, ItemBlockDesc.class);
registerBlock(GCBlocks.emergencyBox, ItemBlockEmergencyBox.class);
// GCCoreUtil.sortBlock(GCBlocks.aluminumWire, 0, new StackSorted(GCBlocks.landingPad, 1));
// GCCoreUtil.sortBlock(GCBlocks.aluminumWire, 1, new StackSorted(GCBlocks.aluminumWire, 0));
// GCCoreUtil.sortBlock(GCBlocks.oxygenPipe, 0, new StackSorted(GCBlocks.aluminumWire, 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ private void registerTileEntities()
GameRegistry.registerTileEntity(TileEntityFluidTank.class, "GC Fluid Tank");
GameRegistry.registerTileEntity(TileEntityPlayerDetector.class, "GC Player Detector");
GameRegistry.registerTileEntity(TileEntityPlatform.class, "GC Platform");
GameRegistry.registerTileEntity(TileEntityEmergencyBox.class, "GC Emergency Post");
GameRegistry.registerTileEntity(TileEntityNull.class, "GC Null Tile");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;

import java.lang.reflect.Method;
Expand Down Expand Up @@ -229,4 +230,9 @@ else if (metaDir == 5)
world.setBlockState(pos, this.getStateFromMeta(metaDir), 3);
}

@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing side)
{
return this.isNormalCube(world, pos);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
package micdoodle8.mods.galacticraft.core.blocks;

import java.util.List;

import micdoodle8.mods.galacticraft.api.block.IPartialSealableBlock;
import micdoodle8.mods.galacticraft.core.GalacticraftCore;
import micdoodle8.mods.galacticraft.core.items.IShiftDescription;
import micdoodle8.mods.galacticraft.core.tile.TileEntityEmergencyBox;
import micdoodle8.mods.galacticraft.core.util.EnumSortCategoryBlock;
import micdoodle8.mods.galacticraft.core.util.GCCoreUtil;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class BlockEmergencyBox extends BlockAdvancedTile implements IShiftDescription, ISortableBlock, IPartialSealableBlock
{
public static final PropertyBool KIT = PropertyBool.create("kit");

public BlockEmergencyBox(String assetName)
{
super(Material.iron);
this.setHardness(4.0F);
this.setResistance(70F);
this.setStepSound(Block.soundTypeMetal);
this.setLightLevel(1.0F);
this.setUnlocalizedName(assetName);
this.setDefaultState(this.blockState.getBaseState().withProperty(KIT, false));
}

@Override
protected BlockState createBlockState()
{
return new BlockState(this, KIT);
}

@Override
public IBlockState getStateFromMeta(int meta)
{
return this.getDefaultState().withProperty(KIT, meta % 2 == 1);
}

@Override
public int getMetaFromState(IBlockState state)
{
return (state.getValue(KIT) ? 1 : 0);
}

@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List<ItemStack> par3List)
{
par3List.add(new ItemStack(par1, 1, 0));
par3List.add(new ItemStack(par1, 1, 1));
}

@Override
public int damageDropped(IBlockState state)
{
return getMetaFromState(state);
}

@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player)
{
return new ItemStack(this, 1, this.getDamageValue(world, pos));
}

@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer()
{
return EnumWorldBlockLayer.CUTOUT;
}

@Override
public boolean isOpaqueCube()
{
return false;
}

@Override
public boolean isFullCube()
{
return false;
}

@Override
public TileEntity createNewTileEntity(World world, int meta)
{
return new TileEntityEmergencyBox();
}

@Override
public CreativeTabs getCreativeTabToDisplayOn()
{
return GalacticraftCore.galacticraftBlocksTab;
}

@Override
public boolean onMachineActivated(World world, BlockPos pos, IBlockState state, EntityPlayer entityPlayer, EnumFacing side, float hitX, float hitY, float hitZ)
{
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileEntityEmergencyBox)
{
if (!world.isRemote)
{
((TileEntityEmergencyBox)tile).click(entityPlayer, side, state.getValue(KIT));
}
return true;
}
return false;
}

@Override
public String getShiftDescription(int meta)
{
return GCCoreUtil.translate(this.getUnlocalizedName() + ".description");
}

@Override
public boolean showDescription(int meta)
{
return true;
}

@Override
public EnumSortCategoryBlock getCategory(int meta)
{
return EnumSortCategoryBlock.GENERAL;
}

@Override
public boolean isSealed(World world, BlockPos pos, EnumFacing direction)
{
return direction.ordinal() < 2;
}

@Override
public boolean isSideSolid(IBlockAccess world, BlockPos pos, EnumFacing direction)
{
return direction.ordinal() < 2;
}
}
Loading

0 comments on commit 0e4592e

Please sign in to comment.