Fix Spawn Protection
This commit is contained in:
parent
221f6e2336
commit
378a0662c8
@ -1,5 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
**1.0.14**
|
||||||
|
* Fix Spawn Protection
|
||||||
|
|
||||||
**1.0.13**
|
**1.0.13**
|
||||||
* Fix Bugs
|
* Fix Bugs
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
fabric_loader_version = 0.7.10+build.191
|
fabric_loader_version = 0.7.10+build.191
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.13
|
mod_version = 1.0.14
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
archives_base_name = reliccraft
|
archives_base_name = reliccraft
|
||||||
|
|
||||||
|
@ -9,9 +9,12 @@ import net.minecraft.entity.LivingEntity;
|
|||||||
import net.minecraft.entity.SpawnType;
|
import net.minecraft.entity.SpawnType;
|
||||||
import net.minecraft.entity.mob.ZombieEntity;
|
import net.minecraft.entity.mob.ZombieEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.entity.thrown.ThrownPotionEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
|
import net.minecraft.potion.PotionUtil;
|
||||||
|
import net.minecraft.potion.Potions;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -78,6 +81,9 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
|
ThrownPotionEntity entity = new ThrownPotionEntity(world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
entity.setItemStack(PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), Potions.STRONG_HARMING));
|
||||||
|
world.spawnEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,10 +95,12 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
BlockState state1 = world.getBlockState(attacker.getBlockPos().down());
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos) && world.canPlayerModifyAt((PlayerEntity) attacker, attacker.getBlockPos().down())) {
|
||||||
BlockState state2 = world.getBlockState(pos);
|
BlockState state1 = world.getBlockState(attacker.getBlockPos().down());
|
||||||
world.setBlockState(attacker.getBlockPos().down(), state2);
|
BlockState state2 = world.getBlockState(pos);
|
||||||
world.setBlockState(pos, state1);
|
world.setBlockState(attacker.getBlockPos().down(), state2);
|
||||||
|
world.setBlockState(pos, state1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -109,14 +117,18 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, Entity target) {
|
public void execute(World world, LivingEntity attacker, Entity target) {
|
||||||
target.remove();
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, target.getBlockPos())) {
|
||||||
target.kill();
|
target.remove();
|
||||||
world.setBlockState(target.getBlockPos(), Blocks.DIRT.getDefaultState());
|
target.kill();
|
||||||
|
world.setBlockState(target.getBlockPos(), Blocks.DIRT.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||||
|
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +149,9 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
world.setBlockState(pos, Blocks.LAVA.getDefaultState());
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||||
|
world.setBlockState(pos, Blocks.LAVA.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,7 +168,9 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
world.setBlockState(pos, Blocks.END_STONE.getDefaultState());
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||||
|
world.setBlockState(pos, Blocks.END_STONE.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -212,7 +228,7 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
if (world.getBlockState(pos).getBlock() == getTargetBlock()) {
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos) && world.getBlockState(pos).getBlock() == getTargetBlock()) {
|
||||||
world.setBlockState(pos, getConvertedBlock().getDefaultState());
|
world.setBlockState(pos, getConvertedBlock().getDefaultState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,19 +264,23 @@ public class Actions {
|
|||||||
public static class BedrockAction implements Action {
|
public static class BedrockAction implements Action {
|
||||||
@Override
|
@Override
|
||||||
public int getCost() {
|
public int getCost() {
|
||||||
return 90;
|
return 95;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, Entity target) {
|
public void execute(World world, LivingEntity attacker, Entity target) {
|
||||||
target.remove();
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, attacker.getBlockPos())) {
|
||||||
target.kill();
|
target.remove();
|
||||||
world.setBlockState(target.getBlockPos(), Blocks.BEDROCK.getDefaultState());
|
target.kill();
|
||||||
|
world.setBlockState(target.getBlockPos(), Blocks.BEDROCK.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
world.setBlockState(pos, Blocks.BEDROCK.getDefaultState());
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||||
|
world.setBlockState(pos, Blocks.BEDROCK.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,6 +299,9 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
|
ThrownPotionEntity entity = new ThrownPotionEntity(world, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
entity.setItemStack(PotionUtil.setPotion(new ItemStack(Items.LINGERING_POTION), Potions.STRONG_HEALING));
|
||||||
|
world.spawnEntity(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,9 +353,11 @@ public class Actions {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
public void execute(World world, LivingEntity attacker, BlockPos pos) {
|
||||||
int blockID = new Random().nextInt(Registry.BLOCK.getIds().size());
|
if (attacker instanceof PlayerEntity && world.canPlayerModifyAt((PlayerEntity) attacker, pos)) {
|
||||||
Block block = Registry.BLOCK.get(blockID);
|
int blockID = new Random().nextInt(Registry.BLOCK.getIds().size());
|
||||||
world.setBlockState(pos, block.getDefaultState());
|
Block block = Registry.BLOCK.get(blockID);
|
||||||
|
world.setBlockState(pos, block.getDefaultState());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Reference in New Issue
Block a user