Port To 1.16.1
All checks were successful
SlightlyVanilla/pipeline/head This commit looks good

This commit is contained in:
TheBrokenRail 2020-06-24 18:48:38 -04:00
parent f030fce712
commit 8342ef83ec
9 changed files with 50 additions and 39 deletions

View File

@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.2.7-SNAPSHOT'
id 'fabric-loom' version '0.4-SNAPSHOT'
id 'com.matthewprenger.cursegradle' version '1.4.0'
}
@ -37,12 +37,12 @@ dependencies {
}
processResources {
inputs.property 'version', mod_version
inputs.property 'version', project.version
inputs.property 'name', rootProject.name
from(sourceSets.main.resources.srcDirs) {
include 'fabric.mod.json'
expand 'version': mod_version, 'name': rootProject.name
expand 'version': project.version, 'name': rootProject.name
}
from(sourceSets.main.resources.srcDirs) {

View File

@ -3,11 +3,11 @@ org.gradle.jvmargs = -Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
minecraft_version = 20w14a
minecraft_version = 1.16.1
curseforge_id = 368420
simple_minecraft_version = 1.16-Snapshot
yarn_build = 2
fabric_loader_version = 0.7.9+build.190
simple_minecraft_version = 1.16.1
yarn_build = 4
fabric_loader_version = 0.8.8+build.202
# Mod Properties
mod_version = 1.0.9
@ -16,7 +16,7 @@ org.gradle.jvmargs = -Xmx1G
# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
fabric_api_version = 0.5.7+build.314-1.16
cloth_config_version = 3.2.1-unstable
auto_config_version = 1.2.4
mod_menu_version = 1.11.1+build.3
fabric_api_version = 0.13.1+build.370-1.16
cloth_config_version = 4.5.6
auto_config_version = 3.2.0-unstable
mod_menu_version = 1.12.2+build.16

View File

@ -7,13 +7,11 @@ import com.thebrokenrail.slightlyvanilla.entity.SpawnEggEntity;
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.fabricmc.fabric.api.tag.TagRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.DispenserBlock;
import net.minecraft.entity.EntityCategory;
import net.minecraft.entity.EntityDimensions;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnGroup;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Items;
import net.minecraft.item.SpawnEggItem;
@ -41,11 +39,14 @@ public class SlightlyVanilla implements ModInitializer {
public void onInitialize() {
AutoConfig.register(ModConfig.class, GsonConfigSerializer::new);
SLIMEBALL_ENTITY = FabricEntityTypeBuilder.create(EntityCategory.MISC, (EntityType.EntityFactory<SlimeballEntity>) SlimeballEntity::new).size(EntityDimensions.fixed(0.25f, 0.25f)).build();
SPAWN_EGG_ENTITY = FabricEntityTypeBuilder.create(EntityCategory.MISC, (EntityType.EntityFactory<SpawnEggEntity>) SpawnEggEntity::new).size(EntityDimensions.fixed(0.25f, 0.25f)).build();
Identifier slimeballID = new Identifier(NAMESPACE, "slimeball");
Identifier spawnEggID = new Identifier(NAMESPACE, "spawn_egg");
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "slimeball"), SLIMEBALL_ENTITY);
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "spawn_egg"), SPAWN_EGG_ENTITY);
SLIMEBALL_ENTITY = EntityType.Builder.create((EntityType.EntityFactory<SlimeballEntity>) SlimeballEntity::new, SpawnGroup.MISC).setDimensions(0.25f, 0.25f).build(slimeballID.toString());
SPAWN_EGG_ENTITY = EntityType.Builder.create((EntityType.EntityFactory<SpawnEggEntity>) SpawnEggEntity::new, SpawnGroup.MISC).setDimensions(0.25f, 0.25f).build(spawnEggID.toString());
Registry.register(Registry.ENTITY_TYPE, slimeballID, SLIMEBALL_ENTITY);
Registry.register(Registry.ENTITY_TYPE, spawnEggID, SPAWN_EGG_ENTITY);
DispenserBlock.registerBehavior(Items.SLIME_BALL, new SlimeballDispenserBehavior());

View File

@ -23,11 +23,6 @@ public class SlightlyVanillaClient implements ClientModInitializer, ModMenuApi {
EntityRendererRegistry.INSTANCE.register(SlightlyVanilla.SPAWN_EGG_ENTITY, (entityRenderDispatcher, context) -> new FlyingItemEntityRenderer<SpawnEggEntity>(entityRenderDispatcher, context.getItemRenderer()));
}
@Override
public String getModId() {
return SlightlyVanilla.NAMESPACE;
}
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return (ConfigScreenFactory<Screen>) screen -> AutoConfig.getConfigScreen(ModConfig.class, screen).get();

View File

@ -7,7 +7,7 @@ import net.minecraft.block.dispenser.DispenserBehavior;
import net.minecraft.block.dispenser.ItemDispenserBehavior;
import net.minecraft.block.dispenser.ProjectileDispenserBehavior;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.SpawnType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.SpawnEggItem;
@ -22,7 +22,7 @@ public class SpawnEggDispenserBehavior implements DispenserBehavior {
protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
Direction direction = pointer.getBlockState().get(DispenserBlock.FACING);
EntityType<?> entityType = ((SpawnEggItem)stack.getItem()).getEntityType(stack.getTag());
entityType.spawnFromItemStack(pointer.getWorld(), stack, null, pointer.getBlockPos().offset(direction), SpawnType.DISPENSER, direction != Direction.UP, false);
entityType.spawnFromItemStack(pointer.getWorld(), stack, null, pointer.getBlockPos().offset(direction), SpawnReason.DISPENSER, direction != Direction.UP, false);
stack.decrement(1);
return stack;
}

View File

@ -5,7 +5,7 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.SpawnType;
import net.minecraft.entity.SpawnReason;
import net.minecraft.entity.projectile.thrown.ThrownItemEntity;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
@ -63,7 +63,7 @@ public class SpawnEggEntity extends ThrownItemEntity {
if (!world.isClient()) {
world.sendEntityStatus(this, (byte) 3);
EntityType<?> entityType = ((SpawnEggItem) getStack().getItem()).getEntityType(getStack().getTag());
entityType.spawnFromItemStack(world, getItem(), null, getBlockPos(), SpawnType.SPAWN_EGG, false, false);
entityType.spawnFromItemStack(world, getItem(), null, getBlockPos(), SpawnReason.SPAWN_EGG, false, false);
remove();
}
}

View File

@ -13,13 +13,12 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(NetherPortalBlock.AreaHelper.class)
public class MixinNetherPortalBlockAreaHelper {
@SuppressWarnings("UnresolvedMixinReference")
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"), method = "*")
public Block redirectBlock(BlockState state) {
Block block = state.getBlock();
if (block.isIn(SlightlyVanilla.EXTRA_PORTAL_BLOCKS_TAG) && SlightlyVanilla.getConfig().cryingObsidianNetherPortal) {
return Blocks.OBSIDIAN;
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z"), method = "*")
public boolean redirectBlock(BlockState state, Block obsidian) {
if (SlightlyVanilla.getConfig().cryingObsidianNetherPortal && state.isIn(SlightlyVanilla.EXTRA_PORTAL_BLOCKS_TAG) && obsidian == Blocks.OBSIDIAN) {
return true;
} else {
return block;
return state.isOf(obsidian);
}
}
}

View File

@ -2,21 +2,31 @@ package com.thebrokenrail.slightlyvanilla.mixin;
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
import net.minecraft.block.RespawnAnchorBlock;
import net.minecraft.world.dimension.Dimension;
import net.minecraft.world.dimension.DimensionType;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@SuppressWarnings("unused")
@Mixin(RespawnAnchorBlock.class)
public class MixinRespawnAnchorBlock {
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/dimension/Dimension;getType()Lnet/minecraft/world/dimension/DimensionType;", ordinal = 0), method = "onUse")
public DimensionType getDimension(Dimension dimension) {
@Inject(at = @At("HEAD"), method = "isNether", cancellable = true)
private static void isNether(World world, CallbackInfoReturnable<Boolean> info) {
if (SlightlyVanilla.getConfig().useRespawnAnchorInAnyDimension) {
return DimensionType.THE_NETHER;
info.setReturnValue(true);
}
}
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;getSpawnPointPosition()Lnet/minecraft/util/math/BlockPos;"), method = "onUse")
public BlockPos getSpawnPointPosition(ServerPlayerEntity serverPlayerEntity) {
if (SlightlyVanilla.getConfig().useRespawnAnchorInAnyDimension && serverPlayerEntity.getSpawnPointPosition() == null) {
return new BlockPos(0, 512, 0);
} else {
return dimension.getType();
return serverPlayerEntity.getSpawnPointPosition();
}
}
}

View File

@ -33,5 +33,11 @@
"fabricloader": ">=0.7.4",
"fabric": "*",
"minecraft": "1.16.x"
},
"custom": {
"modupdater": {
"strategy": "curseforge",
"projectID": 368420
}
}
}