edited the fray, fixed the limbo checking so it doesn't crash on servers.
This commit is contained in:
parent
510cc35135
commit
9e686d8ec7
6 changed files with 40 additions and 13 deletions
|
@ -10,7 +10,6 @@ public class ModStats {
|
|||
public static final Identifier TIMES_SENT_TO_LIMBO = StatsAccessor.invokeRegister("dimdoors:times_sent_to_limbo", StatFormatter.DEFAULT);
|
||||
public static final Identifier TIMES_TELEPORTED_BY_MONOLITH = StatsAccessor.invokeRegister("dimdoors:times_teleported_by_monolith", StatFormatter.DEFAULT);
|
||||
public static final Identifier TIMES_BEEN_TO_DUNGEON = StatsAccessor.invokeRegister("dimdoors:times_been_to_dungeon", StatFormatter.DEFAULT);
|
||||
|
||||
public static void init() {
|
||||
// just loads the class
|
||||
}
|
||||
|
|
|
@ -34,10 +34,9 @@ public abstract class PlayerEntityMixin extends LivingEntity {
|
|||
}
|
||||
|
||||
|
||||
|
||||
@Inject(method = "handleFallDamage", at = @At("HEAD"), cancellable = true)
|
||||
public void handleLimboFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (this.world.getDimension().equals(ModDimensions.LIMBO_DIMENSION.getDimension())) {
|
||||
if (ModDimensions.isLimboDimension(world)) {
|
||||
cir.setReturnValue(false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
package org.dimdev.dimdoors.mixin;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.packet.s2c.play.InventoryS2CPacket;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.apache.logging.log4j.core.jmx.Server;
|
||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||
import org.dimdev.dimdoors.criteria.ModCriteria;
|
||||
import org.dimdev.dimdoors.entity.limbo.LimboEntranceSource;
|
||||
import org.dimdev.dimdoors.entity.stat.ModStats;
|
||||
import org.dimdev.dimdoors.api.util.TeleportUtil;
|
||||
import org.dimdev.dimdoors.item.ModItems;
|
||||
import org.dimdev.dimdoors.network.ExtendedServerPlayNetworkHandler;
|
||||
import org.dimdev.dimdoors.network.packet.s2c.PlayerInventorySlotUpdateS2CPacket;
|
||||
import org.dimdev.dimdoors.world.ModDimensions;
|
||||
import org.dimdev.dimdoors.world.level.component.PlayerModifiersComponent;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -27,9 +32,9 @@ import java.util.Random;
|
|||
|
||||
@Mixin(value = ServerPlayerEntity.class, priority = 900)
|
||||
public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
||||
private static final int RANDOM_ACTION_BOUND = 100;
|
||||
private static final int RANDOM_ACTION_BOUND = 1;
|
||||
private static final int CHANCE_TO_DECREASE_ARMOR_DURABILITY = 20;
|
||||
private static final int CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC = 10;
|
||||
private static final int CHANCE_TO_REPLACE_ITEMSLOT_WITH_UNRAVLED_FABRIC = 1;
|
||||
Random random = new Random();
|
||||
|
||||
public ServerPlayerEntityMixin(EntityType<? extends LivingEntity> entityType, World world) {
|
||||
|
@ -58,6 +63,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
|||
|
||||
}
|
||||
|
||||
//TODO: Fix this shit so it syncs.
|
||||
private void addRandomUnravledFabric(PlayerEntity player) {
|
||||
if(PlayerModifiersComponent.getFray(player) < DimensionalDoorsInitializer.getConfig().getPlayerConfig().fray.unravledFabricInInventoryFray)
|
||||
return;
|
||||
|
@ -70,8 +76,9 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
|||
return;
|
||||
if (player.getInventory().main.get(slot).getCount() >= 64)
|
||||
return;
|
||||
player.getInventory().main.set(slot, new ItemStack(ModItems.UNRAVELLED_FABRIC, 1 + player.getInventory().main.get(slot).getCount()));
|
||||
|
||||
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) {
|
||||
|
@ -104,4 +111,6 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin {
|
|||
ModCriteria.POCKET_SPAWN_POINT_SET.trigger((ServerPlayerEntity) (Object) this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -26,6 +26,9 @@ import net.fabricmc.api.Environment;
|
|||
@Environment(EnvType.CLIENT)
|
||||
@Mixin(InGameHud.class)
|
||||
public abstract class InGameHudMixin{
|
||||
private int frame = 0;
|
||||
private static final float OVERLAY_OPACITY_ADJUSTEMENT = 3F;
|
||||
private static final float FRAMING_ADJUSTEMENT = 1F;
|
||||
private ModConfig.Player config = DimensionalDoorsInitializer.getConfig().getPlayerConfig();
|
||||
@Shadow
|
||||
private int scaledHeight;
|
||||
|
@ -43,13 +46,30 @@ public abstract class InGameHudMixin{
|
|||
// }
|
||||
@Inject(method = "render", at = @At("HEAD"), cancellable = true)
|
||||
public void renderOverlayMixin(MatrixStack matrices, float tickDelta, CallbackInfo ci) {
|
||||
float overlayOpacity = (config.fray.grayScreenFray - PlayerModifiersComponent.getFray(getCameraPlayer()))/(config.fray.grayScreenFray - (float)config.fray.maxFray);
|
||||
float overlayOpacity = (config.fray.grayScreenFray - PlayerModifiersComponent.getFray(getCameraPlayer()))/(config.fray.grayScreenFray - (float)config.fray.maxFray) / OVERLAY_OPACITY_ADJUSTEMENT;
|
||||
if (PlayerModifiersComponent.getFray(getCameraPlayer()) > config.fray.grayScreenFray) {
|
||||
System.out.println(overlayOpacity);
|
||||
this.renderOverlay(new Identifier("dimdoors", "textures/other/grey_vingette.png"), overlayOpacity);
|
||||
this.renderOverlay(new Identifier("dimdoors", "textures/other/static.png"), overlayOpacity);
|
||||
}
|
||||
}
|
||||
private void renderOverlay(Identifier texture, float opacity) {
|
||||
frame++;
|
||||
if(frame > 6)
|
||||
frame = 0;
|
||||
float frameAdjustment = FRAMING_ADJUSTEMENT*(opacity);
|
||||
frameAdjustment -= 1;
|
||||
float amountMoved = ((float)frame)/6F;
|
||||
float up = amountMoved;
|
||||
float down = 1*amountMoved + 1f/6f;
|
||||
float left = frameAdjustment;
|
||||
float right = 1-frameAdjustment;
|
||||
/*
|
||||
up = up+frameAdjustment;
|
||||
|
||||
down = down-frameAdjustment;
|
||||
|
||||
*/
|
||||
|
||||
RenderSystem.disableDepthTest();
|
||||
RenderSystem.depthMask(false);
|
||||
RenderSystem.enableBlend();
|
||||
|
@ -60,10 +80,10 @@ public abstract class InGameHudMixin{
|
|||
Tessellator tessellator = Tessellator.getInstance();
|
||||
BufferBuilder bufferBuilder = tessellator.getBuffer();
|
||||
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
|
||||
bufferBuilder.vertex(0.0D, (double)this.scaledHeight, -90.0D).texture(0.0F, 1.0F).next();
|
||||
bufferBuilder.vertex((double)this.scaledWidth, (double)this.scaledHeight, -90.0D).texture(1.0F, 1.0F).next();
|
||||
bufferBuilder.vertex((double)this.scaledWidth, 0.0D, -90.0D).texture(1.0F, 0.0F).next();
|
||||
bufferBuilder.vertex(0.0D, 0.0D, -90.0D).texture(0.0F, 0.0F).next();
|
||||
bufferBuilder.vertex(0.0D, (double)this.scaledHeight, -90.0D).texture(left, up).next(); //Upper left hand corner
|
||||
bufferBuilder.vertex((double)this.scaledWidth, (double)this.scaledHeight, -90.0D).texture(right, up).next(); //Upper right hand corner
|
||||
bufferBuilder.vertex((double)this.scaledWidth, 0.0D, -90.0D).texture(right, down).next(); //Lower left hand corner
|
||||
bufferBuilder.vertex(0.0D, 0.0D, -90.0D).texture(left, down).next();//Lower right hand corner.
|
||||
tessellator.draw();
|
||||
RenderSystem.depthMask(true);
|
||||
RenderSystem.enableDepthTest();
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.1 KiB |
BIN
src/main/resources/assets/dimdoors/textures/other/static.png
Normal file
BIN
src/main/resources/assets/dimdoors/textures/other/static.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 57 KiB |
Loading…
Reference in a new issue