mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 03:05:10 +00:00
Lots of changes, fixed a few crashes, and minor bugs. Also, doesnt need Asielib anymore
This commit is contained in:
1 parent
333c1d6596
commit
fd4351711a
146 files changed
+12167
-9527
No files matched your search
Executable → Regular
+123
-105
@@ -1,105 +1,123 @@
|
||||
package info.jbcs.minecraft.chisel.entity;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.ChiselBlocks;
|
||||
import info.jbcs.minecraft.chisel.GeneralChiselClient;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBallOMoss extends EntityThrowable {
|
||||
|
||||
public EntityBallOMoss(World par1World) {
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityBallOMoss(World par1World, EntityLivingBase par2EntityLiving) {
|
||||
super(par1World, par2EntityLiving);
|
||||
}
|
||||
|
||||
public EntityBallOMoss(World par1World, double x, double y, double z) {
|
||||
super(par1World, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition movingobjectposition) {
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
switch (movingobjectposition.sideHit) {
|
||||
case 0:
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
|
||||
setDead();
|
||||
|
||||
if (worldObj.isRemote){
|
||||
worldObj.playSound(x, y, z, "chisel:squash", 1.0f, 1.0f, false);
|
||||
|
||||
for(int i=0;i<32;i++)
|
||||
GeneralChiselClient.spawnBallOMossFX(worldObj,posX,posY,posZ);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int radius=5;
|
||||
int falloff=3;
|
||||
|
||||
for(int xx=-radius;xx<radius;xx++){
|
||||
for(int yy=-radius;yy<radius;yy++){
|
||||
for(int zz=-radius;zz<radius;zz++){
|
||||
double dist=(xx<0?-xx:xx)+(yy<0?-yy:yy)+(zz<0?-zz:zz);
|
||||
|
||||
if(! (dist<falloff || General.rand.nextInt(radius*3-falloff)>=dist*2)) continue;
|
||||
|
||||
if (! worldObj.isRemote)
|
||||
turnToMoss(worldObj, x+xx, y+yy, z+zz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void turnToMoss(World world, int x, int y, int z) {
|
||||
Block block=world.getBlock(x, y, z);
|
||||
int meta=world.getBlockMetadata(x, y, z);
|
||||
Block resBlock=block;
|
||||
int resMeta=meta;
|
||||
|
||||
if(block.equals(Blocks.cobblestone)){
|
||||
resBlock = Blocks.mossy_cobblestone;
|
||||
} else if(block.equals(Blocks.cobblestone_wall) && meta==0){
|
||||
resMeta=1;
|
||||
} else if(block.equals(ChiselBlocks.blockCobblestone)){
|
||||
resBlock=ChiselBlocks.blockCobblestoneMossy;
|
||||
} else if(block.equals(ChiselBlocks.blockTemple)){
|
||||
resBlock=ChiselBlocks.blockTempleMossy;
|
||||
}
|
||||
|
||||
if(resBlock.equals(block) && resMeta==meta) return;
|
||||
world.setBlock(x, y, z, resBlock, resMeta, 3);
|
||||
}
|
||||
|
||||
}
|
||||
package info.jbcs.minecraft.chisel.entity;
|
||||
|
||||
import info.jbcs.minecraft.chisel.ChiselBlocks;
|
||||
import info.jbcs.minecraft.chisel.client.GeneralChiselClient;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.projectile.EntityThrowable;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class EntityBallOMoss extends EntityThrowable
|
||||
{
|
||||
|
||||
public EntityBallOMoss(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntityBallOMoss(World par1World, EntityLivingBase par2EntityLiving)
|
||||
{
|
||||
super(par1World, par2EntityLiving);
|
||||
}
|
||||
|
||||
public EntityBallOMoss(World par1World, double x, double y, double z)
|
||||
{
|
||||
super(par1World, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onImpact(MovingObjectPosition movingobjectposition)
|
||||
{
|
||||
int x = movingobjectposition.blockX;
|
||||
int y = movingobjectposition.blockY;
|
||||
int z = movingobjectposition.blockZ;
|
||||
|
||||
switch(movingobjectposition.sideHit)
|
||||
{
|
||||
case 0:
|
||||
y--;
|
||||
break;
|
||||
case 1:
|
||||
y++;
|
||||
break;
|
||||
case 2:
|
||||
z--;
|
||||
break;
|
||||
case 3:
|
||||
z++;
|
||||
break;
|
||||
case 4:
|
||||
x--;
|
||||
break;
|
||||
case 5:
|
||||
x++;
|
||||
break;
|
||||
}
|
||||
|
||||
setDead();
|
||||
|
||||
if(worldObj.isRemote)
|
||||
{
|
||||
worldObj.playSound(x, y, z, "chisel:squash", 1.0f, 1.0f, false);
|
||||
|
||||
for(int i = 0; i < 32; i++)
|
||||
GeneralChiselClient.spawnBallOMossFX(worldObj, posX, posY, posZ);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int radius = 5;
|
||||
int falloff = 3;
|
||||
|
||||
for(int xx = -radius; xx < radius; xx++)
|
||||
{
|
||||
for(int yy = -radius; yy < radius; yy++)
|
||||
{
|
||||
for(int zz = -radius; zz < radius; zz++)
|
||||
{
|
||||
double dist = (xx < 0 ? -xx : xx) + (yy < 0 ? -yy : yy) + (zz < 0 ? -zz : zz);
|
||||
|
||||
if(!(dist < falloff || General.rand.nextInt(radius * 3 - falloff) >= dist * 2)) continue;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
turnToMoss(worldObj, x + xx, y + yy, z + zz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void turnToMoss(World world, int x, int y, int z)
|
||||
{
|
||||
Block block = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
Block resBlock = block;
|
||||
int resMeta = meta;
|
||||
|
||||
if(block.equals(Blocks.cobblestone))
|
||||
{
|
||||
resBlock = Blocks.mossy_cobblestone;
|
||||
} else if(block.equals(Blocks.cobblestone_wall) && meta == 0)
|
||||
{
|
||||
resMeta = 1;
|
||||
} else if(block.equals(ChiselBlocks.blockCobblestone))
|
||||
{
|
||||
resBlock = ChiselBlocks.blockCobblestoneMossy;
|
||||
} else if(block.equals(ChiselBlocks.blockTemple))
|
||||
{
|
||||
resBlock = ChiselBlocks.blockTempleMossy;
|
||||
} else if(block.equals(Blocks.stonebrick))
|
||||
{
|
||||
resMeta = 1;
|
||||
}
|
||||
|
||||
if(resBlock.equals(block) && resMeta == meta)
|
||||
return;
|
||||
world.setBlock(x, y, z, resBlock, resMeta, 3);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user