commit
05f43fe6d6
19 changed files with 3 additions and 491 deletions
|
@ -3,15 +3,10 @@ package org.dimdev.dimdoors;
|
||||||
import dev.onyxstudios.cca.api.v3.chunk.ChunkComponentFactoryRegistry;
|
import dev.onyxstudios.cca.api.v3.chunk.ChunkComponentFactoryRegistry;
|
||||||
import dev.onyxstudios.cca.api.v3.chunk.ChunkComponentInitializer;
|
import dev.onyxstudios.cca.api.v3.chunk.ChunkComponentInitializer;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
import dev.onyxstudios.cca.api.v3.component.ComponentFactory;
|
|
||||||
import dev.onyxstudios.cca.api.v3.component.ComponentKey;
|
import dev.onyxstudios.cca.api.v3.component.ComponentKey;
|
||||||
import dev.onyxstudios.cca.api.v3.component.ComponentRegistryV3;
|
import dev.onyxstudios.cca.api.v3.component.ComponentRegistryV3;
|
||||||
import dev.onyxstudios.cca.api.v3.entity.EntityComponentFactoryRegistry;
|
|
||||||
import dev.onyxstudios.cca.api.v3.entity.EntityComponentInitializer;
|
|
||||||
import dev.onyxstudios.cca.api.v3.entity.RespawnCopyStrategy;
|
|
||||||
import dev.onyxstudios.cca.api.v3.item.ItemComponentFactoryRegistry;
|
import dev.onyxstudios.cca.api.v3.item.ItemComponentFactoryRegistry;
|
||||||
import dev.onyxstudios.cca.api.v3.item.ItemComponentInitializer;
|
import dev.onyxstudios.cca.api.v3.item.ItemComponentInitializer;
|
||||||
import dev.onyxstudios.cca.api.v3.level.LevelComponentFactoryRegistry;
|
import dev.onyxstudios.cca.api.v3.level.LevelComponentFactoryRegistry;
|
||||||
|
@ -19,12 +14,10 @@ import dev.onyxstudios.cca.api.v3.level.LevelComponentInitializer;
|
||||||
import org.dimdev.dimdoors.item.ModItems;
|
import org.dimdev.dimdoors.item.ModItems;
|
||||||
import org.dimdev.dimdoors.world.level.component.ChunkLazilyGeneratedComponent;
|
import org.dimdev.dimdoors.world.level.component.ChunkLazilyGeneratedComponent;
|
||||||
import org.dimdev.dimdoors.item.component.CounterComponent;
|
import org.dimdev.dimdoors.item.component.CounterComponent;
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
import org.dimdev.dimdoors.world.level.registry.DimensionalRegistry;
|
import org.dimdev.dimdoors.world.level.registry.DimensionalRegistry;
|
||||||
|
|
||||||
@SuppressWarnings("UnstableApiUsage")
|
@SuppressWarnings("UnstableApiUsage")
|
||||||
public class DimensionalDoorsComponents implements LevelComponentInitializer, ItemComponentInitializer, ChunkComponentInitializer, EntityComponentInitializer {
|
public class DimensionalDoorsComponents implements LevelComponentInitializer, ItemComponentInitializer, ChunkComponentInitializer {
|
||||||
public static final ComponentKey<PlayerModifiersComponent> PLAYER_MODIFIERS_COMPONENT_KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("dimdoors:player_modifiers"), PlayerModifiersComponent.class);
|
|
||||||
public static final ComponentKey<DimensionalRegistry> DIMENSIONAL_REGISTRY_COMPONENT_KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("dimdoors:dimensional_registry"), DimensionalRegistry.class);
|
public static final ComponentKey<DimensionalRegistry> DIMENSIONAL_REGISTRY_COMPONENT_KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("dimdoors:dimensional_registry"), DimensionalRegistry.class);
|
||||||
public static final ComponentKey<CounterComponent> COUNTER_COMPONENT_KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("dimdoors:counter"), CounterComponent.class);
|
public static final ComponentKey<CounterComponent> COUNTER_COMPONENT_KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("dimdoors:counter"), CounterComponent.class);
|
||||||
public static final ComponentKey<ChunkLazilyGeneratedComponent> CHUNK_LAZILY_GENERATED_COMPONENT_KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("dimdoors:chunk_lazily_generated"), ChunkLazilyGeneratedComponent.class);
|
public static final ComponentKey<ChunkLazilyGeneratedComponent> CHUNK_LAZILY_GENERATED_COMPONENT_KEY = ComponentRegistryV3.INSTANCE.getOrCreate(new Identifier("dimdoors:chunk_lazily_generated"), ChunkLazilyGeneratedComponent.class);
|
||||||
|
@ -44,8 +37,4 @@ public class DimensionalDoorsComponents implements LevelComponentInitializer, It
|
||||||
registry.register(CHUNK_LAZILY_GENERATED_COMPONENT_KEY, chunk -> new ChunkLazilyGeneratedComponent());
|
registry.register(CHUNK_LAZILY_GENERATED_COMPONENT_KEY, chunk -> new ChunkLazilyGeneratedComponent());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void registerEntityComponentFactories(EntityComponentFactoryRegistry registry) {
|
|
||||||
registry.registerForPlayers(PLAYER_MODIFIERS_COMPONENT_KEY, PlayerModifiersComponent::new, RespawnCopyStrategy.ALWAYS_COPY);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.dimdev.dimdoors.block.door.data.condition.Condition;
|
||||||
import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes;
|
import org.dimdev.dimdoors.block.entity.ModBlockEntityTypes;
|
||||||
import org.dimdev.dimdoors.command.ModCommands;
|
import org.dimdev.dimdoors.command.ModCommands;
|
||||||
import org.dimdev.dimdoors.command.PocketCommand;
|
import org.dimdev.dimdoors.command.PocketCommand;
|
||||||
import org.dimdev.dimdoors.enchantment.FrayedEnchantment;
|
|
||||||
import org.dimdev.dimdoors.enchantment.ModEnchants;
|
import org.dimdev.dimdoors.enchantment.ModEnchants;
|
||||||
import org.dimdev.dimdoors.entity.ModEntityTypes;
|
import org.dimdev.dimdoors.entity.ModEntityTypes;
|
||||||
import org.dimdev.dimdoors.criteria.ModCriteria;
|
import org.dimdev.dimdoors.criteria.ModCriteria;
|
||||||
|
|
|
@ -40,9 +40,6 @@ public final class ModConfig implements ConfigData {
|
||||||
@Category("world")
|
@Category("world")
|
||||||
private World world = new World();
|
private World world = new World();
|
||||||
@TransitiveObject
|
@TransitiveObject
|
||||||
@Category("player")
|
|
||||||
private Player player = new Player();
|
|
||||||
@TransitiveObject
|
|
||||||
@Category("dungeons")
|
@Category("dungeons")
|
||||||
private Dungeons dungeons = new Dungeons();
|
private Dungeons dungeons = new Dungeons();
|
||||||
@TransitiveObject
|
@TransitiveObject
|
||||||
|
@ -70,10 +67,6 @@ public final class ModConfig implements ConfigData {
|
||||||
return this.world;
|
return this.world;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Player getPlayerConfig() {
|
|
||||||
return this.player;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Dungeons getDungeonsConfig() {
|
public Dungeons getDungeonsConfig() {
|
||||||
return this.dungeons;
|
return this.dungeons;
|
||||||
}
|
}
|
||||||
|
@ -163,24 +156,6 @@ public final class ModConfig implements ConfigData {
|
||||||
@Tooltip public List<String> gatewayDimBlacklist = new LinkedList<>();
|
@Tooltip public List<String> gatewayDimBlacklist = new LinkedList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Player {
|
|
||||||
@CollapsibleObject @Tooltip public Fray fray = new Fray();
|
|
||||||
|
|
||||||
public static class Fray {
|
|
||||||
@Tooltip public int maxFray = 200;
|
|
||||||
@Tooltip public int riftFrayIncrement = 5;
|
|
||||||
@Tooltip public int monolithTeleportationIncrement = 5;
|
|
||||||
@Tooltip public int eternalFluidFrayDecrease = 100;
|
|
||||||
@Tooltip public int nameplateGlitchFray = 80;
|
|
||||||
@Tooltip public int staticOverlayFray = 100;
|
|
||||||
@Tooltip public int armorDamageFray = 125;
|
|
||||||
@Tooltip public int grayScreenFray = 175;
|
|
||||||
@Tooltip public int unravelledStatueFray = 200;
|
|
||||||
@Tooltip public int minFrayForTickFray = 125;
|
|
||||||
@Tooltip public int unravledFabricInInventoryFray = 150;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class Dungeons {
|
public static class Dungeons {
|
||||||
@Tooltip public int maxDungeonDepth = 50;
|
@Tooltip public int maxDungeonDepth = 50;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import org.dimdev.dimdoors.api.util.math.MathUtil;
|
import org.dimdev.dimdoors.api.util.math.MathUtil;
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
|
|
||||||
public class EternalFluidBlock extends FluidBlock {
|
public class EternalFluidBlock extends FluidBlock {
|
||||||
private static final EntityTarget TARGET = new EscapeTarget(true);
|
private static final EntityTarget TARGET = new EscapeTarget(true);
|
||||||
|
@ -35,7 +34,6 @@ public class EternalFluidBlock extends FluidBlock {
|
||||||
if (TARGET.receiveEntity(entity, Vec3d.ZERO, MathUtil.entityEulerAngle(entity), entity.getVelocity())) {
|
if (TARGET.receiveEntity(entity, Vec3d.ZERO, MathUtil.entityEulerAngle(entity), entity.getVelocity())) {
|
||||||
if (entity instanceof PlayerEntity) {
|
if (entity instanceof PlayerEntity) {
|
||||||
LimboExitReason.ETERNAL_FLUID.broadcast((PlayerEntity) entity);
|
LimboExitReason.ETERNAL_FLUID.broadcast((PlayerEntity) entity);
|
||||||
PlayerModifiersComponent.incrementFray((PlayerEntity) entity, -DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.eternalFluidFrayDecrease);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
package org.dimdev.dimdoors.command;
|
|
||||||
|
|
||||||
import com.mojang.brigadier.Command;
|
|
||||||
import com.mojang.brigadier.CommandDispatcher;
|
|
||||||
import com.mojang.brigadier.arguments.FloatArgumentType;
|
|
||||||
import com.mojang.brigadier.arguments.IntegerArgumentType;
|
|
||||||
import net.minecraft.command.argument.ColorArgumentType;
|
|
||||||
import net.minecraft.command.argument.DimensionArgumentType;
|
|
||||||
import net.minecraft.command.argument.Vec3ArgumentType;
|
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.network.MessageType;
|
|
||||||
import net.minecraft.server.command.CommandManager;
|
|
||||||
import net.minecraft.server.command.ServerCommandSource;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
|
||||||
import net.minecraft.server.world.ServerWorld;
|
|
||||||
import net.minecraft.text.LiteralText;
|
|
||||||
import net.minecraft.text.Text;
|
|
||||||
import net.minecraft.util.Formatting;
|
|
||||||
import net.minecraft.util.math.EulerAngle;
|
|
||||||
import net.minecraft.util.math.Vec3d;
|
|
||||||
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
|
||||||
import org.dimdev.dimdoors.api.util.math.MathUtil;
|
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
|
|
||||||
public class FrayCommand {
|
|
||||||
public static void register(CommandDispatcher<ServerCommandSource> dispatcher) {
|
|
||||||
dispatcher.register(CommandManager.literal("fray")
|
|
||||||
.then(CommandManager
|
|
||||||
.argument("amount", IntegerArgumentType.integer())
|
|
||||||
.executes(ctx -> {
|
|
||||||
ServerPlayerEntity player = ctx.getSource().getPlayer();
|
|
||||||
return addFray(ctx.getSource(), Formatting.ITALIC, player, IntegerArgumentType.getInteger(ctx, "amount"));
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
private static int addFray(ServerCommandSource source, Formatting formatting, PlayerEntity player, int amount) {
|
|
||||||
PlayerModifiersComponent.incrementFray(player, amount);
|
|
||||||
final Text text = new LiteralText("added : " + amount + " player now has : " + PlayerModifiersComponent.getFray(player)).formatted(formatting);
|
|
||||||
source.getMinecraftServer().getPlayerManager().broadcastChatMessage(text, MessageType.CHAT, player.getUuid());
|
|
||||||
return Command.SINGLE_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -7,7 +7,6 @@ public final class ModCommands {
|
||||||
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
CommandRegistrationCallback.EVENT.register((dispatcher, dedicated) -> {
|
||||||
DimTeleportCommand.register(dispatcher);
|
DimTeleportCommand.register(dispatcher);
|
||||||
PocketCommand.register(dispatcher);
|
PocketCommand.register(dispatcher);
|
||||||
FrayCommand.register(dispatcher);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package org.dimdev.dimdoors.enchantment;
|
|
||||||
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.enchantment.EnchantmentTarget;
|
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
|
||||||
|
|
||||||
public class FrayedEnchantment extends Enchantment {
|
|
||||||
public FrayedEnchantment(Rarity weight, EnchantmentTarget type, EquipmentSlot[] slotTypes) {
|
|
||||||
super(weight, type, slotTypes);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int getMinPower(int level) {
|
|
||||||
return 10000;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public int getMaxLevel() {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public boolean isCursed(){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -7,14 +7,8 @@ import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
public class ModEnchants {
|
public class ModEnchants {
|
||||||
public static Enchantment FRAYED_ENCHANTMENT;
|
|
||||||
public static Enchantment STRING_THEORY_ENCHANTMENT;
|
public static Enchantment STRING_THEORY_ENCHANTMENT;
|
||||||
public static void init() {
|
public static void init() {
|
||||||
FRAYED_ENCHANTMENT = Registry.register(
|
|
||||||
Registry.ENCHANTMENT,
|
|
||||||
new Identifier("dimdoors", "frayed"),
|
|
||||||
new FrayedEnchantment(Enchantment.Rarity.VERY_RARE, EnchantmentTarget.BREAKABLE, new EquipmentSlot[] {EquipmentSlot.MAINHAND, EquipmentSlot.CHEST, EquipmentSlot.FEET, EquipmentSlot.HEAD, EquipmentSlot.LEGS})
|
|
||||||
);
|
|
||||||
STRING_THEORY_ENCHANTMENT = Registry.register(
|
STRING_THEORY_ENCHANTMENT = Registry.register(
|
||||||
Registry.ENCHANTMENT,
|
Registry.ENCHANTMENT,
|
||||||
new Identifier("dimdoors", "string_theory"),
|
new Identifier("dimdoors", "string_theory"),
|
||||||
|
|
|
@ -3,8 +3,6 @@ package org.dimdev.dimdoors.entity.ai;
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
import io.netty.buffer.Unpooled;
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsComponents;
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.entity.MonolithEntity;
|
import org.dimdev.dimdoors.entity.MonolithEntity;
|
||||||
import org.dimdev.dimdoors.entity.stat.ModStats;
|
import org.dimdev.dimdoors.entity.stat.ModStats;
|
||||||
|
@ -13,23 +11,15 @@ import org.dimdev.dimdoors.network.ServerPacketHandler;
|
||||||
import org.dimdev.dimdoors.network.packet.s2c.MonolithAggroParticlesPacket;
|
import org.dimdev.dimdoors.network.packet.s2c.MonolithAggroParticlesPacket;
|
||||||
import org.dimdev.dimdoors.network.packet.s2c.MonolithTeleportParticlesPacket;
|
import org.dimdev.dimdoors.network.packet.s2c.MonolithTeleportParticlesPacket;
|
||||||
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
|
|
||||||
import net.minecraft.entity.ai.TargetPredicate;
|
import net.minecraft.entity.ai.TargetPredicate;
|
||||||
import net.minecraft.entity.ai.goal.Goal;
|
import net.minecraft.entity.ai.goal.Goal;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.network.PacketByteBuf;
|
|
||||||
import net.minecraft.predicate.entity.EntityPredicates;
|
import net.minecraft.predicate.entity.EntityPredicates;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
|
||||||
import net.minecraft.sound.SoundCategory;
|
import net.minecraft.sound.SoundCategory;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
|
|
||||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
|
|
||||||
|
|
||||||
import static net.minecraft.predicate.entity.EntityPredicates.EXCEPT_SPECTATOR;
|
|
||||||
import static org.dimdev.dimdoors.entity.MonolithEntity.MAX_AGGRO;
|
import static org.dimdev.dimdoors.entity.MonolithEntity.MAX_AGGRO;
|
||||||
|
|
||||||
public class MonolithAggroGoal extends Goal {
|
public class MonolithAggroGoal extends Goal {
|
||||||
|
@ -108,7 +98,6 @@ public class MonolithAggroGoal extends Goal {
|
||||||
this.target.teleport(this.target.getX(), this.target.getY() + 256, this.target.getZ());
|
this.target.teleport(this.target.getX(), this.target.getY() + 256, this.target.getZ());
|
||||||
this.target.world.playSound(null, new BlockPos(this.target.getPos()), ModSoundEvents.CRACK, SoundCategory.HOSTILE, 13, 1);
|
this.target.world.playSound(null, new BlockPos(this.target.getPos()), ModSoundEvents.CRACK, SoundCategory.HOSTILE, 13, 1);
|
||||||
this.target.incrementStat(ModStats.TIMES_TELEPORTED_BY_MONOLITH);
|
this.target.incrementStat(ModStats.TIMES_TELEPORTED_BY_MONOLITH);
|
||||||
PlayerModifiersComponent.incrementFray(this.target, -DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.monolithTeleportationIncrement);
|
|
||||||
ServerPacketHandler.get((ServerPlayerEntity) this.target).sendPacket(new MonolithTeleportParticlesPacket());
|
ServerPacketHandler.get((ServerPlayerEntity) this.target).sendPacket(new MonolithTeleportParticlesPacket());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package org.dimdev.dimdoors.mixin;
|
package org.dimdev.dimdoors.mixin;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.item.ModItems;
|
|
||||||
import org.dimdev.dimdoors.mixin.accessor.EntityAccessor;
|
import org.dimdev.dimdoors.mixin.accessor.EntityAccessor;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.Unique;
|
import org.spongepowered.asm.mixin.Unique;
|
||||||
|
@ -21,8 +18,6 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
@Mixin(value = PlayerEntity.class, priority = 900)
|
@Mixin(value = PlayerEntity.class, priority = 900)
|
||||||
public abstract class PlayerEntityMixin extends LivingEntity {
|
public abstract class PlayerEntityMixin extends LivingEntity {
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
package org.dimdev.dimdoors.mixin;
|
package org.dimdev.dimdoors.mixin;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.block.Blocks;
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.server.network.ServerRecipeBook;
|
import net.minecraft.server.network.ServerRecipeBook;
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
|
||||||
import org.dimdev.dimdoors.block.UnravelledFabricBlock;
|
import org.dimdev.dimdoors.block.UnravelledFabricBlock;
|
||||||
import org.dimdev.dimdoors.criteria.ModCriteria;
|
import org.dimdev.dimdoors.criteria.ModCriteria;
|
||||||
import org.dimdev.dimdoors.enchantment.ModEnchants;
|
|
||||||
import org.dimdev.dimdoors.entity.limbo.LimboEntranceSource;
|
import org.dimdev.dimdoors.entity.limbo.LimboEntranceSource;
|
||||||
import org.dimdev.dimdoors.entity.stat.ModStats;
|
import org.dimdev.dimdoors.entity.stat.ModStats;
|
||||||
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
||||||
|
@ -17,7 +14,6 @@ import org.dimdev.dimdoors.item.ModItems;
|
||||||
import org.dimdev.dimdoors.network.ExtendedServerPlayNetworkHandler;
|
import org.dimdev.dimdoors.network.ExtendedServerPlayNetworkHandler;
|
||||||
import org.dimdev.dimdoors.network.packet.s2c.PlayerInventorySlotUpdateS2CPacket;
|
import org.dimdev.dimdoors.network.packet.s2c.PlayerInventorySlotUpdateS2CPacket;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
@ -46,11 +42,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
||||||
public abstract void readCustomDataFromNbt(NbtCompound nbt);
|
public abstract void readCustomDataFromNbt(NbtCompound nbt);
|
||||||
|
|
||||||
private static final float RANDOM_ACTION_CHANCE = 0.1F;
|
private static final float RANDOM_ACTION_CHANCE = 0.1F;
|
||||||
private static final float CHANCE_TO_DECREASE_ARMOR_DURABILITY = 0.03F;
|
|
||||||
private static final float CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC = 0.005F;
|
|
||||||
private static final float CHANCE_TO_ENCHANT_WITH_FRAY = 0.01F;
|
|
||||||
private static final float CHANCE_TO_MAKE_LIMBO_LIKE_OTHER_DIMENSIONS = 0.1F;
|
private static final float CHANCE_TO_MAKE_LIMBO_LIKE_OTHER_DIMENSIONS = 0.1F;
|
||||||
private static final float RANDOM_INCREMENT_FRAY_CHANCE = 0.1F;
|
|
||||||
private static final int CHUNK_SIZES = 25;
|
private static final int CHUNK_SIZES = 25;
|
||||||
private static final int POSITION_AWAY = 50;
|
private static final int POSITION_AWAY = 50;
|
||||||
private static final float RANDOM_LIQUID_CHANCE = 0.7F;
|
private static final float RANDOM_LIQUID_CHANCE = 0.7F;
|
||||||
|
@ -63,14 +55,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
||||||
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "tick", at = @At("HEAD"), cancellable = true)
|
||||||
public void playerTickMixin(CallbackInfo ci) {
|
public void playerTickMixin(CallbackInfo ci) {
|
||||||
if (random.nextFloat() <= RANDOM_ACTION_CHANCE) {
|
if (random.nextFloat() <= RANDOM_ACTION_CHANCE) {
|
||||||
if(random.nextFloat() <= RANDOM_INCREMENT_FRAY_CHANCE && PlayerModifiersComponent.getFray((PlayerEntity) (Object)this) < 180 && ModDimensions.isLimboDimension((((PlayerEntity)(Object)(this)).getEntityWorld()))) {
|
|
||||||
PlayerModifiersComponent.incrementFray((PlayerEntity) (Object)this, 1);
|
|
||||||
}
|
|
||||||
if (PlayerModifiersComponent.getFray(this) >= 125) {
|
|
||||||
doRandomFunction(this);
|
|
||||||
}
|
|
||||||
if(ModDimensions.isLimboDimension(((PlayerEntity)(Object)(this)).getEntityWorld())) {
|
if(ModDimensions.isLimboDimension(((PlayerEntity)(Object)(this)).getEntityWorld())) {
|
||||||
tryAddingFrayEnchantment((PlayerEntity) (Object)this);
|
|
||||||
tryMakingLimboLikeOtherDimensions((PlayerEntity)(Object)this);
|
tryMakingLimboLikeOtherDimensions((PlayerEntity)(Object)this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -148,62 +133,6 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doRandomFunction(LivingEntity player) {
|
|
||||||
switch (random.nextInt(2)) {
|
|
||||||
case 0:
|
|
||||||
decreaseArmorDurability((PlayerEntity) player);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
addRandomUnravledFabric((PlayerEntity) player);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void tryAddingFrayEnchantment(PlayerEntity player) {
|
|
||||||
if (!(random.nextFloat() <= CHANCE_TO_ENCHANT_WITH_FRAY)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
int slot = random.nextInt(player.getInventory().size());
|
|
||||||
if (!player.getInventory().getStack(slot).isEnchantable()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
ItemStack stack = player.getInventory().getStack(slot);
|
|
||||||
stack.addEnchantment(ModEnchants.FRAYED_ENCHANTMENT, 1);
|
|
||||||
player.getInventory().setStack(slot, stack);
|
|
||||||
((ExtendedServerPlayNetworkHandler) (Object) ((ServerPlayerEntity) (Object) this).networkHandler).getDimDoorsPacketHandler().sendPacket(new PlayerInventorySlotUpdateS2CPacket(slot, stack));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Fix this shit so it syncs.
|
|
||||||
private void addRandomUnravledFabric(PlayerEntity player) {
|
|
||||||
if (PlayerModifiersComponent.getFray(player) < DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.unravledFabricInInventoryFray)
|
|
||||||
return;
|
|
||||||
if (!(random.nextFloat() <= CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC))
|
|
||||||
return;
|
|
||||||
|
|
||||||
int slot = random.nextInt(player.getInventory().main.size());
|
|
||||||
|
|
||||||
if (!player.getInventory().main.get(slot).isEmpty() && !(player.getInventory().main.get(slot).getItem() == ModItems.UNRAVELLED_FABRIC))
|
|
||||||
return;
|
|
||||||
if (player.getInventory().main.get(slot).getCount() >= 64)
|
|
||||||
return;
|
|
||||||
ItemStack stack = new ItemStack(ModItems.UNRAVELLED_FABRIC, 1 + player.getInventory().main.get(slot).getCount());
|
|
||||||
player.getInventory().main.set(slot, stack);
|
|
||||||
((ExtendedServerPlayNetworkHandler) (Object) ((ServerPlayerEntity) (Object) this).networkHandler).getDimDoorsPacketHandler().sendPacket(new PlayerInventorySlotUpdateS2CPacket(slot, stack));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void decreaseArmorDurability(PlayerEntity player) {
|
|
||||||
if (PlayerModifiersComponent.getFray(player) < DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.unravledFabricInInventoryFray)
|
|
||||||
return;
|
|
||||||
for (int i = 0; i < player.getInventory().armor.size(); i++)
|
|
||||||
if (random.nextFloat() <= CHANCE_TO_DECREASE_ARMOR_DURABILITY)
|
|
||||||
player.getArmorItems().forEach((itemStack) -> {
|
|
||||||
itemStack.setDamage(itemStack.getDamage() + 1);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Inject(method = "onDeath", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "onDeath", at = @At("HEAD"), cancellable = true)
|
||||||
public void checkDeathServer(DamageSource source, CallbackInfo ci) {
|
public void checkDeathServer(DamageSource source, CallbackInfo ci) {
|
||||||
this.doOnDeathStuff(source, ci);
|
this.doOnDeathStuff(source, ci);
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
package org.dimdev.dimdoors.mixin.client;
|
package org.dimdev.dimdoors.mixin.client;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.render.*;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.util.Identifier;
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.client.ModShaders;
|
|
||||||
import org.dimdev.dimdoors.world.ModBiomes;
|
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
@ -19,7 +11,6 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import net.minecraft.client.gui.hud.InGameHud;
|
import net.minecraft.client.gui.hud.InGameHud;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
|
@ -29,7 +20,6 @@ import net.fabricmc.api.Environment;
|
||||||
public abstract class InGameHudMixin{
|
public abstract class InGameHudMixin{
|
||||||
private int frame = 0;
|
private int frame = 0;
|
||||||
private static final float OVERLAY_OPACITY_ADJUSTEMENT = 1.5F;
|
private static final float OVERLAY_OPACITY_ADJUSTEMENT = 1.5F;
|
||||||
private ModConfig.Player config = DimensionalDoorsInitializer.getConfig().getPlayerConfig();
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private int scaledHeight;
|
private int scaledHeight;
|
||||||
@Shadow
|
@Shadow
|
||||||
|
|
|
@ -3,14 +3,12 @@ package org.dimdev.dimdoors.mixin.client;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.gl.JsonEffectGlShader;
|
import net.minecraft.client.gl.JsonEffectGlShader;
|
||||||
import net.minecraft.client.gl.PostProcessShader;
|
import net.minecraft.client.gl.PostProcessShader;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.ModConfig;
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
|
||||||
import org.spongepowered.asm.mixin.Final;
|
import org.spongepowered.asm.mixin.Final;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
@ -20,20 +18,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
@Mixin(PostProcessShader.class)
|
@Mixin(PostProcessShader.class)
|
||||||
public class PostProcessShaderMixin {
|
public class PostProcessShaderMixin {
|
||||||
private ModConfig.Player config = DimensionalDoorsInitializer.getConfig().getPlayerConfig();
|
|
||||||
|
|
||||||
@Shadow @Final private JsonEffectGlShader program;
|
@Shadow @Final private JsonEffectGlShader program;
|
||||||
|
|
||||||
@Inject(method = "render(F)V", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "render(F)V", at = @At("HEAD"), cancellable = true)
|
||||||
public void render(float time, CallbackInfo cir) {
|
public void render(float time, CallbackInfo cir) {
|
||||||
program.getUniformByNameOrDummy("GameTime").set(RenderSystem.getShaderGameTime());
|
program.getUniformByNameOrDummy("GameTime").set(RenderSystem.getShaderGameTime());
|
||||||
|
|
||||||
if (PlayerModifiersComponent.getFray(getCameraPlayer()) > config.fray.grayScreenFray) {
|
|
||||||
float overlayOpacity = (config.fray.grayScreenFray - PlayerModifiersComponent.getFray(getCameraPlayer())) / (config.fray.grayScreenFray - (float) config.fray.maxFray);
|
|
||||||
program.getUniformByNameOrDummy("FrayIntensity").set(overlayOpacity);
|
|
||||||
} else {
|
|
||||||
program.getUniformByNameOrDummy("FrayIntensity").set(0.0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayerEntity getCameraPlayer() {
|
private PlayerEntity getCameraPlayer() {
|
||||||
|
|
|
@ -1,104 +0,0 @@
|
||||||
package org.dimdev.dimdoors.world.level.component;
|
|
||||||
|
|
||||||
import dev.onyxstudios.cca.api.v3.component.ComponentV3;
|
|
||||||
import dev.onyxstudios.cca.api.v3.component.sync.AutoSyncedComponent;
|
|
||||||
import net.minecraft.enchantment.EnchantmentHelper;
|
|
||||||
import net.minecraft.enchantment.Enchantments;
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
|
||||||
import org.apache.logging.log4j.Level;
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsComponents;
|
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
|
||||||
import net.minecraft.nbt.NbtCompound;
|
|
||||||
import net.minecraft.network.PacketByteBuf;
|
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
|
||||||
import net.minecraft.util.math.MathHelper;
|
|
||||||
import org.dimdev.dimdoors.block.ModBlocks;
|
|
||||||
import org.dimdev.dimdoors.enchantment.ModEnchants;
|
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
import static org.dimdev.dimdoors.util.schematic.SchematicPlacer.LOGGER;
|
|
||||||
|
|
||||||
public class PlayerModifiersComponent implements ComponentV3, AutoSyncedComponent {
|
|
||||||
private int fray = 0;
|
|
||||||
|
|
||||||
public PlayerModifiersComponent(@SuppressWarnings("unused") PlayerEntity player) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void readFromNbt(NbtCompound nbt) {
|
|
||||||
fray = nbt.getInt("Fray");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeToNbt(NbtCompound nbt) {
|
|
||||||
nbt.putInt("Fray", fray);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void writeSyncPacket(PacketByteBuf buf, ServerPlayerEntity recipient) {
|
|
||||||
buf.writeVarInt(fray);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applySyncPacket(PacketByteBuf buf) {
|
|
||||||
fray = buf.readVarInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFray() {
|
|
||||||
return fray;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void resetFray() {fray = 0;}
|
|
||||||
|
|
||||||
public int incrementFray(int amount) {
|
|
||||||
return (fray = MathHelper.clamp(fray + amount, 0, DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.maxFray));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static PlayerModifiersComponent get(PlayerEntity player) {
|
|
||||||
return DimensionalDoorsComponents.PLAYER_MODIFIERS_COMPONENT_KEY.get(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void resetFray(PlayerEntity player) {
|
|
||||||
get(player).resetFray();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static int getFray(LivingEntity player) {
|
|
||||||
return get((PlayerEntity) player).getFray();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void sync(PlayerEntity player) {
|
|
||||||
DimensionalDoorsComponents.PLAYER_MODIFIERS_COMPONENT_KEY.sync(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int incrementFray(PlayerEntity player, int amount) {
|
|
||||||
for(int i = 0; i < player.getInventory().armor.size(); i++) {
|
|
||||||
if(EnchantmentHelper.getLevel(ModEnchants.STRING_THEORY_ENCHANTMENT, player.getInventory().armor.get(i)) > 0) {
|
|
||||||
amount *= 0.85;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int v = get(player).incrementFray(amount);
|
|
||||||
PlayerModifiersComponent.sync(player);
|
|
||||||
if(getFray(player) == DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.maxFray) {
|
|
||||||
killPlayer(player);
|
|
||||||
}
|
|
||||||
if(false) {
|
|
||||||
LOGGER.log(Level.INFO, "fray amount is : " + getFray(player));
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void killPlayer(PlayerEntity player) {
|
|
||||||
player.kill();
|
|
||||||
//Fray should be reset by mixinging into the player class and changing the kill event or some other funciton that happens when a player dies.
|
|
||||||
//This is just temporary
|
|
||||||
//On second thought, this should get rid of fray, and fray should stay with the player otherwise, that way they have to actively try to get rid of it without just like, dying.
|
|
||||||
resetFray(player);
|
|
||||||
player.getEntityWorld().setBlockState(player.getBlockPos(), ModBlocks.STONE_PLAYER.getDefaultState(), 3);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -266,28 +266,6 @@
|
||||||
"text.autoconfig.dimdoors.option.limbo.decaySpreadChance": "Decay Spread Chance",
|
"text.autoconfig.dimdoors.option.limbo.decaySpreadChance": "Decay Spread Chance",
|
||||||
"text.autoconfig.dimdoors.option.limbo.decaySpreadChance.@Tooltip": "To be filled out.",
|
"text.autoconfig.dimdoors.option.limbo.decaySpreadChance.@Tooltip": "To be filled out.",
|
||||||
|
|
||||||
"text.autoconfig.dimdoors.category.player": "Player",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray": "Fray",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.@Tooltip": "To be filled out.",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.maxFray": "Max Fray",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.maxFray.@Tooltip": "Title",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.riftFrayIncrement": "Rift Fray Increment",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.riftFrayIncrement.@Tooltip": "Title",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.monolithTeleportationIncrement": "Monolith Teleportation Increment",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.monolithTeleportationIncrement.@Tooltip": "Title",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.eternalFluidFrayDecrease": "Eternal Fluid Fray Decrease",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.eternalFluidFrayDecrease.@Tooltip": "Title",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.nameplateGlitchFray": "Nameplate Glitch Fray",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.nameplateGlitchFray.@Tooltip": "Amount of fray needed for nameplate to glitch.",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.staticOverlayFray": "Static Overlay Fray",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.staticOverlayFray.@Tooltip": "Amount of fray needed for screen to start having static",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.armorDamageFray": "Armor Damage Fray",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.armorDamageFray.@Tooltip": "Amount of fray needed for your armor to start taking damage",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.grayScreenFray": "Gray Screen Fray",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.grayScreenFray.@Tooltip": "Title",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.unravelledStatueFray": "Unravelled Statue Fray",
|
|
||||||
"text.autoconfig.dimdoors.option.player.fray.unravelledStatueFray.@Tooltip": "Title",
|
|
||||||
|
|
||||||
"text.autoconfig.dimdoors.category.graphics": "Graphics Settings",
|
"text.autoconfig.dimdoors.category.graphics": "Graphics Settings",
|
||||||
"text.autoconfig.dimdoors.option.graphics.highlightRiftCoreFor": "Time to Highlight Rift Core",
|
"text.autoconfig.dimdoors.option.graphics.highlightRiftCoreFor": "Time to Highlight Rift Core",
|
||||||
"text.autoconfig.dimdoors.option.graphics.highlightRiftCoreFor.@Tooltip": "How long, in milliseconds, the rift's core (tesseract animation) should be shown for when attempting to place a door near a large rift but not directly on it. Set to -1 to disable.",
|
"text.autoconfig.dimdoors.option.graphics.highlightRiftCoreFor.@Tooltip": "How long, in milliseconds, the rift's core (tesseract animation) should be shown for when attempting to place a door near a large rift but not directly on it. Set to -1 to disable.",
|
||||||
|
@ -433,7 +411,5 @@
|
||||||
"resourcePackActivationType.alwaysEnabled": "Always Enabled",
|
"resourcePackActivationType.alwaysEnabled": "Always Enabled",
|
||||||
|
|
||||||
"dimdoors.mode.enable": "Enable",
|
"dimdoors.mode.enable": "Enable",
|
||||||
"dimdoors.mode.disable": "Disable",
|
"dimdoors.mode.disable": "Disable"
|
||||||
|
|
||||||
"enchantment.dimdoors.frayed" : "Frayed"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,11 +59,6 @@
|
||||||
"id": "weather:depth"
|
"id": "weather:depth"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "fray",
|
|
||||||
"intarget": "final",
|
|
||||||
"outtarget": "minecraft:main"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -1,105 +0,0 @@
|
||||||
#version 150
|
|
||||||
|
|
||||||
//make this a uniform when implementing in practice.
|
|
||||||
//ranges from 0 to 1.
|
|
||||||
//note: the shader should not be used when the effect strength is 0,
|
|
||||||
//because this will cause division-by-zero issues inside the shader.
|
|
||||||
uniform float FrayIntensity;
|
|
||||||
uniform sampler2D DiffuseSampler;
|
|
||||||
uniform vec2 OutSize;
|
|
||||||
|
|
||||||
in vec2 texcoord;
|
|
||||||
|
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
float square(float f) { return f * f; }
|
|
||||||
vec2 square(vec2 v) { return v * v; }
|
|
||||||
|
|
||||||
float smoothify(float f) { return f * f * (f * -2.0 + 3.0); }
|
|
||||||
vec2 smoothify(vec2 v) { return v * v * (v * -2.0 + 3.0); }
|
|
||||||
|
|
||||||
float unmix(float low, float high, float frac) { return (frac - low) / (high - low); }
|
|
||||||
vec2 unmix(vec2 low, vec2 high, vec2 frac) { return (frac - low) / (high - low); }
|
|
||||||
|
|
||||||
float hash11(float p) { //from https://www.shadertoy.com/view/4djSRW
|
|
||||||
p = fract(p * 10.31);
|
|
||||||
p *= p + 33.33;
|
|
||||||
p *= p + p;
|
|
||||||
return fract(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
float noise11(float coord, float wrap) {
|
|
||||||
float fracCoord = fract(coord);
|
|
||||||
vec2 corners;
|
|
||||||
corners.x = mod(coord - fracCoord, wrap);
|
|
||||||
corners.y = mod(corners.x + 1.0, wrap);
|
|
||||||
fracCoord = smoothify(fracCoord);
|
|
||||||
return mix(hash11(corners.x), hash11(corners.y), fracCoord);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 hash22(vec2 p) { //from https://www.shadertoy.com/view/4djSRW
|
|
||||||
vec3 p3 = fract(vec3(p.xyx) * vec3(10.31, 10.30, 9.73));
|
|
||||||
p3 += dot(p3, p3.yzx + 33.33);
|
|
||||||
return fract((p3.xx + p3.yz) * p3.zy);
|
|
||||||
}
|
|
||||||
|
|
||||||
vec2 noise22(vec2 coord) {
|
|
||||||
vec2 fracCoord = fract(coord);
|
|
||||||
vec4 corners;
|
|
||||||
corners.xy = coord - fracCoord;
|
|
||||||
corners.zw = corners.xy + vec2(1.0);
|
|
||||||
fracCoord = smoothify(fracCoord);
|
|
||||||
return mix(
|
|
||||||
mix(
|
|
||||||
hash22(corners.xy),
|
|
||||||
hash22(corners.xw),
|
|
||||||
fracCoord.y
|
|
||||||
),
|
|
||||||
mix(
|
|
||||||
hash22(corners.zy),
|
|
||||||
hash22(corners.zw),
|
|
||||||
fracCoord.y
|
|
||||||
),
|
|
||||||
fracCoord.x
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(){
|
|
||||||
//-1 to +1 instead of 0 to 1.
|
|
||||||
vec2 signedTexcoord = texcoord * 2.0 - 1.0;
|
|
||||||
//0 in the center, 1 on the edges.
|
|
||||||
//this is not a euclidean distance.
|
|
||||||
float centerDistance = sqrt(1.0 - (1.0 - signedTexcoord.x * signedTexcoord.x) * (1.0 - signedTexcoord.y * signedTexcoord.y));
|
|
||||||
|
|
||||||
//offset the texcoord a bit so the lines are more wiggley.
|
|
||||||
vec2 offset = noise22(texcoord * 4.0);
|
|
||||||
offset += noise22(texcoord * 8.0) * 0.5;
|
|
||||||
offset += noise22(texcoord * 16.0) * 0.25;
|
|
||||||
offset /= 1.0 + 0.5 + 0.25; //0 to 1
|
|
||||||
offset = offset * 2.0 - 1.0; //-1 to +1
|
|
||||||
//don't offset the texcoord in the exact middle of the screen,
|
|
||||||
//because we want the lines to converge on the center.
|
|
||||||
offset *= centerDistance;
|
|
||||||
//0.03125 is the amount of wiggleyness to apply.
|
|
||||||
vec2 tc = texcoord + offset * 0.03125;
|
|
||||||
|
|
||||||
//texcoord, in polar coordinates, ranging from 0 to 1 instead of -pi to +pi.
|
|
||||||
float angle = atan(tc.y - 0.5, tc.x - 0.5) * (0.5 / 3.14159265359) + 0.5;
|
|
||||||
|
|
||||||
//noise used for the lines.
|
|
||||||
//this is one-dimensional noise, where the angle is the
|
|
||||||
float noise = noise11(angle * 64.0, 64.0);
|
|
||||||
noise += noise11(angle * 128.0, 128.0) * 0.5;
|
|
||||||
noise += noise11(angle * 256.0, 256.0) * 0.25;
|
|
||||||
noise /= 1.0 + 0.5 + 0.25; //0 to 1
|
|
||||||
//4.0 controls the "initial" thickness of the lines.
|
|
||||||
//higher numbers will be thinner, and lower numbers will be thicker.
|
|
||||||
noise = abs(noise * 2.0 - 1.0) * 4.0;
|
|
||||||
|
|
||||||
//0 at the edges, and... more than 0 at the center.
|
|
||||||
float distanceFactor = unmix(1.0, 1.0 - FrayIntensity, centerDistance);
|
|
||||||
float finalMultiplier = (noise + distanceFactor) * (1.0 - FrayIntensity);
|
|
||||||
|
|
||||||
fragColor = texture(DiffuseSampler, texcoord);
|
|
||||||
fragColor.rgb *= min(finalMultiplier, 1.0);
|
|
||||||
}
|
|
|
@ -1,14 +0,0 @@
|
||||||
{
|
|
||||||
"blend": { "func": "add", "srcrgb": "one", "dstrgb": "zero" },
|
|
||||||
"vertex": "fray",
|
|
||||||
"fragment": "fray",
|
|
||||||
"attributes": [ "Position" ],
|
|
||||||
"samplers": [
|
|
||||||
{ "name": "DiffuseSampler" }
|
|
||||||
],
|
|
||||||
"uniforms": [
|
|
||||||
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] },
|
|
||||||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] },
|
|
||||||
{ "name": "FrayIntensity", "type": "float", "count": 1, "values": [ 0.1 ] }
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
#version 150
|
|
||||||
|
|
||||||
in vec4 Position;
|
|
||||||
|
|
||||||
uniform mat4 ProjMat;
|
|
||||||
uniform vec2 OutSize;
|
|
||||||
|
|
||||||
out vec2 texcoord;
|
|
||||||
|
|
||||||
void main(){
|
|
||||||
vec4 outPos = ProjMat * vec4(Position.xy, 0.0, 1.0);
|
|
||||||
gl_Position = vec4(outPos.xy, 0.2, 1.0);
|
|
||||||
|
|
||||||
texcoord = Position.xy / OutSize;
|
|
||||||
}
|
|
Loading…
Reference in a new issue