This commit is contained in:
parent
f030fce712
commit
8342ef83ec
@ -1,5 +1,5 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.2.7-SNAPSHOT'
|
id 'fabric-loom' version '0.4-SNAPSHOT'
|
||||||
id 'com.matthewprenger.cursegradle' version '1.4.0'
|
id 'com.matthewprenger.cursegradle' version '1.4.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,12 +37,12 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
inputs.property 'version', mod_version
|
inputs.property 'version', project.version
|
||||||
inputs.property 'name', rootProject.name
|
inputs.property 'name', rootProject.name
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
include 'fabric.mod.json'
|
include 'fabric.mod.json'
|
||||||
expand 'version': mod_version, 'name': rootProject.name
|
expand 'version': project.version, 'name': rootProject.name
|
||||||
}
|
}
|
||||||
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
|
@ -3,11 +3,11 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version = 20w14a
|
minecraft_version = 1.16.1
|
||||||
curseforge_id = 368420
|
curseforge_id = 368420
|
||||||
simple_minecraft_version = 1.16-Snapshot
|
simple_minecraft_version = 1.16.1
|
||||||
yarn_build = 2
|
yarn_build = 4
|
||||||
fabric_loader_version = 0.7.9+build.190
|
fabric_loader_version = 0.8.8+build.202
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.9
|
mod_version = 1.0.9
|
||||||
@ -16,7 +16,7 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
|
# 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
|
fabric_api_version = 0.13.1+build.370-1.16
|
||||||
cloth_config_version = 3.2.1-unstable
|
cloth_config_version = 4.5.6
|
||||||
auto_config_version = 1.2.4
|
auto_config_version = 3.2.0-unstable
|
||||||
mod_menu_version = 1.11.1+build.3
|
mod_menu_version = 1.12.2+build.16
|
||||||
|
@ -7,13 +7,11 @@ import com.thebrokenrail.slightlyvanilla.entity.SpawnEggEntity;
|
|||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import net.fabricmc.fabric.api.entity.FabricEntityTypeBuilder;
|
|
||||||
import net.fabricmc.fabric.api.tag.TagRegistry;
|
import net.fabricmc.fabric.api.tag.TagRegistry;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.DispenserBlock;
|
import net.minecraft.block.DispenserBlock;
|
||||||
import net.minecraft.entity.EntityCategory;
|
|
||||||
import net.minecraft.entity.EntityDimensions;
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
import net.minecraft.entity.SpawnGroup;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.item.SpawnEggItem;
|
import net.minecraft.item.SpawnEggItem;
|
||||||
@ -41,11 +39,14 @@ public class SlightlyVanilla implements ModInitializer {
|
|||||||
public void onInitialize() {
|
public void onInitialize() {
|
||||||
AutoConfig.register(ModConfig.class, GsonConfigSerializer::new);
|
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();
|
Identifier slimeballID = new Identifier(NAMESPACE, "slimeball");
|
||||||
SPAWN_EGG_ENTITY = FabricEntityTypeBuilder.create(EntityCategory.MISC, (EntityType.EntityFactory<SpawnEggEntity>) SpawnEggEntity::new).size(EntityDimensions.fixed(0.25f, 0.25f)).build();
|
Identifier spawnEggID = new Identifier(NAMESPACE, "spawn_egg");
|
||||||
|
|
||||||
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "slimeball"), SLIMEBALL_ENTITY);
|
SLIMEBALL_ENTITY = EntityType.Builder.create((EntityType.EntityFactory<SlimeballEntity>) SlimeballEntity::new, SpawnGroup.MISC).setDimensions(0.25f, 0.25f).build(slimeballID.toString());
|
||||||
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "spawn_egg"), SPAWN_EGG_ENTITY);
|
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());
|
DispenserBlock.registerBehavior(Items.SLIME_BALL, new SlimeballDispenserBehavior());
|
||||||
|
|
||||||
|
@ -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()));
|
EntityRendererRegistry.INSTANCE.register(SlightlyVanilla.SPAWN_EGG_ENTITY, (entityRenderDispatcher, context) -> new FlyingItemEntityRenderer<SpawnEggEntity>(entityRenderDispatcher, context.getItemRenderer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getModId() {
|
|
||||||
return SlightlyVanilla.NAMESPACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
return (ConfigScreenFactory<Screen>) screen -> AutoConfig.getConfigScreen(ModConfig.class, screen).get();
|
return (ConfigScreenFactory<Screen>) screen -> AutoConfig.getConfigScreen(ModConfig.class, screen).get();
|
||||||
|
@ -7,7 +7,7 @@ import net.minecraft.block.dispenser.DispenserBehavior;
|
|||||||
import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
||||||
import net.minecraft.block.dispenser.ProjectileDispenserBehavior;
|
import net.minecraft.block.dispenser.ProjectileDispenserBehavior;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.SpawnType;
|
import net.minecraft.entity.SpawnReason;
|
||||||
import net.minecraft.entity.projectile.ProjectileEntity;
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.SpawnEggItem;
|
import net.minecraft.item.SpawnEggItem;
|
||||||
@ -22,7 +22,7 @@ public class SpawnEggDispenserBehavior implements DispenserBehavior {
|
|||||||
protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
|
protected ItemStack dispenseSilently(BlockPointer pointer, ItemStack stack) {
|
||||||
Direction direction = pointer.getBlockState().get(DispenserBlock.FACING);
|
Direction direction = pointer.getBlockState().get(DispenserBlock.FACING);
|
||||||
EntityType<?> entityType = ((SpawnEggItem)stack.getItem()).getEntityType(stack.getTag());
|
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);
|
stack.decrement(1);
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import net.fabricmc.api.EnvType;
|
|||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LivingEntity;
|
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.entity.projectile.thrown.ThrownItemEntity;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
@ -63,7 +63,7 @@ public class SpawnEggEntity extends ThrownItemEntity {
|
|||||||
if (!world.isClient()) {
|
if (!world.isClient()) {
|
||||||
world.sendEntityStatus(this, (byte) 3);
|
world.sendEntityStatus(this, (byte) 3);
|
||||||
EntityType<?> entityType = ((SpawnEggItem) getStack().getItem()).getEntityType(getStack().getTag());
|
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();
|
remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,12 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
|||||||
@Mixin(NetherPortalBlock.AreaHelper.class)
|
@Mixin(NetherPortalBlock.AreaHelper.class)
|
||||||
public class MixinNetherPortalBlockAreaHelper {
|
public class MixinNetherPortalBlockAreaHelper {
|
||||||
@SuppressWarnings("UnresolvedMixinReference")
|
@SuppressWarnings("UnresolvedMixinReference")
|
||||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;getBlock()Lnet/minecraft/block/Block;"), method = "*")
|
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/block/BlockState;isOf(Lnet/minecraft/block/Block;)Z"), method = "*")
|
||||||
public Block redirectBlock(BlockState state) {
|
public boolean redirectBlock(BlockState state, Block obsidian) {
|
||||||
Block block = state.getBlock();
|
if (SlightlyVanilla.getConfig().cryingObsidianNetherPortal && state.isIn(SlightlyVanilla.EXTRA_PORTAL_BLOCKS_TAG) && obsidian == Blocks.OBSIDIAN) {
|
||||||
if (block.isIn(SlightlyVanilla.EXTRA_PORTAL_BLOCKS_TAG) && SlightlyVanilla.getConfig().cryingObsidianNetherPortal) {
|
return true;
|
||||||
return Blocks.OBSIDIAN;
|
|
||||||
} else {
|
} else {
|
||||||
return block;
|
return state.isOf(obsidian);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,21 +2,31 @@ package com.thebrokenrail.slightlyvanilla.mixin;
|
|||||||
|
|
||||||
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
import net.minecraft.block.RespawnAnchorBlock;
|
import net.minecraft.block.RespawnAnchorBlock;
|
||||||
import net.minecraft.world.dimension.Dimension;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.world.dimension.DimensionType;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
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.Redirect;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Mixin(RespawnAnchorBlock.class)
|
@Mixin(RespawnAnchorBlock.class)
|
||||||
public class MixinRespawnAnchorBlock {
|
public class MixinRespawnAnchorBlock {
|
||||||
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/world/dimension/Dimension;getType()Lnet/minecraft/world/dimension/DimensionType;", ordinal = 0), method = "onUse")
|
@Inject(at = @At("HEAD"), method = "isNether", cancellable = true)
|
||||||
public DimensionType getDimension(Dimension dimension) {
|
private static void isNether(World world, CallbackInfoReturnable<Boolean> info) {
|
||||||
if (SlightlyVanilla.getConfig().useRespawnAnchorInAnyDimension) {
|
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 {
|
} else {
|
||||||
return dimension.getType();
|
return serverPlayerEntity.getSpawnPointPosition();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,5 +33,11 @@
|
|||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "1.16.x"
|
"minecraft": "1.16.x"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"modupdater": {
|
||||||
|
"strategy": "curseforge",
|
||||||
|
"projectID": 368420
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user