Skip to content

Commit

Permalink
Updated to SecurityCraft v1.7.4 for 1.7.10 and 1.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
Geforce132 committed Apr 11, 2015
1 parent ad962e4 commit a8a4574
Show file tree
Hide file tree
Showing 70 changed files with 2,059 additions and 197 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.freeforums.geforce.securitycraft.interfaces.IHelpInfo;
import org.freeforums.geforce.securitycraft.main.mod_SecurityCraft;
import org.freeforums.geforce.securitycraft.tileentity.TileEntityAlarm;
import org.freeforums.geforce.securitycraft.tileentity.TileEntityOwnable;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
Expand Down Expand Up @@ -83,7 +84,7 @@ public void onBlockAdded(World par1World, int par2, int par3, int par4) {
*/
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack p_149689_6_)
{
((TileEntityAlarm) par1World.getTileEntity(par2, par3, par4)).setOwner(((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(), par5EntityLivingBase.getCommandSenderName());
((TileEntityOwnable) par1World.getTileEntity(par2, par3, par4)).setOwner(((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(), par5EntityLivingBase.getCommandSenderName());

int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
Expand All @@ -21,7 +20,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockCageTrap extends Block implements IHelpInfo {
public class BlockCageTrap extends BlockOwnable implements IHelpInfo {

public final boolean deactivated;
private final int blockTextureIndex;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package org.freeforums.geforce.securitycraft.blocks;

import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

import org.freeforums.geforce.securitycraft.interfaces.IHelpInfo;
import org.freeforums.geforce.securitycraft.tileentity.TileEntityKeypadFrame;
import org.freeforums.geforce.securitycraft.tileentity.TileEntityOwnable;

public class BlockKeypadFrame extends BlockOwnable implements IHelpInfo {

public BlockKeypadFrame(Material par1) {
super(par1);
}

public boolean renderAsNormalBlock(){
return false;
}

public boolean isNormalCube(){
return false;
}

public boolean isOpaqueCube(){
return false;
}

public int getRenderType(){
return -1;
}

/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

((TileEntityOwnable) par1World.getTileEntity(par2, par3, par4)).setOwner(((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(), par5EntityLivingBase.getCommandSenderName());

if(l == 0){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
}

if(l == 1){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
}

if(l == 2){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
}

if(l == 3){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
}else{
return;
}

}

public void registerBlockIcons(IIconRegister icon){
this.blockIcon = icon.registerIcon("stone");
}

public TileEntity createNewTileEntity(World var1, int var2) {
return new TileEntityKeypadFrame();
}

public String getHelpInfo() {
return "The keypad frame is used in the keypad's crafting recipe.";
}

public String[] getRecipe() {
return new String[]{"The keypad frame requires: 8 stone, 1 redstone", "XXX", "XYX", "X X", "X = stone, Y = redstone"};
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
package org.freeforums.geforce.securitycraft.blocks;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;

import org.freeforums.geforce.securitycraft.interfaces.IHelpInfo;
import org.freeforums.geforce.securitycraft.main.mod_SecurityCraft;
import org.freeforums.geforce.securitycraft.tileentity.TileEntityKeypadFurnace;

public class BlockKeypadFurnace extends BlockContainer implements IHelpInfo {

private Random random = new Random();

public BlockKeypadFurnace(Material materialIn) {
super(materialIn);
}

public boolean renderAsNormalBlock(){
return false;
}

public boolean isNormalCube(){
return false;
}

public boolean isOpaqueCube(){
return false;
}

public int getRenderType(){
return -1;
}

public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){
if(par1World.isRemote){
return true;
}else{
System.out.println(mod_SecurityCraft.instance.ircBots.size());
TileEntityKeypadFurnace TE = (TileEntityKeypadFurnace) par1World.getTileEntity(par2, par3, par4);
if(TE.getKeypadCode() != null && !TE.getKeypadCode().isEmpty()){
par5EntityPlayer.openGui(mod_SecurityCraft.instance, 15, par1World, par2, par3, par4);
}else{
par5EntityPlayer.openGui(mod_SecurityCraft.instance, 14, par1World, par2, par3, par4);
}

return true;
}
}

/**
* Called when the block is placed in the world.
*/
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack){
int l = MathHelper.floor_double((double)(par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

((TileEntityKeypadFurnace) par1World.getTileEntity(par2, par3, par4)).setOwner(((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(), par5EntityLivingBase.getCommandSenderName());

if(l == 0){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 1, 2);
}

if(l == 1){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 4, 2);
}

if(l == 2){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 3, 2);
}

if(l == 3){
par1World.setBlockMetadataWithNotify(par2, par3, par4, 2, 2);
}else{
return;
}
}

public void breakBlock(World par1World, int par2, int par3, int par4, Block par5Block, int par6){
TileEntityKeypadFurnace tileentityfurnace = (TileEntityKeypadFurnace) par1World.getTileEntity(par2, par3, par4);

if (tileentityfurnace != null)
{
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
{
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);

if (itemstack != null)
{
float f = this.random.nextFloat() * 0.8F + 0.1F;
float f1 = this.random.nextFloat() * 0.8F + 0.1F;
float f2 = this.random.nextFloat() * 0.8F + 0.1F;

while (itemstack.stackSize > 0)
{
int j1 = this.random.nextInt(21) + 10;

if (j1 > itemstack.stackSize)
{
j1 = itemstack.stackSize;
}

itemstack.stackSize -= j1;
EntityItem entityitem = new EntityItem(par1World, (double)((float)par2 + f), (double)((float)par3 + f1), (double)((float)par4 + f2), new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));

if (itemstack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
}

float f3 = 0.05F;
entityitem.motionX = (double)((float)this.random.nextGaussian() * f3);
entityitem.motionY = (double)((float)this.random.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = (double)((float)this.random.nextGaussian() * f3);
par1World.spawnEntityInWorld(entityitem);
}
}
}

par1World.func_147453_f(par2, par3, par4, par5Block);
}

super.breakBlock(par1World, par2, par3, par4, par5Block, par6);
}

public TileEntity createNewTileEntity(World var1, int var2) {
return new TileEntityKeypadFurnace();
}

public String getHelpInfo() {
return "The password-protected furnace will require you to enter a passcode when you first place it down. After that, entering the correct code into the GUI will allow you to access the furnace's inventory.";
}

public String[] getRecipe() {
return new String[]{"The password-protected furnace requires: 7 iron ingot, 1 keypad, 1 furnace", "XYX", "XZX", "XXX", "X = iron ingot, Y = keypad, Z = furnace"};
}

}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.freeforums.geforce.securitycraft.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
Expand All @@ -19,7 +18,7 @@
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class BlockLogger extends BlockContainer implements IHelpInfo {
public class BlockLogger extends BlockOwnable implements IHelpInfo {

@SideOnly(Side.CLIENT)
private IIcon field_149935_N;
Expand Down Expand Up @@ -58,6 +57,8 @@ public void onNeighborBlockChange(World par1World, int par2, int par3, int par4,
*/
public void onBlockPlacedBy(World p_149689_1_, int p_149689_2_, int p_149689_3_, int p_149689_4_, EntityLivingBase p_149689_5_, ItemStack p_149689_6_)
{
super.onBlockPlacedBy(p_149689_1_, p_149689_2_, p_149689_3_, p_149689_4_, p_149689_5_, p_149689_6_);

int l = MathHelper.floor_double((double)(p_149689_5_.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

if (l == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ public BlockOwnable(Material par1) {
}

public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
if(par1World.isRemote){
return;
}else{
if(!par1World.isRemote){
if(par5EntityLivingBase instanceof EntityPlayer){
((TileEntityOwnable) par1World.getTileEntity(par2, par3, par4)).setOwner(((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(), par5EntityLivingBase.getCommandSenderName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
import net.minecraft.block.BlockButton;
import net.minecraft.block.ITileEntityProvider;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
Expand Down Expand Up @@ -52,6 +54,14 @@ public boolean onBlockActivated(World worldIn, int par2, int par3, int par4, Ent

public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_){}

public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
if(!par1World.isRemote){
if(par5EntityLivingBase instanceof EntityPlayer){
((TileEntityOwnable) par1World.getTileEntity(par2, par3, par4)).setOwner(((EntityPlayer) par5EntityLivingBase).getGameProfile().getId().toString(), par5EntityLivingBase.getCommandSenderName());
}
}
}

public void breakBlock(World par1World, int par2, int par3, int par4, Block par5Block, int par6) {
if(par1World.isRemote){
return;
Expand Down
Loading

0 comments on commit a8a4574

Please sign in to comment.