mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-12-15 10:43:42 +01:00
Fix Flywheel contraption lighting
- Fix some events being registered to the wrong event bus - Organize some event registration - Fully fix FluidRenderer
This commit is contained in:
parent
2078899ed9
commit
795ef07b38
13 changed files with 104 additions and 94 deletions
|
@ -11,7 +11,6 @@ import com.simibubi.create.api.behaviour.BlockSpoutingBehaviour;
|
|||
import com.simibubi.create.content.CreateItemGroup;
|
||||
import com.simibubi.create.content.contraptions.TorquePropagator;
|
||||
import com.simibubi.create.content.contraptions.components.flywheel.engine.FurnaceEngineModifiers;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
|
||||
import com.simibubi.create.content.curiosities.weapons.BuiltinPotatoProjectileTypes;
|
||||
import com.simibubi.create.content.logistics.RedstoneLinkNetworkHandler;
|
||||
import com.simibubi.create.content.palettes.AllPaletteBlocks;
|
||||
|
@ -45,8 +44,6 @@ import net.minecraft.world.level.levelgen.placement.FeatureDecorator;
|
|||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
|
@ -112,16 +109,13 @@ public class Create {
|
|||
IEventBus forgeEventBus = MinecraftForge.EVENT_BUS;
|
||||
|
||||
modEventBus.addListener(Create::init);
|
||||
modEventBus.addListener(EventPriority.LOWEST, Create::gatherData);
|
||||
modEventBus.addGenericListener(Feature.class, AllWorldFeatures::registerOreFeatures);
|
||||
modEventBus.addGenericListener(FeatureDecorator.class, AllWorldFeatures::registerDecoratorFeatures);
|
||||
modEventBus.addGenericListener(RecipeSerializer.class, AllRecipeTypes::register);
|
||||
modEventBus.addGenericListener(ParticleType.class, AllParticleTypes::register);
|
||||
modEventBus.addGenericListener(SoundEvent.class, AllSoundEvents::register);
|
||||
modEventBus.addListener(AllConfigs::onLoad);
|
||||
modEventBus.addListener(AllConfigs::onReload);
|
||||
modEventBus.addListener(EventPriority.LOWEST, Create::gatherData);
|
||||
|
||||
forgeEventBus.addListener(EventPriority.HIGH, Create::onBiomeLoad);
|
||||
forgeEventBus.register(CHUNK_UTIL);
|
||||
|
||||
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
|
||||
|
@ -153,14 +147,6 @@ public class Create {
|
|||
ProcessingRecipeGen.registerAll(gen);
|
||||
}
|
||||
|
||||
public static void registerCapabilities(RegisterCapabilitiesEvent event) {
|
||||
event.register(CapabilityMinecartController.class);
|
||||
}
|
||||
|
||||
public static void onBiomeLoad(BiomeLoadingEvent event) {
|
||||
AllWorldFeatures.reload(event);
|
||||
}
|
||||
|
||||
public static CreateRegistrate registrate() {
|
||||
return REGISTRATE.get();
|
||||
}
|
||||
|
|
|
@ -10,9 +10,7 @@ import com.simibubi.create.content.curiosities.zapper.ZapperRenderHandler;
|
|||
import com.simibubi.create.content.schematics.ClientSchematicLoader;
|
||||
import com.simibubi.create.content.schematics.client.SchematicAndQuillHandler;
|
||||
import com.simibubi.create.content.schematics.client.SchematicHandler;
|
||||
import com.simibubi.create.events.ClientEvents;
|
||||
import com.simibubi.create.foundation.ClientResourceReloadListener;
|
||||
import com.simibubi.create.foundation.block.render.SpriteShifter;
|
||||
import com.simibubi.create.foundation.config.AllConfigs;
|
||||
import com.simibubi.create.foundation.gui.UIRenderHelper;
|
||||
import com.simibubi.create.foundation.ponder.content.PonderIndex;
|
||||
|
@ -58,9 +56,6 @@ public class CreateClient {
|
|||
|
||||
public static void onCtorClient(IEventBus modEventBus, IEventBus forgeEventBus) {
|
||||
modEventBus.addListener(CreateClient::clientInit);
|
||||
modEventBus.addListener(ClientEvents::loadCompleted);
|
||||
modEventBus.addListener(SpriteShifter::onTextureStitchPre);
|
||||
modEventBus.addListener(SpriteShifter::onTextureStitchPost);
|
||||
modEventBus.addListener(AllParticleTypes::registerFactories);
|
||||
modEventBus.addListener(CreateContexts::flwInit);
|
||||
modEventBus.addListener(AllMaterialSpecs::flwInit);
|
||||
|
|
|
@ -32,6 +32,7 @@ import net.minecraft.client.renderer.RenderType;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.LightLayer;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
@ -110,7 +111,7 @@ public class ContraptionRenderDispatcher {
|
|||
for (StructureTemplate.StructureBlockInfo info : c.getBlocks()
|
||||
.values())
|
||||
// Skip individual lighting updates to prevent lag with large contraptions
|
||||
renderWorld.setBlock(info.pos, info.state, 128);
|
||||
renderWorld.setBlock(info.pos, info.state, Block.UPDATE_SUPPRESS_LIGHT);
|
||||
|
||||
renderWorld.updateLightSources();
|
||||
renderWorld.lighter.runUpdates(Integer.MAX_VALUE, false, false);
|
||||
|
|
|
@ -93,7 +93,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
|||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
||||
import net.minecraftforge.fmlclient.ConfigGuiHandler;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
@EventBusSubscriber(Dist.CLIENT)
|
||||
public class ClientEvents {
|
||||
|
||||
private static final String ITEM_PREFIX = "item." + Create.ID;
|
||||
|
@ -341,6 +341,9 @@ public class ClientEvents {
|
|||
}
|
||||
}
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
|
||||
public static class ModBusEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerClientReloadListeners(RegisterClientReloadListenersEvent event) {
|
||||
event.registerReloadListener(CreateClient.RESOURCE_RELOAD_LISTENER);
|
||||
|
@ -352,6 +355,7 @@ public class ClientEvents {
|
|||
CopperBacktankArmorLayer.registerOnAll(dispatcher);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void loadCompleted(FMLLoadCompleteEvent event) {
|
||||
ModContainer createContainer = ModList.get()
|
||||
.getModContainerById(Create.ID)
|
||||
|
@ -360,4 +364,6 @@ public class ClientEvents {
|
|||
() -> new ConfigGuiHandler.ConfigGuiFactory((mc, previousScreen) -> BaseConfigScreen.forCreate(previousScreen)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.simibubi.create.foundation.utility.Iterate;
|
|||
import com.simibubi.create.foundation.utility.ServerSpeedProvider;
|
||||
import com.simibubi.create.foundation.utility.WorldAttached;
|
||||
import com.simibubi.create.foundation.utility.recipe.RecipeFinder;
|
||||
import com.simibubi.create.foundation.worldgen.AllWorldFeatures;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
|
@ -32,6 +33,7 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
|
||||
import net.minecraftforge.event.AddReloadListenerEvent;
|
||||
import net.minecraftforge.event.AttachCapabilitiesEvent;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
|
@ -44,8 +46,10 @@ import net.minecraftforge.event.entity.player.AttackEntityEvent;
|
|||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent.PlayerLoggedInEvent;
|
||||
import net.minecraftforge.event.world.BlockEvent.FluidPlaceBlockEvent;
|
||||
import net.minecraftforge.event.world.BiomeLoadingEvent;
|
||||
import net.minecraftforge.event.world.ChunkEvent;
|
||||
import net.minecraftforge.event.world.WorldEvent;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fmlserverevents.FMLServerStoppingEvent;
|
||||
|
@ -172,6 +176,11 @@ public class CommonEvents {
|
|||
CapabilityMinecartController.startTracking(event);
|
||||
}
|
||||
|
||||
@SubscribeEvent(priority = EventPriority.HIGH)
|
||||
public static void onBiomeLoad(BiomeLoadingEvent event) {
|
||||
AllWorldFeatures.reload(event);
|
||||
}
|
||||
|
||||
public static void leftClickEmpty(ServerPlayer player) {
|
||||
ItemStack stack = player.getMainHandItem();
|
||||
if (stack.getItem() instanceof ZapperItem) {
|
||||
|
@ -179,4 +188,14 @@ public class CommonEvents {
|
|||
}
|
||||
}
|
||||
|
||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||
public static class ModBusEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void registerCapabilities(RegisterCapabilitiesEvent event) {
|
||||
event.register(CapabilityMinecartController.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -15,17 +15,17 @@ import net.minecraftforge.client.event.InputEvent.MouseScrollEvent;
|
|||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT)
|
||||
@EventBusSubscriber(Dist.CLIENT)
|
||||
public class InputEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onKeyInput(KeyInputEvent event) {
|
||||
int key = event.getKey();
|
||||
boolean pressed = !(event.getAction() == 0);
|
||||
|
||||
if (Minecraft.getInstance().screen != null)
|
||||
return;
|
||||
|
||||
int key = event.getKey();
|
||||
boolean pressed = !(event.getAction() == 0);
|
||||
|
||||
CreateClient.SCHEMATIC_HANDLER.onKeyInput(key, pressed);
|
||||
ToolboxHandlerClient.onKeyInput(key, pressed);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,12 @@ import com.simibubi.create.Create;
|
|||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.inventory.InventoryMenu;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
|
||||
@EventBusSubscriber(value = Dist.CLIENT, bus = EventBusSubscriber.Bus.MOD)
|
||||
public class SpriteShifter {
|
||||
|
||||
protected static final Map<String, SpriteShiftEntry> ENTRY_CACHE = new HashMap<>();
|
||||
|
@ -35,6 +39,7 @@ public class SpriteShifter {
|
|||
return ENTRY_CACHE.values().stream().map(SpriteShiftEntry::getTargetResourceLocation).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onTextureStitchPre(TextureStitchEvent.Pre event) {
|
||||
if (!event.getMap()
|
||||
.location()
|
||||
|
@ -45,6 +50,7 @@ public class SpriteShifter {
|
|||
.forEach(event::addSprite);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onTextureStitchPost(TextureStitchEvent.Post event) {
|
||||
if (!event.getMap()
|
||||
.location()
|
||||
|
|
|
@ -10,10 +10,13 @@ import org.apache.commons.lang3.tuple.Pair;
|
|||
import com.simibubi.create.foundation.block.BlockStressValues;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
|
||||
import net.minecraftforge.fml.config.ModConfig;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent;
|
||||
|
||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||
public class AllConfigs {
|
||||
|
||||
private static final Map<ModConfig.Type, ConfigBase> CONFIGS = new EnumMap<>(ModConfig.Type.class);
|
||||
|
@ -50,6 +53,7 @@ public class AllConfigs {
|
|||
BlockStressValues.registerProvider(context.getActiveNamespace(), SERVER.kinetics.stressValues);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onLoad(ModConfigEvent.Loading event) {
|
||||
for (ConfigBase config : CONFIGS.values())
|
||||
if (config.specification == event.getConfig()
|
||||
|
@ -57,6 +61,7 @@ public class AllConfigs {
|
|||
config.onLoad();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onReload(ModConfigEvent.Reloading event) {
|
||||
for (ConfigBase config : CONFIGS.values())
|
||||
if (config.specification == event.getConfig()
|
||||
|
|
|
@ -30,10 +30,10 @@ import net.minecraftforge.fml.config.ModConfig;
|
|||
public class BaseConfigScreen extends ConfigScreen {
|
||||
|
||||
public static final DelegatedStencilElement.ElementRenderer DISABLED_RENDERER = (ms, width, height, alpha) -> UIRenderHelper.angledGradient(ms, 0, 0, height / 2, height, width, Theme.p(Theme.Key.BUTTON_DISABLE));
|
||||
private static final Map<String, UnaryOperator<BaseConfigScreen>> defaults = new HashMap<>();
|
||||
private static final Map<String, UnaryOperator<BaseConfigScreen>> DEFAULTS = new HashMap<>();
|
||||
|
||||
static {
|
||||
defaults.put("create", (base) -> base
|
||||
DEFAULTS.put(Create.ID, (base) -> base
|
||||
.withTitles("Client Settings", "World Generation Settings", "Gameplay Settings")
|
||||
.withSpecs(AllConfigs.CLIENT.specification, AllConfigs.COMMON.specification, AllConfigs.SERVER.specification)
|
||||
);
|
||||
|
@ -52,7 +52,7 @@ public class BaseConfigScreen extends ConfigScreen {
|
|||
if (modID.equals(Create.ID))
|
||||
return;
|
||||
|
||||
defaults.put(modID, transform);
|
||||
DEFAULTS.put(modID, transform);
|
||||
}
|
||||
|
||||
public static BaseConfigScreen forCreate(Screen parent) {
|
||||
|
@ -79,8 +79,8 @@ public class BaseConfigScreen extends ConfigScreen {
|
|||
super(parent);
|
||||
this.modID = modID;
|
||||
|
||||
if (defaults.containsKey(modID))
|
||||
defaults.get(modID).apply(this);
|
||||
if (DEFAULTS.containsKey(modID))
|
||||
DEFAULTS.get(modID).apply(this);
|
||||
else {
|
||||
this.searchForSpecsInModContainer();
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ public class FluidRenderer {
|
|||
light = (light & 0xF00000) | luminosity << 4;
|
||||
|
||||
Vec3 center = new Vec3(xMin + (xMax - xMin) / 2, yMin + (yMax - yMin) / 2, zMin + (zMax - zMin) / 2);
|
||||
MatrixTransformStack msr = MatrixTransformStack.of(ms);
|
||||
ms.pushPose();
|
||||
if (fluidStack.getFluid()
|
||||
.getAttributes()
|
||||
|
@ -120,28 +119,17 @@ public class FluidRenderer {
|
|||
if (side == Direction.DOWN && !renderBottom)
|
||||
continue;
|
||||
|
||||
boolean positive = side.getAxisDirection() == AxisDirection.POSITIVE;
|
||||
if (side.getAxis()
|
||||
.isHorizontal()) {
|
||||
ms.pushPose();
|
||||
|
||||
if (side.getAxisDirection() == AxisDirection.NEGATIVE) {
|
||||
msr.translate(center)
|
||||
.rotateY(180)
|
||||
.translateBack(center);
|
||||
side = Direction.get(AxisDirection.POSITIVE, side.getAxis());
|
||||
}
|
||||
|
||||
boolean X = side.getAxis() == Axis.X;
|
||||
renderTiledHorizontalFace(X ? xMax : zMax, side, X ? zMin : xMin, yMin, X ? zMax : xMax, yMax, builder,
|
||||
boolean x = side.getAxis() == Axis.X;
|
||||
renderTiledHorizontalFace(positive ? (x ? xMax : zMax) : (x ? xMin : zMin), side, x ? zMin : xMin, yMin, x ? zMax : xMax, yMax, builder,
|
||||
ms, light, color, fluidTexture);
|
||||
|
||||
ms.popPose();
|
||||
continue;
|
||||
}
|
||||
|
||||
renderTiledVerticalFace(side == Direction.UP ? yMax : yMin, side, xMin, zMin, xMax, zMax, builder, ms,
|
||||
} else {
|
||||
renderTiledVerticalFace(positive ? yMax : yMin, side, xMin, zMin, xMax, zMax, builder, ms,
|
||||
light, color, fluidTexture);
|
||||
}
|
||||
}
|
||||
|
||||
ms.popPose();
|
||||
|
||||
|
@ -149,6 +137,8 @@ public class FluidRenderer {
|
|||
|
||||
private static void renderTiledVerticalFace(float y, Direction face, float xMin, float zMin, float xMax, float zMax,
|
||||
VertexConsumer builder, PoseStack ms, int light, int color, TextureAtlasSprite texture) {
|
||||
boolean positive = face.getAxisDirection() == Direction.AxisDirection.POSITIVE;
|
||||
|
||||
float x2 = 0;
|
||||
float z2 = 0;
|
||||
for (float x1 = xMin; x1 < xMax; x1 = x2) {
|
||||
|
@ -161,41 +151,40 @@ public class FluidRenderer {
|
|||
float u2 = texture.getU(x2 == xMax ? local(x2) * 16 : 16);
|
||||
float v2 = texture.getV(z2 == zMax ? local(z2) * 16 : 16);
|
||||
|
||||
putVertex(builder, ms, x1, y, z2, color, u1, v2, face, light);
|
||||
putVertex(builder, ms, x2, y, z2, color, u2, v2, face, light);
|
||||
putVertex(builder, ms, x2, y, z1, color, u2, v1, face, light);
|
||||
putVertex(builder, ms, x1, y, z1, color, u1, v1, face, light);
|
||||
putVertex(builder, ms, x1, y, positive ? z1 : z2, color, u1, v1, face, light);
|
||||
putVertex(builder, ms, x1, y, positive ? z2 : z1, color, u1, v2, face, light);
|
||||
putVertex(builder, ms, x2, y, positive ? z2 : z1, color, u2, v2, face, light);
|
||||
putVertex(builder, ms, x2, y, positive ? z1 : z2, color, u2, v1, face, light);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void renderTiledHorizontalFace(float h, Direction face, float hMin, float yMin, float hMax,
|
||||
float yMax, VertexConsumer builder, PoseStack ms, int light, int color, TextureAtlasSprite texture) {
|
||||
boolean X = face.getAxis() == Axis.X;
|
||||
boolean positive = face.getAxisDirection() == Direction.AxisDirection.POSITIVE;
|
||||
boolean x = face.getAxis() == Axis.X;
|
||||
|
||||
float h2 = 0;
|
||||
float y2 = 0;
|
||||
|
||||
for (float h1 = hMin; h1 < hMax; h1 = h2) {
|
||||
h2 = Math.min((int) (h1 + 1), hMax);
|
||||
for (float y1 = yMin; y1 < yMax; y1 = y2) {
|
||||
y2 = Math.min((int) (y1 + 1), yMax);
|
||||
|
||||
int multiplier = texture.getWidth() == 32 ? 8 : 16;
|
||||
float u1 = texture.getU(local(h1) * multiplier);
|
||||
float v1 = texture.getV(local(y1) * multiplier);
|
||||
float u2 = texture.getU(h2 == hMax ? local(h2) * multiplier : multiplier);
|
||||
float v2 = texture.getV(y2 == yMax ? local(y2) * multiplier : multiplier);
|
||||
float u1 = texture.getU(local(h1) * 16);
|
||||
float v1 = texture.getV(local(y1) * 16);
|
||||
float u2 = texture.getU(h2 == hMax ? local(h2) * 16 : 16);
|
||||
float v2 = texture.getV(y2 == yMax ? local(y2) * 16 : 16);
|
||||
|
||||
float x1 = X ? h : h1;
|
||||
float x2 = X ? h : h2;
|
||||
float z1 = X ? h1 : h;
|
||||
float z2 = X ? h2 : h;
|
||||
float x1 = x ? h : (positive ? h1 : h2);
|
||||
float x2 = x ? h : (positive ? h2 : h1);
|
||||
float z1 = x ? (positive ? h1 : h2) : h;
|
||||
float z2 = x ? (positive ? h2 : h1) : h;
|
||||
|
||||
putVertex(builder, ms, x2, y2, z1, color, u1, v2, face, light);
|
||||
putVertex(builder, ms, x1, y2, z2, color, u2, v2, face, light);
|
||||
putVertex(builder, ms, x1, y1, z2, color, u2, v1, face, light);
|
||||
putVertex(builder, ms, x2, y1, z1, color, u1, v1, face, light);
|
||||
putVertex(builder, ms, x1, y2, z2, color, u1, v1, face, light);
|
||||
putVertex(builder, ms, x1, y1, z2, color, u1, v2, face, light);
|
||||
putVertex(builder, ms, x2, y1, z1, color, u2, v2, face, light);
|
||||
putVertex(builder, ms, x2, y2, z1, color, u2, v1, face, light);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -209,20 +198,19 @@ public class FluidRenderer {
|
|||
private static void putVertex(VertexConsumer builder, PoseStack ms, float x, float y, float z, int color, float u,
|
||||
float v, Direction face, int light) {
|
||||
|
||||
Vec3i n = face.getNormal();
|
||||
Vec3i normal = face.getNormal();
|
||||
Pose peek = ms.last();
|
||||
int ff = 0xff;
|
||||
int a = color >> 24 & ff;
|
||||
int r = color >> 16 & ff;
|
||||
int g = color >> 8 & ff;
|
||||
int b = color & ff;
|
||||
int a = color >> 24 & 0xff;
|
||||
int r = color >> 16 & 0xff;
|
||||
int g = color >> 8 & 0xff;
|
||||
int b = color & 0xff;
|
||||
|
||||
builder.vertex(peek.pose(), x, y, z)
|
||||
.color(r, g, b, a)
|
||||
.uv(u, v)
|
||||
.overlayCoords(OverlayTexture.NO_OVERLAY)
|
||||
.uv2(light)
|
||||
.normal(peek.normal(), n.getX(), n.getY(), n.getZ())
|
||||
.normal(peek.normal(), normal.getX(), normal.getY(), normal.getZ())
|
||||
.endVertex();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import com.jozufozu.flywheel.backend.source.Resolver;
|
|||
import com.jozufozu.flywheel.core.WorldContext;
|
||||
import com.jozufozu.flywheel.event.GatherContextEvent;
|
||||
import com.jozufozu.flywheel.util.ResourceUtil;
|
||||
import com.simibubi.create.Create;
|
||||
import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
@ -21,7 +22,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
|||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class CreateContexts {
|
||||
private static final ResourceLocation CONTRAPTION = new ResourceLocation("create", "context/contraption");
|
||||
private static final ResourceLocation CONTRAPTION = Create.asResource("context/contraption");
|
||||
|
||||
public static WorldContext<ContraptionProgram> CWORLD;
|
||||
public static WorldContext<ContraptionProgram> STRUCTURE;
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.jozufozu.flywheel.backend.IFlywheelWorld;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -73,7 +74,7 @@ public class PlacementSimulationWorld extends WrappedWorld implements IFlywheelW
|
|||
lighter.updateSectionStatus(sectionPos, false);
|
||||
}
|
||||
|
||||
if ((flags & 128) == 0) {
|
||||
if ((flags & Block.UPDATE_SUPPRESS_LIGHT) == 0) {
|
||||
lighter.checkBlock(pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#use "flywheel:context/fog.glsl"
|
||||
|
||||
out vec3 BoxCoord;
|
||||
|
||||
uniform sampler3D uLightVolume;
|
||||
|
||||
uniform sampler2D uBlockAtlas;
|
||||
|
@ -25,6 +23,8 @@ void FLWFinalizeNormal(inout vec3 normal) {
|
|||
|
||||
#if defined(VERTEX_SHADER)
|
||||
|
||||
out vec3 BoxCoord;
|
||||
|
||||
void FLWFinalizeWorldPos(inout vec4 worldPos) {
|
||||
worldPos = uModel * worldPos;
|
||||
|
||||
|
@ -40,6 +40,8 @@ void FLWFinalizeWorldPos(inout vec4 worldPos) {
|
|||
#elif defined(FRAGMENT_SHADER)
|
||||
#use "flywheel:core/lightutil.glsl"
|
||||
|
||||
in vec3 BoxCoord;
|
||||
|
||||
out vec4 FragColor;
|
||||
|
||||
vec4 FLWBlockTexture(vec2 texCoords) {
|
||||
|
|
Loading…
Reference in a new issue