Fix #794, fix some issues with ic2 wrench, and use new forge perms to check when taping and wrenching blocks

This commit is contained in:
modmuss50 2016-11-05 15:10:28 +00:00
parent 015620094c
commit c9ff3330ca
No known key found for this signature in database
GPG key ID: 203A5ED4D3E48BEA
5 changed files with 31 additions and 4 deletions

View file

@ -70,8 +70,8 @@ if (ENV.BUILD_NUMBER) {
}
minecraft {
version = "1.10.2-12.18.1.2084"
mappings = "snapshot_20160518"
version = "1.10.2-12.18.2.2121"
mappings = "snapshot_20161105"
replace "@MODVERSION@", project.version
// makeObfSourceJar = false
useDepAts = true

View file

@ -18,7 +18,10 @@ import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.server.permission.PermissionAPI;
import net.minecraftforge.server.permission.context.BlockPosContext;
import reborncore.RebornCore;
import reborncore.common.util.RebornPermissions;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.init.ModSounds;
import techreborn.items.ItemParts;
@ -147,6 +150,9 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
if(!PermissionAPI.hasPermission(playerIn.getGameProfile(), RebornPermissions.TAP_BLOCK, new BlockPosContext(playerIn, pos, worldIn.getBlockState(pos), side))){
return false;
}
if (playerIn.getHeldItem(EnumHand.MAIN_HAND) != null
&& playerIn.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemTreeTap)
if (state.getValue(HAS_SAP)) {

View file

@ -20,8 +20,11 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.server.permission.PermissionAPI;
import net.minecraftforge.server.permission.context.BlockPosContext;
import reborncore.common.IWrenchable;
import reborncore.common.tile.TileMachineBase;
import reborncore.common.util.RebornPermissions;
import techreborn.blocks.fluid.BlockFluidBase;
import techreborn.client.TechRebornCreativeTabMisc;
import techreborn.compat.CompatManager;
@ -48,6 +51,9 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
@Override
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
if(!PermissionAPI.hasPermission(player.getGameProfile(), RebornPermissions.WRENCH_BLOCK, new BlockPosContext(player, pos, world.getBlockState(pos), side))){
return EnumActionResult.FAIL;
}
if (CompatManager.isIC2Loaded) {
EnumActionResult result = IC2WrenchHelper.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
if (result == EnumActionResult.SUCCESS) {
@ -76,7 +82,15 @@ public class ItemWrench extends ItemTR implements ITexturedItem {
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos,
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!PermissionAPI.hasPermission(player.getGameProfile(), RebornPermissions.WRENCH_BLOCK, new BlockPosContext(player, pos, world.getBlockState(pos), facing))){
return EnumActionResult.FAIL;
}
if (CompatManager.isIC2Loaded) {
EnumActionResult result = IC2WrenchHelper.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
if (result == EnumActionResult.SUCCESS) {
return result;
}
}
if (world.isAirBlock(pos)) {
return EnumActionResult.FAIL;
}

View file

@ -21,4 +21,11 @@ public class IC2WrenchHelper {
}
return wrench.onItemUseFirst(stack, player, world, pos, side, hitX, hitY, hitZ, hand);
}
public static EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (wrench == null) {
wrench = (ItemToolWrench) IC2Items.getItem("wrench").getItem();
}
return wrench.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
}
}

View file

@ -102,7 +102,7 @@ public class TechRebornWorldGen implements IWorldGenerator {
// config.overworldOres.addAll(getMissingOres(config.overworldOres, defaultConfig.overworldOres));
// config.neatherOres.addAll(getMissingOres(config.neatherOres, defaultConfig.neatherOres));
// config.endOres.addAll(getMissingOres(config.endOres, defaultConfig.endOres));
if (!jsonInvalid) {
if (jsonInvalid) {
save();
}
}