more work on the chisel and hammer feature
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
## Bugs
|
||||
- [ ] Can't put a crucible straight from creative inventory into bloomery and pull with tongs
|
||||
- [ ] Hot Crucible block form missing texture
|
||||
- [ ] Soft Crucible drop from tongs
|
||||
- [ ] Pickaxe upgrades printout
|
||||
|
||||
## Current Feature
|
||||
- [ ] SledgeHammer and Chisel
|
||||
|
||||
@@ -57,6 +57,7 @@ public class AnvilStone extends AnvilBase {
|
||||
tempwootzchunk.getTagCompound().setBoolean("hot", true);
|
||||
|
||||
if (stack12.getItem().equals(ModItems.ironingotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
world.playEvent(1031, pos, 0);
|
||||
tile.setSlotStack(6, tempironchunk);
|
||||
tile.setSlotStack(7, tempironchunk);
|
||||
tile.setSlotStack(8, tempironchunk);
|
||||
@@ -70,6 +71,7 @@ public class AnvilStone extends AnvilBase {
|
||||
return true;
|
||||
}
|
||||
if (stack12.getItem().equals(ModItems.ironcleaningotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
world.playEvent(1031, pos, 0);
|
||||
tile.setSlotStack(6, tempironcleanchunk);
|
||||
tile.setSlotStack(7, tempironcleanchunk);
|
||||
tile.setSlotStack(8, tempironcleanchunk);
|
||||
@@ -83,6 +85,7 @@ public class AnvilStone extends AnvilBase {
|
||||
return true;
|
||||
}
|
||||
if (stack12.getItem().equals(ModItems.steelingotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
world.playEvent(1031, pos, 0);
|
||||
tile.setSlotStack(6, tempsteelchunk);
|
||||
tile.setSlotStack(7, tempsteelchunk);
|
||||
tile.setSlotStack(8, tempsteelchunk);
|
||||
@@ -95,6 +98,7 @@ public class AnvilStone extends AnvilBase {
|
||||
return true;
|
||||
}
|
||||
if (stack12.getItem().equals(ModItems.wootzingotball) && stack12.getTagCompound().getBoolean("hot")) {
|
||||
world.playEvent(1031, pos, 0);
|
||||
tile.setSlotStack(6, tempwootzchunk);
|
||||
tile.setSlotStack(7, tempwootzchunk);
|
||||
tile.setSlotStack(8, tempwootzchunk);
|
||||
|
||||
@@ -1,24 +1,59 @@
|
||||
package nmd.primal.forgecraft.blocks;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.EnumFaceDirection;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.RenderBlockOverlayEvent;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.core.common.helper.PlayerHelper;
|
||||
import nmd.primal.forgecraft.init.ModBlocks;
|
||||
import nmd.primal.forgecraft.init.ModSounds;
|
||||
import nmd.primal.forgecraft.items.SledgeHammer;
|
||||
|
||||
public class Chisel extends BlockCustomBase {
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
public class Chisel extends CustomFacing {
|
||||
|
||||
public AxisAlignedBB boundBox = new AxisAlignedBB(0.4375D, 0.0D, 0.4375D, 0.5625D, 0.875D, 0.5625D);
|
||||
|
||||
public Chisel(Material material, String registryName, Float hardness) {
|
||||
super(material, registryName, hardness);
|
||||
public Chisel(Material material, String name) {
|
||||
super(material, name);
|
||||
this.setHardness(8.0f);
|
||||
this.setResistance(8.0f);
|
||||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.DOWN).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||
{
|
||||
if(!worldIn.isRemote) {
|
||||
worldIn.setBlockState(pos, state.withProperty(FACING, reverseFacing(EnumFacing.getDirectionFromEntityLiving(pos, placer))).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
}
|
||||
}
|
||||
|
||||
protected BlockStateContainer createBlockState()
|
||||
{
|
||||
return new BlockStateContainer(this, new IProperty[] {FACING, PrimalAPI.States.ACTIVE});
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos)
|
||||
{
|
||||
return boundBox;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -29,31 +64,205 @@ public class Chisel extends BlockCustomBase {
|
||||
if (hand.equals(hand.MAIN_HAND)) {
|
||||
if(!player.isSwingInProgress) {
|
||||
if (playerStack.getItem() instanceof SledgeHammer) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
if (facing == EnumFacing.UP) {
|
||||
IBlockState breakState = world.getBlockState(pos.add((a - 1), (-1), (i - 1)));
|
||||
BlockPos breakPos = pos.add((a - 1), (-1), (i - 1));
|
||||
//System.out.println(i + ":" + a + ":" + breakState.getBlock());
|
||||
if (!(breakState.getBlock().equals(Blocks.AIR))) {
|
||||
NonNullList<ItemStack> tempDrops = NonNullList.create();
|
||||
world.getBlockState(breakPos).getBlock().getDrops(tempDrops, world, breakPos, breakState, 0);
|
||||
PlayerHelper.spawnItemOnPlayer(world, player, tempDrops);
|
||||
//System.out.println(tempDrops);
|
||||
world.setBlockToAir(breakPos);
|
||||
world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.CHISEL_HIT, SoundCategory.BLOCKS, 0.8F, 0.3F / (PrimalAPI.getRandom().nextFloat() * 0.4F + 0.8F));
|
||||
|
||||
if (state.getValue(FACING) == EnumFacing.UP) {
|
||||
if (state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
BlockPos movePos = pos.add((a - 1), (1), (i - 1));
|
||||
IBlockState breakState = world.getBlockState(movePos);
|
||||
if (state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
doBreaking(world, movePos, pos, breakState);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos.up(), state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
world.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
BlockPos movePos = pos.add((a - 1), (1), (i - 1));
|
||||
if (world.getBlockState(movePos).getBlock() != ModBlocks.chisel) {
|
||||
world.sendBlockBreakProgress(player.getEntityId() + PrimalAPI.getRandom().nextInt(100), movePos, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos.down(), state);
|
||||
world.setBlockToAir(pos);
|
||||
//player.swingArm(hand);
|
||||
return true;
|
||||
|
||||
if (state.getValue(FACING) == EnumFacing.DOWN) {
|
||||
if (state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
BlockPos movePos = pos.add((a - 1), (-1), (i - 1));
|
||||
IBlockState breakState = world.getBlockState(movePos);
|
||||
if (state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
doBreaking(world, movePos, pos, breakState);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos.down(), state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
world.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
BlockPos movePos = pos.add((a - 1), (-1), (i - 1));
|
||||
if (world.getBlockState(movePos).getBlock() != ModBlocks.chisel) {
|
||||
world.sendBlockBreakProgress(player.getEntityId() + PrimalAPI.getRandom().nextInt(100), movePos, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.SOUTH) {
|
||||
if (state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
BlockPos movePos = pos.add((a - 1), (i-1), (1));
|
||||
IBlockState breakState = world.getBlockState(movePos);
|
||||
if (state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
doBreaking(world, movePos, pos, breakState);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos.south(), state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
world.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
if (!state.getValue(PrimalAPI.States.ACTIVE)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
BlockPos movePos = pos.add((a - 1), (i-1), (1));
|
||||
if (world.getBlockState(movePos).getBlock() != ModBlocks.chisel) {
|
||||
world.sendBlockBreakProgress(player.getEntityId() + PrimalAPI.getRandom().nextInt(100), movePos, 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, true), 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (state.getValue(FACING) == EnumFacing.NORTH) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
for (int a = 0; a < 3; a++) {
|
||||
BlockPos movePos = pos.add((a-1), (i-1), (1));
|
||||
IBlockState breakState = world.getBlockState(movePos);
|
||||
doBreaking(world, movePos, pos, breakState);
|
||||
}
|
||||
}
|
||||
world.setBlockState(pos.south(), state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||
world.setBlockToAir(pos);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the given metadata into a BlockState for this Block
|
||||
*/
|
||||
public IBlockState getStateFromMeta(int meta)
|
||||
{
|
||||
return this.getDefaultState().withProperty(FACING, getFacing(meta)).withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf((meta & 8) > 0));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static EnumFacing getFacing(int meta)
|
||||
{
|
||||
int i = meta & 7;
|
||||
return i > 5 ? null : EnumFacing.getFront(i);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the BlockState into the correct metadata value
|
||||
*/
|
||||
public int getMetaFromState(IBlockState state)
|
||||
{
|
||||
int i = 0;
|
||||
i = i | ((EnumFacing)state.getValue(FACING)).getIndex();
|
||||
|
||||
if (((Boolean)state.getValue(PrimalAPI.States.ACTIVE)).booleanValue())
|
||||
{
|
||||
i |= 8;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
private EnumFacing reverseFacing(EnumFacing facing){
|
||||
if(facing == EnumFacing.UP){
|
||||
return EnumFacing.DOWN;
|
||||
}
|
||||
if(facing == EnumFacing.DOWN){
|
||||
return EnumFacing.UP;
|
||||
}
|
||||
if(facing == EnumFacing.NORTH){
|
||||
return EnumFacing.SOUTH;
|
||||
}
|
||||
if(facing == EnumFacing.SOUTH){
|
||||
return EnumFacing.NORTH;
|
||||
}
|
||||
if(facing == EnumFacing.EAST){
|
||||
return EnumFacing.WEST;
|
||||
}
|
||||
if(facing == EnumFacing.WEST){
|
||||
return EnumFacing.EAST;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void doBreaking(World world, BlockPos movePos, BlockPos pos, IBlockState state){
|
||||
|
||||
if (!(state.getBlock().equals(Blocks.AIR))) {
|
||||
NonNullList<ItemStack> tempDrops = NonNullList.create();
|
||||
world.getBlockState(movePos).getBlock().getDrops(tempDrops, world, movePos, state, 0);
|
||||
PlayerHelper.spawnItemOnGround(world, pos, tempDrops);
|
||||
world.setBlockToAir(movePos);
|
||||
}
|
||||
}
|
||||
|
||||
private void makeParticles(World world, BlockPos pos, EnumParticleTypes particle, EnumFacing facing){
|
||||
|
||||
double d0 = (double)pos.getX() + 0.5D;
|
||||
double d1 = (double)pos.getY() + 0.5D;
|
||||
double d2 = (double)pos.getZ() + 0.5D;
|
||||
double xVelocity = 0.0D;
|
||||
double yVelocity = 0.0D;
|
||||
double zVelocity = 0.0D;
|
||||
double d4 = PrimalAPI.getRandom().nextDouble(0.066, 0.33);
|
||||
|
||||
if(facing == EnumFacing.NORTH){
|
||||
d0 += 0.5D;
|
||||
}
|
||||
if(facing == EnumFacing.DOWN){
|
||||
d1 += 0.5D;
|
||||
yVelocity += 0.1D;
|
||||
}
|
||||
if(facing == EnumFacing.UP){
|
||||
d1 -= 0.5D;
|
||||
}
|
||||
|
||||
//if(PrimalAPI.getRandom().nextInt(3) == 0){
|
||||
world.spawnParticle(particle, d0, d1, d2, 0.0D + xVelocity, 0.0 + yVelocity, 0.0D + zVelocity, new int[1]);
|
||||
world.spawnParticle(particle, d0, d1, d2, 0.0D + xVelocity, 0.0 + yVelocity, 0.0D + zVelocity, new int[1]);
|
||||
//}
|
||||
|
||||
|
||||
|
||||
//double ySpeed = ThreadLocalRandom.current().nextDouble(0.05, 0.20);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,25 +2,53 @@ package nmd.primal.forgecraft.blocks;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDirectional;
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyDirection;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import nmd.primal.forgecraft.ModInfo;
|
||||
|
||||
/**
|
||||
* Created by mminaie on 1/1/17.
|
||||
*/
|
||||
public abstract class CustomFacing extends Block {
|
||||
public abstract class CustomFacing extends BlockDirectional {
|
||||
|
||||
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL);
|
||||
|
||||
protected CustomFacing(Material material)
|
||||
{
|
||||
protected CustomFacing(Material material, String name) {
|
||||
super(material);
|
||||
this.setRegistryName(name);
|
||||
this.setUnlocalizedName(name);
|
||||
setCreativeTab(ModInfo.TAB_FORGECRAFT);
|
||||
}
|
||||
|
||||
protected CustomFacing(Material material, MapColor color)
|
||||
@Override
|
||||
public boolean isFullCube(IBlockState state)
|
||||
{
|
||||
super(material, color);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube(IBlockState state)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumBlockRenderType getRenderType(IBlockState state)
|
||||
{
|
||||
return EnumBlockRenderType.MODEL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -459,24 +459,4 @@ public class PistonBellows extends CustomContainerFacing {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
if(rand.nextInt(4) == 1){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 2){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 3){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
if(rand.nextInt(4) == 4){
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0-d4, d1, d2-d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
world.spawnParticle(EnumParticleTypes.FLAME, d0+d4, d1, d2+d4, 0.0D, (double) (rand.nextInt(2) + 1)/1000, 0.0D, new int[0]);
|
||||
}
|
||||
*/
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class ModBlocks {
|
||||
blockbreaker = new Breaker(Material.WOOD, "blockbreaker", 4.0f);
|
||||
castingform = new CastingForm(Material.WOOD, "castingform");
|
||||
|
||||
chisel = new Chisel(Material.IRON, "chisel", 5.0f);
|
||||
chisel = new Chisel(Material.IRON, "chisel");
|
||||
|
||||
pistonbellowsoak = new PistonBellows(Material.WOOD, "pistonbellowsoak");
|
||||
pistonbellowsjungle = new PistonBellows(Material.WOOD, "pistonbellowsjungle");
|
||||
|
||||
@@ -223,7 +223,7 @@ public class ModItems {
|
||||
ironaxe = new CustomAxe("ironaxe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironaxehead, 5, -3.6f);
|
||||
ironshovel = new CustomShovel("ironshovel", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironshovelhead);
|
||||
ironhoe = new CustomHoe("ironhoe", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON, ironhoehead);
|
||||
IRON_SLEDGE_HAMMER = new SledgeHammer("ironsledgehammer", PrimalAPI.ToolMaterials.TOOL_WROUGHT_IRON);
|
||||
IRON_SLEDGE_HAMMER = new SledgeHammer("ironsledgehammer", PrimalAPI.ToolMaterials.TOOL_WOOTZ_STEEL);
|
||||
|
||||
cleanironpickaxe = new CustomPickaxe("cleanironpickaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironpickaxehead);
|
||||
cleanironaxe = new CustomAxe("cleanironaxe", PrimalAPI.ToolMaterials.TOOL_CLEAN_IRON, cleanironaxehead, 6, -3.2f);
|
||||
|
||||
@@ -13,12 +13,16 @@ public class ModSounds {
|
||||
public static SoundEvent PISTON_BELLOWS;
|
||||
public static SoundEvent MUSKET_SHOT;
|
||||
public static SoundEvent BOW_TWANG;
|
||||
public static SoundEvent CHISEL_HIT;
|
||||
public static SoundEvent CHISEL_HIT_FINISHED;
|
||||
|
||||
public static void registerSounds()
|
||||
{
|
||||
PISTON_BELLOWS = registerSound("piston_bellows");
|
||||
MUSKET_SHOT = registerSound("musket_shot");
|
||||
BOW_TWANG = registerSound("bow_twang");
|
||||
CHISEL_HIT = registerSound("chisel_hit");
|
||||
CHISEL_HIT_FINISHED = registerSound("chisel_hit_finished");
|
||||
}
|
||||
|
||||
private static SoundEvent registerSound(String name)
|
||||
|
||||
@@ -10,13 +10,20 @@ import net.minecraft.util.ActionResult;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.world.World;
|
||||
import nmd.primal.core.api.PrimalAPI;
|
||||
import nmd.primal.forgecraft.util.ToolMaterialMap;
|
||||
|
||||
public class SledgeHammer extends BaseItem {
|
||||
public class SledgeHammer extends BaseItem implements ToolMaterialMap {
|
||||
|
||||
|
||||
|
||||
private ToolMaterial material;
|
||||
|
||||
public SledgeHammer(String registryName, Item.ToolMaterial material) {
|
||||
super(registryName);
|
||||
this.setMaxDamage(material.getMaxUses()*3);
|
||||
this.setHarvestLevel("pickaxe", material.getHarvestLevel());
|
||||
this.material=material;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -38,11 +45,15 @@ public class SledgeHammer extends BaseItem {
|
||||
{
|
||||
if(!world.isRemote) {
|
||||
if (!player.isSwingInProgress) {
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, 150, 100));
|
||||
player.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, (100/materialModifiers.get(this.getMaterial()) / (player.getActivePotionEffect(MobEffects.STRENGTH).getAmplifier()+1)), 100));
|
||||
player.swingArm(hand);
|
||||
return new ActionResult<ItemStack>(EnumActionResult.PASS, player.getHeldItem(hand));
|
||||
}
|
||||
}
|
||||
return new ActionResult<ItemStack>(EnumActionResult.FAIL, player.getHeldItem(hand));
|
||||
}
|
||||
|
||||
public ToolMaterial getMaterial() {
|
||||
return material;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,22 @@
|
||||
}
|
||||
},
|
||||
"variants": {
|
||||
"normal": { "model": "forgecraft:chisel_model" },
|
||||
"inventory": { "model": "forgecraft:chisel_model" }
|
||||
"active=false,facing=down": { "model": "forgecraft:chisel_model" },
|
||||
"active=false,facing=up": { "model": "forgecraft:chisel_model", "x": 180 },
|
||||
"active=false,facing=east": { "model": "forgecraft:chisel_model", "x": 90, "y": -90 },
|
||||
"active=false,facing=west": { "model": "forgecraft:chisel_model", "x": -90, "y": -90},
|
||||
"active=false,facing=south": { "model": "forgecraft:chisel_model", "x": -90, "y": 180 },
|
||||
"active=false,facing=north": { "model": "forgecraft:chisel_model", "x": 90, "y": 180 },
|
||||
|
||||
"active=true,facing=down": { "model": "forgecraft:chisel_model_active" },
|
||||
"active=true,facing=up": { "model": "forgecraft:chisel_model_active", "x": 180 },
|
||||
"active=true,facing=east": { "model": "forgecraft:chisel_model_active", "x": 90, "y": -90 },
|
||||
"active=true,facing=west": { "model": "forgecraft:chisel_model_active", "x": -90, "y": -90},
|
||||
"active=true,facing=south": { "model": "forgecraft:chisel_model_active", "x": -90, "y": 180 },
|
||||
"active=true,facing=north": { "model": "forgecraft:chisel_model_active", "x": 90, "y": 180 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
{
|
||||
"__comment": "Designed by Kitsushadow with Cubik Studio - https://cubik.studio",
|
||||
"textures": {
|
||||
"particle": "forgecraft:items/iron/0",
|
||||
"texture": "forgecraft:items/iron/0"
|
||||
},
|
||||
"elements": [
|
||||
{
|
||||
"__comment": "Box1",
|
||||
"from": [ 7, -6.5, 7 ],
|
||||
"to": [ 8.72, 5.11, 8.935 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 7, 7.065001, 8.72, 9 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 7, 7, 8.72, 8.934999 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 7.28, 2.889999, 9, 14.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 7, 2.889999, 8.72, 14.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 7, 2.889999, 8.935, 14.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 7.065, 2.889999, 9, 14.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box4",
|
||||
"from": [ 7, -7.36, 7.215 ],
|
||||
"to": [ 8.72, -6.5, 8.719999 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6, 6, 10, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6, 6.5, 10, 10 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6, 2, 10, 4 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6, 2, 10, 4 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 2, 10, 4 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6, 2, 9.5, 4 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box4",
|
||||
"from": [ 7, -8.22, 7.43 ],
|
||||
"to": [ 8.72, -7.36, 8.505 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6, 6.5, 10, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6, 6.5, 10, 9.5 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6, 11, 10, 11.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6, 11, 10, 11.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 11, 9.5, 11.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6.5, 11, 9.5, 11.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box4",
|
||||
"from": [ 7, -9.08, 7.645 ],
|
||||
"to": [ 8.72, -8.219999, 8.29 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6, 6.5, 10, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6, 6.5, 10, 9.5 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6, 11, 10, 11.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6, 11, 10, 11.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 11, 9.5, 11.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6.5, 11, 9.5, 11.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box4",
|
||||
"from": [ 7, -9.94, 7.86 ],
|
||||
"to": [ 8.72, -9.08, 8.074999 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6, 6.5, 10, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6, 6.5, 10, 9.5 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6, 11, 10, 11.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6, 11, 10, 11.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 11, 9.5, 11.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6.5, 11, 9.5, 11.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box8",
|
||||
"from": [ 6.785, 5.11, 6.785 ],
|
||||
"to": [ 8.934999, 5.325, 9.15 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 5.5, 5, 10.5, 10.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 5.5, 5.5, 10.5, 11 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 5.5, 6.5, 10.5, 7 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 5.5, 6.5, 10.5, 7 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 5.5, 6.5, 11, 7 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 5, 6.5, 10.5, 7 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box9",
|
||||
"from": [ 7, 5.325, 7 ],
|
||||
"to": [ 8.72, 5.54, 8.935 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6, 5.5, 10, 10 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6, 6, 10, 10.5 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6, 6, 10, 6.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6, 6, 10, 6.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6, 6, 10.5, 6.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 5.5, 6, 10, 6.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box16",
|
||||
"from": [ 6.785, 5.325, 7.215 ],
|
||||
"to": [ 7, 5.54, 8.719999 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 5.5, 6, 6, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 5.5, 6.5, 6, 10 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 10, 6, 10.5, 6.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 5.5, 6, 6, 6.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 6, 10, 6.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6, 6, 9.5, 6.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box16",
|
||||
"from": [ 8.719999, 5.325, 7.215 ],
|
||||
"to": [ 8.934999, 5.54, 8.719999 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 5.5, 6, 6, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 5.5, 6.5, 6, 10 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 10, 8, 10.5, 8.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 5.5, 8, 6, 8.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 8, 10, 8.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6, 8, 9.5, 8.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box18",
|
||||
"from": [ 7.215, 5.325, 6.785 ],
|
||||
"to": [ 8.504999, 5.54, 7 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6.5, 10, 9.5, 10.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6.5, 5.5, 9.5, 6 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6.5, 6, 9.5, 6.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6.5, 6, 9.5, 6.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 5.5, 6, 6, 6.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 10, 6, 10.5, 6.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box18",
|
||||
"from": [ 7.215, 5.325, 8.934999 ],
|
||||
"to": [ 8.504999, 5.54, 9.15 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6.5, 10, 9.5, 10.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6.5, 5.5, 9.5, 6 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6.5, 8, 9.5, 8.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6.5, 8, 9.5, 8.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 5.5, 8, 6, 8.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 10, 8, 10.5, 8.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box16",
|
||||
"from": [ 6.57, 5.11, 7 ],
|
||||
"to": [ 6.784999, 5.325, 8.935 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 5.5, 6, 6, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 5.5, 6.5, 6, 10 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 10, 8, 10.5, 8.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 5.5, 8, 6, 8.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 8, 10, 8.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6, 8, 9.5, 8.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box16",
|
||||
"from": [ 8.934999, 5.11, 7 ],
|
||||
"to": [ 9.15, 5.325, 8.935 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 5.5, 6, 6, 9.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 5.5, 6.5, 6, 10 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 10, 8, 10.5, 8.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 5.5, 8, 6, 8.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 6.5, 8, 10, 8.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 6, 8, 9.5, 8.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box18",
|
||||
"from": [ 7, 5.11, 9.15 ],
|
||||
"to": [ 8.72, 5.325, 9.365 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6.5, 10, 9.5, 10.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6.5, 5.5, 9.5, 6 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6.5, 8, 9.5, 8.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6.5, 8, 9.5, 8.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 5.5, 8, 6, 8.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 10, 8, 10.5, 8.5 ], "texture": "#texture" }
|
||||
}
|
||||
},
|
||||
{
|
||||
"__comment": "Box18",
|
||||
"from": [ 7, 5.11, 6.57 ],
|
||||
"to": [ 8.72, 5.325, 6.784999 ],
|
||||
"faces": {
|
||||
"down": { "uv": [ 6.5, 10, 9.5, 10.5 ], "texture": "#texture" },
|
||||
"up": { "uv": [ 6.5, 5.5, 9.5, 6 ], "texture": "#texture" },
|
||||
"north": { "uv": [ 6.5, 8, 9.5, 8.5 ], "texture": "#texture" },
|
||||
"south": { "uv": [ 6.5, 8, 9.5, 8.5 ], "texture": "#texture" },
|
||||
"west": { "uv": [ 5.5, 8, 6, 8.5 ], "texture": "#texture" },
|
||||
"east": { "uv": [ 10, 8, 10.5, 8.5 ], "texture": "#texture" }
|
||||
}
|
||||
}
|
||||
],
|
||||
"display": {
|
||||
"gui": {
|
||||
"rotation": [ -90, 135, 90 ]
|
||||
},
|
||||
"ground": {
|
||||
"rotation": [ 90, 0, 0 ],
|
||||
"scale": [ 0.6, 0.6, 0.6 ]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [ 90, -45, 90 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,5 +13,17 @@
|
||||
"category": "block",
|
||||
"subtitle": "forgecraft.subtitle.bow_twang",
|
||||
"sounds": [ "forgecraft:bow_twang" ]
|
||||
}
|
||||
},
|
||||
|
||||
"chisel_hit": {
|
||||
"category": "block",
|
||||
"subtitle": "forgecraft.subtitle.chisel_hit",
|
||||
"sounds": [ "forgecraft:chisel_hit" ]
|
||||
},
|
||||
|
||||
"chisel_hit_finished": {
|
||||
"category": "block",
|
||||
"subtitle": "forgecraft.subtitle.chisel_hit_finishedg",
|
||||
"sounds": [ "forgecraft:chisel_hit_finished" ]
|
||||
}
|
||||
}
|
||||
BIN
kfc/src/main/resources/assets/forgecraft/sounds/chisel_hit.ogg
Normal file
BIN
kfc/src/main/resources/assets/forgecraft/sounds/chisel_hit.ogg
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user