teaconmc / SlideShow

Simple slide show projector in Minecraft.
BSD 3-Clause "New" or "Revised" License
39 stars 24 forks source link

Add a feature which can show projector when a creative mode player holds the projector item. #7

Closed FledgeXu closed 3 years ago

FledgeXu commented 3 years ago

This PR solve https://github.com/teaconmc/SlideShow/issues/4. Comparing to https://github.com/teaconmc/SlideShow/pull/6, this solution doesn't need any dummy entity. Before:

image

After:

image
3TUSK commented 3 years ago

那么问题出现了,GH-6 和 GH-7 之间只能选一个,选哪个?

SeraphJACK commented 3 years ago

Donk

FledgeXu commented 3 years ago

I don’t think it will cause render performance issues. People will not hold the block too long. But, Indeed there is a better way to achieve it. However, I need to do more tests. On Oct 24, 2020, 15:24 +0800, Seraph_JACK notifications@github.com, wrote:

@SeraphJACK commented on this pull request. In src/main/java/org/teacon/slides/render/ProjectorWorldRender.java:

  • World world = player.getEntityWorld();
  • matrixStack.push();
  • Vec3d projectedView = Minecraft.getInstance().gameRenderer.getActiveRenderInfo().getProjectedView();
  • matrixStack.translate(-projectedView.x, -projectedView.y, -projectedView.z); // In default situation, the original position of matrix in world origin point. We should translate it.
  • Matrix4f matrix = matrixStack.getLast().getMatrix();
  • BlockPos.Mutable pos = new BlockPos.Mutable();
  • for (int dx = -10; dx <= 10; dx++) {
  • for (int dy = -10; dy <= 10; dy++) {
  • for (int dz = -10; dz <= 10; dz++) {
  • pos.setPos(px + dx, py + dy, pz + dz);
  • //Check ProjectorTileEntity
  • if (world.getTileEntity(pos) != null && world.getTileEntity(pos).getType() == ProjectorTileEntity.theType) { Won't this cause render performance issues? I think @ustc-zzzz 's solution is more efficient. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
ustc-zzzz commented 3 years ago

Merged to 1.15-forge branch manually.