fix some small minor issues noticed on the server
This commit is contained in:
parent
d7d65ddb49
commit
49e4de1b71
3 changed files with 37 additions and 0 deletions
|
@ -11,6 +11,7 @@ import at.petrak.hexcasting.common.blocks.HexBlocks
|
||||||
import at.petrak.hexcasting.common.casting.RegisterPatterns
|
import at.petrak.hexcasting.common.casting.RegisterPatterns
|
||||||
import at.petrak.hexcasting.common.casting.operators.spells.great.OpFlight
|
import at.petrak.hexcasting.common.casting.operators.spells.great.OpFlight
|
||||||
import at.petrak.hexcasting.common.command.HexCommands
|
import at.petrak.hexcasting.common.command.HexCommands
|
||||||
|
import at.petrak.hexcasting.common.command.PatternResLocArgument
|
||||||
import at.petrak.hexcasting.common.entities.HexEntities
|
import at.petrak.hexcasting.common.entities.HexEntities
|
||||||
import at.petrak.hexcasting.common.items.HexItems
|
import at.petrak.hexcasting.common.items.HexItems
|
||||||
import at.petrak.hexcasting.common.lib.HexCapabilityHandler
|
import at.petrak.hexcasting.common.lib.HexCapabilityHandler
|
||||||
|
@ -18,11 +19,14 @@ import at.petrak.hexcasting.common.lib.HexSounds
|
||||||
import at.petrak.hexcasting.common.misc.Brainsweeping
|
import at.petrak.hexcasting.common.misc.Brainsweeping
|
||||||
import at.petrak.hexcasting.common.network.HexMessages
|
import at.petrak.hexcasting.common.network.HexMessages
|
||||||
import at.petrak.hexcasting.common.particles.HexParticles
|
import at.petrak.hexcasting.common.particles.HexParticles
|
||||||
|
import at.petrak.hexcasting.common.recipe.HexComposting
|
||||||
import at.petrak.hexcasting.common.recipe.HexCustomRecipes
|
import at.petrak.hexcasting.common.recipe.HexCustomRecipes
|
||||||
import at.petrak.hexcasting.common.recipe.HexRecipeSerializers
|
import at.petrak.hexcasting.common.recipe.HexRecipeSerializers
|
||||||
import at.petrak.hexcasting.datagen.HexDataGenerators
|
import at.petrak.hexcasting.datagen.HexDataGenerators
|
||||||
import at.petrak.hexcasting.datagen.lootmods.HexLootModifiers
|
import at.petrak.hexcasting.datagen.lootmods.HexLootModifiers
|
||||||
import at.petrak.hexcasting.server.TickScheduler
|
import at.petrak.hexcasting.server.TickScheduler
|
||||||
|
import net.minecraft.commands.synchronization.ArgumentTypes
|
||||||
|
import net.minecraft.commands.synchronization.EmptyArgumentSerializer
|
||||||
import net.minecraftforge.api.distmarker.Dist
|
import net.minecraftforge.api.distmarker.Dist
|
||||||
import net.minecraftforge.common.ForgeConfigSpec
|
import net.minecraftforge.common.ForgeConfigSpec
|
||||||
import net.minecraftforge.eventbus.api.SubscribeEvent
|
import net.minecraftforge.eventbus.api.SubscribeEvent
|
||||||
|
@ -55,6 +59,8 @@ object HexMod {
|
||||||
CLIENT_CONFIG_SPEC = ForgeConfigSpec.Builder()
|
CLIENT_CONFIG_SPEC = ForgeConfigSpec.Builder()
|
||||||
.configure { builder: ForgeConfigSpec.Builder? -> HexConfig.Client(builder) }.right
|
.configure { builder: ForgeConfigSpec.Builder? -> HexConfig.Client(builder) }.right
|
||||||
|
|
||||||
|
ArgumentTypes.register("hexcasting:pattern", PatternResLocArgument::class.java, EmptyArgumentSerializer(PatternResLocArgument::id))
|
||||||
|
|
||||||
// mod lifecycle
|
// mod lifecycle
|
||||||
val modBus = thedarkcolour.kotlinforforge.forge.MOD_BUS
|
val modBus = thedarkcolour.kotlinforforge.forge.MOD_BUS
|
||||||
// game events
|
// game events
|
||||||
|
@ -77,6 +83,8 @@ object HexMod {
|
||||||
modBus.register(HexStatistics::class.java)
|
modBus.register(HexStatistics::class.java)
|
||||||
modBus.register(HexRecipeSerializers::class.java)
|
modBus.register(HexRecipeSerializers::class.java)
|
||||||
|
|
||||||
|
modBus.register(HexComposting::class.java)
|
||||||
|
|
||||||
evBus.register(HexCommands::class.java)
|
evBus.register(HexCommands::class.java)
|
||||||
evBus.register(TickScheduler)
|
evBus.register(TickScheduler)
|
||||||
evBus.register(HexCapabilityHandler::class.java)
|
evBus.register(HexCapabilityHandler::class.java)
|
||||||
|
|
|
@ -51,6 +51,7 @@ object OpBlink : SpellOperator {
|
||||||
val dvec = targetDelta(ctx, target, delta)
|
val dvec = targetDelta(ctx, target, delta)
|
||||||
target.setPos(target.position().add(dvec))
|
target.setPos(target.position().add(dvec))
|
||||||
if (target is ServerPlayer) {
|
if (target is ServerPlayer) {
|
||||||
|
target.connection.resetPosition()
|
||||||
HexMessages.getNetwork().send(PacketDistributor.PLAYER.with { target }, MsgBlinkAck(dvec))
|
HexMessages.getNetwork().send(PacketDistributor.PLAYER.with { target }, MsgBlinkAck(dvec))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
package at.petrak.hexcasting.common.recipe;
|
||||||
|
|
||||||
|
import at.petrak.hexcasting.common.blocks.HexBlocks;
|
||||||
|
import net.minecraft.world.item.Item;
|
||||||
|
import net.minecraft.world.item.Items;
|
||||||
|
import net.minecraft.world.level.block.Block;
|
||||||
|
import net.minecraft.world.level.block.ComposterBlock;
|
||||||
|
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||||
|
import net.minecraftforge.registries.RegistryObject;
|
||||||
|
|
||||||
|
public final class HexComposting {
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void setup(FMLCommonSetupEvent evt) {
|
||||||
|
compost(HexBlocks.AKASHIC_LEAVES1, 0.3F);
|
||||||
|
compost(HexBlocks.AKASHIC_LEAVES2, 0.3F);
|
||||||
|
compost(HexBlocks.AKASHIC_LEAVES3, 0.3F);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static <T extends Block> void compost(RegistryObject<T> blockHolder, float chance) {
|
||||||
|
T block = blockHolder.get();
|
||||||
|
Item item = block.asItem();
|
||||||
|
|
||||||
|
if (item != Items.AIR)
|
||||||
|
ComposterBlock.COMPOSTABLES.put(item, chance);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue