-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow block entity data to be updated with block placement
- Loading branch information
Showing
4 changed files
with
76 additions
and
34 deletions.
There are no files selected for viewing
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
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
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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/gdmc/httpinterfacemod/utils/TagComparator.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,30 @@ | ||
package com.gdmc.httpinterfacemod.utils; | ||
|
||
import net.minecraft.nbt.CompoundTag; | ||
import net.minecraft.nbt.Tag; | ||
|
||
public class TagComparator { | ||
|
||
public static boolean contains(CompoundTag existingCompound, CompoundTag newCompound) { | ||
if (existingCompound == newCompound) { | ||
return true; | ||
} | ||
|
||
if (existingCompound.isEmpty() != newCompound.isEmpty()) { | ||
return false; | ||
} | ||
|
||
for (String newCompoundKey : newCompound.getAllKeys()) { | ||
Tag existingTag = existingCompound.get(newCompoundKey); | ||
if (existingTag == null) { | ||
return false; | ||
} | ||
if (!existingTag.equals(newCompound.get(newCompoundKey))) { | ||
return false; | ||
} | ||
} | ||
|
||
return true; | ||
} | ||
|
||
} |