Skip to content

Commit

Permalink
[3/3] Prepare to port this mod on Fabric
Browse files Browse the repository at this point in the history
  • Loading branch information
mikroskeem committed Jun 12, 2019
1 parent 5400800 commit 0d2c3e3
Show file tree
Hide file tree
Showing 15 changed files with 201 additions and 1,744 deletions.
282 changes: 0 additions & 282 deletions src/main/java/com/mumfrey/worldeditcui/LiteModWorldEditCUI.java

This file was deleted.

Expand Up @@ -4,7 +4,7 @@
import com.mumfrey.worldeditcui.event.CUIEventArgs;
import com.mumfrey.worldeditcui.event.CUIEventType;
import com.mumfrey.worldeditcui.render.region.Region;
import net.minecraft.client.Minecraft;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;

/**
Expand Down Expand Up @@ -41,9 +41,9 @@ public String raise()

if (this.multi && "~".equals(this.getString(1)) && "~".equals(this.getString(2)) && "~".equals(this.getString(3)))
{
Minecraft mc = Minecraft.getMinecraft();
Entity entity = mc.getRenderViewEntity();
double hitDistance = mc.playerController.getBlockReachDistance();
MinecraftClient mc = MinecraftClient.getInstance();
Entity entity = mc.getCameraEntity();
double hitDistance = mc.interactionManager.getReachDistance();

selection.setCuboidVertexLatch(id, entity, Math.min(Math.max(this.getDouble(4), hitDistance), 256.0));
this.controller.getDebugger().debug("Setting vertex latch #" + id);
Expand Down
@@ -1,9 +1,11 @@
package com.mumfrey.worldeditcui.event.listeners;

import com.mojang.blaze3d.platform.GLX;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mumfrey.worldeditcui.WorldEditCUI;
import com.mumfrey.worldeditcui.util.Vector3;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.Entity;
import org.lwjgl.opengl.GL11;

/**
Expand All @@ -29,8 +31,7 @@ public void onRender(float partialTicks)
{
try
{
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240);

GLX.glMultiTexCoord2f(GLX.GL_TEXTURE1, 240F, 240F);
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GlStateManager.enableBlend();
GlStateManager.enableAlphaTest();
Expand All @@ -43,7 +44,12 @@ public void onRender(float partialTicks)

try
{
Vector3 cameraPos = new Vector3(this.minecraft.getCameraEntity(), partialTicks);
Entity player = this.minecraft.player;
Vector3 cameraPos = new Vector3(
player.prevX + ((player.x - player.prevX) * partialTicks),
player.prevY + ((player.y - player.prevY) * partialTicks) + player.getEyeHeight(player.getPose()),
player.prevZ + ((player.z - player.prevZ) * partialTicks)
);
GlStateManager.color4f(1.0F, 1.0F, 1.0F, 0.5F);
this.controller.renderSelections(cameraPos, partialTicks);
}
Expand Down

0 comments on commit 0d2c3e3

Please sign in to comment.