mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-19 20:09:46 +00:00
Added in all of the original files
This commit is contained in:
1 parent
b61f5f1072
commit
aa52debeb5
1764 files changed
+15476
No files matched your search
@@ -0,0 +1,36 @@
|
||||
package info.jbcs.minecraft.chisel.item;
|
||||
|
||||
import info.jbcs.minecraft.chisel.entity.EntityBallOMoss;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemBallOMoss extends Item
|
||||
{
|
||||
|
||||
public ItemBallOMoss()
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("ballMoss");
|
||||
}
|
||||
|
||||
@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 EntityBallOMoss(par2World, par3EntityPlayer));
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package info.jbcs.minecraft.chisel.item;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Configurations;
|
||||
import info.jbcs.minecraft.chisel.api.ICarvable;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableVariation;
|
||||
import info.jbcs.minecraft.utilities.General;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ItemCarvable extends ItemBlock
|
||||
{
|
||||
|
||||
public ItemCarvable(Block block)
|
||||
{
|
||||
super(block);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int i)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIconFromDamage(int damage)
|
||||
{
|
||||
return Block.getBlockFromItem(this).getIcon(2, damage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List lines, boolean advancedTooltips)
|
||||
{
|
||||
if(!Configurations.blockDescriptions) return;
|
||||
|
||||
Item item = General.getItem(stack);
|
||||
if(item == null) return;
|
||||
|
||||
Block block = Block.getBlockFromItem(this);
|
||||
if(!(block instanceof ICarvable)) return;
|
||||
|
||||
ICarvable carvable = (ICarvable) block;
|
||||
CarvableVariation var = carvable.getVariation(stack.getItemDamage());
|
||||
if(var == null)
|
||||
return;
|
||||
|
||||
lines.add(var.description);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package info.jbcs.minecraft.chisel.item;
|
||||
|
||||
import info.jbcs.minecraft.chisel.Chisel;
|
||||
import info.jbcs.minecraft.chisel.api.ChiselMode;
|
||||
import info.jbcs.minecraft.chisel.api.IChiselMode;
|
||||
import info.jbcs.minecraft.chisel.carving.CarvableHelper;
|
||||
import info.jbcs.minecraft.chisel.carving.Carving;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.ItemTool;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ItemChisel extends ItemTool implements IChiselMode
|
||||
{
|
||||
public static Carving carving = Carving.chisel;
|
||||
private static final HashSet<String> toolSet = new HashSet<String>();
|
||||
|
||||
public ItemChisel()
|
||||
{
|
||||
super(1, ToolMaterial.IRON, CarvableHelper.getChiselBlockSet());
|
||||
|
||||
setMaxStackSize(1);
|
||||
setMaxDamage(500);
|
||||
efficiencyOnProperMaterial = 100f;
|
||||
setUnlocalizedName("chisel");
|
||||
|
||||
toolSet.add("chisel");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getToolClasses(ItemStack stack)
|
||||
{
|
||||
return toolSet;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
|
||||
{
|
||||
entityplayer.openGui(Chisel.instance, 0, world, 0, 0, 0);
|
||||
|
||||
return itemstack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockStartBreak(ItemStack itemstack, int X, int Y, int Z, EntityPlayer player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChiselMode getChiselMode(ItemStack itemStack)
|
||||
{
|
||||
//TODO
|
||||
return ChiselMode.SINGLE;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package info.jbcs.minecraft.chisel.item;
|
||||
|
||||
import info.jbcs.minecraft.chisel.entity.EntityCloudInABottle;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemCloudInABottle extends Item
|
||||
{
|
||||
|
||||
public ItemCloudInABottle()
|
||||
{
|
||||
super();
|
||||
setUnlocalizedName("cloudBottle");
|
||||
}
|
||||
|
||||
@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 EntityCloudInABottle(par2World, par3EntityPlayer));
|
||||
}
|
||||
|
||||
return par1ItemStack;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package info.jbcs.minecraft.chisel.item;
|
||||
|
||||
import info.jbcs.minecraft.chisel.block.BlockMarbleSlab;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemMarbleSlab extends ItemCarvable
|
||||
{
|
||||
|
||||
public ItemMarbleSlab(Block block)
|
||||
{
|
||||
super(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_150936_a(World world, int x, int y, int z, int side, EntityPlayer player, ItemStack stack)
|
||||
{
|
||||
BlockMarbleSlab block = (BlockMarbleSlab) Block.getBlockFromItem(this);
|
||||
|
||||
switch(side)
|
||||
{
|
||||
case 0:
|
||||
--y;
|
||||
break;
|
||||
case 1:
|
||||
++y;
|
||||
break;
|
||||
case 2:
|
||||
--z;
|
||||
break;
|
||||
case 3:
|
||||
++z;
|
||||
break;
|
||||
case 4:
|
||||
--x;
|
||||
break;
|
||||
case 5:
|
||||
++x;
|
||||
break;
|
||||
}
|
||||
|
||||
Block targetBlock = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
return (targetBlock.equals(block) || targetBlock.equals(block.top)) && meta == stack.getItemDamage() || world.canPlaceEntityOnSide(block, x, y, z, false, side, (Entity) null, stack);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hx, float hy, float hz)
|
||||
{
|
||||
BlockMarbleSlab block = (BlockMarbleSlab) Block.getBlockFromItem(this);
|
||||
|
||||
Block targetBlock = world.getBlock(x, y, z);
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
boolean metaMatches = meta == stack.getItemDamage();
|
||||
|
||||
if(metaMatches && side == 0 && targetBlock.equals(block.top))
|
||||
{
|
||||
world.setBlock(x, y, z, block.master, meta, 2);
|
||||
stack.stackSize -= 1;
|
||||
return true;
|
||||
} else if(metaMatches && side == 1 && targetBlock.equals(block.bottom))
|
||||
{
|
||||
world.setBlock(x, y, z, block.master, meta, 2);
|
||||
stack.stackSize -= 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean result = super.onItemUse(stack, player, world, x, y, z, side, hz, hy, hz);
|
||||
|
||||
|
||||
switch(side)
|
||||
{
|
||||
case 0:
|
||||
--y;
|
||||
break;
|
||||
case 1:
|
||||
++y;
|
||||
break;
|
||||
case 2:
|
||||
--z;
|
||||
break;
|
||||
case 3:
|
||||
++z;
|
||||
break;
|
||||
case 4:
|
||||
--x;
|
||||
break;
|
||||
case 5:
|
||||
++x;
|
||||
break;
|
||||
}
|
||||
|
||||
targetBlock = world.getBlock(x, y, z);
|
||||
meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if(!result && (targetBlock.equals(block.top) || targetBlock.equals(block.bottom)) && meta == stack.getItemDamage())
|
||||
{
|
||||
world.setBlock(x, y, z, block.master, meta, 2);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!result)
|
||||
return false;
|
||||
|
||||
if(side != 0 && (side == 1 || hy <= 0.5D))
|
||||
return true;
|
||||
|
||||
|
||||
//TODO allow top slabs
|
||||
//world.setBlock(x, y, z, block.top, meta, 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -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