Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
3a323ad3f9 | |||
dd4694ec40 | |||
e04dc6ffe2 | |||
a1b67ed622 | |||
e7f639092b | |||
dc61f79b95 | |||
f3ea21bea5 | |||
b6614da325 | |||
ed494fd52a | |||
8342ef83ec | |||
f030fce712 | |||
6fa51c4650 | |||
cabf4162ca | |||
c82406bb47 |
12
CHANGELOG.md
12
CHANGELOG.md
@ -1,8 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
**1.15.2 Port**
|
**1.0.12**
|
||||||
* Remove Crying Obsidian Nether Portal
|
* Allow Disabling Beds Setting Spawn
|
||||||
* Remove Use Respawn Anchor In Any Dimension
|
|
||||||
|
**1.0.11**
|
||||||
|
* Fix Loading On Client Without ModMenu
|
||||||
|
* Fix Loading On Server
|
||||||
|
|
||||||
|
**1.0.10**
|
||||||
|
* Add Note Block Screen Tweak
|
||||||
|
|
||||||
**1.0.9**
|
**1.0.9**
|
||||||
* Disable Instant Nether Portal In Creative
|
* Disable Instant Nether Portal In Creative
|
||||||
|
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
@ -15,5 +15,17 @@ pipeline {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stage('Publish') {
|
||||||
|
when {
|
||||||
|
expression {
|
||||||
|
return sh(returnStdout: true, script: 'git tag --contains').trim().length() > 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
steps {
|
||||||
|
withCredentials([string(credentialsId: 'curseforge_key', variable: 'CURSEFORGE_KEY')]) {
|
||||||
|
sh './gradlew -Pcurseforge.api_key="${CURSEFORGE_KEY}" curseforge'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
# SlightlyVanilla
|
# SlightlyVanilla
|
||||||
**1.15.2 Port**
|
|
||||||
|
|
||||||
A Collection of Tweaks for Vanilla Minecraft
|
A Collection of Tweaks for Vanilla Minecraft
|
||||||
|
|
||||||
All tweaks can be enabled/disabled individually.
|
All tweaks can be enabled/disabled individually.
|
||||||
Suggest more tweaks in the issue tracker!
|
Suggest more tweaks in the issue tracker!
|
||||||
|
|
||||||
## Tweaks
|
## Tweaks
|
||||||
|
* Use Respawn Anchor in Any Dimension
|
||||||
* Instant Kill In Creative Mode
|
* Instant Kill In Creative Mode
|
||||||
* Throwable Slimeballs
|
* Throwable Slimeballs
|
||||||
* Throwable Spawn Eggs
|
* Throwable Spawn Eggs
|
||||||
* Open Loot Chests In Spectator Mode
|
* Open Loot Chests In Spectator Mode
|
||||||
|
* Crying Obsidian Nether Portal
|
||||||
* Allow Leashing Villagers
|
* Allow Leashing Villagers
|
||||||
* Disable Instant Nether Portal In Creative
|
* Disable Instant Nether Portal In Creative
|
||||||
|
* Add Note Block Screen
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
[View Changelog](CHANGELOG.md)
|
[View Changelog](CHANGELOG.md)
|
||||||
|
14
build.gradle
14
build.gradle
@ -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'
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,18 +31,18 @@ dependencies {
|
|||||||
|
|
||||||
modImplementation "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
|
modImplementation "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
|
||||||
include "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
|
include "me.shedaniel.cloth:config-2:${project.cloth_config_version}"
|
||||||
modImplementation "me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"
|
modImplementation "me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}"
|
||||||
include "me.sargunvohra.mcmods:autoconfig1u:${project.auto_config_version}"
|
include "me.sargunvohra.mcmods:autoconfig1u:${project.autoconfig_version}"
|
||||||
modImplementation "io.github.prospector:modmenu:${project.mod_menu_version}"
|
modImplementation "io.github.prospector:modmenu:${project.modmenu_version}"
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
||||||
@ -84,7 +84,7 @@ if (project.hasProperty('curseforge.api_key')) {
|
|||||||
apiKey = project.getProperty('curseforge.api_key')
|
apiKey = project.getProperty('curseforge.api_key')
|
||||||
project {
|
project {
|
||||||
id = project.curseforge_id
|
id = project.curseforge_id
|
||||||
changelog = 'A changelog can be found at https://gitea.thebrokenrail.com/TheBrokenRail/SlightlyVanilla/src/branch/1.15/CHANGELOG.md'
|
changelog = 'A changelog can be found at https://gitea.thebrokenrail.com/TheBrokenRail/SlightlyVanilla/src/branch/master/CHANGELOG.md'
|
||||||
releaseType = 'release'
|
releaseType = 'release'
|
||||||
addGameVersion project.simple_minecraft_version
|
addGameVersion project.simple_minecraft_version
|
||||||
addGameVersion 'Fabric'
|
addGameVersion 'Fabric'
|
||||||
|
@ -3,20 +3,20 @@ org.gradle.jvmargs = -Xmx1G
|
|||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/use
|
# check these on https://fabricmc.net/use
|
||||||
minecraft_version = 1.15.2
|
minecraft_version = 1.16.4
|
||||||
curseforge_id = 368420
|
curseforge_id = 368420
|
||||||
simple_minecraft_version = 1.15.2
|
simple_minecraft_version = 1.16.4
|
||||||
yarn_build = 14
|
yarn_build = 7
|
||||||
fabric_loader_version = 0.7.8+build.189
|
fabric_loader_version = 0.10.8
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 1.0.9
|
mod_version = 1.0.12
|
||||||
maven_group = com.thebrokenrail
|
maven_group = com.thebrokenrail
|
||||||
archives_base_name = slightlyvanilla
|
archives_base_name = slightlyvanilla
|
||||||
|
|
||||||
# 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.1+build.294-1.15
|
fabric_api_version = 0.28.1+1.16
|
||||||
cloth_config_version = 2.9.3
|
modmenu_version = 1.14.6+build.31
|
||||||
auto_config_version = 1.2.4
|
cloth_config_version = 4.7.0-unstable
|
||||||
mod_menu_version = 1.10.2+build.32
|
autoconfig_version = 3.2.0-unstable
|
||||||
|
@ -3,17 +3,25 @@ package com.thebrokenrail.slightlyvanilla;
|
|||||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
|
import me.sargunvohra.mcmods.autoconfig1u.annotation.ConfigEntry;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
|
||||||
|
|
||||||
@Config(name = SlightlyVanilla.NAMESPACE)
|
@Config(name = SlightlyVanilla.NAMESPACE)
|
||||||
public class ModConfig implements ConfigData {
|
public class ModConfig implements ConfigData {
|
||||||
|
public boolean useRespawnAnchorInAnyDimension = true;
|
||||||
public boolean instantKillInCreative = true;
|
public boolean instantKillInCreative = true;
|
||||||
@ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
|
@ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
|
||||||
public ThrowableOption throwableSlimeballs = new ThrowableOption(true, true);
|
public ThrowableOption throwableSlimeballs = new ThrowableOption(true, true);
|
||||||
@ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
|
@ConfigEntry.Gui.CollapsibleObject(startExpanded = true)
|
||||||
public ThrowableOption throwableSpawnEggs = new ThrowableOption(true, false);
|
public ThrowableOption throwableSpawnEggs = new ThrowableOption(true, false);
|
||||||
public boolean openLootChestsInSpectatorMode = true;
|
public boolean openLootChestsInSpectatorMode = true;
|
||||||
|
public boolean cryingObsidianNetherPortal = true;
|
||||||
public boolean allowLeashingVillagers = true;
|
public boolean allowLeashingVillagers = true;
|
||||||
public boolean disableInstantNetherPortalInCreative = true;
|
public boolean disableInstantNetherPortalInCreative = true;
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public boolean noteBlockScreen = true;
|
||||||
|
public boolean bedsSetSpawn = true;
|
||||||
|
|
||||||
public static class ThrowableOption {
|
public static class ThrowableOption {
|
||||||
public boolean player;
|
public boolean player;
|
||||||
|
@ -1,31 +1,27 @@
|
|||||||
package com.thebrokenrail.slightlyvanilla;
|
package com.thebrokenrail.slightlyvanilla;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.dispenser.SlimeballDispenserBehavior;
|
||||||
|
import com.thebrokenrail.slightlyvanilla.dispenser.SpawnEggDispenserBehavior;
|
||||||
import com.thebrokenrail.slightlyvanilla.entity.SlimeballEntity;
|
import com.thebrokenrail.slightlyvanilla.entity.SlimeballEntity;
|
||||||
import com.thebrokenrail.slightlyvanilla.entity.SpawnEggEntity;
|
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.object.builder.v1.entity.FabricEntityTypeBuilder;
|
||||||
|
import net.fabricmc.fabric.api.tag.TagRegistry;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.DispenserBlock;
|
import net.minecraft.block.DispenserBlock;
|
||||||
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.EntityDimensions;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.SpawnType;
|
import net.minecraft.entity.SpawnGroup;
|
||||||
import net.minecraft.entity.projectile.Projectile;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.item.Items;
|
import net.minecraft.item.Items;
|
||||||
import net.minecraft.item.SpawnEggItem;
|
import net.minecraft.item.SpawnEggItem;
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.sound.SoundEvents;
|
import net.minecraft.sound.SoundEvents;
|
||||||
|
import net.minecraft.tag.Tag;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPointer;
|
|
||||||
import net.minecraft.util.math.Direction;
|
|
||||||
import net.minecraft.util.math.Position;
|
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import net.minecraft.world.World;
|
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -35,6 +31,8 @@ public class SlightlyVanilla implements ModInitializer {
|
|||||||
public static EntityType<SlimeballEntity> SLIMEBALL_ENTITY;
|
public static EntityType<SlimeballEntity> SLIMEBALL_ENTITY;
|
||||||
public static EntityType<SpawnEggEntity> SPAWN_EGG_ENTITY;
|
public static EntityType<SpawnEggEntity> SPAWN_EGG_ENTITY;
|
||||||
|
|
||||||
|
public static final Tag<Block> NETHER_PORTAL_FRAME_BLOCKS_TAG = TagRegistry.block(new Identifier(NAMESPACE, "nether_portal_frame_blocks"));
|
||||||
|
|
||||||
public static ModConfig getConfig() {
|
public static ModConfig getConfig() {
|
||||||
return AutoConfig.getConfigHolder(ModConfig.class).getConfig();
|
return AutoConfig.getConfigHolder(ModConfig.class).getConfig();
|
||||||
}
|
}
|
||||||
@ -43,51 +41,16 @@ 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();
|
SLIMEBALL_ENTITY = FabricEntityTypeBuilder.create(SpawnGroup.MISC, (EntityType.EntityFactory<SlimeballEntity>) SlimeballEntity::new).dimensions(new EntityDimensions(0.25f, 0.25f, true)).build();
|
||||||
SPAWN_EGG_ENTITY = FabricEntityTypeBuilder.create(EntityCategory.MISC, (EntityType.EntityFactory<SpawnEggEntity>) SpawnEggEntity::new).size(EntityDimensions.fixed(0.25f, 0.25f)).build();
|
SPAWN_EGG_ENTITY = FabricEntityTypeBuilder.create(SpawnGroup.MISC, (EntityType.EntityFactory<SpawnEggEntity>) SpawnEggEntity::new).dimensions(new EntityDimensions(0.25f, 0.25f, true)).build();
|
||||||
|
|
||||||
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "slimeball"), SLIMEBALL_ENTITY);
|
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "slimeball"), SLIMEBALL_ENTITY);
|
||||||
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "spawn_egg"), SPAWN_EGG_ENTITY);
|
Registry.register(Registry.ENTITY_TYPE, new Identifier(NAMESPACE, "spawn_egg"), SPAWN_EGG_ENTITY);
|
||||||
|
|
||||||
DispenserBlock.registerBehavior(Items.SLIME_BALL, (pointer, stack) -> {
|
DispenserBlock.registerBehavior(Items.SLIME_BALL, new SlimeballDispenserBehavior());
|
||||||
if (getConfig().throwableSlimeballs.dispenser) {
|
|
||||||
return new ProjectileDispenserBehavior() {
|
|
||||||
@Override
|
|
||||||
protected Projectile 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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
for (SpawnEggItem spawnEgg : SpawnEggItem.getAll()) {
|
for (SpawnEggItem spawnEgg : SpawnEggItem.getAll()) {
|
||||||
DispenserBlock.registerBehavior(spawnEgg, (pointer, stack) -> {
|
DispenserBlock.registerBehavior(spawnEgg, new SpawnEggDispenserBehavior());
|
||||||
if (getConfig().throwableSpawnEggs.dispenser) {
|
|
||||||
return new ProjectileDispenserBehavior() {
|
|
||||||
@Override
|
|
||||||
protected Projectile createProjectile(World position, Position stack, ItemStack itemStack) {
|
|
||||||
SpawnEggEntity entity = new SpawnEggEntity(position, stack.getX(), stack.getY(), stack.getZ());
|
|
||||||
entity.setItem(itemStack);
|
|
||||||
return entity;
|
|
||||||
}
|
|
||||||
}.dispense(pointer, stack);
|
|
||||||
} else {
|
|
||||||
return new ItemDispenserBehavior() {
|
|
||||||
@Override
|
|
||||||
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);
|
|
||||||
stack.decrement(1);
|
|
||||||
return stack;
|
|
||||||
}
|
|
||||||
}.dispense(pointer, stack);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.client;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.ModConfig;
|
||||||
|
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
||||||
|
import io.github.prospector.modmenu.api.ModMenuApi;
|
||||||
|
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public class ModMenu implements ModMenuApi {
|
||||||
|
@Override
|
||||||
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
|
return (ConfigScreenFactory<Screen>) screen -> AutoConfig.getConfigScreen(ModConfig.class, screen).get();
|
||||||
|
}
|
||||||
|
}
|
@ -1,35 +1,20 @@
|
|||||||
package com.thebrokenrail.slightlyvanilla.client;
|
package com.thebrokenrail.slightlyvanilla.client;
|
||||||
|
|
||||||
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
import com.thebrokenrail.slightlyvanilla.ModConfig;
|
|
||||||
import com.thebrokenrail.slightlyvanilla.entity.SlimeballEntity;
|
import com.thebrokenrail.slightlyvanilla.entity.SlimeballEntity;
|
||||||
import com.thebrokenrail.slightlyvanilla.entity.SpawnEggEntity;
|
import com.thebrokenrail.slightlyvanilla.entity.SpawnEggEntity;
|
||||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
|
||||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
|
||||||
import net.fabricmc.api.ClientModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
import net.fabricmc.fabric.api.client.rendereregistry.v1.EntityRendererRegistry;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
|
||||||
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Environment(EnvType.CLIENT)
|
@Environment(EnvType.CLIENT)
|
||||||
public class SlightlyVanillaClient implements ClientModInitializer, ModMenuApi {
|
public class SlightlyVanillaClient implements ClientModInitializer {
|
||||||
@Override
|
@Override
|
||||||
public void onInitializeClient() {
|
public void onInitializeClient() {
|
||||||
EntityRendererRegistry.INSTANCE.register(SlightlyVanilla.SLIMEBALL_ENTITY, (entityRenderDispatcher, context) -> new FlyingItemEntityRenderer<SlimeballEntity>(entityRenderDispatcher, context.getItemRenderer()));
|
EntityRendererRegistry.INSTANCE.register(SlightlyVanilla.SLIMEBALL_ENTITY, (entityRenderDispatcher, context) -> new FlyingItemEntityRenderer<SlimeballEntity>(entityRenderDispatcher, context.getItemRenderer()));
|
||||||
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
|
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
|
||||||
return (ConfigScreenFactory<Screen>) screen -> AutoConfig.getConfigScreen(ModConfig.class, screen).get();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,144 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.client.screen;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
|
import com.thebrokenrail.slightlyvanilla.mixin.ScreenHandlerAccessor;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
import net.minecraft.client.gui.widget.SliderWidget;
|
||||||
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
|
import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
|
||||||
|
import net.minecraft.screen.ScreenHandlerContext;
|
||||||
|
import net.minecraft.state.property.Properties;
|
||||||
|
import net.minecraft.text.LiteralText;
|
||||||
|
import net.minecraft.text.TranslatableText;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
public class NoteBlockScreen extends Screen {
|
||||||
|
private static class NoteSliderWidget extends SliderWidget {
|
||||||
|
private final ScreenHandlerContext context;
|
||||||
|
|
||||||
|
public NoteSliderWidget(ScreenHandlerContext context, int x, int y, int width, int height) {
|
||||||
|
super(x, y, width, height, LiteralText.EMPTY, (double) getNote(context) / getMax());
|
||||||
|
this.context = context;
|
||||||
|
updateMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double getMax() {
|
||||||
|
return (double) Properties.NOTE.getValues().size() - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("OptionalGetWithoutIsPresent")
|
||||||
|
private static int getNote(ScreenHandlerContext context) {
|
||||||
|
return context.run((BiFunction<World, BlockPos, Integer>) (world, pos) -> world.getBlockState(pos).get(Properties.NOTE)).get();
|
||||||
|
}
|
||||||
|
|
||||||
|
private int toNote() {
|
||||||
|
return (int) (value * getMax());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateMessage() {
|
||||||
|
int note = toNote();
|
||||||
|
setMessage(new TranslatableText("text." + SlightlyVanilla.NAMESPACE + ".noteblock_screen_slider", note, new TranslatableText("text." + SlightlyVanilla.NAMESPACE + ".noteblock_note." + note)));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void applyValue() {
|
||||||
|
context.run((world, blockPos) -> {
|
||||||
|
BlockState target = world.getBlockState(blockPos);
|
||||||
|
|
||||||
|
int currentNote = target.get(Properties.NOTE);
|
||||||
|
int targetNote = toNote();
|
||||||
|
|
||||||
|
int amount;
|
||||||
|
if (targetNote >= currentNote) {
|
||||||
|
amount = targetNote - currentNote;
|
||||||
|
} else {
|
||||||
|
amount = ((int) getMax()) - currentNote + 1 + targetNote;
|
||||||
|
}
|
||||||
|
|
||||||
|
MinecraftClient client = MinecraftClient.getInstance();
|
||||||
|
assert client != null;
|
||||||
|
assert client.getNetworkHandler() != null;
|
||||||
|
|
||||||
|
BlockHitResult hitResult = new BlockHitResult(Vec3d.ofCenter(blockPos), Direction.UP, blockPos, false);
|
||||||
|
for (int i = 0; i < amount; i++) {
|
||||||
|
client.getNetworkHandler().sendPacket(new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, hitResult));
|
||||||
|
}
|
||||||
|
|
||||||
|
world.setBlockState(blockPos, target.with(Properties.NOTE, targetNote));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final Identifier TEXTURE = new Identifier(SlightlyVanilla.NAMESPACE, "textures/gui/noteblock.png");
|
||||||
|
|
||||||
|
private final ScreenHandlerContext context;
|
||||||
|
|
||||||
|
public NoteBlockScreen(ScreenHandlerContext context) {
|
||||||
|
super(Blocks.NOTE_BLOCK.getName());
|
||||||
|
passEvents = true;
|
||||||
|
this.context = context;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void init() {
|
||||||
|
super.init();
|
||||||
|
int sliderWidth = BACKGROUND_WIDTH - 36;
|
||||||
|
int sliderHeight = 20;
|
||||||
|
addButton(new NoteSliderWidget(context, width / 2 - sliderWidth / 2, (height / 2) - (sliderHeight / 2) + 4, sliderWidth, sliderHeight));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final int BACKGROUND_WIDTH = 176;
|
||||||
|
private static final int BACKGROUND_HEIGHT = 60;
|
||||||
|
|
||||||
|
private static final int TITLE_X_OFFSET = 8;
|
||||||
|
private static final int TITLE_Y_OFFSEt = 6;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderBackground(MatrixStack matrices) {
|
||||||
|
super.renderBackground(matrices);
|
||||||
|
|
||||||
|
//noinspection deprecation
|
||||||
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
assert client != null;
|
||||||
|
client.getTextureManager().bindTexture(TEXTURE);
|
||||||
|
int centerX = width / 2;
|
||||||
|
int centerY = height / 2;
|
||||||
|
drawTexture(matrices, centerX - (BACKGROUND_WIDTH / 2), centerY - (BACKGROUND_HEIGHT / 2), 0, 0, BACKGROUND_WIDTH, BACKGROUND_HEIGHT);
|
||||||
|
|
||||||
|
int titleX = centerX - (BACKGROUND_WIDTH / 2) + TITLE_X_OFFSET;
|
||||||
|
int titleY = centerY - (BACKGROUND_HEIGHT / 2) + TITLE_Y_OFFSEt;
|
||||||
|
textRenderer.draw(matrices, title, titleX, titleY, 4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
|
renderBackground(matrices);
|
||||||
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick() {
|
||||||
|
super.tick();
|
||||||
|
assert client != null;
|
||||||
|
if (!ScreenHandlerAccessor.callCanUse(context, client.player, Blocks.NOTE_BLOCK)) {
|
||||||
|
assert client.player != null;
|
||||||
|
client.player.closeScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,35 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.dispenser;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
|
import com.thebrokenrail.slightlyvanilla.entity.SlimeballEntity;
|
||||||
|
import net.minecraft.block.dispenser.DispenserBehavior;
|
||||||
|
import net.minecraft.block.dispenser.ItemDispenserBehavior;
|
||||||
|
import net.minecraft.block.dispenser.ProjectileDispenserBehavior;
|
||||||
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.math.BlockPointer;
|
||||||
|
import net.minecraft.util.math.Position;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SlimeballDispenserBehavior implements DispenserBehavior {
|
||||||
|
private static class Default extends ItemDispenserBehavior {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Modified extends 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack dispense(BlockPointer pointer, ItemStack stack) {
|
||||||
|
if (SlightlyVanilla.getConfig().throwableSlimeballs.dispenser) {
|
||||||
|
return new Modified().dispense(pointer, stack);
|
||||||
|
} else {
|
||||||
|
return new Default().dispense(pointer, stack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.dispenser;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
|
import com.thebrokenrail.slightlyvanilla.entity.SpawnEggEntity;
|
||||||
|
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.EntityType;
|
||||||
|
import net.minecraft.entity.SpawnReason;
|
||||||
|
import net.minecraft.entity.projectile.ProjectileEntity;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.SpawnEggItem;
|
||||||
|
import net.minecraft.util.math.BlockPointer;
|
||||||
|
import net.minecraft.util.math.Direction;
|
||||||
|
import net.minecraft.util.math.Position;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SpawnEggDispenserBehavior implements DispenserBehavior {
|
||||||
|
private static class Default extends ItemDispenserBehavior {
|
||||||
|
@Override
|
||||||
|
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), SpawnReason.DISPENSER, direction != Direction.UP, false);
|
||||||
|
stack.decrement(1);
|
||||||
|
return stack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Modified extends ProjectileDispenserBehavior {
|
||||||
|
@Override
|
||||||
|
protected ProjectileEntity createProjectile(World position, Position stack, ItemStack itemStack) {
|
||||||
|
SpawnEggEntity entity = new SpawnEggEntity(position, stack.getX(), stack.getY(), stack.getZ());
|
||||||
|
entity.setItem(itemStack);
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack dispense(BlockPointer pointer, ItemStack stack) {
|
||||||
|
if (SlightlyVanilla.getConfig().throwableSpawnEggs.dispenser) {
|
||||||
|
return new Modified().dispense(pointer, stack);
|
||||||
|
} else {
|
||||||
|
return new Default().dispense(pointer, 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.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;
|
||||||
import net.minecraft.network.Packet;
|
import net.minecraft.network.Packet;
|
||||||
@ -49,15 +49,16 @@ public class SlimeballEntity extends ThrownItemEntity {
|
|||||||
ParticleEffect particleEffect = getParticleParameters();
|
ParticleEffect particleEffect = getParticleParameters();
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
world.addParticle(particleEffect, getX(), getY(), getZ(), 0.0D, 0.0D, 0.0D);
|
getEntityWorld().addParticle(particleEffect, getX(), getY(), getZ(), 0.0D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCollision(HitResult hitResult) {
|
protected void onCollision(HitResult hitResult) {
|
||||||
if (!world.isClient()) {
|
super.onCollision(hitResult);
|
||||||
world.sendEntityStatus(this, (byte) 3);
|
if (!getEntityWorld().isClient()) {
|
||||||
|
getEntityWorld().sendEntityStatus(this, (byte) 3);
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,8 @@ 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.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;
|
||||||
import net.minecraft.item.SpawnEggItem;
|
import net.minecraft.item.SpawnEggItem;
|
||||||
@ -15,6 +15,7 @@ import net.minecraft.network.packet.s2c.play.EntitySpawnS2CPacket;
|
|||||||
import net.minecraft.particle.ItemStackParticleEffect;
|
import net.minecraft.particle.ItemStackParticleEffect;
|
||||||
import net.minecraft.particle.ParticleEffect;
|
import net.minecraft.particle.ParticleEffect;
|
||||||
import net.minecraft.particle.ParticleTypes;
|
import net.minecraft.particle.ParticleTypes;
|
||||||
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.hit.HitResult;
|
import net.minecraft.util.hit.HitResult;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@ -52,17 +53,18 @@ public class SpawnEggEntity extends ThrownItemEntity {
|
|||||||
ParticleEffect particleEffect = getParticleParameters();
|
ParticleEffect particleEffect = getParticleParameters();
|
||||||
|
|
||||||
for (int i = 0; i < 8; ++i) {
|
for (int i = 0; i < 8; ++i) {
|
||||||
world.addParticle(particleEffect, getX(), getY(), getZ(), 0.0D, 0.0D, 0.0D);
|
getEntityWorld().addParticle(particleEffect, getX(), getY(), getZ(), 0.0D, 0.0D, 0.0D);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCollision(HitResult hitResult) {
|
protected void onCollision(HitResult hitResult) {
|
||||||
if (!world.isClient()) {
|
super.onCollision(hitResult);
|
||||||
world.sendEntityStatus(this, (byte) 3);
|
if (!getEntityWorld().isClient()) {
|
||||||
|
getEntityWorld().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((ServerWorld) getEntityWorld(), getItem(), null, getBlockPos(), SpawnReason.SPAWN_EGG, false, false);
|
||||||
remove();
|
remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package com.thebrokenrail.slightlyvanilla.mixin;
|
|||||||
|
|
||||||
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.passive.AbstractTraderEntity;
|
import net.minecraft.entity.passive.MerchantEntity;
|
||||||
import net.minecraft.entity.passive.PassiveEntity;
|
import net.minecraft.entity.passive.PassiveEntity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
@ -12,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@Mixin(AbstractTraderEntity.class)
|
@Mixin(MerchantEntity.class)
|
||||||
public abstract class MixinAbstractTraderEntity extends PassiveEntity {
|
public abstract class MixinAbstractTraderEntity extends PassiveEntity {
|
||||||
protected MixinAbstractTraderEntity(EntityType<? extends PassiveEntity> entityType, World world) {
|
protected MixinAbstractTraderEntity(EntityType<? extends PassiveEntity> entityType, World world) {
|
||||||
super(entityType, world);
|
super(entityType, world);
|
||||||
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.mixin;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
|
import com.thebrokenrail.slightlyvanilla.client.screen.NoteBlockScreen;
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.client.MinecraftClient;
|
||||||
|
import net.minecraft.client.network.ClientPlayerEntity;
|
||||||
|
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||||
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.screen.ScreenHandlerContext;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
@Mixin(ClientPlayerInteractionManager.class)
|
||||||
|
public class MixinClientPlayerInteractionManager {
|
||||||
|
@Shadow
|
||||||
|
@Final
|
||||||
|
private MinecraftClient client;
|
||||||
|
|
||||||
|
@Inject(at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getStackInHand(Lnet/minecraft/util/Hand;)Lnet/minecraft/item/ItemStack;", ordinal = 0), method = "interactBlock", cancellable = true)
|
||||||
|
public void interactBlock(ClientPlayerEntity player, ClientWorld world, Hand hand, BlockHitResult hitResult, CallbackInfoReturnable<ActionResult> info) {
|
||||||
|
if (!player.isSpectator() && SlightlyVanilla.getConfig().noteBlockScreen && world.getBlockState(hitResult.getBlockPos()).getBlock() == Blocks.NOTE_BLOCK) {
|
||||||
|
NoteBlockScreen screen = new NoteBlockScreen(ScreenHandlerContext.create(world, hitResult.getBlockPos()));
|
||||||
|
client.openScreen(screen);
|
||||||
|
|
||||||
|
info.setReturnValue(ActionResult.SUCCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.mixin;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.BlockView;
|
||||||
|
import net.minecraft.world.dimension.AreaHelper;
|
||||||
|
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.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
@Mixin(AreaHelper.class)
|
||||||
|
public class MixinNetherPortalBlockAreaHelper {
|
||||||
|
@Inject(at = @At("HEAD"), method = "method_30487", cancellable = true)
|
||||||
|
private static void isValidFrameBlock(BlockState state, BlockView world, BlockPos pos, CallbackInfoReturnable<Boolean> info) {
|
||||||
|
if (SlightlyVanilla.getConfig().cryingObsidianNetherPortal) {
|
||||||
|
info.setReturnValue(state.isIn(SlightlyVanilla.NETHER_PORTAL_FRAME_BLOCKS_TAG));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.mixin;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
|
import net.minecraft.block.RespawnAnchorBlock;
|
||||||
|
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 {
|
||||||
|
@Inject(at = @At("HEAD"), method = "isNether", cancellable = true)
|
||||||
|
private static void isNether(World world, CallbackInfoReturnable<Boolean> info) {
|
||||||
|
if (SlightlyVanilla.getConfig().useRespawnAnchorInAnyDimension) {
|
||||||
|
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 serverPlayerEntity.getSpawnPointPosition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.mixin;
|
||||||
|
|
||||||
|
import com.thebrokenrail.slightlyvanilla.SlightlyVanilla;
|
||||||
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(ServerPlayerEntity.class)
|
||||||
|
public class MixinServerPlayerEntity {
|
||||||
|
@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;setSpawnPoint(Lnet/minecraft/util/registry/RegistryKey;Lnet/minecraft/util/math/BlockPos;FZZ)V"), method = "trySleep")
|
||||||
|
public void setSpawnPoint(ServerPlayerEntity obj, RegistryKey<World> dimension, BlockPos pos, float angle, boolean spawnPointSet, boolean bl) {
|
||||||
|
if (SlightlyVanilla.getConfig().bedsSetSpawn) {
|
||||||
|
obj.setSpawnPoint(dimension, pos, angle, spawnPointSet, bl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.thebrokenrail.slightlyvanilla.mixin;
|
||||||
|
|
||||||
|
import net.fabricmc.api.EnvType;
|
||||||
|
import net.fabricmc.api.Environment;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
import net.minecraft.screen.ScreenHandler;
|
||||||
|
import net.minecraft.screen.ScreenHandlerContext;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.gen.Invoker;
|
||||||
|
|
||||||
|
@Environment(EnvType.CLIENT)
|
||||||
|
@Mixin(ScreenHandler.class)
|
||||||
|
public interface ScreenHandlerAccessor {
|
||||||
|
@Invoker
|
||||||
|
static boolean callCanUse(ScreenHandlerContext context, PlayerEntity player, Block block) {
|
||||||
|
throw new UnsupportedOperationException();
|
||||||
|
}
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"text.autoconfig.slightlyvanilla.title": "SlightlyVanilla Tweaks",
|
"text.autoconfig.slightlyvanilla.title": "SlightlyVanilla Tweaks",
|
||||||
|
"text.autoconfig.slightlyvanilla.option.useRespawnAnchorInAnyDimension": "Use Respawn Anchor In Any Dimension",
|
||||||
"text.autoconfig.slightlyvanilla.option.instantKillInCreative": "Instant 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.throwableSlimeballs": "Throwable Slimeballs",
|
||||||
"text.autoconfig.slightlyvanilla.option.throwableSlimeballs.player": "Player",
|
"text.autoconfig.slightlyvanilla.option.throwableSlimeballs.player": "Player",
|
||||||
@ -8,8 +9,37 @@
|
|||||||
"text.autoconfig.slightlyvanilla.option.throwableSpawnEggs.player": "Player",
|
"text.autoconfig.slightlyvanilla.option.throwableSpawnEggs.player": "Player",
|
||||||
"text.autoconfig.slightlyvanilla.option.throwableSpawnEggs.dispenser": "Dispenser",
|
"text.autoconfig.slightlyvanilla.option.throwableSpawnEggs.dispenser": "Dispenser",
|
||||||
"text.autoconfig.slightlyvanilla.option.openLootChestsInSpectatorMode": "Open Loot Chests In Spectator Mode",
|
"text.autoconfig.slightlyvanilla.option.openLootChestsInSpectatorMode": "Open Loot Chests In Spectator Mode",
|
||||||
|
"text.autoconfig.slightlyvanilla.option.cryingObsidianNetherPortal": "Crying Obsidian Nether Portal",
|
||||||
"text.autoconfig.slightlyvanilla.option.allowLeashingVillagers": "Allow Leashing Villagers",
|
"text.autoconfig.slightlyvanilla.option.allowLeashingVillagers": "Allow Leashing Villagers",
|
||||||
"text.autoconfig.slightlyvanilla.option.disableInstantNetherPortalInCreative": "Disable Instant Nether Portal In Creative",
|
"text.autoconfig.slightlyvanilla.option.disableInstantNetherPortalInCreative": "Disable Instant Nether Portal In Creative",
|
||||||
|
"text.autoconfig.slightlyvanilla.option.noteBlockScreen": "Add Note Block Screen",
|
||||||
|
"text.autoconfig.slightlyvanilla.option.bedsSetSpawn": "Beds Set Spawn",
|
||||||
"entity.slightlyvanilla.slimeball": "Slimeball",
|
"entity.slightlyvanilla.slimeball": "Slimeball",
|
||||||
"entity.slightlyvanilla.spawn_egg": "Spawn Egg"
|
"entity.slightlyvanilla.spawn_egg": "Spawn Egg",
|
||||||
|
"text.slightlyvanilla.noteblock_screen_slider": "Note: %s (%s)",
|
||||||
|
"text.slightlyvanilla.noteblock_note.0": "F#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.1": "G",
|
||||||
|
"text.slightlyvanilla.noteblock_note.2": "G#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.3": "A",
|
||||||
|
"text.slightlyvanilla.noteblock_note.4": "A#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.5": "B",
|
||||||
|
"text.slightlyvanilla.noteblock_note.6": "C",
|
||||||
|
"text.slightlyvanilla.noteblock_note.7": "C#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.8": "D",
|
||||||
|
"text.slightlyvanilla.noteblock_note.9": "D#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.10": "E",
|
||||||
|
"text.slightlyvanilla.noteblock_note.11": "F",
|
||||||
|
"text.slightlyvanilla.noteblock_note.12": "F#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.13": "G",
|
||||||
|
"text.slightlyvanilla.noteblock_note.14": "G#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.15": "A",
|
||||||
|
"text.slightlyvanilla.noteblock_note.16": "A#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.17": "B",
|
||||||
|
"text.slightlyvanilla.noteblock_note.18": "C",
|
||||||
|
"text.slightlyvanilla.noteblock_note.19": "C#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.20": "D",
|
||||||
|
"text.slightlyvanilla.noteblock_note.21": "D#",
|
||||||
|
"text.slightlyvanilla.noteblock_note.22": "E",
|
||||||
|
"text.slightlyvanilla.noteblock_note.23": "F",
|
||||||
|
"text.slightlyvanilla.noteblock_note.24": "F#"
|
||||||
}
|
}
|
Binary file not shown.
After Width: | Height: | Size: 8.5 KiB |
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"replace": false,
|
||||||
|
"values": [
|
||||||
|
"minecraft:obsidian",
|
||||||
|
"minecraft:crying_obsidian"
|
||||||
|
]
|
||||||
|
}
|
@ -23,7 +23,7 @@
|
|||||||
"com.thebrokenrail.slightlyvanilla.client.SlightlyVanillaClient"
|
"com.thebrokenrail.slightlyvanilla.client.SlightlyVanillaClient"
|
||||||
],
|
],
|
||||||
"modmenu": [
|
"modmenu": [
|
||||||
"com.thebrokenrail.slightlyvanilla.client.SlightlyVanillaClient"
|
"com.thebrokenrail.slightlyvanilla.client.ModMenu"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
@ -32,6 +32,12 @@
|
|||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.7.4",
|
"fabricloader": ">=0.7.4",
|
||||||
"fabric": "*",
|
"fabric": "*",
|
||||||
"minecraft": "1.15.x"
|
"minecraft": "1.16.x"
|
||||||
|
},
|
||||||
|
"custom": {
|
||||||
|
"modupdater": {
|
||||||
|
"strategy": "curseforge",
|
||||||
|
"projectID": 368420
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,19 @@
|
|||||||
"package": "com.thebrokenrail.slightlyvanilla.mixin",
|
"package": "com.thebrokenrail.slightlyvanilla.mixin",
|
||||||
"compatibilityLevel": "JAVA_8",
|
"compatibilityLevel": "JAVA_8",
|
||||||
"client": [
|
"client": [
|
||||||
"MixinClientPlayNetworkHandler"
|
"MixinClientPlayerInteractionManager",
|
||||||
|
"MixinClientPlayNetworkHandler",
|
||||||
|
"ScreenHandlerAccessor"
|
||||||
],
|
],
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"MixinPlayerEntity",
|
"MixinAbstractTraderEntity",
|
||||||
"MixinItem",
|
"MixinItem",
|
||||||
"MixinSpawnEggItem",
|
|
||||||
"MixinLootableContainerBlockEntity",
|
"MixinLootableContainerBlockEntity",
|
||||||
"MixinAbstractTraderEntity"
|
"MixinNetherPortalBlockAreaHelper",
|
||||||
|
"MixinPlayerEntity",
|
||||||
|
"MixinRespawnAnchorBlock",
|
||||||
|
"MixinServerPlayerEntity",
|
||||||
|
"MixinSpawnEggItem"
|
||||||
],
|
],
|
||||||
"injectors": {
|
"injectors": {
|
||||||
"defaultRequire": 1
|
"defaultRequire": 1
|
||||||
|
Reference in New Issue
Block a user