Skip to content

Commit

Permalink
FINSISHED And HxCPlayer successfully tested!
Browse files Browse the repository at this point in the history
  • Loading branch information
DrZed committed Feb 5, 2015
1 parent 9ee90aa commit dd9627c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ minecraft {
}

dependencies {
runtime files('libs/HxCCore-1.7.10-1.8b-dev.jar')
runtime files('libs/HxCCore-1.7.10-1.8c-dev.jar')
}

processResources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public TileEntity createNewTileEntity(World world, int metadata) {
public void onBlockAdded(World world, int x, int y, int z) {
super.onBlockAdded(world, x, y, z);
TileSlaughterBlock block = (TileSlaughterBlock)world.getTileEntity(x, y, z);
block.AllowUpdate = true; block.BoundPlayer = world.getClosestPlayer(x,y,z,5).getDisplayName(); block.modifier = 1;
block.modifier = 1;
}
}
7 changes: 5 additions & 2 deletions src/main/java/HxCKDMS/HxCBlocks/Events/EventSlaughter.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package HxCKDMS.HxCBlocks.Events;

import HxCKDMS.HxCBlocks.TileEntities.TileSlaughterBlock;
import HxCKDMS.HxCCore.Entity.HxCFakePlayer;
import HxCKDMS.HxCCore.HxCCore;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.DamageSource;
Expand All @@ -18,8 +21,8 @@ public void Slaughter(int[] coords, World world){
List list = world.getEntitiesWithinAABB(EntityLiving.class, getAreaBoundingBox(coords[0], coords[1], coords[2], modifier));
for (EntityLiving entity : (List<EntityLiving>) list) {
if (!entity.isDead && entity.deathTime == 0) {
String BoundPlayer = HxCTile.BoundPlayer;
entity.attackEntityFrom(DamageSource.causePlayerDamage(world.getPlayerEntityByName(BoundPlayer)), 300f);
EntityPlayer pla = new HxCFakePlayer(HxCCore.server.worldServerForDimension(world.provider.dimensionId));
entity.attackEntityFrom(DamageSource.causePlayerDamage(pla), 300f);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,22 @@

public class TileSlaughterBlock extends TileEntity{
public int modifier;
public boolean AllowUpdate;
public String BoundPlayer;

EventSlaughter event = new EventSlaughter();

@Override
public void writeToNBT(NBTTagCompound par1) {
super.writeToNBT(par1);
par1.setBoolean("Enabled", AllowUpdate);
par1.setInteger("Mod", modifier);
if (BoundPlayer != null) par1.setString("BoundPlayer", BoundPlayer);
}

@Override
public void readFromNBT(NBTTagCompound par1) {
super.readFromNBT(par1);
this.modifier = par1.getInteger("Mod");
this.AllowUpdate = par1.getBoolean("Enabled");
this.BoundPlayer = par1.getString("BoundPlayer");
}

public void updateEntity(){
if(worldObj != null && !worldObj.isRemote && AllowUpdate) event.Slaughter(new int[]{xCoord, yCoord, zCoord}, worldObj);
if(worldObj != null && !worldObj.isRemote) event.Slaughter(new int[]{xCoord, yCoord, zCoord}, worldObj);
}
}

0 comments on commit dd9627c

Please sign in to comment.