net.minecraft.client.multiplayer.ChunkProviderClient Java Examples

The following examples show how to use net.minecraft.client.multiplayer.ChunkProviderClient. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Debug.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
public static List<TileEntity> getNearTileEntities() {
    ArrayList<TileEntity> out = new ArrayList<>();
    IChunkProvider chunkProvider = getWorld().getChunkProvider();
    if (chunkProvider instanceof ChunkProviderClient) {
        List<Chunk> chunks = ReflectionHelper.getPrivateValue(ChunkProviderClient.class, (ChunkProviderClient) chunkProvider, Mappings.chunkListing);
        chunks.forEach((chunk) -> {
            chunk.chunkTileEntityMap.values().stream().filter((entityObj) -> !(!(entityObj instanceof TileEntity))).forEachOrdered((entityObj) -> {
                out.add((TileEntity) entityObj);
            });
        });
    }
    return out;
}
 
Example #2
Source File: NoLimitClear.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onModuleEnabled() {
    try {
        Class.forName("powercrystals.minefactoryreloaded.net.ServerPacketHandler");
        int count = 0;
        IChunkProvider chunkProvider = Wrapper.INSTANCE.world().getChunkProvider();
        if (chunkProvider instanceof ChunkProviderClient) {
            ChunkProviderClient clientProvider = (ChunkProviderClient) chunkProvider;
            List<Chunk> chunks = ReflectionHelper.getPrivateValue(ChunkProviderClient.class, clientProvider, Mappings.chunkListing);
            for (Chunk chunk : chunks) {
                for (Object entityObj : chunk.chunkTileEntityMap.values()) {
                    if (!(entityObj instanceof TileEntity)) {
                        return;
                    }
                    TileEntity entity = (TileEntity) entityObj;
                    if (entity instanceof IInventory) {
                        IInventory inv = (IInventory) entity;
                        TileEntity ent = entity;
                        for (int i = 0; i < inv.getSizeInventory(); i++) {
                            setSlot(i, ent.xCoord, ent.yCoord, ent.zCoord);
                        }
                        count++;
                    }
                }
            }
        }
        InteropUtils.log("Cleared " + String.valueOf(count) + " containers", this);
        this.off();
    } catch (Exception ex) {
        this.off();
    }
}
 
Example #3
Source File: WorldDummy.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
protected IChunkProvider createChunkProvider() {
	if(this.isRemote)
		return new ChunkProviderClient(this);
	else 
		return null;
}
 
Example #4
Source File: IMixinWorldClient.java    From litematica with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Accessor
void setClientChunkProvider(ChunkProviderClient provider);