Config Options
This commit is contained in:
parent
04359809d2
commit
1b97e5a62a
|
|
@ -34,7 +34,7 @@ public class CarryOn {
|
|||
public static CarryOn instance;
|
||||
|
||||
public static final String MODID = "carryon";
|
||||
public static final String VERSION = "1.7";
|
||||
public static final String VERSION = "1.7.1";
|
||||
public static final String NAME = "Carry On";
|
||||
public static final String ACCEPTED_VERSIONS = "[1.11,1.12)";
|
||||
public static final String UPDATE_JSON = "https://gist.githubusercontent.com/Tschipp/dccadee7c90d7a34e6e76a35d9d6fa2e/raw/";
|
||||
|
|
|
|||
|
|
@ -55,6 +55,12 @@ public class Configs {
|
|||
@Comment("Use Whitelist instead of Blacklist for Entities")
|
||||
public boolean useWhitelistEntities=false;
|
||||
|
||||
@Comment("Whether the player can break blocks while carrying or not")
|
||||
public boolean breakBlocksWhileCarrying=false;
|
||||
|
||||
@Comment("Whether the player drops the carried object when hit or not")
|
||||
public boolean dropCarriedWhenHit=false;
|
||||
|
||||
@Config.RequiresMcRestart()
|
||||
@Comment("Use custom Pickup Scripts. Having this set to false, will not allow you to run scripts, but will save you some performance")
|
||||
public boolean useScripts=false;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package tschipp.carryon.common.event;
|
|||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
|
|
@ -20,6 +21,7 @@ import net.minecraft.util.text.event.ClickEvent.Action;
|
|||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingAttackEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.StartTracking;
|
||||
|
|
@ -31,6 +33,7 @@ import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
|||
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||
import tschipp.carryon.CarryOn;
|
||||
import tschipp.carryon.client.keybinds.CarryOnKeybinds;
|
||||
import tschipp.carryon.common.config.CarryOnConfig;
|
||||
import tschipp.carryon.common.handler.PickupHandler;
|
||||
import tschipp.carryon.common.handler.RegistrationHandler;
|
||||
import tschipp.carryon.common.item.ItemEntity;
|
||||
|
|
@ -167,7 +170,7 @@ public class ItemEvents
|
|||
public void harvestSpeed(BreakSpeed event)
|
||||
{
|
||||
EntityPlayer player = event.getEntityPlayer();
|
||||
if (player != null)
|
||||
if (player != null && !CarryOnConfig.settings.breakBlocksWhileCarrying)
|
||||
{
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
|
|
@ -175,6 +178,27 @@ public class ItemEvents
|
|||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerAttack(LivingAttackEvent event)
|
||||
{
|
||||
EntityLivingBase eliving = event.getEntityLiving();
|
||||
if (eliving instanceof EntityPlayer && CarryOnConfig.settings.dropCarriedWhenHit)
|
||||
{
|
||||
EntityPlayer player = (EntityPlayer) eliving;
|
||||
ItemStack stack = player.getHeldItemMainhand();
|
||||
if (!stack.isEmpty() && (stack.getItem() == RegistrationHandler.itemTile || stack.getItem() == RegistrationHandler.itemEntity))
|
||||
{
|
||||
if (!player.world.isRemote)
|
||||
{
|
||||
player.setHeldItem(EnumHand.MAIN_HAND, ItemStack.EMPTY);
|
||||
EntityItem item = new EntityItem(player.world, player.posX, player.posY, player.posZ, stack);
|
||||
player.world.spawnEntity(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBlockRightClick(PlayerInteractEvent.RightClickBlock event) throws InstantiationException, IllegalAccessException
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user