Merge branch 'master' of github.com:mcMMO-Dev/mcMMO into configurable

This commit is contained in:
nossr50
2019-05-14 23:01:05 -07:00
13 changed files with 135 additions and 43 deletions

View File

@ -48,6 +48,10 @@ public class FishingManager extends SkillManager {
private long fishHookSpawnTimestamp;
private long lastWarned;
private long lastWarnedExhaust;
public static final int FISHING_ROD_CAST_CD_MILLISECONDS = 100;
private final long FISHING_COOLDOWN_SECONDS = 1000L;
private FishHook fishHookReference;
private BoundingBox lastFishingBoundingBox;
private Location hookLocation;
private int fishCaughtCounter;
@ -130,7 +134,7 @@ public class FishingManager extends SkillManager {
fishCaughtCounter = 1;
if (fishCaughtCounter + 1 == overfishLimit) {
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResources"));
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", mcMMO.getConfigManager().getConfigExploitPrevention().getOverFishingAreaSize() * 2));
}
//If the new bounding box does not intersect with the old one, then update our bounding box reference

View File

@ -85,7 +85,9 @@ public class Herbalism {
protected static int countAndMarkDoubleDropsMultiBlockPlant(BlockState blockState, boolean triple, HerbalismManager herbalismManager) {
Block block = blockState.getBlock();
Material blockType = blockState.getType();
int dropAmount = mcMMO.getPlaceStore().isTrue(block) ? 0 : 1;
int dropAmount = 0;
int bonusDropAmount = 0;
int bonusAdd = triple ? 2 : 1;
if (blockType == Material.CHORUS_PLANT) {
dropAmount = 1;
@ -94,6 +96,17 @@ public class Herbalism {
dropAmount = calculateChorusPlantDrops(block, triple, herbalismManager);
}
} else {
//Check the block itself first
if(!mcMMO.getPlaceStore().isTrue(block))
{
dropAmount++;
if(herbalismManager.checkDoubleDrop(blockState))
bonusDropAmount+=bonusAdd;
} else {
mcMMO.getPlaceStore().setFalse(blockState);
}
// Handle the two blocks above it - cacti & sugar cane can only grow 3 high naturally
for (int y = 1; y < 255; y++) {
Block relativeBlock = block.getRelative(BlockFace.UP, y);
@ -107,12 +120,15 @@ public class Herbalism {
} else {
dropAmount++;
if (herbalismManager.checkDoubleDrop(relativeBlock.getState()))
BlockUtils.markDropsAsBonus(relativeBlock.getState(), triple);
if(herbalismManager.checkDoubleDrop(relativeBlock.getState()))
bonusDropAmount+=bonusAdd;
}
}
}
//Mark the original block for bonus drops
BlockUtils.markDropsAsBonus(blockState, bonusDropAmount);
return dropAmount;
}

View File

@ -249,6 +249,14 @@ public class TamingManager extends SkillManager {
}
public void attackTarget(LivingEntity target) {
if(target instanceof Tameable)
{
Tameable tameable = (Tameable) target;
if(tameable.getOwner() == getPlayer())
{
return;
}
}
double range = 5;
Player player = getPlayer();
@ -299,36 +307,36 @@ public class TamingManager extends SkillManager {
}
location = Misc.getLocationOffset(location, 1);
LivingEntity entity = (LivingEntity) player.getWorld().spawnEntity(location, type);
LivingEntity callOfWildEntity = (LivingEntity) player.getWorld().spawnEntity(location, type);
FakeEntityTameEvent event = new FakeEntityTameEvent(entity, player);
FakeEntityTameEvent event = new FakeEntityTameEvent(callOfWildEntity, player);
mcMMO.p.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
continue;
}
entity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
((Tameable) entity).setOwner(player);
entity.setRemoveWhenFarAway(false);
callOfWildEntity.setMetadata(MetadataConstants.UNNATURAL_MOB_METAKEY, MetadataConstants.metadataValue);
((Tameable) callOfWildEntity).setOwner(player);
callOfWildEntity.setRemoveWhenFarAway(false);
addToTracker(entity);
addToTracker(callOfWildEntity);
switch (type) {
case OCELOT:
((Ocelot) entity).setCatType(Ocelot.Type.values()[1 + Misc.getRandom().nextInt(3)]);
((Ocelot) callOfWildEntity).setCatType(Ocelot.Type.values()[1 + Misc.getRandom().nextInt(3)]);
break;
case WOLF:
entity.setMaxHealth(20.0);
entity.setHealth(entity.getMaxHealth());
callOfWildEntity.setMaxHealth(20.0);
callOfWildEntity.setHealth(callOfWildEntity.getMaxHealth());
break;
case HORSE:
Horse horse = (Horse) entity;
Horse horse = (Horse) callOfWildEntity;
entity.setMaxHealth(15.0 + (Misc.getRandom().nextDouble() * 15));
entity.setHealth(entity.getMaxHealth());
callOfWildEntity.setMaxHealth(15.0 + (Misc.getRandom().nextDouble() * 15));
callOfWildEntity.setHealth(callOfWildEntity.getMaxHealth());
horse.setColor(Horse.Color.values()[Misc.getRandom().nextInt(Horse.Color.values().length)]);
horse.setStyle(Horse.Style.values()[Misc.getRandom().nextInt(Horse.Style.values().length)]);
horse.setJumpStrength(Math.max(AdvancedConfig.getInstance().getMinHorseJumpStrength(), Math.min(Math.min(Misc.getRandom().nextDouble(), Misc.getRandom().nextDouble()) * 2, AdvancedConfig.getInstance().getMaxHorseJumpStrength())));
@ -340,10 +348,10 @@ public class TamingManager extends SkillManager {
}
if (Permissions.renamePets(player)) {
entity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", player.getName(), StringUtils.getPrettyEntityTypeString(type)));
callOfWildEntity.setCustomName(LocaleLoader.getString("Taming.Summon.Name.Format", player.getName(), StringUtils.getPrettyEntityTypeString(type)));
}
ParticleEffectUtils.playCallOfTheWildEffect(entity);
ParticleEffectUtils.playCallOfTheWildEffect(callOfWildEntity);
}
ItemStack leftovers = new ItemStack(heldItem);