commit
acf337406a
5 changed files with 85 additions and 16 deletions
|
@ -86,7 +86,7 @@ dependencies {
|
|||
provided "codechicken:CodeChickenLib:${config.minecraft.version}-${config.codechickenlib.version}:deobf"
|
||||
//provided "codechicken:CodeChickenCore:${config.minecraft.version}-${config.codechickencore.version}:dev"
|
||||
//provided "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:dev"
|
||||
provided "net.industrial-craft:industrialcraft-2:${config.ic2.version}:dev"
|
||||
deobfCompile "net.industrial-craft:industrialcraft-2:${config.ic2.version}"
|
||||
deobfCompile "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}"
|
||||
deobfCompile "mezz.jei:jei_${config.minecraft.version}:+"
|
||||
//provided "applecore:AppleCore:${config.applecore.version}:api"
|
||||
|
|
|
@ -237,7 +237,7 @@ public class GregTech_API {
|
|||
sSoundList.put(3, "block.stone_button.click_on");//SoundEvents.BLOCK_STONE_BUTTON_CLICK_ON.getSoundName().toString());
|
||||
sSoundList.put(4, "block.fire.extinguish");//SoundEvents.ENTITY_ITEM_BREAK.getSoundName().toString());
|
||||
sSoundList.put(5, "entity.generic.explode");//SoundEvents.ENTITY_GENERIC_EXPLODE.getSoundName().toString());
|
||||
sSoundList.put(6, "item.firecharge.use");//SoundEvents.ITEM_FIRECHARGE_USE.getSoundName().toString());
|
||||
sSoundList.put(6, "item.flintandsteel.use");//SoundEvents.ITEM_FIRECHARGE_USE.getSoundName().toString());
|
||||
|
||||
registerSound(100, aTextIC2Lower + ":" + "tools.Wrench");
|
||||
registerSound(101, aTextIC2Lower + ":" + "tools.RubberTrampoline");
|
||||
|
|
|
@ -12,18 +12,24 @@ import gregtech.api.objects.MaterialStack;
|
|||
import gregtech.api.util.GT_LanguageManager;
|
||||
import gregtech.api.util.GT_ModHandler;
|
||||
import gregtech.api.util.GT_OreDictUnificator;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.SoundType;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.Explosion;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
@ -31,6 +37,7 @@ import net.minecraft.world.World;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
public class GT_Block_Reinforced extends GT_Generic_Block {
|
||||
|
@ -180,6 +187,62 @@ public class GT_Block_Reinforced extends GT_Generic_Block {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) {
|
||||
if(!world.isRemote && state.getValue(METADATA) == 5){
|
||||
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F, player);
|
||||
world.spawnEntityInWorld(entitytntprimed);
|
||||
world.playSound((EntityPlayer)null, pos, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||
|
||||
world.setBlockToAir(pos);
|
||||
return false;
|
||||
}
|
||||
return super.removedByPlayer(state, world, pos, player, willHarvest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
|
||||
super.onBlockAdded(worldIn, pos, state);
|
||||
if (worldIn.isBlockPowered(pos) && state.getValue(METADATA) == 5) {
|
||||
this.removedByPlayer(state, worldIn, pos, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn) {
|
||||
if (worldIn.isBlockPowered(pos) && state.getValue(METADATA) == 5) {
|
||||
this.removedByPlayer(state, worldIn, pos, null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockExploded(World world, BlockPos pos, Explosion explosion) {
|
||||
if (!world.isRemote && world.getBlockState(pos).getValue(METADATA) == 5) {
|
||||
EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosion.getExplosivePlacedBy());
|
||||
entitytntprimed.setFuse(world.rand.nextInt(entitytntprimed.getFuse() / 4) + entitytntprimed.getFuse() / 8);
|
||||
world.spawnEntityInWorld(entitytntprimed);
|
||||
}
|
||||
super.onBlockExploded(world, pos, explosion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (heldItem != null && (heldItem.getItem() == Items.FLINT_AND_STEEL || heldItem.getItem() == Items.FIRE_CHARGE) && state.getValue(METADATA) == 5) {
|
||||
removedByPlayer(state, worldIn, pos, playerIn, true);
|
||||
|
||||
if (heldItem.getItem() == Items.FLINT_AND_STEEL)
|
||||
{
|
||||
heldItem.damageItem(1, playerIn);
|
||||
}
|
||||
else if (!playerIn.capabilities.isCreativeMode)
|
||||
{
|
||||
--heldItem.stackSize;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubBlocks(Item aItem, CreativeTabs par2CreativeTabs, List<ItemStack> aList) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
|
|
|
@ -23,6 +23,8 @@ public class GT_Cover_Crafting extends GT_CoverBehavior {
|
|||
return true;
|
||||
}
|
||||
};
|
||||
playerMP.openContainer.windowId = playerMP.currentWindowId;
|
||||
playerMP.openContainer.addListener(playerMP);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ public class Behaviour_Lighter
|
|||
return false;
|
||||
}
|
||||
boolean rOutput = false;
|
||||
if ((aEntity instanceof EntityCreeper)) {
|
||||
if (aEntity instanceof EntityCreeper) {
|
||||
prepare(aStack);
|
||||
long tFuelAmount = GT_Utility.ItemNBT.getLighterFuel(aStack);
|
||||
if (GT_Utility.areStacksEqual(aStack, this.mUsedLighter, true)) {
|
||||
|
@ -68,24 +68,28 @@ public class Behaviour_Lighter
|
|||
|
||||
@Override
|
||||
public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, BlockPos blockPos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
|
||||
if ((aWorld.isRemote) || (aStack.stackSize != 1) || !aPlayer.canPlayerEdit(blockPos, side, aStack)) {
|
||||
if (aWorld.isRemote || aStack.stackSize != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
long tFuelAmount = GT_Utility.ItemNBT.getLighterFuel(aStack);
|
||||
BlockPos clickedBlock = blockPos.offset(side);
|
||||
if(Blocks.FIRE.canCatchFire(aWorld, blockPos, side)) {
|
||||
if(!aPlayer.canPlayerEdit(clickedBlock, side, aStack)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (aWorld.isAirBlock(clickedBlock))
|
||||
{
|
||||
prepare(aStack);
|
||||
aWorld.setBlockState(clickedBlock, Blocks.FIRE.getDefaultState());
|
||||
GT_Utility.ItemNBT.setLighterFuel(aStack, --tFuelAmount);
|
||||
if(tFuelAmount == 0L) {
|
||||
useUp(aStack);
|
||||
long tFuelAmount = GT_Utility.ItemNBT.getLighterFuel(aStack);
|
||||
|
||||
GT_Utility.sendSoundToPlayers(aWorld, GregTech_API.sSoundList.get(6), 1.0F, 1.0F, clickedBlock.getX(), clickedBlock.getY(), clickedBlock.getZ());
|
||||
aWorld.setBlockState(clickedBlock, Blocks.FIRE.getDefaultState(), 11);
|
||||
|
||||
if (!aPlayer.capabilities.isCreativeMode) {
|
||||
tFuelAmount -= 1L;
|
||||
}
|
||||
} else if(Blocks.FIRE.canCatchFire(aWorld, clickedBlock, EnumFacing.UP)) {
|
||||
prepare(aStack);
|
||||
aWorld.setBlockState(clickedBlock, Blocks.FIRE.getDefaultState());
|
||||
GT_Utility.ItemNBT.setLighterFuel(aStack, --tFuelAmount);
|
||||
if(tFuelAmount == 0L) {
|
||||
GT_Utility.ItemNBT.setLighterFuel(aStack, tFuelAmount);
|
||||
if(tFuelAmount <= 0L) {
|
||||
useUp(aStack);
|
||||
}
|
||||
}
|
||||
|
@ -113,7 +117,7 @@ public class Behaviour_Lighter
|
|||
public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) {
|
||||
aList.add(this.mTooltip);
|
||||
NBTTagCompound tNBT = aStack.getTagCompound();
|
||||
long tFuelAmount = tNBT == null ? 0L : GT_Utility.areStacksEqual(aStack, this.mFullLighter, true) ? this.mFuelAmount : tNBT.getLong("GT.LighterFuel");
|
||||
long tFuelAmount = tNBT == null ? this.mFuelAmount : tNBT.getLong("GT.LighterFuel");
|
||||
aList.add(this.mTooltipUses + " " + tFuelAmount);
|
||||
aList.add(this.mTooltipUnstackable);
|
||||
return aList;
|
||||
|
|
Loading…
Reference in a new issue