mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-08 16:32:01 +01:00
Check minecart metadata presence instead of always setting default as stone
This commit is contained in:
parent
7e87f2ff27
commit
7a99819c0a
@ -1869,8 +1869,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(0));
|
||||
}
|
||||
|
@ -1927,8 +1927,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(0));
|
||||
}
|
||||
|
@ -1935,8 +1935,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(Block.getByCombinedId(mat.getId()).getBlock().getBlockData());
|
||||
}
|
||||
|
@ -2036,8 +2036,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(IRegistry.BLOCK.get(MinecraftKey.a(mat.getKey().toString())).getBlockData());
|
||||
}
|
||||
|
@ -2110,8 +2110,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(IRegistry.BLOCK.get(MinecraftKey.a(mat.getKey().toString())).getBlockData());
|
||||
}
|
||||
|
@ -2149,14 +2149,13 @@ public class NMSImpl implements NMSBridge {
|
||||
return navigation.m();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void minecartItemLogic(EntityMinecartAbstract minecart) {
|
||||
NPC npc = ((NPCHolder) minecart).getNPC();
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(IRegistry.BLOCK.get(MinecraftKey.a(mat.getKey().toString())).getBlockData());
|
||||
}
|
||||
|
@ -2146,8 +2146,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(IRegistry.BLOCK.get(MinecraftKey.a(mat.getKey().toString())).getBlockData());
|
||||
}
|
||||
|
@ -2146,8 +2146,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.setCustomDisplay(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.setCustomDisplay(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (minecart.hasCustomDisplay()) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlockState(
|
||||
Registry.BLOCK.get(ResourceLocation.tryParse(mat.getKey().toString())).defaultBlockState());
|
||||
|
@ -2154,8 +2154,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.setCustomDisplay(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.setCustomDisplay(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (minecart.hasCustomDisplay()) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlockState(
|
||||
Registry.BLOCK.get(ResourceLocation.tryParse(mat.getKey().toString())).defaultBlockState());
|
||||
|
@ -2387,8 +2387,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.setCustomDisplay(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.setCustomDisplay(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (minecart.hasCustomDisplay()) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlockState(BuiltInRegistries.BLOCK
|
||||
.get(ResourceLocation.tryParse(mat.getKey().toString())).defaultBlockState());
|
||||
|
@ -2462,8 +2462,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.setCustomDisplay(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.setCustomDisplay(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (minecart.hasCustomDisplay()) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlockState(BuiltInRegistries.BLOCK
|
||||
.get(ResourceLocation.tryParse(mat.getKey().toString())).defaultBlockState());
|
||||
|
@ -2346,8 +2346,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.setCustomDisplay(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.setCustomDisplay(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (minecart.hasCustomDisplay()) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlockState(BuiltInRegistries.BLOCK
|
||||
.getValue(ResourceLocation.parse(mat.getKey().toString())).defaultBlockState());
|
||||
|
@ -1731,8 +1731,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (npc == null)
|
||||
return;
|
||||
int offset = npc.data().get(NPC.Metadata.MINECART_OFFSET, 0);
|
||||
minecart.a(npc.getItemProvider().get() != null);
|
||||
if (npc.getItemProvider().get() != null) {
|
||||
minecart.a(npc.data().has(NPC.Metadata.ITEM_ID));
|
||||
if (npc.data().has(NPC.Metadata.ITEM_ID)) {
|
||||
Material mat = npc.getItemProvider().get().getType();
|
||||
minecart.setDisplayBlock(Block.getById(mat.getId()).fromLegacyData(0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user