forked from FabricMC/fabric
19w42a
Includes a work around for the funky rendering issues, this will need looking into some more.
This commit is contained in:
parent
ccd269cfad
commit
d2e3099f39
16 changed files with 65 additions and 26 deletions
build.gradle
fabric-blockrenderlayer-v1
build.gradle
src/main/java/net/fabricmc/fabric
api/blockrenderlayer/v1
impl/blockrenderlayer
mixin/blockrenderlayer
fabric-events-interaction-v0
build.gradle
src/main/java/net/fabricmc/fabric/mixin/eventsinteraction
fabric-networking-v0
fabric-renderer-api-v1
fabric-renderer-indigo
build.gradle
src/main/java/net/fabricmc/indigo
src/main/resources
|
@ -12,8 +12,8 @@ plugins {
|
||||||
def ENV = System.getenv()
|
def ENV = System.getenv()
|
||||||
|
|
||||||
class Globals {
|
class Globals {
|
||||||
static def baseVersion = "0.4.4"
|
static def baseVersion = "0.4.5"
|
||||||
static def mcVersion = "19w41a"
|
static def mcVersion = "19w42a"
|
||||||
static def yarnVersion = "+build.1"
|
static def yarnVersion = "+build.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
archivesBaseName = "fabric-blockrenderlayer-v1"
|
archivesBaseName = "fabric-blockrenderlayer-v1"
|
||||||
version = getSubprojectVersion(project, "1.0.2")
|
version = getSubprojectVersion(project, "1.1.0")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||||
|
|
|
@ -20,6 +20,7 @@ import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use to associate blocks or fluids with block render layer other than default.
|
* Use to associate blocks or fluids with block render layer other than default.
|
||||||
|
@ -44,7 +45,16 @@ public interface BlockRenderLayerMap {
|
||||||
* @param renderLayer Render layer. Should be one of the layers used for terrain rendering.
|
* @param renderLayer Render layer. Should be one of the layers used for terrain rendering.
|
||||||
*/
|
*/
|
||||||
void putBlock(Block block, RenderLayer renderLayer);
|
void putBlock(Block block, RenderLayer renderLayer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Map (or re-map) a item with a render layer. Re-mapping is not recommended but if done, last one in wins.
|
||||||
|
* Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer.
|
||||||
|
*
|
||||||
|
* @param item Identifies item to be mapped.
|
||||||
|
* @param renderLayer Render layer. Should be one of the layers used for entity rendering.
|
||||||
|
*/
|
||||||
|
void putItem(Item item, RenderLayer renderLayer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map (or re-map) a fluid state with a render layer. Re-mapping is not recommended but if done, last one in wins.
|
* Map (or re-map) a fluid state with a render layer. Re-mapping is not recommended but if done, last one in wins.
|
||||||
* Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer.
|
* Must be called from client thread prior to world load/rendering. Best practice will be to call from mod's client initializer.
|
||||||
|
|
|
@ -19,6 +19,7 @@ package net.fabricmc.fabric.impl.blockrenderlayer;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
|
@ -40,6 +41,17 @@ public class BlockRenderLayerMapImpl implements BlockRenderLayerMap {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void putItem(Item item, RenderLayer renderLayer) {
|
||||||
|
if (item == null) {
|
||||||
|
LOG.warn("Ignoring request to map null item to BlockRenderLayer");
|
||||||
|
} else if (renderLayer == null) {
|
||||||
|
LOG.warn("Ignoring request to map item " + item.toString() + " to null BlockRenderLayer");
|
||||||
|
} else {
|
||||||
|
itemHandler.accept(item, renderLayer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putFluid(Fluid fluid, RenderLayer renderLayer) {
|
public void putFluid(Fluid fluid, RenderLayer renderLayer) {
|
||||||
if (fluid == null) {
|
if (fluid == null) {
|
||||||
|
@ -63,12 +75,17 @@ public class BlockRenderLayerMapImpl implements BlockRenderLayerMap {
|
||||||
LOG.warn("Unable to map Block {} to BlockRenderLayer. Mapping handler not ready.", b);
|
LOG.warn("Unable to map Block {} to BlockRenderLayer. Mapping handler not ready.", b);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static BiConsumer<Item, RenderLayer> itemHandler = (b, l) -> {
|
||||||
|
LOG.warn("Unable to map Item {} to BlockRenderLayer. Mapping handler not ready.", b);
|
||||||
|
};
|
||||||
|
|
||||||
private static BiConsumer<Fluid, RenderLayer> fluidHandler = (f, b) -> {
|
private static BiConsumer<Fluid, RenderLayer> fluidHandler = (f, b) -> {
|
||||||
LOG.warn("Unable to map Fluid {} to BlockRenderLayer. Mapping handler not ready.", f);
|
LOG.warn("Unable to map Fluid {} to BlockRenderLayer. Mapping handler not ready.", f);
|
||||||
};
|
};
|
||||||
|
|
||||||
public static void initialize(BiConsumer<Block, RenderLayer> blockHandlerIn, BiConsumer<Fluid, RenderLayer> fluidHandlerIn) {
|
public static void initialize(BiConsumer<Block, RenderLayer> blockHandlerIn, BiConsumer<Item, RenderLayer> itemHandlerIn, BiConsumer<Fluid, RenderLayer> fluidHandlerIn) {
|
||||||
blockHandler = blockHandlerIn;
|
blockHandler = blockHandlerIn;
|
||||||
|
itemHandler = itemHandlerIn;
|
||||||
fluidHandler = fluidHandlerIn;
|
fluidHandler = fluidHandlerIn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,9 @@ package net.fabricmc.fabric.mixin.blockrenderlayer;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.class_4696;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
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;
|
||||||
|
@ -29,13 +31,14 @@ import net.fabricmc.fabric.impl.blockrenderlayer.BlockRenderLayerMapImpl;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
|
|
||||||
@Mixin(RenderLayer.class)
|
@Mixin(class_4696.class)
|
||||||
public class MixinBlockRenderLayer {
|
public class MixinBlockRenderLayer {
|
||||||
@Shadow private static Map<Block, RenderLayer> field_20803;
|
@Shadow private static Map<Block, RenderLayer> field_21469;
|
||||||
@Shadow private static Map<Fluid, RenderLayer> field_20804;
|
@Shadow private static Map<Item, RenderLayer> field_21470;
|
||||||
|
@Shadow private static Map<Fluid, RenderLayer> field_21471;
|
||||||
|
|
||||||
@Inject(method = "<clinit>*", at = @At("RETURN"))
|
@Inject(method = "<clinit>*", at = @At("RETURN"))
|
||||||
private static void onInitialize(CallbackInfo info) {
|
private static void onInitialize(CallbackInfo info) {
|
||||||
BlockRenderLayerMapImpl.initialize(field_20803::put, field_20804::put);
|
BlockRenderLayerMapImpl.initialize(field_21469::put, field_21470::put, field_21471::put);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
archivesBaseName = "fabric-events-interaction-v0"
|
archivesBaseName = "fabric-events-interaction-v0"
|
||||||
version = getSubprojectVersion(project, "0.2.3")
|
version = getSubprojectVersion(project, "0.2.4")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class MixinClientPlayerInteractionManager {
|
||||||
ActionResult result = UseEntityCallback.EVENT.invoker().interact(player, player.getEntityWorld(), hand, entity, hitResult);
|
ActionResult result = UseEntityCallback.EVENT.invoker().interact(player, player.getEntityWorld(), hand, entity, hitResult);
|
||||||
if (result != ActionResult.PASS) {
|
if (result != ActionResult.PASS) {
|
||||||
if (result == ActionResult.SUCCESS) {
|
if (result == ActionResult.SUCCESS) {
|
||||||
Vec3d hitVec = hitResult.getPos().subtract(entity.method_23317(), entity.method_23318(), entity.method_23321());
|
Vec3d hitVec = hitResult.getPos().subtract(entity.getX(), entity.getY(), entity.getZ());
|
||||||
this.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, hand, hitVec));
|
this.networkHandler.sendPacket(new PlayerInteractEntityC2SPacket(entity, hand, hitVec));
|
||||||
}
|
}
|
||||||
info.setReturnValue(result);
|
info.setReturnValue(result);
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class MixinServerPlayNetworkHandler {
|
||||||
World world = player.getEntityWorld();
|
World world = player.getEntityWorld();
|
||||||
Entity entity = packet.getEntity(world);
|
Entity entity = packet.getEntity(world);
|
||||||
if (entity != null) {
|
if (entity != null) {
|
||||||
EntityHitResult hitResult = new EntityHitResult(entity, packet.getHitPosition().add(entity.method_23317(), entity.method_23318(), entity.method_23321()));
|
EntityHitResult hitResult = new EntityHitResult(entity, packet.getHitPosition().add(entity.getX(), entity.getY(), entity.getZ()));
|
||||||
|
|
||||||
ActionResult result = UseEntityCallback.EVENT.invoker().interact(player, world, packet.getHand(), entity, hitResult);
|
ActionResult result = UseEntityCallback.EVENT.invoker().interact(player, world, packet.getHand(), entity, hitResult);
|
||||||
if (result != ActionResult.PASS) {
|
if (result != ActionResult.PASS) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
archivesBaseName = "fabric-networking-v0"
|
archivesBaseName = "fabric-networking-v0"
|
||||||
version = getSubprojectVersion(project, "0.1.4")
|
version = getSubprojectVersion(project, "0.1.5")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||||
|
|
|
@ -88,7 +88,7 @@ public final class PlayerStream {
|
||||||
}
|
}
|
||||||
|
|
||||||
// fallback
|
// fallback
|
||||||
return watching(entity.getEntityWorld(), new ChunkPos((int) (entity.method_23317() / 16.0D), (int) (entity.method_23318() / 16.0D)));
|
return watching(entity.getEntityWorld(), new ChunkPos((int) (entity.getX() / 16.0D), (int) (entity.getZ() / 16.0D)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Stream<PlayerEntity> watching(BlockEntity entity) {
|
public static Stream<PlayerEntity> watching(BlockEntity entity) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
archivesBaseName = "fabric-renderer-api-v1"
|
archivesBaseName = "fabric-renderer-api-v1"
|
||||||
version = getSubprojectVersion(project, "0.2.4")
|
version = getSubprojectVersion(project, "0.2.5")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||||
|
|
|
@ -30,25 +30,25 @@ public enum BlendMode {
|
||||||
/**
|
/**
|
||||||
* Fully opaque with depth test, no blending. Used for most normal blocks.
|
* Fully opaque with depth test, no blending. Used for most normal blocks.
|
||||||
*/
|
*/
|
||||||
SOLID(RenderLayer.method_23577()),
|
SOLID(RenderLayer.getSolid()),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
|
* Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
|
||||||
* Texture mip-map enabled. Used for leaves.
|
* Texture mip-map enabled. Used for leaves.
|
||||||
*/
|
*/
|
||||||
CUTOUT_MIPPED(RenderLayer.method_23579()),
|
CUTOUT_MIPPED(RenderLayer.getCutoutMipped()),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
|
* Pixels with alpha > 0.5 are rendered as if {@code SOLID}. Other pixels are not rendered.
|
||||||
* Texture mip-map disabled. Used for iron bars, glass and other cutout sprites with hard edges.
|
* Texture mip-map disabled. Used for iron bars, glass and other cutout sprites with hard edges.
|
||||||
*/
|
*/
|
||||||
CUTOUT(RenderLayer.method_23581()),
|
CUTOUT(RenderLayer.getCutout()),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pixels are blended with the background according to alpha color values. Some performance cost,
|
* Pixels are blended with the background according to alpha color values. Some performance cost,
|
||||||
* use in moderation. Texture mip-map enabled. Used for stained glass.
|
* use in moderation. Texture mip-map enabled. Used for stained glass.
|
||||||
*/
|
*/
|
||||||
TRANSLUCENT(RenderLayer.method_23583());
|
TRANSLUCENT(RenderLayer.getTranslucent());
|
||||||
|
|
||||||
public final RenderLayer blockRenderLayer;
|
public final RenderLayer blockRenderLayer;
|
||||||
|
|
||||||
|
@ -57,13 +57,13 @@ public enum BlendMode {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BlendMode fromRenderLayer(RenderLayer renderLayer) {
|
public static BlendMode fromRenderLayer(RenderLayer renderLayer) {
|
||||||
if (renderLayer == RenderLayer.method_23577()) {
|
if (renderLayer == RenderLayer.getSolid()) {
|
||||||
return SOLID;
|
return SOLID;
|
||||||
} else if (renderLayer == RenderLayer.method_23579()) {
|
} else if (renderLayer == RenderLayer.getCutoutMipped()) {
|
||||||
return CUTOUT_MIPPED;
|
return CUTOUT_MIPPED;
|
||||||
} else if (renderLayer == RenderLayer.method_23581()) {
|
} else if (renderLayer == RenderLayer.getCutout()) {
|
||||||
return CUTOUT;
|
return CUTOUT;
|
||||||
} else if (renderLayer == RenderLayer.method_23583()) {
|
} else if (renderLayer == RenderLayer.getTranslucent()) {
|
||||||
return TRANSLUCENT;
|
return TRANSLUCENT;
|
||||||
} else {
|
} else {
|
||||||
return DEFAULT;
|
return DEFAULT;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
archivesBaseName = "fabric-renderer-indigo"
|
archivesBaseName = "fabric-renderer-indigo"
|
||||||
version = getSubprojectVersion(project, "0.2.5")
|
version = getSubprojectVersion(project, "0.2.6")
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile project(path: ':fabric-api-base', configuration: 'dev')
|
compile project(path: ':fabric-api-base', configuration: 'dev')
|
||||||
|
|
|
@ -61,6 +61,14 @@ public class IndigoMixinConfigPlugin implements IMixinConfigPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean shouldForceCompatibility() {
|
static boolean shouldForceCompatibility() {
|
||||||
|
if(true){
|
||||||
|
/**
|
||||||
|
* TODO: remove me, and fix indigo
|
||||||
|
*
|
||||||
|
* This has been done to work around some funky rendering issues as of 19w42a
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
loadIfNeeded();
|
loadIfNeeded();
|
||||||
return forceCompatibility;
|
return forceCompatibility;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
import net.fabricmc.fabric.api.renderer.v1.material.BlendMode;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.class_4696;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.color.block.BlockColors;
|
import net.minecraft.client.color.block.BlockColors;
|
||||||
import net.minecraft.client.render.RenderLayer;
|
import net.minecraft.client.render.RenderLayer;
|
||||||
|
@ -69,7 +70,7 @@ public class BlockRenderInfo {
|
||||||
seed = -1L;
|
seed = -1L;
|
||||||
defaultAo = modelAO && MinecraftClient.isAmbientOcclusionEnabled() && blockState.getLuminance() == 0;
|
defaultAo = modelAO && MinecraftClient.isAmbientOcclusionEnabled() && blockState.getLuminance() == 0;
|
||||||
|
|
||||||
defaultLayer = RenderLayer.method_22715(blockState);
|
defaultLayer = class_4696.method_23679(blockState);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void release() {
|
public void release() {
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.6.2",
|
"fabricloader": ">=0.6.2",
|
||||||
"minecraft": "~1.15-alpha.19.39.a"
|
"minecraft": "~1.15-alpha.19.42.a"
|
||||||
},
|
},
|
||||||
"description": "Core API module providing key hooks and intercompatibility features."
|
"description": "Core API module providing key hooks and intercompatibility features."
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue