-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finally properly rendering fuel tanks
- Loading branch information
Showing
11 changed files
with
441 additions
and
80 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
common/src/main/java/org/valkyrienskies/tournament/mixin/client/MixinMinecraft.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package org.valkyrienskies.tournament.mixin.client; | ||
|
||
import kotlin.Unit; | ||
import net.minecraft.client.Minecraft; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import org.valkyrienskies.tournament.TournamentEvents; | ||
|
||
@Mixin(Minecraft.class) | ||
public class MixinMinecraft { | ||
@Inject(at = @At("TAIL"), method = "runTick") | ||
private void runTick(boolean renderLevel, CallbackInfo ci) { | ||
TournamentEvents.INSTANCE.getClientTick().emit(Unit.INSTANCE); | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
...lkyrienskies/tournament/util/rend/DefinitelyNotCopiedFromCreateSuperRenderTypeBuffer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package org.valkyrienskies.tournament.util.rend; | ||
|
||
import com.mojang.blaze3d.vertex.BufferBuilder; | ||
import com.mojang.blaze3d.vertex.VertexConsumer; | ||
import it.unimi.dsi.fastutil.objects.Object2ObjectLinkedOpenHashMap; | ||
import net.minecraft.Util; | ||
import net.minecraft.client.renderer.ChunkBufferBuilderPack; | ||
import net.minecraft.client.renderer.MultiBufferSource; | ||
import net.minecraft.client.renderer.RenderType; | ||
import net.minecraft.client.renderer.Sheets; | ||
import net.minecraft.client.resources.model.ModelBakery; | ||
|
||
import java.util.SortedMap; | ||
|
||
public class DefinitelyNotCopiedFromCreateSuperRenderTypeBuffer implements MultiBufferSource { | ||
|
||
private static final DefinitelyNotCopiedFromCreateSuperRenderTypeBuffer INSTANCE = new DefinitelyNotCopiedFromCreateSuperRenderTypeBuffer(); | ||
|
||
public static DefinitelyNotCopiedFromCreateSuperRenderTypeBuffer getInstance() { | ||
return INSTANCE; | ||
} | ||
|
||
private SuperRenderTypeBufferPhase earlyBuffer; | ||
private SuperRenderTypeBufferPhase defaultBuffer; | ||
private SuperRenderTypeBufferPhase lateBuffer; | ||
|
||
public DefinitelyNotCopiedFromCreateSuperRenderTypeBuffer() { | ||
earlyBuffer = new SuperRenderTypeBufferPhase(); | ||
defaultBuffer = new SuperRenderTypeBufferPhase(); | ||
lateBuffer = new SuperRenderTypeBufferPhase(); | ||
} | ||
|
||
public VertexConsumer getEarlyBuffer(RenderType type) { | ||
return earlyBuffer.bufferSource.getBuffer(type); | ||
} | ||
|
||
@Override | ||
public VertexConsumer getBuffer(RenderType type) { | ||
return defaultBuffer.bufferSource.getBuffer(type); | ||
} | ||
|
||
public VertexConsumer getLateBuffer(RenderType type) { | ||
return lateBuffer.bufferSource.getBuffer(type); | ||
} | ||
|
||
public void draw() { | ||
earlyBuffer.bufferSource.endBatch(); | ||
defaultBuffer.bufferSource.endBatch(); | ||
lateBuffer.bufferSource.endBatch(); | ||
} | ||
|
||
public void draw(RenderType type) { | ||
earlyBuffer.bufferSource.endBatch(type); | ||
defaultBuffer.bufferSource.endBatch(type); | ||
lateBuffer.bufferSource.endBatch(type); | ||
} | ||
|
||
private static class SuperRenderTypeBufferPhase { | ||
|
||
// Visible clones from RenderBuffers | ||
private final ChunkBufferBuilderPack fixedBufferPack = new ChunkBufferBuilderPack(); | ||
private final SortedMap<RenderType, BufferBuilder> fixedBuffers = Util.make(new Object2ObjectLinkedOpenHashMap<>(), map -> { | ||
map.put(Sheets.solidBlockSheet(), fixedBufferPack.builder(RenderType.solid())); | ||
map.put(Sheets.cutoutBlockSheet(), fixedBufferPack.builder(RenderType.cutout())); | ||
map.put(Sheets.bannerSheet(), fixedBufferPack.builder(RenderType.cutoutMipped())); | ||
map.put(Sheets.translucentCullBlockSheet(), fixedBufferPack.builder(RenderType.translucent())); | ||
put(map, Sheets.shieldSheet()); | ||
put(map, Sheets.bedSheet()); | ||
put(map, Sheets.shulkerBoxSheet()); | ||
put(map, Sheets.signSheet()); | ||
put(map, Sheets.chestSheet()); | ||
put(map, RenderType.translucentNoCrumbling()); | ||
put(map, RenderType.armorGlint()); | ||
put(map, RenderType.armorEntityGlint()); | ||
put(map, RenderType.glint()); | ||
put(map, RenderType.glintDirect()); | ||
put(map, RenderType.glintTranslucent()); | ||
put(map, RenderType.entityGlint()); | ||
put(map, RenderType.entityGlintDirect()); | ||
put(map, RenderType.waterMask()); | ||
ModelBakery.DESTROY_TYPES.forEach((p_173062_) -> { | ||
put(map, p_173062_); | ||
}); | ||
}); | ||
private final MultiBufferSource.BufferSource bufferSource = MultiBufferSource.immediateWithBuffers(fixedBuffers, new BufferBuilder(256)); | ||
|
||
private static void put(Object2ObjectLinkedOpenHashMap<RenderType, BufferBuilder> map, RenderType type) { | ||
map.put(type, new BufferBuilder(type.bufferSize())); | ||
} | ||
|
||
} | ||
|
||
} |
Oops, something went wrong.