1.0.2
All checks were successful
SlightlyVanilla/pipeline/head This commit looks good

Allow Shooting Slimeballs from Dispensers
Update Lang
This commit is contained in:
TheBrokenRail 2020-03-19 18:03:42 -04:00
parent 59a8c4c869
commit 36f1f31bad
6 changed files with 34 additions and 4 deletions

View File

@ -1,5 +1,9 @@
# Changelog
**1.0.2**
* Allow Shooting Slimeballs from Dispensers
* Update Lang
**1.0.1**
* Update Mappings
* Add Throwable Spawn Eggs

View File

@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G
fabric_loader_version = 0.7.8+build.189
# Mod Properties
mod_version = 1.0.1
mod_version = 1.0.2
maven_group = com.thebrokenrail
archives_base_name = slightlyvanilla

View File

@ -6,7 +6,7 @@ import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
@Config(name = SlightlyVanilla.NAMESPACE)
public class ModConfig implements ConfigData {
public boolean useRespawnAnchorInAnyDimension = true;
public boolean instantlyKillInCreative = true;
public boolean instantKillInCreative = true;
public boolean throwableSlimeballs = true;
public boolean throwableSpawnEggs = true;
}

View File

@ -6,11 +6,21 @@ import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.entity.FabricEntityTypeBuilder;
import net.minecraft.block.DispenserBlock;
import net.minecraft.block.dispenser.DispenserBehavior;
import net.minecraft.block.dispenser.ItemDispenserBehavior;
import net.minecraft.block.dispenser.ProjectileDispenserBehavior;
import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.BlockPointer;
import net.minecraft.util.math.Position;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
public class SlightlyVanilla implements ModInitializer {
public static final String NAMESPACE = "slightlyvanilla";
@ -31,5 +41,20 @@ public class SlightlyVanilla implements ModInitializer {
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "slimeball"), SLIMEBALL_ENTITY);
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "spawn_egg"), SPAWN_EGG_ENTITY);
DispenserBlock.registerBehavior(Items.SLIME_BALL, (pointer, stack) -> {
if (getConfig().throwableSlimeballs) {
return new ProjectileDispenserBehavior() {
@Override
protected ProjectileEntity createProjectile(World position, Position stack, ItemStack itemStack) {
SlimeballEntity entity = new SlimeballEntity(position, stack.getX(), stack.getY(), stack.getZ());
entity.setItem(itemStack);
return entity;
}
}.dispense(pointer, stack);
} else {
return new ItemDispenserBehavior().dispense(pointer, stack);
}
});
}
}

View File

@ -15,7 +15,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class MixinPlayerEntity {
@Inject(at = @At("HEAD"), method = "attack", cancellable = true)
public void attack(Entity target, CallbackInfo info) {
if (SlightlyVanilla.getConfig().instantlyKillInCreative && target.isAttackable()) {
if (SlightlyVanilla.getConfig().instantKillInCreative && target.isAttackable()) {
if (target instanceof EnderDragonPart) {
target = ((EnderDragonPart)target).owner;
}

View File

@ -1,8 +1,9 @@
{
"text.autoconfig.slightlyvanilla.title": "SlightlyVanilla Tweaks",
"text.autoconfig.slightlyvanilla.option.useRespawnAnchorInAnyDimension": "Use Respawn Anchor In Any Dimension",
"text.autoconfig.slightlyvanilla.option.instantlyKillInCreative": "Instantly Kill In Creative Mode",
"text.autoconfig.slightlyvanilla.option.instantKillInCreative": "Instant Kill In Creative Mode",
"text.autoconfig.slightlyvanilla.option.throwableSlimeballs": "Throwable Slimeballs",
"text.autoconfig.slightlyvanilla.option.throwableSpawnEggs": "Throwable Spawn Eggs",
"entity.slightlyvanilla.slimeball": "Slimeball",
"entity.slightlyvanilla.spawn_egg": "Spawn Egg"
}