Skip to content

Commit 1a4b6a3

Browse files
committed
Patched many bugs. (I have suffered)
Added new panorama screen
1 parent be6bafb commit 1a4b6a3

30 files changed

Lines changed: 125 additions & 96 deletions

File tree

build.gradle

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
2-
id 'java'
2+
id 'java'
3+
id 'java-library'
34
id 'eclipse'
45
id 'maven-publish'
56
id 'net.minecraftforge.gradle' version '5.1.+'
@@ -131,6 +132,7 @@ minecraft.runs.all {
131132
}
132133

133134
jar {
135+
exclude 'META-INF/*.SF', 'META-INF/*.DSA', 'META-INF/*.RSA', 'META-INF/*.MF', "META-INF/versions/9/module-info.class"
134136
manifest {
135137
attributes([
136138
"Specification-Title" : "dimensional_expansion",
@@ -142,6 +144,7 @@ jar {
142144
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
143145
])
144146
}
147+
from { configurations.library.copyRecursive().resolve().collect { it.isDirectory() ? it.absolutePath : zipTree(it.absolutePath) } }
145148
}
146149

147150
jar.finalizedBy('reobfJar')

src/main/java/net/killarexe/dimensional_expansion/client/integration/discord/DiscordUtils.java

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,17 @@ public class DiscordUtils {
1818
public static IPCClient RPC;
1919

2020
public static void start() {
21-
RPC = new IPCClient(ID);
22-
RPC.setListener(new IPCListener(){
23-
@Override
24-
public void onReady(IPCClient client) {
25-
client.sendRichPresence(DEFAULT_BUILDER.build());
26-
}
27-
});
28-
try {
21+
try {
22+
RPC = new IPCClient(ID);
23+
RPC.setListener(new IPCListener(){
24+
@Override
25+
public void onReady(IPCClient client) {
26+
client.sendRichPresence(DEFAULT_BUILDER.build());
27+
}
28+
});
2929
RPC.connect(DiscordBuild.ANY);
3030
} catch (NoDiscordClientException e) {
31-
System.out.println("Discord RPC Failed:\n" + e.getMessage());
31+
DEMod.LOGGER.info("Discord RPC Failed:\n" + e.getMessage());
3232
}
33-
/*new Thread(() -> {
34-
while(!Thread.currentThread().isInterrupted()) {
35-
try {
36-
Thread.sleep(2000);
37-
RPC.sendRichPresence(DEFAULT_BUILDER.setEndTimestamp(System.currentTimeMillis()).build(), null, false);
38-
} catch (InterruptedException e) {}
39-
}
40-
}, "RPC").start();*/
4133
}
4234
}

src/main/java/net/killarexe/dimensional_expansion/client/integration/discord/IPCClient.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package net.killarexe.dimensional_expansion.client.integration.discord;
1717

18-
import org.slf4j.Logger;
19-
import org.slf4j.LoggerFactory;
20-
2118
import com.google.gson.JsonObject;
2219

2320
import net.killarexe.dimensional_expansion.client.integration.discord.entities.Callback;
@@ -37,6 +34,9 @@
3734

3835
import javax.json.JsonException;
3936

37+
import org.apache.logging.log4j.LogManager;
38+
import org.apache.logging.log4j.Logger;
39+
4040
/**
4141
* Represents a Discord IPC Client that can send and receive
4242
* Rich Presence data.<p>
@@ -62,7 +62,7 @@
6262
*/
6363
public final class IPCClient implements Closeable
6464
{
65-
private static final Logger LOGGER = LoggerFactory.getLogger(IPCClient.class);
65+
private static final Logger LOGGER = LogManager.getLogger();
6666
private final long clientId;
6767
private final HashMap<String,Callback> callbacks = new HashMap<>();
6868
private volatile Pipe pipe;
@@ -122,7 +122,7 @@ public void connect(DiscordBuild... preferredOrder) throws NoDiscordClientExcept
122122

123123
pipe = Pipe.openPipe(this, clientId, callbacks, preferredOrder);
124124

125-
LOGGER.debug("Client is now connected and ready!");
125+
LOGGER.info("Client is now connected and ready!");
126126
if(listener != null)
127127
listener.onReady(this);
128128
startReading();
@@ -177,7 +177,7 @@ public void sendRichPresence(RichPresence presence, Callback callback, boolean l
177177
{
178178
checkConnected(true);
179179
if(log) {
180-
LOGGER.debug("Sending RichPresence to discord: "+(presence == null ? null : presence.toJson().toString()));
180+
LOGGER.info("Sending RichPresence to discord: "+(presence == null ? null : presence.toJson().toString()));
181181
}
182182
JsonObject command = new JsonObject();
183183
JsonObject args = new JsonObject();
@@ -230,7 +230,7 @@ public void subscribe(Event sub, Callback callback)
230230
checkConnected(true);
231231
if(!sub.isSubscribable())
232232
throw new IllegalStateException("Cannot subscribe to "+sub+" event!");
233-
LOGGER.debug(String.format("Subscribing to Event: %s", sub.name()));
233+
LOGGER.info(String.format("Subscribing to Event: %s", sub.name()));
234234
JsonObject command = new JsonObject();
235235
command.addProperty("cmd", "SUBSCRIBE");
236236
command.addProperty("evt", sub.name());
@@ -265,7 +265,7 @@ public void close()
265265
try {
266266
pipe.close();
267267
} catch (IOException e) {
268-
LOGGER.debug("Failed to close pipe", e);
268+
LOGGER.info("Failed to close pipe", e);
269269
}
270270
}
271271

@@ -385,19 +385,19 @@ private void startReading()
385385
break;
386386

387387
case ACTIVITY_JOIN:
388-
LOGGER.debug("Reading thread received a 'join' event.");
388+
LOGGER.info("Reading thread received a 'join' event.");
389389
break;
390390

391391
case ACTIVITY_SPECTATE:
392-
LOGGER.debug("Reading thread received a 'spectate' event.");
392+
LOGGER.info("Reading thread received a 'spectate' event.");
393393
break;
394394

395395
case ACTIVITY_JOIN_REQUEST:
396-
LOGGER.debug("Reading thread received a 'join request' event.");
396+
LOGGER.info("Reading thread received a 'join request' event.");
397397
break;
398398

399399
case UNKNOWN:
400-
LOGGER.debug("Reading thread encountered an event with an unknown type: " +
400+
LOGGER.info("Reading thread encountered an event with an unknown type: " +
401401
json.get("evt").getAsString());
402402
break;
403403
default:
@@ -454,8 +454,7 @@ private void startReading()
454454
listener.onDisconnect(this, ex);
455455
}
456456
});
457-
458-
LOGGER.debug("Starting IPCClient reading thread!");
457+
LOGGER.info("Starting IPCClient reading thread!");
459458
readThread.start();
460459
}
461460

src/main/java/net/killarexe/dimensional_expansion/client/integration/discord/entities/pipe/Pipe.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
*/
1616
package net.killarexe.dimensional_expansion.client.integration.discord.entities.pipe;
1717

18-
import org.slf4j.Logger;
19-
import org.slf4j.LoggerFactory;
20-
2118
import com.google.gson.JsonObject;
2219

2320
import net.killarexe.dimensional_expansion.client.integration.discord.IPCClient;
@@ -36,9 +33,13 @@
3633

3734
import javax.json.JsonException;
3835

36+
import org.apache.logging.log4j.LogManager;
37+
import org.apache.logging.log4j.Logger;
38+
3939
public abstract class Pipe {
4040

41-
private static final Logger LOGGER = LoggerFactory.getLogger(Pipe.class);
41+
private static final Logger LOGGER = LogManager.getLogger();
42+
4243
private static final int VERSION = 1;
4344
protected PipeStatus status = PipeStatus.CONNECTING;
4445
protected IPCListener listener;
@@ -71,7 +72,7 @@ public static Pipe openPipe(IPCClient ipcClient, long clientId, HashMap<String,C
7172
if(!new File(location).exists()) {
7273
throw new IOException();
7374
}
74-
LOGGER.debug(String.format("Searching for IPC: %s", location));
75+
LOGGER.info(String.format("Searching for IPC: %s", location));
7576
pipe = createPipe(ipcClient, callbacks, location);
7677
JsonObject info = new JsonObject();
7778
info.addProperty("v", VERSION);
@@ -83,7 +84,7 @@ public static Pipe openPipe(IPCClient ipcClient, long clientId, HashMap<String,C
8384
.getAsJsonObject("config")
8485
.get("api_endpoint").getAsString());
8586

86-
LOGGER.debug(String.format("Found a valid client (%s) with packet: %s", pipe.build.name(), p.toString()));
87+
LOGGER.info(String.format("Found a valid client (%s) with packet: %s", pipe.build.name(), p.toString()));
8788
// we're done if we found our first choice
8889
if(pipe.build == preferredOrder[0] || DiscordBuild.ANY == preferredOrder[0])
8990
{
@@ -111,7 +112,7 @@ public static Pipe openPipe(IPCClient ipcClient, long clientId, HashMap<String,C
111112
for(int i = 1; i < preferredOrder.length; i++)
112113
{
113114
DiscordBuild cb = preferredOrder[i];
114-
LOGGER.debug(String.format("Looking for client build: %s", cb.name()));
115+
LOGGER.info(String.format("Looking for client build: %s", cb.name()));
115116
if(open[cb.ordinal()] != null)
116117
{
117118
pipe = open[cb.ordinal()];
@@ -150,7 +151,7 @@ public static Pipe openPipe(IPCClient ipcClient, long clientId, HashMap<String,C
150151
} catch(IOException ex) {
151152
// This isn't really important to applications and better
152153
// as debug info
153-
LOGGER.debug("Failed to close an open IPC pipe!", ex);
154+
LOGGER.info("Failed to close an open IPC pipe!", ex);
154155
}
155156
}
156157
}

src/main/java/net/killarexe/dimensional_expansion/client/integration/discord/entities/pipe/ipml/UnixPipe.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616

1717
package net.killarexe.dimensional_expansion.client.integration.discord.entities.pipe.ipml;
1818

19+
import org.apache.logging.log4j.LogManager;
20+
import org.apache.logging.log4j.Logger;
1921
import org.newsclub.net.unix.AFUNIXSocket;
2022
import org.newsclub.net.unix.AFUNIXSocketAddress;
21-
import org.slf4j.Logger;
22-
import org.slf4j.LoggerFactory;
2323

2424
import com.google.gson.Gson;
2525
import com.google.gson.JsonObject;
@@ -41,16 +41,15 @@
4141
public class UnixPipe extends Pipe
4242
{
4343

44-
private static final Logger LOGGER = LoggerFactory.getLogger(UnixPipe.class);
44+
private static final Logger LOGGER = LogManager.getLogger();
4545
private final AFUNIXSocket socket;
4646

47-
@SuppressWarnings("deprecation")
4847
public UnixPipe(IPCClient ipcClient, HashMap<String, Callback> callbacks, String location) throws IOException
4948
{
5049
super(ipcClient, callbacks);
5150
LOGGER.info("CONNECTING...");
5251
socket = AFUNIXSocket.newInstance();
53-
socket.connect(new AFUNIXSocketAddress(new File(location)));
52+
socket.connect(AFUNIXSocketAddress.of(new File(location)));
5453
LOGGER.info("CONNECTED!");
5554
}
5655

@@ -103,7 +102,7 @@ public void write(byte[] b) throws IOException
103102
@Override
104103
public void close() throws IOException
105104
{
106-
LOGGER.debug("Closing IPC pipe...");
105+
LOGGER.info("Closing IPC pipe...");
107106
send(Packet.OpCode.CLOSE, new JsonObject(), null);
108107
status = PipeStatus.CLOSED;
109108
socket.close();

src/main/java/net/killarexe/dimensional_expansion/client/integration/discord/entities/pipe/ipml/WindowsPipe.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616

1717
package net.killarexe.dimensional_expansion.client.integration.discord.entities.pipe.ipml;
1818

19-
import org.slf4j.Logger;
20-
import org.slf4j.LoggerFactory;
19+
import org.apache.logging.log4j.LogManager;
20+
import org.apache.logging.log4j.Logger;
2121

2222
import com.google.gson.Gson;
2323
import com.google.gson.JsonObject;
@@ -38,7 +38,7 @@
3838
public class WindowsPipe extends Pipe
3939
{
4040

41-
private static final Logger LOGGER = LoggerFactory.getLogger(WindowsPipe.class);
41+
private static final Logger LOGGER = LogManager.getLogger();
4242

4343
private final RandomAccessFile file;
4444

@@ -86,7 +86,7 @@ public Packet read() throws IOException, JsonException {
8686

8787
@Override
8888
public void close() throws IOException {
89-
LOGGER.debug("Closing IPC pipe...");
89+
LOGGER.info("Closing IPC pipe...");
9090
send(Packet.OpCode.CLOSE, new JsonObject(), null);
9191
status = PipeStatus.CLOSED;
9292
file.close();

src/main/java/net/killarexe/dimensional_expansion/common/block/OriginPortalBlock.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public static void portalSpawn(Level level, BlockPos pos) {
3737
}
3838
}
3939

40+
@Override
41+
public void randomTick(BlockState pState, ServerLevel pLevel, BlockPos pPos, RandomSource pRandom) {
42+
}
43+
4044
@Override
4145
public BlockState updateShape(BlockState pState, Direction pFacing, BlockState pFacingState, LevelAccessor pLevel,
4246
BlockPos pCurrentPos, BlockPos pFacingPos) {

src/main/java/net/killarexe/dimensional_expansion/common/block/StrippingMap.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
11
package net.killarexe.dimensional_expansion.common.block;
22

3+
import com.google.common.collect.ImmutableMap;
4+
35
import net.killarexe.dimensional_expansion.DEMod;
46
import net.killarexe.dimensional_expansion.core.init.DEBlocks;
57
import net.minecraft.world.item.AxeItem;
8+
import net.minecraft.world.level.block.Block;
69

710
public class StrippingMap {
11+
12+
public static void putStrippable(Block input, Block output) throws Exception{
13+
AxeItem.STRIPPABLES = new ImmutableMap.Builder<Block, Block>().putAll(AxeItem.STRIPPABLES).put(input, output).build();
14+
}
15+
816
public static void putStrippables(){
917
try {
10-
AxeItem.STRIPPABLES.put(DEBlocks.PURPLEHEART_LOG.get(), DEBlocks.STRIPPED_PURPLEHEART_LOG.get());
18+
putStrippable(DEBlocks.PURPLEHEART_LOG.get(), DEBlocks.STRIPPED_PURPLEHEART_LOG.get());
1119
}catch(Exception e) {
1220
DEMod.LOGGER.error("Failed to put Strippables: " + e.getLocalizedMessage() + " (Don't worry if you see this message i don't know why it do this error but it's there wait for the MinecraftForge Team to fix it - Killar.exe)");
1321
}

src/main/java/net/killarexe/dimensional_expansion/common/item/OriginPortalKey.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package net.killarexe.dimensional_expansion.common.item;
22

3-
import net.killarexe.dimensional_expansion.DEMod;
43
import net.killarexe.dimensional_expansion.common.block.OriginPortalBlock;
54
import net.minecraft.core.BlockPos;
65
import net.minecraft.world.InteractionResult;
@@ -23,15 +22,13 @@ public InteractionResult useOn(UseOnContext pContext) {
2322
ItemStack item = pContext.getItemInHand();
2423
Level level = pContext.getLevel();
2524
if(!player.mayUseItemAt(pos, pContext.getClickedFace(), item)) {
26-
DEMod.LOGGER.warn("Failed to create portal");
2725
return InteractionResult.FAIL;
2826
}
2927
if(level.isEmptyBlock(pos)) {
30-
OriginPortalBlock.portalSpawn(level, pos);
3128
item.hurtAndBreak(1, player, c -> c.broadcastBreakEvent(pContext.getHand()));
29+
OriginPortalBlock.portalSpawn(level, pos);
3230
return InteractionResult.SUCCESS;
3331
}
34-
DEMod.LOGGER.warn("Failed to create portal");
3532
return InteractionResult.FAIL;
3633
}
3734
}

src/main/java/net/killarexe/dimensional_expansion/core/init/DEItems.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private static void addRemoteProperties(Item item) {
252252
ItemProperties.register(item, new ResourceLocation("duration"), new ClampedItemPropertyFunction() {
253253
@Override
254254
public float unclampedCall(ItemStack pStack, ClientLevel pLevel, LivingEntity pEntity, int pSeed) {
255-
if(pLevel == null && pEntity.getLevel() instanceof ClientLevel level) {
255+
if(pLevel == null && pEntity.getLevel() instanceof @SuppressWarnings("resource") ClientLevel level) {
256256
pLevel = level;
257257
}
258258
if(pLevel == null) {

0 commit comments

Comments
 (0)