#Same values
1 messages · Page 1 of 1 (latest)
Wym?
[13:40:50] [Server thread/INFO]: ================
[13:40:50] [Server thread/INFO]: PUT - ENTRY: GOLD_ORE
[13:40:50] [Server thread/INFO]: PUT - ITEMS: [md.mirrerror.thewalkingdead.utils.Drops@33552e4e]
[13:40:50] [Server thread/INFO]: ================
[13:40:50] [Server thread/INFO]: ================
[13:40:50] [Server thread/INFO]: PUT - ENTRY: LAPIS_ORE
[13:40:50] [Server thread/INFO]: PUT - ITEMS: [md.mirrerror.thewalkingdead.utils.Drops@2d78135b]
[13:40:50] [Server thread/INFO]: ================
[13:40:50] [Server thread/INFO]: Material:GOLD_ORE; drops: [md.mirrerror.thewalkingdead.utils.Drops@2d78135b]
[13:40:50] [Server thread/INFO]: Material:LAPIS_ORE; drops: [md.mirrerror.thewalkingdead.utils.Drops@2d78135b]
I put a value for the GOLD_ORE material and another one for the LAPIS_ORE material (they are not equal), but when I get the values from the map it returns me equal values
PUT - ENTRY is the key and PUT - ITEMS is the value that I put when I initialize this map
And the last two strings is the keys and values of this map
As u can see they has equal objects as the values
But on initialization they are not equal (as it has to be)
So you mean the bug is that two keys get mapped to the same value even though you mapped them to different values?
yes
I’d advice sending more code than that clinit block of yours
Drops.java: https://pastebin.com/iEM8V5kq
the way I get the values from this map:
public static List<Drops> getBlockDrops(Material material) {
return blockDrops.get(material);
}
well, can you send the entire class that code belongs to
In fact, any class that touches the map might be relevant
Possibly upload the project to smtng like GitHub or gitlab
ItemUtils.java: https://pastebin.com/sZFgAm1P
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
if(ItemUtils.getBlockDrops(block.getType()) != null) {
event.setCancelled(true);
ItemUtils.getBlockDrops(block.getType()).forEach(item -> {
int count;
if(item.getMin() == item.getMax()) count = item.getMax();
else count = item.getMin() + ThreadLocalRandom.current().nextInt(item.getMax() - item.getMin());
for(int i = 0; i < count; i++) block.getWorld().dropItemNaturally(block.getLocation(), item.getDrops());
});
block.setType(Material.AIR);
}
}
no more usages
that's all
Can you send the config itself also?
AllowedEntities:
ZOMBIE:
SpawnOnlyOnSurface: true
AdditionalSpawnCount:
Min: 0
Max: 4
ChangedBlockDrops:
GOLD_ORE:
1:
Material: 'gold_nugget'
Name: 'T1 Сера'
Tier: 1
Min: 1
Max: 1
LAPIS_ORE:
1:
Material: 'iron_nugget'
Name: 'T1 Вольфрамовая руда'
Tier: 1
Min: 1
Max: 1
if u didn't observe - it returns exactly the second value for both keys
Yes, Idk but it feels like you should just spend a minute rewriting that clinit block
It’s quite messy
Also consider to extract smaller methods
And the problem from what I can tell
Is that you reuse the same list
So when the second entry clears the list, the reflections are mirrored onto the first entry
Since their values are bound to the same list
but why when I use the put method there is not equal keys
And?