Skip to content

Commit 0cb501e

Browse files
committed
added smooth video renderer
1 parent 1fadfd5 commit 0cb501e

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@
5555
</build>
5656

5757
<repositories>
58+
<repository>
59+
<id>central</id>
60+
<name>Maven Central</name>
61+
<layout>default</layout>
62+
<url>https://repo1.maven.org/maven2</url>
63+
<snapshots>
64+
<enabled>false</enabled>
65+
</snapshots>
66+
</repository>
5867
<repository>
5968
<id>dmulloy2-repo</id>
6069
<url>https://repo.dmulloy2.net/repository/public/</url>
@@ -70,6 +79,11 @@
7079
</repositories>
7180

7281
<dependencies>
82+
<dependency>
83+
<groupId>com.github.sarxos</groupId>
84+
<artifactId>webcam-capture</artifactId>
85+
<version>0.3.12</version>
86+
</dependency>
7387
<dependency>
7488
<groupId>org.spigotmc</groupId>
7589
<artifactId>spigot-api</artifactId>

readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# GRAPHICS MC
22
*GMC*
33
## GraphicsMC is a plugin for rendering images and other things on maps.
4+
### This plugin has commands and can be used on its own, but it is intended to be used as a lib. Solo use is only recommended for testing.
45
### Commands
56
`/gmcmode <MODE>`
67
Change the gmc mode to :
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.github.clientcrash.graphicsmc.graphicsmc.renderers;
2+
3+
import org.bukkit.entity.Player;
4+
import org.bukkit.map.MapCanvas;
5+
import org.bukkit.map.MapRenderer;
6+
import org.bukkit.map.MapView;
7+
8+
import java.awt.image.BufferedImage;
9+
10+
public class SmoothVideoRender extends MapRenderer {
11+
BufferedImage[] frames;
12+
int currentIndex = 0;
13+
int ticksBetweenFrames = 0;
14+
public SmoothVideoRender(BufferedImage[] frames,int startindex,int ticksBetweenFrames){
15+
this.frames = frames;
16+
this.currentIndex = startindex;
17+
this.ticksBetweenFrames = ticksBetweenFrames;
18+
}
19+
int currentTick = 0;
20+
@Override
21+
public void render(MapView map, MapCanvas canvas, Player player) {
22+
if(currentTick < ticksBetweenFrames){
23+
currentTick++;
24+
}else{
25+
currentTick=0;
26+
currentIndex++;
27+
}
28+
if(currentIndex+1 >= frames.length){currentIndex = 0;}
29+
canvas.drawImage(0,0, frames[currentIndex]);
30+
}
31+
}

0 commit comments

Comments
 (0)