Skip to content

Commit

Permalink
fixing forge being dumb yet again
Browse files Browse the repository at this point in the history
  • Loading branch information
ImplementsLegend committed Oct 13, 2024
1 parent a3803ce commit e6c1019
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import net.minecraftforge.registries.ForgeRegistry
val BLOCKS by lazy {
val data = (ForgeRegistries.BLOCKS as ForgeRegistry<Block>).values

val result = IdMapper<Block>(data.maxOf { (it as IndexedBlock).registryIndex }+1)
data.forEach {
result.addMapping(it,(it as IndexedBlock).registryIndex)
val result = IdMapper<Block>(data.count()/*data.maxOf { (it as IndexedBlock).registryIndex }+1*/)
data.forEachIndexed { index, it ->
result.addMapping(it,index)
}
result
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package implementslegend.mod.vaultfaster.mixin;

import implementslegend.mod.vaultfaster.FixatedBlockIDsKt;
import implementslegend.mod.vaultfaster.interfaces.IndexedBlock;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistry;
Expand All @@ -16,10 +18,13 @@ public class MixinBlockRegistryIndex implements IndexedBlock {
private int registryIndex = -1;
@Override
public int getRegistryIndex() {
/*
if(registryIndex<0){
registryIndex= ((ForgeRegistry)ForgeRegistries.BLOCKS).getID((BlockBehaviour) (Object)this);
}
return registryIndex;
*/
return FixatedBlockIDsKt.getIdForBlock((Block)(Object) this);
}

@Override
Expand Down

0 comments on commit e6c1019

Please sign in to comment.