mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-17 19:25:06 +00:00
A few generic changes, and the Smashing Rock
This commit is contained in:
1 parent
fd4351711a
commit
f8510ae94c
9 files changed
+175
-1681
No files matched your search
@@ -3,6 +3,7 @@ package info.jbcs.minecraft.chisel;
|
||||
import info.jbcs.minecraft.chisel.carving.Carving;
|
||||
import info.jbcs.minecraft.chisel.entity.EntityBallOMoss;
|
||||
import info.jbcs.minecraft.chisel.entity.EntityCloudInABottle;
|
||||
import info.jbcs.minecraft.chisel.entity.EntitySmashingRock;
|
||||
import info.jbcs.minecraft.chisel.inventory.ContainerChisel;
|
||||
import info.jbcs.minecraft.chisel.client.gui.GuiChisel;
|
||||
import info.jbcs.minecraft.chisel.inventory.InventoryChiselSelection;
|
||||
@@ -12,15 +13,10 @@ import info.jbcs.minecraft.chisel.item.ItemCloudInABottle;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import info.jbcs.minecraft.chisel.item.ItemSmashingRock;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
@@ -49,6 +45,7 @@ public class Chisel
|
||||
public static Item itemIceshard;
|
||||
public static ItemCloudInABottle itemCloudInABottle;
|
||||
public static ItemBallOMoss itemBallOMoss;
|
||||
public static ItemSmashingRock smashingRock;
|
||||
|
||||
public static CreativeTabs tabChisel;
|
||||
|
||||
@@ -125,6 +122,13 @@ public class Chisel
|
||||
GameRegistry.registerItem(itemBallOMoss, "ballomoss");
|
||||
}
|
||||
|
||||
if(featureEnabled("smashingRock"))
|
||||
{
|
||||
smashingRock = (ItemSmashingRock) new ItemSmashingRock().setTextureName("Chisel:smashingrock").setCreativeTab(CreativeTabs.tabTools);
|
||||
EntityRegistry.registerModEntity(EntitySmashingRock.class, "SmashingRock", 2, this, 40, 1, true);
|
||||
GameRegistry.registerItem(smashingRock, "smashingrock");
|
||||
}
|
||||
|
||||
concreteVelocity = config.get("general", "concreteVelocity", 0.45, "Traversing concrete roads, players will acceleration to this velocity. For reference, normal running speed is about 0.28. Set to 0 to disable acceleration.").getDouble(0.45);
|
||||
particlesTickrate = config.get("client", "particleTickrate", 1, "Particle tick rate. Greater value = less particles.").getInt(1);
|
||||
oldPillars = config.get("client", "pillarOldGraphics", false, "Use old pillar textures").getBoolean(false);
|
||||
@@ -169,8 +173,8 @@ public class Chisel
|
||||
});
|
||||
|
||||
|
||||
GameRegistry.registerWorldGenerator(new MarbleWorldGenerator(ChiselBlocks.blockMarble, 32, config.get("worldgen", "marbleAmount", 8, "Amount of marble to generate in the world; use 0 for none").getInt(8)), 1000);
|
||||
GameRegistry.registerWorldGenerator(new MarbleWorldGenerator(ChiselBlocks.blockLimestone, 32, config.get("worldgen", "limestoneAmount", 4, "Amount of limestone to generate in the world; use 0 for none").getInt(4)), 1000);
|
||||
GameRegistry.registerWorldGenerator(new ChiselWorldGenerator(ChiselBlocks.blockMarble, 32, config.get("worldgen", "marbleAmount", 8, "Amount of marble to generate in the world; use 0 for none").getInt(8)), 1000);
|
||||
GameRegistry.registerWorldGenerator(new ChiselWorldGenerator(ChiselBlocks.blockLimestone, 32, config.get("worldgen", "limestoneAmount", 4, "Amount of limestone to generate in the world; use 0 for none").getInt(4)), 1000);
|
||||
|
||||
proxy.init();
|
||||
|
||||
|
||||
+2
-2
@@ -8,12 +8,12 @@ import net.minecraft.world.chunk.IChunkProvider;
|
||||
import net.minecraft.world.gen.feature.WorldGenMinable;
|
||||
import cpw.mods.fml.common.IWorldGenerator;
|
||||
|
||||
public class MarbleWorldGenerator implements IWorldGenerator
|
||||
public class ChiselWorldGenerator implements IWorldGenerator
|
||||
{
|
||||
WorldGenMinable gen;
|
||||
int amount;
|
||||
|
||||
public MarbleWorldGenerator(Block id, int count, int am)
|
||||
public ChiselWorldGenerator(Block id, int count, int am)
|
||||
{
|
||||
gen = new WorldGenMinable(id, count);
|
||||
amount = am;
|
||||
@@ -7,10 +7,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.FurnaceRecipes;
|
||||
|
||||
/**
|
||||
* Created by Pokefenn.
|
||||
* Licensed under MIT (If this is one of my Mods)
|
||||
*/
|
||||
public class Crafting
|
||||
{
|
||||
|
||||
|
||||
@@ -57,11 +57,6 @@ public class BlockMarbleIce extends BlockIce implements ICarvable
|
||||
carverHelper.registerSubBlocks(this, tabs, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the player destroys a block with an item that can harvest it.
|
||||
* (i, j, k) are the coordinates of the block and l is the block's
|
||||
* subtype/damage.
|
||||
*/
|
||||
@Override
|
||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
|
||||
@@ -80,7 +80,8 @@ public class EntityBallOMoss extends EntityThrowable
|
||||
{
|
||||
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(!(dist < falloff || General.rand.nextInt(radius * 3 - falloff) >= dist * 2))
|
||||
continue;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
turnToMoss(worldObj, x + xx, y + yy, z + zz);
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
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 EntitySmashingRock extends EntityThrowable
|
||||
{
|
||||
|
||||
public EntitySmashingRock(World par1World)
|
||||
{
|
||||
super(par1World);
|
||||
}
|
||||
|
||||
public EntitySmashingRock(World par1World, EntityLivingBase par2EntityLiving)
|
||||
{
|
||||
super(par1World, par2EntityLiving);
|
||||
}
|
||||
|
||||
public EntitySmashingRock(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.spawn
|
||||
|
||||
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)
|
||||
smash(worldObj, x + xx, y + yy, z + zz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static void smash(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.stone))
|
||||
{
|
||||
resBlock = Blocks.cobblestone;
|
||||
} else if(block.equals(Blocks.stonebrick) && meta == 0)
|
||||
{
|
||||
resMeta = 2;
|
||||
} else if(block.equals(Blocks.cobblestone))
|
||||
{
|
||||
resBlock = Blocks.sand;
|
||||
} else if(block.equals(Blocks.sand))
|
||||
{
|
||||
resBlock = Blocks.gravel;
|
||||
}
|
||||
|
||||
if(resBlock.equals(block) && resMeta == meta)
|
||||
return;
|
||||
world.setBlock(x, y, z, resBlock, resMeta, 3);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package info.jbcs.minecraft.chisel.item;
|
||||
|
||||
import info.jbcs.minecraft.chisel.entity.EntitySmashingRock;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemSmashingRock extends Item
|
||||
{
|
||||
|
||||
public ItemSmashingRock()
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("smashingRock");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
if(!par3EntityPlayer.capabilities.isCreativeMode)
|
||||
{
|
||||
--par1ItemStack.stackSize;
|
||||
}
|
||||
|
||||
if(par2World.isRemote)
|
||||
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if(!par2World.isRemote)
|
||||
{
|
||||
par2World.spawnEntityInWorld(new EntitySmashingRock(par2World, par3EntityPlayer));
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user